@opra/common 1.0.0-alpha.8 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.cjs +12 -0
- package/browser/index.mjs +12 -0
- package/cjs/document/api-document.js +11 -0
- package/cjs/document/common/api-base.js +1 -1
- package/cjs/document/common/document-element.js +2 -0
- package/cjs/document/data-type/api-field.js +8 -7
- package/cjs/document/data-type/complex-type-base.js +5 -3
- package/cjs/document/data-type/extended-types/date-string.type.js +2 -2
- package/cjs/document/data-type/extended-types/date-time-string.type.js +2 -2
- package/cjs/document/data-type/extended-types/date-time.type.js +2 -2
- package/cjs/document/data-type/extended-types/date.type.js +2 -2
- package/cjs/document/data-type/extended-types/email.type.js +2 -2
- package/cjs/document/data-type/extended-types/filter.type.js +1 -1
- package/cjs/document/data-type/extended-types/time.type.js +2 -2
- package/cjs/document/data-type/extended-types/url.type.js +2 -2
- package/cjs/document/data-type/omit-type.js +7 -2
- package/cjs/document/data-type/partial-type.js +7 -2
- package/cjs/document/data-type/pick-type.js +1 -2
- package/cjs/document/data-type/primitive-types/object.type.js +0 -3
- package/cjs/document/data-type/required-type.js +1 -2
- package/cjs/document/data-type/simple-type.js +1 -6
- package/cjs/document/data-type/utils/create-mapped-class.js +1 -2
- package/cjs/document/data-type/utils/get-is-inherited-predicate-fn.js +1 -2
- package/cjs/document/decorators/api-field-decorator.js +4 -6
- package/cjs/document/decorators/complex-type.decorator.js +1 -2
- package/cjs/document/decorators/http-controller.decorator.js +2 -3
- package/cjs/document/decorators/http-operation-entity.decorator.js +68 -74
- package/cjs/document/decorators/http-operation.decorator.js +4 -2
- package/cjs/document/decorators/simple-type.decorator.js +2 -3
- package/cjs/document/factory/api-document.factory.js +17 -8
- package/cjs/document/http/http-api.js +0 -1
- package/cjs/document/http/http-controller.js +4 -2
- package/cjs/document/http/http-media-type.js +17 -2
- package/cjs/document/http/http-multipart-field.js +0 -1
- package/cjs/document/http/http-operation-response.js +0 -1
- package/cjs/document/http/http-operation.js +12 -1
- package/cjs/document/http/http-parameter.js +2 -0
- package/cjs/document/http/http-request-body.js +0 -1
- package/cjs/document/http/http-status-range.js +5 -2
- package/cjs/document/utils/parse-regexp.util.js +1 -2
- package/cjs/document/utils/string-compare.util.js +1 -2
- package/cjs/exception/opra-exception.js +1 -0
- package/cjs/filter/build.js +21 -22
- package/cjs/filter/filter-rules.js +17 -16
- package/cjs/filter/parse.js +1 -2
- package/cjs/filter/utils.js +2 -3
- package/cjs/helpers/function-utils.js +1 -2
- package/cjs/helpers/get-stack-filename.js +2 -3
- package/cjs/helpers/index.js +1 -0
- package/cjs/helpers/mixin-utils.js +2 -3
- package/cjs/helpers/object-utils.js +5 -6
- package/cjs/helpers/parse-fields-projection.js +3 -3
- package/cjs/helpers/safe-json-stringify.js +16 -0
- package/cjs/helpers/type-guards.js +10 -11
- package/cjs/i18n/string-utils.js +2 -3
- package/cjs/i18n/translate.js +1 -2
- package/cjs/schema/index.js +2 -27
- package/cjs/schema/opra-schema.js +24 -0
- package/cjs/schema/type-guards.js +7 -8
- package/esm/document/api-document.js +11 -0
- package/esm/document/common/api-base.js +1 -1
- package/esm/document/common/document-element.js +2 -0
- package/esm/document/data-type/api-field.js +8 -7
- package/esm/document/data-type/complex-type-base.js +5 -3
- package/esm/document/data-type/extended-types/date-string.type.js +2 -2
- package/esm/document/data-type/extended-types/date-time-string.type.js +2 -2
- package/esm/document/data-type/extended-types/date-time.type.js +2 -2
- package/esm/document/data-type/extended-types/date.type.js +2 -2
- package/esm/document/data-type/extended-types/email.type.js +2 -2
- package/esm/document/data-type/extended-types/filter.type.js +1 -1
- package/esm/document/data-type/extended-types/time.type.js +2 -2
- package/esm/document/data-type/extended-types/url.type.js +2 -2
- package/esm/document/data-type/omit-type.js +6 -0
- package/esm/document/data-type/partial-type.js +6 -0
- package/esm/document/data-type/primitive-types/object.type.js +0 -3
- package/esm/document/data-type/simple-type.js +1 -6
- package/esm/document/decorators/api-field-decorator.js +1 -2
- package/esm/document/decorators/http-controller.decorator.js +1 -1
- package/esm/document/decorators/http-operation-entity.decorator.js +25 -31
- package/esm/document/decorators/http-operation.decorator.js +3 -0
- package/esm/document/factory/api-document.factory.js +17 -7
- package/esm/document/http/http-api.js +0 -1
- package/esm/document/http/http-controller.js +3 -2
- package/esm/document/http/http-media-type.js +16 -2
- package/esm/document/http/http-multipart-field.js +0 -1
- package/esm/document/http/http-operation-response.js +0 -1
- package/esm/document/http/http-operation.js +12 -1
- package/esm/document/http/http-parameter.js +2 -0
- package/esm/document/http/http-request-body.js +0 -1
- package/esm/document/http/http-status-range.js +5 -2
- package/esm/exception/opra-exception.js +1 -0
- package/esm/filter/filter-rules.js +10 -9
- package/esm/helpers/index.js +1 -0
- package/esm/helpers/object-utils.js +2 -2
- package/esm/helpers/safe-json-stringify.js +13 -0
- package/esm/package.json +3 -0
- package/esm/schema/index.js +2 -27
- package/esm/schema/opra-schema.js +21 -0
- package/package.json +47 -53
- package/types/document/api-document.d.ts +2 -1
- package/types/document/common/api-base.d.ts +2 -2
- package/types/document/common/data-type-map.d.ts +1 -1
- package/types/document/common/document-element.d.ts +1 -0
- package/types/document/common/document-node.d.ts +8 -8
- package/types/document/common/value.d.ts +1 -1
- package/types/document/data-type/api-field.d.ts +11 -1
- package/types/document/data-type/complex-type-base.d.ts +6 -7
- package/types/document/data-type/complex-type.d.ts +1 -1
- package/types/document/data-type/data-type.d.ts +3 -2
- package/types/document/data-type/enum-type.d.ts +2 -2
- package/types/document/data-type/extended-types/base64.type.d.ts +1 -1
- package/types/document/data-type/extended-types/date-string.type.d.ts +1 -1
- package/types/document/data-type/extended-types/date-time-string.type.d.ts +1 -1
- package/types/document/data-type/extended-types/date-time.type.d.ts +1 -1
- package/types/document/data-type/extended-types/date.type.d.ts +1 -1
- package/types/document/data-type/extended-types/email.type.d.ts +1 -1
- package/types/document/data-type/extended-types/field-path.type.d.ts +3 -3
- package/types/document/data-type/extended-types/filter.type.d.ts +3 -3
- package/types/document/data-type/extended-types/object-id.type.d.ts +1 -1
- package/types/document/data-type/extended-types/operation-result.type.d.ts +2 -2
- package/types/document/data-type/extended-types/time.type.d.ts +1 -1
- package/types/document/data-type/extended-types/url.type.d.ts +1 -1
- package/types/document/data-type/extended-types/uuid.type.d.ts +1 -1
- package/types/document/data-type/mapped-type.d.ts +3 -3
- package/types/document/data-type/mixin-type.d.ts +1 -1
- package/types/document/data-type/omit-type.d.ts +1 -7
- package/types/document/data-type/partial-type.d.ts +1 -7
- package/types/document/data-type/pick-type.d.ts +3 -3
- package/types/document/data-type/primitive-types/any.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/bigint.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/boolean.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/integer.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/null.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/number.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/string.type.d.ts +1 -1
- package/types/document/data-type/required-type.d.ts +8 -8
- package/types/document/data-type/simple-type.d.ts +2 -2
- package/types/document/data-type/utils/create-mapped-class.d.ts +2 -2
- package/types/document/decorators/api-field-decorator.d.ts +1 -1
- package/types/document/decorators/http-controller.decorator.d.ts +3 -3
- package/types/document/decorators/http-operation-entity.decorator.d.ts +5 -4
- package/types/document/decorators/http-operation.decorator.d.ts +1 -1
- package/types/document/factory/api-document.factory.d.ts +2 -1
- package/types/document/factory/data-type.factory.d.ts +1 -1
- package/types/document/factory/http-api.factory.d.ts +1 -1
- package/types/document/http/http-api.d.ts +2 -2
- package/types/document/http/http-controller.d.ts +1 -1
- package/types/document/http/http-media-type.d.ts +3 -2
- package/types/document/http/http-multipart-field.d.ts +1 -2
- package/types/document/http/http-operation-response.d.ts +1 -1
- package/types/document/http/http-operation.d.ts +6 -5
- package/types/document/http/http-parameter.d.ts +2 -2
- package/types/document/http/http-request-body.d.ts +1 -1
- package/types/document/http/http-status-range.d.ts +2 -1
- package/types/exception/http-errors/bad-request.error.d.ts +1 -1
- package/types/exception/http-errors/conflict.error.d.ts +1 -1
- package/types/exception/http-errors/failed-dependency.error.d.ts +1 -1
- package/types/exception/http-errors/forbidden.error.d.ts +1 -1
- package/types/exception/http-errors/internal-server.error.d.ts +1 -1
- package/types/exception/http-errors/method-not-allowed.error.d.ts +1 -1
- package/types/exception/http-errors/not-acceptable.error.d.ts +1 -1
- package/types/exception/http-errors/not-found.error.d.ts +1 -1
- package/types/exception/http-errors/permission.error.d.ts +1 -1
- package/types/exception/http-errors/unauthorized.error.d.ts +1 -1
- package/types/exception/http-errors/unprocessable-entity.error.d.ts +1 -1
- package/types/exception/opra-exception.d.ts +1 -1
- package/types/exception/opra-http-error.d.ts +1 -1
- package/types/filter/antlr/OpraFilterParser.d.ts +1 -1
- package/types/filter/ast/expressions/comparison-expression.d.ts +1 -1
- package/types/filter/errors.d.ts +3 -4
- package/types/filter/filter-rules.d.ts +5 -5
- package/types/filter/opra-error-listener.d.ts +1 -2
- package/types/helpers/function-utils.d.ts +1 -1
- package/types/helpers/index.d.ts +1 -0
- package/types/helpers/mixin-utils.d.ts +1 -1
- package/types/helpers/object-utils.d.ts +1 -1
- package/types/helpers/safe-json-stringify.d.ts +1 -0
- package/types/helpers/type-guards.d.ts +1 -3
- package/types/i18n/i18n.d.ts +2 -2
- package/types/i18n/translate.d.ts +1 -1
- package/types/index.d.cts +9 -0
- package/types/schema/{document.interface.d.ts → api-document.interface.d.ts} +4 -4
- package/types/schema/data-type/complex-type.interface.d.ts +1 -1
- package/types/schema/data-type/data-type.interface.d.ts +1 -1
- package/types/schema/data-type/enum-type.interface.d.ts +1 -1
- package/types/schema/data-type/mapped-type.interface.d.ts +3 -3
- package/types/schema/data-type/mixin-type.interface.d.ts +1 -1
- package/types/schema/data-type-container.interface.d.ts +1 -1
- package/types/schema/http/http-controller.interface.d.ts +2 -2
- package/types/schema/http/http-media-type.interface.d.ts +1 -1
- package/types/schema/http/http-operation-response.interface.d.ts +2 -2
- package/types/schema/http/http-operation.interface.d.ts +8 -4
- package/types/schema/http/http-parameter.interface.d.ts +2 -2
- package/types/schema/index.d.ts +2 -62
- package/types/schema/opra-schema.d.ts +21 -0
- package/types/schema/type-guards.d.ts +1 -1
- package/browser.js +0 -13393
- /package/cjs/schema/{document.interface.js → api-document.interface.js} +0 -0
- /package/esm/schema/{document.interface.js → api-document.interface.js} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/****************************************
|
|
2
|
+
* All rights reserved Panates® 2022-2024
|
|
3
|
+
* http://www.panates.com
|
|
4
|
+
*****************************************/
|
|
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=>`
|
|
10
|
+
|
|
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");
|