@opra/common 1.0.0-alpha.37 → 1.0.0-alpha.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/browser/index.cjs +5 -5
  2. package/browser/index.mjs +5 -5
  3. package/cjs/document/data-type/complex-type-base.js +1 -1
  4. package/cjs/document/data-type/extended-types/filter.type.js +1 -1
  5. package/cjs/filter/filter-rules.js +17 -16
  6. package/cjs/helpers/index.js +1 -0
  7. package/cjs/helpers/safe-json-stringify.js +16 -0
  8. package/cjs/schema/index.js +2 -27
  9. package/cjs/schema/opra-schema.js +24 -0
  10. package/esm/document/data-type/complex-type-base.js +1 -1
  11. package/esm/document/data-type/extended-types/filter.type.js +1 -1
  12. package/esm/filter/filter-rules.js +10 -9
  13. package/esm/helpers/index.js +1 -0
  14. package/esm/helpers/safe-json-stringify.js +13 -0
  15. package/esm/schema/index.js +2 -27
  16. package/esm/schema/opra-schema.js +21 -0
  17. package/package.json +2 -2
  18. package/types/document/api-document.d.ts +1 -1
  19. package/types/document/common/data-type-map.d.ts +1 -1
  20. package/types/document/common/document-node.d.ts +1 -1
  21. package/types/document/common/value.d.ts +1 -1
  22. package/types/document/data-type/api-field.d.ts +1 -1
  23. package/types/document/data-type/complex-type-base.d.ts +3 -4
  24. package/types/document/data-type/complex-type.d.ts +1 -1
  25. package/types/document/data-type/data-type.d.ts +2 -2
  26. package/types/document/data-type/enum-type.d.ts +2 -2
  27. package/types/document/data-type/extended-types/base64.type.d.ts +1 -1
  28. package/types/document/data-type/extended-types/date-string.type.d.ts +1 -1
  29. package/types/document/data-type/extended-types/date-time-string.type.d.ts +1 -1
  30. package/types/document/data-type/extended-types/date-time.type.d.ts +1 -1
  31. package/types/document/data-type/extended-types/date.type.d.ts +1 -1
  32. package/types/document/data-type/extended-types/email.type.d.ts +1 -1
  33. package/types/document/data-type/extended-types/field-path.type.d.ts +3 -3
  34. package/types/document/data-type/extended-types/filter.type.d.ts +3 -3
  35. package/types/document/data-type/extended-types/object-id.type.d.ts +1 -1
  36. package/types/document/data-type/extended-types/operation-result.type.d.ts +2 -2
  37. package/types/document/data-type/extended-types/time.type.d.ts +1 -1
  38. package/types/document/data-type/extended-types/url.type.d.ts +1 -1
  39. package/types/document/data-type/extended-types/uuid.type.d.ts +1 -1
  40. package/types/document/data-type/mapped-type.d.ts +1 -1
  41. package/types/document/data-type/mixin-type.d.ts +1 -1
  42. package/types/document/data-type/omit-type.d.ts +1 -1
  43. package/types/document/data-type/partial-type.d.ts +1 -1
  44. package/types/document/data-type/pick-type.d.ts +1 -1
  45. package/types/document/data-type/primitive-types/any.type.d.ts +1 -1
  46. package/types/document/data-type/primitive-types/bigint.type.d.ts +1 -1
  47. package/types/document/data-type/primitive-types/boolean.type.d.ts +1 -1
  48. package/types/document/data-type/primitive-types/integer.type.d.ts +1 -1
  49. package/types/document/data-type/primitive-types/null.type.d.ts +1 -1
  50. package/types/document/data-type/primitive-types/number.type.d.ts +1 -1
  51. package/types/document/data-type/primitive-types/string.type.d.ts +1 -1
  52. package/types/document/data-type/required-type.d.ts +1 -1
  53. package/types/document/data-type/simple-type.d.ts +2 -2
  54. package/types/document/data-type/utils/create-mapped-class.d.ts +1 -1
  55. package/types/document/decorators/http-controller.decorator.d.ts +1 -1
  56. package/types/document/decorators/http-operation-entity.decorator.d.ts +2 -2
  57. package/types/document/decorators/http-operation.decorator.d.ts +1 -1
  58. package/types/document/factory/api-document.factory.d.ts +1 -1
  59. package/types/document/factory/data-type.factory.d.ts +1 -1
  60. package/types/document/factory/http-api.factory.d.ts +1 -1
  61. package/types/document/http/http-api.d.ts +1 -1
  62. package/types/document/http/http-controller.d.ts +1 -1
  63. package/types/document/http/http-media-type.d.ts +2 -2
  64. package/types/document/http/http-multipart-field.d.ts +1 -1
  65. package/types/document/http/http-operation-response.d.ts +1 -1
  66. package/types/document/http/http-operation.d.ts +2 -2
  67. package/types/document/http/http-parameter.d.ts +1 -1
  68. package/types/document/http/http-request-body.d.ts +1 -1
  69. package/types/exception/http-errors/bad-request.error.d.ts +1 -1
  70. package/types/exception/http-errors/conflict.error.d.ts +1 -1
  71. package/types/exception/http-errors/failed-dependency.error.d.ts +1 -1
  72. package/types/exception/http-errors/forbidden.error.d.ts +1 -1
  73. package/types/exception/http-errors/internal-server.error.d.ts +1 -1
  74. package/types/exception/http-errors/method-not-allowed.error.d.ts +1 -1
  75. package/types/exception/http-errors/not-acceptable.error.d.ts +1 -1
  76. package/types/exception/http-errors/not-found.error.d.ts +1 -1
  77. package/types/exception/http-errors/permission.error.d.ts +1 -1
  78. package/types/exception/http-errors/unauthorized.error.d.ts +1 -1
  79. package/types/exception/http-errors/unprocessable-entity.error.d.ts +1 -1
  80. package/types/exception/opra-exception.d.ts +1 -1
  81. package/types/exception/opra-http-error.d.ts +1 -1
  82. package/types/filter/antlr/OpraFilterParser.d.ts +1 -1
  83. package/types/filter/ast/expressions/comparison-expression.d.ts +1 -1
  84. package/types/filter/errors.d.ts +1 -1
  85. package/types/filter/filter-rules.d.ts +5 -5
  86. package/types/filter/opra-error-listener.d.ts +1 -1
  87. package/types/helpers/function-utils.d.ts +1 -1
  88. package/types/helpers/index.d.ts +1 -0
  89. package/types/helpers/mixin-utils.d.ts +1 -1
  90. package/types/helpers/object-utils.d.ts +1 -1
  91. package/types/helpers/safe-json-stringify.d.ts +1 -0
  92. package/types/helpers/type-guards.d.ts +1 -1
  93. package/types/i18n/i18n.d.ts +2 -2
  94. package/types/i18n/translate.d.ts +1 -1
  95. package/types/schema/{document.interface.d.ts → api-document.interface.d.ts} +3 -3
  96. package/types/schema/data-type/complex-type.interface.d.ts +1 -1
  97. package/types/schema/data-type/enum-type.interface.d.ts +1 -1
  98. package/types/schema/data-type/mapped-type.interface.d.ts +1 -1
  99. package/types/schema/data-type/mixin-type.interface.d.ts +1 -1
  100. package/types/schema/http/http-parameter.interface.d.ts +1 -1
  101. package/types/schema/index.d.ts +2 -62
  102. package/types/schema/opra-schema.d.ts +21 -0
  103. package/types/schema/type-guards.d.ts +1 -1
  104. /package/cjs/schema/{document.interface.js → api-document.interface.js} +0 -0
  105. /package/esm/schema/{document.interface.js → api-document.interface.js} +0 -0
package/browser/index.cjs CHANGED
@@ -3,10 +3,10 @@
3
3
  * http://www.panates.com
4
4
  *****************************************/
5
5
 
6
- "use strict";var xa=Object.create;var Gt=Object.defineProperty;var ga=Object.getOwnPropertyDescriptor;var Oa=Object.getOwnPropertyNames;var Ra=Object.getPrototypeOf,Aa=Object.prototype.hasOwnProperty;var s=(i,e)=>Gt(i,"name",{value:e,configurable:!0});var xs=(i,e)=>{for(var t in e)Gt(i,t,{get:e[t],enumerable:!0})},gs=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Oa(e))!Aa.call(i,n)&&n!==t&&Gt(i,n,{get:()=>e[n],enumerable:!(r=ga(e,n))||r.enumerable});return i};var ie=(i,e,t)=>(t=i!=null?xa(Ra(i)):{},gs(e||!i||!i.__esModule?Gt(t,"default",{value:i,enumerable:!0}):t,i)),ba=i=>gs(Gt({},"__esModule",{value:!0}),i);var $p={};xs($p,{AnyType:()=>br,ApiBase:()=>nr,ApiDocument:()=>Ne,ApiDocumentFactory:()=>Ts,ApiField:()=>k,BUILTIN:()=>Ae,BadRequestError:()=>Rn,Base64Type:()=>lr,BaseI18n:()=>js,BigintType:()=>wr,BooleanType:()=>Nr,CLASS_NAME_PATTERN:()=>K,ComplexType:()=>Z,ConflictError:()=>bn,DATATYPE_METADATA:()=>E,DECODER:()=>T,DECORATOR:()=>I,DataType:()=>R,DataTypeMap:()=>Ee,DateStringType:()=>Xe,DateTimeStringType:()=>He,DateTimeType:()=>Ze,DateType:()=>Qe,DocumentElement:()=>w,DocumentInitContext:()=>le,DocumentNode:()=>tr,ENCODER:()=>g,EXTRACT_TYPENAME_PATTERN:()=>Xt,EmailType:()=>W,EnumType:()=>fe,FailedDependencyError:()=>Nn,FieldPathType:()=>te,FieldsProjection:()=>be,FilterType:()=>pe,ForbiddenError:()=>mr,HTTP_CONTROLLER_METADATA:()=>ne,HttpApi:()=>sr,HttpController:()=>ee,HttpHeaderCodes:()=>pn,HttpMediaType:()=>_e,HttpMultipartField:()=>ar,HttpOperation:()=>D,HttpOperationResponse:()=>pr,HttpParameter:()=>Et,HttpRequestBody:()=>cr,HttpStatusCode:()=>N,HttpStatusMessages:()=>ip,HttpStatusRange:()=>Tt,I18n:()=>yt,IntegerType:()=>Ce,InternalServerError:()=>In,IssueSeverity:()=>Wn,MappedType:()=>we,MethodNotAllowedError:()=>Ln,MimeTypes:()=>L,MixinType:()=>We,NAMESPACE_PATTERN:()=>Ei,NotAcceptableError:()=>Pn,NotFoundError:()=>kn,NullType:()=>Dr,NumberType:()=>ue,ObjectIdType:()=>Or,ObjectType:()=>Sr,OmitType:()=>jp,OperationResult:()=>Q,OpraDocumentError:()=>Ge,OpraException:()=>de,OpraFilter:()=>J,OpraHttpError:()=>b,OpraSchema:()=>d,PartialType:()=>Up,PermissionError:()=>Un,PickType:()=>Cp,RequiredType:()=>Bp,ResourceConflictError:()=>Bn,ResourceNotAvailableError:()=>$n,ResponsiveMap:()=>F,SimpleType:()=>u,StringType:()=>Re,TimeType:()=>ct,UnauthorizedError:()=>Kn,UnprocessableEntityError:()=>Jn,UrlType:()=>Ar,UuidType:()=>jt,classes:()=>Es,cloneObject:()=>M,getErrorStack:()=>Fa,getStackFileName:()=>Pa,i18n:()=>Fr,inheritPropertyInitializers:()=>Qt,isAsyncIterable:()=>va,isBlob:()=>Sa,isConstructor:()=>Wt,isFormData:()=>Ia,isIterable:()=>La,isReadable:()=>wa,isReadableStream:()=>Da,isStream:()=>Mr,isURL:()=>Ma,isWritable:()=>Na,kCtorMap:()=>Zt,kDataTypeMap:()=>V,kTypeNSMap:()=>Te,mergePrototype:()=>Yt,omitNullish:()=>bs,omitUndefined:()=>x,parse:()=>gi,parseFieldsProjection:()=>xi,resolveThunk:()=>ye,translate:()=>A,uid:()=>_a.uid});module.exports=ba($p);var WT=require("reflect-metadata");BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});var Os=ie(require("putil-promisify"),1);function Wt(i){return typeof i=="function"&&i.prototype&&i.prototype.constructor===i&&i.prototype.constructor.name!=="Function"&&i.prototype.constructor.name!=="embedded"}s(Wt,"isConstructor");function Mr(i){return i!==null&&typeof i=="object"&&typeof i.pipe=="function"}s(Mr,"isStream");function wa(i){return Mr(i)&&typeof i._read=="function"&&typeof i._readableState=="object"}s(wa,"isReadable");function Na(i){return Mr(i)&&typeof i._write=="function"}s(Na,"isWritable");function Da(i){return Mr(i)&&typeof i.getReader=="function"&&typeof i.pipeThrough=="function"&&typeof i.pipeTo=="function"}s(Da,"isReadableStream");function Sa(i){return i!==null&&typeof i=="object"&&typeof i.size=="number"&&typeof i.arrayBuffer=="function"&&typeof i.stream=="function"}s(Sa,"isBlob");function Ia(i){return i!==null&&typeof i.constructor=="function"&&i.constructor.name==="FormData"&&typeof i.append=="function"&&typeof i.getAll=="function"}s(Ia,"isFormData");function Ma(i){return i!==null&&typeof i=="object"&&typeof i.host=="string"&&typeof i.href=="string"}s(Ma,"isURL");function La(i){return Symbol.iterator in i}s(La,"isIterable");function va(i){return Symbol.asyncIterator in i}s(va,"isAsyncIterable");async function ye(i){return i=Os.default.isPromise(i)?await i:i,typeof i=="function"?Wt(i)?i:await i():i}s(ye,"resolveThunk");var Rs=/^(?:file:\/\/)?(.+)$/;function Pa(i=1){if(i>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+i+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,n)=>n;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[i]?t[i].getFileName():void 0,n=r?Rs.exec(r):void 0;return n?n[1]:""}return""}s(Pa,"getStackFileName");function Fa(i=1){if(i>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+i+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,n)=>n;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[i]?t[i].getFileName():void 0,n=r?Rs.exec(r):void 0;return n?n[1]:""}return""}s(Fa,"getErrorStack");function Yt(i,e,t){for(let r of Object.getOwnPropertyNames(e))r==="constructor"||r==="__proto__"||r==="toJSON"||r==="toString"||t&&!t(r)||Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(e,r)||Object.create(null))}s(Yt,"mergePrototype");function Qt(i,e,t=r=>!0){try{let r=new e;Object.getOwnPropertyNames(r).filter(o=>typeof r[o]<"u"&&typeof i[o]>"u").filter(o=>t(o)).forEach(o=>{i[o]=r[o]})}catch{}}s(Qt,"inheritPropertyInitializers");var Lr=ie(require("putil-isplainobject"),1),As=ie(require("putil-merge"),1);var E=Symbol.for("opra.type.metadata"),ne=Symbol("opra.http-controller.metadata"),T=Symbol.for("opra.type.decoder"),g=Symbol("opra.type.encoder"),I=Symbol.for("DECORATOR"),Ae=Symbol.for("BUILTIN"),Ei=/([a-z$_]\w+):(.+)/i,K=/^[a-z][\w_]*$/i,Xt=/^(.*)Type(\d*)$/,V=Symbol.for("kDataTypeMap"),Zt=Symbol.for("kCtorMap"),Te=Symbol.for("kTypeNSMap");function M(i,e){return(0,As.default)({},i,{deep:s(t=>(0,Lr.default)(t)&&!t[E],"deep"),descriptor:!0,filter:s((t,r)=>{let n=t[r];return!e||typeof n!="function"&&(typeof n!="object"||(0,Lr.default)(n)||Array.isArray(n))},"filter")})}s(M,"cloneObject");function x(i,e){if(!(i&&typeof i=="object"))return i;for(let t of Object.keys(i))i[t]===void 0?delete i[t]:e&&typeof i[t]=="object"&&x(i[t]);return i}s(x,"omitUndefined");function bs(i,e){if(!(i&&typeof i=="object"))return i;for(let t of Object.keys(i))i[t]==null?delete i[t]:e&&(0,Lr.default)(i[t])&&bs(i[t]);return i}s(bs,"omitNullish");var _i=require("fast-tokenizer");var ka=/^([+-])?([a-z_$]\w*)$/i,ja=/[^.]\(/g,Oi=class Oi{};s(Oi,"FieldsProjection");var be=Oi;(function(i){let t=class t{};s(t,"Item");let e=t;i.Item=e})(be||(be={}));function xi(i,e){let t=Array.isArray(i)?i:[i];if(!(t&&t.length))return;let r=new be;for(let n of t)e||(n=n.toLowerCase()),gi(n,r);return r}s(xi,"parseFieldsProjection");function gi(i,e){i=i.replace(ja,r=>r.charAt(0)+"."+r.substring(1));let t=(0,_i.splitString)(i,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let n=t[r];if(n.includes(",")){let c=(0,_i.splitString)(n,{delimiters:",",brackets:!0,keepBrackets:!0});for(let l of c)gi(l,e);continue}let o=ka.exec(n);if(!o)throw new TypeError(`Invalid field path (${i})`);let a=o[2],p=e[a]=e[a]||new be.Item;o[1]&&(p.sign=o[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new be}}s(gi,"parse");function Ua(i){return i&&typeof i.forEach=="function"}s(Ua,"isMap");var G=Symbol.for("kEntries"),me=Symbol.for("kKeyMap"),vr=Symbol.for("kWellKnownKeys"),Ri=Symbol.for("kOptions"),dt=Symbol.for("kSize"),Ai=class Ai{constructor(e,t){Object.defineProperty(this,dt,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,G,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,me,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,vr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,Ri,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(n=>{r?this[vr][n]=n:this[vr][n.toLowerCase()]=n}),this.clear(),e&&this.setAll(e)}get size(){return this[dt]}clear(){Object.keys(this[G]).forEach(e=>delete this[G][e]),Object.keys(this[me]).forEach(e=>delete this[me][e]),this[dt]=0}forEach(e,t){for(let[r,n]of this.entries())e.call(t,n,r,this)}get(e){if(e)return this[G][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[G],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let n=Object.prototype.hasOwnProperty.call(this[G],r);return this[G][r]=t,n||this[dt]++,this[me][r]=e,this}setAll(e){return Ua(e)?e.forEach((t,r)=>this.set(r,t)):Object.keys(e).forEach(t=>this.set(t,e[t])),this}keys(){return Object.values(this[me])[Symbol.iterator]()}values(){return Object.values(this[G])[Symbol.iterator]()}entries(){return Object.entries(this[G])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[G],t);return delete this[G][t],delete this[me][t],r||this[dt]--,r}sort(e){let t={...this[G]},r={...this[me]},n=Array.from(this.keys());e?n.sort(e):n.sort(),this.clear();for(let o of n)this[G][o]=t[o],this[me][o]=r[o];return this[dt]=n.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[me]))e[r]=this[G][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[Ri].caseSensitive)return e;let t=this._getStoringKey(e);return this[me][t]??this[vr][t]??e}_getStoringKey(e){return this[Ri].caseSensitive?e:e.toLowerCase()}};s(Ai,"ResponsiveMap");var F=Ai;var ws="1.0";var $e;(function(i){i.Kind="ComplexType"})($e||($e={}));var Ve;(function(i){i.Kind="EnumType"})(Ve||(Ve={}));var Ke;(function(i){i.Kind="MappedType"})(Ke||(Ke={}));var ze;(function(i){i.Kind="MixinType"})(ze||(ze={}));var Je;(function(i){i.Kind="SimpleType"})(Je||(Je={}));var ht;(function(i){i.Kind="HttpController"})(ht||(ht={}));var Pr;(function(i){i.Kind="HttpOperation"})(Pr||(Pr={}));function Ns(i){return i&&typeof i=="object"&&(i.kind===$e.Kind||i.kind===Ve.Kind||i.kind===Ke.Kind||i.kind===Je.Kind||i.kind===ze.Kind)}s(Ns,"isDataType");function Ds(i){return i&&typeof i=="object"&&i.kind===$e.Kind}s(Ds,"isComplexType");function Ss(i){return i&&typeof i=="object"&&i.kind===Je.Kind}s(Ss,"isSimpleType");function Is(i){return i&&typeof i=="object"&&i.kind===ze.Kind}s(Is,"isMixinType");function Ms(i){return i&&typeof i=="object"&&i.kind===Ke.Kind}s(Ms,"isMappedType");function Ls(i){return i&&typeof i=="object"&&i.kind===Ve.Kind}s(Ls,"isEnumType");function vs(i){return i&&typeof i=="object"&&i.kind===ht.Kind}s(vs,"isHttpController");var d;(function(i){i.SpecVersion=ws,i.ComplexType=$e,i.EnumType=Ve,i.MappedType=Ke,i.MixinType=ze,i.SimpleType=Je,i.HttpController=ht,i.HttpOperation=Pr,i.isComplexType=Ds,i.isDataType=Ns,i.isSimpleType=Ss,i.isMixinType=Is,i.isMappedType=Ms,i.isEnumType=Ls,i.isHttpController=vs})(d||(d={}));var ks=ie(require("@browsery/i18next"),1),er=require("fast-tokenizer");var Wa=/\\(.)/g,Ya=/(\\)/g;function Ps(i){return i.replace(Ya,"\\\\")}s(Ps,"escapeString");function Fs(i){return i.replace(Wa,"$1")}s(Fs,"unescapeString");var js=Object.getPrototypeOf(ks.default.createInstance()).constructor,Ht=class Ht extends js{async init(e,t){let r=typeof e=="object"?e:{},n=typeof e=="function"?e:t;try{let o=await super.init(r,n),a=this.services.formatter;if(a.add("lowercase",(p,c)=>p.toLocaleLowerCase(c)),a.add("uppercase",(p,c)=>p.toLocaleUpperCase(c)),a.add("upperFirst",(p,c)=>p.charAt(0).toLocaleUpperCase(c)+p.substring(1)),r!=null&&r.resources)for(let p of Object.keys(r.resources)){let c=r.resources[p];for(let l of Object.keys(c))this.addResourceBundle(p,l,c[l],!1,!0)}return n&&n(null,o),o}catch(o){throw n&&n(o,this.t),o}}deep(e,t){if(e==null)return e;let r=new WeakMap;return this._deepTranslate(e,r,t)}createInstance(e,t){return new Ht(e,t)}static createInstance(e,t){return new Ht(e,t)}_deepTranslate(e,t,r){if(e==null||r!=null&&r.ignore&&r.ignore(e,this))return e;if(typeof e=="object"&&t.has(e))return t.get(e);if(typeof e=="string"){let n="";for(let o of(0,er.tokenize)(e,{brackets:{"$t(":")"},quotes:!0,keepQuotes:!0,keepBrackets:!0,keepDelimiters:!0})){if(o.startsWith("$t(")&&o.endsWith(")")){o=o.substring(3,o.length-1);let a=(0,er.splitString)(o,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),p=Fs(o.substring((a[0]||"").length+1));o=a[0]||"";let c=[],l=null;for(let m of(0,er.tokenize)(o,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(m.startsWith("{")){l=JSON.parse(m);continue}c.push(m)}let O=c.length>1?"$t("+c.join(",")+")":c[0];n+=p?this.t(O,p,{...r,...l}):this.t(O,{...r,...l});continue}n+=o}return n}if(Array.isArray(e)){let n=Array(e.length);t.set(e,n);for(let o=0,a=e.length;o<a;o++)n[o]=this._deepTranslate(e[o],t,r);return t.delete(e),n}if(typeof e=="object"){if(Buffer.isBuffer(e)||Buffer.isBuffer(e)||e instanceof Symbol||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof WeakMap||e instanceof WeakSet)return e;let n={};t.set(e,n);let o=Object.keys(e);for(let a=0,p=o.length;a<p;a++){let c=o[a];n[c]=this._deepTranslate(e[c],t,r)}return t.delete(e),n}return e}static get defaultInstance(){return Qa}};s(Ht,"I18n");var yt=Ht,Qa=yt.createInstance();var Xa=/(\))/g;function A(i,e,t){let r=e&&typeof e=="object"?e:void 0,n=typeof e=="string"?e:t;return"$t("+i+(r?","+JSON.stringify(r):"")+(n?"?"+Ps(n).replace(Xa,"\\$1"):"")+")"}s(A,"translate");var Fr=yt.createInstance();Fr.init().catch(()=>{});var bi=class bi extends Error{constructor(e,t){super("Unknown error"),this.severity="error",t=t||(e instanceof Error?e:void 0),e instanceof Error&&(t=e),t&&t instanceof Error&&(this.cause=t,t.stack&&(this.stack=t.stack)),typeof e=="string"?this.initString(e):e instanceof Error?this.initError(e):this.init(e),this.message=this.message||this.constructor.name}toString(){return Fr.deep(this.message)}toJSON(){var t;let e="production";return x({message:this.message,severity:this.severity,system:this.system,code:this.code,details:this.details,stack:e==="dev"||e==="development"||e==="test"?(t=this.stack)==null?void 0:t.split(`
7
- `):void 0},!0)}init(e){this.message=(e==null?void 0:e.message)||this.constructor.name,this.severity=(e==null?void 0:e.severity)||"error",e&&(this.system=e.system,this.code=e.code,this.details=e.details)}initString(e){this.init({message:String(e||"")||this.constructor.name,severity:"error",code:this.constructor.name})}initError(e){this.init({message:e.message,severity:e.severity||"error",code:e.code||e.constructor.name})}};s(bi,"OpraException");var de=bi;var wi=class wi extends de{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};s(wi,"OpraDocumentError");var Ge=wi;var Ni=class Ni{constructor(e){this.path="",this.error=new Ge,this.showErrorDetails=!0,this.maxErrors=(e==null?void 0:e.maxErrors)||0,this.error.message=""}addError(e){if(!this.error.details.length)if(e instanceof Error)this.error.stack=e.stack;else{let t=new Error;Error.captureStackTrace(t,this.addError),this.error.stack=t.stack}if(this.error.add({message:typeof e=="string"?e:e.message,path:this.path,...typeof e=="object"?e:void 0}),this.error.details.length>=this.maxErrors)throw this.error}enter(e,t){let r=this.path;this.path=this.path+e;try{return t()}catch(n){n!==this.error&&this.addError(n)}finally{this.path=r}}async enterAsync(e,t){let r=this.path;this.path=this.path+e;try{return await t()}catch(n){n!==this.error&&this.addError(n)}finally{this.path=r}}extend(e){let t={...e};return Object.setPrototypeOf(t,this),t}};s(Ni,"DocumentInitContext");var le=Ni;var wl=require("reflect-metadata"),Ks=require("ts-gems");var Us=ie(require("lodash.omit"),1);function Di(i){return function(e){var n;let t;if(!(i!=null&&i.embedded))if(i!=null&&i.name){if(!K.test(i.name))throw new TypeError(`"${i.name}" is not a valid type name`);t=i.name}else t=((n=e.name.match(Xt))==null?void 0:n[1])||e.name;let r=Reflect.getOwnMetadata(E,e);r||(r={},Reflect.defineMetadata(E,r,e)),r.kind=d.ComplexType.Kind,r.name=t,i&&Object.assign(r,(0,Us.default)(i,["kind","name","base","fields"]))}}s(Di,"ComplexTypeDecorator");var Vs=require("ts-gems");var Cs=require("ts-gems"),Bs=require("uid");var Si=class Si{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[Te])return this.element;if(this.parent)return this._document=this.parent.getDocument();throw new Error("ApiDocument not found in document tree")}hasDataType(e){var r;let t=(r=this[V])==null?void 0:r.has(e);return t||(this.parent?this.parent.hasDataType(e):!1)}findDataType(e){var r;let t=(r=this[V])==null?void 0:r.get(e);return t||(this.parent?this.parent.findDataType(e):void 0)}getDataType(e){let t=this.findDataType(e);if(t)return t;let r="";if(typeof e=="function")r=Reflect.getMetadata(E,e).name;else if(typeof e=="object"){let n=e[E];r=n==null?void 0:n.name}throw typeof e=="string"&&(r=e),new TypeError("Unknown data type"+(r?" ("+r+")":""))}getDataTypeNameWithNs(e){if(!e.name)return;let t=this.getDocument().getDataTypeNs(e);return t?t+":"+e.name:e.name}getComplexType(e){let t=this.getDataType(e);if(t.kind===d.ComplexType.Kind)return t;throw new TypeError(`Data type "${t.name}" is not a ComplexType`)}getSimpleType(e){let t=this.getDataType(e);if(t.kind===d.SimpleType.Kind)return t;throw new TypeError(`Data type "${t.name||t}" is not a SimpleType`)}getEnumType(e){let t=this.getDataType(e);if(t.kind===d.EnumType.Kind)return t;throw new TypeError(`Data type "${t.name||t}" is not a EnumType`)}getMappedType(e){let t=this.getDataType(e);if(t.kind===d.MappedType.Kind)return t;throw new TypeError(`Data type "${t.name||t}" is not a MappedType`)}getMixinType(e){let t=this.getDataType(e);if(t.kind===d.MixinType.Kind)return t;throw new TypeError(`Data type "${t.name||t}" is not a MixinType`)}};s(Si,"DocumentNode");var tr=Si;var w=s(function(i){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=(0,Cs.asMutable)(this);e.id=(0,Bs.uid)(16),Object.defineProperty(e,"node",{value:new tr(this,i==null?void 0:i.node),enumerable:!1,writable:!0}),i&&Object.defineProperty(e,"owner",{value:i,enumerable:!1,writable:!0})},"DocumentElement"),Mi=class Mi{};s(Mi,"DocumentElementClass");var Ii=Mi;w.prototype=Ii.prototype;function Li(i){return function(e,t){if(typeof t!="string")throw new TypeError("Symbol properties can't be used as a field");let r=Reflect.getOwnMetadata(E,e.constructor)||{};r.kind=d.ComplexType.Kind,r.fields=r.fields||{};let n=Reflect.getMetadata("design:type",e,t),o=r.fields[t]={...i};n===Array?o.isArray=!0:o.type=o.type||n,Reflect.defineMetadata(E,r,e.constructor)}}s(Li,"ApiFieldDecorator");var $s=require("ts-gems"),he=require("valgen");var qs=require("ts-gems");var kr=Symbol.for("nodejs.util.inspect.custom"),rr="\x1B[0m",jr="\x1B[33m",Ur="\x1B[35m";var R=s(function(i,e,t){if(!this)throw new TypeError('"this" should be passed to call class constructor');if(e!=null&&e.name&&!K.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);w.call(this,i);let r=(0,qs.asMutable)(this);r.kind=e.kind,r.name=e.name,r.description=e.description,r.abstract=e.abstract,r.examples=e.examples},"DataType"),Pi=class Pi extends w{get embedded(){return!this.name}toJSON(){return x({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[kr](){return`[${jr+Object.getPrototypeOf(this).constructor.name+rr} ${Ur+this.name+rr}]`}};s(Pi,"DataTypeClass");var vi=Pi;R.prototype=vi.prototype;var Za=/^([+-])?([a-z$_][\w.]*)$/i,S=s(function(...i){if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=i;R.call(this,e,t,r);let n=(0,$s.asMutable)(this);n.fields=new F},"ComplexTypeBase"),ki=class ki extends R{findField(e){if(e.includes(".")){let r=this.parseFieldPath(e).pop();return r==null?void 0:r.field}return this.fields.get(e)}getField(e){let t=this.findField(e);if(!t)throw new Error(A("error:UNKNOWN_FIELD",{field:e}));return t}parseFieldPath(e,t){var m,$,_s;let r=this,n,o=e.split("."),a=o.length,p=[],c=this.owner.node.getDataType("object"),l=t==null?void 0:t.allowSigns,O=s(()=>p.map(qe=>qe.fieldName).join("."),"getStrPath");for(let qe=0;qe<a;qe++){let X={fieldName:o[qe],dataType:c};p.push(X);let Ir=Za.exec(o[qe]);if(!Ir)throw new TypeError(`Invalid field name (${O()})`);if(Ir[1]&&((qe===0&&l==="first"||l==="each")&&(X.sign=Ir[1]),X.fieldName=Ir[2]),r){if(r instanceof S){if(n=r.fields.get(X.fieldName),n){X.fieldName=n.name,X.field=n,X.dataType=n.type,r=n.type;continue}if(((m=r.additionalFields)==null?void 0:m[0])===!0){X.additionalField=!0,X.dataType=c,r=void 0;continue}if((($=r.additionalFields)==null?void 0:$[0])==="type"&&((_s=r.additionalFields)==null?void 0:_s[1])instanceof R){X.additionalField=!0,X.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(Ti=>Ti.fieldName).join(".")})`)}throw new TypeError(`"${p.map(Ti=>Ti.fieldName).join(".")}" field is not a complex type and has no child fields`)}X.additionalField=!0,X.dataType=c}return p}normalizeFieldPath(e,t){return this.parseFieldPath(e,t).map(r=>(r.sign||"")+r.fieldName).join(".")}generateCodec(e,t){let r=Array.isArray(t==null?void 0:t.projection)?xi(t.projection):t==null?void 0:t.projection,n=this._generateSchema(e,{...t,projection:r,currentPath:""}),o;if(this.additionalFields instanceof R)o=this.additionalFields.generateCodec(e,t);else if(typeof this.additionalFields=="boolean")o=this.additionalFields;else if(Array.isArray(this.additionalFields))if(this.additionalFields.length<2)o="error";else{let a=o[1];o=(0,he.validator)((p,c,l)=>c.fail(l,a,p))}return he.vg.isObject(n,{ctor:this.name==="object"?Object:this.ctor,additionalFields:o,name:this.name,coerce:!0,caseInSensitive:t==null?void 0:t.caseInSensitive,onFail:t==null?void 0:t.onFail})}_generateSchema(e,t){let r={},{currentPath:n,projection:o}=t,a=!!(o&&Object.values(o).find(c=>!c.sign)),p;for(let c of this.fields.values()){if(t.ignoreReadonlyFields&&c.readonly||t.ignoreWriteonlyFields&&c.writeonly||t.ignoreHiddenFields&&c.hidden){r[c.name]=he.vg.isUndefined({coerce:!0});continue}p=c.name;let l;if(o!=="*"&&(l=o==null?void 0:o[p.toLowerCase()],(l==null?void 0:l.sign)==="-"||a&&!l||!a&&c.exclusive&&!l)){r[c.name]=he.vg.isUndefined({coerce:!0});continue}let O=this._generateFieldCodec(e,c,{...t,partial:t.partial==="deep"?t.partial:void 0,projection:o,currentPath:n+(n?".":"")+p});r[p]=t.partial||!c.required?he.vg.optional(O):he.vg.required(O)}return r}_generateFieldCodec(e,t,r){let n=t.type.generateCodec(e,r);return t.fixed&&(n=he.vg.isEnum([t.fixed])),t.isArray&&(n=he.vg.isArray(n)),n}};s(ki,"ComplexTypeBaseClass");var Fi=ki;S.prototype=Fi.prototype;var k=s(function(...i){if(!this){let[o]=i;return k[I](o)}let[e,t]=i;w.call(this,e);let r=(0,Vs.asMutable)(this);r.name=t.name;let n=t.origin||e;if(!(n instanceof S))throw new Error("Field origin should be one of ComplexType, MappedType or MixinType");r.origin=n,r.type=t.type||e.node.getDataType("any"),r.description=t.description,r.isArray=t.isArray,r.default=t.default,r.fixed=t.fixed,r.required=t.required,r.exclusive=t.exclusive,r.translatable=t.translatable,r.deprecated=t.deprecated,r.readonly=t.readonly,r.writeonly=t.writeonly,r.examples=t.examples,r.hidden=t.hidden},"ApiField"),Ui=class Ui extends w{toJSON(){var t;let e=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return x({type:e||((t=this.type)==null?void 0:t.toJSON()),description:this.description,isArray:this.isArray||void 0,default:this.default,fixed:this.fixed,required:this.required||void 0,exclusive:this.exclusive||void 0,translatable:this.translatable||void 0,deprecated:this.deprecated||void 0,readonly:this.readonly||void 0,writeonly:this.writeonly||void 0,examples:this.examples})}};s(Ui,"ApiFieldClass");var ji=Ui;k.prototype=ji.prototype;Object.assign(k,Li);k[I]=Li;var Z=s(function(...i){var o;if(!this)return Z[I].apply(void 0,i);let[e,t]=i,r=i[2]||new le({maxErrors:0});S.call(this,e,t,r);let n=(0,Ks.asMutable)(this);n.kind=d.ComplexType.Kind,n.additionalFields=t.additionalFields,n.keyField=t.keyField,t.base&&r.enter(".base",()=>{if(!(t.base instanceof S))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);n.base=t.base,n.additionalFields==null&&n.base.additionalFields&&(n.additionalFields=n.base.additionalFields);for(let a of n.base.fields.values())this.fields.set(a.name,new k(this,a))}),n.ctor=t.ctor||((o=n.base)==null?void 0:o.ctor),t.fields&&r.enter(".fields",()=>{for(let[a,p]of Object.entries(t.fields)){let c=new k(this,{...p,name:a});this.fields.set(c.name,c)}})},"ComplexType"),Bi=class Bi extends S{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof S?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(){let e=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,t=x({...S.prototype.toJSON.call(this),kind:this.kind,base:this.base?e||this.base.toJSON():void 0});if(this.additionalFields)if(this.additionalFields instanceof R){let r=this.node.getDataTypeNameWithNs(this.additionalFields);t.additionalFields=r||this.additionalFields.toJSON()}else t.additionalFields=this.additionalFields;if(this.fields.size){let r={},n=0;for(let o of this.fields.values())o.origin===this&&(r[o.name]=o.toJSON(),n++);n&&(t.fields=r)}return x(t)}};s(Bi,"ComplexTypeClass");var Ci=Bi;Z.prototype=Ci.prototype;Object.assign(Z,Di);Z[I]=Di;var jl=require("reflect-metadata"),zs=require("ts-gems"),Js=require("valgen");var fe=s(function(...i){if(!this)return fe[I].apply(void 0,i);let[e,t,r]=i;R.call(this,e,t,r);let n=(0,zs.asMutable)(this);if(n.kind=d.EnumType.Kind,t.base){if(!(t.base instanceof fe))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${n.kind}"`);n.base=t.base}n.instance=t.instance,n.ownAttributes=M(t.attributes||{}),n.attributes=n.base?M(n.base.attributes):{};for(let[o,a]of Object.entries(n.ownAttributes))n.attributes[o]=a},"EnumType"),qi=class qi extends R{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof fe?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return Js.vg.isEnum(Object.keys(this.attributes))}toJSON(){let e=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return x({...R.prototype.toJSON.call(this),base:this.base?e||this.base.toJSON():void 0,attributes:M(this.ownAttributes)})}};s(qi,"EnumTypeClass");var ir=qi;fe.prototype=ir.prototype;Object.assign(fe,ir);function Ha(i,...e){let t=e.length>=2?e[0]:void 0,r=e.length>=2?e[1]:e[0],n={},o=i;if(Array.isArray(i)){if(t){if(!Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be array');o=[...t,...i]}n={},i.forEach(p=>{var l;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];n[p]=x({description:c})})}else{if(t){if(Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be enum object');o={...t,...i}}Object.keys(i).forEach(p=>{var l;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];n[i[p]]=x({alias:p,description:c})})}let a={kind:d.EnumType.Kind,attributes:n,base:r.base,name:r.name,description:r==null?void 0:r.description};return Object.defineProperty(i,E,{value:a,enumerable:!1,configurable:!0,writable:!0}),o}s(Ha,"EnumTypeFactory");fe.prototype=ir.prototype;fe[I]=Ha;var Jl=require("reflect-metadata"),Gs=require("ts-gems");function Cr(i,e){let t=i==null?void 0:i.map(n=>String(n).toLowerCase()),r=e==null?void 0:e.map(n=>String(n).toLowerCase());return n=>r&&r.includes(n.toLowerCase())?!1:t?t.includes(n.toLowerCase()):!0}s(Cr,"getIsInheritedPredicateFn");var we=s(function(...i){var o;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=i;S.call(this,e,t,r);let n=(0,Gs.asMutable)(this);if(n.kind=d.MappedType.Kind,t.base){if(!(t.base instanceof S))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);n.base=t.base,n.ctor=t.ctor||n.base.ctor,t.pick?n.pick=t.pick.map(l=>n.base.normalizeFieldPath(l)):t.omit?n.omit=t.omit.map(l=>n.base.normalizeFieldPath(l)):t.partial?n.partial=Array.isArray(t.partial)?t.partial.map(l=>n.base.normalizeFieldPath(l)):t.partial:t.required&&(n.required=Array.isArray(t.required)?t.required.map(l=>n.base.normalizeFieldPath(l)):t.required);let a=Cr(n.pick,n.omit),p=Array.isArray(n.partial)?n.partial.map(l=>l.toLowerCase()):n.partial,c=Array.isArray(n.required)?n.required.map(l=>l.toLowerCase()):n.required;for(let[l,O]of n.base.fields.entries()){if(!a(l))continue;let m={...O};p===!0||Array.isArray(p)&&p.includes(O.name.toLowerCase())?m.required=!1:(c===!0||Array.isArray(c)&&c.includes(O.name.toLowerCase()))&&(m.required=!0);let $=new k(this,m);n.fields.set($.name,$)}(!n.pick||n.base.additionalFields===!1||Array.isArray(n.base.additionalFields)&&((o=n.base.additionalFields)==null?void 0:o[0])==="error")&&(n.additionalFields=n.base.additionalFields),t.base.keyField&&a(t.base.keyField)&&(n.keyField=t.base.keyField)}},"MappedType"),Vi=class Vi extends S{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof S?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(){let e=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return x({...S.prototype.toJSON.call(this),base:e||this.base.toJSON(),kind:this.kind,pick:this.pick,omit:this.omit,partial:this.partial,required:this.required})}};s(Vi,"MappedTypeClass");var $i=Vi;we.prototype=$i.prototype;we._applyMixin=()=>{};var tf=require("reflect-metadata"),Ws=require("ts-gems");var We=s(function(...i){if(!this)return We[I].apply(void 0,i);let[e,t,r]=i;S.call(this,e,t,r);let n=(0,Ws.asMutable)(this);n.kind=d.MixinType.Kind,n.types=[];for(let o of t.types){n.additionalFields!==!0&&(o.additionalFields===!0?n.additionalFields=!0:n.additionalFields||(n.additionalFields=o.additionalFields));for(let a of o.fields.values()){let p=new k(this,a);n.fields.set(p.name,p)}n.types.push(o),o.keyField&&(n.keyField=o.keyField)}},"MixinType"),zi=class zi extends S{extendsFrom(e){if(e instanceof R||(e=this.node.getDataType(e)),!(e instanceof S))return!1;if(e===this)return!0;for(let t of this.types)if(t.extendsFrom(e))return!0;return!1}toJSON(){return x({...S.prototype.toJSON.call(this),kind:this.kind,types:this.types.map(e=>{let t=this.node.getDataTypeNameWithNs(e);return t||e.toJSON()})})}};s(zi,"MixinTypeClass");var Ki=zi;We.prototype=Ki.prototype;We[I]=ep;function ep(...i){let e=i.filter(a=>typeof a=="function"),t=typeof i[i.length-1]=="object"?i[i.length-1]:void 0;if(!e.length)throw new TypeError("No Class has been provided");if(e.length===1)return e[0];let r=e[0].name+"Mixin",n={[r]:class{constructor(){for(let a of e)Qt(this,a)}}}[r],o={...t,kind:d.MixinType.Kind,types:[]};Reflect.defineMetadata(E,o,n);for(let a of e){let p=Reflect.getMetadata(E,a);if(!(p&&(p.kind===d.ComplexType.Kind||p.kind===d.MixinType.Kind||p.kind===d.MappedType.Kind)))throw new TypeError(`Class "${a.name}" is not a ${d.ComplexType.Kind}, ${d.MixinType.Kind} or ${d.MappedType.Kind}`);o.types.push(a),Yt(n.prototype,a.prototype)}return n}s(ep,"MixinTypeFactory");var yf=require("reflect-metadata"),Xs=require("ts-gems"),Gi=require("valgen");var Ys=ie(require("lodash.omit"),1);function Ji(i){let e=[],t=s(function(r){var a;let n;if(!(i!=null&&i.embedded))if(i!=null&&i.name){if(!K.test(i.name))throw new TypeError(`"${i.name}" is not a valid type name`);n=i.name}else n=((a=r.name.match(Xt))==null?void 0:a[1])||r.name,n=n.toLowerCase();let o=Reflect.getOwnMetadata(E,r)||{};o.kind=d.SimpleType.Kind,o.name=n,i&&Object.assign(o,(0,Ys.default)(i,["kind","name"])),Reflect.defineMetadata(E,o,r)},"decorator");return t.Example=(r,n)=>(e.push(o=>{o.examples=o.examples||[],o.examples.push({description:n,value:r})}),t),t}s(Ji,"SimpleTypeDecoratorFactory");function Qs(i){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(E,e.constructor)||{},n=Reflect.getMetadata("design:type",e,t),o="string";n===Boolean?o="boolean":n===Number&&(o="number"),r.kind=d.SimpleType.Kind,r.attributes=r.attributes||{},r.attributes[t]={format:(i==null?void 0:i.format)||o,description:i==null?void 0:i.description,deprecated:i==null?void 0:i.deprecated},Reflect.defineMetadata(E,r,e.constructor)}}s(Qs,"AttributeDecoratorFactory");var u=s(function(...i){var o,a;if(!this)return u[I](...i);let[e,t,r]=i;R.call(this,e,t,r);let n=(0,Xs.asMutable)(this);if(n.kind=d.SimpleType.Kind,t.base){if(!(t.base instanceof u))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);n.base=t.base}if(n.properties=t.properties,n.ownNameMappings={...t.nameMappings},n.nameMappings={...(o=n.base)==null?void 0:o.nameMappings,...t.nameMappings},n.ownAttributes=M(t.attributes||{}),n.attributes=n.base?M(n.base.attributes):{},n.ownAttributes)for(let[p,c]of Object.entries(n.ownAttributes)){if((a=n.attributes[p])!=null&&a.sealed)throw new TypeError(`Sealed attribute "${p}" can not be overwritten`);n.attributes[p]=c}n._generateDecoder=t.generateDecoder,n._generateEncoder=t.generateEncoder},"SimpleType"),Yi=class Yi extends R{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof u?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(e,t,r){let n={...this.properties,...r};if(e==="decode"){let a=this;for(;a;){if(a._generateDecoder)return a._generateDecoder(n,(t==null?void 0:t.documentElement)||this.owner);a=this.base}return Gi.isAny}let o=this;for(;o;){if(o._generateEncoder)return o._generateEncoder(n,(t==null?void 0:t.documentElement)||this.owner);o=this.base}return Gi.isAny}toJSON(){let e=x(this.ownAttributes),t;this.properties&&typeof this.properties.toJSON=="function"?t=this.properties.toJSON(this.properties,this.owner):t=this.properties?M(this.properties):{};let r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,n=x({...R.prototype.toJSON.apply(this),base:this.base?r||this.base.toJSON():void 0,attributes:e&&Object.keys(e).length?e:void 0,properties:Object.keys(t).length?t:void 0});return Object.keys(this.ownNameMappings).length&&(n.nameMappings={...this.ownNameMappings}),n}};s(Yi,"SimpleTypeClass");var Wi=Yi;u.prototype=Wi.prototype;Object.assign(u,Ji);u[I]=Ji;u.Attribute=Qs;var Qi=Symbol("initializing"),Xi=class Xi{static async createDataType(e,t,r){e=e||new le({maxErrors:0});let n=await this._importDataTypeArgs(e,t,r);if(n)return typeof n=="string"?t.node.getDataType(n):this._createDataType(e,t,n)}static async addDataTypes(e,t,r){let n=t.node[V];if(!n)throw new TypeError("DocumentElement should has [kDataTypeMap] property");let o=await this.createAllDataTypes(e,t,r);if(o)for(let a of o)a!=null&&a.name&&n.set(a.name,a)}static async createAllDataTypes(e,t,r){e=e||new le({maxErrors:0});let n=await this._prepareAllInitArgs(e,t,r);if(!n)return;let o=new F;for(let c of n)o.set(c.name,c);let a=e.extend({initArgsMap:o}),p=[];for(let[c,l]of o.entries())e.enter(`[${c}]`,()=>{if(!o.has(c))return;let O=this._createDataType(a,t,l);O&&p.push(O)});return p}static async _prepareAllInitArgs(e,t,r){let n=new F,o=new F,a=e.extend({owner:t,importQueue:n,initArgsMap:o});if(!t.node[V])throw new TypeError("DocumentElement should has [kDataTypeMap] property");if(Array.isArray(r)){let p=0;for(let c of r)await a.enterAsync(`$[${p++}]`,async()=>{c=await ye(c);let l=Reflect.getMetadata(E,c)||c[E];if(!(l&&l.name))return typeof c=="function"?a.addError(`Class "${c.name}" doesn't have a valid data type metadata`):a.addError("Object doesn't have a valid data type metadata");n.set(l.name,c)})}else{let p,c;for([c,p]of Object.entries(r))p=await ye(p),n.set(c,typeof p=="object"?{...p,name:c}:p)}for(let p of Array.from(n.keys())){if(!n.has(p))continue;let c=await this._importDataTypeArgs(a,t,p);c&&typeof c!="string"&&a.addError("Embedded data type can't be loaded into document node directly")}return Array.from(o.values())}static async _importDataTypeArgs(e,t,r){var O;r=await ye(r);let{importQueue:n,initArgsMap:o}=e,a=t.node.findDataType(r);if(a instanceof R)return a.name;let p,c,l;if(typeof r!="string"){let $=t.node.getDocument().types[Zt].get(r);$&&(r=$)}if(typeof r=="string"){let m=r;if(r=(n==null?void 0:n.get(m))||((O=e.initArgsMap)==null?void 0:O.get(m)),!r)return e.addError(`Unknown data type (${m})`)}if(typeof r=="function"){if(p=Reflect.getMetadata(E,r),!p)return e.addError(`Class "${r.name}" doesn't have a valid DataType metadata`);c=r}else if(typeof r=="object"){if(p=r[E],p)l=r,p.kind!==d.EnumType.Kind&&(p=void 0);else if(d.isDataType(r))p=r,c=p.ctor;else if(c=Object.getPrototypeOf(r).constructor,p=c&&Reflect.getMetadata(E,c),p&&p.kind===d.SimpleType.Kind){let m=await this._importDataTypeArgs(e,t,p.name);return m?typeof m=="object"&&m.kind!==d.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:d.SimpleType.Kind,name:void 0,base:m,properties:r}:void 0}}return p?e.enterAsync(p.name?`[${p.name}]`:"",async()=>{if(p.name){let $=o==null?void 0:o.get(p.name);if($)return $[Qi]?e.addError("Circular reference detected"):p.name}let m={kind:p.kind,name:p.name};m[Qi]=!0;try{if(m.name)if(n!=null&&n.has(m.name))o==null||o.set(p.name,m),m._instance={name:p.name},m[V]=t.node[V];else return e.addError(`Data Type (${m.name}) must be explicitly added to type list in the document scope`);switch(m.kind){case d.ComplexType.Kind:m.ctor=c,await this._prepareComplexTypeArgs(e,t,m,p);break;case d.EnumType.Kind:m.instance=l,await this._prepareEnumTypeArgs(e,t,m,p);break;case d.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,m,p);break;case d.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,m,p);break;case d.SimpleType.Kind:m.ctor=c,await this._prepareSimpleTypeArgs(e,t,m,p);break;default:return e.addError(`Invalid data type kind ${p.kind}`)}}finally{m.name&&(n==null||n.delete(m.name)),delete m[Qi]}return n&&m.name?m.name:m}):e.addError("No DataType metadata found")}static async _prepareDataTypeArgs(e,t,r){t.description=r.description,t.abstract=r.abstract,t.examples=r.examples}static async _prepareComplexTypeArgs(e,t,r,n){await this._prepareDataTypeArgs(e,r,n),await e.enterAsync(".base",async()=>{let o;if(n.base)o=await this._importDataTypeArgs(e,t,n.base);else if(r.ctor){let a=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(E,a)&&(o=await this._importDataTypeArgs(e,t,a))}o&&(r.base=Ye(o),r.ctor=r.ctor||o.ctor)}),n.additionalFields!=null&&(typeof n.additionalFields=="boolean"||Array.isArray(n.additionalFields)?r.additionalFields=n.additionalFields:await e.enterAsync(".additionalFields",async()=>{let o=await this._importDataTypeArgs(e,t,n.additionalFields);o&&(r.additionalFields=Ye(o))})),n.fields&&(r.fields={},await e.enterAsync(".fields",async()=>{for(let[o,a]of Object.entries(n.fields))await e.enterAsync(`[${o}]`,async()=>{let p=typeof a=="string"?{type:a}:a;if(p.isArray&&!p.type)return e.addError('"type" must be defined explicitly for array fields');let c=await this._importDataTypeArgs(e,t,p.type||"any");c&&(r.fields[o]={...p,type:Ye(c)})})}))}static async _prepareEnumTypeArgs(e,t,r,n){await this._prepareDataTypeArgs(e,r,n),n.base&&await e.enterAsync(".base",async()=>{let o=await this._importDataTypeArgs(e,t,n.base);o&&(r.base=Ye(o))}),r.attributes=M(n.attributes)}static async _prepareSimpleTypeArgs(e,t,r,n){var o,a,p,c;await this._prepareDataTypeArgs(e,r,n),await e.enterAsync(".base",async()=>{let l;if(n.base)l=await this._importDataTypeArgs(e,t,n.base);else if(r.ctor){let O=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(E,O)&&(l=await this._importDataTypeArgs(e,t,O))}l&&(r.base=Ye(l),r.ctor=r.ctor||l.ctor)}),r.properties=n.properties,r.nameMappings=n.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),n.attributes&&(r.attributes=M(n.attributes)),typeof((o=r.properties)==null?void 0:o[T])=="function"&&(r.generateDecoder=(a=r.properties)==null?void 0:a[T].bind(r.properties)),typeof((p=r.properties)==null?void 0:p[g])=="function"&&(r.generateEncoder=(c=r.properties)==null?void 0:c[g].bind(r.properties))}static async _prepareMappedTypeArgs(e,t,r,n){await this._prepareDataTypeArgs(e,r,n),await e.enterAsync(".base",async()=>{let o;if(n.base)o=await this._importDataTypeArgs(e,t,n.base);else if(r.ctor){let a=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(E,a)&&(o=await this._importDataTypeArgs(e,t,a))}o&&(r.base=Ye(o),r.ctor=r.ctor||o.ctor)}),n.pick?r.pick=[...n.pick]:n.omit?r.omit=[...n.omit]:n.partial?r.partial=Array.isArray(n.partial)?[...n.partial]:n.partial:n.required&&(r.required=Array.isArray(n.required)?[...n.required]:n.required)}static async _prepareMixinTypeArgs(e,t,r,n){await this._prepareDataTypeArgs(e,r,n),r.types=[],await e.enterAsync(".types",async()=>{let o=n.types,a=0;for(let p of o)await e.enterAsync(`[${a++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(Ye(c))})})}static _createDataType(e,t,r){var a;let n=t.node.findDataType(typeof r=="string"?r:r.name||"");if(n instanceof R)return n;let o=typeof r=="string"?(a=e.initArgsMap)==null?void 0:a.get(r):r;if(o){let p=o[V];switch(p||delete o._instance,n=o._instance,n!=null&&n.name&&p&&p.set(n.name,n),o==null?void 0:o.kind){case d.ComplexType.Kind:return this._createComplexType(e,t,o);case d.EnumType.Kind:return this._createEnumType(e,t,o);case d.MappedType.Kind:return this._createMappedType(e,t,o);case d.MixinType.Kind:return this._createMixinType(e,t,o);case d.SimpleType.Kind:return this._createSimpleType(e,t,o);default:break}}e.addError(`Unknown data type (${String(r)})`)}static _createComplexType(e,t,r){let n=r._instance||{};Object.setPrototypeOf(n,Z.prototype);let o=M(r);return r.base&&e.enter(".base",()=>{o.base=this._createDataType(e,t,r.base)}),r.additionalFields&&e.enter(".additionalFields",()=>{typeof r.additionalFields=="boolean"||Array.isArray(r.additionalFields)?o.additionalFields=r.additionalFields:o.additionalFields=this._createDataType(e,t,r.additionalFields)}),o.fields={},r.fields&&e.enter(".fields",()=>{for(let[a,p]of Object.entries(r.fields))e.enter(`[${a}]`,()=>{let c=this._createDataType(e,t,p.type);c&&(o.fields[a]={...p,name:a,type:c})})}),Z.apply(n,[t,o]),n}static _createEnumType(e,t,r){let n=r._instance||{};Object.setPrototypeOf(n,fe.prototype);let o=M(r);return r.base&&e.enter(".base",()=>{o.base=this._createDataType(e,t,r.base)}),o.attributes=r.attributes,fe.apply(n,[t,o]),n}static _createMappedType(e,t,r){let n=r._instance||{};Object.setPrototypeOf(n,we.prototype);let o=M(r);return r.base&&e.enter(".base",()=>{o.base=this._createDataType(e,t,r.base)}),we.apply(n,[t,o]),n}static _createMixinType(e,t,r){let n=r._instance||{};Object.setPrototypeOf(n,We.prototype);let o=M(r);return r.types&&e.enter(".types",()=>{o.types=[];let a=0;for(let p of r.types)e.enter(`[${a++}]`,()=>{let c=this._createDataType(e,t,p);if(!(c instanceof S))throw new TypeError(`"${c==null?void 0:c.kind}" can't be set as base for a "${o.kind}"`);o.types.push(c)})}),We.apply(n,[t,o]),n}static _createSimpleType(e,t,r){let n=r._instance||{};Object.setPrototypeOf(n,u.prototype);let o=M(r);return r.base&&e.enter(".base",()=>{o.base=this._createDataType(e,t,r.base)}),u.apply(n,[t,o]),n}};s(Xi,"DataTypeFactory");var H=Xi;function Ye(i){return typeof i=="object"&&i.name?i.name:i}s(Ye,"preferName");var Zi=class Zi extends w{constructor(e){super(e),this.name="OpraApi"}toJSON(){return x({protocol:this.protocol,name:this.name,description:this.description})}async _initialize(e,t){if(!K.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};s(Zi,"ApiBase");var nr=Zi;var ta=ie(require("path-browserify"),1),ra=require("ts-gems");var Zs,Hs,oe=Symbol.for("kMap"),or=Symbol.for("kCtorMap"),Hi=class Hi{constructor(){this[Zs]=new F,this[Hs]=new WeakMap}get size(){return this[oe].size}forEach(e,t){this[oe].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[or].get(e);if(!t&&typeof e=="function"){let r=Reflect.getMetadata(E,e);t=r==null?void 0:r.name}if(!t&&typeof e=="object"){let r=e[E];t=r==null?void 0:r.name}return t?this[oe].get(t):void 0}set(e,t){this[oe].set(e,t),t.ctor?this[or].set(t.ctor,e):t.instance&&this[or].set(t.instance,e)}has(e){if(e instanceof R)return!!e.name&&this[oe].has(e.name);let t=typeof e=="string"?e:this[or].get(e);return t?this[oe].has(t):!1}keys(){return this[oe].keys()}values(){return this[oe].values()}entries(){return this[oe].entries()}sort(e){return this[oe].sort(e),this}[(Zs=oe,Hs=or,Symbol.iterator)](){return this[oe][Symbol.iterator]()}};s(Hi,"DataTypeMap");var Ee=Hi;var ea=ie(require("lodash.omit"),1),Br=ie(require("putil-merge"),1);var rp=/^(.*)(Controller)$/;function en(i){let e=[],t=s(function(r){var c;let n=i==null?void 0:i.name;n||(n=((c=rp.exec(r.name))==null?void 0:c[1])||r.name);let o={},a=Reflect.getOwnMetadata(ne,Object.getPrototypeOf(r));a&&(0,Br.default)(o,a,{deep:!0});let p=Reflect.getOwnMetadata(ne,r);p&&(0,Br.default)(o,p,{deep:!0}),(0,Br.default)(o,{kind:d.HttpController.Kind,name:n,path:n,...(0,ea.default)(i,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(ne,o,r);for(let l of e)l(o);Reflect.defineMetadata(ne,o,r)},"decorator");return t.Cookie=(r,n)=>(e.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"cookie",type:n}:{...n,name:r,location:"cookie"};o.parameters=o.parameters||[],o.parameters.push(a)}),t),t.Header=(r,n)=>(e.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"header",type:n}:{...n,name:r,location:"header"};o.parameters=o.parameters||[],o.parameters.push(a)}),t),t.QueryParam=(r,n)=>(e.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"query",type:n}:{...n,name:r,location:"query"};o.parameters=o.parameters||[],o.parameters.push(a)}),t),t.PathParam=(r,n)=>(e.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"path",type:n}:{...n,name:r,location:"path"};o.parameters=o.parameters||[],o.parameters.push(a)}),t),t.KeyParam=(r,n)=>(e.push(o=>{var p;(p=o.path)!=null&&p.includes(":"+r)||(o.path=(o.path||"")+"@:"+r);let a=typeof n=="string"||typeof n=="function"?{name:r,location:"path",type:n,keyParam:!0}:{...n,name:r,location:"path",keyParam:!0};o.parameters=o.parameters||[],o.parameters.push(a)}),t),t.UseType=(...r)=>(e.push(n=>{n.types=n.types||[],n.types.push(...r)}),t),t}s(en,"HttpControllerDecoratorFactory");var ee=s(function(...i){var n;if(!this)return ee[I].apply(void 0,i);let[e,t]=i;if(w.call(this,e),!K.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,ra.asMutable)(this);r.kind=d.HttpController.Kind,r.types=r.node[V]=new Ee,r.operations=new F,r.controllers=new F,r.parameters=[],r.name=t.name,r.description=t.description,r.path=t.path??t.name,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(n=r._initialize)==null||n.call(r,t)},"HttpController"),rn=class rn extends w{get isRoot(){return!(this.owner instanceof ee)}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values()){if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;if(r.controllers.size&&(t=r.findController(e),t))return this._controllerReverseMap.set(e,t),t}this._controllerReverseMap.set(e,null);return}if(e.startsWith("/")&&(e=e.substring(1)),e.includes("/")){let t=e.split("/"),r=this;for(;r&&t.length>0;)r=r.controllers.get(t.shift());return r}return this.controllers.get(e)}findParameter(e,t){let r=e.toLowerCase(),n;for(n of this.parameters)if(!(t&&t!==n.location)&&(typeof n.name=="string"&&(n._nameLower=n._nameLower||n.name.toLowerCase(),n._nameLower===r)||n.name instanceof RegExp&&n.name.test(e)))return n;if(this.node.parent&&this.node.parent.element instanceof ee)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return ta.default.posix.join(this.owner instanceof ee?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(){let e=x({kind:this.kind,description:this.description,path:this.path});if(this.operations.size){e.operations={};for(let t of this.operations.values())e.operations[t.name]=t.toJSON()}if(this.controllers.size){e.controllers={};for(let t of this.controllers.values())e.controllers[t.name]=t.toJSON()}if(this.types.size){e.types={};for(let t of this.types.values())e.types[t.name]=t.toJSON()}if(this.parameters.length){e.parameters=[];for(let t of this.parameters)e.parameters.push(t.toJSON())}return e}[kr](){return`[${jr}HttpController${Ur+this.name+rr}]`}};s(rn,"HttpControllerClass");var tn=rn;ee.prototype=tn.prototype;Object.assign(ee,en);ee[I]=en;var nn=class nn extends nr{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.protocol="http",this.controllers=new F}findController(e){return ee.prototype.findController.call(this,e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(){let t={...super.toJSON(),protocol:this.protocol,url:this.url,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};s(nn,"HttpApi");var sr=nn;var ia=ie(require("@browsery/type-is"),1),na=require("ts-gems"),qr=require("valgen");var _e=s(function(i,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');w.call(this,i);let t=(0,na.asMutable)(this);if(e.contentType){let r=Array.isArray(e.contentType)?e.contentType:[e.contentType];r=r.map(n=>n.split(/\s*,\s*/)).flat(),t.contentType=r.length>1?r:r[0]}t.description=e.description,t.contentEncoding=e.contentEncoding,t.examples=e.examples,t.multipartFields=[],t.maxFieldsSize=e.maxFieldsSize,t.maxFields=e.maxFields,t.maxFiles=e.maxFiles,t.maxFileSize=e.maxFileSize,t.maxTotalFileSize=e.maxTotalFileSize,e!=null&&e.type&&(t.type=(e==null?void 0:e.type)instanceof R?e.type:t.owner.node.getDataType(e.type)),t.isArray=e.isArray},"HttpMediaType"),sn=class sn extends w{findMultipartField(e,t){if(this.multipartFields){for(let r of this.multipartFields)if((!t||t===r.fieldType)&&(r.fieldName instanceof RegExp&&r.fieldName.test(e)||r.fieldName===e))return r}}toJSON(){var r,n;let e=this.type?this.node.getDataTypeNameWithNs(this.type):void 0,t=x({description:this.description,contentType:this.contentType,contentEncoding:this.contentEncoding,type:e||((r=this.type)==null?void 0:r.toJSON()),isArray:this.isArray,example:this.example,examples:this.examples,maxFields:this.maxFields,maxFieldsSize:this.maxFieldsSize,maxFiles:this.maxFiles,maxFileSize:this.maxFileSize,maxTotalFileSize:this.maxTotalFileSize});return(n=this.multipartFields)!=null&&n.length&&(t.multipartFields=this.multipartFields.map(o=>o.toJSON())),t}generateCodec(e,t){let r;return this.type?r=this.type.generateCodec(e,t):this.contentType&&(Array.isArray(this.contentType)?this.contentType:[this.contentType]).find(o=>ia.default.is(o,["json"]))&&(r=this.node.findDataType("object").generateCodec(e)),r=r||qr.isAny,this.isArray?qr.vg.isArray(r):r}};s(sn,"HttpMediaTypeClass");var on=sn;_e.prototype=on.prototype;function $r(i,e){let t=i.lastIndexOf("/");if(i.startsWith("/")&&t){let r=i.substring(1,t),n=i.substring(t+1);if(e!=null&&e.includeFlags)for(let o of e==null?void 0:e.includeFlags)n.includes(o)||(n+=o);if(e!=null&&e.excludeFlags)for(let o of e==null?void 0:e.excludeFlags)n.replace(o,"");return new RegExp(r,n)}throw new TypeError(`"${i}" is not a valid RegExp string`)}s($r,"parseRegExp");var an=class an extends _e{constructor(e,t){super(e,t),this.owner=e,this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?$r(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(){return x({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON()})}};s(an,"HttpMultipartField");var ar=an;var sa=ie(require("path-browserify"),1),aa=require("ts-gems");var oa=ie(require("lodash.omit"),1);var pn;(function(i){i.X_Opra_Version="X-Opra-Version",i.X_Total_Count="X-Total-Count",i.WWW_Authenticate="WWW-Authenticate",i.Authorization="Authorization",i.Proxy_Authenticate="Proxy-Authenticate",i.Proxy_Authorization="Proxy-Authorization",i.Age="Age",i.Cache_Control="Cache-Control",i.Clear_Site_Data="Clear-Site-Data",i.Expires="Expires",i.Pragma="Pragma",i.Last_Modified="Last-Modified",i.ETag="ETag",i.If_Match="If-Match",i.If_None_Match="If-None-Match",i.If_Modified_Since="If-Modified-Since",i.If_Unmodified_Since="If-Unmodified-Since",i.Vary="Vary",i.Connection="Connection",i.Keep_Alive="Keep-Alive",i.Accept="Accept",i.Accept_Encoding="Accept-Encoding",i.Accept_Language="Accept-Language",i.Expect="Expect",i.Cookie="Cookie",i.Set_Cookie="Set-Cookie",i.Access_Control_Allow_Origin="Access-Control-Allow-Origin",i.Access_Control_Allow_Credentials="Access-Control-Allow-Credentials",i.Access_Control_Allow_Headers="Access-Control-Allow-Headers",i.Access_Control_Allow_Methods="Access-Control-Allow-Methods",i.Access_Control_Expose_Headers="Access-Control-Expose-Headers",i.Access_Control_Max_Age="Access-Control-Max-Age",i.Access_Control_Request_Headers="Access-Control-Request-Headers",i.Access_Control_Request_Method="Access-Control-Request-Method",i.Origin="Origin",i.Timing_Allow_Origin="Timing-Allow-Origin",i.Content_Disposition="Content-Disposition",i.Content_ID="Content-ID",i.Content_Length="Content-Length",i.Content_Type="Content-Type",i.Content_Transfer_Encoding="Content-Transfer-Encoding",i.Content_Encoding="Content-Encoding",i.Content_Language="Content-Language",i.Content_Location="Content-Location",i.Forwarded="Forwarded",i.X_Forwarded_For="X-Forwarded-For",i.X_Forwarded_Host="X-Forwarded-Host",i.X_Forwarded_Proto="X-Forwarded-Proto",i.Via="Via",i.Location="Location",i.From="From",i.Host="Host",i.Referer="Referer",i.Referrer_Policy="Referrer-Policy",i.User_Agent="User-Agent",i.Allow="Allow",i.Server="Server",i.Accept_Ranges="Accept-Ranges",i.Range="Range",i.If_Range="If-Range",i.Content_Range="Content-Range",i.Cross_Origin_Embedder_Policy="Cross-Origin-Embedder-Policy",i.Cross_Origin_Opener_Policy="Cross-Origin-Opener-Policy",i.Cross_Origin_Resource_Policy="Cross-Origin-Resource-Policy",i.Content_Security_Policy="Content-Security-Policy",i.Content_Security_Policy_Report_Only="Content-Security-Policy-Report-Only",i.Expect_CT="Expect-CT",i.Feature_Policy="Feature-Policy",i.Strict_Transport_Security="Strict-Transport-Security",i.Upgrade="Upgrade",i.Upgrade_Insecure_Requests="Upgrade-Insecure-Requests",i.X_Content_Type_Options="X-Content-Type-Options",i.X_Download_Options="X-Download-Options",i.X_Frame_Options="X-Frame-Options",i.X_Permitted_Cross_Domain_Policies="X-Permitted-Cross-Domain-Policies",i.X_Powered_By="X-Powered-By",i.X_XSS_Protection="X-XSS-Protection",i.Transfer_Encoding="Transfer-Encoding",i.TE="TE",i.Trailer="Trailer",i.Sec_WebSocket_Key="Sec-WebSocket-Key",i.Sec_WebSocket_Extensions="Sec-WebSocket-Extensions",i.Sec_WebSocket_Accept="Sec-WebSocket-Accept",i.Sec_WebSocket_Protocol="Sec-WebSocket-Protocol",i.Sec_WebSocket_Version="Sec-WebSocket-Version",i.Date="Date",i.Retry_After="Retry-After",i.Server_Timing="Server-Timing",i.X_DNS_Prefetch_Control="X-DNS-Prefetch-Control",i.Max_Forwards="Max-Forwards"})(pn||(pn={}));var N;(function(i){i[i.CONTINUE=100]="CONTINUE",i[i.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",i[i.PROCESSING=102]="PROCESSING",i[i.EARLYHINTS=103]="EARLYHINTS",i[i.OK=200]="OK",i[i.CREATED=201]="CREATED",i[i.ACCEPTED=202]="ACCEPTED",i[i.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",i[i.NO_CONTENT=204]="NO_CONTENT",i[i.RESET_CONTENT=205]="RESET_CONTENT",i[i.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",i[i.AMBIGUOUS=300]="AMBIGUOUS",i[i.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",i[i.FOUND=302]="FOUND",i[i.SEE_OTHER=303]="SEE_OTHER",i[i.NOT_MODIFIED=304]="NOT_MODIFIED",i[i.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",i[i.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",i[i.BAD_REQUEST=400]="BAD_REQUEST",i[i.UNAUTHORIZED=401]="UNAUTHORIZED",i[i.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",i[i.FORBIDDEN=403]="FORBIDDEN",i[i.NOT_FOUND=404]="NOT_FOUND",i[i.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",i[i.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",i[i.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",i[i.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",i[i.CONFLICT=409]="CONFLICT",i[i.GONE=410]="GONE",i[i.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",i[i.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",i[i.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",i[i.URI_TOO_LONG=414]="URI_TOO_LONG",i[i.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",i[i.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",i[i.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",i[i.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",i[i.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",i[i.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",i[i.LOCKED=423]="LOCKED",i[i.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",i[i.TOO_EARLY=425]="TOO_EARLY",i[i.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",i[i.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",i[i.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",i[i.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",i[i.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",i[i.BAD_GATEWAY=502]="BAD_GATEWAY",i[i.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",i[i.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",i[i.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",i[i.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",i[i.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",i[i.LOOP_DETECTED=508]="LOOP_DETECTED",i[i.NOT_EXTENDED=510]="NOT_EXTENDED",i[i.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(N||(N={}));var ip={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"};var L;(function(i){i.json="application/json",i.opra_response_json="application/opra.response+json",i.xml="application/XML",i.text="text/plain",i.html="text/html",i.markdown="text/markdown",i.binary="binary/octet-stream"})(L||(L={}));function U(i,e){let t=s((r,n)=>{if(typeof n!="string")throw new TypeError("Symbol properties can not be decorated");let o={kind:d.HttpOperation.Kind,...(0,oa.default)(e,["kind"])},a=Reflect.getOwnMetadata(ne,r.constructor)||{};a.operations=a.operations||{},a.operations[n]=o;for(let p of i)p(o);Reflect.defineMetadata(ne,a,r.constructor)},"decorator");return t.Cookie=(r,n)=>(i.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"cookie",type:n}:{...n,name:r,location:"cookie"};o.parameters?o.parameters=o.parameters.filter(p=>!(p.location==="cookie"&&String(p.name)===String(r))):o.parameters=[],o.parameters.push(a)}),t),t.Header=(r,n)=>(i.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"header",type:n}:{...n,name:r,location:"header"};o.parameters?o.parameters=o.parameters.filter(p=>!(p.location==="header"&&String(p.name)===String(r))):o.parameters=[],o.parameters.push(a)}),t),t.QueryParam=(r,n)=>(i.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"query",type:n}:{...n,name:r,location:"query"};o.parameters?o.parameters=o.parameters.filter(p=>!(p.location==="query"&&String(p.name)===String(r))):o.parameters=[],o.parameters.push(a)}),t),t.PathParam=(r,n)=>(i.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"path",type:n}:{...n,name:r,location:"path"};o.parameters?o.parameters=o.parameters.filter(p=>!(p.location==="path"&&String(p.name)===String(r))):o.parameters=[],o.parameters.push(a)}),t),t.Response=(r,n)=>{let o={...n,statusCode:r};return o.type&&(o.contentType=o.contentType||L.opra_response_json,o.contentEncoding=o.contentEncoding||"utf-8"),o.contentType===L.opra_response_json&&(o.contentEncoding=o.contentEncoding||"utf-8"),i.push(a=>{a.responses=a.responses||[],a.responses.push(o)}),t},t.RequestContent=function(r){let n=typeof r=="object"?r:{type:r};return n.type&&(n.contentType=n.contentType||L.json,n.contentEncoding=n.contentEncoding||"utf-8"),i.push(o=>{o.requestBody=o.requestBody||{required:!0,content:[]},o.requestBody.content=o.requestBody.content||[],o.requestBody.content.push(n)}),t},t.MultipartContent=function(r,n){let o={...r,contentType:(r==null?void 0:r.contentType)||"multipart/form-data"};if(i.push(a=>{a.requestBody=a.requestBody||{required:!0,content:[]},a.requestBody.content=a.requestBody.content||[],a.requestBody.content.push(o)}),n){let a={Field(p,c){return o.multipartFields=o.multipartFields||[],o.multipartFields.push({fieldName:p,fieldType:"field",...c}),a},File(p,c){return o.multipartFields=o.multipartFields||[],o.multipartFields.push({fieldName:p,fieldType:"file",...c}),a}};n(a)}return t},t.UseType=(...r)=>(i.push(n=>{n.types=n.types||[],n.types.push(...r)}),t),t}s(U,"HttpOperationDecoratorFactory");var D=s(function(...i){if(!this){let[n]=i,o=[];return D[I].call(void 0,o,n)}let[e,t]=i;if(w.call(this,e),!K.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,aa.asMutable)(this);r.parameters=[],r.responses=[],r.types=r.node[V]=new Ee,r.name=t.name,r.path=t.path,r.mergePath=t.mergePath,r.method=t.method||"GET",r.description=t.description,r.composition=t.composition,r.compositionOptions=t.compositionOptions?M(t.compositionOptions):void 0},"HttpOperation"),ln=class ln extends w{findParameter(e,t){let r=e.toLowerCase(),n;for(n of this.parameters)if(!(t&&t!==n.location)&&(typeof n.name=="string"&&(n._nameLower=n._nameLower||n.name.toLowerCase(),n._nameLower===r)||n.name instanceof RegExp&&n.name.test(e)))return n}getFullUrl(){let e=this.owner.getFullUrl();return e?this.path?this.mergePath?e+this.path:sa.default.posix.join(e,this.path):e:this.path||"/"}toJSON(){var t;let e=x({kind:d.HttpOperation.Kind,description:this.description,method:this.method,path:this.path,mergePath:this.mergePath,composition:this.composition,requestBody:(t=this.requestBody)==null?void 0:t.toJSON()});if(this.parameters.length){e.parameters=[];for(let r of this.parameters)e.parameters.push(r.toJSON())}return this.responses.length&&(e.responses=this.responses.map(r=>r.toJSON())),e}};s(ln,"HttpOperationClass");var cn=ln;D.prototype=cn.prototype;D[I]=U;D.GET=function(i){return U([],{...i,method:"GET"})};D.DELETE=function(i){return U([],{...i,method:"DELETE"})};D.HEAD=function(i){return U([],{...i,method:"HEAD"})};D.OPTIONS=function(i){return U([],{...i,method:"OPTIONS"})};D.PATCH=function(i){return U([],{...i,method:"PATCH"})};D.POST=function(i){return U([],{...i,method:"POST"})};D.PUT=function(i){return U([],{...i,method:"PUT"})};D.SEARCH=function(i){return U([],{...i,method:"SEARCH"})};var np=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,fn=class fn{constructor(e,t){if(this.start=0,this.end=0,e&&typeof e=="object"&&(this.start=e.start||0,this.end=e.end||0),typeof e=="number"&&(this.start=e,this.end=t||this.start),typeof e=="string"){let r=np.exec(e);if(!r)throw new TypeError(`"${e}" is not a valid Status Code range`);this.start=parseInt(r[1],10),this.end=r[2]?parseInt(r[2],10):this.start}}includes(e){return e>=this.start&&e<=this.end}intersects(e,t){return t>=this.start&&e<=this.end}toString(){return this.start===this.end?String(this.start):String(this.start)+"-"+String(this.end)}toJSON(){return!this.end||this.start===this.end?this.start:{start:this.start,end:this.end}}};s(fn,"HttpStatusRange");var Tt=fn;var un=class un extends _e{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new Tt(r.start,r.end):new Tt(r)),this.partial=t.partial}findParameter(e,t){e=e.toLowerCase();for(let r of this.parameters)if((!t||t===r.location)&&(r.name instanceof RegExp&&r.name.test(e)||r.name===e))return r}toJSON(){let e=this.statusCode.map(r=>r.toJSON()),t=x({...super.toJSON(),statusCode:e.length===1&&typeof e[0]=="number"?e[0]:e,partial:this.partial});if(this.parameters.length){t.parameters=[];for(let r of this.parameters)t.parameters.push(r.toJSON())}return t}};s(un,"HttpOperationResponse");var pr=un;var ca=require("ts-gems");var pa=require("ts-gems");var Vr=s(function(i,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');w.call(this,i);let t=(0,pa.asMutable)(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),dn=class dn extends w{toJSON(){let e=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return x({type:this.type?e||this.type.toJSON():"any",description:this.description,isArray:this.isArray,examples:this.examples})}};s(dn,"ValueClass");var mn=dn;Vr.prototype=mn.prototype;var Et=s(function(i,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');Vr.call(this,i,e);let t=(0,ca.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?$r(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.location=e.location,t.deprecated=e.deprecated,t.required=e.required,t.required==null&&e.location==="path"&&(t.required=!0),t.arraySeparator=e.arraySeparator,t.keyParam=e.keyParam},"HttpParameter"),yn=class yn extends Vr{toJSON(){return x({...super.toJSON(),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}};s(yn,"HttpParameterClass");var hn=yn;Et.prototype=hn.prototype;var Tn=class Tn extends w{constructor(e){super(e),this.content=[]}toJSON(){return x({description:this.description,required:this.required,maxContentSize:this.maxContentSize,content:this.content.length?this.content.map(e=>e.toJSON()):[],partial:this.partial})}};s(Tn,"HttpRequestBody");var cr=Tn;var En=class En{static async createApi(e,t,r){let n=new sr(t);return n.name=r.name,n.description=r.description,n.url=r.url,r.controllers&&await e.enterAsync(".controllers",async()=>{if(Array.isArray(r.controllers))for(let o of r.controllers){let a=await this._createController(e,n,o);a&&n.controllers.set(a.name,a)}else for(let[o,a]of Object.entries(r.controllers)){let p=await this._createController(e,n,a,o);p&&n.controllers.set(p.name,p)}}),n}static async _createController(e,t,r,n){typeof r=="function"&&!Wt(r)&&(r=t instanceof ee?r(t.instance):r()),r=await ye(r);let o,a,p;if(typeof r=="function"){if(a=Reflect.getMetadata(ne,r),!a)return e.addError(`Class "${r.name}" doesn't have a valid HttpController metadata`);o=r}else o=Object.getPrototypeOf(r).constructor,a=Reflect.getMetadata(ne,o),a?p=r:(a=r,r.instance==="object"&&(p=r.instance,o=Object.getPrototypeOf(p).constructor));if(!a)return e.addError(`Class "${o.name}" is not decorated with HttpController()`);if(n=n||a.name,!n)throw new TypeError("Controller name required");let c=new ee(t,{...a,name:n,instance:p,ctor:o});return a.types&&await e.enterAsync(".types",async()=>{await H.addDataTypes(e,c,a.types)}),a.parameters&&await e.enterAsync(".parameters",async()=>{let l=0;for(let O of a.parameters)await e.enterAsync(`[${l++}]`,async()=>{let m={...O};await e.enterAsync(".type",async()=>{O.type&&(m.type=c.node.findDataType(O.type)),!m.type&&typeof O.type=="object"&&(m.type=await H.createDataType(e,c,O.type)),m.type||(m.type=c.node.getDataType("any"))});let $=new Et(c,m);c.parameters.push($)})}),a.operations&&await e.enterAsync(".operations",async()=>{for(let[l,O]of Object.entries(a.operations))await e.enterAsync(`[${l}]`,async()=>{let m=new D(c,{name:l,method:"GET"});await this._initHttpOperation(e,m,O),c.operations.set(l,m)})}),a.controllers&&await e.enterAsync(".controllers",async()=>{if(Array.isArray(a.controllers)){let l=0;for(let O of a.controllers)await e.enterAsync(`[${l}]`,async()=>{let m=await this._createController(e,c,O);m&&(c.controllers.get(m.name)&&e.addError(`Duplicate controller name (${m.name})`),c.controllers.set(m.name,m))}),l++}else for(let[l,O]of Object.entries(a.controllers))await e.enterAsync(`[${l}]`,async()=>{let m=await this._createController(e,c,O,l);m&&(c.controllers.get(m.name)&&e.addError(`Duplicate controller name (${m.name})`),c.controllers.set(m.name,m))})}),c}static async _initHttpOperation(e,t,r){let n={...r,name:t.name,types:void 0};return D.apply(t,[t.owner,n]),r.types&&await e.enterAsync(".types",async()=>{await H.addDataTypes(e,t,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let o=0;for(let a of r.parameters)await e.enterAsync(`[${o++}]`,async()=>{let p={...a};await e.enterAsync(".type",async()=>{a.type&&(p.type=t.node.findDataType(a.type)),!p.type&&typeof a.type=="object"&&(p.type=await H.createDataType(e,t,a.type)),p.type||(p.type=t.node.getDataType("any"))});let c=new Et(t,p);t.parameters.push(c)})}),r.responses&&await e.enterAsync(".responses",async()=>{let o=0;for(let a of r.responses)await e.enterAsync(`[${o++}]`,async()=>{let p=new pr(t,{statusCode:a.statusCode});await this._initHttpOperationResponse(e,p,a),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let o=new cr(t);await this._initHttpRequestBody(e,o,r.requestBody),t.requestBody=o}),t}static async _initHttpMediaType(e,t,r){_e.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{r.type&&(t.type=t.node.findDataType(r.type)),!t.type&&(typeof r.type=="object"||typeof r.type=="function")&&(t.type=await H.createDataType(e,t,r.type)),t.type||(t.type=t.node.getDataType("any"))}),r.multipartFields&&await e.enterAsync(".multipartFields",async()=>{for(let n=0;n<r.multipartFields.length;n++)await e.enterAsync(`[${n}]`,async()=>{let o=r.multipartFields[n],a=new ar(t,{fieldName:o.fieldName,fieldType:o.fieldType});await this._initHttpMediaType(e,a,o),t.multipartFields.push(a)})})}static async _initHttpOperationResponse(e,t,r){await this._initHttpMediaType(e,t,r),t.partial=r.partial,r.parameters&&await e.enterAsync(".parameters",async()=>{let n=0;for(let o of r.parameters)await e.enterAsync(`[${n++}]`,async()=>{let a={...o};await e.enterAsync(".type",async()=>{o.type&&(a.type=t.node.findDataType(o.type)),!a.type&&typeof o.type=="object"&&(a.type=await H.createDataType(e,t,o.type)),a.type||(a.type=t.node.getDataType("any"))});let p=new Et(t,a);t.parameters.push(p)})})}static async _initHttpRequestBody(e,t,r){t.description=r.description,t.required=r.required,t.maxContentSize=r.maxContentSize,t.immediateFetch=r.immediateFetch,t.partial=r.partial,r.content&&await e.enterAsync(".content",async()=>{for(let n=0;n<r.content.length;n++)await e.enterAsync(`[${n}]`,async()=>{let o=r.content[n],a=new _e(t,String(n));await this._initHttpMediaType(e,a,o),t.content.push(a)})})}};s(En,"HttpApiFactory");var _t=En;var fa=require("super-fast-md5");var la,_n=class _n extends w{constructor(){super(null),this[la]=new WeakMap,this.id="",this.info={},this.references=new F,this.types=new Ee,this.node[V]=this.types,this.node.findDataType=this._findDataType.bind(this)}getDataTypeNs(e){let t=e instanceof R?this._findDataType(e.name||""):this._findDataType(e);if(t)return this[Te].get(t)}findDocument(e){if(this.id===e)return this;for(let t of this.references.values()){if(t.id===e)return t;let r=t.findDocument(e);if(r)return r}}toJSON(){return this.export()}export(){let e=x({spec:d.SpecVersion,id:this.id,url:this.url,info:M(this.info,!0)});if(this.references.size){let t=0,r={};for(let[n,o]of this.references.entries())o[Ae]||(r[n]={id:o.id,url:o.url,info:M(o.info,!0)},t++);t&&(e.references=r)}if(this.types.size){e.types={};for(let t of this.types.values())e.types[t.name]=t.toJSON()}return this.api&&(e.api=this.api.toJSON()),e}invalidate(){let e=this.export();delete e.id,this.id=(0,fa.md5)(JSON.stringify(e)),this[Te]=new WeakMap}_findDataType(e,t){let r=this.types.get(e);if(r||!this.references.size)return r;if(typeof e=="string"){let o=Ei.exec(e);if(o){let a=o[1];if(a){let p=this.references.get(a);return p?(t=t||new WeakMap,t.set(this,!0),t.set(p,!0),p._findDataType(o[2],t)):void 0}e=o[2]}}t=t||new WeakMap,t.set(this,!0);let n=Array.from(this.references.keys()).reverse();for(let o of n){let a=this.references.get(o);if(r=a==null?void 0:a.types.get(e),r)return this[Te].set(r,a!=null&&a[Ae]?"":o),r}for(let o of n){let a=this.references.get(o);if(t.set(a,!0),r=a._findDataType(e,t),r)return this[Te].set(r,a!=null&&a[Ae]?"":o),r}}};s(_n,"ApiDocument");var Ne=_n;la=Te;var Kr=require("tslib"),xn=require("valgen");var xt,lr=(xt=class{constructor(e){e&&Object.assign(this,e)}[T](){return xn.vg.isBase64({coerce:!0})}[g](){return xn.vg.isBase64({coerce:!0})}},s(xt,"Base64Type"),xt);lr=(0,Kr.__decorate)([u({description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),(0,Kr.__metadata)("design:paramtypes",[Object])],lr);var De=require("tslib"),C=require("valgen");var gt,Qe=(gt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=C.vg.isDate({precision:"date",coerce:!0}),r=[];return e.minValue&&((0,C.isDateString)(e.minValue),r.push(C.toString,C.vg.isGte(e.minValue))),e.maxValue&&((0,C.isDateString)(e.maxValue),r.push(C.toString,C.vg.isLte(e.maxValue))),r.length>0?C.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){let t=C.vg.isDateString({precision:"date",trim:"date",coerce:!0}),r=[];return e.minValue&&((0,C.isDateString)(e.minValue),r.push(C.vg.isGte(e.minValue))),e.maxValue&&((0,C.isDateString)(e.maxValue),r.push(C.vg.isLte(e.maxValue))),r.length>0?C.vg.pipe([t,...r],{returnIndex:0}):t}},s(gt,"DateType"),gt);(0,De.__decorate)([u.Attribute({description:"Minimum value"}),(0,De.__metadata)("design:type",String)],Qe.prototype,"minValue",void 0);(0,De.__decorate)([u.Attribute({description:"Maximum value"}),(0,De.__metadata)("design:type",String)],Qe.prototype,"maxValue",void 0);Qe=(0,De.__decorate)([u({description:"A date without time",nameMappings:{js:"Date",json:"string"}}).Example("2021-04-18","Full date value"),(0,De.__metadata)("design:paramtypes",[Object])],Qe);var Se=require("tslib"),fr=require("valgen");var Ot,Xe=(Ot=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=fr.vg.isDateString({trim:"date",coerce:!0}),r=[];return e.minValue&&r.push(fr.vg.isGte(e.minValue)),e.maxValue&&r.push(fr.vg.isLte(e.maxValue)),r.length>0?fr.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){return this[T](e)}},s(Ot,"DateStringType"),Ot);(0,Se.__decorate)([u.Attribute({description:"Minimum value"}),(0,Se.__metadata)("design:type",String)],Xe.prototype,"minValue",void 0);(0,Se.__decorate)([u.Attribute({description:"Maximum value"}),(0,Se.__metadata)("design:type",String)],Xe.prototype,"maxValue",void 0);Xe=(0,Se.__decorate)([u({description:"Date string value",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18","Full date value").Example("2021-04","Date value without day").Example("2021","Year only value"),(0,Se.__metadata)("design:paramtypes",[Object])],Xe);var Ie=require("tslib"),B=require("valgen");var Rt,Ze=(Rt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=B.vg.isDate({precision:"time",coerce:!0}),r=[];return e.minValue&&((0,B.isDateString)(e.minValue),r.push(B.toString,B.vg.isGte(e.minValue))),e.maxValue&&((0,B.isDateString)(e.maxValue),r.push(B.toString,B.vg.isLte(e.maxValue))),r.length>0?B.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){let t=B.vg.isDateString({precision:"time",trim:"time",coerce:!0}),r=[];return e.minValue&&((0,B.isDateString)(e.minValue),r.push(B.vg.isGte(e.minValue))),e.maxValue&&((0,B.isDateString)(e.maxValue),r.push(B.vg.isLte(e.maxValue))),r.length>0?B.vg.pipe([t,...r],{returnIndex:0}):t}},s(Rt,"DateTimeType"),Rt);(0,Ie.__decorate)([u.Attribute({description:"Minimum value"}),(0,Ie.__metadata)("design:type",String)],Ze.prototype,"minValue",void 0);(0,Ie.__decorate)([u.Attribute({description:"Maximum value"}),(0,Ie.__metadata)("design:type",String)],Ze.prototype,"maxValue",void 0);Ze=(0,Ie.__decorate)([u({description:"A full datetime value",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15").Example("2021-04-18 22:30:15").Example("2021-04-18 22:30"),(0,Ie.__metadata)("design:paramtypes",[Object])],Ze);var Me=require("tslib"),ur=require("valgen");var At,He=(At=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=ur.vg.isDateString({coerce:!0}),r=[];return e.minValue&&r.push(ur.vg.isGte(e.minValue)),e.maxValue&&r.push(ur.vg.isLte(e.maxValue)),r.length>0?ur.vg.pipe([t,...r]):t}[g](e){return this[T](e)}},s(At,"DateTimeStringType"),At);(0,Me.__decorate)([u.Attribute({description:"Minimum value"}),(0,Me.__metadata)("design:type",String)],He.prototype,"minValue",void 0);(0,Me.__decorate)([u.Attribute({description:"Maximum value"}),(0,Me.__metadata)("design:type",String)],He.prototype,"maxValue",void 0);He=(0,Me.__decorate)([u({description:"DateTime string value",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15+01:00","Full date-time value with timezone").Example("2021-04-18T22:30:15","Full date-time value without timezone").Example("2021-04-18 22:30","Date-time value").Example("2021-04-18","Date value").Example("2021-04","Date value without day").Example("2021","Year only value"),(0,Me.__metadata)("design:paramtypes",[Object])],He);var v=require("tslib"),gn=require("valgen");var bt,W=(bt=class{constructor(e){e&&Object.assign(this,e)}[T](e){return gn.vg.isEmail({...e,coerce:!0})}[g](e){return gn.vg.isEmail({...e,coerce:!0})}},s(bt,"EmailType"),bt);(0,v.__decorate)([u.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),(0,v.__metadata)("design:type",Boolean)],W.prototype,"allowDisplayName",void 0);(0,v.__decorate)([u.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),(0,v.__metadata)("design:type",Boolean)],W.prototype,"requireDisplayName",void 0);(0,v.__decorate)([u.Attribute({description:"If set to `false`, the validator will not allow any non-English UTF8 character in email address's local part",default:!0}),(0,v.__metadata)("design:type",Boolean)],W.prototype,"utf8LocalPart",void 0);(0,v.__decorate)([u.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),(0,v.__metadata)("design:type",Boolean)],W.prototype,"ignoreMaxLength",void 0);(0,v.__decorate)([u.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),(0,v.__metadata)("design:type",Boolean)],W.prototype,"allowIpDomain",void 0);(0,v.__decorate)([u.Attribute({description:"If set to `true`, some additional validation will be enabled, e.g. disallowing certain syntactically valid email addresses that are rejected by GMail.",default:!1}),(0,v.__metadata)("design:type",Boolean)],W.prototype,"domainSpecificValidation",void 0);(0,v.__decorate)([u.Attribute({description:"If set to an array of strings and the part of the email after the @ symbol one of the strings defined in it, the validation fails."}),(0,v.__metadata)("design:type",Array)],W.prototype,"hostBlacklist",void 0);(0,v.__decorate)([u.Attribute({description:"If set to an array of strings and the part of the email after the @ symbol matches none of the strings defined in it, the validation fails."}),(0,v.__metadata)("design:type",Array)],W.prototype,"hostWhitelist",void 0);(0,v.__decorate)([u.Attribute({description:"If set to a string, then the validator will reject emails that include any of the characters in the string, in the name part."}),(0,v.__metadata)("design:type",String)],W.prototype,"blacklistedChars",void 0);W=(0,v.__decorate)([u({description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),(0,v.__metadata)("design:paramtypes",[Object])],W);var Le=require("tslib"),Nt=require("valgen");var wt,te=(wt=class{constructor(e){e&&Object.assign(this,e)}[T](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.allowSigns,o=(0,Nt.validator)("decodeFieldPath",a=>r.normalizeFieldPath(a,{allowSigns:n}));return Nt.vg.pipe([Nt.toString,o])}[g](e,t){return this[T](e,t)}toJSON(e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=r?t.node.getDataTypeNameWithNs(r):void 0;return{dataType:n||r.toJSON(),allowSigns:e.allowSigns}}},s(wt,"FieldPathType"),wt);(0,Le.__decorate)([u.Attribute({description:"Data type which field belong to"}),(0,Le.__metadata)("design:type",Object)],te.prototype,"dataType",void 0);(0,Le.__decorate)([u.Attribute({description:'Determines if signs (+,-) are allowed. If set "first" signs are allowed only beginning of the field pathIf set "each" signs are allowed at each field in the path'}),(0,Le.__metadata)("design:type",String)],te.prototype,"allowSigns",void 0);te=(0,Le.__decorate)([u({description:"Field path",nameMappings:{js:"string",json:"string"}}),(0,Le.__metadata)("design:paramtypes",[Object])],te);var Fe=require("tslib"),ls=require("valgen");var On=class On extends de{constructor(e,t,r){super(e,t instanceof Error?t:void 0),this.status=(typeof t=="number"?t:Number(r))||500}setStatus(e){return this.status=e,this}initError(e){typeof e.status=="number"?this.status=e.status:typeof e.getStatus=="function"&&(this.status=e.getStatus()),super.initError(e)}};s(On,"OpraHttpError");var b=On;var An=class An extends b{constructor(){super(...arguments),this.status=400}init(e){super.init({message:A("error:BAD_REQUEST","Bad request"),code:"BAD_REQUEST",...e})}};s(An,"BadRequestError");var Rn=An;var wn=class wn extends b{constructor(){super(...arguments),this.status=409}init(e){super.init({message:A("error:CONFLICT","Conflict"),code:"CONFLICT",...e})}};s(wn,"ConflictError");var bn=wn;var Dn=class Dn extends b{constructor(){super(...arguments),this.status=424}init(e){super.init({message:A("error:FAILED_DEPENDENCY","The request failed due to failure of a previous request"),code:"FAILED_DEPENDENCY",...e})}};s(Dn,"FailedDependencyError");var Nn=Dn;var Sn=class Sn extends b{constructor(){super(...arguments),this.status=N.FORBIDDEN}init(e){super.init({message:A("error:FORBIDDEN","You are not authorized to perform this action"),code:"FORBIDDEN",...e})}};s(Sn,"ForbiddenError");var mr=Sn;var Mn=class Mn extends b{constructor(){super(...arguments),this.status=500}init(e){super.init({message:A("error:INTERNAL_SERVER_ERROR","Internal server error"),code:"INTERNAL_SERVER_ERROR",severity:"fatal",...e})}};s(Mn,"InternalServerError");var In=Mn;var vn=class vn extends b{constructor(){super(...arguments),this.status=405}init(e){super.init({message:A("error:METHOD_NOT_ALLOWED","Method not allowed"),code:"METHOD_NOT_ALLOWED",...e})}};s(vn,"MethodNotAllowedError");var Ln=vn;var Fn=class Fn extends b{constructor(){super(...arguments),this.status=406}init(e){super.init({message:A("error:NOT_ACCEPTABLE","Not Acceptable"),code:"NOT_ACCEPTABLE",...e})}};s(Fn,"NotAcceptableError");var Pn=Fn;var jn=class jn extends b{constructor(){super(...arguments),this.status=404}init(e){super.init({message:A("error:NOT_FOUND","Not found"),code:"NOT_FOUND",...e})}};s(jn,"NotFoundError");var kn=jn;var Cn=class Cn extends mr{init(e){super.init({message:A("error:PERMISSION_ERROR","You dont have permission for this operation"),code:"PERMISSION_ERROR",...e})}};s(Cn,"PermissionError");var Un=Cn;var qn=class qn extends b{constructor(e,t,r){super({message:A("error:RESOURCE_CONFLICT",{resource:e,fields:t},"There is already an other {{resource}} resource with same values ({{fields}})"),severity:"error",code:"RESOURCE_CONFLICT",details:{resource:e,location:t}},r),this.status=409}};s(qn,"ResourceConflictError");var Bn=qn;var Vn=class Vn extends b{constructor(e,t,r){super({message:A("error:RESOURCE_NOT_AVAILABLE",`Resource "${e}${t?"/"+t:""}" is not available`),severity:"error",code:"RESOURCE_NOT_AVAILABLE",details:{resource:e,key:t}},r,N.UNPROCESSABLE_ENTITY)}};s(Vn,"ResourceNotAvailableError");var $n=Vn;var zn=class zn extends b{constructor(){super(...arguments),this.status=401}init(e){super.init({message:A("error:UNAUTHORIZED","You have not been authenticated to perform this action"),code:"UNAUTHORIZED",...e})}};s(zn,"UnauthorizedError");var Kn=zn;var Gn=class Gn extends b{constructor(){super(...arguments),this.status=422}init(e){super.init({message:A("error:UNPROCESSABLE_ENTITY","Unprocessable entity"),severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};s(Gn,"UnprocessableEntityError");var Jn=Gn;var Wn;(function(i){let e;(function(t){t.fatal="fatal",t.error="error",t.warning="warning",t.info="info"})(e=i.Enum||(i.Enum={})),i.name="IssueSeverity",i.description="Severity of the issue",i.Keys=Object.keys(i),i.descriptions={fatal:"The issue caused the action to fail and no further checking could be performed",error:"The issue is sufficiently important to cause the action to fail",warning:"The issue is not important enough to cause the action to fail but may cause it to be performed suboptimally or in a way that is not as desired",info:"The issue has no relation to the degree of success of the action"}})(Wn||(Wn={}));var J={};xs(J,{$and:()=>dp,$arithmetic:()=>Lp,$array:()=>da,$date:()=>hp,$eq:()=>_p,$field:()=>Ep,$gt:()=>gp,$gte:()=>Op,$ilike:()=>Sp,$in:()=>bp,$like:()=>Np,$lt:()=>Rp,$lte:()=>Ap,$ne:()=>xp,$notILike:()=>Ip,$notIn:()=>wp,$notLike:()=>Dp,$number:()=>Tp,$or:()=>mp,$paren:()=>Mp,$time:()=>yp,ArithmeticExpression:()=>hr,ArithmeticExpressionItem:()=>zr,ArrayExpression:()=>tt,Ast:()=>dr,BooleanLiteral:()=>nt,ComparisonExpression:()=>rt,DateLiteral:()=>xe,Expression:()=>q,FilterTreeVisitor:()=>xr,Literal:()=>j,LogicalExpression:()=>ve,NegativeExpression:()=>yr,NullLiteral:()=>ot,NumberLiteral:()=>ge,OpraErrorListener:()=>gr,ParenthesizedExpression:()=>it,QualifiedIdentifier:()=>st,StringLiteral:()=>at,Term:()=>et,TimeLiteral:()=>pt,parse:()=>vp});var Yn=class Yn{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};s(Yn,"Ast");var dr=Yn;var Qn=class Qn extends dr{};s(Qn,"Expression");var q=Qn;var Xn=class Xn extends q{};s(Xn,"Term");var et=Xn;var Zn=class Zn extends et{constructor(e){super(),this.value=e}toString(){return""+this.value}};s(Zn,"Literal");var j=Zn;var Hn=class Hn extends q{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new zr({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};s(Hn,"ArithmeticExpression");var hr=Hn,eo=class eo{constructor(e){Object.assign(this,e)}};s(eo,"ArithmeticExpressionItem");var zr=eo;var to=class to extends et{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};s(to,"ArrayExpression");var tt=to;var sp=/\w/,ro=class ro extends q{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${sp.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};s(ro,"ComparisonExpression");var rt=ro;var io=class io extends q{constructor(e){super(),Object.assign(this,e),this.op==="&&"&&(this.op="and"),this.op==="||"&&(this.op="or")}toString(){return this.items.map(e=>""+e).join(" "+this.op+" ")}};s(io,"LogicalExpression");var ve=io;var no=class no extends q{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};s(no,"NegativeExpression");var yr=no;var oo=class oo extends q{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};s(oo,"ParenthesizedExpression");var it=oo;var so=class so extends j{constructor(e){super(e)}};s(so,"BooleanLiteral");var nt=so;var ma=require("putil-varhelpers");var ao=class ao extends TypeError{};s(ao,"SyntaxError");var Jr=ao,po=class po extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};s(po,"FilterValidationError");var Pe=po,co=class co extends Error{constructor(e,t){super(e),Object.assign(this,t)}};s(co,"FilterParseError");var Gr=co;var ap=/'/g,pp=/(\\)/g,cp=/\\(.)/g;function lp(i){return i.replace(pp,"\\\\")}s(lp,"escapeString");function fp(i){return i.replace(cp,"$1")}s(fp,"unescapeString");function Dt(i){return"'"+lp(i).replace(ap,"\\'")+"'"}s(Dt,"quoteFilterString");function Tr(i){return i&&(i.startsWith("'")||i.startsWith('"'))&&i.endsWith(i.charAt(0))?fp(i.substring(1,i.length-1)):i}s(Tr,"unquoteFilterString");var ua=new Date(0),lo=class lo extends j{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,ma.toDateDef)(e,ua)!==ua){this.value=e;return}throw new Pe(`Invalid date value "${e}"`)}toString(){return Dt(this.value)}};s(lo,"DateLiteral");var xe=lo;var fo=class fo extends j{constructor(){super(null),this.value=null}};s(fo,"NullLiteral");var ot=fo;var uo=class uo extends j{constructor(e){if(super(0),typeof e=="number"||typeof e=="bigint"){this.value=e;return}try{if(typeof e=="string"){if(e.includes(".")){this.value=parseFloat(e);return}let t=Number(e);""+t===e?this.value=t:this.value=BigInt(e);return}}catch{}throw new Pe(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};s(uo,"NumberLiteral");var ge=uo;var mo=class mo extends j{constructor(e){super(""+e)}};s(mo,"QualifiedIdentifier");var st=mo;var ho=class ho extends j{constructor(e){super(""+e)}toString(){return Dt(this.value)}};s(ho,"StringLiteral");var at=ho;var up=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,yo=class yo extends j{constructor(e){if(super(""),e instanceof Date){this.value=Wr(e.getHours())+":"+Wr(e.getMinutes())+(e.getSeconds()?":"+Wr(e.getSeconds()):"")+(e.getMilliseconds()?"."+Wr(e.getMilliseconds()):"");return}if(typeof e=="string"&&up.test(e)){this.value=e;return}throw new Pe(`Invalid time value "${e}"`)}toString(){return Dt(this.value)}};s(yo,"TimeLiteral");var pt=yo;function Wr(i){return i<=9?"0"+i:""+i}s(Wr,"pad");function mp(...i){return new ve({op:"or",items:i})}s(mp,"$or");function dp(...i){return new ve({op:"and",items:i})}s(dp,"$and");function hp(i){return new xe(i)}s(hp,"$date");function yp(i){return new pt(i)}s(yp,"$time");function Tp(i){return new ge(i)}s(Tp,"$number");function da(...i){return new tt(i.map(Yr))}s(da,"$array");function Ep(i){return new st(i)}s(Ep,"$field");function _p(i,e){return se("=",i,e)}s(_p,"$eq");function xp(i,e){return se("!=",i,e)}s(xp,"$ne");function gp(i,e){return se(">",i,e)}s(gp,"$gt");function Op(i,e){return se(">=",i,e)}s(Op,"$gte");function Rp(i,e){return se("<",i,e)}s(Rp,"$lt");function Ap(i,e){return se("<=",i,e)}s(Ap,"$lte");function bp(i,e){return se("in",i,e)}s(bp,"$in");function wp(i,e){return se("!in",i,e)}s(wp,"$notIn");function Np(i,e){return se("like",i,e)}s(Np,"$like");function Dp(i,e){return se("!like",i,e)}s(Dp,"$notLike");function Sp(i,e){return se("ilike",i,e)}s(Sp,"$ilike");function Ip(i,e){return se("!ilike",i,e)}s(Ip,"$notILike");function Mp(i){return new it(i)}s(Mp,"$paren");function Lp(i){let e=new hr;return e.add=t=>(e.append("+",St(t)),e),e.sub=t=>(e.append("-",St(t)),e),e.mul=t=>(e.append("*",St(t)),e),e.div=t=>(e.append("/",St(t)),e),e.append("+",Yr(i)),e}s(Lp,"$arithmetic");function se(i,e,t){let r=Yr(e),n=Yr(t);return new rt({op:i,left:r,right:n})}s(se,"comparisonExpression");var Yr=s(i=>Array.isArray(i)?da(...i.map(St)):St(i),"wrapEntryValue"),St=s(i=>i instanceof q?i:typeof i=="boolean"?new nt(i):typeof i=="number"||typeof i=="bigint"?new ge(i):i==null?new ot:i instanceof Date?new xe(i):new at(""+i),"_wrapEntryValue");var ya=require("@browsery/antlr4");var h=require("@browsery/antlr4");var _=class _ extends h.Parser{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return _.literalNames}get symbolicNames(){return _.symbolicNames}get ruleNames(){return _.ruleNames}get serializedATN(){return _._serializedATN}createFailedPredicateException(e,t){return new h.FailedPredicateException(this,e,t)}constructor(e){super(e),this._interp=new h.ParserATNSimulator(this,_._ATN,_.DecisionsToDFA,new h.PredictionContextCache)}root(){let e=new To(this,this._ctx,this.state);this.enterRule(e,0,_.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(_.EOF)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}expression(e){e===void 0&&(e=0);let t=this._ctx,r=this.state,n=new re(this,this._ctx,r),o=n,a=2;this.enterRecursionRule(n,2,_.RULE_expression,e);let p;try{let c;this.enterOuterAlt(n,1);{switch(this.state=48,this._errHandler.sync(this),this._input.LA(1)){case 35:n=new xo(this,n),this._ctx=n,o=n,this.state=38,n._left=this.comparisonLeft(),this.state=39,n._operator=this.comparisonOperator(),this.state=40,n._right=this.comparisonRight();break;case 1:n=new Eo(this,n),this._ctx=n,o=n,this.state=42,this.match(_.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(_.T__1);break;case 3:case 4:n=new _o(this,n),this._ctx=n,o=n,this.state=46,p=this._input.LA(1),p===3||p===4?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=47,this.expression(1);break;default:throw new h.NoViableAltException(this)}for(this._ctx.stop=this._input.LT(-1),this.state=56,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx);c!==2&&c!==h.ATN.INVALID_ALT_NUMBER;){if(c===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),o=n;{if(n=new Er(this,new re(this,t,r)),this.pushNewRecursionContext(n,a,_.RULE_expression),this.state=50,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=51,n._op=this.logicalOperator(),this.state=52,this.expression(4)}}this.state=58,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx)}}}catch(c){if(c instanceof h.RecognitionException)n.exception=c,this._errHandler.reportError(this,c),this._errHandler.recover(this,c);else throw c}finally{this.unrollRecursionContexts(t)}return n}comparisonLeft(){let e=new Qr(this,this._ctx,this.state);this.enterRule(e,4,_.RULE_comparisonLeft);try{this.enterOuterAlt(e,1),this.state=59,this.qualifiedIdentifier()}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}comparisonRight(){let e=new Xr(this,this._ctx,this.state);this.enterRule(e,6,_.RULE_comparisonRight);try{switch(this.state=65,this._errHandler.sync(this),this._input.LA(1)){case 10:case 11:case 12:case 13:case 14:case 37:case 38:case 39:case 40:case 42:this.enterOuterAlt(e,1),this.state=61,this.value();break;case 35:this.enterOuterAlt(e,2),this.state=62,this.qualifiedIdentifier();break;case 6:this.enterOuterAlt(e,3),this.state=63,this.externalConstant();break;case 7:this.enterOuterAlt(e,4),this.state=64,this.arrayValue();break;default:throw new h.NoViableAltException(this)}}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}parenthesizedItem(){let e=new Zr(this,this._ctx,this.state);this.enterRule(e,8,_.RULE_parenthesizedItem);try{this.enterOuterAlt(e,1),this.state=67,this.expression(0)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}value(){let e=new Y(this,this._ctx,this.state);this.enterRule(e,10,_.RULE_value);try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 40:e=new Do(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(_.NUMBER);break;case 13:case 14:e=new wo(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new No(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new Oo(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 37:e=new bo(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(_.DATE);break;case 38:e=new Ro(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(_.DATETIME);break;case 39:e=new go(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(_.TIME);break;case 42:e=new Ao(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(_.STRING);break;default:throw new h.NoViableAltException(this)}}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}qualifiedIdentifier(){let e=new _r(this,this._ctx,this.state);this.enterRule(e,12,_.RULE_qualifiedIdentifier);try{let t;this.enterOuterAlt(e,1);{for(this.state=84,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);t!==2&&t!==h.ATN.INVALID_ALT_NUMBER;)t===1&&(this.state=79,this.identifier(),this.state=80,this.match(_.T__4)),this.state=86,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);this.state=87,this.identifier()}}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}externalConstant(){let e=new Hr(this,this._ctx,this.state);this.enterRule(e,14,_.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(_.T__5),this.state=90,this.identifier()}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}identifier(){let e=new It(this,this._ctx,this.state);this.enterRule(e,16,_.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(_.IDENTIFIER)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}arrayValue(){let e=new ei(this,this._ctx,this.state);this.enterRule(e,18,_.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(_.T__6),this.state=95,this.value(),this.state=100,this._errHandler.sync(this),t=this._input.LA(1);t===8;)this.state=96,this.match(_.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(_.T__8)}}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}boolean_(){let e=new ti(this,this._ctx,this.state);this.enterRule(e,20,_.RULE_boolean);let t;try{this.enterOuterAlt(e,1),this.state=105,t=this._input.LA(1),t===10||t===11?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}null_(){let e=new ri(this,this._ctx,this.state);this.enterRule(e,22,_.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(_.T__11)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}infinity(){let e=new ii(this,this._ctx,this.state);this.enterRule(e,24,_.RULE_infinity);let t;try{this.enterOuterAlt(e,1),this.state=109,t=this._input.LA(1),t===13||t===14?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}arithmeticOperator(){let e=new So(this,this._ctx,this.state);this.enterRule(e,26,_.RULE_arithmeticOperator);let t;try{this.enterOuterAlt(e,1),this.state=111,t=this._input.LA(1),!(t&-32)&&1<<t&491520?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}comparisonOperator(){let e=new ni(this,this._ctx,this.state);this.enterRule(e,28,_.RULE_comparisonOperator);let t;try{this.enterOuterAlt(e,1),this.state=113,t=this._input.LA(1),!(t&-32)&&1<<t&2146959360?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}logicalOperator(){let e=new oi(this,this._ctx,this.state);this.enterRule(e,30,_.RULE_logicalOperator);let t;try{this.enterOuterAlt(e,1),this.state=115,t=this._input.LA(1),!(t-31&-32)&&1<<t-31&15?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}polarityOperator(){let e=new Io(this,this._ctx,this.state);this.enterRule(e,32,_.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(_.POLAR_OP)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}sempred(e,t,r){switch(t){case 1:return this.expression_sempred(e,r)}return!0}expression_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,3)}return!0}static get _ATN(){return _.__ATN||(_.__ATN=new h.ATNDeserializer().deserialize(_._serializedATN)),_.__ATN}};s(_,"OpraFilterParser");var f=_;f.T__0=1;f.T__1=2;f.T__2=3;f.T__3=4;f.T__4=5;f.T__5=6;f.T__6=7;f.T__7=8;f.T__8=9;f.T__9=10;f.T__10=11;f.T__11=12;f.T__12=13;f.T__13=14;f.T__14=15;f.T__15=16;f.T__16=17;f.T__17=18;f.T__18=19;f.T__19=20;f.T__20=21;f.T__21=22;f.T__22=23;f.T__23=24;f.T__24=25;f.T__25=26;f.T__26=27;f.T__27=28;f.T__28=29;f.T__29=30;f.T__30=31;f.T__31=32;f.T__32=33;f.T__33=34;f.IDENTIFIER=35;f.POLAR_OP=36;f.DATE=37;f.DATETIME=38;f.TIME=39;f.NUMBER=40;f.INTEGER=41;f.STRING=42;f.WHITESPACE=43;f.EOF=h.Token.EOF;f.RULE_root=0;f.RULE_expression=1;f.RULE_comparisonLeft=2;f.RULE_comparisonRight=3;f.RULE_parenthesizedItem=4;f.RULE_value=5;f.RULE_qualifiedIdentifier=6;f.RULE_externalConstant=7;f.RULE_identifier=8;f.RULE_arrayValue=9;f.RULE_boolean=10;f.RULE_null=11;f.RULE_infinity=12;f.RULE_arithmeticOperator=13;f.RULE_comparisonOperator=14;f.RULE_logicalOperator=15;f.RULE_polarityOperator=16;f.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];f.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];f.ruleNames=["root","expression","comparisonLeft","comparisonRight","parenthesizedItem","value","qualifiedIdentifier","externalConstant","identifier","arrayValue","boolean","null","infinity","arithmeticOperator","comparisonOperator","logicalOperator","polarityOperator"];f._serializedATN=[4,1,43,120,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,49,8,1,1,1,1,1,1,1,1,1,5,1,55,8,1,10,1,12,1,58,9,1,1,2,1,2,1,3,1,3,1,3,1,3,3,3,66,8,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,78,8,5,1,6,1,6,1,6,5,6,83,8,6,10,6,12,6,86,9,6,1,6,1,6,1,7,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,5,9,99,8,9,10,9,12,9,102,9,9,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,16,0,1,2,17,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,0,6,1,0,3,4,1,0,10,11,1,0,13,14,1,0,15,18,1,0,19,30,1,0,31,34,117,0,34,1,0,0,0,2,48,1,0,0,0,4,59,1,0,0,0,6,65,1,0,0,0,8,67,1,0,0,0,10,77,1,0,0,0,12,84,1,0,0,0,14,89,1,0,0,0,16,92,1,0,0,0,18,94,1,0,0,0,20,105,1,0,0,0,22,107,1,0,0,0,24,109,1,0,0,0,26,111,1,0,0,0,28,113,1,0,0,0,30,115,1,0,0,0,32,117,1,0,0,0,34,35,3,2,1,0,35,36,5,0,0,1,36,1,1,0,0,0,37,38,6,1,-1,0,38,39,3,4,2,0,39,40,3,28,14,0,40,41,3,6,3,0,41,49,1,0,0,0,42,43,5,1,0,0,43,44,3,8,4,0,44,45,5,2,0,0,45,49,1,0,0,0,46,47,7,0,0,0,47,49,3,2,1,1,48,37,1,0,0,0,48,42,1,0,0,0,48,46,1,0,0,0,49,56,1,0,0,0,50,51,10,3,0,0,51,52,3,30,15,0,52,53,3,2,1,4,53,55,1,0,0,0,54,50,1,0,0,0,55,58,1,0,0,0,56,54,1,0,0,0,56,57,1,0,0,0,57,3,1,0,0,0,58,56,1,0,0,0,59,60,3,12,6,0,60,5,1,0,0,0,61,66,3,10,5,0,62,66,3,12,6,0,63,66,3,14,7,0,64,66,3,18,9,0,65,61,1,0,0,0,65,62,1,0,0,0,65,63,1,0,0,0,65,64,1,0,0,0,66,7,1,0,0,0,67,68,3,2,1,0,68,9,1,0,0,0,69,78,5,40,0,0,70,78,3,24,12,0,71,78,3,20,10,0,72,78,3,22,11,0,73,78,5,37,0,0,74,78,5,38,0,0,75,78,5,39,0,0,76,78,5,42,0,0,77,69,1,0,0,0,77,70,1,0,0,0,77,71,1,0,0,0,77,72,1,0,0,0,77,73,1,0,0,0,77,74,1,0,0,0,77,75,1,0,0,0,77,76,1,0,0,0,78,11,1,0,0,0,79,80,3,16,8,0,80,81,5,5,0,0,81,83,1,0,0,0,82,79,1,0,0,0,83,86,1,0,0,0,84,82,1,0,0,0,84,85,1,0,0,0,85,87,1,0,0,0,86,84,1,0,0,0,87,88,3,16,8,0,88,13,1,0,0,0,89,90,5,6,0,0,90,91,3,16,8,0,91,15,1,0,0,0,92,93,5,35,0,0,93,17,1,0,0,0,94,95,5,7,0,0,95,100,3,10,5,0,96,97,5,8,0,0,97,99,3,10,5,0,98,96,1,0,0,0,99,102,1,0,0,0,100,98,1,0,0,0,100,101,1,0,0,0,101,103,1,0,0,0,102,100,1,0,0,0,103,104,5,9,0,0,104,19,1,0,0,0,105,106,7,1,0,0,106,21,1,0,0,0,107,108,5,12,0,0,108,23,1,0,0,0,109,110,7,2,0,0,110,25,1,0,0,0,111,112,7,3,0,0,112,27,1,0,0,0,113,114,7,4,0,0,114,29,1,0,0,0,115,116,7,5,0,0,116,31,1,0,0,0,117,118,5,36,0,0,118,33,1,0,0,0,6,48,56,65,77,84,100];f.DecisionsToDFA=f._ATN.decisionToState.map((i,e)=>new h.DFA(i,e));var ha=f,Mo=class Mo extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(re,0)}EOF(){return this.getToken(f.EOF,0)}get ruleIndex(){return f.RULE_root}enterRule(e){e.enterRoot&&e.enterRoot(this)}exitRule(e){e.exitRoot&&e.exitRoot(this)}accept(e){return e.visitRoot?e.visitRoot(this):e.visitChildren(this)}};s(Mo,"RootContext");var To=Mo,Lo=class Lo extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_expression}copyFrom(e){super.copyFrom(e)}};s(Lo,"ExpressionContext");var re=Lo,vo=class vo extends re{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(Zr,0)}enterRule(e){e.enterParenthesizedExpression&&e.enterParenthesizedExpression(this)}exitRule(e){e.exitParenthesizedExpression&&e.exitParenthesizedExpression(this)}accept(e){return e.visitParenthesizedExpression?e.visitParenthesizedExpression(this):e.visitChildren(this)}};s(vo,"ParenthesizedExpressionContext");var Eo=vo,Po=class Po extends re{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(re,0)}enterRule(e){e.enterNegativeExpression&&e.enterNegativeExpression(this)}exitRule(e){e.exitNegativeExpression&&e.exitNegativeExpression(this)}accept(e){return e.visitNegativeExpression?e.visitNegativeExpression(this):e.visitChildren(this)}};s(Po,"NegativeExpressionContext");var _o=Po,Fo=class Fo extends re{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(Qr,0)}comparisonOperator(){return this.getTypedRuleContext(ni,0)}comparisonRight(){return this.getTypedRuleContext(Xr,0)}enterRule(e){e.enterComparisonExpression&&e.enterComparisonExpression(this)}exitRule(e){e.exitComparisonExpression&&e.exitComparisonExpression(this)}accept(e){return e.visitComparisonExpression?e.visitComparisonExpression(this):e.visitChildren(this)}};s(Fo,"ComparisonExpressionContext");var xo=Fo,ko=class ko extends re{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(re)}expression(e){return this.getTypedRuleContext(re,e)}logicalOperator(){return this.getTypedRuleContext(oi,0)}enterRule(e){e.enterLogicalExpression&&e.enterLogicalExpression(this)}exitRule(e){e.exitLogicalExpression&&e.exitLogicalExpression(this)}accept(e){return e.visitLogicalExpression?e.visitLogicalExpression(this):e.visitChildren(this)}};s(ko,"LogicalExpressionContext");var Er=ko,jo=class jo extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(_r,0)}get ruleIndex(){return f.RULE_comparisonLeft}enterRule(e){e.enterComparisonLeft&&e.enterComparisonLeft(this)}exitRule(e){e.exitComparisonLeft&&e.exitComparisonLeft(this)}accept(e){return e.visitComparisonLeft?e.visitComparisonLeft(this):e.visitChildren(this)}};s(jo,"ComparisonLeftContext");var Qr=jo,Uo=class Uo extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(Y,0)}qualifiedIdentifier(){return this.getTypedRuleContext(_r,0)}externalConstant(){return this.getTypedRuleContext(Hr,0)}arrayValue(){return this.getTypedRuleContext(ei,0)}get ruleIndex(){return f.RULE_comparisonRight}enterRule(e){e.enterComparisonRight&&e.enterComparisonRight(this)}exitRule(e){e.exitComparisonRight&&e.exitComparisonRight(this)}accept(e){return e.visitComparisonRight?e.visitComparisonRight(this):e.visitChildren(this)}};s(Uo,"ComparisonRightContext");var Xr=Uo,Co=class Co extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(re,0)}get ruleIndex(){return f.RULE_parenthesizedItem}enterRule(e){e.enterParenthesizedItem&&e.enterParenthesizedItem(this)}exitRule(e){e.exitParenthesizedItem&&e.exitParenthesizedItem(this)}accept(e){return e.visitParenthesizedItem?e.visitParenthesizedItem(this):e.visitChildren(this)}};s(Co,"ParenthesizedItemContext");var Zr=Co,Bo=class Bo extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_value}copyFrom(e){super.copyFrom(e)}};s(Bo,"ValueContext");var Y=Bo,qo=class qo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(f.TIME,0)}enterRule(e){e.enterTimeLiteral&&e.enterTimeLiteral(this)}exitRule(e){e.exitTimeLiteral&&e.exitTimeLiteral(this)}accept(e){return e.visitTimeLiteral?e.visitTimeLiteral(this):e.visitChildren(this)}};s(qo,"TimeLiteralContext");var go=qo,$o=class $o extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(ri,0)}enterRule(e){e.enterNullLiteral&&e.enterNullLiteral(this)}exitRule(e){e.exitNullLiteral&&e.exitNullLiteral(this)}accept(e){return e.visitNullLiteral?e.visitNullLiteral(this):e.visitChildren(this)}};s($o,"NullLiteralContext");var Oo=$o,Vo=class Vo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(f.DATETIME,0)}enterRule(e){e.enterDateTimeLiteral&&e.enterDateTimeLiteral(this)}exitRule(e){e.exitDateTimeLiteral&&e.exitDateTimeLiteral(this)}accept(e){return e.visitDateTimeLiteral?e.visitDateTimeLiteral(this):e.visitChildren(this)}};s(Vo,"DateTimeLiteralContext");var Ro=Vo,Ko=class Ko extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(f.STRING,0)}enterRule(e){e.enterStringLiteral&&e.enterStringLiteral(this)}exitRule(e){e.exitStringLiteral&&e.exitStringLiteral(this)}accept(e){return e.visitStringLiteral?e.visitStringLiteral(this):e.visitChildren(this)}};s(Ko,"StringLiteralContext");var Ao=Ko,zo=class zo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(f.DATE,0)}enterRule(e){e.enterDateLiteral&&e.enterDateLiteral(this)}exitRule(e){e.exitDateLiteral&&e.exitDateLiteral(this)}accept(e){return e.visitDateLiteral?e.visitDateLiteral(this):e.visitChildren(this)}};s(zo,"DateLiteralContext");var bo=zo,Jo=class Jo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(ii,0)}enterRule(e){e.enterInfinityLiteral&&e.enterInfinityLiteral(this)}exitRule(e){e.exitInfinityLiteral&&e.exitInfinityLiteral(this)}accept(e){return e.visitInfinityLiteral?e.visitInfinityLiteral(this):e.visitChildren(this)}};s(Jo,"InfinityLiteralContext");var wo=Jo,Go=class Go extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(ti,0)}enterRule(e){e.enterBooleanLiteral&&e.enterBooleanLiteral(this)}exitRule(e){e.exitBooleanLiteral&&e.exitBooleanLiteral(this)}accept(e){return e.visitBooleanLiteral?e.visitBooleanLiteral(this):e.visitChildren(this)}};s(Go,"BooleanLiteralContext");var No=Go,Wo=class Wo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(f.NUMBER,0)}enterRule(e){e.enterNumberLiteral&&e.enterNumberLiteral(this)}exitRule(e){e.exitNumberLiteral&&e.exitNumberLiteral(this)}accept(e){return e.visitNumberLiteral?e.visitNumberLiteral(this):e.visitChildren(this)}};s(Wo,"NumberLiteralContext");var Do=Wo,Yo=class Yo extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(It)}identifier(e){return this.getTypedRuleContext(It,e)}get ruleIndex(){return f.RULE_qualifiedIdentifier}enterRule(e){e.enterQualifiedIdentifier&&e.enterQualifiedIdentifier(this)}exitRule(e){e.exitQualifiedIdentifier&&e.exitQualifiedIdentifier(this)}accept(e){return e.visitQualifiedIdentifier?e.visitQualifiedIdentifier(this):e.visitChildren(this)}};s(Yo,"QualifiedIdentifierContext");var _r=Yo,Qo=class Qo extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(It,0)}get ruleIndex(){return f.RULE_externalConstant}enterRule(e){e.enterExternalConstant&&e.enterExternalConstant(this)}exitRule(e){e.exitExternalConstant&&e.exitExternalConstant(this)}accept(e){return e.visitExternalConstant?e.visitExternalConstant(this):e.visitChildren(this)}};s(Qo,"ExternalConstantContext");var Hr=Qo,Xo=class Xo extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(f.IDENTIFIER,0)}get ruleIndex(){return f.RULE_identifier}enterRule(e){e.enterIdentifier&&e.enterIdentifier(this)}exitRule(e){e.exitIdentifier&&e.exitIdentifier(this)}accept(e){return e.visitIdentifier?e.visitIdentifier(this):e.visitChildren(this)}};s(Xo,"IdentifierContext");var It=Xo,Zo=class Zo extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(Y)}value(e){return this.getTypedRuleContext(Y,e)}get ruleIndex(){return f.RULE_arrayValue}enterRule(e){e.enterArrayValue&&e.enterArrayValue(this)}exitRule(e){e.exitArrayValue&&e.exitArrayValue(this)}accept(e){return e.visitArrayValue?e.visitArrayValue(this):e.visitChildren(this)}};s(Zo,"ArrayValueContext");var ei=Zo,Ho=class Ho extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_boolean}enterRule(e){e.enterBoolean&&e.enterBoolean(this)}exitRule(e){e.exitBoolean&&e.exitBoolean(this)}accept(e){return e.visitBoolean?e.visitBoolean(this):e.visitChildren(this)}};s(Ho,"BooleanContext");var ti=Ho,es=class es extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_null}enterRule(e){e.enterNull&&e.enterNull(this)}exitRule(e){e.exitNull&&e.exitNull(this)}accept(e){return e.visitNull?e.visitNull(this):e.visitChildren(this)}};s(es,"NullContext");var ri=es,ts=class ts extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_infinity}enterRule(e){e.enterInfinity&&e.enterInfinity(this)}exitRule(e){e.exitInfinity&&e.exitInfinity(this)}accept(e){return e.visitInfinity?e.visitInfinity(this):e.visitChildren(this)}};s(ts,"InfinityContext");var ii=ts,rs=class rs extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_arithmeticOperator}enterRule(e){e.enterArithmeticOperator&&e.enterArithmeticOperator(this)}exitRule(e){e.exitArithmeticOperator&&e.exitArithmeticOperator(this)}accept(e){return e.visitArithmeticOperator?e.visitArithmeticOperator(this):e.visitChildren(this)}};s(rs,"ArithmeticOperatorContext");var So=rs,is=class is extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_comparisonOperator}enterRule(e){e.enterComparisonOperator&&e.enterComparisonOperator(this)}exitRule(e){e.exitComparisonOperator&&e.exitComparisonOperator(this)}accept(e){return e.visitComparisonOperator?e.visitComparisonOperator(this):e.visitChildren(this)}};s(is,"ComparisonOperatorContext");var ni=is,ns=class ns extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_logicalOperator}enterRule(e){e.enterLogicalOperator&&e.enterLogicalOperator(this)}exitRule(e){e.exitLogicalOperator&&e.exitLogicalOperator(this)}accept(e){return e.visitLogicalOperator?e.visitLogicalOperator(this):e.visitChildren(this)}};s(ns,"LogicalOperatorContext");var oi=ns,os=class os extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}POLAR_OP(){return this.getToken(f.POLAR_OP,0)}get ruleIndex(){return f.RULE_polarityOperator}enterRule(e){e.enterPolarityOperator&&e.enterPolarityOperator(this)}exitRule(e){e.exitPolarityOperator&&e.exitPolarityOperator(this)}accept(e){return e.visitPolarityOperator?e.visitPolarityOperator(this):e.visitChildren(this)}};s(os,"PolarityOperatorContext");var Io=os;var ss=class ss extends j{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};s(ss,"ExternalConstant");var si=ss;var as=class as extends ya.ParseTreeVisitor{constructor(e){super(),this._timeZone=e==null?void 0:e.timeZone}visitChildren(e){let t=super.visitChildren(e);return Array.isArray(t)&&t.length<2?t[0]:t??e.getText()}defaultResult(){}visitRoot(e){return this.visit(e.expression())}visitParenthesizedExpression(e){let t=this.visit(e.parenthesizedItem());return new it(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new yr(t)}visitComparisonExpression(e){return new rt({op:e.comparisonOperator().getText(),left:this.visit(e.comparisonLeft()),right:this.visit(e.comparisonRight())})}visitLogicalExpression(e){let t=[],r=s((n,o)=>{for(let a of n){if(a instanceof Er&&a.logicalOperator().getText()===o){r(a.expression_list(),a.logicalOperator().getText());continue}let p=this.visit(a);t.push(p)}},"wrapChildren");return r(e.expression_list(),e.logicalOperator().getText()),new ve({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new st(e.getText())}visitExternalConstant(e){return new si(e.identifier().getText())}visitNullLiteral(){return new ot}visitBooleanLiteral(e){return new nt(e.getText()==="true")}visitNumberLiteral(e){return new ge(e.getText())}visitStringLiteral(e){return new at(Tr(e.getText()))}visitInfinityLiteral(){return new ge(1/0)}visitDateLiteral(e){return new xe(Tr(e.getText()))}visitDateTimeLiteral(e){return new xe(Tr(e.getText()))}visitTimeLiteral(e){return new pt(Tr(e.getText()))}visitArrayValue(e){return new tt(e.value_list().map(t=>this.visit(t)))}};s(as,"FilterTreeVisitor");var xr=as;var Ta=require("@browsery/antlr4");var ps=class ps extends Ta.ErrorListener{constructor(e){super(),this.errors=e}syntaxError(e,t,r,n,o,a){this.errors.push(new Gr(o,{recognizer:e,offendingSymbol:t,line:r,column:n,e:a}))}};s(ps,"OpraErrorListener");var gr=ps;var ai=require("@browsery/antlr4");var ae=require("@browsery/antlr4");var z=class z extends ae.Lexer{constructor(e){super(e),this._interp=new ae.LexerATNSimulator(this,z._ATN,z.DecisionsToDFA,new ae.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return z.literalNames}get symbolicNames(){return z.symbolicNames}get ruleNames(){return z.ruleNames}get serializedATN(){return z._serializedATN}get channelNames(){return z.channelNames}get modeNames(){return z.modeNames}static get _ATN(){return z.__ATN||(z.__ATN=new ae.ATNDeserializer().deserialize(z._serializedATN)),z.__ATN}};s(z,"OpraFilterLexer");var y=z;y.T__0=1;y.T__1=2;y.T__2=3;y.T__3=4;y.T__4=5;y.T__5=6;y.T__6=7;y.T__7=8;y.T__8=9;y.T__9=10;y.T__10=11;y.T__11=12;y.T__12=13;y.T__13=14;y.T__14=15;y.T__15=16;y.T__16=17;y.T__17=18;y.T__18=19;y.T__19=20;y.T__20=21;y.T__21=22;y.T__22=23;y.T__23=24;y.T__24=25;y.T__25=26;y.T__26=27;y.T__27=28;y.T__28=29;y.T__29=30;y.T__30=31;y.T__31=32;y.T__32=33;y.T__33=34;y.IDENTIFIER=35;y.POLAR_OP=36;y.DATE=37;y.DATETIME=38;y.TIME=39;y.NUMBER=40;y.INTEGER=41;y.STRING=42;y.WHITESPACE=43;y.EOF=ae.Token.EOF;y.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];y.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];y.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];y.modeNames=["DEFAULT_MODE"];y.ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","T__14","T__15","T__16","T__17","T__18","T__19","T__20","T__21","T__22","T__23","T__24","T__25","T__26","T__27","T__28","T__29","T__30","T__31","T__32","T__33","IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE","DIGIT","DATEFORMAT","TIMEFORMAT","TIMEZONEOFFSETFORMAT","ESC","UNICODE","HEX"];y._serializedATN=[4,0,43,426,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,1,0,1,0,1,1,1,1,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,24,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,32,1,32,1,32,1,33,1,33,1,33,1,34,1,34,5,34,225,8,34,10,34,12,34,228,9,34,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,3,36,240,8,36,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,256,8,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,3,38,266,8,38,1,39,3,39,269,8,39,1,39,4,39,272,8,39,11,39,12,39,273,1,39,1,39,5,39,278,8,39,10,39,12,39,281,9,39,3,39,283,8,39,1,39,1,39,3,39,287,8,39,1,39,4,39,290,8,39,11,39,12,39,291,3,39,294,8,39,1,39,1,39,1,39,1,39,4,39,300,8,39,11,39,12,39,301,3,39,304,8,39,1,40,3,40,307,8,40,1,40,4,40,310,8,40,11,40,12,40,311,1,40,1,40,1,40,1,40,4,40,318,8,40,11,40,12,40,319,3,40,322,8,40,1,41,1,41,1,41,5,41,327,8,41,10,41,12,41,330,9,41,1,41,1,41,1,41,1,41,5,41,336,8,41,10,41,12,41,339,9,41,1,41,3,41,342,8,41,1,42,4,42,345,8,42,11,42,12,42,346,1,42,1,42,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,362,8,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,371,8,44,1,45,1,45,1,45,1,45,3,45,377,8,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,4,45,389,8,45,11,45,12,45,390,3,45,393,8,45,3,45,395,8,45,1,46,1,46,1,46,3,46,400,8,46,1,46,1,46,1,46,3,46,405,8,46,1,46,1,46,1,46,3,46,410,8,46,3,46,412,8,46,1,47,1,47,1,47,3,47,417,8,47,1,48,1,48,1,48,1,48,1,48,1,48,1,49,1,49,0,0,50,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,0,89,0,91,0,93,0,95,0,97,0,99,0,1,0,16,4,0,36,36,65,90,95,95,97,122,5,0,36,36,48,57,65,90,95,95,97,122,2,0,43,43,45,45,1,0,39,39,1,0,34,34,3,0,9,10,13,13,32,32,1,0,48,57,1,0,48,48,1,0,49,57,1,0,49,49,1,0,48,50,1,0,49,51,1,0,48,49,1,0,48,51,1,0,48,53,3,0,48,57,65,70,97,102,453,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,1,101,1,0,0,0,3,103,1,0,0,0,5,105,1,0,0,0,7,109,1,0,0,0,9,111,1,0,0,0,11,113,1,0,0,0,13,115,1,0,0,0,15,117,1,0,0,0,17,119,1,0,0,0,19,121,1,0,0,0,21,126,1,0,0,0,23,132,1,0,0,0,25,137,1,0,0,0,27,146,1,0,0,0,29,155,1,0,0,0,31,157,1,0,0,0,33,159,1,0,0,0,35,161,1,0,0,0,37,163,1,0,0,0,39,166,1,0,0,0,41,168,1,0,0,0,43,170,1,0,0,0,45,173,1,0,0,0,47,175,1,0,0,0,49,178,1,0,0,0,51,181,1,0,0,0,53,185,1,0,0,0,55,190,1,0,0,0,57,196,1,0,0,0,59,202,1,0,0,0,61,209,1,0,0,0,63,213,1,0,0,0,65,216,1,0,0,0,67,219,1,0,0,0,69,222,1,0,0,0,71,229,1,0,0,0,73,239,1,0,0,0,75,255,1,0,0,0,77,265,1,0,0,0,79,303,1,0,0,0,81,321,1,0,0,0,83,341,1,0,0,0,85,344,1,0,0,0,87,350,1,0,0,0,89,352,1,0,0,0,91,376,1,0,0,0,93,411,1,0,0,0,95,413,1,0,0,0,97,418,1,0,0,0,99,424,1,0,0,0,101,102,5,40,0,0,102,2,1,0,0,0,103,104,5,41,0,0,104,4,1,0,0,0,105,106,5,110,0,0,106,107,5,111,0,0,107,108,5,116,0,0,108,6,1,0,0,0,109,110,5,33,0,0,110,8,1,0,0,0,111,112,5,46,0,0,112,10,1,0,0,0,113,114,5,64,0,0,114,12,1,0,0,0,115,116,5,91,0,0,116,14,1,0,0,0,117,118,5,44,0,0,118,16,1,0,0,0,119,120,5,93,0,0,120,18,1,0,0,0,121,122,5,116,0,0,122,123,5,114,0,0,123,124,5,117,0,0,124,125,5,101,0,0,125,20,1,0,0,0,126,127,5,102,0,0,127,128,5,97,0,0,128,129,5,108,0,0,129,130,5,115,0,0,130,131,5,101,0,0,131,22,1,0,0,0,132,133,5,110,0,0,133,134,5,117,0,0,134,135,5,108,0,0,135,136,5,108,0,0,136,24,1,0,0,0,137,138,5,73,0,0,138,139,5,110,0,0,139,140,5,102,0,0,140,141,5,105,0,0,141,142,5,110,0,0,142,143,5,105,0,0,143,144,5,116,0,0,144,145,5,121,0,0,145,26,1,0,0,0,146,147,5,105,0,0,147,148,5,110,0,0,148,149,5,102,0,0,149,150,5,105,0,0,150,151,5,110,0,0,151,152,5,105,0,0,152,153,5,116,0,0,153,154,5,121,0,0,154,28,1,0,0,0,155,156,5,43,0,0,156,30,1,0,0,0,157,158,5,45,0,0,158,32,1,0,0,0,159,160,5,42,0,0,160,34,1,0,0,0,161,162,5,47,0,0,162,36,1,0,0,0,163,164,5,60,0,0,164,165,5,61,0,0,165,38,1,0,0,0,166,167,5,60,0,0,167,40,1,0,0,0,168,169,5,62,0,0,169,42,1,0,0,0,170,171,5,62,0,0,171,172,5,61,0,0,172,44,1,0,0,0,173,174,5,61,0,0,174,46,1,0,0,0,175,176,5,33,0,0,176,177,5,61,0,0,177,48,1,0,0,0,178,179,5,105,0,0,179,180,5,110,0,0,180,50,1,0,0,0,181,182,5,33,0,0,182,183,5,105,0,0,183,184,5,110,0,0,184,52,1,0,0,0,185,186,5,108,0,0,186,187,5,105,0,0,187,188,5,107,0,0,188,189,5,101,0,0,189,54,1,0,0,0,190,191,5,33,0,0,191,192,5,108,0,0,192,193,5,105,0,0,193,194,5,107,0,0,194,195,5,101,0,0,195,56,1,0,0,0,196,197,5,105,0,0,197,198,5,108,0,0,198,199,5,105,0,0,199,200,5,107,0,0,200,201,5,101,0,0,201,58,1,0,0,0,202,203,5,33,0,0,203,204,5,105,0,0,204,205,5,108,0,0,205,206,5,105,0,0,206,207,5,107,0,0,207,208,5,101,0,0,208,60,1,0,0,0,209,210,5,97,0,0,210,211,5,110,0,0,211,212,5,100,0,0,212,62,1,0,0,0,213,214,5,111,0,0,214,215,5,114,0,0,215,64,1,0,0,0,216,217,5,38,0,0,217,218,5,38,0,0,218,66,1,0,0,0,219,220,5,124,0,0,220,221,5,124,0,0,221,68,1,0,0,0,222,226,7,0,0,0,223,225,7,1,0,0,224,223,1,0,0,0,225,228,1,0,0,0,226,224,1,0,0,0,226,227,1,0,0,0,227,70,1,0,0,0,228,226,1,0,0,0,229,230,7,2,0,0,230,72,1,0,0,0,231,232,5,39,0,0,232,233,3,89,44,0,233,234,5,39,0,0,234,240,1,0,0,0,235,236,5,34,0,0,236,237,3,89,44,0,237,238,5,34,0,0,238,240,1,0,0,0,239,231,1,0,0,0,239,235,1,0,0,0,240,74,1,0,0,0,241,242,5,39,0,0,242,243,3,89,44,0,243,244,5,84,0,0,244,245,3,91,45,0,245,246,3,93,46,0,246,247,5,39,0,0,247,256,1,0,0,0,248,249,5,34,0,0,249,250,3,89,44,0,250,251,5,84,0,0,251,252,3,91,45,0,252,253,3,93,46,0,253,254,5,34,0,0,254,256,1,0,0,0,255,241,1,0,0,0,255,248,1,0,0,0,256,76,1,0,0,0,257,258,5,39,0,0,258,259,3,91,45,0,259,260,5,39,0,0,260,266,1,0,0,0,261,262,5,34,0,0,262,263,3,91,45,0,263,264,5,34,0,0,264,266,1,0,0,0,265,257,1,0,0,0,265,261,1,0,0,0,266,78,1,0,0,0,267,269,3,71,35,0,268,267,1,0,0,0,268,269,1,0,0,0,269,271,1,0,0,0,270,272,3,87,43,0,271,270,1,0,0,0,272,273,1,0,0,0,273,271,1,0,0,0,273,274,1,0,0,0,274,282,1,0,0,0,275,279,5,46,0,0,276,278,3,87,43,0,277,276,1,0,0,0,278,281,1,0,0,0,279,277,1,0,0,0,279,280,1,0,0,0,280,283,1,0,0,0,281,279,1,0,0,0,282,275,1,0,0,0,282,283,1,0,0,0,283,293,1,0,0,0,284,286,5,69,0,0,285,287,7,2,0,0,286,285,1,0,0,0,286,287,1,0,0,0,287,289,1,0,0,0,288,290,3,87,43,0,289,288,1,0,0,0,290,291,1,0,0,0,291,289,1,0,0,0,291,292,1,0,0,0,292,294,1,0,0,0,293,284,1,0,0,0,293,294,1,0,0,0,294,304,1,0,0,0,295,296,5,48,0,0,296,297,5,120,0,0,297,299,1,0,0,0,298,300,3,99,49,0,299,298,1,0,0,0,300,301,1,0,0,0,301,299,1,0,0,0,301,302,1,0,0,0,302,304,1,0,0,0,303,268,1,0,0,0,303,295,1,0,0,0,304,80,1,0,0,0,305,307,3,71,35,0,306,305,1,0,0,0,306,307,1,0,0,0,307,309,1,0,0,0,308,310,3,87,43,0,309,308,1,0,0,0,310,311,1,0,0,0,311,309,1,0,0,0,311,312,1,0,0,0,312,322,1,0,0,0,313,314,5,48,0,0,314,315,5,120,0,0,315,317,1,0,0,0,316,318,3,99,49,0,317,316,1,0,0,0,318,319,1,0,0,0,319,317,1,0,0,0,319,320,1,0,0,0,320,322,1,0,0,0,321,306,1,0,0,0,321,313,1,0,0,0,322,82,1,0,0,0,323,328,5,39,0,0,324,327,3,95,47,0,325,327,8,3,0,0,326,324,1,0,0,0,326,325,1,0,0,0,327,330,1,0,0,0,328,326,1,0,0,0,328,329,1,0,0,0,329,331,1,0,0,0,330,328,1,0,0,0,331,342,5,39,0,0,332,337,5,34,0,0,333,336,3,95,47,0,334,336,8,4,0,0,335,333,1,0,0,0,335,334,1,0,0,0,336,339,1,0,0,0,337,335,1,0,0,0,337,338,1,0,0,0,338,340,1,0,0,0,339,337,1,0,0,0,340,342,5,34,0,0,341,323,1,0,0,0,341,332,1,0,0,0,342,84,1,0,0,0,343,345,7,5,0,0,344,343,1,0,0,0,345,346,1,0,0,0,346,344,1,0,0,0,346,347,1,0,0,0,347,348,1,0,0,0,348,349,6,42,0,0,349,86,1,0,0,0,350,351,7,6,0,0,351,88,1,0,0,0,352,353,7,6,0,0,353,354,7,6,0,0,354,355,7,6,0,0,355,356,7,6,0,0,356,361,5,45,0,0,357,358,7,7,0,0,358,362,7,8,0,0,359,360,7,9,0,0,360,362,7,10,0,0,361,357,1,0,0,0,361,359,1,0,0,0,362,363,1,0,0,0,363,370,5,45,0,0,364,365,7,11,0,0,365,371,7,7,0,0,366,367,7,10,0,0,367,371,7,8,0,0,368,369,5,51,0,0,369,371,5,49,0,0,370,364,1,0,0,0,370,366,1,0,0,0,370,368,1,0,0,0,371,90,1,0,0,0,372,373,7,12,0,0,373,377,7,6,0,0,374,375,5,50,0,0,375,377,7,13,0,0,376,372,1,0,0,0,376,374,1,0,0,0,377,378,1,0,0,0,378,379,5,58,0,0,379,380,7,14,0,0,380,381,7,6,0,0,381,394,1,0,0,0,382,383,5,58,0,0,383,384,7,14,0,0,384,385,7,6,0,0,385,392,1,0,0,0,386,388,5,46,0,0,387,389,7,6,0,0,388,387,1,0,0,0,389,390,1,0,0,0,390,388,1,0,0,0,390,391,1,0,0,0,391,393,1,0,0,0,392,386,1,0,0,0,392,393,1,0,0,0,393,395,1,0,0,0,394,382,1,0,0,0,394,395,1,0,0,0,395,92,1,0,0,0,396,412,5,90,0,0,397,404,7,2,0,0,398,400,7,12,0,0,399,398,1,0,0,0,399,400,1,0,0,0,400,401,1,0,0,0,401,405,7,6,0,0,402,403,5,50,0,0,403,405,7,13,0,0,404,399,1,0,0,0,404,402,1,0,0,0,405,409,1,0,0,0,406,407,5,58,0,0,407,408,7,14,0,0,408,410,7,6,0,0,409,406,1,0,0,0,409,410,1,0,0,0,410,412,1,0,0,0,411,396,1,0,0,0,411,397,1,0,0,0,412,94,1,0,0,0,413,416,5,92,0,0,414,417,3,97,48,0,415,417,9,0,0,0,416,414,1,0,0,0,416,415,1,0,0,0,417,96,1,0,0,0,418,419,5,117,0,0,419,420,3,99,49,0,420,421,3,99,49,0,421,422,3,99,49,0,422,423,3,99,49,0,423,98,1,0,0,0,424,425,7,15,0,0,425,100,1,0,0,0,35,0,226,239,255,265,268,273,279,282,286,291,293,301,303,306,311,319,321,326,328,335,337,341,346,361,370,376,390,392,394,399,404,409,411,416,1,0,1,0];y.DecisionsToDFA=y._ATN.decisionToState.map((i,e)=>new ae.DFA(i,e));var Ea=y;function vp(i,e){let t=new ai.CharStream(i),r=new Ea(t),n=new ai.CommonTokenStream(r),o=new ha(n);o.buildParseTrees=!0;let a=[],p=new gr(a);r.removeErrorListeners(),r.addErrorListener(p),o.removeErrorListeners(),o.addErrorListener(p);let c=o.root();if(a.length){let l=[];for(let m of a)l.push(m.message+(i.includes(`
8
- `)?" at line: "+m.line+" column: "+m.column:" at column: "+m.column));let O=new Jr(l.join(`
9
- `));throw O.errors=a,O}return e=e||new xr,e.visit(c)}s(vp,"parse");var cs=class cs{constructor(e,t){if(this._rules=new F,Object.defineProperty(this,"_rules",{value:new F(null,{caseSensitive:t==null?void 0:t.caseSensitive}),enumerable:!1}),e)for(let[r,n]of Object.entries(e))this.set(r,n)}set(e,t){let r=typeof(t==null?void 0:t.operators)=="string"?t.operators.split(/\s*[,| ]\s*/):t==null?void 0:t.operators;this._rules.set(e,x({...t,operators:r}))}normalizeFilter(e,t){if(!e)return;let r=typeof e=="string"?J.parse(e):e;if(r instanceof J.ComparisonExpression){if(this.normalizeFilter(r.left,t),!(r.left instanceof J.QualifiedIdentifier&&r.left.field))throw new TypeError("Invalid filter query. Left side should be a data field.");let n=this._rules.get(r.left.value);if(!n)throw new de({message:A("error:UNACCEPTED_FILTER_FIELD",{field:r.left.value}),code:"UNACCEPTED_FILTER_FIELD",details:{field:r.left.value}});if(n.operators&&!n.operators.includes(r.op))throw new de({message:A("error:UNACCEPTED_FILTER_OPERATION",{field:r.left.value}),code:"UNACCEPTED_FILTER_OPERATION",details:{field:r.left.value,operator:r.op}});return this.normalizeFilter(r.right,t),r}return r instanceof J.LogicalExpression?(r.items.forEach(n=>this.normalizeFilter(n,t)),r):r instanceof J.ArithmeticExpression?(r.items.forEach(n=>this.normalizeFilter(n.expression,t)),r):r instanceof J.ArrayExpression?(r.items.forEach(n=>this.normalizeFilter(n,t)),r):r instanceof J.ParenthesizedExpression?(this.normalizeFilter(r.expression,t),r):(r instanceof J.QualifiedIdentifier&&t&&(r.value=t.normalizeFieldPath(r.value),r.field=t.getField(r.value),r.dataType=r.field.type),r)}toJSON(){return this._rules.toObject()}[Symbol.iterator](){return this._rules.entries()}};s(cs,"FilterRules");var Oe=cs;var Mt,pe=(Mt=class{constructor(e){e&&Object.assign(this,e)}[T](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.rules?new Oe(e.rules):void 0;return Pp(r,n)}[g](){return Fp}toJSON(e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");return{dataType:r.name?r.name:r.toJSON(),rules:e.rules}}},s(Mt,"FilterType"),Mt);(0,Fe.__decorate)([u.Attribute({description:"Data type which filtering fields belong to"}),(0,Fe.__metadata)("design:type",Object)],pe.prototype,"dataType",void 0);(0,Fe.__decorate)([u.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),(0,Fe.__metadata)("design:type",Object)],pe.prototype,"rules",void 0);pe=(0,Fe.__decorate)([u({description:"A query filter",nameMappings:{js:"object",json:"string"}}),(0,Fe.__metadata)("design:paramtypes",[Object])],pe);var Pp=s((i,e)=>(0,ls.validator)("decodeFilter",(t,r,n)=>{if(typeof t=="string")try{let o=J.parse(t);return e?e.normalizeFilter(o,i):o}catch(o){r.fail(n,`Not a valid filter expression. ${o.message}`,t,o.errors);return}r.fail(n,"Nt a valid filter expression string",t)}),"decodeFilter"),Fp=(0,ls.validator)("encodeFilter",(i,e,t)=>{if(i instanceof J.Ast)return i.toString();e.fail(t,"Not a valid filter expression",i)});var pi=require("tslib"),fs=require("valgen");var Lt,Or=(Lt=class{constructor(e){e&&Object.assign(this,e)}[T](){return fs.vg.isObjectId({coerce:!0})}[g](){return fs.vg.isObjectId({coerce:!0})}},s(Lt,"ObjectIdType"),Lt);Or=(0,pi.__decorate)([u({description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),(0,pi.__metadata)("design:paramtypes",[Object])],Or);var P=require("tslib");var vt,Q=(vt=class{constructor(e){e&&Object.assign(this,e)}},s(vt,"OperationResult"),vt);(0,P.__decorate)([k(),(0,P.__metadata)("design:type",Number)],Q.prototype,"affected",void 0);(0,P.__decorate)([k(),(0,P.__metadata)("design:type",Number)],Q.prototype,"totalMatches",void 0);(0,P.__decorate)([k(),(0,P.__metadata)("design:type",String)],Q.prototype,"context",void 0);(0,P.__decorate)([k(),(0,P.__metadata)("design:type",String)],Q.prototype,"type",void 0);(0,P.__decorate)([k(),(0,P.__metadata)("design:type",String)],Q.prototype,"message",void 0);(0,P.__decorate)([k({type:"any"}),(0,P.__metadata)("design:type",Object)],Q.prototype,"payload",void 0);(0,P.__decorate)([k({type:"object"}),(0,P.__metadata)("design:type",Array)],Q.prototype,"errors",void 0);Q=(0,P.__decorate)([Z({description:"Operation result"}),(0,P.__metadata)("design:paramtypes",[Object])],Q);(function(i){function e(t){var n;let r=(n=class extends i{constructor(...a){super(...a)}},s(n,"OperationResult_"),n);return(0,P.__decorate)([k({type:t,required:!0}),(0,P.__metadata)("design:type",Object)],r.prototype,"payload",void 0),r=(0,P.__decorate)([Z({embedded:!0}),(0,P.__metadata)("design:paramtypes",[Object])],r),r}s(e,"forPayload"),i.forPayload=e})(Q||(Q={}));var ke=require("tslib"),Rr=require("valgen");var kp=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,Pt,ct=(Pt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=Rr.vg.matches(kp,{formatName:"time",coerce:!0}),r=[];return e.minValue&&r.push(Rr.vg.isGte(e.minValue)),e.maxValue&&r.push(Rr.vg.isLte(e.maxValue)),r.length>0?Rr.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){return this[T](e)}},s(Pt,"TimeType"),Pt);(0,ke.__decorate)([u.Attribute({description:"Minimum value"}),(0,ke.__metadata)("design:type",String)],ct.prototype,"minValue",void 0);(0,ke.__decorate)([u.Attribute({description:"Maximum value"}),(0,ke.__metadata)("design:type",String)],ct.prototype,"maxValue",void 0);ct=(0,ke.__decorate)([u({description:"Time string in 24h format",nameMappings:{js:"string",json:"string"}}).Example("18:23:00","Full time value").Example("18:23:00","Time value without seconds"),(0,ke.__metadata)("design:paramtypes",[Object])],ct);var ci=require("tslib"),us=require("valgen");var Ft,Ar=(Ft=class{constructor(e){e&&Object.assign(this,e)}[T](){return us.vg.isURL({coerce:!0})}[g](){return us.vg.isURL({coerce:!0})}},s(Ft,"UrlType"),Ft);Ar=(0,ci.__decorate)([u({description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),(0,ci.__metadata)("design:paramtypes",[Object])],Ar);var Ut=require("tslib"),ms=require("valgen");var kt,jt=(kt=class{constructor(e){e&&Object.assign(this,e)}[T](e){return ms.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}[g](e){return ms.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}},s(kt,"UuidType"),kt);(0,Ut.__decorate)([u.Attribute({description:"Version of the UUID"}),(0,Ut.__metadata)("design:type",Number)],jt.prototype,"version",void 0);jt=(0,Ut.__decorate)([u({description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),(0,Ut.__metadata)("design:paramtypes",[Object])],jt);function je(i,e,t){let r=Cr(e.pick,e.omit),n=typeof i=="string"?i.charAt(0).toUpperCase()+i.substring(1):i.name,o=(t==null?void 0:t.name)||n+"Mapped",a={[o]:class{constructor(){typeof i=="function"&&Qt(this,i,r)}}}[o];if(typeof i=="function"&&Yt(a.prototype,i.prototype),typeof i=="function"){let c=Reflect.getOwnMetadata(E,i);if(!c)throw new TypeError(`Class "${i}" doesn't have datatype metadata information`);if(!(c.kind===d.ComplexType.Kind||c.kind===d.MappedType.Kind||c.kind===d.MixinType.Kind))throw new TypeError(`Class "${i}" is not a ${d.ComplexType.Kind}`)}let p={...t,kind:"MappedType",base:i};return e.pick&&(p.pick=e.pick),e.omit&&(p.omit=e.omit),e.partial&&(p.partial=e.partial),e.required&&(p.required=e.required),Reflect.defineMetadata(E,p,a),typeof i=="function"&&we._applyMixin(a,i,{...e,isInheritedPredicate:r}),a}s(je,"createMappedClass");function jp(i,e,t){return je(i,{omit:e},t)}s(jp,"OmitType");function Up(i,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return je(i,{partial:t},r)}s(Up,"PartialType");function Cp(i,e,t){return je(i,{pick:e},t)}s(Cp,"PickType");var li=require("tslib"),ds=require("valgen");var Ct,br=(Ct=class{constructor(e){e&&Object.assign(this,e)}[T](){return ds.isAny}[g](){return ds.isAny}},s(Ct,"AnyType"),Ct);br=(0,li.__decorate)([u({description:"Represents any value"}),(0,li.__metadata)("design:paramtypes",[Object])],br);var fi=require("tslib"),ft=require("valgen");var Ue=require("tslib"),lt=require("valgen");var Bt,ue=(Bt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=[];return e.minValue&&t.push(lt.vg.isGte(e.minValue)),e.maxValue&&t.push(lt.vg.isLte(e.maxValue)),t.length>0?lt.vg.pipe([lt.toNumber,...t],{returnIndex:0}):lt.toNumber}[g](e){return this[T](e)}},s(Bt,"NumberType"),Bt);(0,Ue.__decorate)([u.Attribute({description:"Determines the minimum value"}),(0,Ue.__metadata)("design:type",Number)],ue.prototype,"minValue",void 0);(0,Ue.__decorate)([u.Attribute({description:"Determines the maximum value"}),(0,Ue.__metadata)("design:type",Number)],ue.prototype,"maxValue",void 0);ue=(0,Ue.__decorate)([u({description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),(0,Ue.__metadata)("design:paramtypes",[Object])],ue);var qt,wr=(qt=class extends ue{constructor(e){super(e)}[T](e){let t=[];return e.minValue&&t.push(ft.vg.isGte(e.minValue)),e.maxValue&&t.push(ft.vg.isLte(e.maxValue)),t.length>0?ft.vg.pipe([ft.toBigint,...t],{returnIndex:0}):ft.toBigint}[g](e){return this[T](e)}},s(qt,"BigintType"),qt);wr=(0,fi.__decorate)([u({description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),(0,fi.__metadata)("design:paramtypes",[Object])],wr);var ui=require("tslib"),hs=require("valgen");var $t,Nr=($t=class{constructor(e){e&&Object.assign(this,e)}[T](){return hs.toBoolean}[g](){return hs.toBoolean}},s($t,"BooleanType"),$t);Nr=(0,ui.__decorate)([u({description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),(0,ui.__metadata)("design:paramtypes",[Object])],Nr);var mi=require("tslib"),ut=require("valgen");var Vt,Ce=(Vt=class extends ue{constructor(e){super(e)}[T](e){let t=[];return e.minValue&&t.push(ut.vg.isGte(e.minValue)),e.maxValue&&t.push(ut.vg.isLte(e.maxValue)),t.length>0?ut.vg.pipe([ut.toInteger,...t],{returnIndex:0}):ut.toInteger}[g](e){return this[T](e)}},s(Vt,"IntegerType"),Vt);Ce=(0,mi.__decorate)([u({description:"An integer number",nameMappings:{js:"number",json:"number"}}),(0,mi.__metadata)("design:paramtypes",[Object])],Ce);var di=require("tslib"),ys=require("valgen");var Kt,Dr=(Kt=class{constructor(e){e&&Object.assign(this,e)}[T](){return ys.isNull}[g](){return ys.isNull}},s(Kt,"NullType"),Kt);Dr=(0,di.__decorate)([u({description:"A Null value",nameMappings:{js:"null",json:"null"}}),(0,di.__metadata)("design:paramtypes",[Object])],Dr);var hi=require("tslib");var zt,Sr=(zt=class{constructor(e){e&&Object.assign(this,e)}},s(zt,"ObjectType"),zt);Sr=(0,hi.__decorate)([Z({name:"object",description:"A non modelled object",additionalFields:!0}),(0,hi.__metadata)("design:paramtypes",[Object])],Sr);var ce=require("tslib"),Be=require("valgen");var Jt,Re=(Jt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(E,Object.getPrototypeOf(this).constructor).name),t.push(Be.vg.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(Be.vg.lengthMin(e.minLength)),e.maxLength&&t.push(Be.vg.lengthMax(e.maxLength)),t.length>0?Be.vg.pipe([Be.toString,...t],{returnIndex:0}):Be.toString}[g](e){return this[T](e)}},s(Jt,"StringType"),Jt);(0,ce.__decorate)([u.Attribute({description:"Regex pattern to be used for validation"}),(0,ce.__metadata)("design:type",Object)],Re.prototype,"pattern",void 0);(0,ce.__decorate)([u.Attribute({description:"Name of the pattern"}),(0,ce.__metadata)("design:type",String)],Re.prototype,"patternName",void 0);(0,ce.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,ce.__metadata)("design:type",Number)],Re.prototype,"minLength",void 0);(0,ce.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,ce.__metadata)("design:type",Number)],Re.prototype,"maxLength",void 0);Re=(0,ce.__decorate)([u({description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),(0,ce.__metadata)("design:paramtypes",[Object])],Re);function Bp(i,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return je(i,{required:t},r)}s(Bp,"RequiredType");D.Entity={};D.Entity.Create=function(i,e){var o;let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=U(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return n.QueryParam("projection",{description:"Determines fields projection",type:new te({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((o=t.requestBody)==null?void 0:o.type)||t.type).Response(N.CREATED,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the created resource.',contentType:L.opra_response_json,type:t.type,partial:"deep"}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:L.opra_response_json}),r.push(a=>{let p=a.compositionOptions=a.compositionOptions||{};p.type=mt(t.type)}),n};D.Entity.Delete=function(i,e){let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=U(r,{method:"DELETE",...t,composition:"Entity.Delete"});return n.Response(N.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:L.opra_response_json}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:L.opra_response_json}),n.KeyParam=(o,a)=>{let p=typeof a=="string"||typeof a=="function"?{name:o,location:"path",type:a,keyParam:!0}:{...a,name:o,location:"path",keyParam:!0};return n.PathParam(o,p),r.push(c=>{var l;(l=c.path)!=null&&l.includes(":"+o)||(c.path=(c.path||"")+"@:"+o),c.mergePath=!0}),n},r.push(o=>{let a=o.compositionOptions=o.compositionOptions||{};a.type=mt(t.type)}),n};D.Entity.DeleteMany=function(i,e){let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=new Oe,o=new pe({dataType:t.type});o.rules={};let a=U(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return a.Response(N.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:L.opra_response_json}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:L.opra_response_json}).QueryParam("filter",{type:o,description:"Determines filter fields"}),r.push(p=>{let c=p.compositionOptions=p.compositionOptions||{};c.type=mt(t.type)}),a.Filter=(p,c,l)=>(r.push(()=>{n.set(p,{operators:c,description:l}),o.rules=n.toJSON()}),a),a};D.Entity.FindMany=function(i,e){let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=new Oe,o=new pe({dataType:t.type});o.rules={};let a=U(r,{method:"GET",...t,composition:"Entity.FindMany"});return a.Response(N.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains list of resources.',contentType:L.opra_response_json,type:t.type,partial:"deep",isArray:!0}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:L.opra_response_json}).QueryParam("limit",{description:"Determines number of returning instances",type:new Ce({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new Ce({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new te({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).QueryParam("filter",{type:o,description:"Determines filter fields"}).QueryParam("sort",{description:"Determines sort fields",type:new te({dataType:t.type,allowSigns:"first"}),isArray:!0,arraySeparator:","}),r.push(p=>{let c=p.compositionOptions=p.compositionOptions||{};c.type=mt(t.type),t.defaultLimit&&(c.defaultLimit=t.defaultLimit),t.defaultProjection&&(c.defaultProjection=t.defaultProjection),t.maxLimit&&(c.maxLimit=t.maxLimit)}),a.DefaultSort=(...p)=>(r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.defaultSort=p}),a),a.SortFields=(...p)=>(r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.sortFields=p}),a),a.Filter=(p,c,l)=>(r.push(()=>{n.set(p,{operators:c,description:l}),o.rules=n.toJSON()}),a),a};D.Entity.Get=function(i,e){let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=U(r,{method:"GET",...t,composition:"Entity.Get"});return n.QueryParam("projection",{description:"Determines fields projection",type:new te({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(N.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:L.opra_response_json,type:t.type,partial:"deep"}).Response(N.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:L.opra_response_json}),n.KeyParam=(o,a)=>{let p=typeof a=="string"||typeof a=="function"?{name:o,location:"path",type:a,keyParam:!0}:{...a,name:o,location:"path",keyParam:!0};return n.PathParam(o,p),r.push(c=>{var l;(l=c.path)!=null&&l.includes(":"+o)||(c.path=(c.path||"")+"@:"+o),c.mergePath=!0}),n},r.push(o=>{let a=o.compositionOptions=o.compositionOptions||{};a.type=mt(t.type)}),n};D.Entity.UpdateMany=function(i,e){var p;let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=new pe({dataType:t.type});n.rules={};let o=new Oe,a=U(r,{method:"PATCH",...t,composition:"Entity.UpdateMany",requestBody:{immediateFetch:!0,partial:"deep",...t.requestBody,required:!0}});return a.RequestContent(((p=t.requestBody)==null?void 0:p.type)||t.type).Response(N.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:L.opra_response_json}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:L.opra_response_json}).QueryParam("filter",{type:n,description:"Determines filter fields"}),r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.type=mt(t.type)}),a.Filter=(c,l,O)=>(r.push(()=>{o.set(c,{operators:l,description:O}),n.rules=o.toJSON()}),a),a};D.Entity.Update=function(i,e){var p;let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=new Oe,o=new pe({dataType:t.type});o.rules={};let a=U(r,{method:"PATCH",...t,composition:"Entity.Update",requestBody:{partial:"deep",immediateFetch:!0,...t.requestBody,required:!0}});return a.QueryParam("projection",{description:"Determines fields projection",type:new te({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).QueryParam("filter",{type:o,description:"Determines filter fields"}).RequestContent(((p=t.requestBody)==null?void 0:p.type)||t.type).Response(N.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',contentType:L.opra_response_json,type:t.type,partial:"deep"}).Response(N.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:L.opra_response_json}),a.KeyParam=(c,l)=>{let O=typeof l=="string"||typeof l=="function"?{name:c,location:"path",type:l,keyParam:!0}:{...l,name:c,location:"path",keyParam:!0};return a.PathParam(c,O),r.push(m=>{var $;($=m.path)!=null&&$.includes(":"+c)||(m.path=(m.path||"")+"@:"+c),m.mergePath=!0}),a},r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.type=mt(t.type)}),a.Filter=(c,l,O)=>(r.push(()=>{n.set(c,{operators:l,description:O}),o.rules=n.toJSON()}),a),a};function mt(i){if(typeof i=="string")return i;let e=Reflect.getMetadata(E,i);if(!e)throw new TypeError(`Type (${i}) is not decorated with any datatype decorators`);if(e!=null&&e.name)return e.name;throw new TypeError("You should provide named data type but embedded one found")}s(mt,"getDataTypeName");var qp="https://oprajs.com/spec/v"+d.SpecVersion,yi=class yi{static async createDocument(e,t){let r=new yi,n=t instanceof le?t:new le(t);try{let o=new Ne;if(await r.initDocument(o,n,e),n.error.details.length)throw n.error;return o}catch(o){try{o instanceof Ge||n.addError(o)}catch{}if(!n.error.message){let a=n.error.details.length;n.error.message=`(${a}) error${a>1?"s":""} found in document schema.`,n.showErrorDetails&&(n.error.message+=n.error.details.map(p=>`
6
+ "use strict";var ma=Object.create;var Wt=Object.defineProperty;var ha=Object.getOwnPropertyDescriptor;var da=Object.getOwnPropertyNames;var ya=Object.getPrototypeOf,Ta=Object.prototype.hasOwnProperty;var s=(i,e)=>Wt(i,"name",{value:e,configurable:!0});var Ti=(i,e)=>{for(var t in e)Wt(i,t,{get:e[t],enumerable:!0})},Os=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of da(e))!Ta.call(i,n)&&n!==t&&Wt(i,n,{get:()=>e[n],enumerable:!(r=ha(e,n))||r.enumerable});return i};var re=(i,e,t)=>(t=i!=null?ma(ya(i)):{},Os(e||!i||!i.__esModule?Wt(t,"default",{value:i,enumerable:!0}):t,i)),Ea=i=>Os(Wt({},"__esModule",{value:!0}),i);var vp={};Ti(vp,{AnyType:()=>br,ApiBase:()=>or,ApiDocument:()=>Le,ApiDocumentFactory:()=>_s,ApiField:()=>k,BUILTIN:()=>De,BadRequestError:()=>An,Base64Type:()=>fr,BaseI18n:()=>Is,BigintType:()=>wr,BooleanType:()=>Nr,CLASS_NAME_PATTERN:()=>K,ComplexType:()=>X,ConflictError:()=>wn,DATATYPE_METADATA:()=>E,DECODER:()=>T,DECORATOR:()=>I,DataType:()=>R,DataTypeMap:()=>_e,DateStringType:()=>Ye,DateTimeStringType:()=>Xe,DateTimeType:()=>Qe,DateType:()=>Ge,DocumentElement:()=>w,DocumentInitContext:()=>ce,DocumentNode:()=>rr,ENCODER:()=>O,EXTRACT_TYPENAME_PATTERN:()=>Xt,EmailType:()=>W,EnumType:()=>le,FailedDependencyError:()=>Dn,FieldPathType:()=>ee,FieldsProjection:()=>Se,FilterType:()=>ae,ForbiddenError:()=>hr,HTTP_CONTROLLER_METADATA:()=>ie,HttpApi:()=>ar,HttpController:()=>H,HttpHeaderCodes:()=>cn,HttpMediaType:()=>xe,HttpMultipartField:()=>pr,HttpOperation:()=>D,HttpOperationResponse:()=>cr,HttpParameter:()=>Tt,HttpRequestBody:()=>lr,HttpStatusCode:()=>N,HttpStatusMessages:()=>Qa,HttpStatusRange:()=>yt,I18n:()=>dt,IntegerType:()=>$e,InternalServerError:()=>Ln,IssueSeverity:()=>Yn,MappedType:()=>Ie,MethodNotAllowedError:()=>Mn,MimeTypes:()=>P,MixinType:()=>Je,NAMESPACE_PATTERN:()=>Ei,NotAcceptableError:()=>Fn,NotFoundError:()=>jn,NullType:()=>Dr,NumberType:()=>fe,ObjectIdType:()=>Or,ObjectType:()=>Sr,OmitType:()=>Sp,OperationResult:()=>Y,OpraDocumentError:()=>ze,OpraException:()=>me,OpraFilter:()=>It,OpraHttpError:()=>b,OpraSchema:()=>h,PartialType:()=>Ip,PermissionError:()=>Cn,PickType:()=>Lp,RequiredType:()=>Pp,ResourceConflictError:()=>qn,ResourceNotAvailableError:()=>Vn,ResponsiveMap:()=>F,SimpleType:()=>u,StringType:()=>Ne,TimeType:()=>nt,UnauthorizedError:()=>zn,UnprocessableEntityError:()=>Wn,UrlType:()=>Ar,UuidType:()=>jt,classes:()=>xs,cloneObject:()=>L,getErrorStack:()=>Da,getStackFileName:()=>Na,i18n:()=>vr,inheritPropertyInitializers:()=>Qt,isAsyncIterable:()=>wa,isBlob:()=>Oa,isConstructor:()=>Gt,isFormData:()=>Ra,isIterable:()=>ba,isReadable:()=>_a,isReadableStream:()=>ga,isStream:()=>Lr,isURL:()=>Aa,isWritable:()=>xa,kCtorMap:()=>Zt,kDataTypeMap:()=>V,kTypeNSMap:()=>Ee,mergePrototype:()=>Yt,omitNullish:()=>ws,omitUndefined:()=>g,parse:()=>gi,parseFieldsProjection:()=>xi,resolveThunk:()=>Te,safeJsonStringify:()=>Pa,translate:()=>A,uid:()=>ua.uid});module.exports=Ea(vp);var xE=require("reflect-metadata");BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});var Rs=re(require("putil-promisify"),1);function Gt(i){return typeof i=="function"&&i.prototype&&i.prototype.constructor===i&&i.prototype.constructor.name!=="Function"&&i.prototype.constructor.name!=="embedded"}s(Gt,"isConstructor");function Lr(i){return i!==null&&typeof i=="object"&&typeof i.pipe=="function"}s(Lr,"isStream");function _a(i){return Lr(i)&&typeof i._read=="function"&&typeof i._readableState=="object"}s(_a,"isReadable");function xa(i){return Lr(i)&&typeof i._write=="function"}s(xa,"isWritable");function ga(i){return Lr(i)&&typeof i.getReader=="function"&&typeof i.pipeThrough=="function"&&typeof i.pipeTo=="function"}s(ga,"isReadableStream");function Oa(i){return i!==null&&typeof i=="object"&&typeof i.size=="number"&&typeof i.arrayBuffer=="function"&&typeof i.stream=="function"}s(Oa,"isBlob");function Ra(i){return i!==null&&typeof i.constructor=="function"&&i.constructor.name==="FormData"&&typeof i.append=="function"&&typeof i.getAll=="function"}s(Ra,"isFormData");function Aa(i){return i!==null&&typeof i=="object"&&typeof i.host=="string"&&typeof i.href=="string"}s(Aa,"isURL");function ba(i){return Symbol.iterator in i}s(ba,"isIterable");function wa(i){return Symbol.asyncIterator in i}s(wa,"isAsyncIterable");async function Te(i){return i=Rs.default.isPromise(i)?await i:i,typeof i=="function"?Gt(i)?i:await i():i}s(Te,"resolveThunk");var As=/^(?:file:\/\/)?(.+)$/;function Na(i=1){if(i>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+i+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,n)=>n;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[i]?t[i].getFileName():void 0,n=r?As.exec(r):void 0;return n?n[1]:""}return""}s(Na,"getStackFileName");function Da(i=1){if(i>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+i+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,n)=>n;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[i]?t[i].getFileName():void 0,n=r?As.exec(r):void 0;return n?n[1]:""}return""}s(Da,"getErrorStack");function Yt(i,e,t){for(let r of Object.getOwnPropertyNames(e))r==="constructor"||r==="__proto__"||r==="toJSON"||r==="toString"||t&&!t(r)||Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(e,r)||Object.create(null))}s(Yt,"mergePrototype");function Qt(i,e,t=r=>!0){try{let r=new e;Object.getOwnPropertyNames(r).filter(o=>typeof r[o]<"u"&&typeof i[o]>"u").filter(o=>t(o)).forEach(o=>{i[o]=r[o]})}catch{}}s(Qt,"inheritPropertyInitializers");var Pr=re(require("putil-isplainobject"),1),bs=re(require("putil-merge"),1);var E=Symbol.for("opra.type.metadata"),ie=Symbol("opra.http-controller.metadata"),T=Symbol.for("opra.type.decoder"),O=Symbol("opra.type.encoder"),I=Symbol.for("DECORATOR"),De=Symbol.for("BUILTIN"),Ei=/([a-z$_]\w+):(.+)/i,K=/^[a-z][\w_]*$/i,Xt=/^(.*)Type(\d*)$/,V=Symbol.for("kDataTypeMap"),Zt=Symbol.for("kCtorMap"),Ee=Symbol.for("kTypeNSMap");function L(i,e){return(0,bs.default)({},i,{deep:s(t=>(0,Pr.default)(t)&&!t[E],"deep"),descriptor:!0,filter:s((t,r)=>{let n=t[r];return!e||typeof n!="function"&&(typeof n!="object"||(0,Pr.default)(n)||Array.isArray(n))},"filter")})}s(L,"cloneObject");function g(i,e){if(!(i&&typeof i=="object"))return i;for(let t of Object.keys(i))i[t]===void 0?delete i[t]:e&&typeof i[t]=="object"&&g(i[t]);return i}s(g,"omitUndefined");function ws(i,e){if(!(i&&typeof i=="object"))return i;for(let t of Object.keys(i))i[t]==null?delete i[t]:e&&(0,Pr.default)(i[t])&&ws(i[t]);return i}s(ws,"omitNullish");var _i=require("fast-tokenizer");var Sa=/^([+-])?([a-z_$]\w*)$/i,Ia=/[^.]\(/g,Oi=class Oi{};s(Oi,"FieldsProjection");var Se=Oi;(function(i){let t=class t{};s(t,"Item");let e=t;i.Item=e})(Se||(Se={}));function xi(i,e){let t=Array.isArray(i)?i:[i];if(!(t&&t.length))return;let r=new Se;for(let n of t)e||(n=n.toLowerCase()),gi(n,r);return r}s(xi,"parseFieldsProjection");function gi(i,e){i=i.replace(Ia,r=>r.charAt(0)+"."+r.substring(1));let t=(0,_i.splitString)(i,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let n=t[r];if(n.includes(",")){let c=(0,_i.splitString)(n,{delimiters:",",brackets:!0,keepBrackets:!0});for(let l of c)gi(l,e);continue}let o=Sa.exec(n);if(!o)throw new TypeError(`Invalid field path (${i})`);let a=o[2],p=e[a]=e[a]||new Se.Item;o[1]&&(p.sign=o[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new Se}}s(gi,"parse");function La(i){return i&&typeof i.forEach=="function"}s(La,"isMap");var J=Symbol.for("kEntries"),ue=Symbol.for("kKeyMap"),Mr=Symbol.for("kWellKnownKeys"),Ri=Symbol.for("kOptions"),ct=Symbol.for("kSize"),Ai=class Ai{constructor(e,t){Object.defineProperty(this,ct,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,J,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,ue,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,Mr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,Ri,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(n=>{r?this[Mr][n]=n:this[Mr][n.toLowerCase()]=n}),this.clear(),e&&this.setAll(e)}get size(){return this[ct]}clear(){Object.keys(this[J]).forEach(e=>delete this[J][e]),Object.keys(this[ue]).forEach(e=>delete this[ue][e]),this[ct]=0}forEach(e,t){for(let[r,n]of this.entries())e.call(t,n,r,this)}get(e){if(e)return this[J][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[J],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let n=Object.prototype.hasOwnProperty.call(this[J],r);return this[J][r]=t,n||this[ct]++,this[ue][r]=e,this}setAll(e){return La(e)?e.forEach((t,r)=>this.set(r,t)):Object.keys(e).forEach(t=>this.set(t,e[t])),this}keys(){return Object.values(this[ue])[Symbol.iterator]()}values(){return Object.values(this[J])[Symbol.iterator]()}entries(){return Object.entries(this[J])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[J],t);return delete this[J][t],delete this[ue][t],r||this[ct]--,r}sort(e){let t={...this[J]},r={...this[ue]},n=Array.from(this.keys());e?n.sort(e):n.sort(),this.clear();for(let o of n)this[J][o]=t[o],this[ue][o]=r[o];return this[ct]=n.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[ue]))e[r]=this[J][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[Ri].caseSensitive)return e;let t=this._getStoringKey(e);return this[ue][t]??this[Mr][t]??e}_getStoringKey(e){return this[Ri].caseSensitive?e:e.toLowerCase()}};s(Ai,"ResponsiveMap");var F=Ai;function Pa(i,e,t){let r=new WeakSet;return JSON.stringify(i,(n,o)=>{if(o!==null&&typeof o=="object"){if(r.has(o))return;r.add(o)}return e?e(n,o):o},t)}s(Pa,"safeJsonStringify");var h={};Ti(h,{ComplexType:()=>lt,EnumType:()=>ft,HttpController:()=>Ht,HttpOperation:()=>bi,MappedType:()=>ut,MixinType:()=>mt,SimpleType:()=>ht,SpecVersion:()=>Ma,isComplexType:()=>Fa,isDataType:()=>va,isEnumType:()=>Ca,isHttpController:()=>Ba,isMappedType:()=>Ua,isMixinType:()=>ja,isSimpleType:()=>ka});var Ma="1.0";var lt;(function(i){i.Kind="ComplexType"})(lt||(lt={}));var ft;(function(i){i.Kind="EnumType"})(ft||(ft={}));var ut;(function(i){i.Kind="MappedType"})(ut||(ut={}));var mt;(function(i){i.Kind="MixinType"})(mt||(mt={}));var ht;(function(i){i.Kind="SimpleType"})(ht||(ht={}));var Ht;(function(i){i.Kind="HttpController"})(Ht||(Ht={}));var bi;(function(i){i.Kind="HttpOperation"})(bi||(bi={}));function va(i){return i&&typeof i=="object"&&(i.kind===lt.Kind||i.kind===ft.Kind||i.kind===ut.Kind||i.kind===ht.Kind||i.kind===mt.Kind)}s(va,"isDataType");function Fa(i){return i&&typeof i=="object"&&i.kind===lt.Kind}s(Fa,"isComplexType");function ka(i){return i&&typeof i=="object"&&i.kind===ht.Kind}s(ka,"isSimpleType");function ja(i){return i&&typeof i=="object"&&i.kind===mt.Kind}s(ja,"isMixinType");function Ua(i){return i&&typeof i=="object"&&i.kind===ut.Kind}s(Ua,"isMappedType");function Ca(i){return i&&typeof i=="object"&&i.kind===ft.Kind}s(Ca,"isEnumType");function Ba(i){return i&&typeof i=="object"&&i.kind===Ht.Kind}s(Ba,"isHttpController");var Ss=re(require("@browsery/i18next"),1),tr=require("fast-tokenizer");var qa=/\\(.)/g,$a=/(\\)/g;function Ns(i){return i.replace($a,"\\\\")}s(Ns,"escapeString");function Ds(i){return i.replace(qa,"$1")}s(Ds,"unescapeString");var Is=Object.getPrototypeOf(Ss.default.createInstance()).constructor,er=class er extends Is{async init(e,t){let r=typeof e=="object"?e:{},n=typeof e=="function"?e:t;try{let o=await super.init(r,n),a=this.services.formatter;if(a.add("lowercase",(p,c)=>p.toLocaleLowerCase(c)),a.add("uppercase",(p,c)=>p.toLocaleUpperCase(c)),a.add("upperFirst",(p,c)=>p.charAt(0).toLocaleUpperCase(c)+p.substring(1)),r!=null&&r.resources)for(let p of Object.keys(r.resources)){let c=r.resources[p];for(let l of Object.keys(c))this.addResourceBundle(p,l,c[l],!1,!0)}return n&&n(null,o),o}catch(o){throw n&&n(o,this.t),o}}deep(e,t){if(e==null)return e;let r=new WeakMap;return this._deepTranslate(e,r,t)}createInstance(e,t){return new er(e,t)}static createInstance(e,t){return new er(e,t)}_deepTranslate(e,t,r){if(e==null||r!=null&&r.ignore&&r.ignore(e,this))return e;if(typeof e=="object"&&t.has(e))return t.get(e);if(typeof e=="string"){let n="";for(let o of(0,tr.tokenize)(e,{brackets:{"$t(":")"},quotes:!0,keepQuotes:!0,keepBrackets:!0,keepDelimiters:!0})){if(o.startsWith("$t(")&&o.endsWith(")")){o=o.substring(3,o.length-1);let a=(0,tr.splitString)(o,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),p=Ds(o.substring((a[0]||"").length+1));o=a[0]||"";let c=[],l=null;for(let m of(0,tr.tokenize)(o,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(m.startsWith("{")){l=JSON.parse(m);continue}c.push(m)}let x=c.length>1?"$t("+c.join(",")+")":c[0];n+=p?this.t(x,p,{...r,...l}):this.t(x,{...r,...l});continue}n+=o}return n}if(Array.isArray(e)){let n=Array(e.length);t.set(e,n);for(let o=0,a=e.length;o<a;o++)n[o]=this._deepTranslate(e[o],t,r);return t.delete(e),n}if(typeof e=="object"){if(Buffer.isBuffer(e)||Buffer.isBuffer(e)||e instanceof Symbol||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof WeakMap||e instanceof WeakSet)return e;let n={};t.set(e,n);let o=Object.keys(e);for(let a=0,p=o.length;a<p;a++){let c=o[a];n[c]=this._deepTranslate(e[c],t,r)}return t.delete(e),n}return e}static get defaultInstance(){return Va}};s(er,"I18n");var dt=er,Va=dt.createInstance();var Ka=/(\))/g;function A(i,e,t){let r=e&&typeof e=="object"?e:void 0,n=typeof e=="string"?e:t;return"$t("+i+(r?","+JSON.stringify(r):"")+(n?"?"+Ns(n).replace(Ka,"\\$1"):"")+")"}s(A,"translate");var vr=dt.createInstance();vr.init().catch(()=>{});var wi=class wi extends Error{constructor(e,t){super("Unknown error"),this.severity="error",t=t||(e instanceof Error?e:void 0),e instanceof Error&&(t=e),t&&t instanceof Error&&(this.cause=t,t.stack&&(this.stack=t.stack)),typeof e=="string"?this.initString(e):e instanceof Error?this.initError(e):this.init(e),this.message=this.message||this.constructor.name}toString(){return vr.deep(this.message)}toJSON(){var t;let e="production";return g({message:this.message,severity:this.severity,system:this.system,code:this.code,details:this.details,stack:e==="dev"||e==="development"||e==="test"?(t=this.stack)==null?void 0:t.split(`
7
+ `):void 0},!0)}init(e){this.message=(e==null?void 0:e.message)||this.constructor.name,this.severity=(e==null?void 0:e.severity)||"error",e&&(this.system=e.system,this.code=e.code,this.details=e.details)}initString(e){this.init({message:String(e||"")||this.constructor.name,severity:"error",code:this.constructor.name})}initError(e){this.init({message:e.message,severity:e.severity||"error",code:e.code||e.constructor.name})}};s(wi,"OpraException");var me=wi;var Ni=class Ni extends me{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};s(Ni,"OpraDocumentError");var ze=Ni;var Di=class Di{constructor(e){this.path="",this.error=new ze,this.showErrorDetails=!0,this.maxErrors=(e==null?void 0:e.maxErrors)||0,this.error.message=""}addError(e){if(!this.error.details.length)if(e instanceof Error)this.error.stack=e.stack;else{let t=new Error;Error.captureStackTrace(t,this.addError),this.error.stack=t.stack}if(this.error.add({message:typeof e=="string"?e:e.message,path:this.path,...typeof e=="object"?e:void 0}),this.error.details.length>=this.maxErrors)throw this.error}enter(e,t){let r=this.path;this.path=this.path+e;try{return t()}catch(n){n!==this.error&&this.addError(n)}finally{this.path=r}}async enterAsync(e,t){let r=this.path;this.path=this.path+e;try{return await t()}catch(n){n!==this.error&&this.addError(n)}finally{this.path=r}}extend(e){let t={...e};return Object.setPrototypeOf(t,this),t}};s(Di,"DocumentInitContext");var ce=Di;var Xl=require("reflect-metadata"),js=require("ts-gems");var Ls=re(require("lodash.omit"),1);function Si(i){return function(e){var n;let t;if(!(i!=null&&i.embedded))if(i!=null&&i.name){if(!K.test(i.name))throw new TypeError(`"${i.name}" is not a valid type name`);t=i.name}else t=((n=e.name.match(Xt))==null?void 0:n[1])||e.name;let r=Reflect.getOwnMetadata(E,e);r||(r={},Reflect.defineMetadata(E,r,e)),r.kind=h.ComplexType.Kind,r.name=t,i&&Object.assign(r,(0,Ls.default)(i,["kind","name","base","fields"]))}}s(Si,"ComplexTypeDecorator");var ks=require("ts-gems");var Ps=require("ts-gems"),Ms=require("uid");var Ii=class Ii{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[Ee])return this.element;if(this.parent)return this._document=this.parent.getDocument();throw new Error("ApiDocument not found in document tree")}hasDataType(e){var r;let t=(r=this[V])==null?void 0:r.has(e);return t||(this.parent?this.parent.hasDataType(e):!1)}findDataType(e){var r;let t=(r=this[V])==null?void 0:r.get(e);return t||(this.parent?this.parent.findDataType(e):void 0)}getDataType(e){let t=this.findDataType(e);if(t)return t;let r="";if(typeof e=="function")r=Reflect.getMetadata(E,e).name;else if(typeof e=="object"){let n=e[E];r=n==null?void 0:n.name}throw typeof e=="string"&&(r=e),new TypeError("Unknown data type"+(r?" ("+r+")":""))}getDataTypeNameWithNs(e){if(!e.name)return;let t=this.getDocument().getDataTypeNs(e);return t?t+":"+e.name:e.name}getComplexType(e){let t=this.getDataType(e);if(t.kind===h.ComplexType.Kind)return t;throw new TypeError(`Data type "${t.name}" is not a ComplexType`)}getSimpleType(e){let t=this.getDataType(e);if(t.kind===h.SimpleType.Kind)return t;throw new TypeError(`Data type "${t.name||t}" is not a SimpleType`)}getEnumType(e){let t=this.getDataType(e);if(t.kind===h.EnumType.Kind)return t;throw new TypeError(`Data type "${t.name||t}" is not a EnumType`)}getMappedType(e){let t=this.getDataType(e);if(t.kind===h.MappedType.Kind)return t;throw new TypeError(`Data type "${t.name||t}" is not a MappedType`)}getMixinType(e){let t=this.getDataType(e);if(t.kind===h.MixinType.Kind)return t;throw new TypeError(`Data type "${t.name||t}" is not a MixinType`)}};s(Ii,"DocumentNode");var rr=Ii;var w=s(function(i){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=(0,Ps.asMutable)(this);e.id=(0,Ms.uid)(16),Object.defineProperty(e,"node",{value:new rr(this,i==null?void 0:i.node),enumerable:!1,writable:!0}),i&&Object.defineProperty(e,"owner",{value:i,enumerable:!1,writable:!0})},"DocumentElement"),Pi=class Pi{};s(Pi,"DocumentElementClass");var Li=Pi;w.prototype=Li.prototype;function Mi(i){return function(e,t){if(typeof t!="string")throw new TypeError("Symbol properties can't be used as a field");let r=Reflect.getOwnMetadata(E,e.constructor)||{};r.kind=h.ComplexType.Kind,r.fields=r.fields||{};let n=Reflect.getMetadata("design:type",e,t),o=r.fields[t]={...i};n===Array?o.isArray=!0:o.type=o.type||n,Reflect.defineMetadata(E,r,e.constructor)}}s(Mi,"ApiFieldDecorator");var Fs=require("ts-gems"),he=require("valgen");var vs=require("ts-gems");var Fr=Symbol.for("nodejs.util.inspect.custom"),ir="\x1B[0m",kr="\x1B[33m",jr="\x1B[35m";var R=s(function(i,e,t){if(!this)throw new TypeError('"this" should be passed to call class constructor');if(e!=null&&e.name&&!K.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);w.call(this,i);let r=(0,vs.asMutable)(this);r.kind=e.kind,r.name=e.name,r.description=e.description,r.abstract=e.abstract,r.examples=e.examples},"DataType"),Fi=class Fi extends w{get embedded(){return!this.name}toJSON(){return g({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[Fr](){return`[${kr+Object.getPrototypeOf(this).constructor.name+ir} ${jr+this.name+ir}]`}};s(Fi,"DataTypeClass");var vi=Fi;R.prototype=vi.prototype;var za=/^([+-])?([a-z$_][\w.]*)$/i,S=s(function(...i){if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=i;R.call(this,e,t,r);let n=(0,Fs.asMutable)(this);n.fields=new F},"ComplexTypeBase"),ji=class ji extends R{findField(e){if(e.includes(".")){let r=this.parseFieldPath(e).pop();return r==null?void 0:r.field}return this.fields.get(e)}getField(e){let t=this.findField(e);if(!t)throw new Error(A("error:UNKNOWN_FIELD",{field:e}));return t}parseFieldPath(e,t){var m,$,gs;let r=this,n,o=e.split("."),a=o.length,p=[],c=this.owner.node.getDataType("object"),l=t==null?void 0:t.allowSigns,x=s(()=>p.map(Ke=>Ke.fieldName).join("."),"getStrPath");for(let Ke=0;Ke<a;Ke++){let Q={fieldName:o[Ke],dataType:c};p.push(Q);let Ir=za.exec(o[Ke]);if(!Ir)throw new TypeError(`Invalid field name (${x()})`);if(Ir[1]&&((Ke===0&&l==="first"||l==="each")&&(Q.sign=Ir[1]),Q.fieldName=Ir[2]),r){if(r instanceof S){if(n=r.fields.get(Q.fieldName),n){Q.fieldName=n.name,Q.field=n,Q.dataType=n.type,r=n.type;continue}if(((m=r.additionalFields)==null?void 0:m[0])===!0){Q.additionalField=!0,Q.dataType=c,r=void 0;continue}if((($=r.additionalFields)==null?void 0:$[0])==="type"&&((gs=r.additionalFields)==null?void 0:gs[1])instanceof R){Q.additionalField=!0,Q.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(yi=>yi.fieldName).join(".")})`)}throw new TypeError(`"${p.map(yi=>yi.fieldName).join(".")}" field is not a complex type and has no child fields`)}Q.additionalField=!0,Q.dataType=c}return p}normalizeFieldPath(e,t){return this.parseFieldPath(e,t).map(r=>(r.sign||"")+r.fieldName).join(".")}generateCodec(e,t){let r=Array.isArray(t==null?void 0:t.projection)?xi(t.projection):t==null?void 0:t.projection,n=this._generateSchema(e,{...t,projection:r,currentPath:""}),o;if(this.additionalFields instanceof R)o=this.additionalFields.generateCodec(e,t);else if(typeof this.additionalFields=="boolean")o=this.additionalFields;else if(Array.isArray(this.additionalFields))if(this.additionalFields.length<2)o="error";else{let a=o[1];o=(0,he.validator)((p,c,l)=>c.fail(l,a,p))}return he.vg.isObject(n,{ctor:this.name==="object"?Object:this.ctor,additionalFields:o,name:this.name,coerce:!0,caseInSensitive:t==null?void 0:t.caseInSensitive,onFail:t==null?void 0:t.onFail})}_generateSchema(e,t){var c;let r={},{currentPath:n,projection:o}=t,a=!!(o&&Object.values(o).find(l=>!l.sign)),p;for(let l of this.fields.values()){if(t.ignoreReadonlyFields&&l.readonly||t.ignoreWriteonlyFields&&l.writeonly||t.ignoreHiddenFields&&l.hidden){r[l.name]=he.vg.isUndefined({coerce:!0});continue}p=l.name;let x;if(o!=="*"&&(x=o==null?void 0:o[p.toLowerCase()],(x==null?void 0:x.sign)==="-"||a&&!x||!a&&l.exclusive&&!x)){r[l.name]=he.vg.isUndefined({coerce:!0});continue}let m=this._generateFieldCodec(e,l,{...t,partial:t.partial==="deep"?t.partial:void 0,projection:typeof o=="object"?((c=o[p])==null?void 0:c.projection)||"*":o,currentPath:n+(n?".":"")+p});r[p]=t.partial||!l.required?he.vg.optional(m):he.vg.required(m)}return r}_generateFieldCodec(e,t,r){let n=t.type.generateCodec(e,r);return t.fixed&&(n=he.vg.isEnum([t.fixed])),t.isArray&&(n=he.vg.isArray(n)),n}};s(ji,"ComplexTypeBaseClass");var ki=ji;S.prototype=ki.prototype;var k=s(function(...i){if(!this){let[o]=i;return k[I](o)}let[e,t]=i;w.call(this,e);let r=(0,ks.asMutable)(this);r.name=t.name;let n=t.origin||e;if(!(n instanceof S))throw new Error("Field origin should be one of ComplexType, MappedType or MixinType");r.origin=n,r.type=t.type||e.node.getDataType("any"),r.description=t.description,r.isArray=t.isArray,r.default=t.default,r.fixed=t.fixed,r.required=t.required,r.exclusive=t.exclusive,r.translatable=t.translatable,r.deprecated=t.deprecated,r.readonly=t.readonly,r.writeonly=t.writeonly,r.examples=t.examples,r.hidden=t.hidden},"ApiField"),Ci=class Ci extends w{toJSON(){var t;let e=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return g({type:e||((t=this.type)==null?void 0:t.toJSON()),description:this.description,isArray:this.isArray||void 0,default:this.default,fixed:this.fixed,required:this.required||void 0,exclusive:this.exclusive||void 0,translatable:this.translatable||void 0,deprecated:this.deprecated||void 0,readonly:this.readonly||void 0,writeonly:this.writeonly||void 0,examples:this.examples})}};s(Ci,"ApiFieldClass");var Ui=Ci;k.prototype=Ui.prototype;Object.assign(k,Mi);k[I]=Mi;var X=s(function(...i){var o;if(!this)return X[I].apply(void 0,i);let[e,t]=i,r=i[2]||new ce({maxErrors:0});S.call(this,e,t,r);let n=(0,js.asMutable)(this);n.kind=h.ComplexType.Kind,n.additionalFields=t.additionalFields,n.keyField=t.keyField,t.base&&r.enter(".base",()=>{if(!(t.base instanceof S))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);n.base=t.base,n.additionalFields==null&&n.base.additionalFields&&(n.additionalFields=n.base.additionalFields);for(let a of n.base.fields.values())this.fields.set(a.name,new k(this,a))}),n.ctor=t.ctor||((o=n.base)==null?void 0:o.ctor),t.fields&&r.enter(".fields",()=>{for(let[a,p]of Object.entries(t.fields)){let c=new k(this,{...p,name:a});this.fields.set(c.name,c)}})},"ComplexType"),qi=class qi extends S{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof S?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(){let e=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,t=g({...S.prototype.toJSON.call(this),kind:this.kind,base:this.base?e||this.base.toJSON():void 0});if(this.additionalFields)if(this.additionalFields instanceof R){let r=this.node.getDataTypeNameWithNs(this.additionalFields);t.additionalFields=r||this.additionalFields.toJSON()}else t.additionalFields=this.additionalFields;if(this.fields.size){let r={},n=0;for(let o of this.fields.values())o.origin===this&&(r[o.name]=o.toJSON(),n++);n&&(t.fields=r)}return g(t)}};s(qi,"ComplexTypeClass");var Bi=qi;X.prototype=Bi.prototype;Object.assign(X,Si);X[I]=Si;var cf=require("reflect-metadata"),Us=require("ts-gems"),Cs=require("valgen");var le=s(function(...i){if(!this)return le[I].apply(void 0,i);let[e,t,r]=i;R.call(this,e,t,r);let n=(0,Us.asMutable)(this);if(n.kind=h.EnumType.Kind,t.base){if(!(t.base instanceof le))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${n.kind}"`);n.base=t.base}n.instance=t.instance,n.ownAttributes=L(t.attributes||{}),n.attributes=n.base?L(n.base.attributes):{};for(let[o,a]of Object.entries(n.ownAttributes))n.attributes[o]=a},"EnumType"),$i=class $i extends R{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof le?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return Cs.vg.isEnum(Object.keys(this.attributes))}toJSON(){let e=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return g({...R.prototype.toJSON.call(this),base:this.base?e||this.base.toJSON():void 0,attributes:L(this.ownAttributes)})}};s($i,"EnumTypeClass");var nr=$i;le.prototype=nr.prototype;Object.assign(le,nr);function Ja(i,...e){let t=e.length>=2?e[0]:void 0,r=e.length>=2?e[1]:e[0],n={},o=i;if(Array.isArray(i)){if(t){if(!Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be array');o=[...t,...i]}n={},i.forEach(p=>{var l;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];n[p]=g({description:c})})}else{if(t){if(Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be enum object');o={...t,...i}}Object.keys(i).forEach(p=>{var l;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];n[i[p]]=g({alias:p,description:c})})}let a={kind:h.EnumType.Kind,attributes:n,base:r.base,name:r.name,description:r==null?void 0:r.description};return Object.defineProperty(i,E,{value:a,enumerable:!1,configurable:!0,writable:!0}),o}s(Ja,"EnumTypeFactory");le.prototype=nr.prototype;le[I]=Ja;var Ef=require("reflect-metadata"),Bs=require("ts-gems");function Ur(i,e){let t=i==null?void 0:i.map(n=>String(n).toLowerCase()),r=e==null?void 0:e.map(n=>String(n).toLowerCase());return n=>r&&r.includes(n.toLowerCase())?!1:t?t.includes(n.toLowerCase()):!0}s(Ur,"getIsInheritedPredicateFn");var Ie=s(function(...i){var o;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=i;S.call(this,e,t,r);let n=(0,Bs.asMutable)(this);if(n.kind=h.MappedType.Kind,t.base){if(!(t.base instanceof S))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);n.base=t.base,n.ctor=t.ctor||n.base.ctor,t.pick?n.pick=t.pick.map(l=>n.base.normalizeFieldPath(l)):t.omit?n.omit=t.omit.map(l=>n.base.normalizeFieldPath(l)):t.partial?n.partial=Array.isArray(t.partial)?t.partial.map(l=>n.base.normalizeFieldPath(l)):t.partial:t.required&&(n.required=Array.isArray(t.required)?t.required.map(l=>n.base.normalizeFieldPath(l)):t.required);let a=Ur(n.pick,n.omit),p=Array.isArray(n.partial)?n.partial.map(l=>l.toLowerCase()):n.partial,c=Array.isArray(n.required)?n.required.map(l=>l.toLowerCase()):n.required;for(let[l,x]of n.base.fields.entries()){if(!a(l))continue;let m={...x};p===!0||Array.isArray(p)&&p.includes(x.name.toLowerCase())?m.required=!1:(c===!0||Array.isArray(c)&&c.includes(x.name.toLowerCase()))&&(m.required=!0);let $=new k(this,m);n.fields.set($.name,$)}(!n.pick||n.base.additionalFields===!1||Array.isArray(n.base.additionalFields)&&((o=n.base.additionalFields)==null?void 0:o[0])==="error")&&(n.additionalFields=n.base.additionalFields),t.base.keyField&&a(t.base.keyField)&&(n.keyField=t.base.keyField)}},"MappedType"),Ki=class Ki extends S{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof S?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(){let e=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return g({...S.prototype.toJSON.call(this),base:e||this.base.toJSON(),kind:this.kind,pick:this.pick,omit:this.omit,partial:this.partial,required:this.required})}};s(Ki,"MappedTypeClass");var Vi=Ki;Ie.prototype=Vi.prototype;Ie._applyMixin=()=>{};var Nf=require("reflect-metadata"),qs=require("ts-gems");var Je=s(function(...i){if(!this)return Je[I].apply(void 0,i);let[e,t,r]=i;S.call(this,e,t,r);let n=(0,qs.asMutable)(this);n.kind=h.MixinType.Kind,n.types=[];for(let o of t.types){n.additionalFields!==!0&&(o.additionalFields===!0?n.additionalFields=!0:n.additionalFields||(n.additionalFields=o.additionalFields));for(let a of o.fields.values()){let p=new k(this,a);n.fields.set(p.name,p)}n.types.push(o),o.keyField&&(n.keyField=o.keyField)}},"MixinType"),Ji=class Ji extends S{extendsFrom(e){if(e instanceof R||(e=this.node.getDataType(e)),!(e instanceof S))return!1;if(e===this)return!0;for(let t of this.types)if(t.extendsFrom(e))return!0;return!1}toJSON(){return g({...S.prototype.toJSON.call(this),kind:this.kind,types:this.types.map(e=>{let t=this.node.getDataTypeNameWithNs(e);return t||e.toJSON()})})}};s(Ji,"MixinTypeClass");var zi=Ji;Je.prototype=zi.prototype;Je[I]=Wa;function Wa(...i){let e=i.filter(a=>typeof a=="function"),t=typeof i[i.length-1]=="object"?i[i.length-1]:void 0;if(!e.length)throw new TypeError("No Class has been provided");if(e.length===1)return e[0];let r=e[0].name+"Mixin",n={[r]:class{constructor(){for(let a of e)Qt(this,a)}}}[r],o={...t,kind:h.MixinType.Kind,types:[]};Reflect.defineMetadata(E,o,n);for(let a of e){let p=Reflect.getMetadata(E,a);if(!(p&&(p.kind===h.ComplexType.Kind||p.kind===h.MixinType.Kind||p.kind===h.MappedType.Kind)))throw new TypeError(`Class "${a.name}" is not a ${h.ComplexType.Kind}, ${h.MixinType.Kind} or ${h.MappedType.Kind}`);o.types.push(a),Yt(n.prototype,a.prototype)}return n}s(Wa,"MixinTypeFactory");var qf=require("reflect-metadata"),Ks=require("ts-gems"),Gi=require("valgen");var $s=re(require("lodash.omit"),1);function Wi(i){let e=[],t=s(function(r){var a;let n;if(!(i!=null&&i.embedded))if(i!=null&&i.name){if(!K.test(i.name))throw new TypeError(`"${i.name}" is not a valid type name`);n=i.name}else n=((a=r.name.match(Xt))==null?void 0:a[1])||r.name,n=n.toLowerCase();let o=Reflect.getOwnMetadata(E,r)||{};o.kind=h.SimpleType.Kind,o.name=n,i&&Object.assign(o,(0,$s.default)(i,["kind","name"])),Reflect.defineMetadata(E,o,r)},"decorator");return t.Example=(r,n)=>(e.push(o=>{o.examples=o.examples||[],o.examples.push({description:n,value:r})}),t),t}s(Wi,"SimpleTypeDecoratorFactory");function Vs(i){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(E,e.constructor)||{},n=Reflect.getMetadata("design:type",e,t),o="string";n===Boolean?o="boolean":n===Number&&(o="number"),r.kind=h.SimpleType.Kind,r.attributes=r.attributes||{},r.attributes[t]={format:(i==null?void 0:i.format)||o,description:i==null?void 0:i.description,deprecated:i==null?void 0:i.deprecated},Reflect.defineMetadata(E,r,e.constructor)}}s(Vs,"AttributeDecoratorFactory");var u=s(function(...i){var o,a;if(!this)return u[I](...i);let[e,t,r]=i;R.call(this,e,t,r);let n=(0,Ks.asMutable)(this);if(n.kind=h.SimpleType.Kind,t.base){if(!(t.base instanceof u))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);n.base=t.base}if(n.properties=t.properties,n.ownNameMappings={...t.nameMappings},n.nameMappings={...(o=n.base)==null?void 0:o.nameMappings,...t.nameMappings},n.ownAttributes=L(t.attributes||{}),n.attributes=n.base?L(n.base.attributes):{},n.ownAttributes)for(let[p,c]of Object.entries(n.ownAttributes)){if((a=n.attributes[p])!=null&&a.sealed)throw new TypeError(`Sealed attribute "${p}" can not be overwritten`);n.attributes[p]=c}n._generateDecoder=t.generateDecoder,n._generateEncoder=t.generateEncoder},"SimpleType"),Qi=class Qi extends R{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof u?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(e,t,r){let n={...this.properties,...r};if(e==="decode"){let a=this;for(;a;){if(a._generateDecoder)return a._generateDecoder(n,(t==null?void 0:t.documentElement)||this.owner);a=this.base}return Gi.isAny}let o=this;for(;o;){if(o._generateEncoder)return o._generateEncoder(n,(t==null?void 0:t.documentElement)||this.owner);o=this.base}return Gi.isAny}toJSON(){let e=g(this.ownAttributes),t;this.properties&&typeof this.properties.toJSON=="function"?t=this.properties.toJSON(this.properties,this.owner):t=this.properties?L(this.properties):{};let r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,n=g({...R.prototype.toJSON.apply(this),base:this.base?r||this.base.toJSON():void 0,attributes:e&&Object.keys(e).length?e:void 0,properties:Object.keys(t).length?t:void 0});return Object.keys(this.ownNameMappings).length&&(n.nameMappings={...this.ownNameMappings}),n}};s(Qi,"SimpleTypeClass");var Yi=Qi;u.prototype=Yi.prototype;Object.assign(u,Wi);u[I]=Wi;u.Attribute=Vs;var Xi=Symbol("initializing"),Zi=class Zi{static async createDataType(e,t,r){e=e||new ce({maxErrors:0});let n=await this._importDataTypeArgs(e,t,r);if(n)return typeof n=="string"?t.node.getDataType(n):this._createDataType(e,t,n)}static async addDataTypes(e,t,r){let n=t.node[V];if(!n)throw new TypeError("DocumentElement should has [kDataTypeMap] property");let o=await this.createAllDataTypes(e,t,r);if(o)for(let a of o)a!=null&&a.name&&n.set(a.name,a)}static async createAllDataTypes(e,t,r){e=e||new ce({maxErrors:0});let n=await this._prepareAllInitArgs(e,t,r);if(!n)return;let o=new F;for(let c of n)o.set(c.name,c);let a=e.extend({initArgsMap:o}),p=[];for(let[c,l]of o.entries())e.enter(`[${c}]`,()=>{if(!o.has(c))return;let x=this._createDataType(a,t,l);x&&p.push(x)});return p}static async _prepareAllInitArgs(e,t,r){let n=new F,o=new F,a=e.extend({owner:t,importQueue:n,initArgsMap:o});if(!t.node[V])throw new TypeError("DocumentElement should has [kDataTypeMap] property");if(Array.isArray(r)){let p=0;for(let c of r)await a.enterAsync(`$[${p++}]`,async()=>{c=await Te(c);let l=Reflect.getMetadata(E,c)||c[E];if(!(l&&l.name))return typeof c=="function"?a.addError(`Class "${c.name}" doesn't have a valid data type metadata`):a.addError("Object doesn't have a valid data type metadata");n.set(l.name,c)})}else{let p,c;for([c,p]of Object.entries(r))p=await Te(p),n.set(c,typeof p=="object"?{...p,name:c}:p)}for(let p of Array.from(n.keys())){if(!n.has(p))continue;let c=await this._importDataTypeArgs(a,t,p);c&&typeof c!="string"&&a.addError("Embedded data type can't be loaded into document node directly")}return Array.from(o.values())}static async _importDataTypeArgs(e,t,r){var x;r=await Te(r);let{importQueue:n,initArgsMap:o}=e,a=t.node.findDataType(r);if(a instanceof R)return a.name;let p,c,l;if(typeof r!="string"){let $=t.node.getDocument().types[Zt].get(r);$&&(r=$)}if(typeof r=="string"){let m=r;if(r=(n==null?void 0:n.get(m))||((x=e.initArgsMap)==null?void 0:x.get(m)),!r)return e.addError(`Unknown data type (${m})`)}if(typeof r=="function"){if(p=Reflect.getMetadata(E,r),!p)return e.addError(`Class "${r.name}" doesn't have a valid DataType metadata`);c=r}else if(typeof r=="object"){if(p=r[E],p)l=r,p.kind!==h.EnumType.Kind&&(p=void 0);else if(h.isDataType(r))p=r,c=p.ctor;else if(c=Object.getPrototypeOf(r).constructor,p=c&&Reflect.getMetadata(E,c),p&&p.kind===h.SimpleType.Kind){let m=await this._importDataTypeArgs(e,t,p.name);return m?typeof m=="object"&&m.kind!==h.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:h.SimpleType.Kind,name:void 0,base:m,properties:r}:void 0}}return p?e.enterAsync(p.name?`[${p.name}]`:"",async()=>{if(p.name){let $=o==null?void 0:o.get(p.name);if($)return $[Xi]?e.addError("Circular reference detected"):p.name}let m={kind:p.kind,name:p.name};m[Xi]=!0;try{if(m.name)if(n!=null&&n.has(m.name))o==null||o.set(p.name,m),m._instance={name:p.name},m[V]=t.node[V];else return e.addError(`Data Type (${m.name}) must be explicitly added to type list in the document scope`);switch(m.kind){case h.ComplexType.Kind:m.ctor=c,await this._prepareComplexTypeArgs(e,t,m,p);break;case h.EnumType.Kind:m.instance=l,await this._prepareEnumTypeArgs(e,t,m,p);break;case h.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,m,p);break;case h.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,m,p);break;case h.SimpleType.Kind:m.ctor=c,await this._prepareSimpleTypeArgs(e,t,m,p);break;default:return e.addError(`Invalid data type kind ${p.kind}`)}}finally{m.name&&(n==null||n.delete(m.name)),delete m[Xi]}return n&&m.name?m.name:m}):e.addError("No DataType metadata found")}static async _prepareDataTypeArgs(e,t,r){t.description=r.description,t.abstract=r.abstract,t.examples=r.examples}static async _prepareComplexTypeArgs(e,t,r,n){await this._prepareDataTypeArgs(e,r,n),await e.enterAsync(".base",async()=>{let o;if(n.base)o=await this._importDataTypeArgs(e,t,n.base);else if(r.ctor){let a=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(E,a)&&(o=await this._importDataTypeArgs(e,t,a))}o&&(r.base=We(o),r.ctor=r.ctor||o.ctor)}),n.additionalFields!=null&&(typeof n.additionalFields=="boolean"||Array.isArray(n.additionalFields)?r.additionalFields=n.additionalFields:await e.enterAsync(".additionalFields",async()=>{let o=await this._importDataTypeArgs(e,t,n.additionalFields);o&&(r.additionalFields=We(o))})),n.fields&&(r.fields={},await e.enterAsync(".fields",async()=>{for(let[o,a]of Object.entries(n.fields))await e.enterAsync(`[${o}]`,async()=>{let p=typeof a=="string"?{type:a}:a;if(p.isArray&&!p.type)return e.addError('"type" must be defined explicitly for array fields');let c=await this._importDataTypeArgs(e,t,p.type||"any");c&&(r.fields[o]={...p,type:We(c)})})}))}static async _prepareEnumTypeArgs(e,t,r,n){await this._prepareDataTypeArgs(e,r,n),n.base&&await e.enterAsync(".base",async()=>{let o=await this._importDataTypeArgs(e,t,n.base);o&&(r.base=We(o))}),r.attributes=L(n.attributes)}static async _prepareSimpleTypeArgs(e,t,r,n){var o,a,p,c;await this._prepareDataTypeArgs(e,r,n),await e.enterAsync(".base",async()=>{let l;if(n.base)l=await this._importDataTypeArgs(e,t,n.base);else if(r.ctor){let x=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(E,x)&&(l=await this._importDataTypeArgs(e,t,x))}l&&(r.base=We(l),r.ctor=r.ctor||l.ctor)}),r.properties=n.properties,r.nameMappings=n.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),n.attributes&&(r.attributes=L(n.attributes)),typeof((o=r.properties)==null?void 0:o[T])=="function"&&(r.generateDecoder=(a=r.properties)==null?void 0:a[T].bind(r.properties)),typeof((p=r.properties)==null?void 0:p[O])=="function"&&(r.generateEncoder=(c=r.properties)==null?void 0:c[O].bind(r.properties))}static async _prepareMappedTypeArgs(e,t,r,n){await this._prepareDataTypeArgs(e,r,n),await e.enterAsync(".base",async()=>{let o;if(n.base)o=await this._importDataTypeArgs(e,t,n.base);else if(r.ctor){let a=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(E,a)&&(o=await this._importDataTypeArgs(e,t,a))}o&&(r.base=We(o),r.ctor=r.ctor||o.ctor)}),n.pick?r.pick=[...n.pick]:n.omit?r.omit=[...n.omit]:n.partial?r.partial=Array.isArray(n.partial)?[...n.partial]:n.partial:n.required&&(r.required=Array.isArray(n.required)?[...n.required]:n.required)}static async _prepareMixinTypeArgs(e,t,r,n){await this._prepareDataTypeArgs(e,r,n),r.types=[],await e.enterAsync(".types",async()=>{let o=n.types,a=0;for(let p of o)await e.enterAsync(`[${a++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(We(c))})})}static _createDataType(e,t,r){var a;let n=t.node.findDataType(typeof r=="string"?r:r.name||"");if(n instanceof R)return n;let o=typeof r=="string"?(a=e.initArgsMap)==null?void 0:a.get(r):r;if(o){let p=o[V];switch(p||delete o._instance,n=o._instance,n!=null&&n.name&&p&&p.set(n.name,n),o==null?void 0:o.kind){case h.ComplexType.Kind:return this._createComplexType(e,t,o);case h.EnumType.Kind:return this._createEnumType(e,t,o);case h.MappedType.Kind:return this._createMappedType(e,t,o);case h.MixinType.Kind:return this._createMixinType(e,t,o);case h.SimpleType.Kind:return this._createSimpleType(e,t,o);default:break}}e.addError(`Unknown data type (${String(r)})`)}static _createComplexType(e,t,r){let n=r._instance||{};Object.setPrototypeOf(n,X.prototype);let o=L(r);return r.base&&e.enter(".base",()=>{o.base=this._createDataType(e,t,r.base)}),r.additionalFields&&e.enter(".additionalFields",()=>{typeof r.additionalFields=="boolean"||Array.isArray(r.additionalFields)?o.additionalFields=r.additionalFields:o.additionalFields=this._createDataType(e,t,r.additionalFields)}),o.fields={},r.fields&&e.enter(".fields",()=>{for(let[a,p]of Object.entries(r.fields))e.enter(`[${a}]`,()=>{let c=this._createDataType(e,t,p.type);c&&(o.fields[a]={...p,name:a,type:c})})}),X.apply(n,[t,o]),n}static _createEnumType(e,t,r){let n=r._instance||{};Object.setPrototypeOf(n,le.prototype);let o=L(r);return r.base&&e.enter(".base",()=>{o.base=this._createDataType(e,t,r.base)}),o.attributes=r.attributes,le.apply(n,[t,o]),n}static _createMappedType(e,t,r){let n=r._instance||{};Object.setPrototypeOf(n,Ie.prototype);let o=L(r);return r.base&&e.enter(".base",()=>{o.base=this._createDataType(e,t,r.base)}),Ie.apply(n,[t,o]),n}static _createMixinType(e,t,r){let n=r._instance||{};Object.setPrototypeOf(n,Je.prototype);let o=L(r);return r.types&&e.enter(".types",()=>{o.types=[];let a=0;for(let p of r.types)e.enter(`[${a++}]`,()=>{let c=this._createDataType(e,t,p);if(!(c instanceof S))throw new TypeError(`"${c==null?void 0:c.kind}" can't be set as base for a "${o.kind}"`);o.types.push(c)})}),Je.apply(n,[t,o]),n}static _createSimpleType(e,t,r){let n=r._instance||{};Object.setPrototypeOf(n,u.prototype);let o=L(r);return r.base&&e.enter(".base",()=>{o.base=this._createDataType(e,t,r.base)}),u.apply(n,[t,o]),n}};s(Zi,"DataTypeFactory");var Z=Zi;function We(i){return typeof i=="object"&&i.name?i.name:i}s(We,"preferName");var Hi=class Hi extends w{constructor(e){super(e),this.name="OpraApi"}toJSON(){return g({protocol:this.protocol,name:this.name,description:this.description})}async _initialize(e,t){if(!K.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};s(Hi,"ApiBase");var or=Hi;var Gs=re(require("path-browserify"),1),Ys=require("ts-gems");var zs,Js,ne=Symbol.for("kMap"),sr=Symbol.for("kCtorMap"),en=class en{constructor(){this[zs]=new F,this[Js]=new WeakMap}get size(){return this[ne].size}forEach(e,t){this[ne].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[sr].get(e);if(!t&&typeof e=="function"){let r=Reflect.getMetadata(E,e);t=r==null?void 0:r.name}if(!t&&typeof e=="object"){let r=e[E];t=r==null?void 0:r.name}return t?this[ne].get(t):void 0}set(e,t){this[ne].set(e,t),t.ctor?this[sr].set(t.ctor,e):t.instance&&this[sr].set(t.instance,e)}has(e){if(e instanceof R)return!!e.name&&this[ne].has(e.name);let t=typeof e=="string"?e:this[sr].get(e);return t?this[ne].has(t):!1}keys(){return this[ne].keys()}values(){return this[ne].values()}entries(){return this[ne].entries()}sort(e){return this[ne].sort(e),this}[(zs=ne,Js=sr,Symbol.iterator)](){return this[ne][Symbol.iterator]()}};s(en,"DataTypeMap");var _e=en;var Ws=re(require("lodash.omit"),1),Cr=re(require("putil-merge"),1);var Ya=/^(.*)(Controller)$/;function tn(i){let e=[],t=s(function(r){var c;let n=i==null?void 0:i.name;n||(n=((c=Ya.exec(r.name))==null?void 0:c[1])||r.name);let o={},a=Reflect.getOwnMetadata(ie,Object.getPrototypeOf(r));a&&(0,Cr.default)(o,a,{deep:!0});let p=Reflect.getOwnMetadata(ie,r);p&&(0,Cr.default)(o,p,{deep:!0}),(0,Cr.default)(o,{kind:h.HttpController.Kind,name:n,path:n,...(0,Ws.default)(i,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(ie,o,r);for(let l of e)l(o);Reflect.defineMetadata(ie,o,r)},"decorator");return t.Cookie=(r,n)=>(e.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"cookie",type:n}:{...n,name:r,location:"cookie"};o.parameters=o.parameters||[],o.parameters.push(a)}),t),t.Header=(r,n)=>(e.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"header",type:n}:{...n,name:r,location:"header"};o.parameters=o.parameters||[],o.parameters.push(a)}),t),t.QueryParam=(r,n)=>(e.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"query",type:n}:{...n,name:r,location:"query"};o.parameters=o.parameters||[],o.parameters.push(a)}),t),t.PathParam=(r,n)=>(e.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"path",type:n}:{...n,name:r,location:"path"};o.parameters=o.parameters||[],o.parameters.push(a)}),t),t.KeyParam=(r,n)=>(e.push(o=>{var p;(p=o.path)!=null&&p.includes(":"+r)||(o.path=(o.path||"")+"@:"+r);let a=typeof n=="string"||typeof n=="function"?{name:r,location:"path",type:n,keyParam:!0}:{...n,name:r,location:"path",keyParam:!0};o.parameters=o.parameters||[],o.parameters.push(a)}),t),t.UseType=(...r)=>(e.push(n=>{n.types=n.types||[],n.types.push(...r)}),t),t}s(tn,"HttpControllerDecoratorFactory");var H=s(function(...i){var n;if(!this)return H[I].apply(void 0,i);let[e,t]=i;if(w.call(this,e),!K.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,Ys.asMutable)(this);r.kind=h.HttpController.Kind,r.types=r.node[V]=new _e,r.operations=new F,r.controllers=new F,r.parameters=[],r.name=t.name,r.description=t.description,r.path=t.path??t.name,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(n=r._initialize)==null||n.call(r,t)},"HttpController"),nn=class nn extends w{get isRoot(){return!(this.owner instanceof H)}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values()){if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;if(r.controllers.size&&(t=r.findController(e),t))return this._controllerReverseMap.set(e,t),t}this._controllerReverseMap.set(e,null);return}if(e.startsWith("/")&&(e=e.substring(1)),e.includes("/")){let t=e.split("/"),r=this;for(;r&&t.length>0;)r=r.controllers.get(t.shift());return r}return this.controllers.get(e)}findParameter(e,t){let r=e.toLowerCase(),n;for(n of this.parameters)if(!(t&&t!==n.location)&&(typeof n.name=="string"&&(n._nameLower=n._nameLower||n.name.toLowerCase(),n._nameLower===r)||n.name instanceof RegExp&&n.name.test(e)))return n;if(this.node.parent&&this.node.parent.element instanceof H)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return Gs.default.posix.join(this.owner instanceof H?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(){let e=g({kind:this.kind,description:this.description,path:this.path});if(this.operations.size){e.operations={};for(let t of this.operations.values())e.operations[t.name]=t.toJSON()}if(this.controllers.size){e.controllers={};for(let t of this.controllers.values())e.controllers[t.name]=t.toJSON()}if(this.types.size){e.types={};for(let t of this.types.values())e.types[t.name]=t.toJSON()}if(this.parameters.length){e.parameters=[];for(let t of this.parameters)e.parameters.push(t.toJSON())}return e}[Fr](){return`[${kr}HttpController${jr+this.name+ir}]`}};s(nn,"HttpControllerClass");var rn=nn;H.prototype=rn.prototype;Object.assign(H,tn);H[I]=tn;var on=class on extends or{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.protocol="http",this.controllers=new F}findController(e){return H.prototype.findController.call(this,e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(){let t={...super.toJSON(),protocol:this.protocol,url:this.url,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};s(on,"HttpApi");var ar=on;var Qs=re(require("@browsery/type-is"),1),Xs=require("ts-gems"),Br=require("valgen");var xe=s(function(i,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');w.call(this,i);let t=(0,Xs.asMutable)(this);if(e.contentType){let r=Array.isArray(e.contentType)?e.contentType:[e.contentType];r=r.map(n=>n.split(/\s*,\s*/)).flat(),t.contentType=r.length>1?r:r[0]}t.description=e.description,t.contentEncoding=e.contentEncoding,t.examples=e.examples,t.multipartFields=[],t.maxFieldsSize=e.maxFieldsSize,t.maxFields=e.maxFields,t.maxFiles=e.maxFiles,t.maxFileSize=e.maxFileSize,t.maxTotalFileSize=e.maxTotalFileSize,e!=null&&e.type&&(t.type=(e==null?void 0:e.type)instanceof R?e.type:t.owner.node.getDataType(e.type)),t.isArray=e.isArray},"HttpMediaType"),an=class an extends w{findMultipartField(e,t){if(this.multipartFields){for(let r of this.multipartFields)if((!t||t===r.fieldType)&&(r.fieldName instanceof RegExp&&r.fieldName.test(e)||r.fieldName===e))return r}}toJSON(){var r,n;let e=this.type?this.node.getDataTypeNameWithNs(this.type):void 0,t=g({description:this.description,contentType:this.contentType,contentEncoding:this.contentEncoding,type:e||((r=this.type)==null?void 0:r.toJSON()),isArray:this.isArray,example:this.example,examples:this.examples,maxFields:this.maxFields,maxFieldsSize:this.maxFieldsSize,maxFiles:this.maxFiles,maxFileSize:this.maxFileSize,maxTotalFileSize:this.maxTotalFileSize});return(n=this.multipartFields)!=null&&n.length&&(t.multipartFields=this.multipartFields.map(o=>o.toJSON())),t}generateCodec(e,t){let r;return this.type?r=this.type.generateCodec(e,t):this.contentType&&(Array.isArray(this.contentType)?this.contentType:[this.contentType]).find(o=>Qs.default.is(o,["json"]))&&(r=this.node.findDataType("object").generateCodec(e)),r=r||Br.isAny,this.isArray?Br.vg.isArray(r):r}};s(an,"HttpMediaTypeClass");var sn=an;xe.prototype=sn.prototype;function qr(i,e){let t=i.lastIndexOf("/");if(i.startsWith("/")&&t){let r=i.substring(1,t),n=i.substring(t+1);if(e!=null&&e.includeFlags)for(let o of e==null?void 0:e.includeFlags)n.includes(o)||(n+=o);if(e!=null&&e.excludeFlags)for(let o of e==null?void 0:e.excludeFlags)n.replace(o,"");return new RegExp(r,n)}throw new TypeError(`"${i}" is not a valid RegExp string`)}s(qr,"parseRegExp");var pn=class pn extends xe{constructor(e,t){super(e,t),this.owner=e,this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?qr(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(){return g({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON()})}};s(pn,"HttpMultipartField");var pr=pn;var Hs=re(require("path-browserify"),1),ea=require("ts-gems");var Zs=re(require("lodash.omit"),1);var cn;(function(i){i.X_Opra_Version="X-Opra-Version",i.X_Total_Count="X-Total-Count",i.WWW_Authenticate="WWW-Authenticate",i.Authorization="Authorization",i.Proxy_Authenticate="Proxy-Authenticate",i.Proxy_Authorization="Proxy-Authorization",i.Age="Age",i.Cache_Control="Cache-Control",i.Clear_Site_Data="Clear-Site-Data",i.Expires="Expires",i.Pragma="Pragma",i.Last_Modified="Last-Modified",i.ETag="ETag",i.If_Match="If-Match",i.If_None_Match="If-None-Match",i.If_Modified_Since="If-Modified-Since",i.If_Unmodified_Since="If-Unmodified-Since",i.Vary="Vary",i.Connection="Connection",i.Keep_Alive="Keep-Alive",i.Accept="Accept",i.Accept_Encoding="Accept-Encoding",i.Accept_Language="Accept-Language",i.Expect="Expect",i.Cookie="Cookie",i.Set_Cookie="Set-Cookie",i.Access_Control_Allow_Origin="Access-Control-Allow-Origin",i.Access_Control_Allow_Credentials="Access-Control-Allow-Credentials",i.Access_Control_Allow_Headers="Access-Control-Allow-Headers",i.Access_Control_Allow_Methods="Access-Control-Allow-Methods",i.Access_Control_Expose_Headers="Access-Control-Expose-Headers",i.Access_Control_Max_Age="Access-Control-Max-Age",i.Access_Control_Request_Headers="Access-Control-Request-Headers",i.Access_Control_Request_Method="Access-Control-Request-Method",i.Origin="Origin",i.Timing_Allow_Origin="Timing-Allow-Origin",i.Content_Disposition="Content-Disposition",i.Content_ID="Content-ID",i.Content_Length="Content-Length",i.Content_Type="Content-Type",i.Content_Transfer_Encoding="Content-Transfer-Encoding",i.Content_Encoding="Content-Encoding",i.Content_Language="Content-Language",i.Content_Location="Content-Location",i.Forwarded="Forwarded",i.X_Forwarded_For="X-Forwarded-For",i.X_Forwarded_Host="X-Forwarded-Host",i.X_Forwarded_Proto="X-Forwarded-Proto",i.Via="Via",i.Location="Location",i.From="From",i.Host="Host",i.Referer="Referer",i.Referrer_Policy="Referrer-Policy",i.User_Agent="User-Agent",i.Allow="Allow",i.Server="Server",i.Accept_Ranges="Accept-Ranges",i.Range="Range",i.If_Range="If-Range",i.Content_Range="Content-Range",i.Cross_Origin_Embedder_Policy="Cross-Origin-Embedder-Policy",i.Cross_Origin_Opener_Policy="Cross-Origin-Opener-Policy",i.Cross_Origin_Resource_Policy="Cross-Origin-Resource-Policy",i.Content_Security_Policy="Content-Security-Policy",i.Content_Security_Policy_Report_Only="Content-Security-Policy-Report-Only",i.Expect_CT="Expect-CT",i.Feature_Policy="Feature-Policy",i.Strict_Transport_Security="Strict-Transport-Security",i.Upgrade="Upgrade",i.Upgrade_Insecure_Requests="Upgrade-Insecure-Requests",i.X_Content_Type_Options="X-Content-Type-Options",i.X_Download_Options="X-Download-Options",i.X_Frame_Options="X-Frame-Options",i.X_Permitted_Cross_Domain_Policies="X-Permitted-Cross-Domain-Policies",i.X_Powered_By="X-Powered-By",i.X_XSS_Protection="X-XSS-Protection",i.Transfer_Encoding="Transfer-Encoding",i.TE="TE",i.Trailer="Trailer",i.Sec_WebSocket_Key="Sec-WebSocket-Key",i.Sec_WebSocket_Extensions="Sec-WebSocket-Extensions",i.Sec_WebSocket_Accept="Sec-WebSocket-Accept",i.Sec_WebSocket_Protocol="Sec-WebSocket-Protocol",i.Sec_WebSocket_Version="Sec-WebSocket-Version",i.Date="Date",i.Retry_After="Retry-After",i.Server_Timing="Server-Timing",i.X_DNS_Prefetch_Control="X-DNS-Prefetch-Control",i.Max_Forwards="Max-Forwards"})(cn||(cn={}));var N;(function(i){i[i.CONTINUE=100]="CONTINUE",i[i.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",i[i.PROCESSING=102]="PROCESSING",i[i.EARLYHINTS=103]="EARLYHINTS",i[i.OK=200]="OK",i[i.CREATED=201]="CREATED",i[i.ACCEPTED=202]="ACCEPTED",i[i.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",i[i.NO_CONTENT=204]="NO_CONTENT",i[i.RESET_CONTENT=205]="RESET_CONTENT",i[i.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",i[i.AMBIGUOUS=300]="AMBIGUOUS",i[i.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",i[i.FOUND=302]="FOUND",i[i.SEE_OTHER=303]="SEE_OTHER",i[i.NOT_MODIFIED=304]="NOT_MODIFIED",i[i.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",i[i.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",i[i.BAD_REQUEST=400]="BAD_REQUEST",i[i.UNAUTHORIZED=401]="UNAUTHORIZED",i[i.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",i[i.FORBIDDEN=403]="FORBIDDEN",i[i.NOT_FOUND=404]="NOT_FOUND",i[i.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",i[i.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",i[i.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",i[i.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",i[i.CONFLICT=409]="CONFLICT",i[i.GONE=410]="GONE",i[i.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",i[i.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",i[i.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",i[i.URI_TOO_LONG=414]="URI_TOO_LONG",i[i.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",i[i.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",i[i.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",i[i.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",i[i.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",i[i.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",i[i.LOCKED=423]="LOCKED",i[i.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",i[i.TOO_EARLY=425]="TOO_EARLY",i[i.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",i[i.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",i[i.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",i[i.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",i[i.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",i[i.BAD_GATEWAY=502]="BAD_GATEWAY",i[i.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",i[i.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",i[i.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",i[i.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",i[i.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",i[i.LOOP_DETECTED=508]="LOOP_DETECTED",i[i.NOT_EXTENDED=510]="NOT_EXTENDED",i[i.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(N||(N={}));var Qa={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"};var P;(function(i){i.json="application/json",i.opra_response_json="application/opra.response+json",i.xml="application/XML",i.text="text/plain",i.html="text/html",i.markdown="text/markdown",i.binary="binary/octet-stream"})(P||(P={}));function U(i,e){let t=s((r,n)=>{if(typeof n!="string")throw new TypeError("Symbol properties can not be decorated");let o={kind:h.HttpOperation.Kind,...(0,Zs.default)(e,["kind"])},a=Reflect.getOwnMetadata(ie,r.constructor)||{};a.operations=a.operations||{},a.operations[n]=o;for(let p of i)p(o);Reflect.defineMetadata(ie,a,r.constructor)},"decorator");return t.Cookie=(r,n)=>(i.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"cookie",type:n}:{...n,name:r,location:"cookie"};o.parameters?o.parameters=o.parameters.filter(p=>!(p.location==="cookie"&&String(p.name)===String(r))):o.parameters=[],o.parameters.push(a)}),t),t.Header=(r,n)=>(i.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"header",type:n}:{...n,name:r,location:"header"};o.parameters?o.parameters=o.parameters.filter(p=>!(p.location==="header"&&String(p.name)===String(r))):o.parameters=[],o.parameters.push(a)}),t),t.QueryParam=(r,n)=>(i.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"query",type:n}:{...n,name:r,location:"query"};o.parameters?o.parameters=o.parameters.filter(p=>!(p.location==="query"&&String(p.name)===String(r))):o.parameters=[],o.parameters.push(a)}),t),t.PathParam=(r,n)=>(i.push(o=>{let a=typeof n=="string"||typeof n=="function"?{name:r,location:"path",type:n}:{...n,name:r,location:"path"};o.parameters?o.parameters=o.parameters.filter(p=>!(p.location==="path"&&String(p.name)===String(r))):o.parameters=[],o.parameters.push(a)}),t),t.Response=(r,n)=>{let o={...n,statusCode:r};return o.type&&(o.contentType=o.contentType||P.opra_response_json,o.contentEncoding=o.contentEncoding||"utf-8"),o.contentType===P.opra_response_json&&(o.contentEncoding=o.contentEncoding||"utf-8"),i.push(a=>{a.responses=a.responses||[],a.responses.push(o)}),t},t.RequestContent=function(r){let n=typeof r=="object"?r:{type:r};return n.type&&(n.contentType=n.contentType||P.json,n.contentEncoding=n.contentEncoding||"utf-8"),i.push(o=>{o.requestBody=o.requestBody||{required:!0,content:[]},o.requestBody.content=o.requestBody.content||[],o.requestBody.content.push(n)}),t},t.MultipartContent=function(r,n){let o={...r,contentType:(r==null?void 0:r.contentType)||"multipart/form-data"};if(i.push(a=>{a.requestBody=a.requestBody||{required:!0,content:[]},a.requestBody.content=a.requestBody.content||[],a.requestBody.content.push(o)}),n){let a={Field(p,c){return o.multipartFields=o.multipartFields||[],o.multipartFields.push({fieldName:p,fieldType:"field",...c}),a},File(p,c){return o.multipartFields=o.multipartFields||[],o.multipartFields.push({fieldName:p,fieldType:"file",...c}),a}};n(a)}return t},t.UseType=(...r)=>(i.push(n=>{n.types=n.types||[],n.types.push(...r)}),t),t}s(U,"HttpOperationDecoratorFactory");var D=s(function(...i){if(!this){let[n]=i,o=[];return D[I].call(void 0,o,n)}let[e,t]=i;if(w.call(this,e),!K.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,ea.asMutable)(this);r.parameters=[],r.responses=[],r.types=r.node[V]=new _e,r.name=t.name,r.path=t.path,r.mergePath=t.mergePath,r.method=t.method||"GET",r.description=t.description,r.composition=t.composition,r.compositionOptions=t.compositionOptions?L(t.compositionOptions):void 0},"HttpOperation"),fn=class fn extends w{findParameter(e,t){let r=e.toLowerCase(),n;for(n of this.parameters)if(!(t&&t!==n.location)&&(typeof n.name=="string"&&(n._nameLower=n._nameLower||n.name.toLowerCase(),n._nameLower===r)||n.name instanceof RegExp&&n.name.test(e)))return n}getFullUrl(){let e=this.owner.getFullUrl();return e?this.path?this.mergePath?e+this.path:Hs.default.posix.join(e,this.path):e:this.path||"/"}toJSON(){var t;let e=g({kind:h.HttpOperation.Kind,description:this.description,method:this.method,path:this.path,mergePath:this.mergePath,composition:this.composition,requestBody:(t=this.requestBody)==null?void 0:t.toJSON()});if(this.parameters.length){e.parameters=[];for(let r of this.parameters)e.parameters.push(r.toJSON())}return this.responses.length&&(e.responses=this.responses.map(r=>r.toJSON())),e}};s(fn,"HttpOperationClass");var ln=fn;D.prototype=ln.prototype;D[I]=U;D.GET=function(i){return U([],{...i,method:"GET"})};D.DELETE=function(i){return U([],{...i,method:"DELETE"})};D.HEAD=function(i){return U([],{...i,method:"HEAD"})};D.OPTIONS=function(i){return U([],{...i,method:"OPTIONS"})};D.PATCH=function(i){return U([],{...i,method:"PATCH"})};D.POST=function(i){return U([],{...i,method:"POST"})};D.PUT=function(i){return U([],{...i,method:"PUT"})};D.SEARCH=function(i){return U([],{...i,method:"SEARCH"})};var Xa=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,un=class un{constructor(e,t){if(this.start=0,this.end=0,e&&typeof e=="object"&&(this.start=e.start||0,this.end=e.end||0),typeof e=="number"&&(this.start=e,this.end=t||this.start),typeof e=="string"){let r=Xa.exec(e);if(!r)throw new TypeError(`"${e}" is not a valid Status Code range`);this.start=parseInt(r[1],10),this.end=r[2]?parseInt(r[2],10):this.start}}includes(e){return e>=this.start&&e<=this.end}intersects(e,t){return t>=this.start&&e<=this.end}toString(){return this.start===this.end?String(this.start):String(this.start)+"-"+String(this.end)}toJSON(){return!this.end||this.start===this.end?this.start:{start:this.start,end:this.end}}};s(un,"HttpStatusRange");var yt=un;var mn=class mn extends xe{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new yt(r.start,r.end):new yt(r)),this.partial=t.partial}findParameter(e,t){e=e.toLowerCase();for(let r of this.parameters)if((!t||t===r.location)&&(r.name instanceof RegExp&&r.name.test(e)||r.name===e))return r}toJSON(){let e=this.statusCode.map(r=>r.toJSON()),t=g({...super.toJSON(),statusCode:e.length===1&&typeof e[0]=="number"?e[0]:e,partial:this.partial});if(this.parameters.length){t.parameters=[];for(let r of this.parameters)t.parameters.push(r.toJSON())}return t}};s(mn,"HttpOperationResponse");var cr=mn;var ra=require("ts-gems");var ta=require("ts-gems");var $r=s(function(i,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');w.call(this,i);let t=(0,ta.asMutable)(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),dn=class dn extends w{toJSON(){let e=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return g({type:this.type?e||this.type.toJSON():"any",description:this.description,isArray:this.isArray,examples:this.examples})}};s(dn,"ValueClass");var hn=dn;$r.prototype=hn.prototype;var Tt=s(function(i,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');$r.call(this,i,e);let t=(0,ra.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?qr(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.location=e.location,t.deprecated=e.deprecated,t.required=e.required,t.required==null&&e.location==="path"&&(t.required=!0),t.arraySeparator=e.arraySeparator,t.keyParam=e.keyParam},"HttpParameter"),Tn=class Tn extends $r{toJSON(){return g({...super.toJSON(),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}};s(Tn,"HttpParameterClass");var yn=Tn;Tt.prototype=yn.prototype;var En=class En extends w{constructor(e){super(e),this.content=[]}toJSON(){return g({description:this.description,required:this.required,maxContentSize:this.maxContentSize,content:this.content.length?this.content.map(e=>e.toJSON()):[],partial:this.partial})}};s(En,"HttpRequestBody");var lr=En;var _n=class _n{static async createApi(e,t,r){let n=new ar(t);return n.name=r.name,n.description=r.description,n.url=r.url,r.controllers&&await e.enterAsync(".controllers",async()=>{if(Array.isArray(r.controllers))for(let o of r.controllers){let a=await this._createController(e,n,o);a&&n.controllers.set(a.name,a)}else for(let[o,a]of Object.entries(r.controllers)){let p=await this._createController(e,n,a,o);p&&n.controllers.set(p.name,p)}}),n}static async _createController(e,t,r,n){typeof r=="function"&&!Gt(r)&&(r=t instanceof H?r(t.instance):r()),r=await Te(r);let o,a,p;if(typeof r=="function"){if(a=Reflect.getMetadata(ie,r),!a)return e.addError(`Class "${r.name}" doesn't have a valid HttpController metadata`);o=r}else o=Object.getPrototypeOf(r).constructor,a=Reflect.getMetadata(ie,o),a?p=r:(a=r,r.instance==="object"&&(p=r.instance,o=Object.getPrototypeOf(p).constructor));if(!a)return e.addError(`Class "${o.name}" is not decorated with HttpController()`);if(n=n||a.name,!n)throw new TypeError("Controller name required");let c=new H(t,{...a,name:n,instance:p,ctor:o});return a.types&&await e.enterAsync(".types",async()=>{await Z.addDataTypes(e,c,a.types)}),a.parameters&&await e.enterAsync(".parameters",async()=>{let l=0;for(let x of a.parameters)await e.enterAsync(`[${l++}]`,async()=>{let m={...x};await e.enterAsync(".type",async()=>{x.type&&(m.type=c.node.findDataType(x.type)),!m.type&&typeof x.type=="object"&&(m.type=await Z.createDataType(e,c,x.type)),m.type||(m.type=c.node.getDataType("any"))});let $=new Tt(c,m);c.parameters.push($)})}),a.operations&&await e.enterAsync(".operations",async()=>{for(let[l,x]of Object.entries(a.operations))await e.enterAsync(`[${l}]`,async()=>{let m=new D(c,{name:l,method:"GET"});await this._initHttpOperation(e,m,x),c.operations.set(l,m)})}),a.controllers&&await e.enterAsync(".controllers",async()=>{if(Array.isArray(a.controllers)){let l=0;for(let x of a.controllers)await e.enterAsync(`[${l}]`,async()=>{let m=await this._createController(e,c,x);m&&(c.controllers.get(m.name)&&e.addError(`Duplicate controller name (${m.name})`),c.controllers.set(m.name,m))}),l++}else for(let[l,x]of Object.entries(a.controllers))await e.enterAsync(`[${l}]`,async()=>{let m=await this._createController(e,c,x,l);m&&(c.controllers.get(m.name)&&e.addError(`Duplicate controller name (${m.name})`),c.controllers.set(m.name,m))})}),c}static async _initHttpOperation(e,t,r){let n={...r,name:t.name,types:void 0};return D.apply(t,[t.owner,n]),r.types&&await e.enterAsync(".types",async()=>{await Z.addDataTypes(e,t,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let o=0;for(let a of r.parameters)await e.enterAsync(`[${o++}]`,async()=>{let p={...a};await e.enterAsync(".type",async()=>{a.type&&(p.type=t.node.findDataType(a.type)),!p.type&&typeof a.type=="object"&&(p.type=await Z.createDataType(e,t,a.type)),p.type||(p.type=t.node.getDataType("any"))});let c=new Tt(t,p);t.parameters.push(c)})}),r.responses&&await e.enterAsync(".responses",async()=>{let o=0;for(let a of r.responses)await e.enterAsync(`[${o++}]`,async()=>{let p=new cr(t,{statusCode:a.statusCode});await this._initHttpOperationResponse(e,p,a),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let o=new lr(t);await this._initHttpRequestBody(e,o,r.requestBody),t.requestBody=o}),t}static async _initHttpMediaType(e,t,r){xe.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{r.type&&(t.type=t.node.findDataType(r.type)),!t.type&&(typeof r.type=="object"||typeof r.type=="function")&&(t.type=await Z.createDataType(e,t,r.type)),t.type||(t.type=t.node.getDataType("any"))}),r.multipartFields&&await e.enterAsync(".multipartFields",async()=>{for(let n=0;n<r.multipartFields.length;n++)await e.enterAsync(`[${n}]`,async()=>{let o=r.multipartFields[n],a=new pr(t,{fieldName:o.fieldName,fieldType:o.fieldType});await this._initHttpMediaType(e,a,o),t.multipartFields.push(a)})})}static async _initHttpOperationResponse(e,t,r){await this._initHttpMediaType(e,t,r),t.partial=r.partial,r.parameters&&await e.enterAsync(".parameters",async()=>{let n=0;for(let o of r.parameters)await e.enterAsync(`[${n++}]`,async()=>{let a={...o};await e.enterAsync(".type",async()=>{o.type&&(a.type=t.node.findDataType(o.type)),!a.type&&typeof o.type=="object"&&(a.type=await Z.createDataType(e,t,o.type)),a.type||(a.type=t.node.getDataType("any"))});let p=new Tt(t,a);t.parameters.push(p)})})}static async _initHttpRequestBody(e,t,r){t.description=r.description,t.required=r.required,t.maxContentSize=r.maxContentSize,t.immediateFetch=r.immediateFetch,t.partial=r.partial,r.content&&await e.enterAsync(".content",async()=>{for(let n=0;n<r.content.length;n++)await e.enterAsync(`[${n}]`,async()=>{let o=r.content[n],a=new xe(t,String(n));await this._initHttpMediaType(e,a,o),t.content.push(a)})})}};s(_n,"HttpApiFactory");var Et=_n;var na=require("super-fast-md5");var ia,xn=class xn extends w{constructor(){super(null),this[ia]=new WeakMap,this.id="",this.info={},this.references=new F,this.types=new _e,this.node[V]=this.types,this.node.findDataType=this._findDataType.bind(this)}getDataTypeNs(e){let t=e instanceof R?this._findDataType(e.name||""):this._findDataType(e);if(t)return this[Ee].get(t)}findDocument(e){if(this.id===e)return this;for(let t of this.references.values()){if(t.id===e)return t;let r=t.findDocument(e);if(r)return r}}toJSON(){return this.export()}export(){let e=g({spec:h.SpecVersion,id:this.id,url:this.url,info:L(this.info,!0)});if(this.references.size){let t=0,r={};for(let[n,o]of this.references.entries())o[De]||(r[n]={id:o.id,url:o.url,info:L(o.info,!0)},t++);t&&(e.references=r)}if(this.types.size){e.types={};for(let t of this.types.values())e.types[t.name]=t.toJSON()}return this.api&&(e.api=this.api.toJSON()),e}invalidate(){let e=this.export();delete e.id,this.id=(0,na.md5)(JSON.stringify(e)),this[Ee]=new WeakMap}_findDataType(e,t){let r=this.types.get(e);if(r||!this.references.size)return r;if(typeof e=="string"){let o=Ei.exec(e);if(o){let a=o[1];if(a){let p=this.references.get(a);return p?(t=t||new WeakMap,t.set(this,!0),t.set(p,!0),p._findDataType(o[2],t)):void 0}e=o[2]}}t=t||new WeakMap,t.set(this,!0);let n=Array.from(this.references.keys()).reverse();for(let o of n){let a=this.references.get(o);if(r=a==null?void 0:a.types.get(e),r)return this[Ee].set(r,a!=null&&a[De]?"":o),r}for(let o of n){let a=this.references.get(o);if(t.set(a,!0),r=a._findDataType(e,t),r)return this[Ee].set(r,a!=null&&a[De]?"":o),r}}};s(xn,"ApiDocument");var Le=xn;ia=Ee;var Vr=require("tslib"),gn=require("valgen");var _t,fr=(_t=class{constructor(e){e&&Object.assign(this,e)}[T](){return gn.vg.isBase64({coerce:!0})}[O](){return gn.vg.isBase64({coerce:!0})}},s(_t,"Base64Type"),_t);fr=(0,Vr.__decorate)([u({description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),(0,Vr.__metadata)("design:paramtypes",[Object])],fr);var Pe=require("tslib"),C=require("valgen");var xt,Ge=(xt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=C.vg.isDate({precision:"date",coerce:!0}),r=[];return e.minValue&&((0,C.isDateString)(e.minValue),r.push(C.toString,C.vg.isGte(e.minValue))),e.maxValue&&((0,C.isDateString)(e.maxValue),r.push(C.toString,C.vg.isLte(e.maxValue))),r.length>0?C.vg.pipe([t,...r],{returnIndex:0}):t}[O](e){let t=C.vg.isDateString({precision:"date",trim:"date",coerce:!0}),r=[];return e.minValue&&((0,C.isDateString)(e.minValue),r.push(C.vg.isGte(e.minValue))),e.maxValue&&((0,C.isDateString)(e.maxValue),r.push(C.vg.isLte(e.maxValue))),r.length>0?C.vg.pipe([t,...r],{returnIndex:0}):t}},s(xt,"DateType"),xt);(0,Pe.__decorate)([u.Attribute({description:"Minimum value"}),(0,Pe.__metadata)("design:type",String)],Ge.prototype,"minValue",void 0);(0,Pe.__decorate)([u.Attribute({description:"Maximum value"}),(0,Pe.__metadata)("design:type",String)],Ge.prototype,"maxValue",void 0);Ge=(0,Pe.__decorate)([u({description:"A date without time",nameMappings:{js:"Date",json:"string"}}).Example("2021-04-18","Full date value"),(0,Pe.__metadata)("design:paramtypes",[Object])],Ge);var Me=require("tslib"),ur=require("valgen");var gt,Ye=(gt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=ur.vg.isDateString({trim:"date",coerce:!0}),r=[];return e.minValue&&r.push(ur.vg.isGte(e.minValue)),e.maxValue&&r.push(ur.vg.isLte(e.maxValue)),r.length>0?ur.vg.pipe([t,...r],{returnIndex:0}):t}[O](e){return this[T](e)}},s(gt,"DateStringType"),gt);(0,Me.__decorate)([u.Attribute({description:"Minimum value"}),(0,Me.__metadata)("design:type",String)],Ye.prototype,"minValue",void 0);(0,Me.__decorate)([u.Attribute({description:"Maximum value"}),(0,Me.__metadata)("design:type",String)],Ye.prototype,"maxValue",void 0);Ye=(0,Me.__decorate)([u({description:"Date string value",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18","Full date value").Example("2021-04","Date value without day").Example("2021","Year only value"),(0,Me.__metadata)("design:paramtypes",[Object])],Ye);var ve=require("tslib"),B=require("valgen");var Ot,Qe=(Ot=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=B.vg.isDate({precision:"time",coerce:!0}),r=[];return e.minValue&&((0,B.isDateString)(e.minValue),r.push(B.toString,B.vg.isGte(e.minValue))),e.maxValue&&((0,B.isDateString)(e.maxValue),r.push(B.toString,B.vg.isLte(e.maxValue))),r.length>0?B.vg.pipe([t,...r],{returnIndex:0}):t}[O](e){let t=B.vg.isDateString({precision:"time",trim:"time",coerce:!0}),r=[];return e.minValue&&((0,B.isDateString)(e.minValue),r.push(B.vg.isGte(e.minValue))),e.maxValue&&((0,B.isDateString)(e.maxValue),r.push(B.vg.isLte(e.maxValue))),r.length>0?B.vg.pipe([t,...r],{returnIndex:0}):t}},s(Ot,"DateTimeType"),Ot);(0,ve.__decorate)([u.Attribute({description:"Minimum value"}),(0,ve.__metadata)("design:type",String)],Qe.prototype,"minValue",void 0);(0,ve.__decorate)([u.Attribute({description:"Maximum value"}),(0,ve.__metadata)("design:type",String)],Qe.prototype,"maxValue",void 0);Qe=(0,ve.__decorate)([u({description:"A full datetime value",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15").Example("2021-04-18 22:30:15").Example("2021-04-18 22:30"),(0,ve.__metadata)("design:paramtypes",[Object])],Qe);var Fe=require("tslib"),mr=require("valgen");var Rt,Xe=(Rt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=mr.vg.isDateString({coerce:!0}),r=[];return e.minValue&&r.push(mr.vg.isGte(e.minValue)),e.maxValue&&r.push(mr.vg.isLte(e.maxValue)),r.length>0?mr.vg.pipe([t,...r]):t}[O](e){return this[T](e)}},s(Rt,"DateTimeStringType"),Rt);(0,Fe.__decorate)([u.Attribute({description:"Minimum value"}),(0,Fe.__metadata)("design:type",String)],Xe.prototype,"minValue",void 0);(0,Fe.__decorate)([u.Attribute({description:"Maximum value"}),(0,Fe.__metadata)("design:type",String)],Xe.prototype,"maxValue",void 0);Xe=(0,Fe.__decorate)([u({description:"DateTime string value",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15+01:00","Full date-time value with timezone").Example("2021-04-18T22:30:15","Full date-time value without timezone").Example("2021-04-18 22:30","Date-time value").Example("2021-04-18","Date value").Example("2021-04","Date value without day").Example("2021","Year only value"),(0,Fe.__metadata)("design:paramtypes",[Object])],Xe);var M=require("tslib"),On=require("valgen");var At,W=(At=class{constructor(e){e&&Object.assign(this,e)}[T](e){return On.vg.isEmail({...e,coerce:!0})}[O](e){return On.vg.isEmail({...e,coerce:!0})}},s(At,"EmailType"),At);(0,M.__decorate)([u.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),(0,M.__metadata)("design:type",Boolean)],W.prototype,"allowDisplayName",void 0);(0,M.__decorate)([u.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),(0,M.__metadata)("design:type",Boolean)],W.prototype,"requireDisplayName",void 0);(0,M.__decorate)([u.Attribute({description:"If set to `false`, the validator will not allow any non-English UTF8 character in email address's local part",default:!0}),(0,M.__metadata)("design:type",Boolean)],W.prototype,"utf8LocalPart",void 0);(0,M.__decorate)([u.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),(0,M.__metadata)("design:type",Boolean)],W.prototype,"ignoreMaxLength",void 0);(0,M.__decorate)([u.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),(0,M.__metadata)("design:type",Boolean)],W.prototype,"allowIpDomain",void 0);(0,M.__decorate)([u.Attribute({description:"If set to `true`, some additional validation will be enabled, e.g. disallowing certain syntactically valid email addresses that are rejected by GMail.",default:!1}),(0,M.__metadata)("design:type",Boolean)],W.prototype,"domainSpecificValidation",void 0);(0,M.__decorate)([u.Attribute({description:"If set to an array of strings and the part of the email after the @ symbol one of the strings defined in it, the validation fails."}),(0,M.__metadata)("design:type",Array)],W.prototype,"hostBlacklist",void 0);(0,M.__decorate)([u.Attribute({description:"If set to an array of strings and the part of the email after the @ symbol matches none of the strings defined in it, the validation fails."}),(0,M.__metadata)("design:type",Array)],W.prototype,"hostWhitelist",void 0);(0,M.__decorate)([u.Attribute({description:"If set to a string, then the validator will reject emails that include any of the characters in the string, in the name part."}),(0,M.__metadata)("design:type",String)],W.prototype,"blacklistedChars",void 0);W=(0,M.__decorate)([u({description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),(0,M.__metadata)("design:paramtypes",[Object])],W);var ke=require("tslib"),wt=require("valgen");var bt,ee=(bt=class{constructor(e){e&&Object.assign(this,e)}[T](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.allowSigns,o=(0,wt.validator)("decodeFieldPath",a=>r.normalizeFieldPath(a,{allowSigns:n}));return wt.vg.pipe([wt.toString,o])}[O](e,t){return this[T](e,t)}toJSON(e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=r?t.node.getDataTypeNameWithNs(r):void 0;return{dataType:n||r.toJSON(),allowSigns:e.allowSigns}}},s(bt,"FieldPathType"),bt);(0,ke.__decorate)([u.Attribute({description:"Data type which field belong to"}),(0,ke.__metadata)("design:type",Object)],ee.prototype,"dataType",void 0);(0,ke.__decorate)([u.Attribute({description:'Determines if signs (+,-) are allowed. If set "first" signs are allowed only beginning of the field pathIf set "each" signs are allowed at each field in the path'}),(0,ke.__metadata)("design:type",String)],ee.prototype,"allowSigns",void 0);ee=(0,ke.__decorate)([u({description:"Field path",nameMappings:{js:"string",json:"string"}}),(0,ke.__metadata)("design:paramtypes",[Object])],ee);var Ue=require("tslib"),us=require("valgen");var Rn=class Rn extends me{constructor(e,t,r){super(e,t instanceof Error?t:void 0),this.status=(typeof t=="number"?t:Number(r))||500}setStatus(e){return this.status=e,this}initError(e){typeof e.status=="number"?this.status=e.status:typeof e.getStatus=="function"&&(this.status=e.getStatus()),super.initError(e)}};s(Rn,"OpraHttpError");var b=Rn;var bn=class bn extends b{constructor(){super(...arguments),this.status=400}init(e){super.init({message:A("error:BAD_REQUEST","Bad request"),code:"BAD_REQUEST",...e})}};s(bn,"BadRequestError");var An=bn;var Nn=class Nn extends b{constructor(){super(...arguments),this.status=409}init(e){super.init({message:A("error:CONFLICT","Conflict"),code:"CONFLICT",...e})}};s(Nn,"ConflictError");var wn=Nn;var Sn=class Sn extends b{constructor(){super(...arguments),this.status=424}init(e){super.init({message:A("error:FAILED_DEPENDENCY","The request failed due to failure of a previous request"),code:"FAILED_DEPENDENCY",...e})}};s(Sn,"FailedDependencyError");var Dn=Sn;var In=class In extends b{constructor(){super(...arguments),this.status=N.FORBIDDEN}init(e){super.init({message:A("error:FORBIDDEN","You are not authorized to perform this action"),code:"FORBIDDEN",...e})}};s(In,"ForbiddenError");var hr=In;var Pn=class Pn extends b{constructor(){super(...arguments),this.status=500}init(e){super.init({message:A("error:INTERNAL_SERVER_ERROR","Internal server error"),code:"INTERNAL_SERVER_ERROR",severity:"fatal",...e})}};s(Pn,"InternalServerError");var Ln=Pn;var vn=class vn extends b{constructor(){super(...arguments),this.status=405}init(e){super.init({message:A("error:METHOD_NOT_ALLOWED","Method not allowed"),code:"METHOD_NOT_ALLOWED",...e})}};s(vn,"MethodNotAllowedError");var Mn=vn;var kn=class kn extends b{constructor(){super(...arguments),this.status=406}init(e){super.init({message:A("error:NOT_ACCEPTABLE","Not Acceptable"),code:"NOT_ACCEPTABLE",...e})}};s(kn,"NotAcceptableError");var Fn=kn;var Un=class Un extends b{constructor(){super(...arguments),this.status=404}init(e){super.init({message:A("error:NOT_FOUND","Not found"),code:"NOT_FOUND",...e})}};s(Un,"NotFoundError");var jn=Un;var Bn=class Bn extends hr{init(e){super.init({message:A("error:PERMISSION_ERROR","You dont have permission for this operation"),code:"PERMISSION_ERROR",...e})}};s(Bn,"PermissionError");var Cn=Bn;var $n=class $n extends b{constructor(e,t,r){super({message:A("error:RESOURCE_CONFLICT",{resource:e,fields:t},"There is already an other {{resource}} resource with same values ({{fields}})"),severity:"error",code:"RESOURCE_CONFLICT",details:{resource:e,location:t}},r),this.status=409}};s($n,"ResourceConflictError");var qn=$n;var Kn=class Kn extends b{constructor(e,t,r){super({message:A("error:RESOURCE_NOT_AVAILABLE",`Resource "${e}${t?"/"+t:""}" is not available`),severity:"error",code:"RESOURCE_NOT_AVAILABLE",details:{resource:e,key:t}},r,N.UNPROCESSABLE_ENTITY)}};s(Kn,"ResourceNotAvailableError");var Vn=Kn;var Jn=class Jn extends b{constructor(){super(...arguments),this.status=401}init(e){super.init({message:A("error:UNAUTHORIZED","You have not been authenticated to perform this action"),code:"UNAUTHORIZED",...e})}};s(Jn,"UnauthorizedError");var zn=Jn;var Gn=class Gn extends b{constructor(){super(...arguments),this.status=422}init(e){super.init({message:A("error:UNPROCESSABLE_ENTITY","Unprocessable entity"),severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};s(Gn,"UnprocessableEntityError");var Wn=Gn;var Yn;(function(i){let e;(function(t){t.fatal="fatal",t.error="error",t.warning="warning",t.info="info"})(e=i.Enum||(i.Enum={})),i.name="IssueSeverity",i.description="Severity of the issue",i.Keys=Object.keys(i),i.descriptions={fatal:"The issue caused the action to fail and no further checking could be performed",error:"The issue is sufficiently important to cause the action to fail",warning:"The issue is not important enough to cause the action to fail but may cause it to be performed suboptimally or in a way that is not as desired",info:"The issue has no relation to the degree of success of the action"}})(Yn||(Yn={}));var Qn=class Qn{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};s(Qn,"Ast");var dr=Qn;var Xn=class Xn extends dr{};s(Xn,"Expression");var q=Xn;var Zn=class Zn extends q{};s(Zn,"Term");var Ze=Zn;var Hn=class Hn extends Ze{constructor(e){super(),this.value=e}toString(){return""+this.value}};s(Hn,"Literal");var j=Hn;var eo=class eo extends q{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new Kr({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};s(eo,"ArithmeticExpression");var He=eo,to=class to{constructor(e){Object.assign(this,e)}};s(to,"ArithmeticExpressionItem");var Kr=to;var ro=class ro extends Ze{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};s(ro,"ArrayExpression");var ge=ro;var Ha=/\w/,io=class io extends q{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${Ha.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};s(io,"ComparisonExpression");var Oe=io;var no=class no extends q{constructor(e){super(),Object.assign(this,e),this.op==="&&"&&(this.op="and"),this.op==="||"&&(this.op="or")}toString(){return this.items.map(e=>""+e).join(" "+this.op+" ")}};s(no,"LogicalExpression");var de=no;var oo=class oo extends q{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};s(oo,"NegativeExpression");var yr=oo;var so=class so extends q{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};s(so,"ParenthesizedExpression");var Re=so;var ao=class ao extends j{constructor(e){super(e)}};s(ao,"BooleanLiteral");var et=ao;var sa=require("putil-varhelpers");var po=class po extends TypeError{};s(po,"SyntaxError");var zr=po,co=class co extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};s(co,"FilterValidationError");var je=co,lo=class lo extends Error{constructor(e,t){super(e),Object.assign(this,t)}};s(lo,"FilterParseError");var Jr=lo;var ep=/'/g,tp=/(\\)/g,rp=/\\(.)/g;function ip(i){return i.replace(tp,"\\\\")}s(ip,"escapeString");function np(i){return i.replace(rp,"$1")}s(np,"unescapeString");function Nt(i){return"'"+ip(i).replace(ep,"\\'")+"'"}s(Nt,"quoteFilterString");function Tr(i){return i&&(i.startsWith("'")||i.startsWith('"'))&&i.endsWith(i.charAt(0))?np(i.substring(1,i.length-1)):i}s(Tr,"unquoteFilterString");var oa=new Date(0),fo=class fo extends j{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,sa.toDateDef)(e,oa)!==oa){this.value=e;return}throw new je(`Invalid date value "${e}"`)}toString(){return Nt(this.value)}};s(fo,"DateLiteral");var Ae=fo;var uo=class uo extends j{constructor(){super(null),this.value=null}};s(uo,"NullLiteral");var tt=uo;var mo=class mo extends j{constructor(e){if(super(0),typeof e=="number"||typeof e=="bigint"){this.value=e;return}try{if(typeof e=="string"){if(e.includes(".")){this.value=parseFloat(e);return}let t=Number(e);""+t===e?this.value=t:this.value=BigInt(e);return}}catch{}throw new je(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};s(mo,"NumberLiteral");var be=mo;var ho=class ho extends j{constructor(e){super(""+e)}};s(ho,"QualifiedIdentifier");var ye=ho;var yo=class yo extends j{constructor(e){super(""+e)}toString(){return Nt(this.value)}};s(yo,"StringLiteral");var rt=yo;var op=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,To=class To extends j{constructor(e){if(super(""),e instanceof Date){this.value=Wr(e.getHours())+":"+Wr(e.getMinutes())+(e.getSeconds()?":"+Wr(e.getSeconds()):"")+(e.getMilliseconds()?"."+Wr(e.getMilliseconds()):"");return}if(typeof e=="string"&&op.test(e)){this.value=e;return}throw new je(`Invalid time value "${e}"`)}toString(){return Nt(this.value)}};s(To,"TimeLiteral");var it=To;function Wr(i){return i<=9?"0"+i:""+i}s(Wr,"pad");var oi=require("@browsery/antlr4");var oe=require("@browsery/antlr4");var z=class z extends oe.Lexer{constructor(e){super(e),this._interp=new oe.LexerATNSimulator(this,z._ATN,z.DecisionsToDFA,new oe.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return z.literalNames}get symbolicNames(){return z.symbolicNames}get ruleNames(){return z.ruleNames}get serializedATN(){return z._serializedATN}get channelNames(){return z.channelNames}get modeNames(){return z.modeNames}static get _ATN(){return z.__ATN||(z.__ATN=new oe.ATNDeserializer().deserialize(z._serializedATN)),z.__ATN}};s(z,"OpraFilterLexer");var y=z;y.T__0=1;y.T__1=2;y.T__2=3;y.T__3=4;y.T__4=5;y.T__5=6;y.T__6=7;y.T__7=8;y.T__8=9;y.T__9=10;y.T__10=11;y.T__11=12;y.T__12=13;y.T__13=14;y.T__14=15;y.T__15=16;y.T__16=17;y.T__17=18;y.T__18=19;y.T__19=20;y.T__20=21;y.T__21=22;y.T__22=23;y.T__23=24;y.T__24=25;y.T__25=26;y.T__26=27;y.T__27=28;y.T__28=29;y.T__29=30;y.T__30=31;y.T__31=32;y.T__32=33;y.T__33=34;y.IDENTIFIER=35;y.POLAR_OP=36;y.DATE=37;y.DATETIME=38;y.TIME=39;y.NUMBER=40;y.INTEGER=41;y.STRING=42;y.WHITESPACE=43;y.EOF=oe.Token.EOF;y.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];y.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];y.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];y.modeNames=["DEFAULT_MODE"];y.ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","T__14","T__15","T__16","T__17","T__18","T__19","T__20","T__21","T__22","T__23","T__24","T__25","T__26","T__27","T__28","T__29","T__30","T__31","T__32","T__33","IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE","DIGIT","DATEFORMAT","TIMEFORMAT","TIMEZONEOFFSETFORMAT","ESC","UNICODE","HEX"];y._serializedATN=[4,0,43,426,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,1,0,1,0,1,1,1,1,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,24,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,32,1,32,1,32,1,33,1,33,1,33,1,34,1,34,5,34,225,8,34,10,34,12,34,228,9,34,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,3,36,240,8,36,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,256,8,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,3,38,266,8,38,1,39,3,39,269,8,39,1,39,4,39,272,8,39,11,39,12,39,273,1,39,1,39,5,39,278,8,39,10,39,12,39,281,9,39,3,39,283,8,39,1,39,1,39,3,39,287,8,39,1,39,4,39,290,8,39,11,39,12,39,291,3,39,294,8,39,1,39,1,39,1,39,1,39,4,39,300,8,39,11,39,12,39,301,3,39,304,8,39,1,40,3,40,307,8,40,1,40,4,40,310,8,40,11,40,12,40,311,1,40,1,40,1,40,1,40,4,40,318,8,40,11,40,12,40,319,3,40,322,8,40,1,41,1,41,1,41,5,41,327,8,41,10,41,12,41,330,9,41,1,41,1,41,1,41,1,41,5,41,336,8,41,10,41,12,41,339,9,41,1,41,3,41,342,8,41,1,42,4,42,345,8,42,11,42,12,42,346,1,42,1,42,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,362,8,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,371,8,44,1,45,1,45,1,45,1,45,3,45,377,8,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,4,45,389,8,45,11,45,12,45,390,3,45,393,8,45,3,45,395,8,45,1,46,1,46,1,46,3,46,400,8,46,1,46,1,46,1,46,3,46,405,8,46,1,46,1,46,1,46,3,46,410,8,46,3,46,412,8,46,1,47,1,47,1,47,3,47,417,8,47,1,48,1,48,1,48,1,48,1,48,1,48,1,49,1,49,0,0,50,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,0,89,0,91,0,93,0,95,0,97,0,99,0,1,0,16,4,0,36,36,65,90,95,95,97,122,5,0,36,36,48,57,65,90,95,95,97,122,2,0,43,43,45,45,1,0,39,39,1,0,34,34,3,0,9,10,13,13,32,32,1,0,48,57,1,0,48,48,1,0,49,57,1,0,49,49,1,0,48,50,1,0,49,51,1,0,48,49,1,0,48,51,1,0,48,53,3,0,48,57,65,70,97,102,453,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,1,101,1,0,0,0,3,103,1,0,0,0,5,105,1,0,0,0,7,109,1,0,0,0,9,111,1,0,0,0,11,113,1,0,0,0,13,115,1,0,0,0,15,117,1,0,0,0,17,119,1,0,0,0,19,121,1,0,0,0,21,126,1,0,0,0,23,132,1,0,0,0,25,137,1,0,0,0,27,146,1,0,0,0,29,155,1,0,0,0,31,157,1,0,0,0,33,159,1,0,0,0,35,161,1,0,0,0,37,163,1,0,0,0,39,166,1,0,0,0,41,168,1,0,0,0,43,170,1,0,0,0,45,173,1,0,0,0,47,175,1,0,0,0,49,178,1,0,0,0,51,181,1,0,0,0,53,185,1,0,0,0,55,190,1,0,0,0,57,196,1,0,0,0,59,202,1,0,0,0,61,209,1,0,0,0,63,213,1,0,0,0,65,216,1,0,0,0,67,219,1,0,0,0,69,222,1,0,0,0,71,229,1,0,0,0,73,239,1,0,0,0,75,255,1,0,0,0,77,265,1,0,0,0,79,303,1,0,0,0,81,321,1,0,0,0,83,341,1,0,0,0,85,344,1,0,0,0,87,350,1,0,0,0,89,352,1,0,0,0,91,376,1,0,0,0,93,411,1,0,0,0,95,413,1,0,0,0,97,418,1,0,0,0,99,424,1,0,0,0,101,102,5,40,0,0,102,2,1,0,0,0,103,104,5,41,0,0,104,4,1,0,0,0,105,106,5,110,0,0,106,107,5,111,0,0,107,108,5,116,0,0,108,6,1,0,0,0,109,110,5,33,0,0,110,8,1,0,0,0,111,112,5,46,0,0,112,10,1,0,0,0,113,114,5,64,0,0,114,12,1,0,0,0,115,116,5,91,0,0,116,14,1,0,0,0,117,118,5,44,0,0,118,16,1,0,0,0,119,120,5,93,0,0,120,18,1,0,0,0,121,122,5,116,0,0,122,123,5,114,0,0,123,124,5,117,0,0,124,125,5,101,0,0,125,20,1,0,0,0,126,127,5,102,0,0,127,128,5,97,0,0,128,129,5,108,0,0,129,130,5,115,0,0,130,131,5,101,0,0,131,22,1,0,0,0,132,133,5,110,0,0,133,134,5,117,0,0,134,135,5,108,0,0,135,136,5,108,0,0,136,24,1,0,0,0,137,138,5,73,0,0,138,139,5,110,0,0,139,140,5,102,0,0,140,141,5,105,0,0,141,142,5,110,0,0,142,143,5,105,0,0,143,144,5,116,0,0,144,145,5,121,0,0,145,26,1,0,0,0,146,147,5,105,0,0,147,148,5,110,0,0,148,149,5,102,0,0,149,150,5,105,0,0,150,151,5,110,0,0,151,152,5,105,0,0,152,153,5,116,0,0,153,154,5,121,0,0,154,28,1,0,0,0,155,156,5,43,0,0,156,30,1,0,0,0,157,158,5,45,0,0,158,32,1,0,0,0,159,160,5,42,0,0,160,34,1,0,0,0,161,162,5,47,0,0,162,36,1,0,0,0,163,164,5,60,0,0,164,165,5,61,0,0,165,38,1,0,0,0,166,167,5,60,0,0,167,40,1,0,0,0,168,169,5,62,0,0,169,42,1,0,0,0,170,171,5,62,0,0,171,172,5,61,0,0,172,44,1,0,0,0,173,174,5,61,0,0,174,46,1,0,0,0,175,176,5,33,0,0,176,177,5,61,0,0,177,48,1,0,0,0,178,179,5,105,0,0,179,180,5,110,0,0,180,50,1,0,0,0,181,182,5,33,0,0,182,183,5,105,0,0,183,184,5,110,0,0,184,52,1,0,0,0,185,186,5,108,0,0,186,187,5,105,0,0,187,188,5,107,0,0,188,189,5,101,0,0,189,54,1,0,0,0,190,191,5,33,0,0,191,192,5,108,0,0,192,193,5,105,0,0,193,194,5,107,0,0,194,195,5,101,0,0,195,56,1,0,0,0,196,197,5,105,0,0,197,198,5,108,0,0,198,199,5,105,0,0,199,200,5,107,0,0,200,201,5,101,0,0,201,58,1,0,0,0,202,203,5,33,0,0,203,204,5,105,0,0,204,205,5,108,0,0,205,206,5,105,0,0,206,207,5,107,0,0,207,208,5,101,0,0,208,60,1,0,0,0,209,210,5,97,0,0,210,211,5,110,0,0,211,212,5,100,0,0,212,62,1,0,0,0,213,214,5,111,0,0,214,215,5,114,0,0,215,64,1,0,0,0,216,217,5,38,0,0,217,218,5,38,0,0,218,66,1,0,0,0,219,220,5,124,0,0,220,221,5,124,0,0,221,68,1,0,0,0,222,226,7,0,0,0,223,225,7,1,0,0,224,223,1,0,0,0,225,228,1,0,0,0,226,224,1,0,0,0,226,227,1,0,0,0,227,70,1,0,0,0,228,226,1,0,0,0,229,230,7,2,0,0,230,72,1,0,0,0,231,232,5,39,0,0,232,233,3,89,44,0,233,234,5,39,0,0,234,240,1,0,0,0,235,236,5,34,0,0,236,237,3,89,44,0,237,238,5,34,0,0,238,240,1,0,0,0,239,231,1,0,0,0,239,235,1,0,0,0,240,74,1,0,0,0,241,242,5,39,0,0,242,243,3,89,44,0,243,244,5,84,0,0,244,245,3,91,45,0,245,246,3,93,46,0,246,247,5,39,0,0,247,256,1,0,0,0,248,249,5,34,0,0,249,250,3,89,44,0,250,251,5,84,0,0,251,252,3,91,45,0,252,253,3,93,46,0,253,254,5,34,0,0,254,256,1,0,0,0,255,241,1,0,0,0,255,248,1,0,0,0,256,76,1,0,0,0,257,258,5,39,0,0,258,259,3,91,45,0,259,260,5,39,0,0,260,266,1,0,0,0,261,262,5,34,0,0,262,263,3,91,45,0,263,264,5,34,0,0,264,266,1,0,0,0,265,257,1,0,0,0,265,261,1,0,0,0,266,78,1,0,0,0,267,269,3,71,35,0,268,267,1,0,0,0,268,269,1,0,0,0,269,271,1,0,0,0,270,272,3,87,43,0,271,270,1,0,0,0,272,273,1,0,0,0,273,271,1,0,0,0,273,274,1,0,0,0,274,282,1,0,0,0,275,279,5,46,0,0,276,278,3,87,43,0,277,276,1,0,0,0,278,281,1,0,0,0,279,277,1,0,0,0,279,280,1,0,0,0,280,283,1,0,0,0,281,279,1,0,0,0,282,275,1,0,0,0,282,283,1,0,0,0,283,293,1,0,0,0,284,286,5,69,0,0,285,287,7,2,0,0,286,285,1,0,0,0,286,287,1,0,0,0,287,289,1,0,0,0,288,290,3,87,43,0,289,288,1,0,0,0,290,291,1,0,0,0,291,289,1,0,0,0,291,292,1,0,0,0,292,294,1,0,0,0,293,284,1,0,0,0,293,294,1,0,0,0,294,304,1,0,0,0,295,296,5,48,0,0,296,297,5,120,0,0,297,299,1,0,0,0,298,300,3,99,49,0,299,298,1,0,0,0,300,301,1,0,0,0,301,299,1,0,0,0,301,302,1,0,0,0,302,304,1,0,0,0,303,268,1,0,0,0,303,295,1,0,0,0,304,80,1,0,0,0,305,307,3,71,35,0,306,305,1,0,0,0,306,307,1,0,0,0,307,309,1,0,0,0,308,310,3,87,43,0,309,308,1,0,0,0,310,311,1,0,0,0,311,309,1,0,0,0,311,312,1,0,0,0,312,322,1,0,0,0,313,314,5,48,0,0,314,315,5,120,0,0,315,317,1,0,0,0,316,318,3,99,49,0,317,316,1,0,0,0,318,319,1,0,0,0,319,317,1,0,0,0,319,320,1,0,0,0,320,322,1,0,0,0,321,306,1,0,0,0,321,313,1,0,0,0,322,82,1,0,0,0,323,328,5,39,0,0,324,327,3,95,47,0,325,327,8,3,0,0,326,324,1,0,0,0,326,325,1,0,0,0,327,330,1,0,0,0,328,326,1,0,0,0,328,329,1,0,0,0,329,331,1,0,0,0,330,328,1,0,0,0,331,342,5,39,0,0,332,337,5,34,0,0,333,336,3,95,47,0,334,336,8,4,0,0,335,333,1,0,0,0,335,334,1,0,0,0,336,339,1,0,0,0,337,335,1,0,0,0,337,338,1,0,0,0,338,340,1,0,0,0,339,337,1,0,0,0,340,342,5,34,0,0,341,323,1,0,0,0,341,332,1,0,0,0,342,84,1,0,0,0,343,345,7,5,0,0,344,343,1,0,0,0,345,346,1,0,0,0,346,344,1,0,0,0,346,347,1,0,0,0,347,348,1,0,0,0,348,349,6,42,0,0,349,86,1,0,0,0,350,351,7,6,0,0,351,88,1,0,0,0,352,353,7,6,0,0,353,354,7,6,0,0,354,355,7,6,0,0,355,356,7,6,0,0,356,361,5,45,0,0,357,358,7,7,0,0,358,362,7,8,0,0,359,360,7,9,0,0,360,362,7,10,0,0,361,357,1,0,0,0,361,359,1,0,0,0,362,363,1,0,0,0,363,370,5,45,0,0,364,365,7,11,0,0,365,371,7,7,0,0,366,367,7,10,0,0,367,371,7,8,0,0,368,369,5,51,0,0,369,371,5,49,0,0,370,364,1,0,0,0,370,366,1,0,0,0,370,368,1,0,0,0,371,90,1,0,0,0,372,373,7,12,0,0,373,377,7,6,0,0,374,375,5,50,0,0,375,377,7,13,0,0,376,372,1,0,0,0,376,374,1,0,0,0,377,378,1,0,0,0,378,379,5,58,0,0,379,380,7,14,0,0,380,381,7,6,0,0,381,394,1,0,0,0,382,383,5,58,0,0,383,384,7,14,0,0,384,385,7,6,0,0,385,392,1,0,0,0,386,388,5,46,0,0,387,389,7,6,0,0,388,387,1,0,0,0,389,390,1,0,0,0,390,388,1,0,0,0,390,391,1,0,0,0,391,393,1,0,0,0,392,386,1,0,0,0,392,393,1,0,0,0,393,395,1,0,0,0,394,382,1,0,0,0,394,395,1,0,0,0,395,92,1,0,0,0,396,412,5,90,0,0,397,404,7,2,0,0,398,400,7,12,0,0,399,398,1,0,0,0,399,400,1,0,0,0,400,401,1,0,0,0,401,405,7,6,0,0,402,403,5,50,0,0,403,405,7,13,0,0,404,399,1,0,0,0,404,402,1,0,0,0,405,409,1,0,0,0,406,407,5,58,0,0,407,408,7,14,0,0,408,410,7,6,0,0,409,406,1,0,0,0,409,410,1,0,0,0,410,412,1,0,0,0,411,396,1,0,0,0,411,397,1,0,0,0,412,94,1,0,0,0,413,416,5,92,0,0,414,417,3,97,48,0,415,417,9,0,0,0,416,414,1,0,0,0,416,415,1,0,0,0,417,96,1,0,0,0,418,419,5,117,0,0,419,420,3,99,49,0,420,421,3,99,49,0,421,422,3,99,49,0,422,423,3,99,49,0,423,98,1,0,0,0,424,425,7,15,0,0,425,100,1,0,0,0,35,0,226,239,255,265,268,273,279,282,286,291,293,301,303,306,311,319,321,326,328,335,337,341,346,361,370,376,390,392,394,399,404,409,411,416,1,0,1,0];y.DecisionsToDFA=y._ATN.decisionToState.map((i,e)=>new oe.DFA(i,e));var aa=y;var d=require("@browsery/antlr4");var _=class _ extends d.Parser{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return _.literalNames}get symbolicNames(){return _.symbolicNames}get ruleNames(){return _.ruleNames}get serializedATN(){return _._serializedATN}createFailedPredicateException(e,t){return new d.FailedPredicateException(this,e,t)}constructor(e){super(e),this._interp=new d.ParserATNSimulator(this,_._ATN,_.DecisionsToDFA,new d.PredictionContextCache)}root(){let e=new Eo(this,this._ctx,this.state);this.enterRule(e,0,_.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(_.EOF)}catch(t){if(t instanceof d.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}expression(e){e===void 0&&(e=0);let t=this._ctx,r=this.state,n=new te(this,this._ctx,r),o=n,a=2;this.enterRecursionRule(n,2,_.RULE_expression,e);let p;try{let c;this.enterOuterAlt(n,1);{switch(this.state=48,this._errHandler.sync(this),this._input.LA(1)){case 35:n=new go(this,n),this._ctx=n,o=n,this.state=38,n._left=this.comparisonLeft(),this.state=39,n._operator=this.comparisonOperator(),this.state=40,n._right=this.comparisonRight();break;case 1:n=new _o(this,n),this._ctx=n,o=n,this.state=42,this.match(_.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(_.T__1);break;case 3:case 4:n=new xo(this,n),this._ctx=n,o=n,this.state=46,p=this._input.LA(1),p===3||p===4?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=47,this.expression(1);break;default:throw new d.NoViableAltException(this)}for(this._ctx.stop=this._input.LT(-1),this.state=56,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx);c!==2&&c!==d.ATN.INVALID_ALT_NUMBER;){if(c===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),o=n;{if(n=new Er(this,new te(this,t,r)),this.pushNewRecursionContext(n,a,_.RULE_expression),this.state=50,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=51,n._op=this.logicalOperator(),this.state=52,this.expression(4)}}this.state=58,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx)}}}catch(c){if(c instanceof d.RecognitionException)n.exception=c,this._errHandler.reportError(this,c),this._errHandler.recover(this,c);else throw c}finally{this.unrollRecursionContexts(t)}return n}comparisonLeft(){let e=new Gr(this,this._ctx,this.state);this.enterRule(e,4,_.RULE_comparisonLeft);try{this.enterOuterAlt(e,1),this.state=59,this.qualifiedIdentifier()}catch(t){if(t instanceof d.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}comparisonRight(){let e=new Yr(this,this._ctx,this.state);this.enterRule(e,6,_.RULE_comparisonRight);try{switch(this.state=65,this._errHandler.sync(this),this._input.LA(1)){case 10:case 11:case 12:case 13:case 14:case 37:case 38:case 39:case 40:case 42:this.enterOuterAlt(e,1),this.state=61,this.value();break;case 35:this.enterOuterAlt(e,2),this.state=62,this.qualifiedIdentifier();break;case 6:this.enterOuterAlt(e,3),this.state=63,this.externalConstant();break;case 7:this.enterOuterAlt(e,4),this.state=64,this.arrayValue();break;default:throw new d.NoViableAltException(this)}}catch(t){if(t instanceof d.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}parenthesizedItem(){let e=new Qr(this,this._ctx,this.state);this.enterRule(e,8,_.RULE_parenthesizedItem);try{this.enterOuterAlt(e,1),this.state=67,this.expression(0)}catch(t){if(t instanceof d.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}value(){let e=new G(this,this._ctx,this.state);this.enterRule(e,10,_.RULE_value);try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 40:e=new So(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(_.NUMBER);break;case 13:case 14:e=new No(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new Do(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new Ro(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 37:e=new wo(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(_.DATE);break;case 38:e=new Ao(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(_.DATETIME);break;case 39:e=new Oo(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(_.TIME);break;case 42:e=new bo(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(_.STRING);break;default:throw new d.NoViableAltException(this)}}catch(t){if(t instanceof d.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}qualifiedIdentifier(){let e=new _r(this,this._ctx,this.state);this.enterRule(e,12,_.RULE_qualifiedIdentifier);try{let t;this.enterOuterAlt(e,1);{for(this.state=84,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);t!==2&&t!==d.ATN.INVALID_ALT_NUMBER;)t===1&&(this.state=79,this.identifier(),this.state=80,this.match(_.T__4)),this.state=86,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);this.state=87,this.identifier()}}catch(t){if(t instanceof d.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}externalConstant(){let e=new Xr(this,this._ctx,this.state);this.enterRule(e,14,_.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(_.T__5),this.state=90,this.identifier()}catch(t){if(t instanceof d.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}identifier(){let e=new Dt(this,this._ctx,this.state);this.enterRule(e,16,_.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(_.IDENTIFIER)}catch(t){if(t instanceof d.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}arrayValue(){let e=new Zr(this,this._ctx,this.state);this.enterRule(e,18,_.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(_.T__6),this.state=95,this.value(),this.state=100,this._errHandler.sync(this),t=this._input.LA(1);t===8;)this.state=96,this.match(_.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(_.T__8)}}catch(r){if(r instanceof d.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}boolean_(){let e=new Hr(this,this._ctx,this.state);this.enterRule(e,20,_.RULE_boolean);let t;try{this.enterOuterAlt(e,1),this.state=105,t=this._input.LA(1),t===10||t===11?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof d.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}null_(){let e=new ei(this,this._ctx,this.state);this.enterRule(e,22,_.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(_.T__11)}catch(t){if(t instanceof d.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}infinity(){let e=new ti(this,this._ctx,this.state);this.enterRule(e,24,_.RULE_infinity);let t;try{this.enterOuterAlt(e,1),this.state=109,t=this._input.LA(1),t===13||t===14?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof d.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}arithmeticOperator(){let e=new Io(this,this._ctx,this.state);this.enterRule(e,26,_.RULE_arithmeticOperator);let t;try{this.enterOuterAlt(e,1),this.state=111,t=this._input.LA(1),!(t&-32)&&1<<t&491520?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof d.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}comparisonOperator(){let e=new ri(this,this._ctx,this.state);this.enterRule(e,28,_.RULE_comparisonOperator);let t;try{this.enterOuterAlt(e,1),this.state=113,t=this._input.LA(1),!(t&-32)&&1<<t&2146959360?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof d.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}logicalOperator(){let e=new ii(this,this._ctx,this.state);this.enterRule(e,30,_.RULE_logicalOperator);let t;try{this.enterOuterAlt(e,1),this.state=115,t=this._input.LA(1),!(t-31&-32)&&1<<t-31&15?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof d.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}polarityOperator(){let e=new Lo(this,this._ctx,this.state);this.enterRule(e,32,_.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(_.POLAR_OP)}catch(t){if(t instanceof d.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}sempred(e,t,r){switch(t){case 1:return this.expression_sempred(e,r)}return!0}expression_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,3)}return!0}static get _ATN(){return _.__ATN||(_.__ATN=new d.ATNDeserializer().deserialize(_._serializedATN)),_.__ATN}};s(_,"OpraFilterParser");var f=_;f.T__0=1;f.T__1=2;f.T__2=3;f.T__3=4;f.T__4=5;f.T__5=6;f.T__6=7;f.T__7=8;f.T__8=9;f.T__9=10;f.T__10=11;f.T__11=12;f.T__12=13;f.T__13=14;f.T__14=15;f.T__15=16;f.T__16=17;f.T__17=18;f.T__18=19;f.T__19=20;f.T__20=21;f.T__21=22;f.T__22=23;f.T__23=24;f.T__24=25;f.T__25=26;f.T__26=27;f.T__27=28;f.T__28=29;f.T__29=30;f.T__30=31;f.T__31=32;f.T__32=33;f.T__33=34;f.IDENTIFIER=35;f.POLAR_OP=36;f.DATE=37;f.DATETIME=38;f.TIME=39;f.NUMBER=40;f.INTEGER=41;f.STRING=42;f.WHITESPACE=43;f.EOF=d.Token.EOF;f.RULE_root=0;f.RULE_expression=1;f.RULE_comparisonLeft=2;f.RULE_comparisonRight=3;f.RULE_parenthesizedItem=4;f.RULE_value=5;f.RULE_qualifiedIdentifier=6;f.RULE_externalConstant=7;f.RULE_identifier=8;f.RULE_arrayValue=9;f.RULE_boolean=10;f.RULE_null=11;f.RULE_infinity=12;f.RULE_arithmeticOperator=13;f.RULE_comparisonOperator=14;f.RULE_logicalOperator=15;f.RULE_polarityOperator=16;f.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];f.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];f.ruleNames=["root","expression","comparisonLeft","comparisonRight","parenthesizedItem","value","qualifiedIdentifier","externalConstant","identifier","arrayValue","boolean","null","infinity","arithmeticOperator","comparisonOperator","logicalOperator","polarityOperator"];f._serializedATN=[4,1,43,120,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,49,8,1,1,1,1,1,1,1,1,1,5,1,55,8,1,10,1,12,1,58,9,1,1,2,1,2,1,3,1,3,1,3,1,3,3,3,66,8,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,78,8,5,1,6,1,6,1,6,5,6,83,8,6,10,6,12,6,86,9,6,1,6,1,6,1,7,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,5,9,99,8,9,10,9,12,9,102,9,9,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,16,0,1,2,17,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,0,6,1,0,3,4,1,0,10,11,1,0,13,14,1,0,15,18,1,0,19,30,1,0,31,34,117,0,34,1,0,0,0,2,48,1,0,0,0,4,59,1,0,0,0,6,65,1,0,0,0,8,67,1,0,0,0,10,77,1,0,0,0,12,84,1,0,0,0,14,89,1,0,0,0,16,92,1,0,0,0,18,94,1,0,0,0,20,105,1,0,0,0,22,107,1,0,0,0,24,109,1,0,0,0,26,111,1,0,0,0,28,113,1,0,0,0,30,115,1,0,0,0,32,117,1,0,0,0,34,35,3,2,1,0,35,36,5,0,0,1,36,1,1,0,0,0,37,38,6,1,-1,0,38,39,3,4,2,0,39,40,3,28,14,0,40,41,3,6,3,0,41,49,1,0,0,0,42,43,5,1,0,0,43,44,3,8,4,0,44,45,5,2,0,0,45,49,1,0,0,0,46,47,7,0,0,0,47,49,3,2,1,1,48,37,1,0,0,0,48,42,1,0,0,0,48,46,1,0,0,0,49,56,1,0,0,0,50,51,10,3,0,0,51,52,3,30,15,0,52,53,3,2,1,4,53,55,1,0,0,0,54,50,1,0,0,0,55,58,1,0,0,0,56,54,1,0,0,0,56,57,1,0,0,0,57,3,1,0,0,0,58,56,1,0,0,0,59,60,3,12,6,0,60,5,1,0,0,0,61,66,3,10,5,0,62,66,3,12,6,0,63,66,3,14,7,0,64,66,3,18,9,0,65,61,1,0,0,0,65,62,1,0,0,0,65,63,1,0,0,0,65,64,1,0,0,0,66,7,1,0,0,0,67,68,3,2,1,0,68,9,1,0,0,0,69,78,5,40,0,0,70,78,3,24,12,0,71,78,3,20,10,0,72,78,3,22,11,0,73,78,5,37,0,0,74,78,5,38,0,0,75,78,5,39,0,0,76,78,5,42,0,0,77,69,1,0,0,0,77,70,1,0,0,0,77,71,1,0,0,0,77,72,1,0,0,0,77,73,1,0,0,0,77,74,1,0,0,0,77,75,1,0,0,0,77,76,1,0,0,0,78,11,1,0,0,0,79,80,3,16,8,0,80,81,5,5,0,0,81,83,1,0,0,0,82,79,1,0,0,0,83,86,1,0,0,0,84,82,1,0,0,0,84,85,1,0,0,0,85,87,1,0,0,0,86,84,1,0,0,0,87,88,3,16,8,0,88,13,1,0,0,0,89,90,5,6,0,0,90,91,3,16,8,0,91,15,1,0,0,0,92,93,5,35,0,0,93,17,1,0,0,0,94,95,5,7,0,0,95,100,3,10,5,0,96,97,5,8,0,0,97,99,3,10,5,0,98,96,1,0,0,0,99,102,1,0,0,0,100,98,1,0,0,0,100,101,1,0,0,0,101,103,1,0,0,0,102,100,1,0,0,0,103,104,5,9,0,0,104,19,1,0,0,0,105,106,7,1,0,0,106,21,1,0,0,0,107,108,5,12,0,0,108,23,1,0,0,0,109,110,7,2,0,0,110,25,1,0,0,0,111,112,7,3,0,0,112,27,1,0,0,0,113,114,7,4,0,0,114,29,1,0,0,0,115,116,7,5,0,0,116,31,1,0,0,0,117,118,5,36,0,0,118,33,1,0,0,0,6,48,56,65,77,84,100];f.DecisionsToDFA=f._ATN.decisionToState.map((i,e)=>new d.DFA(i,e));var pa=f,Po=class Po extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(te,0)}EOF(){return this.getToken(f.EOF,0)}get ruleIndex(){return f.RULE_root}enterRule(e){e.enterRoot&&e.enterRoot(this)}exitRule(e){e.exitRoot&&e.exitRoot(this)}accept(e){return e.visitRoot?e.visitRoot(this):e.visitChildren(this)}};s(Po,"RootContext");var Eo=Po,Mo=class Mo extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_expression}copyFrom(e){super.copyFrom(e)}};s(Mo,"ExpressionContext");var te=Mo,vo=class vo extends te{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(Qr,0)}enterRule(e){e.enterParenthesizedExpression&&e.enterParenthesizedExpression(this)}exitRule(e){e.exitParenthesizedExpression&&e.exitParenthesizedExpression(this)}accept(e){return e.visitParenthesizedExpression?e.visitParenthesizedExpression(this):e.visitChildren(this)}};s(vo,"ParenthesizedExpressionContext");var _o=vo,Fo=class Fo extends te{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(te,0)}enterRule(e){e.enterNegativeExpression&&e.enterNegativeExpression(this)}exitRule(e){e.exitNegativeExpression&&e.exitNegativeExpression(this)}accept(e){return e.visitNegativeExpression?e.visitNegativeExpression(this):e.visitChildren(this)}};s(Fo,"NegativeExpressionContext");var xo=Fo,ko=class ko extends te{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(Gr,0)}comparisonOperator(){return this.getTypedRuleContext(ri,0)}comparisonRight(){return this.getTypedRuleContext(Yr,0)}enterRule(e){e.enterComparisonExpression&&e.enterComparisonExpression(this)}exitRule(e){e.exitComparisonExpression&&e.exitComparisonExpression(this)}accept(e){return e.visitComparisonExpression?e.visitComparisonExpression(this):e.visitChildren(this)}};s(ko,"ComparisonExpressionContext");var go=ko,jo=class jo extends te{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(te)}expression(e){return this.getTypedRuleContext(te,e)}logicalOperator(){return this.getTypedRuleContext(ii,0)}enterRule(e){e.enterLogicalExpression&&e.enterLogicalExpression(this)}exitRule(e){e.exitLogicalExpression&&e.exitLogicalExpression(this)}accept(e){return e.visitLogicalExpression?e.visitLogicalExpression(this):e.visitChildren(this)}};s(jo,"LogicalExpressionContext");var Er=jo,Uo=class Uo extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(_r,0)}get ruleIndex(){return f.RULE_comparisonLeft}enterRule(e){e.enterComparisonLeft&&e.enterComparisonLeft(this)}exitRule(e){e.exitComparisonLeft&&e.exitComparisonLeft(this)}accept(e){return e.visitComparisonLeft?e.visitComparisonLeft(this):e.visitChildren(this)}};s(Uo,"ComparisonLeftContext");var Gr=Uo,Co=class Co extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(G,0)}qualifiedIdentifier(){return this.getTypedRuleContext(_r,0)}externalConstant(){return this.getTypedRuleContext(Xr,0)}arrayValue(){return this.getTypedRuleContext(Zr,0)}get ruleIndex(){return f.RULE_comparisonRight}enterRule(e){e.enterComparisonRight&&e.enterComparisonRight(this)}exitRule(e){e.exitComparisonRight&&e.exitComparisonRight(this)}accept(e){return e.visitComparisonRight?e.visitComparisonRight(this):e.visitChildren(this)}};s(Co,"ComparisonRightContext");var Yr=Co,Bo=class Bo extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(te,0)}get ruleIndex(){return f.RULE_parenthesizedItem}enterRule(e){e.enterParenthesizedItem&&e.enterParenthesizedItem(this)}exitRule(e){e.exitParenthesizedItem&&e.exitParenthesizedItem(this)}accept(e){return e.visitParenthesizedItem?e.visitParenthesizedItem(this):e.visitChildren(this)}};s(Bo,"ParenthesizedItemContext");var Qr=Bo,qo=class qo extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_value}copyFrom(e){super.copyFrom(e)}};s(qo,"ValueContext");var G=qo,$o=class $o extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(f.TIME,0)}enterRule(e){e.enterTimeLiteral&&e.enterTimeLiteral(this)}exitRule(e){e.exitTimeLiteral&&e.exitTimeLiteral(this)}accept(e){return e.visitTimeLiteral?e.visitTimeLiteral(this):e.visitChildren(this)}};s($o,"TimeLiteralContext");var Oo=$o,Vo=class Vo extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(ei,0)}enterRule(e){e.enterNullLiteral&&e.enterNullLiteral(this)}exitRule(e){e.exitNullLiteral&&e.exitNullLiteral(this)}accept(e){return e.visitNullLiteral?e.visitNullLiteral(this):e.visitChildren(this)}};s(Vo,"NullLiteralContext");var Ro=Vo,Ko=class Ko extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(f.DATETIME,0)}enterRule(e){e.enterDateTimeLiteral&&e.enterDateTimeLiteral(this)}exitRule(e){e.exitDateTimeLiteral&&e.exitDateTimeLiteral(this)}accept(e){return e.visitDateTimeLiteral?e.visitDateTimeLiteral(this):e.visitChildren(this)}};s(Ko,"DateTimeLiteralContext");var Ao=Ko,zo=class zo extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(f.STRING,0)}enterRule(e){e.enterStringLiteral&&e.enterStringLiteral(this)}exitRule(e){e.exitStringLiteral&&e.exitStringLiteral(this)}accept(e){return e.visitStringLiteral?e.visitStringLiteral(this):e.visitChildren(this)}};s(zo,"StringLiteralContext");var bo=zo,Jo=class Jo extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(f.DATE,0)}enterRule(e){e.enterDateLiteral&&e.enterDateLiteral(this)}exitRule(e){e.exitDateLiteral&&e.exitDateLiteral(this)}accept(e){return e.visitDateLiteral?e.visitDateLiteral(this):e.visitChildren(this)}};s(Jo,"DateLiteralContext");var wo=Jo,Wo=class Wo extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(ti,0)}enterRule(e){e.enterInfinityLiteral&&e.enterInfinityLiteral(this)}exitRule(e){e.exitInfinityLiteral&&e.exitInfinityLiteral(this)}accept(e){return e.visitInfinityLiteral?e.visitInfinityLiteral(this):e.visitChildren(this)}};s(Wo,"InfinityLiteralContext");var No=Wo,Go=class Go extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(Hr,0)}enterRule(e){e.enterBooleanLiteral&&e.enterBooleanLiteral(this)}exitRule(e){e.exitBooleanLiteral&&e.exitBooleanLiteral(this)}accept(e){return e.visitBooleanLiteral?e.visitBooleanLiteral(this):e.visitChildren(this)}};s(Go,"BooleanLiteralContext");var Do=Go,Yo=class Yo extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(f.NUMBER,0)}enterRule(e){e.enterNumberLiteral&&e.enterNumberLiteral(this)}exitRule(e){e.exitNumberLiteral&&e.exitNumberLiteral(this)}accept(e){return e.visitNumberLiteral?e.visitNumberLiteral(this):e.visitChildren(this)}};s(Yo,"NumberLiteralContext");var So=Yo,Qo=class Qo extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(Dt)}identifier(e){return this.getTypedRuleContext(Dt,e)}get ruleIndex(){return f.RULE_qualifiedIdentifier}enterRule(e){e.enterQualifiedIdentifier&&e.enterQualifiedIdentifier(this)}exitRule(e){e.exitQualifiedIdentifier&&e.exitQualifiedIdentifier(this)}accept(e){return e.visitQualifiedIdentifier?e.visitQualifiedIdentifier(this):e.visitChildren(this)}};s(Qo,"QualifiedIdentifierContext");var _r=Qo,Xo=class Xo extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(Dt,0)}get ruleIndex(){return f.RULE_externalConstant}enterRule(e){e.enterExternalConstant&&e.enterExternalConstant(this)}exitRule(e){e.exitExternalConstant&&e.exitExternalConstant(this)}accept(e){return e.visitExternalConstant?e.visitExternalConstant(this):e.visitChildren(this)}};s(Xo,"ExternalConstantContext");var Xr=Xo,Zo=class Zo extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(f.IDENTIFIER,0)}get ruleIndex(){return f.RULE_identifier}enterRule(e){e.enterIdentifier&&e.enterIdentifier(this)}exitRule(e){e.exitIdentifier&&e.exitIdentifier(this)}accept(e){return e.visitIdentifier?e.visitIdentifier(this):e.visitChildren(this)}};s(Zo,"IdentifierContext");var Dt=Zo,Ho=class Ho extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(G)}value(e){return this.getTypedRuleContext(G,e)}get ruleIndex(){return f.RULE_arrayValue}enterRule(e){e.enterArrayValue&&e.enterArrayValue(this)}exitRule(e){e.exitArrayValue&&e.exitArrayValue(this)}accept(e){return e.visitArrayValue?e.visitArrayValue(this):e.visitChildren(this)}};s(Ho,"ArrayValueContext");var Zr=Ho,es=class es extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_boolean}enterRule(e){e.enterBoolean&&e.enterBoolean(this)}exitRule(e){e.exitBoolean&&e.exitBoolean(this)}accept(e){return e.visitBoolean?e.visitBoolean(this):e.visitChildren(this)}};s(es,"BooleanContext");var Hr=es,ts=class ts extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_null}enterRule(e){e.enterNull&&e.enterNull(this)}exitRule(e){e.exitNull&&e.exitNull(this)}accept(e){return e.visitNull?e.visitNull(this):e.visitChildren(this)}};s(ts,"NullContext");var ei=ts,rs=class rs extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_infinity}enterRule(e){e.enterInfinity&&e.enterInfinity(this)}exitRule(e){e.exitInfinity&&e.exitInfinity(this)}accept(e){return e.visitInfinity?e.visitInfinity(this):e.visitChildren(this)}};s(rs,"InfinityContext");var ti=rs,is=class is extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_arithmeticOperator}enterRule(e){e.enterArithmeticOperator&&e.enterArithmeticOperator(this)}exitRule(e){e.exitArithmeticOperator&&e.exitArithmeticOperator(this)}accept(e){return e.visitArithmeticOperator?e.visitArithmeticOperator(this):e.visitChildren(this)}};s(is,"ArithmeticOperatorContext");var Io=is,ns=class ns extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_comparisonOperator}enterRule(e){e.enterComparisonOperator&&e.enterComparisonOperator(this)}exitRule(e){e.exitComparisonOperator&&e.exitComparisonOperator(this)}accept(e){return e.visitComparisonOperator?e.visitComparisonOperator(this):e.visitChildren(this)}};s(ns,"ComparisonOperatorContext");var ri=ns,os=class os extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_logicalOperator}enterRule(e){e.enterLogicalOperator&&e.enterLogicalOperator(this)}exitRule(e){e.exitLogicalOperator&&e.exitLogicalOperator(this)}accept(e){return e.visitLogicalOperator?e.visitLogicalOperator(this):e.visitChildren(this)}};s(os,"LogicalOperatorContext");var ii=os,ss=class ss extends d.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}POLAR_OP(){return this.getToken(f.POLAR_OP,0)}get ruleIndex(){return f.RULE_polarityOperator}enterRule(e){e.enterPolarityOperator&&e.enterPolarityOperator(this)}exitRule(e){e.exitPolarityOperator&&e.exitPolarityOperator(this)}accept(e){return e.visitPolarityOperator?e.visitPolarityOperator(this):e.visitChildren(this)}};s(ss,"PolarityOperatorContext");var Lo=ss;var ca=require("@browsery/antlr4");var as=class as extends j{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};s(as,"ExternalConstant");var ni=as;var ps=class ps extends ca.ParseTreeVisitor{constructor(e){super(),this._timeZone=e==null?void 0:e.timeZone}visitChildren(e){let t=super.visitChildren(e);return Array.isArray(t)&&t.length<2?t[0]:t??e.getText()}defaultResult(){}visitRoot(e){return this.visit(e.expression())}visitParenthesizedExpression(e){let t=this.visit(e.parenthesizedItem());return new Re(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new yr(t)}visitComparisonExpression(e){return new Oe({op:e.comparisonOperator().getText(),left:this.visit(e.comparisonLeft()),right:this.visit(e.comparisonRight())})}visitLogicalExpression(e){let t=[],r=s((n,o)=>{for(let a of n){if(a instanceof Er&&a.logicalOperator().getText()===o){r(a.expression_list(),a.logicalOperator().getText());continue}let p=this.visit(a);t.push(p)}},"wrapChildren");return r(e.expression_list(),e.logicalOperator().getText()),new de({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new ye(e.getText())}visitExternalConstant(e){return new ni(e.identifier().getText())}visitNullLiteral(){return new tt}visitBooleanLiteral(e){return new et(e.getText()==="true")}visitNumberLiteral(e){return new be(e.getText())}visitStringLiteral(e){return new rt(Tr(e.getText()))}visitInfinityLiteral(){return new be(1/0)}visitDateLiteral(e){return new Ae(Tr(e.getText()))}visitDateTimeLiteral(e){return new Ae(Tr(e.getText()))}visitTimeLiteral(e){return new it(Tr(e.getText()))}visitArrayValue(e){return new ge(e.value_list().map(t=>this.visit(t)))}};s(ps,"FilterTreeVisitor");var xr=ps;var la=require("@browsery/antlr4");var cs=class cs extends la.ErrorListener{constructor(e){super(),this.errors=e}syntaxError(e,t,r,n,o,a){this.errors.push(new Jr(o,{recognizer:e,offendingSymbol:t,line:r,column:n,e:a}))}};s(cs,"OpraErrorListener");var gr=cs;function ls(i,e){let t=new oi.CharStream(i),r=new aa(t),n=new oi.CommonTokenStream(r),o=new pa(n);o.buildParseTrees=!0;let a=[],p=new gr(a);r.removeErrorListeners(),r.addErrorListener(p),o.removeErrorListeners(),o.addErrorListener(p);let c=o.root();if(a.length){let l=[];for(let m of a)l.push(m.message+(i.includes(`
8
+ `)?" at line: "+m.line+" column: "+m.column:" at column: "+m.column));let x=new zr(l.join(`
9
+ `));throw x.errors=a,x}return e=e||new xr,e.visit(c)}s(ls,"parse");var fs=class fs{constructor(e,t){if(this._rules=new F,Object.defineProperty(this,"_rules",{value:new F(null,{caseSensitive:t==null?void 0:t.caseSensitive}),enumerable:!1}),e)for(let[r,n]of Object.entries(e))this.set(r,n)}set(e,t){let r=typeof(t==null?void 0:t.operators)=="string"?t.operators.split(/\s*[,| ]\s*/):t==null?void 0:t.operators;this._rules.set(e,g({...t,operators:r}))}normalizeFilter(e,t){if(!e)return;let r=typeof e=="string"?ls(e):e;if(r instanceof Oe){if(this.normalizeFilter(r.left,t),!(r.left instanceof ye&&r.left.field))throw new TypeError("Invalid filter query. Left side should be a data field.");let n=this._rules.get(r.left.value);if(!n)throw new me({message:A("error:UNACCEPTED_FILTER_FIELD",{field:r.left.value}),code:"UNACCEPTED_FILTER_FIELD",details:{field:r.left.value}});if(n.operators&&!n.operators.includes(r.op))throw new me({message:A("error:UNACCEPTED_FILTER_OPERATION",{field:r.left.value}),code:"UNACCEPTED_FILTER_OPERATION",details:{field:r.left.value,operator:r.op}});return this.normalizeFilter(r.right,t),r}return r instanceof de?(r.items.forEach(n=>this.normalizeFilter(n,t)),r):r instanceof He?(r.items.forEach(n=>this.normalizeFilter(n.expression,t)),r):r instanceof ge?(r.items.forEach(n=>this.normalizeFilter(n,t)),r):r instanceof Re?(this.normalizeFilter(r.expression,t),r):(r instanceof ye&&t&&(r.value=t.normalizeFieldPath(r.value),r.field=t.getField(r.value),r.dataType=r.field.type),r)}toJSON(){return this._rules.toObject()}[Symbol.iterator](){return this._rules.entries()}};s(fs,"FilterRules");var we=fs;var It={};Ti(It,{$and:()=>ap,$arithmetic:()=>bp,$array:()=>fa,$date:()=>pp,$eq:()=>up,$field:()=>fp,$gt:()=>hp,$gte:()=>dp,$ilike:()=>Op,$in:()=>Ep,$like:()=>xp,$lt:()=>yp,$lte:()=>Tp,$ne:()=>mp,$notILike:()=>Rp,$notIn:()=>_p,$notLike:()=>gp,$number:()=>lp,$or:()=>sp,$paren:()=>Ap,$time:()=>cp,ArithmeticExpression:()=>He,ArithmeticExpressionItem:()=>Kr,ArrayExpression:()=>ge,Ast:()=>dr,BooleanLiteral:()=>et,ComparisonExpression:()=>Oe,DateLiteral:()=>Ae,Expression:()=>q,FilterTreeVisitor:()=>xr,Literal:()=>j,LogicalExpression:()=>de,NegativeExpression:()=>yr,NullLiteral:()=>tt,NumberLiteral:()=>be,OpraErrorListener:()=>gr,ParenthesizedExpression:()=>Re,QualifiedIdentifier:()=>ye,StringLiteral:()=>rt,Term:()=>Ze,TimeLiteral:()=>it,parse:()=>ls});function sp(...i){return new de({op:"or",items:i})}s(sp,"$or");function ap(...i){return new de({op:"and",items:i})}s(ap,"$and");function pp(i){return new Ae(i)}s(pp,"$date");function cp(i){return new it(i)}s(cp,"$time");function lp(i){return new be(i)}s(lp,"$number");function fa(...i){return new ge(i.map(si))}s(fa,"$array");function fp(i){return new ye(i)}s(fp,"$field");function up(i,e){return se("=",i,e)}s(up,"$eq");function mp(i,e){return se("!=",i,e)}s(mp,"$ne");function hp(i,e){return se(">",i,e)}s(hp,"$gt");function dp(i,e){return se(">=",i,e)}s(dp,"$gte");function yp(i,e){return se("<",i,e)}s(yp,"$lt");function Tp(i,e){return se("<=",i,e)}s(Tp,"$lte");function Ep(i,e){return se("in",i,e)}s(Ep,"$in");function _p(i,e){return se("!in",i,e)}s(_p,"$notIn");function xp(i,e){return se("like",i,e)}s(xp,"$like");function gp(i,e){return se("!like",i,e)}s(gp,"$notLike");function Op(i,e){return se("ilike",i,e)}s(Op,"$ilike");function Rp(i,e){return se("!ilike",i,e)}s(Rp,"$notILike");function Ap(i){return new Re(i)}s(Ap,"$paren");function bp(i){let e=new He;return e.add=t=>(e.append("+",St(t)),e),e.sub=t=>(e.append("-",St(t)),e),e.mul=t=>(e.append("*",St(t)),e),e.div=t=>(e.append("/",St(t)),e),e.append("+",si(i)),e}s(bp,"$arithmetic");function se(i,e,t){let r=si(e),n=si(t);return new Oe({op:i,left:r,right:n})}s(se,"comparisonExpression");var si=s(i=>Array.isArray(i)?fa(...i.map(St)):St(i),"wrapEntryValue"),St=s(i=>i instanceof q?i:typeof i=="boolean"?new et(i):typeof i=="number"||typeof i=="bigint"?new be(i):i==null?new tt:i instanceof Date?new Ae(i):new rt(""+i),"_wrapEntryValue");var Lt,ae=(Lt=class{constructor(e){e&&Object.assign(this,e)}[T](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.rules?new we(e.rules):void 0;return wp(r,n)}[O](){return Np}toJSON(e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");return{dataType:r.name?r.name:r.toJSON(),rules:e.rules}}},s(Lt,"FilterType"),Lt);(0,Ue.__decorate)([u.Attribute({description:"Data type which filtering fields belong to"}),(0,Ue.__metadata)("design:type",Object)],ae.prototype,"dataType",void 0);(0,Ue.__decorate)([u.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),(0,Ue.__metadata)("design:type",Object)],ae.prototype,"rules",void 0);ae=(0,Ue.__decorate)([u({description:"A query filter",nameMappings:{js:"object",json:"string"}}),(0,Ue.__metadata)("design:paramtypes",[Object])],ae);var wp=s((i,e)=>(0,us.validator)("decodeFilter",(t,r,n)=>{if(typeof t=="string")try{let o=It.parse(t);return e?e.normalizeFilter(o,i):o}catch(o){r.fail(n,`Not a valid filter expression. ${o.message}`,t);return}r.fail(n,"Nt a valid filter expression string",t)}),"decodeFilter"),Np=(0,us.validator)("encodeFilter",(i,e,t)=>{if(i instanceof It.Ast)return i.toString();e.fail(t,"Not a valid filter expression",i)});var ai=require("tslib"),ms=require("valgen");var Pt,Or=(Pt=class{constructor(e){e&&Object.assign(this,e)}[T](){return ms.vg.isObjectId({coerce:!0})}[O](){return ms.vg.isObjectId({coerce:!0})}},s(Pt,"ObjectIdType"),Pt);Or=(0,ai.__decorate)([u({description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),(0,ai.__metadata)("design:paramtypes",[Object])],Or);var v=require("tslib");var Mt,Y=(Mt=class{constructor(e){e&&Object.assign(this,e)}},s(Mt,"OperationResult"),Mt);(0,v.__decorate)([k(),(0,v.__metadata)("design:type",Number)],Y.prototype,"affected",void 0);(0,v.__decorate)([k(),(0,v.__metadata)("design:type",Number)],Y.prototype,"totalMatches",void 0);(0,v.__decorate)([k(),(0,v.__metadata)("design:type",String)],Y.prototype,"context",void 0);(0,v.__decorate)([k(),(0,v.__metadata)("design:type",String)],Y.prototype,"type",void 0);(0,v.__decorate)([k(),(0,v.__metadata)("design:type",String)],Y.prototype,"message",void 0);(0,v.__decorate)([k({type:"any"}),(0,v.__metadata)("design:type",Object)],Y.prototype,"payload",void 0);(0,v.__decorate)([k({type:"object"}),(0,v.__metadata)("design:type",Array)],Y.prototype,"errors",void 0);Y=(0,v.__decorate)([X({description:"Operation result"}),(0,v.__metadata)("design:paramtypes",[Object])],Y);(function(i){function e(t){var n;let r=(n=class extends i{constructor(...a){super(...a)}},s(n,"OperationResult_"),n);return(0,v.__decorate)([k({type:t,required:!0}),(0,v.__metadata)("design:type",Object)],r.prototype,"payload",void 0),r=(0,v.__decorate)([X({embedded:!0}),(0,v.__metadata)("design:paramtypes",[Object])],r),r}s(e,"forPayload"),i.forPayload=e})(Y||(Y={}));var Ce=require("tslib"),Rr=require("valgen");var Dp=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,vt,nt=(vt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=Rr.vg.matches(Dp,{formatName:"time",coerce:!0}),r=[];return e.minValue&&r.push(Rr.vg.isGte(e.minValue)),e.maxValue&&r.push(Rr.vg.isLte(e.maxValue)),r.length>0?Rr.vg.pipe([t,...r],{returnIndex:0}):t}[O](e){return this[T](e)}},s(vt,"TimeType"),vt);(0,Ce.__decorate)([u.Attribute({description:"Minimum value"}),(0,Ce.__metadata)("design:type",String)],nt.prototype,"minValue",void 0);(0,Ce.__decorate)([u.Attribute({description:"Maximum value"}),(0,Ce.__metadata)("design:type",String)],nt.prototype,"maxValue",void 0);nt=(0,Ce.__decorate)([u({description:"Time string in 24h format",nameMappings:{js:"string",json:"string"}}).Example("18:23:00","Full time value").Example("18:23:00","Time value without seconds"),(0,Ce.__metadata)("design:paramtypes",[Object])],nt);var pi=require("tslib"),hs=require("valgen");var Ft,Ar=(Ft=class{constructor(e){e&&Object.assign(this,e)}[T](){return hs.vg.isURL({coerce:!0})}[O](){return hs.vg.isURL({coerce:!0})}},s(Ft,"UrlType"),Ft);Ar=(0,pi.__decorate)([u({description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),(0,pi.__metadata)("design:paramtypes",[Object])],Ar);var Ut=require("tslib"),ds=require("valgen");var kt,jt=(kt=class{constructor(e){e&&Object.assign(this,e)}[T](e){return ds.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}[O](e){return ds.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}},s(kt,"UuidType"),kt);(0,Ut.__decorate)([u.Attribute({description:"Version of the UUID"}),(0,Ut.__metadata)("design:type",Number)],jt.prototype,"version",void 0);jt=(0,Ut.__decorate)([u({description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),(0,Ut.__metadata)("design:paramtypes",[Object])],jt);function Be(i,e,t){let r=Ur(e.pick,e.omit),n=typeof i=="string"?i.charAt(0).toUpperCase()+i.substring(1):i.name,o=(t==null?void 0:t.name)||n+"Mapped",a={[o]:class{constructor(){typeof i=="function"&&Qt(this,i,r)}}}[o];if(typeof i=="function"&&Yt(a.prototype,i.prototype),typeof i=="function"){let c=Reflect.getOwnMetadata(E,i);if(!c)throw new TypeError(`Class "${i}" doesn't have datatype metadata information`);if(!(c.kind===h.ComplexType.Kind||c.kind===h.MappedType.Kind||c.kind===h.MixinType.Kind))throw new TypeError(`Class "${i}" is not a ${h.ComplexType.Kind}`)}let p={...t,kind:"MappedType",base:i};return e.pick&&(p.pick=e.pick),e.omit&&(p.omit=e.omit),e.partial&&(p.partial=e.partial),e.required&&(p.required=e.required),Reflect.defineMetadata(E,p,a),typeof i=="function"&&Ie._applyMixin(a,i,{...e,isInheritedPredicate:r}),a}s(Be,"createMappedClass");function Sp(i,e,t){return Be(i,{omit:e},t)}s(Sp,"OmitType");function Ip(i,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return Be(i,{partial:t},r)}s(Ip,"PartialType");function Lp(i,e,t){return Be(i,{pick:e},t)}s(Lp,"PickType");var ci=require("tslib"),ys=require("valgen");var Ct,br=(Ct=class{constructor(e){e&&Object.assign(this,e)}[T](){return ys.isAny}[O](){return ys.isAny}},s(Ct,"AnyType"),Ct);br=(0,ci.__decorate)([u({description:"Represents any value"}),(0,ci.__metadata)("design:paramtypes",[Object])],br);var li=require("tslib"),st=require("valgen");var qe=require("tslib"),ot=require("valgen");var Bt,fe=(Bt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=[];return e.minValue&&t.push(ot.vg.isGte(e.minValue)),e.maxValue&&t.push(ot.vg.isLte(e.maxValue)),t.length>0?ot.vg.pipe([ot.toNumber,...t],{returnIndex:0}):ot.toNumber}[O](e){return this[T](e)}},s(Bt,"NumberType"),Bt);(0,qe.__decorate)([u.Attribute({description:"Determines the minimum value"}),(0,qe.__metadata)("design:type",Number)],fe.prototype,"minValue",void 0);(0,qe.__decorate)([u.Attribute({description:"Determines the maximum value"}),(0,qe.__metadata)("design:type",Number)],fe.prototype,"maxValue",void 0);fe=(0,qe.__decorate)([u({description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),(0,qe.__metadata)("design:paramtypes",[Object])],fe);var qt,wr=(qt=class extends fe{constructor(e){super(e)}[T](e){let t=[];return e.minValue&&t.push(st.vg.isGte(e.minValue)),e.maxValue&&t.push(st.vg.isLte(e.maxValue)),t.length>0?st.vg.pipe([st.toBigint,...t],{returnIndex:0}):st.toBigint}[O](e){return this[T](e)}},s(qt,"BigintType"),qt);wr=(0,li.__decorate)([u({description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),(0,li.__metadata)("design:paramtypes",[Object])],wr);var fi=require("tslib"),Ts=require("valgen");var $t,Nr=($t=class{constructor(e){e&&Object.assign(this,e)}[T](){return Ts.toBoolean}[O](){return Ts.toBoolean}},s($t,"BooleanType"),$t);Nr=(0,fi.__decorate)([u({description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),(0,fi.__metadata)("design:paramtypes",[Object])],Nr);var ui=require("tslib"),at=require("valgen");var Vt,$e=(Vt=class extends fe{constructor(e){super(e)}[T](e){let t=[];return e.minValue&&t.push(at.vg.isGte(e.minValue)),e.maxValue&&t.push(at.vg.isLte(e.maxValue)),t.length>0?at.vg.pipe([at.toInteger,...t],{returnIndex:0}):at.toInteger}[O](e){return this[T](e)}},s(Vt,"IntegerType"),Vt);$e=(0,ui.__decorate)([u({description:"An integer number",nameMappings:{js:"number",json:"number"}}),(0,ui.__metadata)("design:paramtypes",[Object])],$e);var mi=require("tslib"),Es=require("valgen");var Kt,Dr=(Kt=class{constructor(e){e&&Object.assign(this,e)}[T](){return Es.isNull}[O](){return Es.isNull}},s(Kt,"NullType"),Kt);Dr=(0,mi.__decorate)([u({description:"A Null value",nameMappings:{js:"null",json:"null"}}),(0,mi.__metadata)("design:paramtypes",[Object])],Dr);var hi=require("tslib");var zt,Sr=(zt=class{constructor(e){e&&Object.assign(this,e)}},s(zt,"ObjectType"),zt);Sr=(0,hi.__decorate)([X({name:"object",description:"A non modelled object",additionalFields:!0}),(0,hi.__metadata)("design:paramtypes",[Object])],Sr);var pe=require("tslib"),Ve=require("valgen");var Jt,Ne=(Jt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(E,Object.getPrototypeOf(this).constructor).name),t.push(Ve.vg.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(Ve.vg.lengthMin(e.minLength)),e.maxLength&&t.push(Ve.vg.lengthMax(e.maxLength)),t.length>0?Ve.vg.pipe([Ve.toString,...t],{returnIndex:0}):Ve.toString}[O](e){return this[T](e)}},s(Jt,"StringType"),Jt);(0,pe.__decorate)([u.Attribute({description:"Regex pattern to be used for validation"}),(0,pe.__metadata)("design:type",Object)],Ne.prototype,"pattern",void 0);(0,pe.__decorate)([u.Attribute({description:"Name of the pattern"}),(0,pe.__metadata)("design:type",String)],Ne.prototype,"patternName",void 0);(0,pe.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,pe.__metadata)("design:type",Number)],Ne.prototype,"minLength",void 0);(0,pe.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,pe.__metadata)("design:type",Number)],Ne.prototype,"maxLength",void 0);Ne=(0,pe.__decorate)([u({description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),(0,pe.__metadata)("design:paramtypes",[Object])],Ne);function Pp(i,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return Be(i,{required:t},r)}s(Pp,"RequiredType");D.Entity={};D.Entity.Create=function(i,e){var o;let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=U(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return n.QueryParam("projection",{description:"Determines fields projection",type:new ee({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((o=t.requestBody)==null?void 0:o.type)||t.type).Response(N.CREATED,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the created resource.',contentType:P.opra_response_json,type:t.type,partial:"deep"}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:P.opra_response_json}),r.push(a=>{let p=a.compositionOptions=a.compositionOptions||{};p.type=pt(t.type)}),n};D.Entity.Delete=function(i,e){let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=U(r,{method:"DELETE",...t,composition:"Entity.Delete"});return n.Response(N.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:P.opra_response_json}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:P.opra_response_json}),n.KeyParam=(o,a)=>{let p=typeof a=="string"||typeof a=="function"?{name:o,location:"path",type:a,keyParam:!0}:{...a,name:o,location:"path",keyParam:!0};return n.PathParam(o,p),r.push(c=>{var l;(l=c.path)!=null&&l.includes(":"+o)||(c.path=(c.path||"")+"@:"+o),c.mergePath=!0}),n},r.push(o=>{let a=o.compositionOptions=o.compositionOptions||{};a.type=pt(t.type)}),n};D.Entity.DeleteMany=function(i,e){let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=new we,o=new ae({dataType:t.type});o.rules={};let a=U(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return a.Response(N.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:P.opra_response_json}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:P.opra_response_json}).QueryParam("filter",{type:o,description:"Determines filter fields"}),r.push(p=>{let c=p.compositionOptions=p.compositionOptions||{};c.type=pt(t.type)}),a.Filter=(p,c,l)=>(r.push(()=>{n.set(p,{operators:c,description:l}),o.rules=n.toJSON()}),a),a};D.Entity.FindMany=function(i,e){let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=new we,o=new ae({dataType:t.type});o.rules={};let a=U(r,{method:"GET",...t,composition:"Entity.FindMany"});return a.Response(N.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains list of resources.',contentType:P.opra_response_json,type:t.type,partial:"deep",isArray:!0}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:P.opra_response_json}).QueryParam("limit",{description:"Determines number of returning instances",type:new $e({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new $e({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new ee({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).QueryParam("filter",{type:o,description:"Determines filter fields"}).QueryParam("sort",{description:"Determines sort fields",type:new ee({dataType:t.type,allowSigns:"first"}),isArray:!0,arraySeparator:","}),r.push(p=>{let c=p.compositionOptions=p.compositionOptions||{};c.type=pt(t.type),t.defaultLimit&&(c.defaultLimit=t.defaultLimit),t.defaultProjection&&(c.defaultProjection=t.defaultProjection),t.maxLimit&&(c.maxLimit=t.maxLimit)}),a.DefaultSort=(...p)=>(r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.defaultSort=p}),a),a.SortFields=(...p)=>(r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.sortFields=p}),a),a.Filter=(p,c,l)=>(r.push(()=>{n.set(p,{operators:c,description:l}),o.rules=n.toJSON()}),a),a};D.Entity.Get=function(i,e){let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=U(r,{method:"GET",...t,composition:"Entity.Get"});return n.QueryParam("projection",{description:"Determines fields projection",type:new ee({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(N.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:P.opra_response_json,type:t.type,partial:"deep"}).Response(N.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:P.opra_response_json}),n.KeyParam=(o,a)=>{let p=typeof a=="string"||typeof a=="function"?{name:o,location:"path",type:a,keyParam:!0}:{...a,name:o,location:"path",keyParam:!0};return n.PathParam(o,p),r.push(c=>{var l;(l=c.path)!=null&&l.includes(":"+o)||(c.path=(c.path||"")+"@:"+o),c.mergePath=!0}),n},r.push(o=>{let a=o.compositionOptions=o.compositionOptions||{};a.type=pt(t.type)}),n};D.Entity.UpdateMany=function(i,e){var p;let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=new ae({dataType:t.type});n.rules={};let o=new we,a=U(r,{method:"PATCH",...t,composition:"Entity.UpdateMany",requestBody:{immediateFetch:!0,partial:"deep",...t.requestBody,required:!0}});return a.RequestContent(((p=t.requestBody)==null?void 0:p.type)||t.type).Response(N.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:P.opra_response_json}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:P.opra_response_json}).QueryParam("filter",{type:n,description:"Determines filter fields"}),r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.type=pt(t.type)}),a.Filter=(c,l,x)=>(r.push(()=>{o.set(c,{operators:l,description:x}),n.rules=o.toJSON()}),a),a};D.Entity.Update=function(i,e){var p;let t;typeof i=="object"&&!i[E]?t=i:t={...e,type:i};let r=[],n=new we,o=new ae({dataType:t.type});o.rules={};let a=U(r,{method:"PATCH",...t,composition:"Entity.Update",requestBody:{partial:"deep",immediateFetch:!0,...t.requestBody,required:!0}});return a.QueryParam("projection",{description:"Determines fields projection",type:new ee({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).QueryParam("filter",{type:o,description:"Determines filter fields"}).RequestContent(((p=t.requestBody)==null?void 0:p.type)||t.type).Response(N.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',contentType:P.opra_response_json,type:t.type,partial:"deep"}).Response(N.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(N.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:P.opra_response_json}),a.KeyParam=(c,l)=>{let x=typeof l=="string"||typeof l=="function"?{name:c,location:"path",type:l,keyParam:!0}:{...l,name:c,location:"path",keyParam:!0};return a.PathParam(c,x),r.push(m=>{var $;($=m.path)!=null&&$.includes(":"+c)||(m.path=(m.path||"")+"@:"+c),m.mergePath=!0}),a},r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.type=pt(t.type)}),a.Filter=(c,l,x)=>(r.push(()=>{n.set(c,{operators:l,description:x}),o.rules=n.toJSON()}),a),a};function pt(i){if(typeof i=="string")return i;let e=Reflect.getMetadata(E,i);if(!e)throw new TypeError(`Type (${i}) is not decorated with any datatype decorators`);if(e!=null&&e.name)return e.name;throw new TypeError("You should provide named data type but embedded one found")}s(pt,"getDataTypeName");var Mp="https://oprajs.com/spec/v"+h.SpecVersion,di=class di{static async createDocument(e,t){let r=new di,n=t instanceof ce?t:new ce(t);try{let o=new Le;if(await r.initDocument(o,n,e),n.error.details.length)throw n.error;return o}catch(o){try{o instanceof ze||n.addError(o)}catch{}if(!n.error.message){let a=n.error.details.length;n.error.message=`(${a}) error${a>1?"s":""} found in document schema.`,n.showErrorDetails&&(n.error.message+=n.error.details.map(p=>`
10
10
 
11
11
  - ${p.message}`+(p.path?`
12
- @${p.path}`:"")).join(""))}throw n.error}}async initDocument(e,t,r){let n;if(typeof r=="string"){if(n=await(await fetch(r,{method:"GET"})).json(),!n)return t.addError(`Invalid response returned from url: ${r}`);n.url=r}else n=r;let o;if(!e[Ae]){let a=e.node.findDataType("string");o=a==null?void 0:a.node.getDocument(),o||(o=await this.createBuiltinDocument(t),e.references.set("opra",o))}n.spec=n.spec||d.SpecVersion,e.url=n.url,n.info&&(e.info={...n.info}),n.references&&await t.enterAsync(".references",async()=>{let a,p;for([a,p]of Object.entries(n.references))p=await ye(p),await t.enterAsync(`[${a}]`,async()=>{if(!K.test(a))throw new TypeError(`Invalid namespace (${a})`);if(p instanceof Ne){e.references.set(a,p);return}let c=new Ne;o&&c.references.set("opra",o),await this.initDocument(c,t,p);let l=e.findDocument(c.id);e.references.set(a,l||c)})}),n.types&&await t.enterAsync(".types",async()=>{await H.addDataTypes(t,e,n.types)}),n.api&&await t.enterAsync(".api",async()=>{if(n.api.protocol==="http"){let a=await _t.createApi(t,e,n.api);a&&(e.api=a)}else t.addError(`Unknown service protocol (${n.api.protocol})`)}),e.invalidate()}async createBuiltinDocument(e){let t={spec:d.SpecVersion,url:qp,info:{version:d.SpecVersion,title:"Opra built-in types",license:{url:"https://github.com/oprajs/opra/blob/main/LICENSE",name:"MIT"}},types:[br,wr,Nr,Ce,Dr,ue,Sr,Re,lr,Qe,Xe,Ze,He,W,te,pe,Or,Q,ct,Ar,jt]},r=new Ne;r[Ae]=!0;let n=Object.getPrototypeOf(BigInt(0)).constructor,o=Object.getPrototypeOf(Buffer.from([])),a=r.types[Zt];return a.set(Object,"object"),a.set(String,"string"),a.set(Number,"number"),a.set(Boolean,"boolean"),a.set(Object,"any"),a.set(Date,"datetime"),a.set(n,"bigint"),a.set(ArrayBuffer,"base64"),a.set(SharedArrayBuffer,"base64"),a.set(o,"base64"),await this.initDocument(r,e,t),r}};s(yi,"ApiDocumentFactory");var Ts=yi;var Es;(function(i){i.HttpApiFactory=_t,i.DataTypeFactory=H})(Es||(Es={}));var _a=require("uid");
12
+ @${p.path}`:"")).join(""))}throw n.error}}async initDocument(e,t,r){let n;if(typeof r=="string"){if(n=await(await fetch(r,{method:"GET"})).json(),!n)return t.addError(`Invalid response returned from url: ${r}`);n.url=r}else n=r;let o;if(!e[De]){let a=e.node.findDataType("string");o=a==null?void 0:a.node.getDocument(),o||(o=await this.createBuiltinDocument(t),e.references.set("opra",o))}n.spec=n.spec||h.SpecVersion,e.url=n.url,n.info&&(e.info={...n.info}),n.references&&await t.enterAsync(".references",async()=>{let a,p;for([a,p]of Object.entries(n.references))p=await Te(p),await t.enterAsync(`[${a}]`,async()=>{if(!K.test(a))throw new TypeError(`Invalid namespace (${a})`);if(p instanceof Le){e.references.set(a,p);return}let c=new Le;o&&c.references.set("opra",o),await this.initDocument(c,t,p);let l=e.findDocument(c.id);e.references.set(a,l||c)})}),n.types&&await t.enterAsync(".types",async()=>{await Z.addDataTypes(t,e,n.types)}),n.api&&await t.enterAsync(".api",async()=>{if(n.api.protocol==="http"){let a=await Et.createApi(t,e,n.api);a&&(e.api=a)}else t.addError(`Unknown service protocol (${n.api.protocol})`)}),e.invalidate()}async createBuiltinDocument(e){let t={spec:h.SpecVersion,url:Mp,info:{version:h.SpecVersion,title:"Opra built-in types",license:{url:"https://github.com/oprajs/opra/blob/main/LICENSE",name:"MIT"}},types:[br,wr,Nr,$e,Dr,fe,Sr,Ne,fr,Ge,Ye,Qe,Xe,W,ee,ae,Or,Y,nt,Ar,jt]},r=new Le;r[De]=!0;let n=Object.getPrototypeOf(BigInt(0)).constructor,o=Object.getPrototypeOf(Buffer.from([])),a=r.types[Zt];return a.set(Object,"object"),a.set(String,"string"),a.set(Number,"number"),a.set(Boolean,"boolean"),a.set(Object,"any"),a.set(Date,"datetime"),a.set(n,"bigint"),a.set(ArrayBuffer,"base64"),a.set(SharedArrayBuffer,"base64"),a.set(o,"base64"),await this.initDocument(r,e,t),r}};s(di,"ApiDocumentFactory");var _s=di;var xs;(function(i){i.HttpApiFactory=Et,i.DataTypeFactory=Z})(xs||(xs={}));var ua=require("uid");