@opra/common 1.0.0-beta.2 → 1.0.0-beta.4

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/api-document.js +14 -0
  4. package/cjs/document/common/api-base.js +5 -3
  5. package/cjs/document/common/document-node.js +6 -2
  6. package/cjs/document/constants.js +2 -1
  7. package/cjs/document/decorators/http-controller.decorator.js +1 -1
  8. package/cjs/document/decorators/http-operation-entity.decorator.js +1 -1
  9. package/cjs/document/decorators/http-operation.decorator.js +5 -5
  10. package/cjs/document/decorators/rpc-controller.decorator.js +69 -0
  11. package/cjs/document/decorators/rpc-operation.decorator.js +80 -0
  12. package/cjs/document/factory/api-document.factory.js +9 -3
  13. package/cjs/document/factory/data-type.factory.js +20 -0
  14. package/cjs/document/factory/http-api.factory.js +50 -77
  15. package/cjs/document/factory/rpc-api.factory.js +202 -0
  16. package/cjs/document/http/http-api.js +5 -4
  17. package/cjs/document/http/http-controller.js +16 -0
  18. package/cjs/document/http/http-operation.js +6 -0
  19. package/cjs/document/index.js +8 -0
  20. package/cjs/document/rpc/rpc-api.js +54 -0
  21. package/cjs/document/rpc/rpc-controller.js +116 -0
  22. package/cjs/document/rpc/rpc-header.js +40 -0
  23. package/cjs/document/rpc/rpc-operation-response.js +58 -0
  24. package/cjs/document/rpc/rpc-operation.js +80 -0
  25. package/cjs/enums/index.js +7 -0
  26. package/cjs/exception/http-errors/forbidden.error.js +1 -1
  27. package/cjs/exception/http-errors/resource-not.available.error.js +1 -1
  28. package/cjs/index.js +1 -1
  29. package/cjs/schema/opra-schema.js +3 -0
  30. package/cjs/schema/rpc/rpc-controller.interface.js +11 -0
  31. package/cjs/schema/rpc/rpc-header.interface.js +2 -0
  32. package/cjs/schema/rpc/rpc-operation.interface.js +7 -0
  33. package/esm/document/api-document.js +14 -0
  34. package/esm/document/common/api-base.js +5 -3
  35. package/esm/document/common/document-node.js +6 -2
  36. package/esm/document/constants.js +1 -0
  37. package/esm/document/decorators/http-controller.decorator.js +1 -1
  38. package/esm/document/decorators/http-operation-entity.decorator.js +1 -1
  39. package/esm/document/decorators/http-operation.decorator.js +5 -5
  40. package/esm/document/decorators/rpc-controller.decorator.js +65 -0
  41. package/esm/document/decorators/rpc-operation.decorator.js +76 -0
  42. package/esm/document/factory/api-document.factory.js +9 -3
  43. package/esm/document/factory/data-type.factory.js +20 -0
  44. package/esm/document/factory/http-api.factory.js +50 -77
  45. package/esm/document/factory/rpc-api.factory.js +198 -0
  46. package/esm/document/http/http-api.js +5 -4
  47. package/esm/document/http/http-controller.js +17 -1
  48. package/esm/document/http/http-operation.js +6 -0
  49. package/esm/document/index.js +8 -0
  50. package/esm/document/rpc/rpc-api.js +50 -0
  51. package/esm/document/rpc/rpc-controller.js +113 -0
  52. package/esm/document/rpc/rpc-header.js +37 -0
  53. package/esm/document/rpc/rpc-operation-response.js +54 -0
  54. package/esm/document/rpc/rpc-operation.js +77 -0
  55. package/esm/enums/index.js +4 -0
  56. package/esm/exception/http-errors/forbidden.error.js +1 -1
  57. package/esm/exception/http-errors/resource-not.available.error.js +1 -1
  58. package/esm/index.js +1 -1
  59. package/esm/schema/opra-schema.js +3 -0
  60. package/esm/schema/rpc/rpc-controller.interface.js +8 -0
  61. package/esm/schema/rpc/rpc-header.interface.js +1 -0
  62. package/esm/schema/rpc/rpc-operation.interface.js +4 -0
  63. package/package.json +2 -2
  64. package/types/document/api-document.d.ts +5 -2
  65. package/types/document/common/api-base.d.ts +3 -2
  66. package/types/document/constants.d.ts +1 -0
  67. package/types/document/decorators/http-operation.decorator.d.ts +3 -3
  68. package/types/document/decorators/rpc-controller.decorator.d.ts +20 -0
  69. package/types/document/decorators/rpc-operation.decorator.d.ts +32 -0
  70. package/types/document/factory/api-document.factory.d.ts +2 -1
  71. package/types/document/factory/data-type.factory.d.ts +1 -0
  72. package/types/document/factory/http-api.factory.d.ts +10 -6
  73. package/types/document/factory/rpc-api.factory.d.ts +40 -0
  74. package/types/document/http/http-api.d.ts +8 -3
  75. package/types/document/http/http-controller.d.ts +8 -2
  76. package/types/document/index.d.ts +11 -0
  77. package/types/document/rpc/rpc-api.d.ts +27 -0
  78. package/types/document/rpc/rpc-controller.d.ts +89 -0
  79. package/types/document/rpc/rpc-header.d.ts +47 -0
  80. package/types/document/rpc/rpc-operation-response.d.ts +41 -0
  81. package/types/document/rpc/rpc-operation.d.ts +77 -0
  82. package/types/enums/index.d.ts +4 -0
  83. package/types/exception/http-errors/forbidden.error.d.ts +1 -1
  84. package/types/index.d.cts +1 -1
  85. package/types/index.d.ts +1 -1
  86. package/types/schema/api-document.interface.d.ts +25 -4
  87. package/types/schema/opra-schema.d.ts +3 -0
  88. package/types/schema/rpc/rpc-controller.interface.d.ts +22 -0
  89. package/types/schema/rpc/rpc-header.interface.d.ts +19 -0
  90. package/types/schema/rpc/rpc-operation.interface.d.ts +26 -0
  91. package/cjs/http/index.js +0 -7
  92. package/esm/http/index.js +0 -4
  93. package/types/http/index.d.ts +0 -4
  94. /package/cjs/{http/enums → enums}/http-headers-codes.enum.js +0 -0
  95. /package/cjs/{http/enums → enums}/http-status-codes.enum.js +0 -0
  96. /package/cjs/{http/enums → enums}/http-status-messages.js +0 -0
  97. /package/cjs/{http/enums → enums}/mime-types.enum.js +0 -0
  98. /package/esm/{http/enums → enums}/http-headers-codes.enum.js +0 -0
  99. /package/esm/{http/enums → enums}/http-status-codes.enum.js +0 -0
  100. /package/esm/{http/enums → enums}/http-status-messages.js +0 -0
  101. /package/esm/{http/enums → enums}/mime-types.enum.js +0 -0
  102. /package/types/{http/enums → enums}/http-headers-codes.enum.d.ts +0 -0
  103. /package/types/{http/enums → enums}/http-status-codes.enum.d.ts +0 -0
  104. /package/types/{http/enums → enums}/http-status-messages.d.ts +0 -0
  105. /package/types/{http/enums → enums}/mime-types.enum.d.ts +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 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.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{constructor(){this._allDocuments={}}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=>`
6
+ "use strict";var $a=Object.create;var pr=Object.defineProperty;var Ba=Object.getOwnPropertyDescriptor;var Va=Object.getOwnPropertyNames;var Ka=Object.getPrototypeOf,za=Object.prototype.hasOwnProperty;var s=(i,e)=>pr(i,"name",{value:e,configurable:!0});var Di=(i,e)=>{for(var t in e)pr(i,t,{get:e[t],enumerable:!0})},Vs=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Va(e))!za.call(i,o)&&o!==t&&pr(i,o,{get:()=>e[o],enumerable:!(r=Ba(e,o))||r.enumerable});return i};var G=(i,e,t)=>(t=i!=null?$a(Ka(i)):{},Vs(e||!i||!i.__esModule?pr(t,"default",{value:i,enumerable:!0}):t,i)),Ja=i=>Vs(pr({},"__esModule",{value:!0}),i);var fc={};Di(fc,{AnyType:()=>jr,ApiBase:()=>Ze,ApiDocument:()=>ve,ApiDocumentFactory:()=>qs,ApiField:()=>j,BUILTIN:()=>Ie,BadRequestError:()=>jo,Base64Type:()=>Rr,BaseI18n:()=>ta,BigintType:()=>Cr,BooleanType:()=>Ur,CLASS_NAME_PATTERN:()=>U,ComplexType:()=>re,ConflictError:()=>Uo,DATATYPE_METADATA:()=>_,DECODER:()=>E,DECORATOR:()=>b,DataType:()=>R,DataTypeMap:()=>ie,DateStringType:()=>it,DateTimeStringType:()=>nt,DateTimeType:()=>ot,DateType:()=>rt,DocumentElement:()=>w,DocumentInitContext:()=>ue,DocumentNode:()=>Tr,ENCODER:()=>g,EXTRACT_TYPENAME_PATTERN:()=>lr,EmailType:()=>Z,EnumType:()=>me,FailedDependencyError:()=>$o,FieldPathType:()=>oe,FieldsProjection:()=>Me,FilterType:()=>ce,ForbiddenError:()=>br,HTTP_CONTROLLER_METADATA:()=>B,HttpApi:()=>He,HttpController:()=>Y,HttpHeaderCodes:()=>Oo,HttpMediaType:()=>ge,HttpMultipartField:()=>xr,HttpOperation:()=>I,HttpOperationResponse:()=>Or,HttpParameter:()=>It,HttpRequestBody:()=>gr,HttpStatusCode:()=>S,HttpStatusMessages:()=>Np,HttpStatusRange:()=>St,I18n:()=>wt,IntegerType:()=>Ke,InternalServerError:()=>Ko,IssueSeverity:()=>cn,MappedType:()=>Le,MethodNotAllowedError:()=>Jo,MimeTypes:()=>P,MixinType:()=>Qe,NAMESPACE_PATTERN:()=>Li,NotAcceptableError:()=>Go,NotFoundError:()=>Qo,NullType:()=>qr,NumberType:()=>de,ObjectIdType:()=>Pr,ObjectType:()=>$r,OmitType:()=>sc,OperationResult:()=>ee,OpraDocumentError:()=>Ge,OpraException:()=>ye,OpraFilter:()=>Vt,OpraHttpError:()=>N,OpraSchema:()=>m,PartialType:()=>ac,PermissionError:()=>Zo,PickType:()=>pc,RPC_CONTROLLER_METADATA:()=>V,RequiredType:()=>cc,ResourceConflictError:()=>en,ResourceNotAvailableError:()=>rn,ResponsiveMap:()=>D,RpcApi:()=>tt,RpcController:()=>xe,RpcHeader:()=>sr,RpcOperation:()=>ar,SimpleType:()=>u,StringType:()=>Se,TimeType:()=>ut,UnauthorizedError:()=>nn,UnprocessableEntityError:()=>an,UrlType:()=>kr,UuidType:()=>Qt,classes:()=>$s,cloneObject:()=>v,getErrorStack:()=>mp,getStackFileName:()=>up,i18n:()=>Wr,inheritPropertyInitializers:()=>dr,isAsyncIterable:()=>fp,isBlob:()=>ap,isConstructor:()=>We,isFormData:()=>pp,isIterable:()=>lp,isReadable:()=>op,isReadableStream:()=>sp,isStream:()=>Kr,isURL:()=>cp,isWritable:()=>np,kCtorMap:()=>fr,kDataTypeMap:()=>C,kTypeNSMap:()=>Oe,mergePrototype:()=>mr,omitNullish:()=>Xs,omitUndefined:()=>T,parse:()=>Fi,parseFieldsProjection:()=>Pi,resolveThunk:()=>fe,safeJsonStringify:()=>Tp,translate:()=>A,uid:()=>qa.uid});module.exports=Ja(fc);var H3=require("reflect-metadata");var Ks=G(require("lodash.omit"),1),Vr=G(require("putil-merge"),1);var m={};Di(m,{ComplexType:()=>Tt,EnumType:()=>Et,HttpController:()=>cr,HttpOperation:()=>Si,MappedType:()=>_t,MixinType:()=>xt,RpcController:()=>Ii,RpcOperation:()=>Mi,SimpleType:()=>Ot,SpecVersion:()=>Wa,isComplexType:()=>Ya,isDataType:()=>Ga,isEnumType:()=>Ha,isHttpController:()=>ep,isMappedType:()=>Za,isMixinType:()=>Xa,isSimpleType:()=>Qa});var Wa="1.0";var Tt;(function(i){i.Kind="ComplexType"})(Tt||(Tt={}));var Et;(function(i){i.Kind="EnumType"})(Et||(Et={}));var _t;(function(i){i.Kind="MappedType"})(_t||(_t={}));var xt;(function(i){i.Kind="MixinType"})(xt||(xt={}));var Ot;(function(i){i.Kind="SimpleType"})(Ot||(Ot={}));var cr;(function(i){i.Kind="HttpController"})(cr||(cr={}));var Si;(function(i){i.Kind="HttpOperation"})(Si||(Si={}));var Ii;(function(i){i.Kind="RpcController"})(Ii||(Ii={}));var Mi;(function(i){i.Kind="RpcOperation"})(Mi||(Mi={}));function Ga(i){return i&&typeof i=="object"&&(i.kind===Tt.Kind||i.kind===Et.Kind||i.kind===_t.Kind||i.kind===Ot.Kind||i.kind===xt.Kind)}s(Ga,"isDataType");function Ya(i){return i&&typeof i=="object"&&i.kind===Tt.Kind}s(Ya,"isComplexType");function Qa(i){return i&&typeof i=="object"&&i.kind===Ot.Kind}s(Qa,"isSimpleType");function Xa(i){return i&&typeof i=="object"&&i.kind===xt.Kind}s(Xa,"isMixinType");function Za(i){return i&&typeof i=="object"&&i.kind===_t.Kind}s(Za,"isMappedType");function Ha(i){return i&&typeof i=="object"&&i.kind===Et.Kind}s(Ha,"isEnumType");function ep(i){return i&&typeof i=="object"&&i.kind===cr.Kind}s(ep,"isHttpController");var _=Symbol.for("opra.type.metadata"),B=Symbol("opra.http-controller.metadata"),V=Symbol("opra.rpc-controller.metadata"),E=Symbol.for("opra.type.decoder"),g=Symbol("opra.type.encoder"),b=Symbol.for("DECORATOR"),Ie=Symbol.for("BUILTIN"),Li=/([a-z$_]\w+):(.+)/i,U=/^[a-z][\w_]*$/i,lr=/^(.*)Type(\d*)$/,C=Symbol.for("kDataTypeMap"),fr=Symbol.for("kCtorMap"),Oe=Symbol.for("kTypeNSMap");var tp=/^(.*)(Controller)$/,zs=[];function gt(i){let e=[],t=s(function(r){var c;let o=i==null?void 0:i.name;o||(o=((c=tp.exec(r.name))==null?void 0:c[1])||r.name);let n={},a=Reflect.getOwnMetadata(V,Object.getPrototypeOf(r));a&&(0,Vr.default)(n,a,{deep:!0});let p=Reflect.getOwnMetadata(V,r);p&&(0,Vr.default)(n,p,{deep:!0}),(0,Vr.default)(n,{kind:m.RpcController.Kind,name:o,path:o,...(0,Ks.default)(i,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(V,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(V,n,r)},"decorator");return t.Header=(r,o)=>(e.push(n=>{let a=typeof o=="string"||typeof o=="function"?{name:r,type:o}:{...o,name:r};n.headers=n.headers||[],n.headers.push(a)}),t),t.UseType=(...r)=>(e.push(o=>{o.types=o.types||[],o.types.push(...r)}),t),zs.forEach(r=>r(t,e,i)),t}s(gt,"RpcControllerDecoratorFactory");gt.augment=function(i){zs.push(i)};var Js=G(require("lodash.omit"),1);var Ws=[];function ur(i,e,t){let r=!1,o=s((n,a)=>{if(typeof a!="string")throw new TypeError("Symbol properties can not be decorated");let p={kind:m.RpcOperation.Kind,channel:a,...(0,Js.default)(t,["kind"]),payloadType:e},c=Reflect.getOwnMetadata(V,n.constructor)||{};c.operations=c.operations||{},c.operations[a]=p;for(let l of i)l(p,n,a);Reflect.defineMetadata(V,c,n.constructor)},"decorator");return o.UseType=(...n)=>(i.push(a=>{a.types=a.types||[],a.types.push(...n)}),o),o.Header=(n,a)=>(i.push(p=>{let c=typeof a=="string"||typeof a=="function"?{name:n,type:a}:{...a,name:n},l=r?p.response:p;l.headers?l.headers=l.headers.filter(O=>String(O.name)!==String(n)):l.headers=[],l.headers.push(c)}),o),o.Response=(n,a)=>(i.push(p=>{r=!0,p.response={...a,payloadType:n}}),o),Ws.forEach(n=>n(o,i,e,t)),o}s(ur,"RpcOperationDecoratorFactory");ur.augment=function(i){Ws.push(i)};BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});var Gs=G(require("putil-promisify"),1);function We(i){return typeof i=="function"&&i.prototype&&i.prototype.constructor===i&&i.prototype.constructor.name!=="Function"&&i.prototype.constructor.name!=="embedded"}s(We,"isConstructor");function Kr(i){return i!==null&&typeof i=="object"&&typeof i.pipe=="function"}s(Kr,"isStream");function op(i){return Kr(i)&&typeof i._read=="function"&&typeof i._readableState=="object"}s(op,"isReadable");function np(i){return Kr(i)&&typeof i._write=="function"}s(np,"isWritable");function sp(i){return Kr(i)&&typeof i.getReader=="function"&&typeof i.pipeThrough=="function"&&typeof i.pipeTo=="function"}s(sp,"isReadableStream");function ap(i){return i!==null&&typeof i=="object"&&typeof i.size=="number"&&typeof i.arrayBuffer=="function"&&typeof i.stream=="function"}s(ap,"isBlob");function pp(i){return i!==null&&typeof i.constructor=="function"&&i.constructor.name==="FormData"&&typeof i.append=="function"&&typeof i.getAll=="function"}s(pp,"isFormData");function cp(i){return i!==null&&typeof i=="object"&&typeof i.host=="string"&&typeof i.href=="string"}s(cp,"isURL");function lp(i){return Symbol.iterator in i}s(lp,"isIterable");function fp(i){return Symbol.asyncIterator in i}s(fp,"isAsyncIterable");async function fe(i){return i=Gs.default.isPromise(i)?await i:i,typeof i=="function"?We(i)?i:await i():i}s(fe,"resolveThunk");var Ys=/^(?:file:\/\/)?(.+)$/;function up(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,o)=>o;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[i]?t[i].getFileName():void 0,o=r?Ys.exec(r):void 0;return o?o[1]:""}return""}s(up,"getStackFileName");function mp(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,o)=>o;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[i]?t[i].getFileName():void 0,o=r?Ys.exec(r):void 0;return o?o[1]:""}return""}s(mp,"getErrorStack");function mr(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(mr,"mergePrototype");function dr(i,e,t=r=>!0){try{let r=new e;Object.getOwnPropertyNames(r).filter(n=>typeof r[n]<"u"&&typeof i[n]>"u").filter(n=>t(n)).forEach(n=>{i[n]=r[n]})}catch{}}s(dr,"inheritPropertyInitializers");var zr=G(require("putil-isplainobject"),1),Qs=G(require("putil-merge"),1);function v(i,e){return(0,Qs.default)({},i,{deep:s(t=>(0,zr.default)(t)&&!t[_],"deep"),descriptor:!0,filter:s((t,r)=>{let o=t[r];return!e||typeof o!="function"&&(typeof o!="object"||(0,zr.default)(o)||Array.isArray(o))},"filter")})}s(v,"cloneObject");function T(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"&&T(i[t]);return i}s(T,"omitUndefined");function Xs(i,e){if(!(i&&typeof i=="object"))return i;for(let t of Object.keys(i))i[t]==null?delete i[t]:e&&(0,zr.default)(i[t])&&Xs(i[t]);return i}s(Xs,"omitNullish");var vi=require("fast-tokenizer");var dp=/^([+-])?([a-z_$]\w*)$/i,hp=/[^.]\(/g,ki=class ki{};s(ki,"FieldsProjection");var Me=ki;(function(i){let t=class t{};s(t,"Item");let e=t;i.Item=e})(Me||(Me={}));function Pi(i,e){let t=Array.isArray(i)?i:[i];if(!(t&&t.length))return;let r=new Me;for(let o of t)e||(o=o.toLowerCase()),Fi(o,r);return r}s(Pi,"parseFieldsProjection");function Fi(i,e){i=i.replace(hp,r=>r.charAt(0)+"."+r.substring(1));let t=(0,vi.splitString)(i,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let o=t[r];if(o.includes(",")){let c=(0,vi.splitString)(o,{delimiters:",",brackets:!0,keepBrackets:!0});for(let l of c)Fi(l,e);continue}let n=dp.exec(o);if(!n)throw new TypeError(`Invalid field path (${i})`);let a=n[2],p=e[a]=e[a]||new Me.Item;n[1]&&(p.sign=n[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new Me}}s(Fi,"parse");function yp(i){return i&&typeof i.forEach=="function"}s(yp,"isMap");var X=Symbol.for("kEntries"),he=Symbol.for("kKeyMap"),Jr=Symbol.for("kWellKnownKeys"),ji=Symbol.for("kOptions"),Rt=Symbol.for("kSize"),Ci=class Ci{constructor(e,t){Object.defineProperty(this,Rt,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,X,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,he,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,Jr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,ji,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(o=>{r?this[Jr][o]=o:this[Jr][o.toLowerCase()]=o}),this.clear(),e&&this.setAll(e)}get size(){return this[Rt]}clear(){Object.keys(this[X]).forEach(e=>delete this[X][e]),Object.keys(this[he]).forEach(e=>delete this[he][e]),this[Rt]=0}forEach(e,t){for(let[r,o]of this.entries())e.call(t,o,r,this)}get(e){if(e)return this[X][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[X],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let o=Object.prototype.hasOwnProperty.call(this[X],r);return this[X][r]=t,o||this[Rt]++,this[he][r]=e,this}setAll(e){return yp(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[he])[Symbol.iterator]()}values(){return Object.values(this[X])[Symbol.iterator]()}entries(){return Object.entries(this[X])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[X],t);return delete this[X][t],delete this[he][t],r||this[Rt]--,r}sort(e){let t={...this[X]},r={...this[he]},o=Array.from(this.keys());e?o.sort(e):o.sort(),this.clear();for(let n of o)this[X][n]=t[n],this[he][n]=r[n];return this[Rt]=o.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[he]))e[r]=this[X][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[ji].caseSensitive)return e;let t=this._getStoringKey(e);return this[he][t]??this[Jr][t]??e}_getStoringKey(e){return this[ji].caseSensitive?e:e.toLowerCase()}};s(Ci,"ResponsiveMap");var D=Ci;function Tp(i,e,t){let r=new WeakSet;return JSON.stringify(i,(o,n)=>{if(n!==null&&typeof n=="object"){if(r.has(n))return;r.add(n)}return e?e(o,n):n},t)}s(Tp,"safeJsonStringify");var ea=G(require("@browsery/i18next"),1),yr=require("fast-tokenizer");var Ep=/\\(.)/g,_p=/(\\)/g;function Zs(i){return i.replace(_p,"\\\\")}s(Zs,"escapeString");function Hs(i){return i.replace(Ep,"$1")}s(Hs,"unescapeString");var ta=Object.getPrototypeOf(ea.default.createInstance()).constructor,hr=class hr extends ta{async init(e,t){let r=typeof e=="object"?e:{},o=typeof e=="function"?e:t;try{let n=await super.init(r,o),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 o&&o(null,n),n}catch(n){throw o&&o(n,this.t),n}}deep(e,t){if(e==null)return e;let r=new WeakMap;return this._deepTranslate(e,r,t)}createInstance(e,t){return new hr(e,t)}static createInstance(e,t){return new hr(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 o="";for(let n of(0,yr.tokenize)(e,{brackets:{"$t(":")"},quotes:!0,keepQuotes:!0,keepBrackets:!0,keepDelimiters:!0})){if(n.startsWith("$t(")&&n.endsWith(")")){n=n.substring(3,n.length-1);let a=(0,yr.splitString)(n,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),p=Hs(n.substring((a[0]||"").length+1));n=a[0]||"";let c=[],l=null;for(let d of(0,yr.tokenize)(n,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(d.startsWith("{")){l=JSON.parse(d);continue}c.push(d)}let O=c.length>1?"$t("+c.join(",")+")":c[0];o+=p?this.t(O,p,{...r,...l}):this.t(O,{...r,...l});continue}o+=n}return o}if(Array.isArray(e)){let o=Array(e.length);t.set(e,o);for(let n=0,a=e.length;n<a;n++)o[n]=this._deepTranslate(e[n],t,r);return t.delete(e),o}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 o={};t.set(e,o);let n=Object.keys(e);for(let a=0,p=n.length;a<p;a++){let c=n[a];o[c]=this._deepTranslate(e[c],t,r)}return t.delete(e),o}return e}static get defaultInstance(){return xp}};s(hr,"I18n");var wt=hr,xp=wt.createInstance();var Op=/(\))/g;function A(i,e,t){let r=e&&typeof e=="object"?e:void 0,o=typeof e=="string"?e:t;return"$t("+i+(r?","+JSON.stringify(r):"")+(o?"?"+Zs(o).replace(Op,"\\$1"):"")+")"}s(A,"translate");var Wr=wt.createInstance();Wr.init().catch(()=>{});var Ui=class Ui 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 Wr.deep(this.message)}toJSON(){var t;let e="production";return T({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(Ui,"OpraException");var ye=Ui;var qi=class qi extends ye{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};s(qi,"OpraDocumentError");var Ge=qi;var $i=class $i{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(o){o!==this.error&&this.addError(o)}finally{this.path=r}}async enterAsync(e,t){let r=this.path;this.path=this.path+e;try{return await t()}catch(o){o!==this.error&&this.addError(o)}finally{this.path=r}}extend(e){let t={...e};return Object.setPrototypeOf(t,this),t}};s($i,"DocumentInitContext");var ue=$i;var qf=require("reflect-metadata"),pa=require("ts-gems");var ra=G(require("lodash.omit"),1);function Bi(i){return function(e){var o;let t;if(!(i!=null&&i.embedded))if(i!=null&&i.name){if(!U.test(i.name))throw new TypeError(`"${i.name}" is not a valid type name`);t=i.name}else t=((o=e.name.match(lr))==null?void 0:o[1])||e.name;let r=Reflect.getOwnMetadata(_,e);r||(r={},Reflect.defineMetadata(_,r,e)),r.kind=m.ComplexType.Kind,r.name=t,i&&Object.assign(r,(0,ra.default)(i,["kind","name","base","fields"]))}}s(Bi,"ComplexTypeDecorator");var aa=require("ts-gems");var ia=require("ts-gems"),oa=require("uid");var Vi=class Vi{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[Oe])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[C])==null?void 0:r.has(e);return t||(this.parent?this.parent.hasDataType(e):!1)}findDataType(e){var r;let t=(r=this[C])==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).name;else if(typeof e=="object"){let o=e[_];r=o==null?void 0:o.name}throw r||(e&&typeof e=="string"?r=e:typeof e=="function"&&(r=e.name)),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===m.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===m.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===m.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===m.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===m.MixinType.Kind)return t;throw new TypeError(`Data type "${t.name||t}" is not a MixinType`)}};s(Vi,"DocumentNode");var Tr=Vi;var w=s(function(i){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=(0,ia.asMutable)(this);e.id=(0,oa.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"),zi=class zi{};s(zi,"DocumentElementClass");var Ki=zi;w.prototype=Ki.prototype;function Ji(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.constructor)||{};r.kind=m.ComplexType.Kind,r.fields=r.fields||{};let o=Reflect.getMetadata("design:type",e,t),n=r.fields[t]={...i};o===Array?n.isArray=!0:n.type=n.type||o,Reflect.defineMetadata(_,r,e.constructor)}}s(Ji,"ApiFieldDecorator");var sa=require("ts-gems"),Te=require("valgen");var na=require("ts-gems");var At=Symbol.for("nodejs.util.inspect.custom"),Ye="\x1B[0m",bt="\x1B[33m",Nt="\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&&!U.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);w.call(this,i);let r=(0,na.asMutable)(this);r.kind=e.kind,r.name=e.name,r.description=e.description,r.abstract=e.abstract,r.examples=e.examples},"DataType"),Gi=class Gi extends w{get embedded(){return!this.name}toJSON(){return T({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[At](){return`[${bt+Object.getPrototypeOf(this).constructor.name+Ye} ${Nt+this.name+Ye}]`}};s(Gi,"DataTypeClass");var Wi=Gi;R.prototype=Wi.prototype;var gp=/^([+-])?([a-z$_][\w.]*)$/i,M=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 o=(0,sa.asMutable)(this);o.fields=new D},"ComplexTypeBase"),Qi=class Qi 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 d,W,Bs;let r=this,o,n=e.split("."),a=n.length,p=[],c=this.owner.node.getDataType("object"),l=t==null?void 0:t.allowSigns,O=s(()=>p.map(Je=>Je.fieldName).join("."),"getStrPath");for(let Je=0;Je<a;Je++){let te={fieldName:n[Je],dataType:c};p.push(te);let Br=gp.exec(n[Je]);if(!Br)throw new TypeError(`Invalid field name (${O()})`);if(Br[1]&&((Je===0&&l==="first"||l==="each")&&(te.sign=Br[1]),te.fieldName=Br[2]),r){if(r instanceof M){if(o=r.fields.get(te.fieldName),o){te.fieldName=o.name,te.field=o,te.dataType=o.type,r=o.type;continue}if(((d=r.additionalFields)==null?void 0:d[0])===!0){te.additionalField=!0,te.dataType=c,r=void 0;continue}if(((W=r.additionalFields)==null?void 0:W[0])==="type"&&((Bs=r.additionalFields)==null?void 0:Bs[1])instanceof R){te.additionalField=!0,te.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(Ni=>Ni.fieldName).join(".")})`)}throw new TypeError(`"${p.map(Ni=>Ni.fieldName).join(".")}" field is not a complex type and has no child fields`)}te.additionalField=!0,te.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)?Pi(t.projection):t==null?void 0:t.projection,o=this._generateSchema(e,{...t,projection:r,currentPath:""}),n;if(this.additionalFields instanceof R)n=this.additionalFields.generateCodec(e,t);else if(typeof this.additionalFields=="boolean")n=this.additionalFields;else if(Array.isArray(this.additionalFields))if(this.additionalFields.length<2)n="error";else{let a=n[1];n=(0,Te.validator)((p,c,l)=>c.fail(l,a,p))}return Te.vg.isObject(o,{ctor:this.name==="object"?Object:this.ctor,additionalFields:n,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:o,projection:n}=t,a=!!(n&&Object.values(n).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]=Te.vg.isUndefined({coerce:!0});continue}p=l.name;let O;if(n!=="*"&&(O=n==null?void 0:n[p.toLowerCase()],(O==null?void 0:O.sign)==="-"||a&&!O||!a&&l.exclusive&&!O)){r[l.name]=Te.vg.isUndefined({coerce:!0});continue}let d=this._generateFieldCodec(e,l,{...t,partial:t.partial==="deep"?t.partial:void 0,projection:typeof n=="object"?((c=n[p])==null?void 0:c.projection)||"*":n,currentPath:o+(o?".":"")+p});r[p]=t.partial||!l.required?Te.vg.optional(d):Te.vg.required(d)}return r}_generateFieldCodec(e,t,r){let o=t.type.generateCodec(e,r);return t.fixed&&(o=Te.vg.isEnum([t.fixed])),t.isArray&&(o=Te.vg.isArray(o)),o}};s(Qi,"ComplexTypeBaseClass");var Yi=Qi;M.prototype=Yi.prototype;var j=s(function(...i){if(!this){let[n]=i;return j[b](n)}let[e,t]=i;w.call(this,e);let r=(0,aa.asMutable)(this);r.name=t.name;let o=t.origin||e;if(!(o instanceof M))throw new Error("Field origin should be one of ComplexType, MappedType or MixinType");r.origin=o,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"),Zi=class Zi extends w{toJSON(){var t;let e=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return T({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(Zi,"ApiFieldClass");var Xi=Zi;j.prototype=Xi.prototype;Object.assign(j,Ji);j[b]=Ji;var re=s(function(...i){var n;if(!this)return re[b].apply(void 0,i);let[e,t]=i,r=i[2]||new ue({maxErrors:0});M.call(this,e,t,r);let o=(0,pa.asMutable)(this);o.kind=m.ComplexType.Kind,o.additionalFields=t.additionalFields,o.keyField=t.keyField,t.base&&r.enter(".base",()=>{if(!(t.base instanceof M))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);o.base=t.base,o.additionalFields==null&&o.base.additionalFields&&(o.additionalFields=o.base.additionalFields);for(let a of o.base.fields.values())this.fields.set(a.name,new j(this,a))}),o.ctor=t.ctor||((n=o.base)==null?void 0:n.ctor),t.fields&&r.enter(".fields",()=>{for(let[a,p]of Object.entries(t.fields)){let c=new j(this,{...p,name:a});this.fields.set(c.name,c)}})},"ComplexType"),eo=class eo extends M{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof M?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(){let e=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,t=T({...M.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={},o=0;for(let n of this.fields.values())n.origin===this&&(r[n.name]=n.toJSON(),o++);o&&(t.fields=r)}return T(t)}};s(eo,"ComplexTypeClass");var Hi=eo;re.prototype=Hi.prototype;Object.assign(re,Bi);re[b]=Bi;var Xf=require("reflect-metadata"),ca=require("ts-gems"),la=require("valgen");var me=s(function(...i){if(!this)return me[b].apply(void 0,i);let[e,t,r]=i;R.call(this,e,t,r);let o=(0,ca.asMutable)(this);if(o.kind=m.EnumType.Kind,t.base){if(!(t.base instanceof me))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${o.kind}"`);o.base=t.base}o.instance=t.instance,o.ownAttributes=v(t.attributes||{}),o.attributes=o.base?v(o.base.attributes):{};for(let[n,a]of Object.entries(o.ownAttributes))o.attributes[n]=a},"EnumType"),to=class to extends R{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof me?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return la.vg.isEnum(Object.keys(this.attributes))}toJSON(){let e=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return T({...R.prototype.toJSON.call(this),base:this.base?e||this.base.toJSON():void 0,attributes:v(this.ownAttributes)})}};s(to,"EnumTypeClass");var Er=to;me.prototype=Er.prototype;Object.assign(me,Er);function Rp(i,...e){let t=e.length>=2?e[0]:void 0,r=e.length>=2?e[1]:e[0],o={},n=i;if(Array.isArray(i)){if(t){if(!Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be array');n=[...t,...i]}o={},i.forEach(p=>{var l;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];o[p]=T({description:c})})}else{if(t){if(Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be enum object');n={...t,...i}}Object.keys(i).forEach(p=>{var l;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];o[i[p]]=T({alias:p,description:c})})}let a={kind:m.EnumType.Kind,attributes:o,base:r.base,name:r.name,description:r==null?void 0:r.description};return Object.defineProperty(i,_,{value:a,enumerable:!1,configurable:!0,writable:!0}),n}s(Rp,"EnumTypeFactory");me.prototype=Er.prototype;me[b]=Rp;var su=require("reflect-metadata"),fa=require("ts-gems");function Gr(i,e){let t=i==null?void 0:i.map(o=>String(o).toLowerCase()),r=e==null?void 0:e.map(o=>String(o).toLowerCase());return o=>r&&r.includes(o.toLowerCase())?!1:t?t.includes(o.toLowerCase()):!0}s(Gr,"getIsInheritedPredicateFn");var Le=s(function(...i){var n;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=i;M.call(this,e,t,r);let o=(0,fa.asMutable)(this);if(o.kind=m.MappedType.Kind,t.base){if(!(t.base instanceof M))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);o.base=t.base,o.ctor=t.ctor||o.base.ctor,t.pick?o.pick=t.pick.map(l=>o.base.normalizeFieldPath(l)):t.omit?o.omit=t.omit.map(l=>o.base.normalizeFieldPath(l)):t.partial?o.partial=Array.isArray(t.partial)?t.partial.map(l=>o.base.normalizeFieldPath(l)):t.partial:t.required&&(o.required=Array.isArray(t.required)?t.required.map(l=>o.base.normalizeFieldPath(l)):t.required);let a=Gr(o.pick,o.omit),p=Array.isArray(o.partial)?o.partial.map(l=>l.toLowerCase()):o.partial,c=Array.isArray(o.required)?o.required.map(l=>l.toLowerCase()):o.required;for(let[l,O]of o.base.fields.entries()){if(!a(l))continue;let d={...O};p===!0||Array.isArray(p)&&p.includes(O.name.toLowerCase())?d.required=!1:(c===!0||Array.isArray(c)&&c.includes(O.name.toLowerCase()))&&(d.required=!0);let W=new j(this,d);o.fields.set(W.name,W)}(!o.pick||o.base.additionalFields===!1||Array.isArray(o.base.additionalFields)&&((n=o.base.additionalFields)==null?void 0:n[0])==="error")&&(o.additionalFields=o.base.additionalFields),t.base.keyField&&a(t.base.keyField)&&(o.keyField=t.base.keyField)}},"MappedType"),io=class io extends M{extendsFrom(e){var t;return e instanceof R||(e=this.node.getDataType(e)),e instanceof M?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(){let e=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return T({...M.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(io,"MappedTypeClass");var ro=io;Le.prototype=ro.prototype;Le._applyMixin=()=>{};var hu=require("reflect-metadata"),ua=require("ts-gems");var Qe=s(function(...i){if(!this)return Qe[b].apply(void 0,i);let[e,t,r]=i;M.call(this,e,t,r);let o=(0,ua.asMutable)(this);o.kind=m.MixinType.Kind,o.types=[];for(let n of t.types){o.additionalFields!==!0&&(n.additionalFields===!0?o.additionalFields=!0:o.additionalFields||(o.additionalFields=n.additionalFields));for(let a of n.fields.values()){let p=new j(this,a);o.fields.set(p.name,p)}o.types.push(n),n.keyField&&(o.keyField=n.keyField)}},"MixinType"),no=class no extends M{extendsFrom(e){if(e instanceof R||(e=this.node.getDataType(e)),!(e instanceof M))return!1;if(e===this)return!0;for(let t of this.types)if(t.extendsFrom(e))return!0;return!1}toJSON(){return T({...M.prototype.toJSON.call(this),kind:this.kind,types:this.types.map(e=>{let t=this.node.getDataTypeNameWithNs(e);return t||e.toJSON()})})}};s(no,"MixinTypeClass");var oo=no;Qe.prototype=oo.prototype;Qe[b]=wp;function wp(...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",o={[r]:class{constructor(){for(let a of e)dr(this,a)}}}[r],n={...t,kind:m.MixinType.Kind,types:[]};Reflect.defineMetadata(_,n,o);for(let a of e){let p=Reflect.getMetadata(_,a);if(!(p&&(p.kind===m.ComplexType.Kind||p.kind===m.MixinType.Kind||p.kind===m.MappedType.Kind)))throw new TypeError(`Class "${a.name}" is not a ${m.ComplexType.Kind}, ${m.MixinType.Kind} or ${m.MappedType.Kind}`);n.types.push(a),mr(o.prototype,a.prototype)}return o}s(wp,"MixinTypeFactory");var Su=require("reflect-metadata"),ha=require("ts-gems"),ao=require("valgen");var ma=G(require("lodash.omit"),1);function so(i){let e=[],t=s(function(r){var a;let o;if(!(i!=null&&i.embedded))if(i!=null&&i.name){if(!U.test(i.name))throw new TypeError(`"${i.name}" is not a valid type name`);o=i.name}else o=((a=r.name.match(lr))==null?void 0:a[1])||r.name,o=o.toLowerCase();let n=Reflect.getOwnMetadata(_,r)||{};n.kind=m.SimpleType.Kind,n.name=o,i&&Object.assign(n,(0,ma.default)(i,["kind","name"])),Reflect.defineMetadata(_,n,r)},"decorator");return t.Example=(r,o)=>(e.push(n=>{n.examples=n.examples||[],n.examples.push({description:o,value:r})}),t),t}s(so,"SimpleTypeDecoratorFactory");function da(i){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(_,e.constructor)||{},o=Reflect.getMetadata("design:type",e,t),n="string";o===Boolean?n="boolean":o===Number&&(n="number"),r.kind=m.SimpleType.Kind,r.attributes=r.attributes||{},r.attributes[t]={format:(i==null?void 0:i.format)||n,description:i==null?void 0:i.description,deprecated:i==null?void 0:i.deprecated},Reflect.defineMetadata(_,r,e.constructor)}}s(da,"AttributeDecoratorFactory");var u=s(function(...i){var n,a;if(!this)return u[b](...i);let[e,t,r]=i;R.call(this,e,t,r);let o=(0,ha.asMutable)(this);if(o.kind=m.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}"`);o.base=t.base}if(o.properties=t.properties,o.ownNameMappings={...t.nameMappings},o.nameMappings={...(n=o.base)==null?void 0:n.nameMappings,...t.nameMappings},o.ownAttributes=v(t.attributes||{}),o.attributes=o.base?v(o.base.attributes):{},o.ownAttributes)for(let[p,c]of Object.entries(o.ownAttributes)){if((a=o.attributes[p])!=null&&a.sealed)throw new TypeError(`Sealed attribute "${p}" can not be overwritten`);o.attributes[p]=c}o._generateDecoder=t.generateDecoder,o._generateEncoder=t.generateEncoder},"SimpleType"),co=class co 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 o={...this.properties,...r};if(e==="decode"){let a=this;for(;a;){if(a._generateDecoder)return a._generateDecoder(o,(t==null?void 0:t.documentElement)||this.owner);a=this.base}return ao.isAny}let n=this;for(;n;){if(n._generateEncoder)return n._generateEncoder(o,(t==null?void 0:t.documentElement)||this.owner);n=this.base}return ao.isAny}toJSON(){let e=T(this.ownAttributes),t;this.properties&&typeof this.properties.toJSON=="function"?t=this.properties.toJSON(this.properties,this.owner):t=this.properties?v(this.properties):{};let r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,o=T({...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&&(o.nameMappings={...this.ownNameMappings}),o}};s(co,"SimpleTypeClass");var po=co;u.prototype=po.prototype;Object.assign(u,so);u[b]=so;u.Attribute=da;var lo=Symbol("initializing"),Yr=class Yr{static async createDataType(e,t,r){e=e||new ue({maxErrors:0});let o=await this._importDataTypeArgs(e,t,r);if(o)return typeof o=="string"?t.node.getDataType(o):this._createDataType(e,t,o)}static async resolveDataType(e,t,r){if(r){let o=t.node.findDataType(r);if(o)return o}if(typeof r=="object"||typeof r=="function"){let o=await Yr.createDataType(e,t,r);if(o)return o}if(r){let o=t.node.getDataType(r);if(o)return o}return t.node.getDataType("any")}static async addDataTypes(e,t,r){let o=t.node[C];if(!o)throw new TypeError("DocumentElement should has [kDataTypeMap] property");let n=await this.createAllDataTypes(e,t,r);if(n)for(let a of n)a!=null&&a.name&&o.set(a.name,a)}static async createAllDataTypes(e,t,r){e=e||new ue({maxErrors:0});let o=await this._prepareAllInitArgs(e,t,r);if(!o)return;let n=new D;for(let c of o)n.set(c.name,c);let a=e.extend({initArgsMap:n}),p=[];for(let[c,l]of n.entries())e.enter(`[${c}]`,()=>{if(!n.has(c))return;let O=this._createDataType(a,t,l);O&&p.push(O)});return p}static async _prepareAllInitArgs(e,t,r){let o=new D,n=new D,a=e.extend({owner:t,importQueue:o,initArgsMap:n});if(!t.node[C])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 fe(c);let l=Reflect.getMetadata(_,c)||c[_];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");o.set(l.name,c)})}else{let p,c;for([c,p]of Object.entries(r))p=await fe(p),o.set(c,typeof p=="object"?{...p,name:c}:p)}for(let p of Array.from(o.keys())){if(!o.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(n.values())}static async _importDataTypeArgs(e,t,r){var O;r=await fe(r);let{importQueue:o,initArgsMap:n}=e,a=t.node.findDataType(r);if(a instanceof R)return a.name;let p,c,l;if(typeof r!="string"){let W=t.node.getDocument().types[fr].get(r);W&&(r=W)}if(typeof r=="string"){let d=r;if(r=(o==null?void 0:o.get(d))||((O=e.initArgsMap)==null?void 0:O.get(d)),!r)return e.addError(`Unknown data type (${d})`)}if(typeof r=="function"){if(p=Reflect.getMetadata(_,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[_],p)l=r,p.kind!==m.EnumType.Kind&&(p=void 0);else if(m.isDataType(r))p=r,c=p.ctor;else if(c=Object.getPrototypeOf(r).constructor,p=c&&Reflect.getMetadata(_,c),p&&p.kind===m.SimpleType.Kind){let d=await this._importDataTypeArgs(e,t,p.name);return d?typeof d=="object"&&d.kind!==m.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:m.SimpleType.Kind,name:void 0,base:d,properties:r}:void 0}}return p?e.enterAsync(p.name?`[${p.name}]`:"",async()=>{if(p.name){let W=n==null?void 0:n.get(p.name);if(W)return W[lo]?e.addError("Circular reference detected"):p.name}let d={kind:p.kind,name:p.name};d[lo]=!0;try{if(d.name)if(o!=null&&o.has(d.name))n==null||n.set(p.name,d),d._instance={name:p.name},d[C]=t.node[C];else return e.addError(`Data Type (${d.name}) must be explicitly added to type list in the document scope`);switch(d.kind){case m.ComplexType.Kind:d.ctor=c,await this._prepareComplexTypeArgs(e,t,d,p);break;case m.EnumType.Kind:d.instance=l,await this._prepareEnumTypeArgs(e,t,d,p);break;case m.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,d,p);break;case m.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,d,p);break;case m.SimpleType.Kind:d.ctor=c,await this._prepareSimpleTypeArgs(e,t,d,p);break;default:return e.addError(`Invalid data type kind ${p.kind}`)}}finally{d.name&&(o==null||o.delete(d.name)),delete d[lo]}return o&&d.name?d.name:d}):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,o){await this._prepareDataTypeArgs(e,r,o),await e.enterAsync(".base",async()=>{let n;if(o.base)n=await this._importDataTypeArgs(e,t,o.base);else if(r.ctor){let a=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(_,a)&&(n=await this._importDataTypeArgs(e,t,a))}n&&(r.base=Xe(n),r.ctor=r.ctor||n.ctor)}),o.additionalFields!=null&&(typeof o.additionalFields=="boolean"||Array.isArray(o.additionalFields)?r.additionalFields=o.additionalFields:await e.enterAsync(".additionalFields",async()=>{let n=await this._importDataTypeArgs(e,t,o.additionalFields);n&&(r.additionalFields=Xe(n))})),o.fields&&(r.fields={},await e.enterAsync(".fields",async()=>{for(let[n,a]of Object.entries(o.fields))await e.enterAsync(`[${n}]`,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[n]={...p,type:Xe(c)})})}))}static async _prepareEnumTypeArgs(e,t,r,o){await this._prepareDataTypeArgs(e,r,o),o.base&&await e.enterAsync(".base",async()=>{let n=await this._importDataTypeArgs(e,t,o.base);n&&(r.base=Xe(n))}),r.attributes=v(o.attributes)}static async _prepareSimpleTypeArgs(e,t,r,o){var n,a,p,c;await this._prepareDataTypeArgs(e,r,o),await e.enterAsync(".base",async()=>{let l;if(o.base)l=await this._importDataTypeArgs(e,t,o.base);else if(r.ctor){let O=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(_,O)&&(l=await this._importDataTypeArgs(e,t,O))}l&&(r.base=Xe(l),r.ctor=r.ctor||l.ctor)}),r.properties=o.properties,r.nameMappings=o.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),o.attributes&&(r.attributes=v(o.attributes)),typeof((n=r.properties)==null?void 0:n[E])=="function"&&(r.generateDecoder=(a=r.properties)==null?void 0:a[E].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,o){await this._prepareDataTypeArgs(e,r,o),await e.enterAsync(".base",async()=>{let n;if(o.base)n=await this._importDataTypeArgs(e,t,o.base);else if(r.ctor){let a=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(_,a)&&(n=await this._importDataTypeArgs(e,t,a))}n&&(r.base=Xe(n),r.ctor=r.ctor||n.ctor)}),o.pick?r.pick=[...o.pick]:o.omit?r.omit=[...o.omit]:o.partial?r.partial=Array.isArray(o.partial)?[...o.partial]:o.partial:o.required&&(r.required=Array.isArray(o.required)?[...o.required]:o.required)}static async _prepareMixinTypeArgs(e,t,r,o){await this._prepareDataTypeArgs(e,r,o),r.types=[],await e.enterAsync(".types",async()=>{let n=o.types,a=0;for(let p of n)await e.enterAsync(`[${a++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(Xe(c))})})}static _createDataType(e,t,r){var a;let o=t.node.findDataType(typeof r=="string"?r:r.name||"");if(o instanceof R)return o;let n=typeof r=="string"?(a=e.initArgsMap)==null?void 0:a.get(r):r;if(n){let p=n[C];switch(p||delete n._instance,o=n._instance,o!=null&&o.name&&p&&p.set(o.name,o),n==null?void 0:n.kind){case m.ComplexType.Kind:return this._createComplexType(e,t,n);case m.EnumType.Kind:return this._createEnumType(e,t,n);case m.MappedType.Kind:return this._createMappedType(e,t,n);case m.MixinType.Kind:return this._createMixinType(e,t,n);case m.SimpleType.Kind:return this._createSimpleType(e,t,n);default:break}}e.addError(`Unknown data type (${String(r)})`)}static _createComplexType(e,t,r){let o=r._instance||{};Object.setPrototypeOf(o,re.prototype);let n=v(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),r.additionalFields&&e.enter(".additionalFields",()=>{typeof r.additionalFields=="boolean"||Array.isArray(r.additionalFields)?n.additionalFields=r.additionalFields:n.additionalFields=this._createDataType(e,t,r.additionalFields)}),n.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&&(n.fields[a]={...p,name:a,type:c})})}),re.apply(o,[t,n]),o}static _createEnumType(e,t,r){let o=r._instance||{};Object.setPrototypeOf(o,me.prototype);let n=v(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),n.attributes=r.attributes,me.apply(o,[t,n]),o}static _createMappedType(e,t,r){let o=r._instance||{};Object.setPrototypeOf(o,Le.prototype);let n=v(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),Le.apply(o,[t,n]),o}static _createMixinType(e,t,r){let o=r._instance||{};Object.setPrototypeOf(o,Qe.prototype);let n=v(r);return r.types&&e.enter(".types",()=>{n.types=[];let a=0;for(let p of r.types)e.enter(`[${a++}]`,()=>{let c=this._createDataType(e,t,p);if(!(c instanceof M))throw new TypeError(`"${c==null?void 0:c.kind}" can't be set as base for a "${n.kind}"`);n.types.push(c)})}),Qe.apply(o,[t,n]),o}static _createSimpleType(e,t,r){let o=r._instance||{};Object.setPrototypeOf(o,u.prototype);let n=v(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),u.apply(o,[t,n]),o}};s(Yr,"DataTypeFactory");var L=Yr;function Xe(i){return typeof i=="object"&&i.name?i.name:i}s(Xe,"preferName");var fo=class fo extends w{constructor(e){super(e.owner),this.name="OpraApi",this.name=e.name,this.description=e.description}toJSON(){return T({transport:this.transport,name:this.name,description:this.description})}async _initialize(e,t){if(!U.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};s(fo,"ApiBase");var Ze=fo;var _a=G(require("path-browserify"),1),xa=require("ts-gems");var ya,Ta,se=Symbol.for("kMap"),_r=Symbol.for("kCtorMap"),uo=class uo{constructor(){this[ya]=new D,this[Ta]=new WeakMap}get size(){return this[se].size}forEach(e,t){this[se].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[_r].get(e);if(!t&&typeof e=="function"){let r=Reflect.getMetadata(_,e);t=r==null?void 0:r.name}if(!t&&typeof e=="object"){let r=e[_];t=r==null?void 0:r.name}return t?this[se].get(t):void 0}set(e,t){this[se].set(e,t),t.ctor?this[_r].set(t.ctor,e):t.instance&&this[_r].set(t.instance,e)}has(e){if(e instanceof R)return!!e.name&&this[se].has(e.name);let t=typeof e=="string"?e:this[_r].get(e);return t?this[se].has(t):!1}keys(){return this[se].keys()}values(){return this[se].values()}entries(){return this[se].entries()}sort(e){return this[se].sort(e),this}[(ya=se,Ta=_r,Symbol.iterator)](){return this[se][Symbol.iterator]()}};s(uo,"DataTypeMap");var ie=uo;var Ea=G(require("lodash.omit"),1),Qr=G(require("putil-merge"),1);var bp=/^(.*)(Controller)$/;function mo(i){let e=[],t=s(function(r){var c;let o=i==null?void 0:i.name;o||(o=((c=bp.exec(r.name))==null?void 0:c[1])||r.name);let n={},a=Reflect.getOwnMetadata(B,Object.getPrototypeOf(r));a&&(0,Qr.default)(n,a,{deep:!0});let p=Reflect.getOwnMetadata(B,r);p&&(0,Qr.default)(n,p,{deep:!0}),(0,Qr.default)(n,{kind:m.HttpController.Kind,name:o,path:o,...(0,Ea.default)(i,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(B,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(B,n,r)},"decorator");return t.Cookie=(r,o)=>(e.push(n=>{let a=typeof o=="string"||typeof o=="function"?{name:r,location:"cookie",type:o}:{...o,name:r,location:"cookie"};n.parameters=n.parameters||[],n.parameters.push(a)}),t),t.Header=(r,o)=>(e.push(n=>{let a=typeof o=="string"||typeof o=="function"?{name:r,location:"header",type:o}:{...o,name:r,location:"header"};n.parameters=n.parameters||[],n.parameters.push(a)}),t),t.QueryParam=(r,o)=>(e.push(n=>{let a=typeof o=="string"||typeof o=="function"?{name:r,location:"query",type:o}:{...o,name:r,location:"query"};n.parameters=n.parameters||[],n.parameters.push(a)}),t),t.PathParam=(r,o)=>(e.push(n=>{let a=typeof o=="string"||typeof o=="function"?{name:r,location:"path",type:o}:{...o,name:r,location:"path"};n.parameters=n.parameters||[],n.parameters.push(a)}),t),t.KeyParam=(r,o)=>(e.push(n=>{var p;(p=n.path)!=null&&p.includes(":"+r)||(n.path=(n.path||"")+"@:"+r);let a=typeof o=="string"||typeof o=="function"?{name:r,location:"path",type:o,keyParam:!0}:{...o,name:r,location:"path",keyParam:!0};n.parameters=n.parameters||[],n.parameters.push(a)}),t),t.UseType=(...r)=>(e.push(o=>{o.types=o.types||[],o.types.push(...r)}),t),t}s(mo,"HttpControllerDecoratorFactory");var Y=s(function(...i){var o;if(!this)return Y[b].apply(void 0,i);let[e,t]=i;if(w.call(this,e),!U.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,xa.asMutable)(this);r.kind=m.HttpController.Kind,r.types=r.node[C]=new ie,r.operations=new D,r.controllers=new D,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,(o=r._initialize)==null||o.call(r,t),r.onInit=t.onInit,r.onShutdown=t.onShutdown},"HttpController"),yo=class yo extends w{get isRoot(){return!(this.owner instanceof Y)}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(),o;for(o of this.parameters)if(!(t&&t!==o.location)&&(typeof o.name=="string"&&(o._nameLower=o._nameLower||o.name.toLowerCase(),o._nameLower===r)||o.name instanceof RegExp&&o.name.test(e)))return o;if(this.node.parent&&this.node.parent.element instanceof Y)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return _a.default.posix.join(this.owner instanceof Y?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(){let e=T({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}[At](){return`[${bt}HttpController${Nt+this.name+Ye}]`}};s(yo,"HttpControllerClass");var ho=yo;Y.prototype=ho.prototype;Object.assign(Y,mo);Y[b]=mo;Y.OnInit=function(){return(i,e)=>{let t=Reflect.getOwnMetadata(B,i.constructor)||{};t.onInit=i[e],Reflect.defineMetadata(B,i.constructor,t)}};Y.OnShutdown=function(){return(i,e)=>{let t=Reflect.getOwnMetadata(B,i.constructor)||{};t.onShutdown=i[e],Reflect.defineMetadata(B,i.constructor,t)}};var To=class To extends Ze{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="http",this.controllers=new D,this.url=e.url}findController(e){return Y.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(),transport:this.transport,url:this.url,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};s(To,"HttpApi");var He=To;var Oa=G(require("@browsery/type-is"),1),ga=require("ts-gems"),Xr=require("valgen");var ge=s(function(i,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');w.call(this,i);let t=(0,ga.asMutable)(this);if(e.contentType){let r=Array.isArray(e.contentType)?e.contentType:[e.contentType];r=r.map(o=>o.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"),_o=class _o 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,o;let e=this.type?this.node.getDataTypeNameWithNs(this.type):void 0,t=T({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(o=this.multipartFields)!=null&&o.length&&(t.multipartFields=this.multipartFields.map(n=>n.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(n=>Oa.default.is(n,["json"]))&&(r=this.node.findDataType("object").generateCodec(e)),r=r||Xr.isAny,this.isArray?Xr.vg.isArray(r):r}};s(_o,"HttpMediaTypeClass");var Eo=_o;ge.prototype=Eo.prototype;function Dt(i,e){let t=i.lastIndexOf("/");if(i.startsWith("/")&&t){let r=i.substring(1,t),o=i.substring(t+1);if(e!=null&&e.includeFlags)for(let n of e==null?void 0:e.includeFlags)o.includes(n)||(o+=n);if(e!=null&&e.excludeFlags)for(let n of e==null?void 0:e.excludeFlags)o.replace(n,"");return new RegExp(r,o)}throw new TypeError(`"${i}" is not a valid RegExp string`)}s(Dt,"parseRegExp");var xo=class xo extends ge{constructor(e,t){super(e,t),this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?Dt(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(){return T({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON()})}};s(xo,"HttpMultipartField");var xr=xo;var wa=G(require("path-browserify"),1),Aa=require("ts-gems");var Ra=G(require("lodash.omit"),1);var Oo;(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"})(Oo||(Oo={}));var S;(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"})(S||(S={}));var Np={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 $(i,e){let t=s((r,o)=>{if(typeof o!="string")throw new TypeError("Symbol properties can not be decorated");let n={kind:m.HttpOperation.Kind,...(0,Ra.default)(e,["kind"])},a=Reflect.getOwnMetadata(B,r.constructor)||{};a.operations=a.operations||{},a.operations[o]=n;for(let p of i)p(n);Reflect.defineMetadata(B,a,r.constructor)},"decorator");return t.Cookie=(r,o)=>(i.push(n=>{let a=typeof o=="string"||typeof o=="function"?{name:r,location:"cookie",type:o}:{...o,name:r,location:"cookie"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="cookie"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(a)}),t),t.Header=(r,o)=>(i.push(n=>{let a=typeof o=="string"||typeof o=="function"?{name:r,location:"header",type:o}:{...o,name:r,location:"header"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="header"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(a)}),t),t.QueryParam=(r,o)=>(i.push(n=>{let a=typeof o=="string"||typeof o=="function"?{name:r,location:"query",type:o}:{...o,name:r,location:"query"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="query"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(a)}),t),t.PathParam=(r,o)=>(i.push(n=>{let a=typeof o=="string"||typeof o=="function"?{name:r,location:"path",type:o}:{...o,name:r,location:"path"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="path"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(a)}),t),t.Response=(r,o)=>{let n={...o,statusCode:r};return n.type&&(n.contentType=n.contentType||P.opra_response_json,n.contentEncoding=n.contentEncoding||"utf-8"),n.contentType===P.opra_response_json&&(n.contentEncoding=n.contentEncoding||"utf-8"),i.push(a=>{a.responses=a.responses||[],a.responses.push(n)}),t},t.RequestContent=function(r){let o=typeof r=="object"?r:{type:r};return o.type&&(o.contentType=o.contentType||P.json,o.contentEncoding=o.contentEncoding||"utf-8"),i.push(n=>{n.requestBody=n.requestBody||{required:!0,content:[]},n.requestBody.content=n.requestBody.content||[],n.requestBody.content.push(o)}),t},t.MultipartContent=function(r,o){let n={...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(n)}),o){let a={Field(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"field",...c}),a},File(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"file",...c}),a}};o(a)}return t},t.UseType=(...r)=>(i.push(o=>{o.types=o.types||[],o.types.push(...r)}),t),t}s($,"HttpOperationDecoratorFactory");var I=s(function(...i){if(!this){let[o]=i,n=[];return I[b].call(void 0,n,o)}let[e,t]=i;if(w.call(this,e),!U.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[C]=new ie,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?v(t.compositionOptions):void 0},"HttpOperation"),Ro=class Ro extends w{findParameter(e,t){let r=e.toLowerCase(),o;for(o of this.parameters)if(!(t&&t!==o.location)&&(typeof o.name=="string"&&(o._nameLower=o._nameLower||o.name.toLowerCase(),o._nameLower===r)||o.name instanceof RegExp&&o.name.test(e)))return o}getFullUrl(){let e=this.owner.getFullUrl();return e?this.path?this.mergePath?e+this.path:wa.default.posix.join(e,this.path):e:this.path||"/"}toJSON(){var t;let e=T({kind:m.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.types.size){e.types={};for(let r of this.types.values())e.types[r.name]=r.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(Ro,"HttpOperationClass");var go=Ro;I.prototype=go.prototype;I[b]=$;I.GET=function(i){return $([],{...i,method:"GET"})};I.DELETE=function(i){return $([],{...i,method:"DELETE"})};I.HEAD=function(i){return $([],{...i,method:"HEAD"})};I.OPTIONS=function(i){return $([],{...i,method:"OPTIONS"})};I.PATCH=function(i){return $([],{...i,method:"PATCH"})};I.POST=function(i){return $([],{...i,method:"POST"})};I.PUT=function(i){return $([],{...i,method:"PUT"})};I.SEARCH=function(i){return $([],{...i,method:"SEARCH"})};var Dp=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,wo=class wo{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=Dp.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(wo,"HttpStatusRange");var St=wo;var Ao=class Ao extends ge{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new St(r.start,r.end):new St(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=T({...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(Ao,"HttpOperationResponse");var Or=Ao;var Na=require("ts-gems");var ba=require("ts-gems");var et=s(function(i,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');w.call(this,i);let t=(0,ba.asMutable)(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),No=class No extends w{toJSON(){let e=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return T({type:this.type?e||this.type.toJSON():"any",description:this.description,isArray:this.isArray,examples:this.examples})}};s(No,"ValueClass");var bo=No;et.prototype=bo.prototype;var It=s(function(i,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');et.call(this,i,e);let t=(0,Na.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?Dt(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"),So=class So extends et{toJSON(){return T({...super.toJSON(),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}};s(So,"HttpParameterClass");var Do=So;It.prototype=Do.prototype;var Io=class Io extends w{constructor(e){super(e),this.content=[]}toJSON(){return T({description:this.description,required:this.required,maxContentSize:this.maxContentSize,content:this.content.length?this.content.map(e=>e.toJSON()):[],partial:this.partial})}};s(Io,"HttpRequestBody");var gr=Io;var Mo=class Mo{static async createApi(e,t){let r=new He(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{await this._createControllers(e,r,t.controllers)}),r}static async _createControllers(e,t,r){if(Array.isArray(r)){let o=0;for(let n of r){let a;await e.enterAsync(`[${o++}]`,async()=>{a=await this._resolveControllerMetadata(e,t,n)}),a&&await e.enterAsync(`[${a.metadata.name}]`,async()=>{let p=await this._createController(e,t,a.metadata,a.instance,a.ctor);p&&(t.controllers.get(p.name)&&e.addError(`Duplicate controller name (${a.name})`),t.controllers.set(p.name,p))})}return}for(let[o,n]of Object.entries(r))await e.enterAsync(`[${o}]`,async()=>{let a=await this._resolveControllerMetadata(e,t,n);if(!a)return;let p=await this._createController(e,t,{...a.metadata,name:o},a.instance,a.ctor);p&&(t.controllers.get(p.name)&&e.addError(`Duplicate controller name (${o})`),t.controllers.set(p.name,p))})}static async _resolveControllerMetadata(e,t,r){typeof r=="function"&&!We(r)&&(r=t instanceof Y?r(t.instance):r()),r=await fe(r);let o,n,a;if(typeof r=="function"){if(n=Reflect.getMetadata(B,r),!n)return e.addError(`Class "${r.name}" doesn't have a valid HttpController metadata`);o=r}else o=Object.getPrototypeOf(r).constructor,n=Reflect.getMetadata(B,o),n?a=r:(n=r,r.instance==="object"&&(a=r.instance,o=Object.getPrototypeOf(a).constructor));return n?{metadata:n,instance:a,ctor:o}:e.addError(`Class "${o.name}" is not decorated with HttpController()`)}static async _createController(e,t,r,o,n){if(!r.name)throw new TypeError("Controller name required");let a=new Y(t,{...r,instance:o,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await L.addDataTypes(e,a,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let p=0;for(let c of r.parameters)await e.enterAsync(`[${p++}]`,async()=>{let l={...c};await e.enterAsync(".type",async()=>{l.type=await L.resolveDataType(e,a,c.type)});let O=new It(a,l);a.parameters.push(O)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[p,c]of Object.entries(r.operations))await e.enterAsync(`[${p}]`,async()=>{let l=new I(a,{name:p,method:"GET"});await this._initHttpOperation(e,l,c),a.operations.set(p,l)})}),r.controllers&&await e.enterAsync(".controllers",async()=>{await this._createControllers(e,a,r.controllers)}),a}static async _initHttpOperation(e,t,r){let o={...r,name:t.name,types:void 0};return I.apply(t,[t.owner,o]),r.types&&await e.enterAsync(".types",async()=>{await L.addDataTypes(e,t,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let n=0;for(let a of r.parameters)await e.enterAsync(`[${n++}]`,async()=>{let p={...a};await e.enterAsync(".type",async()=>{p.type=await L.resolveDataType(e,t,a.type)});let c=new It(t,p);t.parameters.push(c)})}),r.responses&&await e.enterAsync(".responses",async()=>{let n=0;for(let a of r.responses)await e.enterAsync(`[${n++}]`,async()=>{let p=new Or(t,{statusCode:a.statusCode});await this._initHttpOperationResponse(e,p,a),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let n=new gr(t);await this._initHttpRequestBody(e,n,r.requestBody),t.requestBody=n}),t}static async _initHttpMediaType(e,t,r){ge.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{t.type=await L.resolveDataType(e,t,r.type)}),r.multipartFields&&await e.enterAsync(".multipartFields",async()=>{for(let o=0;o<r.multipartFields.length;o++)await e.enterAsync(`[${o}]`,async()=>{let n=r.multipartFields[o],a=new xr(t,{fieldName:n.fieldName,fieldType:n.fieldType});await this._initHttpMediaType(e,a,n),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 o=0;for(let n of r.parameters)await e.enterAsync(`[${o++}]`,async()=>{let a={...n};await e.enterAsync(".type",async()=>{a.type=await L.resolveDataType(e,t,n.type)});let p=new It(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 o=0;o<r.content.length;o++)await e.enterAsync(`[${o}]`,async()=>{let n=r.content[o],a=new ge(t,String(o));await this._initHttpMediaType(e,a,n),t.content.push(a)})})}};s(Mo,"HttpApiFactory");var Mt=Mo;var Sa=require("super-fast-md5");var Lo=class Lo extends Ze{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="rpc",this.controllers=new D,this.platform=e.platform}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;this._controllerReverseMap.set(e,null);return}return this.controllers.get(e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(){let t={...super.toJSON(),transport:this.transport,platform:this.platform,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};s(Lo,"RpcApi");var tt=Lo;var Da,vo=class vo extends w{constructor(){super(null),this[Da]=new WeakMap,this.id="",this.info={},this.references=new D,this.types=new ie,this.node[C]=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[Oe].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}}get httpApi(){if(!(this.api&&this.api instanceof He))throw new TypeError("The document do not contains HttpApi instance");return this.api}get rpcApi(){if(!(this.api&&this.api instanceof tt))throw new TypeError("The document do not contains RpcApi instance");return this.api}toJSON(){return this.export()}export(){let e=T({spec:m.SpecVersion,id:this.id,url:this.url,info:v(this.info,!0)});if(this.references.size){let t=0,r={};for(let[o,n]of this.references.entries())n[Ie]||(r[o]={id:n.id,url:n.url,info:v(n.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,Sa.md5)(JSON.stringify(e)),this[Oe]=new WeakMap}_findDataType(e,t){let r=this.types.get(e);if(r||!this.references.size)return r;if(typeof e=="string"){let n=Li.exec(e);if(n){let a=n[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(n[2],t)):void 0}e=n[2]}}t=t||new WeakMap,t.set(this,!0);let o=Array.from(this.references.keys()).reverse();for(let n of o){let a=this.references.get(n);if(r=a==null?void 0:a.types.get(e),r)return this[Oe].set(r,a!=null&&a[Ie]?"":n),r}for(let n of o){let a=this.references.get(n);if(t.set(a,!0),r=a._findDataType(e,t),r)return this[Oe].set(r,a!=null&&a[Ie]?"":n),r}}};s(vo,"ApiDocument");var ve=vo;Da=Oe;var Zr=require("tslib"),Po=require("valgen");var Lt,Rr=(Lt=class{constructor(e){e&&Object.assign(this,e)}[E](){return Po.vg.isBase64({coerce:!0})}[g](){return Po.vg.isBase64({coerce:!0})}},s(Lt,"Base64Type"),Lt);Rr=(0,Zr.__decorate)([u({description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),(0,Zr.__metadata)("design:paramtypes",[Object])],Rr);var Pe=require("tslib"),K=require("valgen");var vt,rt=(vt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=K.vg.isDate({precision:"date",coerce:!0}),r=[];return e.minValue&&((0,K.isDateString)(e.minValue),r.push(K.toString,K.vg.isGte(e.minValue))),e.maxValue&&((0,K.isDateString)(e.maxValue),r.push(K.toString,K.vg.isLte(e.maxValue))),r.length>0?K.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){let t=K.vg.isDateString({precision:"date",trim:"date",coerce:!0}),r=[];return e.minValue&&((0,K.isDateString)(e.minValue),r.push(K.vg.isGte(e.minValue))),e.maxValue&&((0,K.isDateString)(e.maxValue),r.push(K.vg.isLte(e.maxValue))),r.length>0?K.vg.pipe([t,...r],{returnIndex:0}):t}},s(vt,"DateType"),vt);(0,Pe.__decorate)([u.Attribute({description:"Minimum value"}),(0,Pe.__metadata)("design:type",String)],rt.prototype,"minValue",void 0);(0,Pe.__decorate)([u.Attribute({description:"Maximum value"}),(0,Pe.__metadata)("design:type",String)],rt.prototype,"maxValue",void 0);rt=(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])],rt);var Fe=require("tslib"),wr=require("valgen");var Pt,it=(Pt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=wr.vg.isDateString({trim:"date",coerce:!0}),r=[];return e.minValue&&r.push(wr.vg.isGte(e.minValue)),e.maxValue&&r.push(wr.vg.isLte(e.maxValue)),r.length>0?wr.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){return this[E](e)}},s(Pt,"DateStringType"),Pt);(0,Fe.__decorate)([u.Attribute({description:"Minimum value"}),(0,Fe.__metadata)("design:type",String)],it.prototype,"minValue",void 0);(0,Fe.__decorate)([u.Attribute({description:"Maximum value"}),(0,Fe.__metadata)("design:type",String)],it.prototype,"maxValue",void 0);it=(0,Fe.__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,Fe.__metadata)("design:paramtypes",[Object])],it);var ke=require("tslib"),z=require("valgen");var Ft,ot=(Ft=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=z.vg.isDate({precision:"time",coerce:!0}),r=[];return e.minValue&&((0,z.isDateString)(e.minValue),r.push(z.toString,z.vg.isGte(e.minValue))),e.maxValue&&((0,z.isDateString)(e.maxValue),r.push(z.toString,z.vg.isLte(e.maxValue))),r.length>0?z.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){let t=z.vg.isDateString({precision:"time",trim:"time",coerce:!0}),r=[];return e.minValue&&((0,z.isDateString)(e.minValue),r.push(z.vg.isGte(e.minValue))),e.maxValue&&((0,z.isDateString)(e.maxValue),r.push(z.vg.isLte(e.maxValue))),r.length>0?z.vg.pipe([t,...r],{returnIndex:0}):t}},s(Ft,"DateTimeType"),Ft);(0,ke.__decorate)([u.Attribute({description:"Minimum value"}),(0,ke.__metadata)("design:type",String)],ot.prototype,"minValue",void 0);(0,ke.__decorate)([u.Attribute({description:"Maximum value"}),(0,ke.__metadata)("design:type",String)],ot.prototype,"maxValue",void 0);ot=(0,ke.__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,ke.__metadata)("design:paramtypes",[Object])],ot);var je=require("tslib"),Ar=require("valgen");var kt,nt=(kt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=Ar.vg.isDateString({coerce:!0}),r=[];return e.minValue&&r.push(Ar.vg.isGte(e.minValue)),e.maxValue&&r.push(Ar.vg.isLte(e.maxValue)),r.length>0?Ar.vg.pipe([t,...r]):t}[g](e){return this[E](e)}},s(kt,"DateTimeStringType"),kt);(0,je.__decorate)([u.Attribute({description:"Minimum value"}),(0,je.__metadata)("design:type",String)],nt.prototype,"minValue",void 0);(0,je.__decorate)([u.Attribute({description:"Maximum value"}),(0,je.__metadata)("design:type",String)],nt.prototype,"maxValue",void 0);nt=(0,je.__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,je.__metadata)("design:paramtypes",[Object])],nt);var F=require("tslib"),Fo=require("valgen");var jt,Z=(jt=class{constructor(e){e&&Object.assign(this,e)}[E](e){return Fo.vg.isEmail({...e,coerce:!0})}[g](e){return Fo.vg.isEmail({...e,coerce:!0})}},s(jt,"EmailType"),jt);(0,F.__decorate)([u.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),(0,F.__metadata)("design:type",Boolean)],Z.prototype,"allowDisplayName",void 0);(0,F.__decorate)([u.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),(0,F.__metadata)("design:type",Boolean)],Z.prototype,"requireDisplayName",void 0);(0,F.__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,F.__metadata)("design:type",Boolean)],Z.prototype,"utf8LocalPart",void 0);(0,F.__decorate)([u.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),(0,F.__metadata)("design:type",Boolean)],Z.prototype,"ignoreMaxLength",void 0);(0,F.__decorate)([u.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),(0,F.__metadata)("design:type",Boolean)],Z.prototype,"allowIpDomain",void 0);(0,F.__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,F.__metadata)("design:type",Boolean)],Z.prototype,"domainSpecificValidation",void 0);(0,F.__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,F.__metadata)("design:type",Array)],Z.prototype,"hostBlacklist",void 0);(0,F.__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,F.__metadata)("design:type",Array)],Z.prototype,"hostWhitelist",void 0);(0,F.__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,F.__metadata)("design:type",String)],Z.prototype,"blacklistedChars",void 0);Z=(0,F.__decorate)([u({description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),(0,F.__metadata)("design:paramtypes",[Object])],Z);var Ce=require("tslib"),Ut=require("valgen");var Ct,oe=(Ct=class{constructor(e){e&&Object.assign(this,e)}[E](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),o=e.allowSigns,n=(0,Ut.validator)("decodeFieldPath",a=>r.normalizeFieldPath(a,{allowSigns:o}));return Ut.vg.pipe([Ut.toString,n])}[g](e,t){return this[E](e,t)}toJSON(e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),o=r?t.node.getDataTypeNameWithNs(r):void 0;return{dataType:o||r.toJSON(),allowSigns:e.allowSigns}}},s(Ct,"FieldPathType"),Ct);(0,Ce.__decorate)([u.Attribute({description:"Data type which field belong to"}),(0,Ce.__metadata)("design:type",Object)],oe.prototype,"dataType",void 0);(0,Ce.__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,Ce.__metadata)("design:type",String)],oe.prototype,"allowSigns",void 0);oe=(0,Ce.__decorate)([u({description:"Field path",nameMappings:{js:"string",json:"string"}}),(0,Ce.__metadata)("design:paramtypes",[Object])],oe);var qe=require("tslib"),As=require("valgen");var ko=class ko extends ye{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(ko,"OpraHttpError");var N=ko;var Co=class Co extends N{constructor(){super(...arguments),this.status=400}init(e){super.init({message:A("error:BAD_REQUEST","Bad request"),code:"BAD_REQUEST",...e})}};s(Co,"BadRequestError");var jo=Co;var qo=class qo extends N{constructor(){super(...arguments),this.status=409}init(e){super.init({message:A("error:CONFLICT","Conflict"),code:"CONFLICT",...e})}};s(qo,"ConflictError");var Uo=qo;var Bo=class Bo extends N{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(Bo,"FailedDependencyError");var $o=Bo;var Vo=class Vo extends N{constructor(){super(...arguments),this.status=S.FORBIDDEN}init(e){super.init({message:A("error:FORBIDDEN","You are not authorized to perform this action"),code:"FORBIDDEN",...e})}};s(Vo,"ForbiddenError");var br=Vo;var zo=class zo extends N{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(zo,"InternalServerError");var Ko=zo;var Wo=class Wo extends N{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(Wo,"MethodNotAllowedError");var Jo=Wo;var Yo=class Yo extends N{constructor(){super(...arguments),this.status=406}init(e){super.init({message:A("error:NOT_ACCEPTABLE","Not Acceptable"),code:"NOT_ACCEPTABLE",...e})}};s(Yo,"NotAcceptableError");var Go=Yo;var Xo=class Xo extends N{constructor(){super(...arguments),this.status=404}init(e){super.init({message:A("error:NOT_FOUND","Not found"),code:"NOT_FOUND",...e})}};s(Xo,"NotFoundError");var Qo=Xo;var Ho=class Ho extends br{init(e){super.init({message:A("error:PERMISSION_ERROR","You dont have permission for this operation"),code:"PERMISSION_ERROR",...e})}};s(Ho,"PermissionError");var Zo=Ho;var tn=class tn extends N{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(tn,"ResourceConflictError");var en=tn;var on=class on extends N{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,S.UNPROCESSABLE_ENTITY)}};s(on,"ResourceNotAvailableError");var rn=on;var sn=class sn extends N{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(sn,"UnauthorizedError");var nn=sn;var pn=class pn extends N{constructor(){super(...arguments),this.status=422}init(e){super.init({message:A("error:UNPROCESSABLE_ENTITY","Unprocessable entity"),severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};s(pn,"UnprocessableEntityError");var an=pn;var cn;(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"}})(cn||(cn={}));var ln=class ln{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};s(ln,"Ast");var Nr=ln;var fn=class fn extends Nr{};s(fn,"Expression");var J=fn;var un=class un extends J{};s(un,"Term");var st=un;var mn=class mn extends st{constructor(e){super(),this.value=e}toString(){return""+this.value}};s(mn,"Literal");var q=mn;var dn=class dn extends J{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new Hr({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};s(dn,"ArithmeticExpression");var at=dn,hn=class hn{constructor(e){Object.assign(this,e)}};s(hn,"ArithmeticExpressionItem");var Hr=hn;var yn=class yn extends st{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};s(yn,"ArrayExpression");var Re=yn;var Ip=/\w/,Tn=class Tn extends J{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${Ip.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};s(Tn,"ComparisonExpression");var we=Tn;var En=class En extends J{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(En,"LogicalExpression");var Ee=En;var _n=class _n extends J{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};s(_n,"NegativeExpression");var Dr=_n;var xn=class xn extends J{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};s(xn,"ParenthesizedExpression");var Ae=xn;var On=class On extends q{constructor(e){super(e)}};s(On,"BooleanLiteral");var pt=On;var Ma=require("putil-varhelpers");var gn=class gn extends TypeError{};s(gn,"SyntaxError");var ei=gn,Rn=class Rn extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};s(Rn,"FilterValidationError");var Ue=Rn,wn=class wn extends Error{constructor(e,t){super(e),Object.assign(this,t)}};s(wn,"FilterParseError");var ti=wn;var Mp=/'/g,Lp=/(\\)/g,vp=/\\(.)/g;function Pp(i){return i.replace(Lp,"\\\\")}s(Pp,"escapeString");function Fp(i){return i.replace(vp,"$1")}s(Fp,"unescapeString");function qt(i){return"'"+Pp(i).replace(Mp,"\\'")+"'"}s(qt,"quoteFilterString");function Sr(i){return i&&(i.startsWith("'")||i.startsWith('"'))&&i.endsWith(i.charAt(0))?Fp(i.substring(1,i.length-1)):i}s(Sr,"unquoteFilterString");var Ia=new Date(0),An=class An extends q{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,Ma.toDateDef)(e,Ia)!==Ia){this.value=e;return}throw new Ue(`Invalid date value "${e}"`)}toString(){return qt(this.value)}};s(An,"DateLiteral");var be=An;var bn=class bn extends q{constructor(){super(null),this.value=null}};s(bn,"NullLiteral");var ct=bn;var Nn=class Nn extends q{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 Ue(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};s(Nn,"NumberLiteral");var Ne=Nn;var Dn=class Dn extends q{constructor(e){super(""+e)}};s(Dn,"QualifiedIdentifier");var _e=Dn;var Sn=class Sn extends q{constructor(e){super(""+e)}toString(){return qt(this.value)}};s(Sn,"StringLiteral");var lt=Sn;var kp=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,In=class In extends q{constructor(e){if(super(""),e instanceof Date){this.value=ri(e.getHours())+":"+ri(e.getMinutes())+(e.getSeconds()?":"+ri(e.getSeconds()):"")+(e.getMilliseconds()?"."+ri(e.getMilliseconds()):"");return}if(typeof e=="string"&&kp.test(e)){this.value=e;return}throw new Ue(`Invalid time value "${e}"`)}toString(){return qt(this.value)}};s(In,"TimeLiteral");var ft=In;function ri(i){return i<=9?"0"+i:""+i}s(ri,"pad");var di=require("@browsery/antlr4");var ae=require("@browsery/antlr4");var Q=class Q extends ae.Lexer{constructor(e){super(e),this._interp=new ae.LexerATNSimulator(this,Q._ATN,Q.DecisionsToDFA,new ae.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return Q.literalNames}get symbolicNames(){return Q.symbolicNames}get ruleNames(){return Q.ruleNames}get serializedATN(){return Q._serializedATN}get channelNames(){return Q.channelNames}get modeNames(){return Q.modeNames}static get _ATN(){return Q.__ATN||(Q.__ATN=new ae.ATNDeserializer().deserialize(Q._serializedATN)),Q.__ATN}};s(Q,"OpraFilterLexer");var y=Q;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 La=y;var h=require("@browsery/antlr4");var x=class x extends h.Parser{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return x.literalNames}get symbolicNames(){return x.symbolicNames}get ruleNames(){return x.ruleNames}get serializedATN(){return x._serializedATN}createFailedPredicateException(e,t){return new h.FailedPredicateException(this,e,t)}constructor(e){super(e),this._interp=new h.ParserATNSimulator(this,x._ATN,x.DecisionsToDFA,new h.PredictionContextCache)}root(){let e=new Mn(this,this._ctx,this.state);this.enterRule(e,0,x.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(x.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,o=new ne(this,this._ctx,r),n=o,a=2;this.enterRecursionRule(o,2,x.RULE_expression,e);let p;try{let c;this.enterOuterAlt(o,1);{switch(this.state=48,this._errHandler.sync(this),this._input.LA(1)){case 35:o=new Pn(this,o),this._ctx=o,n=o,this.state=38,o._left=this.comparisonLeft(),this.state=39,o._operator=this.comparisonOperator(),this.state=40,o._right=this.comparisonRight();break;case 1:o=new Ln(this,o),this._ctx=o,n=o,this.state=42,this.match(x.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(x.T__1);break;case 3:case 4:o=new vn(this,o),this._ctx=o,n=o,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(),n=o;{if(o=new Ir(this,new ne(this,t,r)),this.pushNewRecursionContext(o,a,x.RULE_expression),this.state=50,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=51,o._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)o.exception=c,this._errHandler.reportError(this,c),this._errHandler.recover(this,c);else throw c}finally{this.unrollRecursionContexts(t)}return o}comparisonLeft(){let e=new ii(this,this._ctx,this.state);this.enterRule(e,4,x.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 oi(this,this._ctx,this.state);this.enterRule(e,6,x.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 ni(this,this._ctx,this.state);this.enterRule(e,8,x.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 H(this,this._ctx,this.state);this.enterRule(e,10,x.RULE_value);try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 40:e=new Bn(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(x.NUMBER);break;case 13:case 14:e=new qn(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new $n(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new kn(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 37:e=new Un(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(x.DATE);break;case 38:e=new jn(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(x.DATETIME);break;case 39:e=new Fn(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(x.TIME);break;case 42:e=new Cn(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(x.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 Mr(this,this._ctx,this.state);this.enterRule(e,12,x.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(x.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 si(this,this._ctx,this.state);this.enterRule(e,14,x.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(x.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 $t(this,this._ctx,this.state);this.enterRule(e,16,x.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(x.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 ai(this,this._ctx,this.state);this.enterRule(e,18,x.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(x.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(x.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(x.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 pi(this,this._ctx,this.state);this.enterRule(e,20,x.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 ci(this,this._ctx,this.state);this.enterRule(e,22,x.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(x.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 li(this,this._ctx,this.state);this.enterRule(e,24,x.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 Vn(this,this._ctx,this.state);this.enterRule(e,26,x.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 fi(this,this._ctx,this.state);this.enterRule(e,28,x.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 ui(this,this._ctx,this.state);this.enterRule(e,30,x.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 Kn(this,this._ctx,this.state);this.enterRule(e,32,x.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(x.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 x.__ATN||(x.__ATN=new h.ATNDeserializer().deserialize(x._serializedATN)),x.__ATN}};s(x,"OpraFilterParser");var f=x;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 va=f,zn=class zn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(ne,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(zn,"RootContext");var Mn=zn,Jn=class Jn 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(Jn,"ExpressionContext");var ne=Jn,Wn=class Wn extends ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(ni,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(Wn,"ParenthesizedExpressionContext");var Ln=Wn,Gn=class Gn extends ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(ne,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(Gn,"NegativeExpressionContext");var vn=Gn,Yn=class Yn extends ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(ii,0)}comparisonOperator(){return this.getTypedRuleContext(fi,0)}comparisonRight(){return this.getTypedRuleContext(oi,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(Yn,"ComparisonExpressionContext");var Pn=Yn,Qn=class Qn extends ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(ne)}expression(e){return this.getTypedRuleContext(ne,e)}logicalOperator(){return this.getTypedRuleContext(ui,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(Qn,"LogicalExpressionContext");var Ir=Qn,Xn=class Xn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(Mr,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(Xn,"ComparisonLeftContext");var ii=Xn,Zn=class Zn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(H,0)}qualifiedIdentifier(){return this.getTypedRuleContext(Mr,0)}externalConstant(){return this.getTypedRuleContext(si,0)}arrayValue(){return this.getTypedRuleContext(ai,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(Zn,"ComparisonRightContext");var oi=Zn,Hn=class Hn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(ne,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(Hn,"ParenthesizedItemContext");var ni=Hn,es=class es 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(es,"ValueContext");var H=es,ts=class ts extends H{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(ts,"TimeLiteralContext");var Fn=ts,rs=class rs extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(ci,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(rs,"NullLiteralContext");var kn=rs,is=class is extends H{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(is,"DateTimeLiteralContext");var jn=is,os=class os extends H{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(os,"StringLiteralContext");var Cn=os,ns=class ns extends H{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(ns,"DateLiteralContext");var Un=ns,ss=class ss extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(li,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(ss,"InfinityLiteralContext");var qn=ss,as=class as extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(pi,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(as,"BooleanLiteralContext");var $n=as,ps=class ps extends H{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(ps,"NumberLiteralContext");var Bn=ps,cs=class cs extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts($t)}identifier(e){return this.getTypedRuleContext($t,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(cs,"QualifiedIdentifierContext");var Mr=cs,ls=class ls extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext($t,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(ls,"ExternalConstantContext");var si=ls,fs=class fs 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(fs,"IdentifierContext");var $t=fs,us=class us extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(H)}value(e){return this.getTypedRuleContext(H,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(us,"ArrayValueContext");var ai=us,ms=class ms 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(ms,"BooleanContext");var pi=ms,ds=class ds 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(ds,"NullContext");var ci=ds,hs=class hs 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(hs,"InfinityContext");var li=hs,ys=class ys 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(ys,"ArithmeticOperatorContext");var Vn=ys,Ts=class Ts 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(Ts,"ComparisonOperatorContext");var fi=Ts,Es=class Es 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(Es,"LogicalOperatorContext");var ui=Es,_s=class _s 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(_s,"PolarityOperatorContext");var Kn=_s;var Pa=require("@browsery/antlr4");var xs=class xs extends q{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};s(xs,"ExternalConstant");var mi=xs;var Os=class Os extends Pa.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 Ae(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new Dr(t)}visitComparisonExpression(e){return new we({op:e.comparisonOperator().getText(),left:this.visit(e.comparisonLeft()),right:this.visit(e.comparisonRight())})}visitLogicalExpression(e){let t=[],r=s((o,n)=>{for(let a of o){if(a instanceof Ir&&a.logicalOperator().getText()===n){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 Ee({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new _e(e.getText())}visitExternalConstant(e){return new mi(e.identifier().getText())}visitNullLiteral(){return new ct}visitBooleanLiteral(e){return new pt(e.getText()==="true")}visitNumberLiteral(e){return new Ne(e.getText())}visitStringLiteral(e){return new lt(Sr(e.getText()))}visitInfinityLiteral(){return new Ne(1/0)}visitDateLiteral(e){return new be(Sr(e.getText()))}visitDateTimeLiteral(e){return new be(Sr(e.getText()))}visitTimeLiteral(e){return new ft(Sr(e.getText()))}visitArrayValue(e){return new Re(e.value_list().map(t=>this.visit(t)))}};s(Os,"FilterTreeVisitor");var Lr=Os;var Fa=require("@browsery/antlr4");var gs=class gs extends Fa.ErrorListener{constructor(e){super(),this.errors=e}syntaxError(e,t,r,o,n,a){this.errors.push(new ti(n,{recognizer:e,offendingSymbol:t,line:r,column:o,e:a}))}};s(gs,"OpraErrorListener");var vr=gs;function Rs(i,e){let t=new di.CharStream(i),r=new La(t),o=new di.CommonTokenStream(r),n=new va(o);n.buildParseTrees=!0;let a=[],p=new vr(a);r.removeErrorListeners(),r.addErrorListener(p),n.removeErrorListeners(),n.addErrorListener(p);let c=n.root();if(a.length){let l=[];for(let d of a)l.push(d.message+(i.includes(`
8
+ `)?" at line: "+d.line+" column: "+d.column:" at column: "+d.column));let O=new ei(l.join(`
9
+ `));throw O.errors=a,O}return e=e||new Lr,e.visit(c)}s(Rs,"parse");var ws=class ws{constructor(e,t){if(this._rules=new D,Object.defineProperty(this,"_rules",{value:new D(null,{caseSensitive:t==null?void 0:t.caseSensitive}),enumerable:!1}),e)for(let[r,o]of Object.entries(e))this.set(r,o)}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,T({...t,operators:r}))}normalizeFilter(e,t){if(!e)return;let r=typeof e=="string"?Rs(e):e;if(r instanceof we){if(this.normalizeFilter(r.left,t),!(r.left instanceof _e&&r.left.field))throw new TypeError("Invalid filter query. Left side should be a data field.");let o=this._rules.get(r.left.value);if(!o)throw new ye({message:A("error:UNACCEPTED_FILTER_FIELD",{field:r.left.value}),code:"UNACCEPTED_FILTER_FIELD",details:{field:r.left.value}});if(o.operators&&!o.operators.includes(r.op))throw new ye({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 Ee?(r.items.forEach(o=>this.normalizeFilter(o,t)),r):r instanceof at?(r.items.forEach(o=>this.normalizeFilter(o.expression,t)),r):r instanceof Re?(r.items.forEach(o=>this.normalizeFilter(o,t)),r):r instanceof Ae?(this.normalizeFilter(r.expression,t),r):(r instanceof _e&&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(ws,"FilterRules");var De=ws;var Vt={};Di(Vt,{$and:()=>Cp,$arithmetic:()=>rc,$array:()=>ka,$date:()=>Up,$eq:()=>Vp,$field:()=>Bp,$gt:()=>zp,$gte:()=>Jp,$ilike:()=>Hp,$in:()=>Yp,$like:()=>Xp,$lt:()=>Wp,$lte:()=>Gp,$ne:()=>Kp,$notILike:()=>ec,$notIn:()=>Qp,$notLike:()=>Zp,$number:()=>$p,$or:()=>jp,$paren:()=>tc,$time:()=>qp,ArithmeticExpression:()=>at,ArithmeticExpressionItem:()=>Hr,ArrayExpression:()=>Re,Ast:()=>Nr,BooleanLiteral:()=>pt,ComparisonExpression:()=>we,DateLiteral:()=>be,Expression:()=>J,FilterTreeVisitor:()=>Lr,Literal:()=>q,LogicalExpression:()=>Ee,NegativeExpression:()=>Dr,NullLiteral:()=>ct,NumberLiteral:()=>Ne,OpraErrorListener:()=>vr,ParenthesizedExpression:()=>Ae,QualifiedIdentifier:()=>_e,StringLiteral:()=>lt,Term:()=>st,TimeLiteral:()=>ft,parse:()=>Rs});function jp(...i){return new Ee({op:"or",items:i})}s(jp,"$or");function Cp(...i){return new Ee({op:"and",items:i})}s(Cp,"$and");function Up(i){return new be(i)}s(Up,"$date");function qp(i){return new ft(i)}s(qp,"$time");function $p(i){return new Ne(i)}s($p,"$number");function ka(...i){return new Re(i.map(hi))}s(ka,"$array");function Bp(i){return new _e(i)}s(Bp,"$field");function Vp(i,e){return pe("=",i,e)}s(Vp,"$eq");function Kp(i,e){return pe("!=",i,e)}s(Kp,"$ne");function zp(i,e){return pe(">",i,e)}s(zp,"$gt");function Jp(i,e){return pe(">=",i,e)}s(Jp,"$gte");function Wp(i,e){return pe("<",i,e)}s(Wp,"$lt");function Gp(i,e){return pe("<=",i,e)}s(Gp,"$lte");function Yp(i,e){return pe("in",i,e)}s(Yp,"$in");function Qp(i,e){return pe("!in",i,e)}s(Qp,"$notIn");function Xp(i,e){return pe("like",i,e)}s(Xp,"$like");function Zp(i,e){return pe("!like",i,e)}s(Zp,"$notLike");function Hp(i,e){return pe("ilike",i,e)}s(Hp,"$ilike");function ec(i,e){return pe("!ilike",i,e)}s(ec,"$notILike");function tc(i){return new Ae(i)}s(tc,"$paren");function rc(i){let e=new at;return e.add=t=>(e.append("+",Bt(t)),e),e.sub=t=>(e.append("-",Bt(t)),e),e.mul=t=>(e.append("*",Bt(t)),e),e.div=t=>(e.append("/",Bt(t)),e),e.append("+",hi(i)),e}s(rc,"$arithmetic");function pe(i,e,t){let r=hi(e),o=hi(t);return new we({op:i,left:r,right:o})}s(pe,"comparisonExpression");var hi=s(i=>Array.isArray(i)?ka(...i.map(Bt)):Bt(i),"wrapEntryValue"),Bt=s(i=>i instanceof J?i:typeof i=="boolean"?new pt(i):typeof i=="number"||typeof i=="bigint"?new Ne(i):i==null?new ct:i instanceof Date?new be(i):new lt(""+i),"_wrapEntryValue");var Kt,ce=(Kt=class{constructor(e){e&&Object.assign(this,e)}[E](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),o=e.rules?new De(e.rules):void 0;return ic(r,o)}[g](){return oc}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(Kt,"FilterType"),Kt);(0,qe.__decorate)([u.Attribute({description:"Data type which filtering fields belong to"}),(0,qe.__metadata)("design:type",Object)],ce.prototype,"dataType",void 0);(0,qe.__decorate)([u.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),(0,qe.__metadata)("design:type",Object)],ce.prototype,"rules",void 0);ce=(0,qe.__decorate)([u({description:"A query filter",nameMappings:{js:"object",json:"string"}}),(0,qe.__metadata)("design:paramtypes",[Object])],ce);var ic=s((i,e)=>(0,As.validator)("decodeFilter",(t,r,o)=>{if(typeof t=="string")try{let n=Vt.parse(t);return e?e.normalizeFilter(n,i):n}catch(n){r.fail(o,`Not a valid filter expression. ${n.message}`,t);return}r.fail(o,"Nt a valid filter expression string",t)}),"decodeFilter"),oc=(0,As.validator)("encodeFilter",(i,e,t)=>{if(i instanceof Vt.Ast)return i.toString();e.fail(t,"Not a valid filter expression",i)});var yi=require("tslib"),bs=require("valgen");var zt,Pr=(zt=class{constructor(e){e&&Object.assign(this,e)}[E](){return bs.vg.isObjectId({coerce:!0})}[g](){return bs.vg.isObjectId({coerce:!0})}},s(zt,"ObjectIdType"),zt);Pr=(0,yi.__decorate)([u({description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),(0,yi.__metadata)("design:paramtypes",[Object])],Pr);var k=require("tslib");var Jt,ee=(Jt=class{constructor(e){e&&Object.assign(this,e)}},s(Jt,"OperationResult"),Jt);(0,k.__decorate)([j(),(0,k.__metadata)("design:type",Number)],ee.prototype,"affected",void 0);(0,k.__decorate)([j(),(0,k.__metadata)("design:type",Number)],ee.prototype,"totalMatches",void 0);(0,k.__decorate)([j(),(0,k.__metadata)("design:type",String)],ee.prototype,"context",void 0);(0,k.__decorate)([j(),(0,k.__metadata)("design:type",String)],ee.prototype,"type",void 0);(0,k.__decorate)([j(),(0,k.__metadata)("design:type",String)],ee.prototype,"message",void 0);(0,k.__decorate)([j({type:"any"}),(0,k.__metadata)("design:type",Object)],ee.prototype,"payload",void 0);(0,k.__decorate)([j({type:"object"}),(0,k.__metadata)("design:type",Array)],ee.prototype,"errors",void 0);ee=(0,k.__decorate)([re({description:"Operation result"}),(0,k.__metadata)("design:paramtypes",[Object])],ee);(function(i){function e(t){var o;let r=(o=class extends i{constructor(...a){super(...a)}},s(o,"OperationResult_"),o);return(0,k.__decorate)([j({type:t,required:!0}),(0,k.__metadata)("design:type",Object)],r.prototype,"payload",void 0),r=(0,k.__decorate)([re({embedded:!0}),(0,k.__metadata)("design:paramtypes",[Object])],r),r}s(e,"forPayload"),i.forPayload=e})(ee||(ee={}));var $e=require("tslib"),Fr=require("valgen");var nc=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,Wt,ut=(Wt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=Fr.vg.matches(nc,{formatName:"time",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[E](e)}},s(Wt,"TimeType"),Wt);(0,$e.__decorate)([u.Attribute({description:"Minimum value"}),(0,$e.__metadata)("design:type",String)],ut.prototype,"minValue",void 0);(0,$e.__decorate)([u.Attribute({description:"Maximum value"}),(0,$e.__metadata)("design:type",String)],ut.prototype,"maxValue",void 0);ut=(0,$e.__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,$e.__metadata)("design:paramtypes",[Object])],ut);var Ti=require("tslib"),Ns=require("valgen");var Gt,kr=(Gt=class{constructor(e){e&&Object.assign(this,e)}[E](){return Ns.vg.isURL({coerce:!0})}[g](){return Ns.vg.isURL({coerce:!0})}},s(Gt,"UrlType"),Gt);kr=(0,Ti.__decorate)([u({description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),(0,Ti.__metadata)("design:paramtypes",[Object])],kr);var Xt=require("tslib"),Ds=require("valgen");var Yt,Qt=(Yt=class{constructor(e){e&&Object.assign(this,e)}[E](e){return Ds.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}[g](e){return Ds.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}},s(Yt,"UuidType"),Yt);(0,Xt.__decorate)([u.Attribute({description:"Version of the UUID"}),(0,Xt.__metadata)("design:type",Number)],Qt.prototype,"version",void 0);Qt=(0,Xt.__decorate)([u({description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),(0,Xt.__metadata)("design:paramtypes",[Object])],Qt);function Be(i,e,t){let r=Gr(e.pick,e.omit),o=typeof i=="string"?i.charAt(0).toUpperCase()+i.substring(1):i.name,n=(t==null?void 0:t.name)||o+"Mapped",a={[n]:class{constructor(){typeof i=="function"&&dr(this,i,r)}}}[n];if(typeof i=="function"&&mr(a.prototype,i.prototype),typeof i=="function"){let c=Reflect.getOwnMetadata(_,i);if(!c)throw new TypeError(`Class "${i}" doesn't have datatype metadata information`);if(!(c.kind===m.ComplexType.Kind||c.kind===m.MappedType.Kind||c.kind===m.MixinType.Kind))throw new TypeError(`Class "${i}" is not a ${m.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(_,p,a),typeof i=="function"&&Le._applyMixin(a,i,{...e,isInheritedPredicate:r}),a}s(Be,"createMappedClass");function sc(i,e,t){return Be(i,{omit:e},t)}s(sc,"OmitType");function ac(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(ac,"PartialType");function pc(i,e,t){return Be(i,{pick:e},t)}s(pc,"PickType");var Ei=require("tslib"),Ss=require("valgen");var Zt,jr=(Zt=class{constructor(e){e&&Object.assign(this,e)}[E](){return Ss.isAny}[g](){return Ss.isAny}},s(Zt,"AnyType"),Zt);jr=(0,Ei.__decorate)([u({description:"Represents any value"}),(0,Ei.__metadata)("design:paramtypes",[Object])],jr);var _i=require("tslib"),dt=require("valgen");var Ve=require("tslib"),mt=require("valgen");var Ht,de=(Ht=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=[];return e.minValue&&t.push(mt.vg.isGte(e.minValue)),e.maxValue&&t.push(mt.vg.isLte(e.maxValue)),t.length>0?mt.vg.pipe([mt.toNumber,...t],{returnIndex:0}):mt.toNumber}[g](e){return this[E](e)}},s(Ht,"NumberType"),Ht);(0,Ve.__decorate)([u.Attribute({description:"Determines the minimum value"}),(0,Ve.__metadata)("design:type",Number)],de.prototype,"minValue",void 0);(0,Ve.__decorate)([u.Attribute({description:"Determines the maximum value"}),(0,Ve.__metadata)("design:type",Number)],de.prototype,"maxValue",void 0);de=(0,Ve.__decorate)([u({description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),(0,Ve.__metadata)("design:paramtypes",[Object])],de);var er,Cr=(er=class extends de{constructor(e){super(e)}[E](e){let t=[];return e.minValue&&t.push(dt.vg.isGte(e.minValue)),e.maxValue&&t.push(dt.vg.isLte(e.maxValue)),t.length>0?dt.vg.pipe([dt.toBigint,...t],{returnIndex:0}):dt.toBigint}[g](e){return this[E](e)}},s(er,"BigintType"),er);Cr=(0,_i.__decorate)([u({description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),(0,_i.__metadata)("design:paramtypes",[Object])],Cr);var xi=require("tslib"),Is=require("valgen");var tr,Ur=(tr=class{constructor(e){e&&Object.assign(this,e)}[E](){return Is.toBoolean}[g](){return Is.toBoolean}},s(tr,"BooleanType"),tr);Ur=(0,xi.__decorate)([u({description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),(0,xi.__metadata)("design:paramtypes",[Object])],Ur);var Oi=require("tslib"),ht=require("valgen");var rr,Ke=(rr=class extends de{constructor(e){super(e)}[E](e){let t=[];return e.minValue&&t.push(ht.vg.isGte(e.minValue)),e.maxValue&&t.push(ht.vg.isLte(e.maxValue)),t.length>0?ht.vg.pipe([ht.toInteger,...t],{returnIndex:0}):ht.toInteger}[g](e){return this[E](e)}},s(rr,"IntegerType"),rr);Ke=(0,Oi.__decorate)([u({description:"An integer number",nameMappings:{js:"number",json:"number"}}),(0,Oi.__metadata)("design:paramtypes",[Object])],Ke);var gi=require("tslib"),Ms=require("valgen");var ir,qr=(ir=class{constructor(e){e&&Object.assign(this,e)}[E](){return Ms.isNull}[g](){return Ms.isNull}},s(ir,"NullType"),ir);qr=(0,gi.__decorate)([u({description:"A Null value",nameMappings:{js:"null",json:"null"}}),(0,gi.__metadata)("design:paramtypes",[Object])],qr);var Ri=require("tslib");var or,$r=(or=class{constructor(e){e&&Object.assign(this,e)}},s(or,"ObjectType"),or);$r=(0,Ri.__decorate)([re({name:"object",description:"A non modelled object",additionalFields:!0}),(0,Ri.__metadata)("design:paramtypes",[Object])],$r);var le=require("tslib"),ze=require("valgen");var nr,Se=(nr=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(_,Object.getPrototypeOf(this).constructor).name),t.push(ze.vg.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(ze.vg.lengthMin(e.minLength)),e.maxLength&&t.push(ze.vg.lengthMax(e.maxLength)),t.length>0?ze.vg.pipe([ze.toString,...t],{returnIndex:0}):ze.toString}[g](e){return this[E](e)}},s(nr,"StringType"),nr);(0,le.__decorate)([u.Attribute({description:"Regex pattern to be used for validation"}),(0,le.__metadata)("design:type",Object)],Se.prototype,"pattern",void 0);(0,le.__decorate)([u.Attribute({description:"Name of the pattern"}),(0,le.__metadata)("design:type",String)],Se.prototype,"patternName",void 0);(0,le.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,le.__metadata)("design:type",Number)],Se.prototype,"minLength",void 0);(0,le.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,le.__metadata)("design:type",Number)],Se.prototype,"maxLength",void 0);Se=(0,le.__decorate)([u({description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),(0,le.__metadata)("design:paramtypes",[Object])],Se);function cc(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(cc,"RequiredType");I.Entity={};I.Entity.Create=function(i,e){var n;let t;typeof i=="object"&&!i[_]?t=i:t={...e,type:i};let r=[],o=$(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return o.QueryParam("projection",{description:"Determines fields projection",type:new oe({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(S.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(S.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=yt(t.type)}),o};I.Entity.Delete=function(i,e){let t;typeof i=="object"&&!i[_]?t=i:t={...e,type:i};let r=[],o=$(r,{method:"DELETE",...t,composition:"Entity.Delete"});return o.Response(S.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:P.opra_response_json}).Response(S.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}),o.KeyParam=(n,a)=>{let p=typeof a=="string"||typeof a=="function"?{name:n,location:"path",type:a,keyParam:!0}:{...a,name:n,location:"path",keyParam:!0};return o.PathParam(n,p),r.push(c=>{var l;(l=c.path)!=null&&l.includes(":"+n)||(c.path=(c.path||"")+"@:"+n),c.mergePath=!0}),o},r.push(n=>{let a=n.compositionOptions=n.compositionOptions||{};a.type=yt(t.type)}),o};I.Entity.DeleteMany=function(i,e){let t;typeof i=="object"&&!i[_]?t=i:t={...e,type:i};let r=[],o=new De,n=new ce({dataType:t.type});n.rules={};let a=$(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return a.Response(S.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:P.opra_response_json}).Response(S.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(p=>{let c=p.compositionOptions=p.compositionOptions||{};c.type=yt(t.type)}),a.Filter=(p,c,l)=>(r.push(()=>{o.set(p,{operators:c,description:l}),n.rules=o.toJSON()}),a),a};I.Entity.FindMany=function(i,e){let t;typeof i=="object"&&!i[_]?t=i:t={...e,type:i};let r=[],o=new De,n=new ce({dataType:t.type});n.rules={};let a=$(r,{method:"GET",...t,composition:"Entity.FindMany"});return a.Response(S.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(S.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 Ke({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new Ke({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new oe({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).QueryParam("filter",{type:n,description:"Determines filter fields"}).QueryParam("sort",{description:"Determines sort fields",type:new oe({dataType:t.type,allowSigns:"first"}),isArray:!0,arraySeparator:","}),r.push(p=>{let c=p.compositionOptions=p.compositionOptions||{};c.type=yt(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(()=>{o.set(p,{operators:c,description:l}),n.rules=o.toJSON()}),a),a};I.Entity.Get=function(i,e){let t;typeof i=="object"&&!i[_]?t=i:t={...e,type:i};let r=[],o=$(r,{method:"GET",...t,composition:"Entity.Get"});return o.QueryParam("projection",{description:"Determines fields projection",type:new oe({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(S.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(S.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(S.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}),o.KeyParam=(n,a)=>{let p=typeof a=="string"||typeof a=="function"?{name:n,location:"path",type:a,keyParam:!0}:{...a,name:n,location:"path",keyParam:!0};return o.PathParam(n,p),r.push(c=>{var l;(l=c.path)!=null&&l.includes(":"+n)||(c.path=(c.path||"")+"@:"+n),c.mergePath=!0}),o},r.push(n=>{let a=n.compositionOptions=n.compositionOptions||{};a.type=yt(t.type)}),o};I.Entity.UpdateMany=function(i,e){var p;let t;typeof i=="object"&&!i[_]?t=i:t={...e,type:i};let r=[],o=new ce({dataType:t.type});o.rules={};let n=new De,a=$(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(S.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:P.opra_response_json}).Response(S.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(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.type=yt(t.type)}),a.Filter=(c,l,O)=>(r.push(()=>{n.set(c,{operators:l,description:O}),o.rules=n.toJSON()}),a),a};I.Entity.Update=function(i,e){var p;let t;typeof i=="object"&&!i[_]?t=i:t={...e,type:i};let r=[],o=new De,n=new ce({dataType:t.type});n.rules={};let a=$(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 oe({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).QueryParam("filter",{type:n,description:"Determines filter fields"}).RequestContent(((p=t.requestBody)==null?void 0:p.type)||t.type).Response(S.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(S.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(S.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 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(d=>{var W;(W=d.path)!=null&&W.includes(":"+c)||(d.path=(d.path||"")+"@:"+c),d.mergePath=!0}),a},r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.type=yt(t.type)}),a.Filter=(c,l,O)=>(r.push(()=>{o.set(c,{operators:l,description:O}),n.rules=o.toJSON()}),a),a};function yt(i){if(typeof i=="string")return i;let e=Reflect.getMetadata(_,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(yt,"getDataTypeName");var ja=require("ts-gems");var xe=s(function(...i){var o;if(!this)return xe[b].apply(void 0,i);let[e,t]=i;if(w.call(this,e),!U.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,ja.asMutable)(this);r.kind=m.RpcController.Kind,r.types=r.node[C]=new ie,r.operations=new D,r.headers=[],r.name=t.name,r.description=t.description,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(o=r._initialize)==null||o.call(r,t),r.onInit=t.onInit,r.onShutdown=t.onShutdown},"RpcController"),vs=class vs extends w{findHeader(e,t){let r=e.toLowerCase(),o;for(o of this.headers)if(typeof o.name=="string"&&(o._nameLower=o._nameLower||o.name.toLowerCase(),o._nameLower===r)||o.name instanceof RegExp&&o.name.test(e))return o;if(this.node.parent&&this.node.parent.element instanceof xe)return this.node.parent.element.findHeader(e,t)}toString(){return`[RpcController ${this.name}]`}toJSON(){let e=T({kind:this.kind,description:this.description});if(this.operations.size){e.operations={};for(let t of this.operations.values())e.operations[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.headers.length){e.headers=[];for(let t of this.headers)e.headers.push(t.toJSON())}return e}[At](){return`[${bt}RpcController${Nt+this.name+Ye}]`}};s(vs,"RpcControllerClass");var Ls=vs;xe.prototype=Ls.prototype;Object.assign(xe,gt);xe[b]=gt;xe.OnInit=function(){return(i,e)=>{let t=Reflect.getOwnMetadata(V,i.constructor)||{};t.onInit=i[e],Reflect.defineMetadata(V,i.constructor,t)}};xe.OnShutdown=function(){return(i,e)=>{let t=Reflect.getOwnMetadata(V,i.constructor)||{};t.onShutdown=i[e],Reflect.defineMetadata(V,i.constructor,t)}};var Ca=require("ts-gems");var sr=s(function(i,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');et.call(this,i,e);let t=(0,Ca.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?Dt(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.deprecated=e.deprecated,t.required=e.required},"RpcHeader"),Fs=class Fs extends et{toJSON(){return T({...super.toJSON(),name:this.name,required:this.required,deprecated:this.deprecated})}};s(Fs,"RpcHeaderClass");var Ps=Fs;sr.prototype=Ps.prototype;var Ua=require("ts-gems");var ar=s(function(...i){if(!this){let[o,n]=i,a=[];return ar[b].call(void 0,a,o,n)}let[e,t]=i;if(w.call(this,e),!U.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,Ua.asMutable)(this);r.headers=[],r.types=r.node[C]=new ie,r.name=t.name,r.description=t.description,r.channel=t.channel,t!=null&&t.payloadType&&(r.payloadType=(t==null?void 0:t.payloadType)instanceof R?t.payloadType:r.owner.node.getDataType(t.payloadType)),t!=null&&t.keyType&&(r.keyType=(t==null?void 0:t.keyType)instanceof R?t.keyType:r.owner.node.getDataType(t.keyType))},"RpcOperation"),js=class js extends w{findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){var t;let e=T({kind:m.RpcOperation.Kind,description:this.description,channel:this.channel,payloadType:this.payloadType.name?this.payloadType.name:this.payloadType.toJSON(),keyType:this.keyType?this.keyType.name?this.keyType.name:this.keyType.toJSON():void 0,response:(t=this.response)==null?void 0:t.toJSON()});if(this.headers.length){e.headers=[];for(let r of this.headers)e.headers.push(r.toJSON())}return e}};s(js,"RpcOperationClass");var ks=js;ar.prototype=ks.prototype;ar[b]=ur;var Cs=class Cs extends w{constructor(e,t){super(e),this.headers=[],this.channel=t==null?void 0:t.channel,this.description=t==null?void 0:t.description,t!=null&&t.payloadType?this.payloadType=(t==null?void 0:t.payloadType)instanceof R?t.payloadType:this.owner.node.getDataType(t.payloadType):this.payloadType=this.owner.node.getDataType("any"),t!=null&&t.keyType&&(this.keyType=(t==null?void 0:t.keyType)instanceof R?t.keyType:this.owner.node.getDataType(t.keyType))}findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){let e=T({description:this.description,channel:this.channel,payloadType:this.payloadType.name?this.payloadType.name:this.payloadType.toJSON(),keyType:this.keyType?this.keyType.name?this.keyType.name:this.keyType.toJSON():void 0});if(this.headers.length){e.headers=[];for(let t of this.headers)e.headers.push(t.toJSON())}return e}};s(Cs,"RpcOperationResponse");var wi=Cs;var Us=class Us{static async createApi(e,t){let r=new tt(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{if(Array.isArray(t.controllers))for(let o of t.controllers){let n=await this._createController(e,r,o);n&&r.controllers.set(n.name,n)}else for(let[o,n]of Object.entries(t.controllers)){let a=await this._createController(e,r,n,o);a&&r.controllers.set(a.name,a)}}),r}static async _createController(e,t,r,o){typeof r=="function"&&!We(r)&&(r=r()),r=await fe(r);let n,a,p;if(typeof r=="function"){if(a=Reflect.getMetadata(V,r),!a)return e.addError(`Class "${r.name}" doesn't have a valid RpcController metadata`);n=r}else n=Object.getPrototypeOf(r).constructor,a=Reflect.getMetadata(V,n),a?p=r:(a=r,r.instance==="object"&&(p=r.instance,n=Object.getPrototypeOf(p).constructor));if(!a)return e.addError(`Class "${n.name}" is not decorated with RpcController()`);if(o=o||a.name,!o)throw new TypeError("Controller name required");let c=new xe(t,{...a,name:o,instance:p,ctor:n});return a.types&&await e.enterAsync(".types",async()=>{await L.addDataTypes(e,c,a.types)}),a.headers&&await e.enterAsync(".headers",async()=>{let l=0;for(let O of a.headers)await e.enterAsync(`[${l++}]`,async()=>{let d={...O};await e.enterAsync(".type",async()=>{O.type&&(d.type=c.node.findDataType(O.type)),!d.type&&typeof O.type=="object"&&(d.type=await L.createDataType(e,c,O.type)),d.type||(d.type=c.node.getDataType("any"))});let W=new sr(c,d);c.headers.push(W)})}),a.operations&&await e.enterAsync(".operations",async()=>{for(let[l,O]of Object.entries(a.operations))await e.enterAsync(`[${l}]`,async()=>{let d=new ar(c,{...O,name:l,types:void 0,payloadType:void 0,keyType:void 0});await this._initRpcOperation(e,d,O),c.operations.set(d.name,d)})}),c}static async _initRpcOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await L.addDataTypes(e,t,r.types)}),t.payloadType=await L.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await L.resolveDataType(e,t,r.keyType)),r.headers&&await e.enterAsync(".headers",async()=>{let o=0;for(let n of r.headers)await e.enterAsync(`[${o++}]`,async()=>{let a={...n};await e.enterAsync(".type",async()=>{a.type=await L.resolveDataType(e,t,n.type)});let p=new sr(t,a);t.headers.push(p)})}),r.response&&await e.enterAsync(".response",async()=>{let o=new wi(t,{...r.response,payloadType:void 0,keyType:void 0});await this._initRpcOperationResponse(e,o,r.response),t.response=o})}static async _initRpcOperationResponse(e,t,r){t.payloadType=await L.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await L.resolveDataType(e,t,r.keyType)),r.headers&&await e.enterAsync(".headers",async()=>{let o=0;for(let n of r.headers)await e.enterAsync(`[${o++}]`,async()=>{let a={...n};await e.enterAsync(".type",async()=>{a.type=await L.resolveDataType(e,t,n.type)});let p=new sr(t,a);t.headers.push(p)})})}};s(Us,"RpcApiFactory");var Ai=Us;var lc="https://oprajs.com/spec/v"+m.SpecVersion,bi=class bi{constructor(){this._allDocuments={}}static async createDocument(e,t){let r=new bi,o=t instanceof ue?t:new ue(t);try{let n=new ve;if(await r.initDocument(n,o,e),o.error.details.length)throw o.error;return n}catch(n){try{n instanceof Ge||o.addError(n)}catch{}if(!o.error.message){let a=o.error.details.length;o.error.message=`(${a}) error${a>1?"s":""} found in document schema.`,o.showErrorDetails&&(o.error.message+=o.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[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),e.references.set(a,this._allDocuments[c.id])})}),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(),this._allDocuments[e.id]||(this._allDocuments[e.id]=e)}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");
12
+ @${p.path}`:"")).join(""))}throw o.error}}async initDocument(e,t,r){let o;if(typeof r=="string"){if(o=await(await fetch(r,{method:"GET"})).json(),!o)return t.addError(`Invalid response returned from url: ${r}`);o.url=r}else o=r;let n;if(!e[Ie]){let a=e.node.findDataType("string");n=a==null?void 0:a.node.getDocument(),n||(n=await this.createBuiltinDocument(t),e.references.set("opra",n))}o.spec=o.spec||m.SpecVersion,e.url=o.url,o.info&&(e.info={...o.info}),o.references&&await t.enterAsync(".references",async()=>{let a,p;for([a,p]of Object.entries(o.references))p=await fe(p),await t.enterAsync(`[${a}]`,async()=>{if(!U.test(a))throw new TypeError(`Invalid namespace (${a})`);if(p instanceof ve){e.references.set(a,p);return}let c=new ve;n&&c.references.set("opra",n),await this.initDocument(c,t,p),e.references.set(a,this._allDocuments[c.id])})}),o.types&&await t.enterAsync(".types",async()=>{await L.addDataTypes(t,e,o.types)}),o.api&&await t.enterAsync(".api",async()=>{if(o.api&&o.api.transport==="http"){let a=await Mt.createApi(t,{...o.api,owner:e});a&&(e.api=a)}else if(o.api&&o.api.transport==="rpc"){let a=await Ai.createApi(t,{...o.api,owner:e});a&&(e.api=a)}else t.addError(`Unknown service transport (${o.api.transport})`)}),e.invalidate(),this._allDocuments[e.id]||(this._allDocuments[e.id]=e)}async createBuiltinDocument(e){let t={spec:m.SpecVersion,url:lc,info:{version:m.SpecVersion,title:"Opra built-in types",license:{url:"https://github.com/oprajs/opra/blob/main/LICENSE",name:"MIT"}},types:[jr,Cr,Ur,Ke,qr,de,$r,Se,Rr,rt,it,ot,nt,Z,oe,ce,Pr,ee,ut,kr,Qt]},r=new ve;r[Ie]=!0;let o=Object.getPrototypeOf(BigInt(0)).constructor,n=Object.getPrototypeOf(Buffer.from([])),a=r.types[fr];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(o,"bigint"),a.set(ArrayBuffer,"base64"),a.set(SharedArrayBuffer,"base64"),a.set(n,"base64"),await this.initDocument(r,e,t),r}};s(bi,"ApiDocumentFactory");var qs=bi;var $s;(function(i){i.HttpApiFactory=Mt,i.DataTypeFactory=L,i.RpcOperationDecoratorFactory=ur,i.RpcControllerDecoratorFactory=gt})($s||($s={}));var qa=require("uid");