@opra/common 1.17.7 → 1.19.0
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 +5 -5
- package/browser/index.mjs +5 -5
- package/cjs/document/data-type/api-field.js +11 -5
- package/cjs/document/data-type/complex-type-base.js +2 -0
- package/cjs/document/data-type/extended-types/base64.type.js +16 -3
- package/cjs/document/data-type/extended-types/date-time-tz.type.js +71 -0
- package/cjs/document/data-type/extended-types/date-time.type.js +13 -9
- package/cjs/document/data-type/extended-types/date.type.js +14 -9
- package/cjs/document/data-type/extended-types/index.js +2 -2
- package/cjs/document/data-type/extended-types/partial-date.type.js +85 -0
- package/cjs/document/data-type/simple-type.js +4 -0
- package/cjs/document/decorators/api-field-decorator.js +1 -0
- package/cjs/document/factory/api-document.factory.js +5 -25
- package/cjs/document/factory/data-type.factory.js +1 -0
- package/cjs/filter/filter-rules.js +1 -1
- package/esm/document/data-type/api-field.js +11 -5
- package/esm/document/data-type/complex-type-base.js +2 -0
- package/esm/document/data-type/extended-types/base64.type.js +17 -4
- package/esm/document/data-type/extended-types/date-time-tz.type.js +68 -0
- package/esm/document/data-type/extended-types/date-time.type.js +13 -9
- package/esm/document/data-type/extended-types/date.type.js +14 -9
- package/esm/document/data-type/extended-types/index.js +2 -2
- package/esm/document/data-type/extended-types/partial-date.type.js +82 -0
- package/esm/document/data-type/simple-type.js +4 -0
- package/esm/document/decorators/api-field-decorator.js +1 -0
- package/esm/document/factory/api-document.factory.js +4 -25
- package/esm/document/factory/data-type.factory.js +1 -0
- package/esm/filter/filter-rules.js +1 -1
- package/package.json +3 -3
- package/types/document/data-type/api-field.d.ts +8 -0
- package/types/document/data-type/data-type.d.ts +1 -1
- package/types/document/data-type/extended-types/base64.type.d.ts +2 -1
- package/types/document/data-type/extended-types/{date-string.type.d.ts → date-time-tz.type.d.ts} +2 -2
- package/types/document/data-type/extended-types/date-time.type.d.ts +1 -0
- package/types/document/data-type/extended-types/date.type.d.ts +1 -0
- package/types/document/data-type/extended-types/index.d.ts +2 -2
- package/types/document/data-type/extended-types/{date-time-string.type.d.ts → partial-date.type.d.ts} +2 -2
- package/types/document/data-type/simple-type.d.ts +3 -1
- package/types/document/factory/data-type.factory.d.ts +1 -0
- package/cjs/document/data-type/extended-types/date-string.type.js +0 -52
- package/cjs/document/data-type/extended-types/date-time-string.type.js +0 -55
- package/esm/document/data-type/extended-types/date-string.type.js +0 -49
- package/esm/document/data-type/extended-types/date-time-string.type.js +0 -52
package/browser/index.cjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* http://www.panates.com
|
|
4
4
|
*****************************************/
|
|
5
5
|
|
|
6
|
-
"use strict";var
|
|
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})}};a(Pi,"OpraException");var ye=Pi;var Li=class Li extends ye{constructor(e,t,r){super(e,t instanceof Error?t:void 0),this.status=(typeof t=="number"?t:Number(r))||500}setStatus(e){return this.status=e,this}initError(e){typeof e.status=="number"?this.status=e.status:typeof e.getStatus=="function"&&(this.status=e.getStatus()),super.initError(e)}};a(Li,"OpraHttpError");var S=Li;var ji=class ji extends S{constructor(){super(...arguments),this.status=400}init(e){super.init({message:"Bad request",code:"BAD_REQUEST",...e})}};a(ji,"BadRequestError");var ki=ji;var Ui=class Ui extends S{constructor(){super(...arguments),this.status=409}init(e){super.init({message:"Conflict",code:"CONFLICT",...e})}};a(Ui,"ConflictError");var Ci=Ui;var qi=class qi extends S{constructor(){super(...arguments),this.status=424}init(e){super.init({message:"The request failed due to failure of a previous request",code:"FAILED_DEPENDENCY",...e})}};a(qi,"FailedDependencyError");var $i=qi;var Bi;(function(o){o.X_Opra_Version="X-Opra-Version",o.X_Total_Count="X-Total-Count",o.WWW_Authenticate="WWW-Authenticate",o.Authorization="Authorization",o.Proxy_Authenticate="Proxy-Authenticate",o.Proxy_Authorization="Proxy-Authorization",o.Age="Age",o.Cache_Control="Cache-Control",o.Clear_Site_Data="Clear-Site-Data",o.Expires="Expires",o.Pragma="Pragma",o.Last_Modified="Last-Modified",o.ETag="ETag",o.If_Match="If-Match",o.If_None_Match="If-None-Match",o.If_Modified_Since="If-Modified-Since",o.If_Unmodified_Since="If-Unmodified-Since",o.Vary="Vary",o.Connection="Connection",o.Keep_Alive="Keep-Alive",o.Accept="Accept",o.Accept_Encoding="Accept-Encoding",o.Accept_Language="Accept-Language",o.Expect="Expect",o.Cookie="Cookie",o.Set_Cookie="Set-Cookie",o.Access_Control_Allow_Origin="Access-Control-Allow-Origin",o.Access_Control_Allow_Credentials="Access-Control-Allow-Credentials",o.Access_Control_Allow_Headers="Access-Control-Allow-Headers",o.Access_Control_Allow_Methods="Access-Control-Allow-Methods",o.Access_Control_Expose_Headers="Access-Control-Expose-Headers",o.Access_Control_Max_Age="Access-Control-Max-Age",o.Access_Control_Request_Headers="Access-Control-Request-Headers",o.Access_Control_Request_Method="Access-Control-Request-Method",o.Origin="Origin",o.Timing_Allow_Origin="Timing-Allow-Origin",o.Content_Disposition="Content-Disposition",o.Content_ID="Content-ID",o.Content_Length="Content-Length",o.Content_Type="Content-Type",o.Content_Transfer_Encoding="Content-Transfer-Encoding",o.Content_Encoding="Content-Encoding",o.Content_Language="Content-Language",o.Content_Location="Content-Location",o.Forwarded="Forwarded",o.X_Forwarded_For="X-Forwarded-For",o.X_Forwarded_Host="X-Forwarded-Host",o.X_Forwarded_Proto="X-Forwarded-Proto",o.Via="Via",o.Location="Location",o.From="From",o.Host="Host",o.Referer="Referer",o.Referrer_Policy="Referrer-Policy",o.User_Agent="User-Agent",o.Allow="Allow",o.Server="Server",o.Accept_Ranges="Accept-Ranges",o.Range="Range",o.If_Range="If-Range",o.Content_Range="Content-Range",o.Cross_Origin_Embedder_Policy="Cross-Origin-Embedder-Policy",o.Cross_Origin_Opener_Policy="Cross-Origin-Opener-Policy",o.Cross_Origin_Resource_Policy="Cross-Origin-Resource-Policy",o.Content_Security_Policy="Content-Security-Policy",o.Content_Security_Policy_Report_Only="Content-Security-Policy-Report-Only",o.Expect_CT="Expect-CT",o.Feature_Policy="Feature-Policy",o.Strict_Transport_Security="Strict-Transport-Security",o.Upgrade="Upgrade",o.Upgrade_Insecure_Requests="Upgrade-Insecure-Requests",o.X_Content_Type_Options="X-Content-Type-Options",o.X_Download_Options="X-Download-Options",o.X_Frame_Options="X-Frame-Options",o.X_Permitted_Cross_Domain_Policies="X-Permitted-Cross-Domain-Policies",o.X_Powered_By="X-Powered-By",o.X_XSS_Protection="X-XSS-Protection",o.Transfer_Encoding="Transfer-Encoding",o.TE="TE",o.Trailer="Trailer",o.Sec_WebSocket_Key="Sec-WebSocket-Key",o.Sec_WebSocket_Extensions="Sec-WebSocket-Extensions",o.Sec_WebSocket_Accept="Sec-WebSocket-Accept",o.Sec_WebSocket_Protocol="Sec-WebSocket-Protocol",o.Sec_WebSocket_Version="Sec-WebSocket-Version",o.Date="Date",o.Retry_After="Retry-After",o.Server_Timing="Server-Timing",o.X_DNS_Prefetch_Control="X-DNS-Prefetch-Control",o.Max_Forwards="Max-Forwards"})(Bi||(Bi={}));var R;(function(o){o[o.CONTINUE=100]="CONTINUE",o[o.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",o[o.PROCESSING=102]="PROCESSING",o[o.EARLYHINTS=103]="EARLYHINTS",o[o.OK=200]="OK",o[o.CREATED=201]="CREATED",o[o.ACCEPTED=202]="ACCEPTED",o[o.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",o[o.NO_CONTENT=204]="NO_CONTENT",o[o.RESET_CONTENT=205]="RESET_CONTENT",o[o.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",o[o.AMBIGUOUS=300]="AMBIGUOUS",o[o.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",o[o.FOUND=302]="FOUND",o[o.SEE_OTHER=303]="SEE_OTHER",o[o.NOT_MODIFIED=304]="NOT_MODIFIED",o[o.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",o[o.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",o[o.BAD_REQUEST=400]="BAD_REQUEST",o[o.UNAUTHORIZED=401]="UNAUTHORIZED",o[o.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",o[o.FORBIDDEN=403]="FORBIDDEN",o[o.NOT_FOUND=404]="NOT_FOUND",o[o.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",o[o.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",o[o.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",o[o.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",o[o.CONFLICT=409]="CONFLICT",o[o.GONE=410]="GONE",o[o.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",o[o.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",o[o.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",o[o.URI_TOO_LONG=414]="URI_TOO_LONG",o[o.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",o[o.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",o[o.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",o[o.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",o[o.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",o[o.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",o[o.LOCKED=423]="LOCKED",o[o.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",o[o.TOO_EARLY=425]="TOO_EARLY",o[o.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",o[o.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",o[o.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",o[o.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",o[o.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",o[o.BAD_GATEWAY=502]="BAD_GATEWAY",o[o.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",o[o.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",o[o.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",o[o.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",o[o.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",o[o.LOOP_DETECTED=508]="LOOP_DETECTED",o[o.NOT_EXTENDED=510]="NOT_EXTENDED",o[o.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(R||(R={}));var Ip={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};var D;(function(o){o.json="application/json",o.opra_response_json="application/opra.response+json",o.xml="application/XML",o.text="text/plain",o.html="text/html",o.markdown="text/markdown",o.binary="binary/octet-stream"})(D||(D={}));var Ki=class Ki extends S{constructor(){super(...arguments),this.status=R.FORBIDDEN}init(e){super.init({message:"You are not authorized to perform this action",code:"FORBIDDEN",...e})}};a(Ki,"ForbiddenError");var yr=Ki;var zi=class zi extends S{constructor(){super(...arguments),this.status=500}init(e){super.init({message:"Internal server error",code:"INTERNAL_SERVER_ERROR",severity:"fatal",...e})}};a(zi,"InternalServerError");var Vi=zi;var Wi=class Wi extends S{constructor(){super(...arguments),this.status=405}init(e){super.init({message:"Method not allowed",code:"METHOD_NOT_ALLOWED",...e})}};a(Wi,"MethodNotAllowedError");var Ji=Wi;var Gi=class Gi extends S{constructor(){super(...arguments),this.status=406}init(e){super.init({message:"Not Acceptable",code:"NOT_ACCEPTABLE",...e})}};a(Gi,"NotAcceptableError");var Yi=Gi;var Xi=class Xi extends S{constructor(){super(...arguments),this.status=404}init(e){super.init({message:"Not found",code:"NOT_FOUND",...e})}};a(Xi,"NotFoundError");var Qi=Xi;var Hi=class Hi extends yr{init(e){super.init({message:"You dont have permission for this operation",code:"PERMISSION_ERROR",...e})}};a(Hi,"PermissionError");var Zi=Hi;var to=class to extends S{constructor(e,t,r){super({message:`There is already an other "${e}" resource with same values for field(s) [${t}]`,severity:"error",code:"RESOURCE_CONFLICT",details:{resource:e,location:t}},r),this.status=409}};a(to,"ResourceConflictError");var eo=to;var io=class io extends S{constructor(e,t,r){super({message:`Resource "${e}${t?"/"+t:""}" is not available`,severity:"error",code:"RESOURCE_NOT_AVAILABLE",details:{resource:e,key:t}},r,R.UNPROCESSABLE_ENTITY)}};a(io,"ResourceNotAvailableError");var ro=io;var no=class no extends S{constructor(){super(...arguments),this.status=401}init(e){super.init({message:"You don't have permission to perform this action",code:"UNAUTHORIZED",...e})}};a(no,"UnauthorizedError");var oo=no;var ao=class ao extends S{constructor(){super(...arguments),this.status=422}init(e){super.init({message:"Unprocessable entity",severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};a(ao,"UnprocessableEntityError");var so=ao;var po;(function(o){let e;(function(t){t.fatal="fatal",t.error="error",t.warning="warning",t.info="info"})(e=o.Enum||(o.Enum={})),o.name="IssueSeverity",o.description="Severity of the issue",o.Keys=Object.keys(o),o.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"}})(po||(po={}));BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});var na=require("@jsopen/objects"),sa=Et(require("putil-promisify"),1);async function ue(o){return o=sa.default.isPromise(o)?await o:o,typeof o=="function"?(0,na.isConstructor)(o)?o:await o():o}a(ue,"resolveThunk");var aa=/^(?:file:\/\/)?(.+)$/;function Pp(o=1){if(o>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+o+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,i)=>i;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[o]?t[o].getFileName():void 0,i=r?aa.exec(r):void 0;return i?i[1]:""}return""}a(Pp,"getStackFileName");function Lp(o=1){if(o>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+o+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,i)=>i;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[o]?t[o].getFileName():void 0,i=r?aa.exec(r):void 0;return i?i[1]:""}return""}a(Lp,"getErrorStack");function Tr(o,e,t){for(let r of Object.getOwnPropertyNames(e))r==="constructor"||r==="__proto__"||r==="toJSON"||r==="toString"||t&&!t(r)||Object.defineProperty(o,r,Object.getOwnPropertyDescriptor(e,r)||Object.create(null))}a(Tr,"mergePrototype");function Er(o,e,t=r=>!0){try{let r=new e;Object.getOwnPropertyNames(r).filter(n=>typeof r[n]<"u"&&typeof o[n]>"u").filter(n=>t(n)).forEach(n=>{o[n]=r[n]})}catch{}}a(Er,"inheritPropertyInitializers");var xr=require("@jsopen/objects");var d=Symbol.for("opra.type.metadata"),se=Symbol("opra.http-controller.metadata"),ae=Symbol("opra.rpc-controller.metadata"),T=Symbol.for("opra.type.decoder"),g=Symbol("opra.type.encoder"),N=Symbol.for("DECORATOR"),Ne=Symbol.for("BUILTIN"),co=/([a-z$_]\w+):(.+)/i,$=/^[a-z][\w_]*$/i,q=Symbol.for("kDataTypeMap"),_r=Symbol.for("kCtorMap"),Oe=Symbol.for("kTypeNSMap");function M(o,e){return(0,xr.merge)({},o,{deep:a(t=>(0,xr.isPlainObject)(t)&&!t[d],"deep"),copyDescriptors:!0,ignoreUndefined:!0,filter(t,r){let i=r[t];return!e||typeof i!="function"&&(typeof i!="object"||(0,xr.isPlainObject)(i)||Array.isArray(i))}})}a(M,"cloneObject");var lo=require("fast-tokenizer");var kp=/^([+-])?([a-z_$]\w*)$/i,jp=/[^.]\(/g,uo=class uo{};a(uo,"FieldsProjection");var Se=uo;(function(o){let t=class t{};a(t,"Item");let e=t;o.Item=e})(Se||(Se={}));function fo(o,e){let t=Array.isArray(o)?o:[o];if(!(t&&t.length))return;let r=new Se;for(let i of t)e||(i=i.toLowerCase()),mo(i,r);return r}a(fo,"parseFieldsProjection");function mo(o,e){o=o.replace(jp,r=>r.charAt(0)+"."+r.substring(1));let t=(0,lo.splitString)(o,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let i=t[r];if(i.includes(",")){let c=(0,lo.splitString)(i,{delimiters:",",brackets:!0,keepBrackets:!0});for(let l of c)mo(l,e);continue}let n=kp.exec(i);if(!n)throw new TypeError(`Invalid field path (${o})`);let s=n[2],p=e[s]=e[s]||new Se.Item;n[1]&&(p.sign=n[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new Se}}a(mo,"parse");function Cp(o){return o&&typeof o.forEach=="function"}a(Cp,"isMap");var Q=Symbol.for("kEntries"),Te=Symbol.for("kKeyMap"),Qr=Symbol.for("kWellKnownKeys"),ho=Symbol.for("kOptions"),xt=Symbol.for("kSize"),yo=class yo{constructor(e,t){Object.defineProperty(this,xt,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,Q,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,Te,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,Qr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,ho,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(i=>{r?this[Qr][i]=i:this[Qr][i.toLowerCase()]=i}),this.clear(),e&&this.setAll(e)}get size(){return this[xt]}clear(){Object.keys(this[Q]).forEach(e=>delete this[Q][e]),Object.keys(this[Te]).forEach(e=>delete this[Te][e]),this[xt]=0}forEach(e,t){for(let[r,i]of this.entries())e.call(t,i,r,this)}get(e){if(e)return this[Q][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[Q],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let i=Object.prototype.hasOwnProperty.call(this[Q],r);return this[Q][r]=t,i||this[xt]++,this[Te][r]=e,this}setAll(e){return Cp(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[Te])[Symbol.iterator]()}values(){return Object.values(this[Q])[Symbol.iterator]()}entries(){return Object.entries(this[Q])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[Q],t);return delete this[Q][t],delete this[Te][t],r||this[xt]--,r}sort(e){let t={...this[Q]},r={...this[Te]},i=Array.from(this.keys());e?i.sort(e):i.sort(),this.clear();for(let n of i)this[Q][n]=t[n],this[Te][n]=r[n];return this[xt]=i.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[Te]))e[r]=this[Q][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[ho].caseSensitive)return e;let t=this._getStoringKey(e);return this[Te][t]??this[Qr][t]??e}_getStoringKey(e){return this[ho].caseSensitive?e:e.toLowerCase()}};a(yo,"ResponsiveMap");var v=yo;function Up(o,e,t){let r=new WeakSet;return JSON.stringify(o,(i,n)=>{if(n!==null&&typeof n=="object"){if(r.has(n))return;r.add(n)}return e?e(i,n):n},t)}a(Up,"safeJsonStringify");function Xr(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}a(Xr,"isStream");function $p(o){return Xr(o)&&typeof o._read=="function"&&typeof o._readableState=="object"}a($p,"isReadable");function qp(o){return Xr(o)&&typeof o._write=="function"}a(qp,"isWritable");function Bp(o){return Xr(o)&&typeof o.getReader=="function"&&typeof o.pipeThrough=="function"&&typeof o.pipeTo=="function"}a(Bp,"isReadableStream");function Kp(o){return o!==null&&typeof o=="object"&&typeof o.size=="number"&&typeof o.arrayBuffer=="function"&&typeof o.stream=="function"}a(Kp,"isBlob");function Vp(o){return o!==null&&typeof o.constructor=="function"&&o.constructor.name==="FormData"&&typeof o.append=="function"&&typeof o.getAll=="function"}a(Vp,"isFormData");function zp(o){return o!==null&&typeof o=="object"&&typeof o.host=="string"&&typeof o.href=="string"}a(zp,"isURL");var To=class To{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};a(To,"Ast");var Or=To;var Eo=class Eo extends Or{};a(Eo,"Expression");var B=Eo;var _o=class _o extends B{};a(_o,"Term");var Qe=_o;var xo=class xo extends Qe{constructor(e){super(),this.value=e}toString(){return""+this.value}};a(xo,"Literal");var I=xo;var Oo=class Oo extends B{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new Zr({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};a(Oo,"ArithmeticExpression");var Xe=Oo,go=class go{constructor(e){Object.assign(this,e)}};a(go,"ArithmeticExpressionItem");var Zr=go;var wo=class wo extends Qe{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};a(wo,"ArrayExpression");var ge=wo;var Jp=/\w/,Ro=class Ro extends B{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${Jp.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};a(Ro,"ComparisonExpression");var Ee=Ro;var Ao=class Ao extends B{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+" ")}};a(Ao,"LogicalExpression");var _e=Ao;var bo=class bo extends B{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(bo,"NegativeExpression");var gr=bo;var Do=class Do extends B{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(Do,"ParenthesizedExpression");var we=Do;var No=class No extends I{constructor(e){super(e)}};a(No,"BooleanLiteral");var Ze=No;var ca=require("putil-varhelpers");var So=class So extends TypeError{};a(So,"SyntaxError");var Hr=So,Fo=class Fo extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};a(Fo,"FilterValidationError");var xe=Fo,vo=class vo extends Error{constructor(e,t){super(e),Object.assign(this,t)}};a(vo,"FilterParseError");var ei=vo;var Wp=/'/g,Yp=/(\\)/g,Gp=/\\(.)/g;function Qp(o){return o.replace(Yp,"\\\\")}a(Qp,"escapeString");function Xp(o){return o.replace(Gp,"$1")}a(Xp,"unescapeString");function Fe(o){return"'"+Qp(o).replace(Wp,"\\'")+"'"}a(Fe,"quoteFilterString");function wr(o){return o&&(o.startsWith("'")||o.startsWith('"'))&&o.endsWith(o.charAt(0))?Xp(o.substring(1,o.length-1)):o}a(wr,"unquoteFilterString");var pa=new Date(0),Mo=class Mo extends I{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,ca.toDateDef)(e,pa)!==pa){this.value=e;return}throw new xe(`Invalid date value "${e}"`)}toString(){return Fe(this.value)}};a(Mo,"DateLiteral");var ve=Mo;var fa=require("putil-varhelpers");var la=new Date(0),Io=class Io extends I{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,fa.toDateDef)(e,la)!==la){this.value=e;return}throw new xe(`Invalid date-time value "${e}"`)}toString(){return Fe(this.value)}};a(Io,"DateTimeLiteral");var Rr=Io;var Po=class Po extends I{constructor(){super(null),this.value=null}};a(Po,"NullLiteral");var He=Po;var Lo=class Lo extends I{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 xe(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};a(Lo,"NumberLiteral");var Re=Lo;var ko=class ko extends I{constructor(e){super(""+e)}};a(ko,"QualifiedIdentifier");var pe=ko;var jo=class jo extends I{constructor(e){super(""+e)}toString(){return Fe(this.value)}};a(jo,"StringLiteral");var et=jo;var Zp=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,Co=class Co extends I{constructor(e){if(super(""),e instanceof Date){this.value=ti(e.getHours())+":"+ti(e.getMinutes())+(e.getSeconds()?":"+ti(e.getSeconds()):"")+(e.getMilliseconds()?"."+ti(e.getMilliseconds()):"");return}if(typeof e=="string"&&Zp.test(e)){this.value=e;return}throw new xe(`Invalid time value "${e}"`)}toString(){return Fe(this.value)}};a(Co,"TimeLiteral");var tt=Co;function ti(o){return o<=9?"0"+o:""+o}a(ti,"pad");var ui=require("@browsery/antlr4");var ce=require("@browsery/antlr4");var G=class G extends ce.Lexer{constructor(e){super(e),this._interp=new ce.LexerATNSimulator(this,G._ATN,G.DecisionsToDFA,new ce.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return G.literalNames}get symbolicNames(){return G.symbolicNames}get ruleNames(){return G.ruleNames}get serializedATN(){return G._serializedATN}get channelNames(){return G.channelNames}get modeNames(){return G.modeNames}static get _ATN(){return G.__ATN||(G.__ATN=new ce.ATNDeserializer().deserialize(G._serializedATN)),G.__ATN}};a(G,"OpraFilterLexer");var y=G;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=ce.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,461,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,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,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,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,291,8,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,3,38,301,8,38,1,39,3,39,304,8,39,1,39,4,39,307,8,39,11,39,12,39,308,1,39,1,39,5,39,313,8,39,10,39,12,39,316,9,39,3,39,318,8,39,1,39,1,39,3,39,322,8,39,1,39,4,39,325,8,39,11,39,12,39,326,3,39,329,8,39,1,39,1,39,1,39,1,39,4,39,335,8,39,11,39,12,39,336,3,39,339,8,39,1,40,3,40,342,8,40,1,40,4,40,345,8,40,11,40,12,40,346,1,40,1,40,1,40,1,40,4,40,353,8,40,11,40,12,40,354,3,40,357,8,40,1,41,1,41,1,41,5,41,362,8,41,10,41,12,41,365,9,41,1,41,1,41,1,41,1,41,5,41,371,8,41,10,41,12,41,374,9,41,1,41,3,41,377,8,41,1,42,4,42,380,8,42,11,42,12,42,381,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,397,8,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,406,8,44,1,45,1,45,1,45,1,45,3,45,412,8,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,4,45,424,8,45,11,45,12,45,425,3,45,428,8,45,3,45,430,8,45,1,46,1,46,1,46,3,46,435,8,46,1,46,1,46,1,46,3,46,440,8,46,1,46,1,46,1,46,3,46,445,8,46,3,46,447,8,46,1,47,1,47,1,47,3,47,452,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,491,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,290,1,0,0,0,77,300,1,0,0,0,79,338,1,0,0,0,81,356,1,0,0,0,83,376,1,0,0,0,85,379,1,0,0,0,87,385,1,0,0,0,89,387,1,0,0,0,91,411,1,0,0,0,93,446,1,0,0,0,95,448,1,0,0,0,97,453,1,0,0,0,99,459,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,248,5,39,0,0,248,249,3,89,44,0,249,250,5,32,0,0,250,251,3,91,45,0,251,252,3,93,46,0,252,253,5,39,0,0,253,254,5,39,0,0,254,255,3,89,44,0,255,256,5,84,0,0,256,257,3,91,45,0,257,258,5,39,0,0,258,259,5,39,0,0,259,260,3,89,44,0,260,261,5,32,0,0,261,262,3,91,45,0,262,263,5,39,0,0,263,291,1,0,0,0,264,265,5,34,0,0,265,266,3,89,44,0,266,267,5,84,0,0,267,268,3,91,45,0,268,269,3,93,46,0,269,270,5,34,0,0,270,291,1,0,0,0,271,272,5,34,0,0,272,273,3,89,44,0,273,274,5,32,0,0,274,275,3,91,45,0,275,276,3,93,46,0,276,277,5,34,0,0,277,291,1,0,0,0,278,279,5,34,0,0,279,280,3,89,44,0,280,281,5,84,0,0,281,282,3,91,45,0,282,283,5,34,0,0,283,291,1,0,0,0,284,285,5,34,0,0,285,286,3,89,44,0,286,287,5,32,0,0,287,288,3,91,45,0,288,289,5,34,0,0,289,291,1,0,0,0,290,241,1,0,0,0,290,264,1,0,0,0,290,271,1,0,0,0,290,278,1,0,0,0,290,284,1,0,0,0,291,76,1,0,0,0,292,293,5,39,0,0,293,294,3,91,45,0,294,295,5,39,0,0,295,301,1,0,0,0,296,297,5,34,0,0,297,298,3,91,45,0,298,299,5,34,0,0,299,301,1,0,0,0,300,292,1,0,0,0,300,296,1,0,0,0,301,78,1,0,0,0,302,304,3,71,35,0,303,302,1,0,0,0,303,304,1,0,0,0,304,306,1,0,0,0,305,307,3,87,43,0,306,305,1,0,0,0,307,308,1,0,0,0,308,306,1,0,0,0,308,309,1,0,0,0,309,317,1,0,0,0,310,314,5,46,0,0,311,313,3,87,43,0,312,311,1,0,0,0,313,316,1,0,0,0,314,312,1,0,0,0,314,315,1,0,0,0,315,318,1,0,0,0,316,314,1,0,0,0,317,310,1,0,0,0,317,318,1,0,0,0,318,328,1,0,0,0,319,321,5,69,0,0,320,322,7,2,0,0,321,320,1,0,0,0,321,322,1,0,0,0,322,324,1,0,0,0,323,325,3,87,43,0,324,323,1,0,0,0,325,326,1,0,0,0,326,324,1,0,0,0,326,327,1,0,0,0,327,329,1,0,0,0,328,319,1,0,0,0,328,329,1,0,0,0,329,339,1,0,0,0,330,331,5,48,0,0,331,332,5,120,0,0,332,334,1,0,0,0,333,335,3,99,49,0,334,333,1,0,0,0,335,336,1,0,0,0,336,334,1,0,0,0,336,337,1,0,0,0,337,339,1,0,0,0,338,303,1,0,0,0,338,330,1,0,0,0,339,80,1,0,0,0,340,342,3,71,35,0,341,340,1,0,0,0,341,342,1,0,0,0,342,344,1,0,0,0,343,345,3,87,43,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,357,1,0,0,0,348,349,5,48,0,0,349,350,5,120,0,0,350,352,1,0,0,0,351,353,3,99,49,0,352,351,1,0,0,0,353,354,1,0,0,0,354,352,1,0,0,0,354,355,1,0,0,0,355,357,1,0,0,0,356,341,1,0,0,0,356,348,1,0,0,0,357,82,1,0,0,0,358,363,5,39,0,0,359,362,3,95,47,0,360,362,8,3,0,0,361,359,1,0,0,0,361,360,1,0,0,0,362,365,1,0,0,0,363,361,1,0,0,0,363,364,1,0,0,0,364,366,1,0,0,0,365,363,1,0,0,0,366,377,5,39,0,0,367,372,5,34,0,0,368,371,3,95,47,0,369,371,8,4,0,0,370,368,1,0,0,0,370,369,1,0,0,0,371,374,1,0,0,0,372,370,1,0,0,0,372,373,1,0,0,0,373,375,1,0,0,0,374,372,1,0,0,0,375,377,5,34,0,0,376,358,1,0,0,0,376,367,1,0,0,0,377,84,1,0,0,0,378,380,7,5,0,0,379,378,1,0,0,0,380,381,1,0,0,0,381,379,1,0,0,0,381,382,1,0,0,0,382,383,1,0,0,0,383,384,6,42,0,0,384,86,1,0,0,0,385,386,7,6,0,0,386,88,1,0,0,0,387,388,7,6,0,0,388,389,7,6,0,0,389,390,7,6,0,0,390,391,7,6,0,0,391,396,5,45,0,0,392,393,7,7,0,0,393,397,7,8,0,0,394,395,7,9,0,0,395,397,7,10,0,0,396,392,1,0,0,0,396,394,1,0,0,0,397,398,1,0,0,0,398,405,5,45,0,0,399,400,7,11,0,0,400,406,7,7,0,0,401,402,7,10,0,0,402,406,7,8,0,0,403,404,5,51,0,0,404,406,5,49,0,0,405,399,1,0,0,0,405,401,1,0,0,0,405,403,1,0,0,0,406,90,1,0,0,0,407,408,7,12,0,0,408,412,7,6,0,0,409,410,5,50,0,0,410,412,7,13,0,0,411,407,1,0,0,0,411,409,1,0,0,0,412,413,1,0,0,0,413,414,5,58,0,0,414,415,7,14,0,0,415,416,7,6,0,0,416,429,1,0,0,0,417,418,5,58,0,0,418,419,7,14,0,0,419,420,7,6,0,0,420,427,1,0,0,0,421,423,5,46,0,0,422,424,7,6,0,0,423,422,1,0,0,0,424,425,1,0,0,0,425,423,1,0,0,0,425,426,1,0,0,0,426,428,1,0,0,0,427,421,1,0,0,0,427,428,1,0,0,0,428,430,1,0,0,0,429,417,1,0,0,0,429,430,1,0,0,0,430,92,1,0,0,0,431,447,5,90,0,0,432,439,7,2,0,0,433,435,7,12,0,0,434,433,1,0,0,0,434,435,1,0,0,0,435,436,1,0,0,0,436,440,7,6,0,0,437,438,5,50,0,0,438,440,7,13,0,0,439,434,1,0,0,0,439,437,1,0,0,0,440,444,1,0,0,0,441,442,5,58,0,0,442,443,7,14,0,0,443,445,7,6,0,0,444,441,1,0,0,0,444,445,1,0,0,0,445,447,1,0,0,0,446,431,1,0,0,0,446,432,1,0,0,0,447,94,1,0,0,0,448,451,5,92,0,0,449,452,3,97,48,0,450,452,9,0,0,0,451,449,1,0,0,0,451,450,1,0,0,0,452,96,1,0,0,0,453,454,5,117,0,0,454,455,3,99,49,0,455,456,3,99,49,0,456,457,3,99,49,0,457,458,3,99,49,0,458,98,1,0,0,0,459,460,7,15,0,0,460,100,1,0,0,0,35,0,226,239,290,300,303,308,314,317,321,326,328,336,338,341,346,354,356,361,363,370,372,376,381,396,405,411,425,427,429,434,439,444,446,451,1,0,1,0];y.DecisionsToDFA=y._ATN.decisionToState.map((o,e)=>new ce.DFA(o,e));var ma=y;var h=require("@browsery/antlr4");var _=class _ extends h.Parser{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return _.literalNames}get symbolicNames(){return _.symbolicNames}get ruleNames(){return _.ruleNames}get serializedATN(){return _._serializedATN}createFailedPredicateException(e,t){return new h.FailedPredicateException(this,e,t)}constructor(e){super(e),this._interp=new h.ParserATNSimulator(this,_._ATN,_.DecisionsToDFA,new h.PredictionContextCache)}root(){let e=new Uo(this,this._ctx,this.state);this.enterRule(e,0,_.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(_.EOF)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}expression(e){e===void 0&&(e=0);let t=this._ctx,r=this.state,i=new te(this,this._ctx,r),n=i,s=2;this.enterRecursionRule(i,2,_.RULE_expression,e);let p;try{let c;this.enterOuterAlt(i,1);{switch(this.state=48,this._errHandler.sync(this),this._input.LA(1)){case 35:i=new Bo(this,i),this._ctx=i,n=i,this.state=38,i._left=this.comparisonLeft(),this.state=39,i._operator=this.comparisonOperator(),this.state=40,i._right=this.comparisonRight();break;case 1:i=new $o(this,i),this._ctx=i,n=i,this.state=42,this.match(_.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(_.T__1);break;case 3:case 4:i=new qo(this,i),this._ctx=i,n=i,this.state=46,p=this._input.LA(1),p===3||p===4?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=47,this.expression(1);break;default:throw new h.NoViableAltException(this)}for(this._ctx.stop=this._input.LT(-1),this.state=56,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx);c!==2&&c!==h.ATN.INVALID_ALT_NUMBER;){if(c===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),n=i;{if(i=new Ar(this,new te(this,t,r)),this.pushNewRecursionContext(i,s,_.RULE_expression),this.state=50,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=51,i._op=this.logicalOperator(),this.state=52,this.expression(4)}}this.state=58,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx)}}}catch(c){if(c instanceof h.RecognitionException)i.exception=c,this._errHandler.reportError(this,c),this._errHandler.recover(this,c);else throw c}finally{this.unrollRecursionContexts(t)}return i}comparisonLeft(){let e=new ri(this,this._ctx,this.state);this.enterRule(e,4,_.RULE_comparisonLeft);try{this.enterOuterAlt(e,1),this.state=59,this.qualifiedIdentifier()}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}comparisonRight(){let e=new ii(this,this._ctx,this.state);this.enterRule(e,6,_.RULE_comparisonRight);try{switch(this.state=65,this._errHandler.sync(this),this._input.LA(1)){case 10:case 11:case 12:case 13:case 14:case 37:case 38:case 39:case 40:case 42:this.enterOuterAlt(e,1),this.state=61,this.value();break;case 35:this.enterOuterAlt(e,2),this.state=62,this.qualifiedIdentifier();break;case 6:this.enterOuterAlt(e,3),this.state=63,this.externalConstant();break;case 7:this.enterOuterAlt(e,4),this.state=64,this.arrayValue();break;default:throw new h.NoViableAltException(this)}}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}parenthesizedItem(){let e=new oi(this,this._ctx,this.state);this.enterRule(e,8,_.RULE_parenthesizedItem);try{this.enterOuterAlt(e,1),this.state=67,this.expression(0)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}value(){let e=new X(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 Qo(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(_.NUMBER);break;case 13:case 14:e=new Yo(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new Go(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new Vo(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 38:e=new zo(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(_.DATETIME);break;case 37:e=new Wo(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(_.DATE);break;case 39:e=new Ko(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(_.TIME);break;case 42:e=new Jo(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(_.STRING);break;default:throw new h.NoViableAltException(this)}}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}qualifiedIdentifier(){let e=new br(this,this._ctx,this.state);this.enterRule(e,12,_.RULE_qualifiedIdentifier);try{let t;this.enterOuterAlt(e,1);{for(this.state=84,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);t!==2&&t!==h.ATN.INVALID_ALT_NUMBER;)t===1&&(this.state=79,this.identifier(),this.state=80,this.match(_.T__4)),this.state=86,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);this.state=87,this.identifier()}}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}externalConstant(){let e=new ni(this,this._ctx,this.state);this.enterRule(e,14,_.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(_.T__5),this.state=90,this.identifier()}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}identifier(){let e=new Ot(this,this._ctx,this.state);this.enterRule(e,16,_.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(_.IDENTIFIER)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}arrayValue(){let e=new si(this,this._ctx,this.state);this.enterRule(e,18,_.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(_.T__6),this.state=95,this.value(),this.state=100,this._errHandler.sync(this),t=this._input.LA(1);t===8;)this.state=96,this.match(_.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(_.T__8)}}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}boolean_(){let e=new ai(this,this._ctx,this.state);this.enterRule(e,20,_.RULE_boolean);let t;try{this.enterOuterAlt(e,1),this.state=105,t=this._input.LA(1),t===10||t===11?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}null_(){let e=new pi(this,this._ctx,this.state);this.enterRule(e,22,_.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(_.T__11)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}infinity(){let e=new ci(this,this._ctx,this.state);this.enterRule(e,24,_.RULE_infinity);let t;try{this.enterOuterAlt(e,1),this.state=109,t=this._input.LA(1),t===13||t===14?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}arithmeticOperator(){let e=new Xo(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)===0&&(1<<t&491520)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}comparisonOperator(){let e=new li(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)===0&&(1<<t&2146959360)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}logicalOperator(){let e=new fi(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)===0&&(1<<t-31&15)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}polarityOperator(){let e=new Zo(this,this._ctx,this.state);this.enterRule(e,32,_.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(_.POLAR_OP)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}sempred(e,t,r){switch(t){case 1:return this.expression_sempred(e,r)}return!0}expression_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,3)}return!0}static get _ATN(){return _.__ATN||(_.__ATN=new h.ATNDeserializer().deserialize(_._serializedATN)),_.__ATN}};a(_,"OpraFilterParser");var f=_;f.T__0=1;f.T__1=2;f.T__2=3;f.T__3=4;f.T__4=5;f.T__5=6;f.T__6=7;f.T__7=8;f.T__8=9;f.T__9=10;f.T__10=11;f.T__11=12;f.T__12=13;f.T__13=14;f.T__14=15;f.T__15=16;f.T__16=17;f.T__17=18;f.T__18=19;f.T__19=20;f.T__20=21;f.T__21=22;f.T__22=23;f.T__23=24;f.T__24=25;f.T__25=26;f.T__26=27;f.T__27=28;f.T__28=29;f.T__29=30;f.T__30=31;f.T__31=32;f.T__32=33;f.T__33=34;f.IDENTIFIER=35;f.POLAR_OP=36;f.DATE=37;f.DATETIME=38;f.TIME=39;f.NUMBER=40;f.INTEGER=41;f.STRING=42;f.WHITESPACE=43;f.EOF=h.Token.EOF;f.RULE_root=0;f.RULE_expression=1;f.RULE_comparisonLeft=2;f.RULE_comparisonRight=3;f.RULE_parenthesizedItem=4;f.RULE_value=5;f.RULE_qualifiedIdentifier=6;f.RULE_externalConstant=7;f.RULE_identifier=8;f.RULE_arrayValue=9;f.RULE_boolean=10;f.RULE_null=11;f.RULE_infinity=12;f.RULE_arithmeticOperator=13;f.RULE_comparisonOperator=14;f.RULE_logicalOperator=15;f.RULE_polarityOperator=16;f.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];f.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];f.ruleNames=["root","expression","comparisonLeft","comparisonRight","parenthesizedItem","value","qualifiedIdentifier","externalConstant","identifier","arrayValue","boolean","null","infinity","arithmeticOperator","comparisonOperator","logicalOperator","polarityOperator"];f._serializedATN=[4,1,43,120,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,49,8,1,1,1,1,1,1,1,1,1,5,1,55,8,1,10,1,12,1,58,9,1,1,2,1,2,1,3,1,3,1,3,1,3,3,3,66,8,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,78,8,5,1,6,1,6,1,6,5,6,83,8,6,10,6,12,6,86,9,6,1,6,1,6,1,7,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,5,9,99,8,9,10,9,12,9,102,9,9,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,16,0,1,2,17,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,0,6,1,0,3,4,1,0,10,11,1,0,13,14,1,0,15,18,1,0,19,30,1,0,31,34,117,0,34,1,0,0,0,2,48,1,0,0,0,4,59,1,0,0,0,6,65,1,0,0,0,8,67,1,0,0,0,10,77,1,0,0,0,12,84,1,0,0,0,14,89,1,0,0,0,16,92,1,0,0,0,18,94,1,0,0,0,20,105,1,0,0,0,22,107,1,0,0,0,24,109,1,0,0,0,26,111,1,0,0,0,28,113,1,0,0,0,30,115,1,0,0,0,32,117,1,0,0,0,34,35,3,2,1,0,35,36,5,0,0,1,36,1,1,0,0,0,37,38,6,1,-1,0,38,39,3,4,2,0,39,40,3,28,14,0,40,41,3,6,3,0,41,49,1,0,0,0,42,43,5,1,0,0,43,44,3,8,4,0,44,45,5,2,0,0,45,49,1,0,0,0,46,47,7,0,0,0,47,49,3,2,1,1,48,37,1,0,0,0,48,42,1,0,0,0,48,46,1,0,0,0,49,56,1,0,0,0,50,51,10,3,0,0,51,52,3,30,15,0,52,53,3,2,1,4,53,55,1,0,0,0,54,50,1,0,0,0,55,58,1,0,0,0,56,54,1,0,0,0,56,57,1,0,0,0,57,3,1,0,0,0,58,56,1,0,0,0,59,60,3,12,6,0,60,5,1,0,0,0,61,66,3,10,5,0,62,66,3,12,6,0,63,66,3,14,7,0,64,66,3,18,9,0,65,61,1,0,0,0,65,62,1,0,0,0,65,63,1,0,0,0,65,64,1,0,0,0,66,7,1,0,0,0,67,68,3,2,1,0,68,9,1,0,0,0,69,78,5,40,0,0,70,78,3,24,12,0,71,78,3,20,10,0,72,78,3,22,11,0,73,78,5,38,0,0,74,78,5,37,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((o,e)=>new h.DFA(o,e));var ua=f,Ho=class Ho extends h.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)}};a(Ho,"RootContext");var Uo=Ho,en=class en extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_expression}copyFrom(e){super.copyFrom(e)}};a(en,"ExpressionContext");var te=en,tn=class tn extends te{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(oi,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)}};a(tn,"ParenthesizedExpressionContext");var $o=tn,rn=class rn 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)}};a(rn,"NegativeExpressionContext");var qo=rn,on=class on extends te{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(ri,0)}comparisonOperator(){return this.getTypedRuleContext(li,0)}comparisonRight(){return this.getTypedRuleContext(ii,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)}};a(on,"ComparisonExpressionContext");var Bo=on,nn=class nn 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(fi,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)}};a(nn,"LogicalExpressionContext");var Ar=nn,sn=class sn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(br,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)}};a(sn,"ComparisonLeftContext");var ri=sn,an=class an extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(X,0)}qualifiedIdentifier(){return this.getTypedRuleContext(br,0)}externalConstant(){return this.getTypedRuleContext(ni,0)}arrayValue(){return this.getTypedRuleContext(si,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)}};a(an,"ComparisonRightContext");var ii=an,pn=class pn extends h.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)}};a(pn,"ParenthesizedItemContext");var oi=pn,cn=class cn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_value}copyFrom(e){super.copyFrom(e)}};a(cn,"ValueContext");var X=cn,ln=class ln extends X{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)}};a(ln,"TimeLiteralContext");var Ko=ln,fn=class fn extends X{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(pi,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)}};a(fn,"NullLiteralContext");var Vo=fn,mn=class mn extends X{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)}};a(mn,"DateTimeLiteralContext");var zo=mn,un=class un extends X{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)}};a(un,"StringLiteralContext");var Jo=un,dn=class dn extends X{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)}};a(dn,"DateLiteralContext");var Wo=dn,hn=class hn extends X{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(ci,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)}};a(hn,"InfinityLiteralContext");var Yo=hn,yn=class yn extends X{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(ai,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)}};a(yn,"BooleanLiteralContext");var Go=yn,Tn=class Tn extends X{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)}};a(Tn,"NumberLiteralContext");var Qo=Tn,En=class En extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(Ot)}identifier(e){return this.getTypedRuleContext(Ot,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)}};a(En,"QualifiedIdentifierContext");var br=En,_n=class _n extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(Ot,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)}};a(_n,"ExternalConstantContext");var ni=_n,xn=class xn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(f.IDENTIFIER,0)}get ruleIndex(){return f.RULE_identifier}enterRule(e){e.enterIdentifier&&e.enterIdentifier(this)}exitRule(e){e.exitIdentifier&&e.exitIdentifier(this)}accept(e){return e.visitIdentifier?e.visitIdentifier(this):e.visitChildren(this)}};a(xn,"IdentifierContext");var Ot=xn,On=class On extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(X)}value(e){return this.getTypedRuleContext(X,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)}};a(On,"ArrayValueContext");var si=On,gn=class gn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_boolean}enterRule(e){e.enterBoolean&&e.enterBoolean(this)}exitRule(e){e.exitBoolean&&e.exitBoolean(this)}accept(e){return e.visitBoolean?e.visitBoolean(this):e.visitChildren(this)}};a(gn,"BooleanContext");var ai=gn,wn=class wn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_null}enterRule(e){e.enterNull&&e.enterNull(this)}exitRule(e){e.exitNull&&e.exitNull(this)}accept(e){return e.visitNull?e.visitNull(this):e.visitChildren(this)}};a(wn,"NullContext");var pi=wn,Rn=class Rn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_infinity}enterRule(e){e.enterInfinity&&e.enterInfinity(this)}exitRule(e){e.exitInfinity&&e.exitInfinity(this)}accept(e){return e.visitInfinity?e.visitInfinity(this):e.visitChildren(this)}};a(Rn,"InfinityContext");var ci=Rn,An=class An extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_arithmeticOperator}enterRule(e){e.enterArithmeticOperator&&e.enterArithmeticOperator(this)}exitRule(e){e.exitArithmeticOperator&&e.exitArithmeticOperator(this)}accept(e){return e.visitArithmeticOperator?e.visitArithmeticOperator(this):e.visitChildren(this)}};a(An,"ArithmeticOperatorContext");var Xo=An,bn=class bn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_comparisonOperator}enterRule(e){e.enterComparisonOperator&&e.enterComparisonOperator(this)}exitRule(e){e.exitComparisonOperator&&e.exitComparisonOperator(this)}accept(e){return e.visitComparisonOperator?e.visitComparisonOperator(this):e.visitChildren(this)}};a(bn,"ComparisonOperatorContext");var li=bn,Dn=class Dn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_logicalOperator}enterRule(e){e.enterLogicalOperator&&e.enterLogicalOperator(this)}exitRule(e){e.exitLogicalOperator&&e.exitLogicalOperator(this)}accept(e){return e.visitLogicalOperator?e.visitLogicalOperator(this):e.visitChildren(this)}};a(Dn,"LogicalOperatorContext");var fi=Dn,Nn=class Nn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}POLAR_OP(){return this.getToken(f.POLAR_OP,0)}get ruleIndex(){return f.RULE_polarityOperator}enterRule(e){e.enterPolarityOperator&&e.enterPolarityOperator(this)}exitRule(e){e.exitPolarityOperator&&e.exitPolarityOperator(this)}accept(e){return e.visitPolarityOperator?e.visitPolarityOperator(this):e.visitChildren(this)}};a(Nn,"PolarityOperatorContext");var Zo=Nn;var da=require("@browsery/antlr4");var Sn=class Sn extends I{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};a(Sn,"ExternalConstant");var mi=Sn;var Fn=class Fn extends da.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 we(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new gr(t)}visitComparisonExpression(e){return new Ee({op:e.comparisonOperator().getText(),left:this.visit(e.comparisonLeft()),right:this.visit(e.comparisonRight())})}visitLogicalExpression(e){let t=[],r=a((i,n)=>{for(let s of i){if(s instanceof Ar&&s.logicalOperator().getText()===n){r(s.expression_list(),s.logicalOperator().getText());continue}let p=this.visit(s);t.push(p)}},"wrapChildren");return r(e.expression_list(),e.logicalOperator().getText()),new _e({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new pe(e.getText())}visitExternalConstant(e){return new mi(e.identifier().getText())}visitNullLiteral(){return new He}visitBooleanLiteral(e){return new Ze(e.getText()==="true")}visitNumberLiteral(e){return new Re(e.getText())}visitStringLiteral(e){return new et(wr(e.getText()))}visitInfinityLiteral(){return new Re(1/0)}visitDateLiteral(e){return new ve(wr(e.getText()))}visitDateTimeLiteral(e){return new Rr(wr(e.getText()))}visitTimeLiteral(e){return new tt(wr(e.getText()))}visitArrayValue(e){return new ge(e.value_list().map(t=>this.visit(t)))}};a(Fn,"FilterTreeVisitor");var Dr=Fn;var ha=require("@browsery/antlr4");var vn=class vn extends ha.ErrorListener{constructor(e){super(),this.errors=e}syntaxError(e,t,r,i,n,s){this.errors.push(new ei(n,{recognizer:e,offendingSymbol:t,line:r,column:i,e:s}))}};a(vn,"OpraErrorListener");var Nr=vn;function Mn(o,e){let t=new ui.CharStream(o),r=new ma(t),i=new ui.CommonTokenStream(r),n=new ua(i);n.buildParseTrees=!0;let s=[],p=new Nr(s);r.removeErrorListeners(),r.addErrorListener(p),n.removeErrorListeners(),n.addErrorListener(p);let c=n.root();if(s.length){let l=[];for(let w of s)l.push(w.message+(o.includes(`
|
|
8
|
-
`)?" at line: "+w.line+" column: "+w.column:" at column: "+w.column));let O=new
|
|
9
|
-
`));throw O.errors=s,O}return e=e||new Dr,e.visit(c)}a(Mn,"parse");var In=class In{constructor(e,t){if(this._rules=new v,this._decoderCache=new WeakMap,Object.defineProperty(this,"_rules",{value:new v(null,{caseSensitive:t==null?void 0:t.caseSensitive}),enumerable:!1}),e)for(let[r,i]of Object.entries(e))this.set(r,i)}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,(0,ya.omitUndefined)({...t,operators:r}))}normalizeFilter(e,t,r){let i=typeof e=="string"?Mn(e):e;return this.normalizeFilterAst(i,[],t,r)}normalizeFilterAst(e,t,r,i){if(e instanceof Ee){if(t.push(e),this.normalizeFilterAst(e.left,t,r),!(e.left instanceof pe&&e.left.field))throw new TypeError("Invalid filter query. Left side should be a data field.");let n=this._rules.get(e.left.value);if(!n)throw new ye({message:`Field '${e.left.value}' is not available for filter operation`,code:"UNACCEPTED_FILTER_FIELD",details:{field:e.left.value}});if(n.operators&&!n.operators.includes(e.op))throw new ye({message:`'${e.left.value}' field do not accept '${e.op}' filter operator`,code:"UNACCEPTED_FILTER_OPERATION",details:{field:e.left.value,operator:e.op}});return n.mappedField&&(e.left.value=n.mappedField),n.prepare&&(e.prepare=n.prepare),this.normalizeFilterAst(e.right,t,r),t.pop(),e}if(e instanceof _e)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof Xe)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n.expression,t,r)),t.pop(),e;if(e instanceof ge)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof we)return t.push(e),this.normalizeFilterAst(e.expression,t,r),t.pop(),e;if(e instanceof pe&&r)return e.value=r.normalizeFieldPath(e.value,{scope:i}),e.field=r.getField(e.value,i),e.dataType=e.field.type,e;if(e instanceof I){let n=t.findLastIndex(s=>s instanceof Ee);if(n>=0){let s=t[n];if((e===s.right||t[n+1]===s.right)&&s&&s.left instanceof pe&&s.left.field){if(e.value==null&&!s.left.field.required)return e.value;let p;s.op==="like"||s.op==="!like"||s.op==="ilike"||s.op==="!ilike"?p=Ta.isString:p=this._decoderCache.get(s.left.field),p||(p=s.left.field.type.generateCodec("decode",{scope:i,projection:"*",ignoreWriteonlyFields:!0,coerce:!0}),this._decoderCache.set(s.left.field,p)),e.value=p(e.value)}}}return e}toJSON(){return this._rules.toObject()}[Symbol.iterator](){return this._rules.entries()}};a(In,"FilterRules");var gt=In;var ga=Et(require("object-hash"),1),wa=require("ts-gems"),K=require("valgen");var xa=require("@jsopen/objects"),Oa=require("ts-gems");var Ea=require("ts-gems"),_a=require("uid");var m={};Ii(m,{ComplexType:()=>wt,EnumType:()=>Rt,HttpController:()=>Sr,HttpOperation:()=>Pn,MappedType:()=>At,MixinType:()=>bt,RpcController:()=>Ln,RpcOperation:()=>kn,SimpleType:()=>Dt,SpecVersion:()=>Hp,UnionType:()=>Nt,isComplexType:()=>tc,isDataType:()=>ec,isEnumType:()=>nc,isHttpController:()=>ac,isMappedType:()=>oc,isMixinType:()=>ic,isSimpleType:()=>rc,isUnionType:()=>sc});var Hp="1.0";var wt;(function(o){o.Kind="ComplexType"})(wt||(wt={}));var Rt;(function(o){o.Kind="EnumType"})(Rt||(Rt={}));var At;(function(o){o.Kind="MappedType"})(At||(At={}));var bt;(function(o){o.Kind="MixinType"})(bt||(bt={}));var Dt;(function(o){o.Kind="SimpleType"})(Dt||(Dt={}));var Nt;(function(o){o.Kind="UnionType"})(Nt||(Nt={}));var Sr;(function(o){o.Kind="HttpController"})(Sr||(Sr={}));var Pn;(function(o){o.Kind="HttpOperation"})(Pn||(Pn={}));var Ln;(function(o){o.Kind="RpcController"})(Ln||(Ln={}));var kn;(function(o){o.Kind="RpcOperation"})(kn||(kn={}));function ec(o){return o&&typeof o=="object"&&(o.kind===wt.Kind||o.kind===Rt.Kind||o.kind===At.Kind||o.kind===Dt.Kind||o.kind===bt.Kind||o.kind===Nt.Kind)}a(ec,"isDataType");function tc(o){return o&&typeof o=="object"&&o.kind===wt.Kind}a(tc,"isComplexType");function rc(o){return o&&typeof o=="object"&&o.kind===Dt.Kind}a(rc,"isSimpleType");function ic(o){return o&&typeof o=="object"&&o.kind===bt.Kind}a(ic,"isMixinType");function oc(o){return o&&typeof o=="object"&&o.kind===At.Kind}a(oc,"isMappedType");function nc(o){return o&&typeof o=="object"&&o.kind===Rt.Kind}a(nc,"isEnumType");function sc(o){return o&&typeof o=="object"&&o.kind===Nt.Kind}a(sc,"isUnionType");function ac(o){return o&&typeof o=="object"&&o.kind===Sr.Kind}a(ac,"isHttpController");var jn=class jn{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[Oe])return this.element;if(this.parent)return this._document=this.parent.getDocument();throw new Error("ApiDocument not found in document tree")}hasDataType(e,t){return!!this.findDataType(e,t)}findDataType(e,t){var i;let r=(i=this[q])==null?void 0:i.get(e);return r&&r.inScope(t)?r:this.parent?this.parent.findDataType(e,t):void 0}getDataType(e,t){let r=this.findDataType(e,t);if(r)return r;let i="";if(typeof e=="function")i=Reflect.getMetadata(d,e).name;else if(typeof e=="object"){let n=e[d];i=n==null?void 0:n.name}throw i||(e&&typeof e=="string"?i=e:typeof e=="function"&&(i=e.name)),r?new TypeError(`Data type${i?" ("+i+")":""} is not in requested scope (${t})`):new TypeError(`Unknown data type${i?" ("+i+")":""}`)}getDataTypeNameWithNs(e){if(!e.name)return;let t=this.getDocument().getDataTypeNs(e);return t?t+":"+e.name:e.name}getComplexType(e,t){let r=this.getDataType(e,t);if(r.kind===m.ComplexType.Kind)return r;throw new TypeError(`Data type "${r.name}" is not a ComplexType`)}getSimpleType(e,t){let r=this.getDataType(e,t);if(r.kind===m.SimpleType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a SimpleType`)}getEnumType(e,t){let r=this.getDataType(e,t);if(r.kind===m.EnumType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a EnumType`)}getMappedType(e,t){let r=this.getDataType(e,t);if(r.kind===m.MappedType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MappedType`)}getMixinType(e,t){let r=this.getDataType(e,t);if(r.kind===m.MixinType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MixinType`)}getUnionType(e,t){let r=this.getDataType(e,t);if(r.kind===m.UnionType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MixinType`)}};a(jn,"DocumentNode");var Fr=jn;var A=a(function(o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=(0,Ea.asMutable)(this);e.id=(0,_a.uid)(16),Object.defineProperty(e,"node",{value:new Fr(this,o==null?void 0:o.node),enumerable:!1,writable:!0}),o&&Object.defineProperty(e,"owner",{value:o,enumerable:!1,writable:!0})},"DocumentElement"),Un=class Un{};a(Un,"DocumentElementClass");var Cn=Un;A.prototype=Cn.prototype;var St=Symbol.for("nodejs.util.inspect.custom"),rt="\x1B[0m",Ft="\x1B[33m",vt="\x1B[35m";function vr(o,e){return!e||o==="*"?!0:o?Array.isArray(e)?e.some(t=>typeof t=="string"?o===t:t.test(o)):typeof e=="string"?o===e:e.test(o):!1}a(vr,"testScopeMatch");var x=a(function(o,e,t){if(!this)throw new TypeError('"this" should be passed to call class constructor');if(e!=null&&e.name&&!$.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);A.call(this,o);let r=(0,Oa.asMutable)(this);r.kind=e.kind,r.scopePattern=e.scopePattern?Array.isArray(e.scopePattern)?e.scopePattern:[e.scopePattern]:void 0,r.name=e.name,r.description=e.description,r.abstract=e.abstract,r.examples=e.examples},"DataType"),qn=class qn extends A{get embedded(){return!this.name}inScope(e){return vr(e,this.scopePattern)}toJSON(e){let t=this._locateBase(r=>!r.inScope(e==null?void 0:e.scope));if(t){let r=this.node.getDataTypeNameWithNs(t);throw new TypeError(`"${r}" model is not available for "${(e==null?void 0:e.scope)||"null"}" scope`)}return(0,xa.omitUndefined)({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[St](){return`[${Ft+Object.getPrototypeOf(this).constructor.name+rt} ${vt+this.name+rt}]`}};a(qn,"DataTypeClass");var $n=qn;x.prototype=$n.prototype;var Mt=/^([+-])?([a-z$_][\w.]*)$/i,U=a(function(...o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;x.call(this,e,t,r);let i=(0,wa.asMutable)(this);i._fields=new v},"ComplexTypeBase"),Kn=class Kn extends x{fieldCount(e){if(e==="*")return this._fields.size;let t=0;for(let r of this.fields(e))t++;return t}fieldEntries(e){let t=this._fields.entries();if(e==="*")return t;let r;return{next(){for(;t&&(r=t.next(),!(r.done||r.value&&r.value[1].inScope(e))););return r.done?{done:r.done,value:void 0}:{done:r.done,value:[r.value[0],r.value[1].forScope(e)]}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}fields(e){let t=this.fieldEntries(e),r;return{next(){var i;return t?(r=t.next(),{done:r.done,value:(i=r.value)==null?void 0:i[1]}):{done:!0,value:void 0}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}fieldNames(e){if(e==="*")return this._fields.keys();let t=this.fieldEntries(e),r;return{next(){var i;return t?(r=t.next(),{done:r.done,value:(i=r.value)==null?void 0:i[0]}):{done:!0,value:void 0}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}findField(e,t){if(e.includes(".")){let i=this.parseFieldPath(e,{scope:t});if(i.length===0)throw new Error(`Field "${e}" does not exist in scope "${t}"`);let n=i.pop();return n==null?void 0:n.field}let r=this._fields.get(e);if(r&&r.inScope(t))return r.forScope(t)}getField(e,t){let r=this.findField(e,"*");if(r&&!r.inScope(t))throw new Error(`Field "${e}" does not exist in scope "${t||"null"}"`);if(!r)throw new Error(`Field (${e}) does not exist`);return r.forScope(t)}parseFieldPath(e,t){var w,E,ee;let r=this,i,n=e.split("."),s=n.length,p=[],c=this.owner.node.getDataType("object"),l=t==null?void 0:t.allowSigns,O=a(()=>p.map(j=>j.fieldName).join("."),"getStrPath");for(let j=0;j<s;j++){let W={fieldName:n[j],dataType:c};p.push(W);let Ge=Mt.exec(n[j]);if(!Ge)throw new TypeError(`Invalid field name (${O()})`);if(Ge[1]&&((j===0&&l==="first"||l==="each")&&(W.sign=Ge[1]),W.fieldName=Ge[2]),r){if(r instanceof U){if(i=r.findField(W.fieldName,t==null?void 0:t.scope),i){W.fieldName=i.name,W.field=i,W.dataType=i.type,r=i.type;continue}if(((w=r.additionalFields)==null?void 0:w[0])===!0){W.additionalField=!0,W.dataType=c,r=void 0;continue}if(((E=r.additionalFields)==null?void 0:E[0])==="type"&&((ee=r.additionalFields)==null?void 0:ee[1])instanceof x){W.additionalField=!0,W.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(Mi=>Mi.fieldName).join(".")})`)}throw new TypeError(`"${p.map(Mi=>Mi.fieldName).join(".")}" field is not a complex type and has no child fields`)}W.additionalField=!0,W.dataType=c}return p}normalizeFieldPath(e,t){return this.parseFieldPath(e,t).map(r=>(r.sign||"")+r.fieldName).join(".")}generateCodec(e,t){var p;let r=t!=null&&t.cache?t:{...t,projection:Array.isArray(t==null?void 0:t.projection)?fo(t.projection):t==null?void 0:t.projection,currentPath:""},i=this._generateSchema(e,r),n;if(this.additionalFields instanceof x)n=this.additionalFields.generateCodec(e,t);else if(typeof this.additionalFields=="boolean")n=this.additionalFields;else if(Array.isArray(this.additionalFields))if(this.additionalFields.length<2)n="error";else{let c=n[1];n=(0,K.validator)((l,O,w)=>O.fail(w,c,l))}let s=K.vg.isObject(i,{ctor:this.name==="object"?Object:this.ctor,additionalFields:n,name:this.name,coerce:!0,caseInSensitive:t==null?void 0:t.caseInSensitive,onFail:t==null?void 0:t.onFail});if(r.level===0&&((p=r.forwardCallbacks)!=null&&p.size))for(let c of r.forwardCallbacks)c();return s}_generateSchema(e,t){var c;t.fieldCache=t.fieldCache||new Map,t.level=t.level||0,t.forwardCallbacks=t.forwardCallbacks||new Set;let r={},{currentPath:i,projection:n}=t,s=!!(n&&Object.values(n).find(l=>!l.sign)),p;for(let l of this.fields("*")){if(!l.inScope(t.scope)||!(t.keepKeyFields&&this.keyField)&&(t.ignoreReadonlyFields&&l.readonly||t.ignoreWriteonlyFields&&l.writeonly)){r[l.name]=K.vg.isUndefined({coerce:!0});continue}p=l.name;let O;if(n!=="*"&&(O=n==null?void 0:n[p.toLowerCase()],(O==null?void 0:O.sign)==="-"||s&&!O||!s&&l.exclusive&&!O)){r[l.name]=K.vg.isUndefined({coerce:!0});continue}let w=typeof n=="object"?((c=n[p])==null?void 0:c.projection)||"*":n,E=t.fieldCache.get(l),ee=typeof w=="string"?w:(0,ga.default)(w||{});E||(E={},t.fieldCache.set(l,E));let j=E[ee];if(j===null)j=K.vg.isAny(),t.forwardCallbacks.add(()=>{j=E[ee],r[p]=t.partial||!l.required?K.vg.optional(j):K.vg.required(j)});else if(!j){let W=a(()=>{E[ee]=null;let Ge=this._generateFieldCodec(e,l,{...t,partial:t.partial==="deep"?t.partial:void 0,projection:w,currentPath:i+(i?".":"")+p});return E[ee]=Ge,Ge},"defaultGenerator");t.fieldHook?j=t.fieldHook(l,t.currentPath,W):j=W()}r[p]=t.partial||!(l.required||j.id==="required")?K.vg.optional(j):j.id==="required"?j:K.vg.required(j)}return t.allowPatchOperators&&(r._$pull=K.vg.optional(K.vg.isAny()),r._$push=K.vg.optional(K.vg.isAny())),r}_generateFieldCodec(e,t,r){let i=t.type.generateCodec(e,{...r,level:r.level+1});return t.fixed&&(i=K.vg.isEqual(t.fixed)),t.isArray&&(i=K.vg.isArray(i)),i}};a(Kn,"ComplexTypeBaseClass");var Bn=Kn;U.prototype=Bn.prototype;var x0=require("reflect-metadata"),di=require("@jsopen/objects"),Ra=require("ts-gems"),Aa=require("valgen");var re=a(function(...o){if(!this)return re[N].apply(void 0,o);let[e,t,r]=o;x.call(this,e,t,r);let i=(0,Ra.asMutable)(this);if(i.kind=m.EnumType.Kind,t.base){if(!(t.base instanceof re))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${i.kind}"`);i.base=t.base}i.instance=t.instance,i.ownAttributes=M(t.attributes||{}),i.attributes=i.base?M(i.base.attributes):{};for(let[n,s]of Object.entries(i.ownAttributes))i.attributes[n]=s},"EnumType"),Vn=class Vn extends x{extendsFrom(e){var t;return e instanceof x||(e=this.node.getDataType(e)),e instanceof re?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return Aa.vg.isEnum(Object.keys(this.attributes))}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return(0,di.omitUndefined)({...t,kind:this.kind,base:r,attributes:M(this.ownAttributes)})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Vn,"EnumTypeClass");var Mr=Vn;re.prototype=Mr.prototype;Object.assign(re,Mr);function pc(o,...e){let t=e.length>=2?e[0]:void 0,r=e.length>=2?e[1]:e[0],i={},n=o;if(Array.isArray(o)){if(t){if(!Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be array');n=[...t,...o]}i={},o.forEach(p=>{var l;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];i[p]=(0,di.omitUndefined)({description:c})})}else{if(t){if(Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be enum object');n={...t,...o}}Object.keys(o).forEach(p=>{var l;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];i[o[p]]=(0,di.omitUndefined)({alias:p,description:c})})}let s={kind:m.EnumType.Kind,attributes:i,base:r==null?void 0:r.base,name:r==null?void 0:r.name,description:r==null?void 0:r.description};return Object.defineProperty(o,d,{value:s,enumerable:!1,configurable:!0,writable:!0}),n}a(pc,"EnumTypeFactory");re.prototype=Mr.prototype;re[N]=pc;var hi=require("tslib"),Qn=require("valgen");var v0=require("reflect-metadata"),Jn=require("@jsopen/objects"),Da=require("ts-gems"),Wn=require("valgen");function zn(o){let e=[],t=a(function(r){let i;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!$.test(o.name))throw new TypeError(`"${o.name}" is not a valid type name`);i=o.name}else i=r.name,i=i.toLowerCase();let n=Reflect.getOwnMetadata(d,r)||{};o&&Object.assign(n,o),n.kind=m.SimpleType.Kind,n.name=i,Reflect.defineMetadata(d,n,r);for(let s of e)s(n,r)},"decorator");return t.Example=(r,i)=>(e.push(n=>{n.examples=n.examples||[],n.examples.push({description:i,value:r})}),t),t}a(zn,"SimpleTypeDecoratorFactory");function ba(o){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(d,e.constructor)||{},i=Reflect.getMetadata("design:type",e,t),n="string";i===Boolean?n="boolean":i===Number&&(n="number"),r.kind=m.SimpleType.Kind,r.attributes=r.attributes||{},r.attributes[t]={format:(o==null?void 0:o.format)||n,description:o==null?void 0:o.description,deprecated:o==null?void 0:o.deprecated},Reflect.defineMetadata(d,r,e.constructor)}}a(ba,"AttributeDecoratorFactory");var u=a(function(...o){var n,s;if(!this)return u[N](...o);let[e,t,r]=o;x.call(this,e,t,r);let i=(0,Da.asMutable)(this);if(i.kind=m.SimpleType.Kind,t.base){if(!(t.base instanceof u))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base}if(i.properties=t.properties,i.ownNameMappings={...t.nameMappings},i.nameMappings={...(n=i.base)==null?void 0:n.nameMappings,...t.nameMappings},i.ownAttributes=M(t.attributes||{}),i.attributes=i.base?M(i.base.attributes):{},i.ownAttributes)for(let[p,c]of Object.entries(i.ownAttributes)){if((s=i.attributes[p])!=null&&s.sealed)throw new TypeError(`Sealed attribute "${p}" can not be overwritten`);i.attributes[p]=c}i._generateDecoder=t.generateDecoder,i._generateEncoder=t.generateEncoder},"SimpleType"),Gn=class Gn extends x{extendsFrom(e){var t;return e instanceof x||(e=this.node.getDataType(e)),e instanceof u?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(e,t,r){let i={...this.properties,...r};if(e==="decode"){let s=this;for(;s;){if(s._generateDecoder)return s._generateDecoder(i,(t==null?void 0:t.documentElement)||this.owner,t==null?void 0:t.scope);s=this.base}return Wn.isAny}let n=this;for(;n;){if(n._generateEncoder)return n._generateEncoder(i,(t==null?void 0:t.documentElement)||this.owner,t==null?void 0:t.scope);n=this.base}return Wn.isAny}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i=(0,Jn.omitUndefined)(this.ownAttributes),n;this.properties&&typeof this.properties.toJSON=="function"?n=this.properties.toJSON(this.properties,this.owner,e):n=this.properties?M(this.properties):{};let s={...t,kind:this.kind,base:r,attributes:i&&Object.keys(i).length?i:void 0,properties:Object.keys(n).length?n:void 0};return Object.keys(this.ownNameMappings).length&&(s.nameMappings={...this.ownNameMappings}),(0,Jn.omitUndefined)(s,!0)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Gn,"SimpleTypeClass");var Yn=Gn;u.prototype=Yn.prototype;Object.assign(u,zn);u[N]=zn;u.Attribute=ba;var It,Ir=(It=class{constructor(e){e&&Object.assign(this,e)}[T](){return Qn.vg.isBase64({coerce:!0})}[g](){return Qn.vg.isBase64({coerce:!0})}},a(It,"Base64Type"),It);Ir=(0,hi.__decorate)([u({name:"base64",description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),(0,hi.__metadata)("design:paramtypes",[Object])],Ir);var Me=require("tslib"),V=require("valgen");var Pt,it=(Pt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=V.vg.isDate({precision:"date",coerce:!0}),r=[];return e.minValue!=null&&((0,V.isDateString)(e.minValue),r.push(V.toString,V.vg.isGte(e.minValue))),e.maxValue!=null&&((0,V.isDateString)(e.maxValue),r.push(V.toString,V.vg.isLte(e.maxValue))),r.length>0?V.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){let t=V.vg.isDateString({precision:"date",trim:"date",coerce:!0}),r=[];return e.minValue!=null&&((0,V.isDateString)(e.minValue),r.push(V.vg.isGte(e.minValue))),e.maxValue!=null&&((0,V.isDateString)(e.maxValue),r.push(V.vg.isLte(e.maxValue))),r.length>0?V.vg.pipe([t,...r],{returnIndex:0}):t}},a(Pt,"DateType"),Pt);(0,Me.__decorate)([u.Attribute({description:"Minimum value"}),(0,Me.__metadata)("design:type",String)],it.prototype,"minValue",void 0);(0,Me.__decorate)([u.Attribute({description:"Maximum value"}),(0,Me.__metadata)("design:type",String)],it.prototype,"maxValue",void 0);it=(0,Me.__decorate)([u({name:"date",description:"A date without time",nameMappings:{js:"Date",json:"string"}}).Example("2021-04-18","Full date value"),(0,Me.__metadata)("design:paramtypes",[Object])],it);var Ie=require("tslib"),Pr=require("valgen");var Lt,ot=(Lt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=Pr.vg.isDateString({trim:"date",coerce:!0}),r=[];return e.minValue!=null&&r.push(Pr.vg.isGte(e.minValue)),e.maxValue!=null&&r.push(Pr.vg.isLte(e.maxValue)),r.length>0?Pr.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){return this[T](e)}},a(Lt,"DateStringType"),Lt);(0,Ie.__decorate)([u.Attribute({description:"Minimum value"}),(0,Ie.__metadata)("design:type",String)],ot.prototype,"minValue",void 0);(0,Ie.__decorate)([u.Attribute({description:"Maximum value"}),(0,Ie.__metadata)("design:type",String)],ot.prototype,"maxValue",void 0);ot=(0,Ie.__decorate)([u({name:"datestring",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,Ie.__metadata)("design:paramtypes",[Object])],ot);var Pe=require("tslib"),z=require("valgen");var kt,nt=(kt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=z.vg.isDate({precision:"time",coerce:!0}),r=[];return e.minValue!=null&&((0,z.isDateString)(e.minValue),r.push(z.toString,z.vg.isGte(e.minValue))),e.maxValue!=null&&((0,z.isDateString)(e.maxValue),r.push(z.toString,z.vg.isLte(e.maxValue))),r.length>0?z.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){let t=z.vg.isDateString({precision:"time",trim:"time",coerce:!0}),r=[];return e.minValue!=null&&((0,z.isDateString)(e.minValue),r.push(z.vg.isGte(e.minValue))),e.maxValue!=null&&((0,z.isDateString)(e.maxValue),r.push(z.vg.isLte(e.maxValue))),r.length>0?z.vg.pipe([t,...r],{returnIndex:0}):t}},a(kt,"DateTimeType"),kt);(0,Pe.__decorate)([u.Attribute({description:"Minimum value"}),(0,Pe.__metadata)("design:type",String)],nt.prototype,"minValue",void 0);(0,Pe.__decorate)([u.Attribute({description:"Maximum value"}),(0,Pe.__metadata)("design:type",String)],nt.prototype,"maxValue",void 0);nt=(0,Pe.__decorate)([u({name:"datetime",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,Pe.__metadata)("design:paramtypes",[Object])],nt);var Le=require("tslib"),Lr=require("valgen");var jt,st=(jt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=Lr.vg.isDateString({coerce:!0}),r=[];return e.minValue!=null&&r.push(Lr.vg.isGte(e.minValue)),e.maxValue!=null&&r.push(Lr.vg.isLte(e.maxValue)),r.length>0?Lr.vg.pipe([t,...r]):t}[g](e){return this[T](e)}},a(jt,"DateTimeStringType"),jt);(0,Le.__decorate)([u.Attribute({description:"Minimum value"}),(0,Le.__metadata)("design:type",String)],st.prototype,"minValue",void 0);(0,Le.__decorate)([u.Attribute({description:"Maximum value"}),(0,Le.__metadata)("design:type",String)],st.prototype,"maxValue",void 0);st=(0,Le.__decorate)([u({name:"datetimestring",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,Le.__metadata)("design:paramtypes",[Object])],st);var L=require("tslib"),Xn=require("valgen");var Ct,Z=(Ct=class{constructor(e){e&&Object.assign(this,e)}[T](e){return Xn.vg.isEmail({...e,coerce:!0})}[g](e){return Xn.vg.isEmail({...e,coerce:!0})}},a(Ct,"EmailType"),Ct);(0,L.__decorate)([u.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),(0,L.__metadata)("design:type",Boolean)],Z.prototype,"allowDisplayName",void 0);(0,L.__decorate)([u.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),(0,L.__metadata)("design:type",Boolean)],Z.prototype,"requireDisplayName",void 0);(0,L.__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,L.__metadata)("design:type",Boolean)],Z.prototype,"utf8LocalPart",void 0);(0,L.__decorate)([u.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),(0,L.__metadata)("design:type",Boolean)],Z.prototype,"ignoreMaxLength",void 0);(0,L.__decorate)([u.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),(0,L.__metadata)("design:type",Boolean)],Z.prototype,"allowIpDomain",void 0);(0,L.__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,L.__metadata)("design:type",Boolean)],Z.prototype,"domainSpecificValidation",void 0);(0,L.__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,L.__metadata)("design:type",Array)],Z.prototype,"hostBlacklist",void 0);(0,L.__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,L.__metadata)("design:type",Array)],Z.prototype,"hostWhitelist",void 0);(0,L.__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,L.__metadata)("design:type",String)],Z.prototype,"blacklistedChars",void 0);Z=(0,L.__decorate)([u({name:"email",description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),(0,L.__metadata)("design:paramtypes",[Object])],Z);var ke=require("tslib"),$t=require("valgen");var Ut,J=(Ut=class{constructor(e){e&&Object.assign(this,e)}[T](e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.allowSigns,s=(0,$t.validator)("decodeFieldPath",p=>i.normalizeFieldPath(p,{allowSigns:n,scope:r}));return $t.vg.pipe([$t.toString,s])}[g](e,t,r){return this[T](e,t,r)}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");x.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),allowSigns:e.allowSigns}}},a(Ut,"FieldPathType"),Ut);(0,ke.__decorate)([u.Attribute({description:"Data type which field belong to"}),(0,ke.__metadata)("design:type",Object)],J.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)],J.prototype,"allowSigns",void 0);J=(0,ke.__decorate)([u({name:"fieldpath",description:"Field path",nameMappings:{js:"string",json:"string"}}),(0,ke.__metadata)("design:paramtypes",[Object])],J);var je=require("tslib"),Zn=require("valgen");var Bt={};Ii(Bt,{$and:()=>lc,$arithmetic:()=>Nc,$array:()=>Na,$date:()=>fc,$eq:()=>hc,$field:()=>dc,$gt:()=>Tc,$gte:()=>Ec,$ilike:()=>Ac,$in:()=>Oc,$like:()=>wc,$lt:()=>_c,$lte:()=>xc,$ne:()=>yc,$notILike:()=>bc,$notIn:()=>gc,$notLike:()=>Rc,$number:()=>uc,$or:()=>cc,$paren:()=>Dc,$time:()=>mc,ArithmeticExpression:()=>Xe,ArithmeticExpressionItem:()=>Zr,ArrayExpression:()=>ge,Ast:()=>Or,BooleanLiteral:()=>Ze,ComparisonExpression:()=>Ee,DateLiteral:()=>ve,DateTimeLiteral:()=>Rr,Expression:()=>B,FilterTreeVisitor:()=>Dr,Literal:()=>I,LogicalExpression:()=>_e,NegativeExpression:()=>gr,NullLiteral:()=>He,NumberLiteral:()=>Re,OpraErrorListener:()=>Nr,ParenthesizedExpression:()=>we,QualifiedIdentifier:()=>pe,StringLiteral:()=>et,Term:()=>Qe,TimeLiteral:()=>tt,parse:()=>Mn});function cc(...o){return new _e({op:"or",items:o})}a(cc,"$or");function lc(...o){return new _e({op:"and",items:o})}a(lc,"$and");function fc(o){return new ve(o)}a(fc,"$date");function mc(o){return new tt(o)}a(mc,"$time");function uc(o){return new Re(o)}a(uc,"$number");function Na(...o){return new ge(o.map(yi))}a(Na,"$array");function dc(o){return new pe(o)}a(dc,"$field");function hc(o,e){return le("=",o,e)}a(hc,"$eq");function yc(o,e){return le("!=",o,e)}a(yc,"$ne");function Tc(o,e){return le(">",o,e)}a(Tc,"$gt");function Ec(o,e){return le(">=",o,e)}a(Ec,"$gte");function _c(o,e){return le("<",o,e)}a(_c,"$lt");function xc(o,e){return le("<=",o,e)}a(xc,"$lte");function Oc(o,e){return le("in",o,e)}a(Oc,"$in");function gc(o,e){return le("!in",o,e)}a(gc,"$notIn");function wc(o,e){return le("like",o,e)}a(wc,"$like");function Rc(o,e){return le("!like",o,e)}a(Rc,"$notLike");function Ac(o,e){return le("ilike",o,e)}a(Ac,"$ilike");function bc(o,e){return le("!ilike",o,e)}a(bc,"$notILike");function Dc(o){return new we(o)}a(Dc,"$paren");function Nc(o){let e=new Xe;return e.add=t=>(e.append("+",qt(t)),e),e.sub=t=>(e.append("-",qt(t)),e),e.mul=t=>(e.append("*",qt(t)),e),e.div=t=>(e.append("/",qt(t)),e),e.append("+",yi(o)),e}a(Nc,"$arithmetic");function le(o,e,t){let r=typeof e=="string"?new pe(e):yi(e),i=yi(t);return new Ee({op:o,left:r,right:i})}a(le,"comparisonExpression");var yi=a(o=>Array.isArray(o)?Na(...o.map(qt)):qt(o),"wrapEntryValue"),qt=a(o=>o instanceof B?o:typeof o=="boolean"?new Ze(o):typeof o=="number"||typeof o=="bigint"?new Re(o):o==null?new He:o instanceof Date?new ve(o):new et(""+o),"_wrapEntryValue");var Kt,Ae=(Kt=class{constructor(e){e&&Object.assign(this,e)}[T](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),i=e.rules?new gt(e.rules):void 0;return Sc(r,i)}[g](){return Fc}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");x.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),rules:e.rules}}},a(Kt,"FilterType"),Kt);(0,je.__decorate)([u.Attribute({description:"Data type which filtering fields belong to"}),(0,je.__metadata)("design:type",Object)],Ae.prototype,"dataType",void 0);(0,je.__decorate)([u.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),(0,je.__metadata)("design:type",Object)],Ae.prototype,"rules",void 0);Ae=(0,je.__decorate)([u({name:"filter",description:"A query filter",nameMappings:{js:"object",json:"string"}}),(0,je.__metadata)("design:paramtypes",[Object])],Ae);var Sc=a((o,e,t)=>(0,Zn.validator)("decodeFilter",(r,i,n)=>{if(typeof r=="string")try{let s=Bt.parse(r);return e?e.normalizeFilter(s,o,t):s}catch(s){i.fail(n,`Not a valid filter expression. ${s.message}`,r);return}i.fail(n,"Nt a valid filter expression string",r)}),"decodeFilter"),Fc=(0,Zn.validator)("encodeFilter",(o,e,t)=>{if(o instanceof Bt.Ast)return o.toString();e.fail(t,"Not a valid filter expression",o)});var Ti=require("tslib"),Hn=require("valgen");var Vt,kr=(Vt=class{constructor(e){e&&Object.assign(this,e)}[T](){return Hn.vg.isObjectId({coerce:!0})}[g](){return Hn.vg.isObjectId({coerce:!0})}},a(Vt,"ObjectIdType"),Vt);kr=(0,Ti.__decorate)([u({name:"ObjectId",description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),(0,Ti.__metadata)("design:paramtypes",[Object])],kr);var k=require("tslib");var ts=require("@jsopen/objects"),Fa=require("ts-gems");var Sa=require("@jsopen/objects");function es(o){let e=[],t=a(function(r,i){if(typeof i!="string")throw new TypeError("Symbol properties can't be used as a field");let n=Reflect.getOwnMetadata(d,r.constructor)||{};n.kind=m.ComplexType.Kind,n.fields=n.fields||{};let s=Reflect.getMetadata("design:type",r,i),p=n.fields[i]={...o};s===Array?p.isArray=!0:p.type=p.type||s,Reflect.defineMetadata(d,n,r.constructor);for(let c of e)c(p)},"decorator");return t.Override=(r,i)=>(e.push(n=>{n.override=n.override||[],n.override.push((0,Sa.omitUndefined)({...i,scopePattern:Array.isArray(r)?r:[r],type:void 0,isArray:void 0,isNestedEntity:void 0}))}),t),t}a(es,"ApiFieldDecoratorFactory");var C=a(function(...o){if(!this){let[n]=o;return C[N](n)}let[e,t]=o;A.call(this,e);let r=(0,Fa.asMutable)(this);r.name=t.name;let i=t.origin||e;if(!(i instanceof U))throw new Error("Field origin should be one of ComplexType, MappedType or MixinType");r.origin=i,r.scopePattern=t.scopePattern?Array.isArray(t.scopePattern)?t.scopePattern:[t.scopePattern]:void 0,r.type=t.type||e.node.getDataType("any"),r.description=t.description,r.isArray=t.isArray,r.isNestedEntity=t.isNestedEntity,r.default=t.default,r.fixed=t.fixed,r.required=t.required,r.exclusive=t.exclusive,r.localization=t.localization,r.keyField=t.keyField,r.deprecated=t.deprecated,r.readonly=t.readonly,r.writeonly=t.writeonly,r.examples=t.examples,r.override=t.override},"ApiField"),is=class is extends A{inScope(e){return vr(e,this.scopePattern)}forScope(e){if(!(e&&this.override))return this;this._overrideCache=this._overrideCache||{};let t=this._overrideCache[e];if(t)return t;if(e!=="*"){for(let r of this.override)if(vr(e,r.scopePattern)){t=(0,ts.omitUndefined)({...r,id:void 0,owner:void 0,node:void 0,origin:void 0,name:void 0,type:void 0,override:void 0,_overrideCache:void 0,scopePattern:r.scopePattern}),Object.setPrototypeOf(t,this);break}}return t=t||this,this._overrideCache[e]=t,t}toJSON(e){var r;let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return(0,ts.omitUndefined)({type:t||((r=this.type)==null?void 0:r.toJSON(e)),description:this.description,isArray:this.isArray||void 0,isNestedEntity:this.isNestedEntity||void 0,default:this.default,fixed:this.fixed,required:this.required||void 0,exclusive:this.exclusive||void 0,localization:this.localization||void 0,keyField:this.keyField||void 0,deprecated:this.deprecated||void 0,readonly:this.readonly||void 0,writeonly:this.writeonly||void 0,examples:this.examples})}};a(is,"ApiFieldClass");var rs=is;C.prototype=rs.prototype;Object.assign(C,es);C[N]=es;var ty=require("reflect-metadata"),Ma=require("@jsopen/objects"),Ia=require("ts-gems");var os=class os extends ye{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};a(os,"OpraDocumentError");var at=os;var ns=class ns{constructor(e){this.path="",this.error=new at,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(i){i!==this.error&&this.addError(i)}finally{this.path=r}}async enterAsync(e,t){let r=this.path;this.path=this.path+e;try{return await t()}catch(i){i!==this.error&&this.addError(i)}finally{this.path=r}}extend(e){let t={...e};return Object.setPrototypeOf(t,this),t}};a(ns,"DocumentInitContext");var de=ns;var va=require("@jsopen/objects");function ss(o){return function(e){let t;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!$.test(o.name))throw new TypeError(`"${o.name}" is not a valid type name`);t=o.name}else t=e.name;let r=Reflect.getOwnMetadata(d,e);r||(r={},Reflect.defineMetadata(d,r,e)),r.kind=m.ComplexType.Kind,r.name=t,o&&Object.assign(r,(0,va.omit)(o,["name"]))}}a(ss,"ComplexTypeDecorator");var ie=a(function(...o){var n;if(!this)return ie[N].apply(void 0,o);let[e,t]=o,r=o[2]||new de({maxErrors:0});U.call(this,e,t,r);let i=(0,Ia.asMutable)(this);i.kind=m.ComplexType.Kind,i.discriminatorField=t.discriminatorField,i.discriminatorValue=t.discriminatorValue,t.base&&r.enter(".base",()=>{if(!(t.base instanceof U))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base,i.additionalFields=i.base.additionalFields,i.keyField=i.base.keyField;for(let s of i.base.fields("*"))i._fields.set(s.name,new C(this,s))}),t.additionalFields!==void 0&&(i.additionalFields=t.additionalFields),t.keyField!==void 0&&(i.keyField=t.keyField),i.ctor=t.ctor||((n=i.base)==null?void 0:n.ctor),t.fields&&r.enter(".fields",()=>{for(let[s,p]of Object.entries(t.fields)){let c=new C(this,{...p,name:s});this._fields.set(c.name,c)}})},"ComplexType"),ps=class ps extends U{extendsFrom(e){var t;return e instanceof x||(e=this.node.getDataType(e)),e instanceof U?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i={...t,kind:this.kind,base:this.base?r||this.base.toJSON(e):void 0,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue};if(this.additionalFields)if(this.additionalFields instanceof x){let n=this.node.getDataTypeNameWithNs(this.additionalFields);i.additionalFields=n||this.additionalFields.toJSON(e)}else i.additionalFields=this.additionalFields;if(this._fields.size){let n={},s=0;for(let p of this._fields.values())p.origin===this&&p.inScope(e==null?void 0:e.scope)&&(n[p.name]=p.toJSON(e),s++);s&&(i.fields=n)}return(0,Ma.omitUndefined)(i)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(ps,"ComplexTypeClass");var as=ps;ie.prototype=as.prototype;Object.assign(ie,ss);ie[N]=ss;var zt,H=(zt=class{constructor(e){e&&Object.assign(this,e)}},a(zt,"OperationResult"),zt);(0,k.__decorate)([C(),(0,k.__metadata)("design:type",Number)],H.prototype,"affected",void 0);(0,k.__decorate)([C(),(0,k.__metadata)("design:type",Number)],H.prototype,"totalMatches",void 0);(0,k.__decorate)([C(),(0,k.__metadata)("design:type",String)],H.prototype,"context",void 0);(0,k.__decorate)([C(),(0,k.__metadata)("design:type",String)],H.prototype,"type",void 0);(0,k.__decorate)([C(),(0,k.__metadata)("design:type",String)],H.prototype,"message",void 0);(0,k.__decorate)([C({type:"any"}),(0,k.__metadata)("design:type",Object)],H.prototype,"payload",void 0);(0,k.__decorate)([C({type:"object"}),(0,k.__metadata)("design:type",Array)],H.prototype,"errors",void 0);H=(0,k.__decorate)([ie({name:"OperationResult",description:"Operation result"}),(0,k.__metadata)("design:paramtypes",[Object])],H);(function(o){function e(t){var i;let r=(i=class extends o{constructor(...s){super(...s)}},a(i,"OperationResult_"),i);return(0,k.__decorate)([C({type:t,required:!0}),(0,k.__metadata)("design:type",Object)],r.prototype,"payload",void 0),r=(0,k.__decorate)([ie({embedded:!0}),(0,k.__metadata)("design:paramtypes",[Object])],r),r}a(e,"forPayload"),o.forPayload=e})(H||(H={}));var Ce=require("tslib"),jr=require("valgen");var vc=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,Jt,pt=(Jt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=jr.vg.matches(vc,{formatName:"time",coerce:!0}),r=[];return e.minValue!=null&&r.push(jr.vg.isGte(e.minValue)),e.maxValue!=null&&r.push(jr.vg.isLte(e.maxValue)),r.length>0?jr.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){return this[T](e)}},a(Jt,"TimeType"),Jt);(0,Ce.__decorate)([u.Attribute({description:"Minimum value"}),(0,Ce.__metadata)("design:type",String)],pt.prototype,"minValue",void 0);(0,Ce.__decorate)([u.Attribute({description:"Maximum value"}),(0,Ce.__metadata)("design:type",String)],pt.prototype,"maxValue",void 0);pt=(0,Ce.__decorate)([u({name:"time",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])],pt);var Ei=require("tslib"),cs=require("valgen");var Wt,Cr=(Wt=class{constructor(e){e&&Object.assign(this,e)}[T](){return cs.vg.isURL({coerce:!0})}[g](){return cs.vg.isURL({coerce:!0})}},a(Wt,"UrlType"),Wt);Cr=(0,Ei.__decorate)([u({name:"url",description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),(0,Ei.__metadata)("design:paramtypes",[Object])],Cr);var Qt=require("tslib"),ls=require("valgen");var Yt,Gt=(Yt=class{constructor(e){e&&Object.assign(this,e)}[T](e){return ls.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}[g](e){return ls.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}},a(Yt,"UuidType"),Yt);(0,Qt.__decorate)([u.Attribute({description:"Version of the UUID"}),(0,Qt.__metadata)("design:type",Number)],Gt.prototype,"version",void 0);Gt=(0,Qt.__decorate)([u({name:"uuid",description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),(0,Qt.__metadata)("design:paramtypes",[Object])],Gt);var ka=Et(require("path-browserify"),1),ja=require("@jsopen/objects"),Ca=require("ts-gems");var Pa,La,fe=Symbol.for("kMap"),Ur=Symbol.for("kCtorMap"),fs=class fs{constructor(){this[Pa]=new v,this[La]=new WeakMap}get size(){return this[fe].size}forEach(e,t){this[fe].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[Ur].get(e);if(!t&&typeof e=="function"){let i=Reflect.getMetadata(d,e);t=i==null?void 0:i.name}if(!t&&typeof e=="object"){let i=e[d];t=i==null?void 0:i.name}if(!t)return;let r=this[fe].get(t);if(r)return typeof e=="function"&&r.kind==="ComplexType"?r.ctor===e?r:void 0:r}set(e,t){this[fe].set(e,t),t.ctor?this[Ur].set(t.ctor,e):t.instance&&this[Ur].set(t.instance,e)}has(e){if(e instanceof x)return!!e.name&&this[fe].has(e.name);let t=typeof e=="string"?e:this[Ur].get(e);return t?this[fe].has(t):!1}keys(){return this[fe].keys()}values(){return this[fe].values()}entries(){return this[fe].entries()}sort(e){return this[fe].sort(e),this}[(Pa=fe,La=Ur,Symbol.iterator)](){return this[fe][Symbol.iterator]()}};a(fs,"DataTypeMap");var oe=fs;function F(o,e){let t=a((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={...e,kind:m.HttpOperation.Kind},s=Reflect.getOwnMetadata(se,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let p of o)p(n);Reflect.defineMetadata(se,s,r.constructor)},"decorator");return t.Cookie=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"cookie",type:i}:{...i,name:r,location:"cookie"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="cookie"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.Header=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"header",type:i}:{...i,name:r,location:"header"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="header"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.QueryParam=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"query",type:i}:{...i,name:r,location:"query"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="query"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.PathParam=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i}:{...i,name:r,location:"path"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="path"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.Response=(r,i)=>{let n={...i,statusCode:r};return n.type&&(n.contentType=n.contentType||D.opra_response_json,n.contentEncoding=n.contentEncoding||"utf-8"),n.contentType===D.opra_response_json&&(n.contentEncoding=n.contentEncoding||"utf-8"),o.push(s=>{s.responses=s.responses||[],s.responses.push(n)}),t},t.RequestContent=function(r){let i=typeof r=="object"?r:{type:r};return i.type&&(i.contentType=i.contentType||D.json,i.contentEncoding=i.contentEncoding||"utf-8"),o.push(n=>{n.requestBody=n.requestBody||{required:!0,content:[]},n.requestBody.content=n.requestBody.content||[],n.requestBody.content.push(i)}),t},t.MultipartContent=function(r,i){let n={...r,contentType:(r==null?void 0:r.contentType)||"multipart/form-data"};if(o.push(s=>{s.requestBody=s.requestBody||{required:!0,content:[]},s.requestBody.content=s.requestBody.content||[],s.requestBody.content.push(n)}),i){let s={Field(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"field",...c}),s},File(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"file",...c}),s}};i(s)}return t},t.UseType=(...r)=>(o.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(F,"HttpOperationDecoratorFactory");var b=a(function(...o){if(!this){let[i]=o,n=[];return b[N].call(void 0,n,i)}let[e,t]=o;if(A.call(this,e),!$.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,Ca.asMutable)(this);r.parameters=[],r.responses=[],r.types=r.node[q]=new oe,r.name=t.name,r.path=t.path,r.mergePath=t.mergePath,r.method=t.method||"GET",r.description=t.description,r.composition=t.composition,r.compositionOptions=t.compositionOptions?M(t.compositionOptions):void 0},"HttpOperation"),us=class us extends A{findParameter(e,t){let r=e.toLowerCase(),i;for(i of this.parameters)if(!(t&&t!==i.location)&&(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e)))return i}getFullUrl(){let e=this.owner.getFullUrl();return e?this.path?this.mergePath?e+this.path:ka.default.posix.join(e,this.path):e:this.path||"/"}toJSON(e){var r;let t=(0,ja.omitUndefined)({kind:m.HttpOperation.Kind,description:this.description,method:this.method,path:this.path,mergePath:this.mergePath,composition:this.composition,requestBody:(r=this.requestBody)==null?void 0:r.toJSON(e)});if(this.types.size){t.types={};for(let i of this.types.values())t.types[i.name]=i.toJSON(e)}if(this.parameters.length){t.parameters=[];for(let i of this.parameters)t.parameters.push(i.toJSON(e))}return this.responses.length&&(t.responses=this.responses.map(i=>i.toJSON(e))),t}};a(us,"HttpOperationClass");var ms=us;b.prototype=ms.prototype;b[N]=F;b.GET=function(o){return F([],{...o,method:"GET"})};b.DELETE=function(o){return F([],{...o,method:"DELETE"})};b.HEAD=function(o){return F([],{...o,method:"HEAD"})};b.OPTIONS=function(o){return F([],{...o,method:"OPTIONS"})};b.PATCH=function(o){return F([],{...o,method:"PATCH"})};b.POST=function(o){return F([],{...o,method:"POST"})};b.PUT=function(o){return F([],{...o,method:"PUT"})};b.SEARCH=function(o){return F([],{...o,method:"SEARCH"})};b.Entity={};function Y(o){if(typeof o=="string")return o;let e=Reflect.getMetadata(d,o);if(!e)throw new TypeError(`Type (${o}) 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")}a(Y,"getDataTypeName");function Ue(o,e){return(t,r)=>{let i=typeof r=="string"||typeof r=="function"?{name:t,location:"path",type:r,keyParam:!0}:{...r,name:t,location:"path",keyParam:!0};return o.PathParam(t,i),e.push(n=>{var s;(s=n.path)!=null&&s.includes(":"+t)||(n.path=(n.path||"")+"@:"+t),n.mergePath=!0}),o}}a(Ue,"createKeyParamDecorator");function Ua(o,e){return(...t)=>{let r=typeof t[0]=="object"?t[0]:t.reduce((s,p)=>{let c=p.split(":");return s[c[0]]=c[1]||c[0],s},{}),i=Object.keys(r).reduce((s,p)=>{let c=Mt.exec(p),l=Mt.exec(r[p]);return c&&l&&(s[c[2]]=l[2]),s},{}),n=Object.keys(r).reduce((s,p)=>{let c=Mt.exec(p);return c&&(c[1]!="-"&&(s[c[2]]=c[2]),c[1]!="+"&&(s["-"+c[2]]="-"+c[2])),s},{});return e.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.sortFields=i}),o.QueryParam("sort",{description:"Determines sort fields",type:re(n),isArray:!0,arraySeparator:",",parser:a(s=>s.map(p=>{let c=Mt.exec(p);return c?(c[1]||"")+i[c[2]]:p}),"parser")}),o}}a(Ua,"createSortFieldsDecorator");function $e(o,e,t){let r=Reflect.getMetadata("FilterRules",o);r||(r=new gt,Reflect.defineMetadata("FilterRules",r,o));let i=Reflect.getMetadata("FilterType",o);return i||(i=new Ae({dataType:t}),i.rules={},Reflect.defineMetadata("FilterType",i,o)),(n,s)=>{let p=(Array.isArray(s)?{operators:s}:typeof s=="string"?{operators:s.split(/\s*,\s*/)}:s)||{};if(p.operators=p.operators||["=","!="],n.includes(":")){let c=n.split(":");n=c[0],p.mappedField=c[1]}return e.push(()=>{r.set(n,p),i.rules=r.toJSON()}),o.QueryParam("filter",{type:i,description:"Determines filter fields"}),o}}a($e,"createFilterDecorator");b.Entity.Create=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.CREATED,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the created resource.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=Y(t.type)}),i};b.Entity.Delete=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"DELETE",...t,composition:"Entity.Delete"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=Y(t.type)}),i.KeyParam=Ue(i,r),i};b.Entity.DeleteMany=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=Y(t.type)}),i.Filter=$e(i,r,t.type),i};var _i=require("tslib"),ds=require("valgen");var Xt,$r=(Xt=class{constructor(e){e&&Object.assign(this,e)}[T](){return ds.isAny}[g](){return ds.isAny}},a(Xt,"AnyType"),Xt);$r=(0,_i.__decorate)([u({name:"any",description:"Represents any value"}),(0,_i.__metadata)("design:paramtypes",[Object])],$r);var xi=require("tslib"),lt=require("valgen");var qe=require("tslib"),ct=require("valgen");var Zt,he=(Zt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=[];return e.minValue!=null&&t.push(ct.vg.isGte(e.minValue)),e.maxValue!=null&&t.push(ct.vg.isLte(e.maxValue)),t.length>0?ct.vg.pipe([ct.toNumber,...t],{returnIndex:0}):ct.toNumber}[g](e){return this[T](e)}},a(Zt,"NumberType"),Zt);(0,qe.__decorate)([u.Attribute({description:"Determines the minimum value"}),(0,qe.__metadata)("design:type",Number)],he.prototype,"minValue",void 0);(0,qe.__decorate)([u.Attribute({description:"Determines the maximum value"}),(0,qe.__metadata)("design:type",Number)],he.prototype,"maxValue",void 0);he=(0,qe.__decorate)([u({name:"number",description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),(0,qe.__metadata)("design:paramtypes",[Object])],he);var Ht,qr=(Ht=class extends he{constructor(e){super(e)}[T](e){let t=[];return e.minValue!=null&&t.push(lt.vg.isGte(e.minValue)),e.maxValue!=null&&t.push(lt.vg.isLte(e.maxValue)),t.length>0?lt.vg.pipe([lt.toBigint,...t],{returnIndex:0}):lt.toBigint}[g](e){return this[T](e)}},a(Ht,"BigintType"),Ht);qr=(0,xi.__decorate)([u({name:"bigint",description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),(0,xi.__metadata)("design:paramtypes",[Object])],qr);var Oi=require("tslib"),hs=require("valgen");var er,Br=(er=class{constructor(e){e&&Object.assign(this,e)}[T](){return hs.toBoolean}[g](){return hs.toBoolean}},a(er,"BooleanType"),er);Br=(0,Oi.__decorate)([u({name:"boolean",description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),(0,Oi.__metadata)("design:paramtypes",[Object])],Br);var gi=require("tslib"),ft=require("valgen");var tr,Be=(tr=class extends he{constructor(e){super(e)}[T](e){let t=[];return e.minValue!=null&&t.push(ft.vg.isGte(e.minValue)),e.maxValue!=null&&t.push(ft.vg.isLte(e.maxValue)),t.length>0?ft.vg.pipe([ft.toInteger,...t],{returnIndex:0}):ft.toInteger}[g](e){return this[T](e)}},a(tr,"IntegerType"),tr);Be=(0,gi.__decorate)([u({name:"integer",description:"An integer number",nameMappings:{js:"number",json:"number"}}),(0,gi.__metadata)("design:paramtypes",[Object])],Be);var wi=require("tslib"),ys=require("valgen");var rr,Kr=(rr=class{constructor(e){e&&Object.assign(this,e)}[T](){return ys.isNull}[g](){return ys.isNull}},a(rr,"NullType"),rr);Kr=(0,wi.__decorate)([u({name:"null",description:"A Null value",nameMappings:{js:"null",json:"null"}}),(0,wi.__metadata)("design:paramtypes",[Object])],Kr);var Ri=require("tslib");var ir,Vr=(ir=class{constructor(e){e&&Object.assign(this,e)}},a(ir,"ObjectType"),ir);Vr=(0,Ri.__decorate)([ie({name:"object",description:"A non modelled object",additionalFields:!0}),(0,Ri.__metadata)("design:paramtypes",[Object])],Vr);var me=require("tslib"),Ke=require("valgen");var or,be=(or=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(d,Object.getPrototypeOf(this).constructor).name),t.push(Ke.vg.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(Ke.vg.lengthMin(e.minLength)),e.maxLength&&t.push(Ke.vg.lengthMax(e.maxLength)),t.length>0?Ke.vg.pipe([Ke.toString,...t],{returnIndex:0}):Ke.toString}[g](e){return this[T](e)}},a(or,"StringType"),or);(0,me.__decorate)([u.Attribute({description:"Regex pattern to be used for validation"}),(0,me.__metadata)("design:type",Object)],be.prototype,"pattern",void 0);(0,me.__decorate)([u.Attribute({description:"Name of the pattern"}),(0,me.__metadata)("design:type",String)],be.prototype,"patternName",void 0);(0,me.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,me.__metadata)("design:type",Number)],be.prototype,"minLength",void 0);(0,me.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,me.__metadata)("design:type",Number)],be.prototype,"maxLength",void 0);be=(0,me.__decorate)([u({name:"string",description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),(0,me.__metadata)("design:paramtypes",[Object])],be);b.Entity.FindMany=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"GET",...t,composition:"Entity.FindMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains list of resources.',contentType:D.opra_response_json,type:t.type,partial:"deep",isArray:!0}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}).QueryParam("limit",{description:"Determines number of returning instances",type:new Be({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new Be({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=Y(t.type),t.defaultLimit&&(s.defaultLimit=t.defaultLimit),t.defaultProjection&&(s.defaultProjection=t.defaultProjection),t.maxLimit&&(s.maxLimit=t.maxLimit)}),i.Filter=$e(i,r,t.type),i.DefaultSort=(...n)=>(r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.defaultSort=n}),i),i.SortFields=Ua(i,r),i};b.Entity.Get=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"GET",...t,composition:"Entity.Get"});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=Y(t.type)}),i.KeyParam=Ue(i,r),i};b.Entity.Replace=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"POST",...t,composition:"Entity.Replace"});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=Y(t.type)}),i.KeyParam=Ue(i,r),i};b.Entity.Update=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"PATCH",...t,composition:"Entity.Update",requestBody:{partial:"deep",immediateFetch:!0,allowPatchOperators:!0,keepKeyFields:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=Y(t.type)}),i.KeyParam=Ue(i,r),i.Filter=$e(i,r,t.type),i};b.Entity.UpdateMany=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"PATCH",...t,composition:"Entity.UpdateMany",requestBody:{immediateFetch:!0,partial:"deep",allowPatchOperators:!0,keepKeyFields:!0,...t.requestBody,required:!0}});return i.RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=Y(t.type)}),i.Filter=$e(i,r,t.type),i};var Ai=require("@jsopen/objects");var Mc=/^(.*)(Controller)$/,$a=[];function nr(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=Mc.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(ae,Object.getPrototypeOf(r));s&&(0,Ai.merge)(n,s,{deep:!0});let p=Reflect.getOwnMetadata(ae,r);p&&(0,Ai.merge)(n,p,{deep:!0}),(0,Ai.merge)(n,{...o,kind:m.RpcController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(ae,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(ae,n,r)},"decorator");return t.Header=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,type:i}:{...i,name:r};n.headers=n.headers||[],n.headers.push(s)}),t),t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),$a.forEach(r=>r(t,e,o)),t}a(nr,"RpcControllerDecoratorFactory");nr.augment=function(o){$a.push(o)};var qa=require("@jsopen/objects");var Ba=[];function zr(o,e,t){let r=!1,i=a((n,s)=>{if(typeof s!="string")throw new TypeError("Symbol properties can not be decorated");let p={kind:m.RpcOperation.Kind,channel:s,payloadType:e,...(0,qa.omit)(t,["kind","payloadType"])},c=Reflect.getOwnMetadata(ae,n.constructor)||{};c.operations=c.operations||{},c.operations[s]=p;for(let l of o)l(p,n,s);Reflect.defineMetadata(ae,c,n.constructor)},"decorator");return i.UseType=(...n)=>(o.push(s=>{s.types=s.types||[],s.types.push(...n)}),i),i.Header=(n,s)=>(o.push(p=>{let c=typeof s=="string"||typeof s=="function"?{name:n,type:s}:{...s,name:n},l=r?p.response:p;l.headers?l.headers=l.headers.filter(O=>String(O.name)!==String(n)):l.headers=[],l.headers.push(c)}),i),i.Response=(n,s)=>(o.push(p=>{r=!0,p.response={...s,payloadType:n}}),i),Ba.forEach(n=>n(i,o,e,t)),i}a(zr,"RpcOperationDecoratorFactory");zr.augment=function(o){Ba.push(o)};var t3=require("reflect-metadata"),Ka=require("@jsopen/objects"),Va=require("ts-gems");function bi(o,e){let t=o==null?void 0:o.map(i=>String(i).toLowerCase()),r=e==null?void 0:e.map(i=>String(i).toLowerCase());return i=>r&&r.includes(i.toLowerCase())?!1:t?t.includes(i.toLowerCase()):!0}a(bi,"getIsInheritedPredicateFn");var Ve=a(function(...o){var n;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;U.call(this,e,t,r);let i=(0,Va.asMutable)(this);if(i.kind=m.MappedType.Kind,t.base){if(!(t.base instanceof U))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base,i.ctor=t.ctor||i.base.ctor,t.pick?i.pick=t.pick.map(l=>i.base.normalizeFieldPath(l)):t.omit?i.omit=t.omit.map(l=>i.base.normalizeFieldPath(l)):t.partial?i.partial=Array.isArray(t.partial)?t.partial.map(l=>i.base.normalizeFieldPath(l)):t.partial:t.required&&(i.required=Array.isArray(t.required)?t.required.map(l=>i.base.normalizeFieldPath(l)):t.required);let s=bi(i.pick,i.omit),p=Array.isArray(i.partial)?i.partial.map(l=>l.toLowerCase()):i.partial,c=Array.isArray(i.required)?i.required.map(l=>l.toLowerCase()):i.required;for(let[l,O]of i.base.fieldEntries("*")){if(!s(l))continue;let w={...O};p===!0||Array.isArray(p)&&p.includes(O.name.toLowerCase())?w.required=!1:(c===!0||Array.isArray(c)&&c.includes(O.name.toLowerCase()))&&(w.required=!0);let E=new C(this,w);i._fields.set(E.name,E)}(!i.pick||i.base.additionalFields===!1||Array.isArray(i.base.additionalFields)&&((n=i.base.additionalFields)==null?void 0:n[0])==="error")&&(i.additionalFields=i.base.additionalFields),t.base.keyField&&s(t.base.keyField)&&(i.keyField=t.base.keyField),i.discriminatorField=t.base.discriminatorField,i.discriminatorValue=t.base.discriminatorValue}},"MappedType"),Es=class Es extends U{extendsFrom(e){var t;return e instanceof x||(e=this.node.getDataType(e)),e instanceof U?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return(0,Ka.omitUndefined)({...t,base:r||this.base.toJSON(e),kind:this.kind,pick:this.pick,omit:this.omit,partial:this.partial,required:this.required,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Es,"MappedTypeClass");var Ts=Es;Ve.prototype=Ts.prototype;Ve._applyMixin=()=>{};var c3=require("reflect-metadata"),za=require("@jsopen/objects"),Ja=require("ts-gems");var mt=a(function(...o){if(!this)return mt[N].apply(void 0,o);let[e,t,r]=o;U.call(this,e,t,r);let i=(0,Ja.asMutable)(this);i.kind=m.MixinType.Kind,i.types=[];for(let n of t.types){i.additionalFields!==!0&&(n.additionalFields===!0?i.additionalFields=!0:i.additionalFields||(i.additionalFields=n.additionalFields));for(let s of n.fields("*")){let p=new C(this,s);i._fields.set(p.name,p)}i.types.push(n),n.keyField&&(i.keyField=n.keyField)}},"MixinType"),xs=class xs extends U{extendsFrom(e){if(e instanceof x||(e=this.node.getDataType(e)),!(e instanceof U))return!1;if(e===this)return!0;for(let t of this.types)if(t.extendsFrom(e))return!0;return!1}toJSON(e){let t=super.toJSON(e);return(0,za.omitUndefined)({...t,kind:this.kind,types:this.types.map(r=>{let i=this.node.getDataTypeNameWithNs(r);return i||r.toJSON(e)})})}_locateBase(e){for(let t of this.types){if(e(t))return t;if(t._locateBase){let r=t._locateBase(e);if(r)return r}}}};a(xs,"MixinTypeClass");var _s=xs;mt.prototype=_s.prototype;mt[N]=Lc;function Lc(o,e){if(o=o.filter(n=>typeof n=="function"),!o.length)throw new TypeError("No Class has been provided");if(o.length===1)return o[0];let t=o[0].name+"Mixin",r={[t]:class{constructor(){for(let n of o)Er(this,n)}}}[t],i={...e,kind:m.MixinType.Kind,types:[]};Reflect.defineMetadata(d,i,r);for(let n of o){let s=Reflect.getMetadata(d,n);if(!(s&&(s.kind===m.ComplexType.Kind||s.kind===m.MixinType.Kind||s.kind===m.MappedType.Kind)))throw new TypeError(`Class "${n.name}" is not a ${m.ComplexType.Kind}, ${m.MixinType.Kind} or ${m.MappedType.Kind}`);i.types.push(n),Tr(r.prototype,n.prototype)}return r}a(Lc,"MixinTypeFactory");var _3=require("reflect-metadata"),Wa=require("@jsopen/objects"),Ya=require("ts-gems"),Os=require("valgen");var ut=a(function(...o){if(!this)return ut[N].apply(void 0,o);let[e,t,r]=o;x.call(this,e,t,r);let i=(0,Ya.asMutable)(this);i.kind=m.UnionType.Kind,i.discriminator=t.discriminator,i.types=[];for(let n of t.types)i.types.push(n)},"UnionType"),ws=class ws extends x{toJSON(e){let t=super.toJSON(e);return(0,Wa.omitUndefined)({...t,kind:this.kind,discriminator:this.discriminator,types:this.types.map(r=>{let i=this.node.getDataTypeNameWithNs(r);return i||r.toJSON(e)})})}generateCodec(e,t){let r=this.types.map(i=>{let n=i.generateCodec(e,t);return(i.kind===m.ComplexType.Kind||i.kind===m.MappedType.Kind)&&i.discriminatorField?[n,{[i.discriminatorField]:Os.vg.isEqual(i.discriminatorValue)}]:n});return Os.vg.oneOf(r)}extendsFrom(){return!1}_locateBase(){}};a(ws,"UnionTypeClass");var gs=ws;ut.prototype=gs.prototype;ut[N]=kc;function kc(o,e){let i=class i{};a(i,"UnionClass");let t=i,r={...e,kind:m.UnionType.Kind,types:o};return Reflect.defineMetadata(d,r,t),t}a(kc,"UnionTypeFactory");var Rs=Symbol("initializing"),Di=class Di{static async createDataType(e,t,r){e=e||new de({maxErrors:0});let i=await this._importDataTypeArgs(e,t,r);if(i)return typeof i=="string"?t.node.getDataType(i):this._createDataType(e,t,i)}static async resolveDataType(e,t,r){if(r){let i=t.node.findDataType(r);if(i)return i}if(typeof r=="object"||typeof r=="function"){let i=await Di.createDataType(e,t,r);if(i)return i}if(r){let i=t.node.getDataType(r);if(i)return i}return t.node.getDataType("any")}static async addDataTypes(e,t,r){let i=t.node[q];if(!i)throw new TypeError("DocumentElement should has [kDataTypeMap] property");let n=await this.createAllDataTypes(e,t,r);if(n)for(let s of n)s!=null&&s.name&&i.set(s.name,s)}static async createAllDataTypes(e,t,r){e=e||new de({maxErrors:0});let i=await this._prepareAllInitArgs(e,t,r);if(!i)return;let n=new v;for(let c of i)n.set(c.name,c);let s=e.extend({initArgsMap:n}),p=[];for(let[c,l]of n.entries())e.enter(`[${c}]`,()=>{if(!n.has(c))return;let O=this._createDataType(s,t,l);O&&p.push(O)});return p}static async _prepareAllInitArgs(e,t,r){let i=new v,n=new v,s=e.extend({owner:t,importQueue:i,initArgsMap:n});if(!t.node[q])throw new TypeError("DocumentElement should has [kDataTypeMap] property");if(Array.isArray(r)){let p=0;for(let c of r)await s.enterAsync(`$[${p++}]`,async()=>{c=await ue(c);let l=Reflect.getMetadata(d,c)||c[d];if(!(l&&l.name))return typeof c=="function"?s.addError(`Class "${c.name}" doesn't have a valid data type metadata`):s.addError("Object doesn't have a valid data type metadata");i.set(l.name,c)})}else{let p,c;for([c,p]of Object.entries(r))p=await ue(p),i.set(c,typeof p=="object"?{...p,name:c}:p)}for(let p of Array.from(i.keys())){if(!i.has(p))continue;let c=await this._importDataTypeArgs(s,t,p);c&&typeof c!="string"&&s.addError("Embedded data type can't be loaded into document node directly")}return Array.from(n.values())}static async _importDataTypeArgs(e,t,r,i){var w;r=await ue(r);let{importQueue:n,initArgsMap:s}=e,p=t.node.findDataType(r);if(p instanceof x)return p.name;let c,l,O;if(typeof r!="string"){let ee=t.node.getDocument().types[_r].get(r);ee&&(r=ee)}if(typeof r=="string"){let E=r;if(r=(n==null?void 0:n.get(E))||((w=e.initArgsMap)==null?void 0:w.get(E)),!r)return e.addError(`Unknown data type (${E})`)}if(typeof r=="function"){if(c=Reflect.getMetadata(d,r),!c)return e.addError(`Class "${r.name}" doesn't have a valid DataType metadata`);l=r}else if(typeof r=="object"){if(c=r[d],c)O=r,c.kind!==m.EnumType.Kind&&(c=void 0);else if(m.isDataType(r))c=r,l=c.ctor;else if(l=Object.getPrototypeOf(r).constructor,c=l&&Reflect.getMetadata(d,l),c&&c.kind===m.SimpleType.Kind){let E=await this._importDataTypeArgs(e,t,c.name);return E?typeof E=="object"&&E.kind!==m.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:m.SimpleType.Kind,name:void 0,base:E,properties:r}:void 0}}return c?e.enterAsync(c.name?`[${c.name}]`:"",async()=>{if(c.name){let ee=s==null?void 0:s.get(c.name);if(ee)return i&&ee[Rs]?e.addError("Circular reference detected"):c.name}let E={kind:c.kind,name:c.name};E[Rs]=!0;try{if(E.name)if(n!=null&&n.has(E.name))s==null||s.set(c.name,E),E._instance={name:c.name},E[q]=t.node[q];else return e.addError(`Data Type (${E.name}) must be explicitly added to type list in the document scope`);switch(E.kind){case m.ComplexType.Kind:E.ctor=l,await this._prepareComplexTypeArgs(e,t,E,c);break;case m.EnumType.Kind:E.instance=O,await this._prepareEnumTypeArgs(e,t,E,c);break;case m.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,E,c);break;case m.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,E,c);break;case m.SimpleType.Kind:E.ctor=l,await this._prepareSimpleTypeArgs(e,t,E,c);break;case m.UnionType.Kind:await this._prepareUnionTypeArgs(e,t,E,c);break;default:return e.addError(`Invalid data type kind ${c.kind}`)}}finally{E.name&&(n==null||n.delete(E.name)),delete E[Rs]}return n&&E.name?E.name:E}):e.addError("No DataType metadata found")}static async _prepareDataTypeArgs(e,t,r){t.description=r.description,t.abstract=r.abstract,t.examples=r.examples,t.scopePattern=r.scopePattern}static async _prepareComplexTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.keyField=i.keyField,r.discriminatorField=i.discriminatorField,r.discriminatorValue=i.discriminatorValue,await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=ze(n),r.ctor=r.ctor||n.ctor)}),i.additionalFields!=null&&(typeof i.additionalFields=="boolean"||Array.isArray(i.additionalFields)?r.additionalFields=i.additionalFields:await e.enterAsync(".additionalFields",async()=>{let n=await this._importDataTypeArgs(e,t,i.additionalFields);n&&(r.additionalFields=ze(n))})),i.fields&&(r.fields={},await e.enterAsync(".fields",async()=>{for(let[n,s]of Object.entries(i.fields))await e.enterAsync(`[${n}]`,async()=>{let p=typeof s=="string"?{type:s}:s;if(p.isArray&&!p.type)return e.addError('"type" must be defined explicitly for array fields');let c=await this._importDataTypeArgs(e,t,p.type||"any");c&&(r.fields[n]={...p,type:ze(c)})})}))}static async _prepareEnumTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),i.base&&await e.enterAsync(".base",async()=>{let n=await this._importDataTypeArgs(e,t,i.base);n&&(r.base=ze(n))}),r.attributes=M(i.attributes)}static async _prepareSimpleTypeArgs(e,t,r,i){var n,s,p,c;await this._prepareDataTypeArgs(e,r,i),await e.enterAsync(".base",async()=>{let l;if(i.base)l=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let O=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,O)&&(l=await this._importDataTypeArgs(e,t,O))}l&&(r.base=ze(l),r.ctor=r.ctor||l.ctor)}),r.properties=i.properties,r.nameMappings=i.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),i.attributes&&(r.attributes=M(i.attributes)),typeof((n=r.properties)==null?void 0:n[T])=="function"&&(r.generateDecoder=(s=r.properties)==null?void 0:s[T].bind(r.properties)),typeof((p=r.properties)==null?void 0:p[g])=="function"&&(r.generateEncoder=(c=r.properties)==null?void 0:c[g].bind(r.properties))}static async _prepareMappedTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.discriminatorField=i.discriminatorField,r.discriminatorValue=i.discriminatorValue,await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=ze(n),r.ctor=r.ctor||n.ctor)}),i.pick?r.pick=[...i.pick]:i.omit?r.omit=[...i.omit]:i.partial?r.partial=Array.isArray(i.partial)?[...i.partial]:i.partial:i.required&&(r.required=Array.isArray(i.required)?[...i.required]:i.required)}static async _prepareMixinTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.types=[],await e.enterAsync(".types",async()=>{let n=i.types,s=0;for(let p of n)await e.enterAsync(`[${s++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(ze(c))})})}static async _prepareUnionTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.types=[],await e.enterAsync(".types",async()=>{let n=i.types,s=0;for(let p of n)await e.enterAsync(`[${s++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(ze(c))})})}static _createDataType(e,t,r){var s;let i=t.node.findDataType(typeof r=="string"?r:r.name||"");if(i instanceof x)return i;let n=typeof r=="string"?(s=e.initArgsMap)==null?void 0:s.get(r):r;if(n){let p=n[q];switch(p||delete n._instance,i=n._instance,i!=null&&i.name&&p&&p.set(i.name,i),n==null?void 0:n.kind){case m.ComplexType.Kind:return this._createComplexType(e,t,n);case m.EnumType.Kind:return this._createEnumType(e,t,n);case m.MappedType.Kind:return this._createMappedType(e,t,n);case m.MixinType.Kind:return this._createMixinType(e,t,n);case m.SimpleType.Kind:return this._createSimpleType(e,t,n);case m.UnionType.Kind:return this._createUnionType(e,t,n);default:break}}e.addError(`Unknown data type (${String(r)})`)}static _createComplexType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ie.prototype);let n=M(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),r.additionalFields&&e.enter(".additionalFields",()=>{typeof r.additionalFields=="boolean"||Array.isArray(r.additionalFields)?n.additionalFields=r.additionalFields:n.additionalFields=this._createDataType(e,t,r.additionalFields)}),n.fields={},r.fields&&e.enter(".fields",()=>{for(let[s,p]of Object.entries(r.fields))e.enter(`[${s}]`,()=>{let c=this._createDataType(e,t,p.type);c&&(n.fields[s]={...p,name:s,type:c})})}),ie.apply(i,[t,n]),i}static _createEnumType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,re.prototype);let n=M(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),n.attributes=r.attributes,re.apply(i,[t,n]),i}static _createMappedType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Ve.prototype);let n=M(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),Ve.apply(i,[t,n]),i}static _createMixinType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,mt.prototype);let n=M(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let p of r.types)e.enter(`[${s++}]`,()=>{let c=this._createDataType(e,t,p);if(!(c instanceof U))throw new TypeError(`"${c==null?void 0:c.kind}" can't be set as base for a "${n.kind}"`);n.types.push(c)})}),mt.apply(i,[t,n]),i}static _createSimpleType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,u.prototype);let n=M(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),u.apply(i,[t,n]),i}static _createUnionType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ut.prototype);let n=M(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let p of r.types)e.enter(`[${s++}]`,()=>{let c=this._createDataType(e,t,p);n.types.push(c)})}),ut.apply(i,[t,n]),i}};a(Di,"DataTypeFactory");var P=Di;function ze(o){return typeof o=="object"&&o.name?o.name:o}a(ze,"preferName");var cp=require("@jsopen/objects");var Ga=require("@jsopen/objects");var As=class As extends A{constructor(e){super(e.owner),this.name="OpraApi",this.name=e.name,this.description=e.description}toJSON(e){return(0,Ga.omitUndefined)({transport:this.transport,name:this.name,description:this.description})}async _initialize(e,t){if(!$.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};a(As,"ApiBase");var dt=As;var Qa=Et(require("path-browserify"),1),Xa=require("@jsopen/objects"),Za=require("ts-gems");var sr=require("@jsopen/objects");var Cc=/^(.*)(Controller)$/;function bs(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=Cc.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(se,Object.getPrototypeOf(r));s&&(0,sr.merge)(n,s,{deep:!0});let p=Reflect.getOwnMetadata(se,r);p&&(0,sr.merge)(n,p,{deep:!0}),(0,sr.merge)(n,{kind:m.HttpController.Kind,name:i,path:i,...(0,sr.omit)(o,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(se,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(se,n,r)},"decorator");return t.Cookie=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"cookie",type:i}:{...i,name:r,location:"cookie"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.Header=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"header",type:i}:{...i,name:r,location:"header"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.QueryParam=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"query",type:i}:{...i,name:r,location:"query"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.PathParam=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i}:{...i,name:r,location:"path"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.KeyParam=(r,i)=>(e.push(n=>{var p;(p=n.path)!=null&&p.includes(":"+r)||(n.path=(n.path||"")+"@:"+r);let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i,keyParam:!0}:{...i,name:r,location:"path",keyParam:!0};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(bs,"HttpControllerDecoratorFactory");var ne=a(function(...o){var i;if(!this)return ne[N].apply(void 0,o);let[e,t]=o;if(A.call(this,e),!$.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,Za.asMutable)(this);r.kind=m.HttpController.Kind,r.types=r.node[q]=new oe,r.operations=new v,r.controllers=new v,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,(i=r._initialize)==null||i.call(r,t)},"HttpController"),Ns=class Ns extends A{get isRoot(){return!(this.owner instanceof ne)}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(),i;for(i of this.parameters)if(!(t&&t!==i.location)&&(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e)))return i;if(this.node.parent&&this.node.parent.element instanceof ne)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return Qa.default.posix.join(this.owner instanceof ne?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(e){let t=(0,Xa.omitUndefined)({kind:this.kind,description:this.description,path:this.path});if(this.operations.size){t.operations={};for(let r of this.operations.values())t.operations[r.name]=r.toJSON(e)}if(this.controllers.size){t.controllers={};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON(e)}if(this.types.size){t.types={};for(let r of this.types.values())t.types[r.name]=r.toJSON(e)}if(this.parameters.length){t.parameters=[];for(let r of this.parameters)t.parameters.push(r.toJSON(e))}return t}[St](){return`[${Ft}HttpController${vt+this.name+rt}]`}};a(Ns,"HttpControllerClass");var Ds=Ns;ne.prototype=Ds.prototype;Object.assign(ne,bs);ne[N]=bs;var Ss=class Ss extends dt{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="http",this.controllers=new v,this.url=e.url}findController(e){return ne.prototype.findController.call(this,e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(e){let r={...super.toJSON(),transport:this.transport,url:this.url,controllers:{}};for(let i of this.controllers.values())r.controllers[i.name]=i.toJSON(e);return r}};a(Ss,"HttpApi");var ht=Ss;var Ha=Et(require("@browsery/type-is"),1),ep=require("@jsopen/objects"),tp=require("ts-gems"),Ni=require("valgen");var De=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');A.call(this,o);let t=(0,tp.asMutable)(this);if(e.contentType){let r=Array.isArray(e.contentType)?e.contentType:[e.contentType];r=r.map(i=>i.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 x?e.type:t.owner.node.getDataType(e.type)),t.isArray=e.isArray},"HttpMediaType"),vs=class vs extends A{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(e){var i,n;let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0,r=(0,ep.omitUndefined)({description:this.description,contentType:this.contentType,contentEncoding:this.contentEncoding,type:t||((i=this.type)==null?void 0:i.toJSON(e)),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&&(r.multipartFields=this.multipartFields.map(s=>s.toJSON(e))),r}generateCodec(e,t){let r;return this.type?r=this.type.generateCodec(e,t):this.contentType&&(Array.isArray(this.contentType)?this.contentType:[this.contentType]).find(n=>Ha.default.is(n,["json"]))&&(r=this.node.findDataType("object").generateCodec(e)),r=r||Ni.isAny,this.isArray?Ni.vg.isArray(r):r}};a(vs,"HttpMediaTypeClass");var Fs=vs;De.prototype=Fs.prototype;var rp=require("@jsopen/objects");function ar(o,e){let t=o.lastIndexOf("/");if(o.startsWith("/")&&t){let r=o.substring(1,t),i=o.substring(t+1);if(e!=null&&e.includeFlags)for(let n of e.includeFlags)i.includes(n)||(i+=n);if(e!=null&&e.excludeFlags)for(let n of e.excludeFlags)i.replace(n,"");return new RegExp(r,i)}throw new TypeError(`"${o}" is not a valid RegExp string`)}a(ar,"parseRegExp");var Ms=class Ms extends De{constructor(e,t){super(e,t),this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?ar(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(e){return(0,rp.omitUndefined)({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON(e)})}};a(Ms,"HttpMultipartField");var Jr=Ms;var ip=require("@jsopen/objects");var Uc=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,Is=class Is{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=Uc.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}}};a(Is,"HttpStatusRange");var pr=Is;var Ps=class Ps extends De{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new pr(r.start,r.end):new pr(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(e){let t=this.statusCode.map(i=>i.toJSON()),r=(0,ip.omitUndefined)({...super.toJSON(e),statusCode:t.length===1&&typeof t[0]=="number"?t[0]:t,partial:this.partial});if(this.parameters.length){r.parameters=[];for(let i of this.parameters)r.parameters.push(i.toJSON(e))}return r}};a(Ps,"HttpOperationResponse");var Wr=Ps;var sp=require("@jsopen/objects"),ap=require("ts-gems");var op=require("@jsopen/objects"),np=require("ts-gems");var yt=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');A.call(this,o);let t=(0,np.asMutable)(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),ks=class ks extends A{toJSON(e){let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return(0,op.omitUndefined)({type:this.type?t||this.type.toJSON(e):"any",description:this.description,isArray:this.isArray,examples:this.examples})}};a(ks,"ValueClass");var Ls=ks;yt.prototype=Ls.prototype;var cr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');yt.call(this,o,e);let t=(0,ap.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?ar(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,t.parser=e.parser},"HttpParameter"),Cs=class Cs extends yt{toJSON(e){return(0,sp.omitUndefined)({...super.toJSON(e),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}};a(Cs,"HttpParameterClass");var js=Cs;cr.prototype=js.prototype;var pp=require("@jsopen/objects");var Us=class Us extends A{constructor(e){super(e),this.content=[]}toJSON(e){return(0,pp.omitUndefined)({description:this.description,required:this.required,maxContentSize:this.maxContentSize,content:this.content.length?this.content.map(t=>t.toJSON(e)):[],partial:this.partial,allowPatchOperators:this.allowPatchOperators})}};a(Us,"HttpRequestBody");var Yr=Us;var $s=class $s{static async createApi(e,t){let r=new ht(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{await this._createControllers(e,r,t.controllers)}),r}static async _createControllers(e,t,r){if(Array.isArray(r)){let i=0;for(let n of r){let s;await e.enterAsync(`[${i++}]`,async()=>{s=await this._resolveControllerMetadata(e,t,n)}),s&&await e.enterAsync(`[${s.metadata.name}]`,async()=>{let p=await this._createController(e,t,s.metadata,s.instance,s.ctor);p&&(t.controllers.get(p.name)&&e.addError(`Duplicate controller name (${s.name})`),t.controllers.set(p.name,p))})}return}for(let[i,n]of Object.entries(r))await e.enterAsync(`[${i}]`,async()=>{let s=await this._resolveControllerMetadata(e,t,n);if(!s)return;let p=await this._createController(e,t,{...s.metadata,name:i},s.instance,s.ctor);p&&(t.controllers.get(p.name)&&e.addError(`Duplicate controller name (${i})`),t.controllers.set(p.name,p))})}static async _resolveControllerMetadata(e,t,r){typeof r=="function"&&!(0,cp.isConstructor)(r)&&(r=t instanceof ne?r(t.instance):r()),r=await ue(r);let i,n,s;if(typeof r=="function"){if(n=Reflect.getMetadata(se,r),!n)return e.addError(`Class "${r.name}" doesn't have a valid HttpController metadata`);i=r}else i=Object.getPrototypeOf(r).constructor,n=Reflect.getMetadata(se,i),n?s=r:(n=r,r.instance==="object"&&(s=r.instance,i=Object.getPrototypeOf(s).constructor));return n?{metadata:n,instance:s,ctor:i}:e.addError(`Class "${i.name}" is not decorated with HttpController()`)}static async _createController(e,t,r,i,n){if(!r.name)throw new TypeError("Controller name required");let s=new ne(t,{...r,instance:i,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await P.addDataTypes(e,s,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let p=0;for(let c of r.parameters)await e.enterAsync(`[${p++}]`,async()=>{let l={...c};await e.enterAsync(".type",async()=>{l.type=await P.resolveDataType(e,s,c.type)});let O=new cr(s,l);s.parameters.push(O)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[p,c]of Object.entries(r.operations))await e.enterAsync(`[${p}]`,async()=>{let l=new b(s,{name:p,method:"GET"});await this._initHttpOperation(e,l,c),s.operations.set(p,l)})}),r.controllers&&await e.enterAsync(".controllers",async()=>{await this._createControllers(e,s,r.controllers)}),s}static async _initHttpOperation(e,t,r){let i={...r,name:t.name,types:void 0};return b.apply(t,[t.owner,i]),r.types&&await e.enterAsync(".types",async()=>{await P.addDataTypes(e,t,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let n=0;for(let s of r.parameters)await e.enterAsync(`[${n++}]`,async()=>{let p={...s};await e.enterAsync(".type",async()=>{p.type=await P.resolveDataType(e,t,s.type)});let c=new cr(t,p);t.parameters.push(c)})}),r.responses&&await e.enterAsync(".responses",async()=>{let n=0;for(let s of r.responses)await e.enterAsync(`[${n++}]`,async()=>{let p=new Wr(t,{statusCode:s.statusCode});await this._initHttpOperationResponse(e,p,s),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let n=new Yr(t);await this._initHttpRequestBody(e,n,r.requestBody),t.requestBody=n}),t}static async _initHttpMediaType(e,t,r){De.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{t.type=await P.resolveDataType(e,t,r.type)}),r.multipartFields&&await e.enterAsync(".multipartFields",async()=>{for(let i=0;i<r.multipartFields.length;i++)await e.enterAsync(`[${i}]`,async()=>{let n=r.multipartFields[i],s=new Jr(t,{fieldName:n.fieldName,fieldType:n.fieldType});await this._initHttpMediaType(e,s,n),t.multipartFields.push(s)})})}static async _initHttpOperationResponse(e,t,r){await this._initHttpMediaType(e,t,r),t.partial=r.partial,r.parameters&&await e.enterAsync(".parameters",async()=>{let i=0;for(let n of r.parameters)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await P.resolveDataType(e,t,n.type)});let p=new cr(t,s);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,t.allowPatchOperators=r.allowPatchOperators,t.keepKeyFields=r.keepKeyFields,r.content&&await e.enterAsync(".content",async()=>{for(let i=0;i<r.content.length;i++)await e.enterAsync(`[${i}]`,async()=>{let n=r.content[i],s=new De(t,String(i));await this._initHttpMediaType(e,s,n),t.content.push(s)})})}};a($s,"HttpApiFactory");var lr=$s;var fp=require("@jsopen/objects"),mp=require("super-fast-md5");var qs=class qs extends dt{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="rpc",this.controllers=new v,this.platform=e.platform}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values())if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;this._controllerReverseMap.set(e,null);return}return this.controllers.get(e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(){let t={...super.toJSON(),transport:this.transport,platform:this.platform,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};a(qs,"RpcApi");var Tt=qs;var lp,Bs=class Bs extends A{constructor(){super(null),this[lp]=new WeakMap,this.id="",this.info={},this.references=new v,this.types=new oe,this.node[q]=this.types,this.node.findDataType=this._findDataType.bind(this)}getDataTypeNs(e){let t=e instanceof x?this._findDataType(e.name||""):this._findDataType(e);if(t)return this[Oe].get(t)}findDocument(e){if(this.id===e)return this;for(let t of this.references.values()){if(t.id===e)return t;let r=t.findDocument(e);if(r)return r}}get httpApi(){if(!(this.api&&this.api instanceof ht))throw new TypeError("The document do not contains HttpApi instance");return this.api}get rpcApi(){if(!(this.api&&this.api instanceof Tt))throw new TypeError("The document do not contains RpcApi instance");return this.api}toJSON(){return this.export()}export(e){let t=(0,fp.omitUndefined)({spec:m.SpecVersion,id:this.id,url:this.url,info:M(this.info,!0)});if(this.references.size){let r=0,i={};for(let[n,s]of this.references.entries())s[Ne]||(i[n]={id:s.id,url:s.url,info:M(s.info,!0)},r++);r&&(t.references=i)}if(this.types.size){t.types={};for(let r of this.types.values())r.inScope(e==null?void 0:e.scope)&&(t.types[r.name]=r.toJSON(e))}return this.api&&(t.api=this.api.toJSON(e)),t}invalidate(){let e=this.export({});delete e.id,this.id=(0,mp.md5)(JSON.stringify(e)),this[Oe]=new WeakMap}_findDataType(e,t,r){let i=this.types.get(e);if(i&&i.inScope(t))return i;if(!this.references.size)return;if(typeof e=="string"){let s=co.exec(e);if(s){let p=s[1];if(p){let c=this.references.get(p);return c?(r=r||new WeakMap,r.set(this,!0),r.set(c,!0),c._findDataType(s[2],t,r)):void 0}e=s[2]}}r=r||new WeakMap,r.set(this,!0);let n=Array.from(this.references.keys()).reverse();for(let s of n){let p=this.references.get(s);if(i=p==null?void 0:p.types.get(e),i)return this[Oe].set(i,p!=null&&p[Ne]?"":s),i}for(let s of n){let p=this.references.get(s);if(r.set(p,!0),i=p._findDataType(e,t,r),i)return this[Oe].set(i,p!=null&&p[Ne]?"":s),i}}};a(Bs,"ApiDocument");var Je=Bs;lp=Oe;function We(o,e,t){let r=bi(e.pick,e.omit),i=typeof o=="string"?o.charAt(0).toUpperCase()+o.substring(1):o.name,n=(t==null?void 0:t.name)||i+"Mapped",s={[n]:class{constructor(){typeof o=="function"&&Er(this,o,r)}}}[n];if(typeof o=="function"&&Tr(s.prototype,o.prototype),typeof o=="function"){let c=Reflect.getOwnMetadata(d,o);if(!c)throw new TypeError(`Class "${o}" doesn't have datatype metadata information`);if(!(c.kind===m.ComplexType.Kind||c.kind===m.MappedType.Kind||c.kind===m.MixinType.Kind))throw new TypeError(`Class "${o}" is not a ${m.ComplexType.Kind}`)}let p={...t,kind:"MappedType",base:o};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(d,p,s),typeof o=="function"&&Ve._applyMixin(s,o,{...e,isInheritedPredicate:r}),s}a(We,"createMappedClass");function qc(o,e,t){return We(o,{omit:e},t)}a(qc,"OmitType");function Bc(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return We(o,{partial:t},r)}a(Bc,"PartialType");function Kc(o,e,t){return We(o,{pick:e},t)}a(Kc,"PickType");function Vc(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return We(o,{required:t},r)}a(Vc,"RequiredType");var xp=require("@jsopen/objects");var up=require("@jsopen/objects"),dp=require("ts-gems");var Ye=a(function(...o){var i;if(!this)return Ye[N].apply(void 0,o);let[e,t]=o;if(A.call(this,e),!$.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,dp.asMutable)(this);r.kind=m.RpcController.Kind,r.types=r.node[q]=new oe,r.operations=new v,r.headers=[],r.name=t.name,r.description=t.description,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(i=r._initialize)==null||i.call(r,t)},"RpcController"),Vs=class Vs extends A{findHeader(e,t){let r=e.toLowerCase(),i;for(i of this.headers)if(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e))return i;if(this.node.parent&&this.node.parent.element instanceof Ye)return this.node.parent.element.findHeader(e,t)}toString(){return`[RpcController ${this.name}]`}toJSON(){let e=(0,up.omitUndefined)({kind:this.kind,description:this.description});if(this.operations.size){e.operations={};for(let t of this.operations.values())e.operations[t.name]=t.toJSON()}if(this.types.size){e.types={};for(let t of this.types.values())e.types[t.name]=t.toJSON()}if(this.headers.length){e.headers=[];for(let t of this.headers)e.headers.push(t.toJSON())}return e}[St](){return`[${Ft}RpcController${vt+this.name+rt}]`}};a(Vs,"RpcControllerClass");var Ks=Vs;Ye.prototype=Ks.prototype;Object.assign(Ye,nr);Ye[N]=nr;var hp=require("@jsopen/objects"),yp=require("ts-gems");var fr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');yt.call(this,o,e);let t=(0,yp.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?ar(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.deprecated=e.deprecated,t.required=e.required},"RpcHeader"),Js=class Js extends yt{toJSON(){return(0,hp.omitUndefined)({...super.toJSON(),name:this.name,required:this.required,deprecated:this.deprecated})}};a(Js,"RpcHeaderClass");var zs=Js;fr.prototype=zs.prototype;var Tp=require("@jsopen/objects"),Ep=require("ts-gems");var mr=a(function(...o){if(!this){let[i,n]=o,s=[];return mr[N].call(void 0,s,i,n)}let[e,t]=o;if(A.call(this,e),!$.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,Ep.asMutable)(this);r.headers=[],r.types=r.node[q]=new oe,r.name=t.name,r.description=t.description,r.channel=t.channel,t!=null&&t.payloadType&&(r.payloadType=(t==null?void 0:t.payloadType)instanceof x?t.payloadType:r.owner.node.getDataType(t.payloadType)),t!=null&&t.keyType&&(r.keyType=(t==null?void 0:t.keyType)instanceof x?t.keyType:r.owner.node.getDataType(t.keyType))},"RpcOperation"),Ys=class Ys extends A{findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){var t;let e=(0,Tp.omitUndefined)({kind:m.RpcOperation.Kind,description:this.description,channel:this.channel,payloadType:this.payloadType.name?this.payloadType.name:this.payloadType.toJSON(),keyType:this.keyType?this.keyType.name?this.keyType.name:this.keyType.toJSON():void 0,response:(t=this.response)==null?void 0:t.toJSON()});if(this.headers.length){e.headers=[];for(let r of this.headers)e.headers.push(r.toJSON())}return e}};a(Ys,"RpcOperationClass");var Ws=Ys;mr.prototype=Ws.prototype;mr[N]=zr;var _p=require("@jsopen/objects");var Gs=class Gs extends A{constructor(e,t){super(e),this.headers=[],this.channel=t==null?void 0:t.channel,this.description=t==null?void 0:t.description,t!=null&&t.payloadType?this.payloadType=(t==null?void 0:t.payloadType)instanceof x?t.payloadType:this.owner.node.getDataType(t.payloadType):this.payloadType=this.owner.node.getDataType("any"),t!=null&&t.keyType&&(this.keyType=(t==null?void 0:t.keyType)instanceof x?t.keyType:this.owner.node.getDataType(t.keyType))}findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){let e=(0,_p.omitUndefined)({description:this.description,channel:this.channel,payloadType:this.payloadType.name?this.payloadType.name:this.payloadType.toJSON(),keyType:this.keyType?this.keyType.name?this.keyType.name:this.keyType.toJSON():void 0});if(this.headers.length){e.headers=[];for(let t of this.headers)e.headers.push(t.toJSON())}return e}};a(Gs,"RpcOperationResponse");var Si=Gs;var Qs=class Qs{static async createApi(e,t){let r=new Tt(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{if(Array.isArray(t.controllers))for(let i of t.controllers){let n=await this._createController(e,r,i);n&&r.controllers.set(n.name,n)}else for(let[i,n]of Object.entries(t.controllers)){let s=await this._createController(e,r,n,i);s&&r.controllers.set(s.name,s)}}),r}static async _createController(e,t,r,i){typeof r=="function"&&!(0,xp.isConstructor)(r)&&(r=r()),r=await ue(r);let n,s,p;if(typeof r=="function"){if(s=Reflect.getMetadata(ae,r),!s)return e.addError(`Class "${r.name}" doesn't have a valid RpcController metadata`);n=r}else n=Object.getPrototypeOf(r).constructor,s=Reflect.getMetadata(ae,n),s?p=r:(s=r,r.instance==="object"&&(p=r.instance,n=Object.getPrototypeOf(p).constructor));if(!s)return e.addError(`Class "${n.name}" is not decorated with RpcController()`);if(i=i||s.name,!i)throw new TypeError("Controller name required");let c=new Ye(t,{...s,name:i,instance:p,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await P.addDataTypes(e,c,s.types)}),s.headers&&await e.enterAsync(".headers",async()=>{let l=0;for(let O of s.headers)await e.enterAsync(`[${l++}]`,async()=>{let w={...O};await e.enterAsync(".type",async()=>{O.type&&(w.type=c.node.findDataType(O.type)),!w.type&&typeof O.type=="object"&&(w.type=await P.createDataType(e,c,O.type)),w.type||(w.type=c.node.getDataType("any"))});let E=new fr(c,w);c.headers.push(E)})}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[l,O]of Object.entries(s.operations))await e.enterAsync(`[${l}]`,async()=>{let w=new mr(c,{...O,name:l,types:void 0,payloadType:void 0,keyType:void 0});await this._initRpcOperation(e,w,O),c.operations.set(w.name,w)})}),c}static async _initRpcOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await P.addDataTypes(e,t,r.types)}),t.payloadType=await P.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await P.resolveDataType(e,t,r.keyType)),r.headers&&await e.enterAsync(".headers",async()=>{let i=0;for(let n of r.headers)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await P.resolveDataType(e,t,n.type)});let p=new fr(t,s);t.headers.push(p)})}),r.response&&await e.enterAsync(".response",async()=>{let i=new Si(t,{...r.response,payloadType:void 0,keyType:void 0});await this._initRpcOperationResponse(e,i,r.response),t.response=i})}static async _initRpcOperationResponse(e,t,r){t.payloadType=await P.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await P.resolveDataType(e,t,r.keyType)),r.headers&&await e.enterAsync(".headers",async()=>{let i=0;for(let n of r.headers)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await P.resolveDataType(e,t,n.type)});let p=new fr(t,s);t.headers.push(p)})})}};a(Qs,"RpcApiFactory");var Fi=Qs;var zc="https://oprajs.com/spec/v"+m.SpecVersion,vi=class vi{constructor(){this._allDocuments={}}static async createDocument(e,t){let r=new vi,i=t instanceof de?t:new de(t);try{let n=new Je;if(await r.initDocument(n,i,e),i.error.details.length)throw i.error;return n}catch(n){try{n instanceof at||i.addError(n)}catch{}if(!i.error.message){let s=i.error.details.length;i.error.message=`(${s}) error${s>1?"s":""} found in document schema.`,i.showErrorDetails&&(i.error.message+=i.error.details.map(p=>`
|
|
6
|
+
"use strict";var Sp=Object.create;var hr=Object.defineProperty;var vp=Object.getOwnPropertyDescriptor;var Mp=Object.getOwnPropertyNames;var Fp=Object.getPrototypeOf,Ip=Object.prototype.hasOwnProperty;var a=(o,e)=>hr(o,"name",{value:e,configurable:!0});var yr=(o,e)=>{for(var t in e)hr(o,t,{get:e[t],enumerable:!0})},oa=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Mp(e))!Ip.call(o,i)&&i!==t&&hr(o,i,{get:()=>e[i],enumerable:!(r=vp(e,i))||r.enumerable});return o};var yt=(o,e,t)=>(t=o!=null?Sp(Fp(o)):{},oa(e||!o||!o.__esModule?hr(t,"default",{value:o,enumerable:!0}):t,o)),Pp=o=>oa(hr({},"__esModule",{value:!0}),o);var el={};yr(el,{AnyType:()=>_i,ApiBase:()=>mt,ApiDocument:()=>Ye,ApiDocumentFactory:()=>ra,ApiField:()=>C,BUILTIN:()=>Ne,BadRequestError:()=>$i,Base64Type:()=>ci,BaseI18n:()=>pa,BigintType:()=>Oi,BooleanType:()=>wi,CLASS_NAME_PATTERN:()=>$,ComplexType:()=>oe,ConflictError:()=>qi,DATATYPE_METADATA:()=>d,DECODER:()=>E,DECORATOR:()=>N,DataType:()=>x,DataTypeMap:()=>se,DateTimeType:()=>Lt,DateTimeTypeTz:()=>jt,DateType:()=>It,DocumentElement:()=>b,DocumentInitContext:()=>ye,DocumentNode:()=>Ir,ENCODER:()=>g,EmailType:()=>ie,EnumType:()=>re,FailedDependencyError:()=>Ki,FieldPathType:()=>J,FieldsProjection:()=>Se,FilterType:()=>je,ForbiddenError:()=>_r,HTTP_CONTROLLER_METADATA:()=>pe,HttpApi:()=>ut,HttpController:()=>ae,HttpHeaderCodes:()=>Ji,HttpMediaType:()=>De,HttpMultipartField:()=>$r,HttpOperation:()=>A,HttpOperationResponse:()=>Br,HttpParameter:()=>fr,HttpRequestBody:()=>qr,HttpStatusCode:()=>R,HttpStatusMessages:()=>$p,HttpStatusRange:()=>lr,I18n:()=>Tt,IntegerType:()=>ct,InternalServerError:()=>Yi,IssueSeverity:()=>mo,MappedType:()=>Je,MethodNotAllowedError:()=>Qi,MimeTypes:()=>D,MixinType:()=>lt,NAMESPACE_PATTERN:()=>uo,NotAcceptableError:()=>Zi,NotFoundError:()=>eo,NullType:()=>Ai,NumberType:()=>ge,ObjectIdType:()=>hi,ObjectType:()=>Ni,OmitType:()=>Gc,OperationResult:()=>ne,OpraDocumentError:()=>nt,OpraException:()=>Te,OpraFilter:()=>qt,OpraHttpError:()=>S,OpraSchema:()=>m,PartialDateType:()=>Wt,PartialType:()=>Qc,PermissionError:()=>ro,PickType:()=>Xc,RPC_CONTROLLER_METADATA:()=>ce,RequiredType:()=>Zc,ResourceConflictError:()=>oo,ResourceNotAvailableError:()=>so,ResponsiveMap:()=>M,RpcApi:()=>ht,RpcController:()=>Qe,RpcHeader:()=>ur,RpcOperation:()=>dr,SimpleType:()=>u,StringType:()=>ze,TimeType:()=>Gt,UnauthorizedError:()=>po,UnionType:()=>ft,UnprocessableEntityError:()=>lo,UrlType:()=>Ti,UuidType:()=>jr,classes:()=>ia,cloneObject:()=>F,getErrorStack:()=>qp,getStackFileName:()=>Bp,i18n:()=>Vr,inheritPropertyInitializers:()=>Or,isBlob:()=>Qp,isFormData:()=>Xp,isReadable:()=>Wp,isReadableStream:()=>Gp,isStream:()=>zr,isURL:()=>Zp,isWritable:()=>Yp,kCtorMap:()=>gr,kDataTypeMap:()=>B,kTypeNSMap:()=>we,mergePrototype:()=>xr,parse:()=>To,parseFieldsProjection:()=>yo,resolveThunk:()=>he,safeJsonStringify:()=>Jp,translate:()=>Up,uid:()=>Np.uid});module.exports=Pp(el);var w2=require("reflect-metadata");Array.prototype.findLast||(Array.prototype.findLast=function(o,e){let t=this.findLastIndex(o,e);return t>=0?this[t]:void 0},Array.prototype.findLastIndex=function(o,e){if(this==null)throw new TypeError("this is null or not defined");let t=Object(this),r=this.length;e=e||this;for(let i=r-1;i>=0;i--)if(o.call(e,t[i],i,t))return i;return-1});var Oa=require("@jsopen/objects"),ga=require("valgen");var ca=require("@jsopen/objects");var aa=yt(require("@browsery/i18next"),1),Er=require("fast-tokenizer");var Lp=/\\(.)/g,kp=/(\\)/g;function na(o){return o.replace(kp,"\\\\")}a(na,"escapeString");function sa(o){return o.replace(Lp,"$1")}a(sa,"unescapeString");var pa=Object.getPrototypeOf(aa.default.createInstance()).constructor,Tr=class Tr extends pa{async init(e,t){let r=typeof e=="object"?e:{},i=typeof e=="function"?e:t;try{let n=await super.init(r,i),s=this.services.formatter;if(s.add("lowercase",(p,c)=>p.toLocaleLowerCase(c)),s.add("uppercase",(p,c)=>p.toLocaleUpperCase(c)),s.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 i&&i(null,n),n}catch(n){throw i&&i(n,this.t),n}}deep(e,t){if(e==null)return e;let r=new WeakMap;return this._deepTranslate(e,r,t)}createInstance(e,t){return new Tr(e,t)}static createInstance(e,t){return new Tr(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 i="";for(let n of(0,Er.tokenize)(e,{brackets:{"$t(":")"},quotes:!0,keepQuotes:!0,keepBrackets:!0,keepDelimiters:!0})){if(n.startsWith("$t(")&&n.endsWith(")")){n=n.substring(3,n.length-1);let s=(0,Er.splitString)(n,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),p=sa(n.substring((s[0]||"").length+1));n=s[0]||"";let c=[],l=null;for(let w of(0,Er.tokenize)(n,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(w.startsWith("{")){l=JSON.parse(w);continue}c.push(w)}let O=c.length>1?"$t("+c.join(",")+")":c[0];i+=p?this.t(O,p,{...r,...l}):this.t(O,{...r,...l});continue}i+=n}return i}if(Array.isArray(e)){let i=Array(e.length);t.set(e,i);for(let n=0,s=e.length;n<s;n++)i[n]=this._deepTranslate(e[n],t,r);return t.delete(e),i}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 i={};t.set(e,i);let n=Object.keys(e);for(let s=0,p=n.length;s<p;s++){let c=n[s];i[c]=this._deepTranslate(e[c],t,r)}return t.delete(e),i}return e}static get defaultInstance(){return jp}};a(Tr,"I18n");var Tt=Tr,jp=Tt.createInstance();var Cp=/(\))/g;function Up(o,e,t){let r=e&&typeof e=="object"?e:void 0,i=typeof e=="string"?e:t;return"$t("+o+(r?","+JSON.stringify(r):"")+(i?"?"+na(i).replace(Cp,"\\$1"):"")+")"}a(Up,"translate");var Vr=Tt.createInstance();Vr.init().catch(()=>{});var Ci=class Ci 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(0,ca.omitUndefined)({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})}};a(Ci,"OpraException");var Te=Ci;var Ui=class Ui extends Te{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)}};a(Ui,"OpraHttpError");var S=Ui;var Bi=class Bi extends S{constructor(){super(...arguments),this.status=400}init(e){super.init({message:"Bad request",code:"BAD_REQUEST",...e})}};a(Bi,"BadRequestError");var $i=Bi;var Vi=class Vi extends S{constructor(){super(...arguments),this.status=409}init(e){super.init({message:"Conflict",code:"CONFLICT",...e})}};a(Vi,"ConflictError");var qi=Vi;var zi=class zi extends S{constructor(){super(...arguments),this.status=424}init(e){super.init({message:"The request failed due to failure of a previous request",code:"FAILED_DEPENDENCY",...e})}};a(zi,"FailedDependencyError");var Ki=zi;var Ji;(function(o){o.X_Opra_Version="X-Opra-Version",o.X_Total_Count="X-Total-Count",o.WWW_Authenticate="WWW-Authenticate",o.Authorization="Authorization",o.Proxy_Authenticate="Proxy-Authenticate",o.Proxy_Authorization="Proxy-Authorization",o.Age="Age",o.Cache_Control="Cache-Control",o.Clear_Site_Data="Clear-Site-Data",o.Expires="Expires",o.Pragma="Pragma",o.Last_Modified="Last-Modified",o.ETag="ETag",o.If_Match="If-Match",o.If_None_Match="If-None-Match",o.If_Modified_Since="If-Modified-Since",o.If_Unmodified_Since="If-Unmodified-Since",o.Vary="Vary",o.Connection="Connection",o.Keep_Alive="Keep-Alive",o.Accept="Accept",o.Accept_Encoding="Accept-Encoding",o.Accept_Language="Accept-Language",o.Expect="Expect",o.Cookie="Cookie",o.Set_Cookie="Set-Cookie",o.Access_Control_Allow_Origin="Access-Control-Allow-Origin",o.Access_Control_Allow_Credentials="Access-Control-Allow-Credentials",o.Access_Control_Allow_Headers="Access-Control-Allow-Headers",o.Access_Control_Allow_Methods="Access-Control-Allow-Methods",o.Access_Control_Expose_Headers="Access-Control-Expose-Headers",o.Access_Control_Max_Age="Access-Control-Max-Age",o.Access_Control_Request_Headers="Access-Control-Request-Headers",o.Access_Control_Request_Method="Access-Control-Request-Method",o.Origin="Origin",o.Timing_Allow_Origin="Timing-Allow-Origin",o.Content_Disposition="Content-Disposition",o.Content_ID="Content-ID",o.Content_Length="Content-Length",o.Content_Type="Content-Type",o.Content_Transfer_Encoding="Content-Transfer-Encoding",o.Content_Encoding="Content-Encoding",o.Content_Language="Content-Language",o.Content_Location="Content-Location",o.Forwarded="Forwarded",o.X_Forwarded_For="X-Forwarded-For",o.X_Forwarded_Host="X-Forwarded-Host",o.X_Forwarded_Proto="X-Forwarded-Proto",o.Via="Via",o.Location="Location",o.From="From",o.Host="Host",o.Referer="Referer",o.Referrer_Policy="Referrer-Policy",o.User_Agent="User-Agent",o.Allow="Allow",o.Server="Server",o.Accept_Ranges="Accept-Ranges",o.Range="Range",o.If_Range="If-Range",o.Content_Range="Content-Range",o.Cross_Origin_Embedder_Policy="Cross-Origin-Embedder-Policy",o.Cross_Origin_Opener_Policy="Cross-Origin-Opener-Policy",o.Cross_Origin_Resource_Policy="Cross-Origin-Resource-Policy",o.Content_Security_Policy="Content-Security-Policy",o.Content_Security_Policy_Report_Only="Content-Security-Policy-Report-Only",o.Expect_CT="Expect-CT",o.Feature_Policy="Feature-Policy",o.Strict_Transport_Security="Strict-Transport-Security",o.Upgrade="Upgrade",o.Upgrade_Insecure_Requests="Upgrade-Insecure-Requests",o.X_Content_Type_Options="X-Content-Type-Options",o.X_Download_Options="X-Download-Options",o.X_Frame_Options="X-Frame-Options",o.X_Permitted_Cross_Domain_Policies="X-Permitted-Cross-Domain-Policies",o.X_Powered_By="X-Powered-By",o.X_XSS_Protection="X-XSS-Protection",o.Transfer_Encoding="Transfer-Encoding",o.TE="TE",o.Trailer="Trailer",o.Sec_WebSocket_Key="Sec-WebSocket-Key",o.Sec_WebSocket_Extensions="Sec-WebSocket-Extensions",o.Sec_WebSocket_Accept="Sec-WebSocket-Accept",o.Sec_WebSocket_Protocol="Sec-WebSocket-Protocol",o.Sec_WebSocket_Version="Sec-WebSocket-Version",o.Date="Date",o.Retry_After="Retry-After",o.Server_Timing="Server-Timing",o.X_DNS_Prefetch_Control="X-DNS-Prefetch-Control",o.Max_Forwards="Max-Forwards"})(Ji||(Ji={}));var R;(function(o){o[o.CONTINUE=100]="CONTINUE",o[o.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",o[o.PROCESSING=102]="PROCESSING",o[o.EARLYHINTS=103]="EARLYHINTS",o[o.OK=200]="OK",o[o.CREATED=201]="CREATED",o[o.ACCEPTED=202]="ACCEPTED",o[o.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",o[o.NO_CONTENT=204]="NO_CONTENT",o[o.RESET_CONTENT=205]="RESET_CONTENT",o[o.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",o[o.AMBIGUOUS=300]="AMBIGUOUS",o[o.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",o[o.FOUND=302]="FOUND",o[o.SEE_OTHER=303]="SEE_OTHER",o[o.NOT_MODIFIED=304]="NOT_MODIFIED",o[o.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",o[o.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",o[o.BAD_REQUEST=400]="BAD_REQUEST",o[o.UNAUTHORIZED=401]="UNAUTHORIZED",o[o.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",o[o.FORBIDDEN=403]="FORBIDDEN",o[o.NOT_FOUND=404]="NOT_FOUND",o[o.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",o[o.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",o[o.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",o[o.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",o[o.CONFLICT=409]="CONFLICT",o[o.GONE=410]="GONE",o[o.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",o[o.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",o[o.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",o[o.URI_TOO_LONG=414]="URI_TOO_LONG",o[o.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",o[o.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",o[o.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",o[o.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",o[o.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",o[o.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",o[o.LOCKED=423]="LOCKED",o[o.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",o[o.TOO_EARLY=425]="TOO_EARLY",o[o.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",o[o.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",o[o.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",o[o.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",o[o.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",o[o.BAD_GATEWAY=502]="BAD_GATEWAY",o[o.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",o[o.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",o[o.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",o[o.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",o[o.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",o[o.LOOP_DETECTED=508]="LOOP_DETECTED",o[o.NOT_EXTENDED=510]="NOT_EXTENDED",o[o.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(R||(R={}));var $p={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 D;(function(o){o.json="application/json",o.opra_response_json="application/opra.response+json",o.xml="application/XML",o.text="text/plain",o.html="text/html",o.markdown="text/markdown",o.binary="binary/octet-stream"})(D||(D={}));var Wi=class Wi extends S{constructor(){super(...arguments),this.status=R.FORBIDDEN}init(e){super.init({message:"You are not authorized to perform this action",code:"FORBIDDEN",...e})}};a(Wi,"ForbiddenError");var _r=Wi;var Gi=class Gi extends S{constructor(){super(...arguments),this.status=500}init(e){super.init({message:"Internal server error",code:"INTERNAL_SERVER_ERROR",severity:"fatal",...e})}};a(Gi,"InternalServerError");var Yi=Gi;var Xi=class Xi extends S{constructor(){super(...arguments),this.status=405}init(e){super.init({message:"Method not allowed",code:"METHOD_NOT_ALLOWED",...e})}};a(Xi,"MethodNotAllowedError");var Qi=Xi;var Hi=class Hi extends S{constructor(){super(...arguments),this.status=406}init(e){super.init({message:"Not Acceptable",code:"NOT_ACCEPTABLE",...e})}};a(Hi,"NotAcceptableError");var Zi=Hi;var to=class to extends S{constructor(){super(...arguments),this.status=404}init(e){super.init({message:"Not found",code:"NOT_FOUND",...e})}};a(to,"NotFoundError");var eo=to;var io=class io extends _r{init(e){super.init({message:"You dont have permission for this operation",code:"PERMISSION_ERROR",...e})}};a(io,"PermissionError");var ro=io;var no=class no extends S{constructor(e,t,r){super({message:`There is already an other "${e}" resource with same values for field(s) [${t}]`,severity:"error",code:"RESOURCE_CONFLICT",details:{resource:e,location:t}},r),this.status=409}};a(no,"ResourceConflictError");var oo=no;var ao=class ao extends S{constructor(e,t,r){super({message:`Resource "${e}${t?"/"+t:""}" is not available`,severity:"error",code:"RESOURCE_NOT_AVAILABLE",details:{resource:e,key:t}},r,R.UNPROCESSABLE_ENTITY)}};a(ao,"ResourceNotAvailableError");var so=ao;var co=class co extends S{constructor(){super(...arguments),this.status=401}init(e){super.init({message:"You don't have permission to perform this action",code:"UNAUTHORIZED",...e})}};a(co,"UnauthorizedError");var po=co;var fo=class fo extends S{constructor(){super(...arguments),this.status=422}init(e){super.init({message:"Unprocessable entity",severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};a(fo,"UnprocessableEntityError");var lo=fo;var mo;(function(o){let e;(function(t){t.fatal="fatal",t.error="error",t.warning="warning",t.info="info"})(e=o.Enum||(o.Enum={})),o.name="IssueSeverity",o.description="Severity of the issue",o.Keys=Object.keys(o),o.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"}})(mo||(mo={}));BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});var la=require("@jsopen/objects"),fa=yt(require("putil-promisify"),1);async function he(o){return o=fa.default.isPromise(o)?await o:o,typeof o=="function"?(0,la.isConstructor)(o)?o:await o():o}a(he,"resolveThunk");var ma=/^(?:file:\/\/)?(.+)$/;function Bp(o=1){if(o>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+o+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,i)=>i;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[o]?t[o].getFileName():void 0,i=r?ma.exec(r):void 0;return i?i[1]:""}return""}a(Bp,"getStackFileName");function qp(o=1){if(o>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+o+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,i)=>i;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[o]?t[o].getFileName():void 0,i=r?ma.exec(r):void 0;return i?i[1]:""}return""}a(qp,"getErrorStack");function xr(o,e,t){for(let r of Object.getOwnPropertyNames(e))r==="constructor"||r==="__proto__"||r==="toJSON"||r==="toString"||t&&!t(r)||Object.defineProperty(o,r,Object.getOwnPropertyDescriptor(e,r)||Object.create(null))}a(xr,"mergePrototype");function Or(o,e,t=r=>!0){try{let r=new e;Object.getOwnPropertyNames(r).filter(n=>typeof r[n]<"u"&&typeof o[n]>"u").filter(n=>t(n)).forEach(n=>{o[n]=r[n]})}catch{}}a(Or,"inheritPropertyInitializers");var wr=require("@jsopen/objects");var d=Symbol.for("opra.type.metadata"),pe=Symbol("opra.http-controller.metadata"),ce=Symbol("opra.rpc-controller.metadata"),E=Symbol.for("opra.type.decoder"),g=Symbol("opra.type.encoder"),N=Symbol.for("DECORATOR"),Ne=Symbol.for("BUILTIN"),uo=/([a-z$_]\w+):(.+)/i,$=/^[a-z][\w_]*$/i,B=Symbol.for("kDataTypeMap"),gr=Symbol.for("kCtorMap"),we=Symbol.for("kTypeNSMap");function F(o,e){return(0,wr.merge)({},o,{deep:a(t=>(0,wr.isPlainObject)(t)&&!t[d],"deep"),copyDescriptors:!0,ignoreUndefined:!0,filter(t,r){let i=r[t];return!e||typeof i!="function"&&(typeof i!="object"||(0,wr.isPlainObject)(i)||Array.isArray(i))}})}a(F,"cloneObject");var ho=require("fast-tokenizer");var Vp=/^([+-])?([a-z_$]\w*)$/i,Kp=/[^.]\(/g,Eo=class Eo{};a(Eo,"FieldsProjection");var Se=Eo;(function(o){let t=class t{};a(t,"Item");let e=t;o.Item=e})(Se||(Se={}));function yo(o,e){let t=Array.isArray(o)?o:[o];if(!(t&&t.length))return;let r=new Se;for(let i of t)e||(i=i.toLowerCase()),To(i,r);return r}a(yo,"parseFieldsProjection");function To(o,e){o=o.replace(Kp,r=>r.charAt(0)+"."+r.substring(1));let t=(0,ho.splitString)(o,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let i=t[r];if(i.includes(",")){let c=(0,ho.splitString)(i,{delimiters:",",brackets:!0,keepBrackets:!0});for(let l of c)To(l,e);continue}let n=Vp.exec(i);if(!n)throw new TypeError(`Invalid field path (${o})`);let s=n[2],p=e[s]=e[s]||new Se.Item;n[1]&&(p.sign=n[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new Se}}a(To,"parse");function zp(o){return o&&typeof o.forEach=="function"}a(zp,"isMap");var Z=Symbol.for("kEntries"),Ee=Symbol.for("kKeyMap"),Kr=Symbol.for("kWellKnownKeys"),_o=Symbol.for("kOptions"),Et=Symbol.for("kSize"),xo=class xo{constructor(e,t){Object.defineProperty(this,Et,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,Z,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,Ee,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,Kr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,_o,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(i=>{r?this[Kr][i]=i:this[Kr][i.toLowerCase()]=i}),this.clear(),e&&this.setAll(e)}get size(){return this[Et]}clear(){Object.keys(this[Z]).forEach(e=>delete this[Z][e]),Object.keys(this[Ee]).forEach(e=>delete this[Ee][e]),this[Et]=0}forEach(e,t){for(let[r,i]of this.entries())e.call(t,i,r,this)}get(e){if(e)return this[Z][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[Z],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let i=Object.prototype.hasOwnProperty.call(this[Z],r);return this[Z][r]=t,i||this[Et]++,this[Ee][r]=e,this}setAll(e){return zp(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[Ee])[Symbol.iterator]()}values(){return Object.values(this[Z])[Symbol.iterator]()}entries(){return Object.entries(this[Z])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[Z],t);return delete this[Z][t],delete this[Ee][t],r||this[Et]--,r}sort(e){let t={...this[Z]},r={...this[Ee]},i=Array.from(this.keys());e?i.sort(e):i.sort(),this.clear();for(let n of i)this[Z][n]=t[n],this[Ee][n]=r[n];return this[Et]=i.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[Ee]))e[r]=this[Z][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[_o].caseSensitive)return e;let t=this._getStoringKey(e);return this[Ee][t]??this[Kr][t]??e}_getStoringKey(e){return this[_o].caseSensitive?e:e.toLowerCase()}};a(xo,"ResponsiveMap");var M=xo;function Jp(o,e,t){let r=new WeakSet;return JSON.stringify(o,(i,n)=>{if(n!==null&&typeof n=="object"){if(r.has(n))return;r.add(n)}return e?e(i,n):n},t)}a(Jp,"safeJsonStringify");function zr(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}a(zr,"isStream");function Wp(o){return zr(o)&&typeof o._read=="function"&&typeof o._readableState=="object"}a(Wp,"isReadable");function Yp(o){return zr(o)&&typeof o._write=="function"}a(Yp,"isWritable");function Gp(o){return zr(o)&&typeof o.getReader=="function"&&typeof o.pipeThrough=="function"&&typeof o.pipeTo=="function"}a(Gp,"isReadableStream");function Qp(o){return o!==null&&typeof o=="object"&&typeof o.size=="number"&&typeof o.arrayBuffer=="function"&&typeof o.stream=="function"}a(Qp,"isBlob");function Xp(o){return o!==null&&typeof o.constructor=="function"&&o.constructor.name==="FormData"&&typeof o.append=="function"&&typeof o.getAll=="function"}a(Xp,"isFormData");function Zp(o){return o!==null&&typeof o=="object"&&typeof o.host=="string"&&typeof o.href=="string"}a(Zp,"isURL");var Oo=class Oo{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};a(Oo,"Ast");var Rr=Oo;var go=class go extends Rr{};a(go,"Expression");var V=go;var wo=class wo extends V{};a(wo,"Term");var Ze=wo;var Ro=class Ro extends Ze{constructor(e){super(),this.value=e}toString(){return""+this.value}};a(Ro,"Literal");var I=Ro;var bo=class bo extends V{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new Jr({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};a(bo,"ArithmeticExpression");var He=bo,Ao=class Ao{constructor(e){Object.assign(this,e)}};a(Ao,"ArithmeticExpressionItem");var Jr=Ao;var Do=class Do extends Ze{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};a(Do,"ArrayExpression");var Re=Do;var Hp=/\w/,No=class No extends V{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${Hp.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};a(No,"ComparisonExpression");var _e=No;var So=class So extends V{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+" ")}};a(So,"LogicalExpression");var xe=So;var vo=class vo extends V{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(vo,"NegativeExpression");var br=vo;var Mo=class Mo extends V{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(Mo,"ParenthesizedExpression");var be=Mo;var Fo=class Fo extends I{constructor(e){super(e)}};a(Fo,"BooleanLiteral");var et=Fo;var da=require("putil-varhelpers");var Io=class Io extends TypeError{};a(Io,"SyntaxError");var Wr=Io,Po=class Po extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};a(Po,"FilterValidationError");var Oe=Po,Lo=class Lo extends Error{constructor(e,t){super(e),Object.assign(this,t)}};a(Lo,"FilterParseError");var Yr=Lo;var ec=/'/g,tc=/(\\)/g,rc=/\\(.)/g;function ic(o){return o.replace(tc,"\\\\")}a(ic,"escapeString");function oc(o){return o.replace(rc,"$1")}a(oc,"unescapeString");function ve(o){return"'"+ic(o).replace(ec,"\\'")+"'"}a(ve,"quoteFilterString");function Ar(o){return o&&(o.startsWith("'")||o.startsWith('"'))&&o.endsWith(o.charAt(0))?oc(o.substring(1,o.length-1)):o}a(Ar,"unquoteFilterString");var ua=new Date(0),ko=class ko extends I{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,da.toDateDef)(e,ua)!==ua){this.value=e;return}throw new Oe(`Invalid date value "${e}"`)}toString(){return ve(this.value)}};a(ko,"DateLiteral");var Me=ko;var ya=require("putil-varhelpers");var ha=new Date(0),jo=class jo extends I{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,ya.toDateDef)(e,ha)!==ha){this.value=e;return}throw new Oe(`Invalid date-time value "${e}"`)}toString(){return ve(this.value)}};a(jo,"DateTimeLiteral");var Dr=jo;var Co=class Co extends I{constructor(){super(null),this.value=null}};a(Co,"NullLiteral");var tt=Co;var Uo=class Uo extends I{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 Oe(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};a(Uo,"NumberLiteral");var Ae=Uo;var $o=class $o extends I{constructor(e){super(""+e)}};a($o,"QualifiedIdentifier");var le=$o;var Bo=class Bo extends I{constructor(e){super(""+e)}toString(){return ve(this.value)}};a(Bo,"StringLiteral");var rt=Bo;var nc=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,qo=class qo extends I{constructor(e){if(super(""),e instanceof Date){this.value=Gr(e.getHours())+":"+Gr(e.getMinutes())+(e.getSeconds()?":"+Gr(e.getSeconds()):"")+(e.getMilliseconds()?"."+Gr(e.getMilliseconds()):"");return}if(typeof e=="string"&&nc.test(e)){this.value=e;return}throw new Oe(`Invalid time value "${e}"`)}toString(){return ve(this.value)}};a(qo,"TimeLiteral");var it=qo;function Gr(o){return o<=9?"0"+o:""+o}a(Gr,"pad");var ai=require("@browsery/antlr4");var fe=require("@browsery/antlr4");var Y=class Y extends fe.Lexer{constructor(e){super(e),this._interp=new fe.LexerATNSimulator(this,Y._ATN,Y.DecisionsToDFA,new fe.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return Y.literalNames}get symbolicNames(){return Y.symbolicNames}get ruleNames(){return Y.ruleNames}get serializedATN(){return Y._serializedATN}get channelNames(){return Y.channelNames}get modeNames(){return Y.modeNames}static get _ATN(){return Y.__ATN||(Y.__ATN=new fe.ATNDeserializer().deserialize(Y._serializedATN)),Y.__ATN}};a(Y,"OpraFilterLexer");var y=Y;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=fe.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,461,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,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,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,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,291,8,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,3,38,301,8,38,1,39,3,39,304,8,39,1,39,4,39,307,8,39,11,39,12,39,308,1,39,1,39,5,39,313,8,39,10,39,12,39,316,9,39,3,39,318,8,39,1,39,1,39,3,39,322,8,39,1,39,4,39,325,8,39,11,39,12,39,326,3,39,329,8,39,1,39,1,39,1,39,1,39,4,39,335,8,39,11,39,12,39,336,3,39,339,8,39,1,40,3,40,342,8,40,1,40,4,40,345,8,40,11,40,12,40,346,1,40,1,40,1,40,1,40,4,40,353,8,40,11,40,12,40,354,3,40,357,8,40,1,41,1,41,1,41,5,41,362,8,41,10,41,12,41,365,9,41,1,41,1,41,1,41,1,41,5,41,371,8,41,10,41,12,41,374,9,41,1,41,3,41,377,8,41,1,42,4,42,380,8,42,11,42,12,42,381,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,397,8,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,406,8,44,1,45,1,45,1,45,1,45,3,45,412,8,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,4,45,424,8,45,11,45,12,45,425,3,45,428,8,45,3,45,430,8,45,1,46,1,46,1,46,3,46,435,8,46,1,46,1,46,1,46,3,46,440,8,46,1,46,1,46,1,46,3,46,445,8,46,3,46,447,8,46,1,47,1,47,1,47,3,47,452,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,491,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,290,1,0,0,0,77,300,1,0,0,0,79,338,1,0,0,0,81,356,1,0,0,0,83,376,1,0,0,0,85,379,1,0,0,0,87,385,1,0,0,0,89,387,1,0,0,0,91,411,1,0,0,0,93,446,1,0,0,0,95,448,1,0,0,0,97,453,1,0,0,0,99,459,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,248,5,39,0,0,248,249,3,89,44,0,249,250,5,32,0,0,250,251,3,91,45,0,251,252,3,93,46,0,252,253,5,39,0,0,253,254,5,39,0,0,254,255,3,89,44,0,255,256,5,84,0,0,256,257,3,91,45,0,257,258,5,39,0,0,258,259,5,39,0,0,259,260,3,89,44,0,260,261,5,32,0,0,261,262,3,91,45,0,262,263,5,39,0,0,263,291,1,0,0,0,264,265,5,34,0,0,265,266,3,89,44,0,266,267,5,84,0,0,267,268,3,91,45,0,268,269,3,93,46,0,269,270,5,34,0,0,270,291,1,0,0,0,271,272,5,34,0,0,272,273,3,89,44,0,273,274,5,32,0,0,274,275,3,91,45,0,275,276,3,93,46,0,276,277,5,34,0,0,277,291,1,0,0,0,278,279,5,34,0,0,279,280,3,89,44,0,280,281,5,84,0,0,281,282,3,91,45,0,282,283,5,34,0,0,283,291,1,0,0,0,284,285,5,34,0,0,285,286,3,89,44,0,286,287,5,32,0,0,287,288,3,91,45,0,288,289,5,34,0,0,289,291,1,0,0,0,290,241,1,0,0,0,290,264,1,0,0,0,290,271,1,0,0,0,290,278,1,0,0,0,290,284,1,0,0,0,291,76,1,0,0,0,292,293,5,39,0,0,293,294,3,91,45,0,294,295,5,39,0,0,295,301,1,0,0,0,296,297,5,34,0,0,297,298,3,91,45,0,298,299,5,34,0,0,299,301,1,0,0,0,300,292,1,0,0,0,300,296,1,0,0,0,301,78,1,0,0,0,302,304,3,71,35,0,303,302,1,0,0,0,303,304,1,0,0,0,304,306,1,0,0,0,305,307,3,87,43,0,306,305,1,0,0,0,307,308,1,0,0,0,308,306,1,0,0,0,308,309,1,0,0,0,309,317,1,0,0,0,310,314,5,46,0,0,311,313,3,87,43,0,312,311,1,0,0,0,313,316,1,0,0,0,314,312,1,0,0,0,314,315,1,0,0,0,315,318,1,0,0,0,316,314,1,0,0,0,317,310,1,0,0,0,317,318,1,0,0,0,318,328,1,0,0,0,319,321,5,69,0,0,320,322,7,2,0,0,321,320,1,0,0,0,321,322,1,0,0,0,322,324,1,0,0,0,323,325,3,87,43,0,324,323,1,0,0,0,325,326,1,0,0,0,326,324,1,0,0,0,326,327,1,0,0,0,327,329,1,0,0,0,328,319,1,0,0,0,328,329,1,0,0,0,329,339,1,0,0,0,330,331,5,48,0,0,331,332,5,120,0,0,332,334,1,0,0,0,333,335,3,99,49,0,334,333,1,0,0,0,335,336,1,0,0,0,336,334,1,0,0,0,336,337,1,0,0,0,337,339,1,0,0,0,338,303,1,0,0,0,338,330,1,0,0,0,339,80,1,0,0,0,340,342,3,71,35,0,341,340,1,0,0,0,341,342,1,0,0,0,342,344,1,0,0,0,343,345,3,87,43,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,357,1,0,0,0,348,349,5,48,0,0,349,350,5,120,0,0,350,352,1,0,0,0,351,353,3,99,49,0,352,351,1,0,0,0,353,354,1,0,0,0,354,352,1,0,0,0,354,355,1,0,0,0,355,357,1,0,0,0,356,341,1,0,0,0,356,348,1,0,0,0,357,82,1,0,0,0,358,363,5,39,0,0,359,362,3,95,47,0,360,362,8,3,0,0,361,359,1,0,0,0,361,360,1,0,0,0,362,365,1,0,0,0,363,361,1,0,0,0,363,364,1,0,0,0,364,366,1,0,0,0,365,363,1,0,0,0,366,377,5,39,0,0,367,372,5,34,0,0,368,371,3,95,47,0,369,371,8,4,0,0,370,368,1,0,0,0,370,369,1,0,0,0,371,374,1,0,0,0,372,370,1,0,0,0,372,373,1,0,0,0,373,375,1,0,0,0,374,372,1,0,0,0,375,377,5,34,0,0,376,358,1,0,0,0,376,367,1,0,0,0,377,84,1,0,0,0,378,380,7,5,0,0,379,378,1,0,0,0,380,381,1,0,0,0,381,379,1,0,0,0,381,382,1,0,0,0,382,383,1,0,0,0,383,384,6,42,0,0,384,86,1,0,0,0,385,386,7,6,0,0,386,88,1,0,0,0,387,388,7,6,0,0,388,389,7,6,0,0,389,390,7,6,0,0,390,391,7,6,0,0,391,396,5,45,0,0,392,393,7,7,0,0,393,397,7,8,0,0,394,395,7,9,0,0,395,397,7,10,0,0,396,392,1,0,0,0,396,394,1,0,0,0,397,398,1,0,0,0,398,405,5,45,0,0,399,400,7,11,0,0,400,406,7,7,0,0,401,402,7,10,0,0,402,406,7,8,0,0,403,404,5,51,0,0,404,406,5,49,0,0,405,399,1,0,0,0,405,401,1,0,0,0,405,403,1,0,0,0,406,90,1,0,0,0,407,408,7,12,0,0,408,412,7,6,0,0,409,410,5,50,0,0,410,412,7,13,0,0,411,407,1,0,0,0,411,409,1,0,0,0,412,413,1,0,0,0,413,414,5,58,0,0,414,415,7,14,0,0,415,416,7,6,0,0,416,429,1,0,0,0,417,418,5,58,0,0,418,419,7,14,0,0,419,420,7,6,0,0,420,427,1,0,0,0,421,423,5,46,0,0,422,424,7,6,0,0,423,422,1,0,0,0,424,425,1,0,0,0,425,423,1,0,0,0,425,426,1,0,0,0,426,428,1,0,0,0,427,421,1,0,0,0,427,428,1,0,0,0,428,430,1,0,0,0,429,417,1,0,0,0,429,430,1,0,0,0,430,92,1,0,0,0,431,447,5,90,0,0,432,439,7,2,0,0,433,435,7,12,0,0,434,433,1,0,0,0,434,435,1,0,0,0,435,436,1,0,0,0,436,440,7,6,0,0,437,438,5,50,0,0,438,440,7,13,0,0,439,434,1,0,0,0,439,437,1,0,0,0,440,444,1,0,0,0,441,442,5,58,0,0,442,443,7,14,0,0,443,445,7,6,0,0,444,441,1,0,0,0,444,445,1,0,0,0,445,447,1,0,0,0,446,431,1,0,0,0,446,432,1,0,0,0,447,94,1,0,0,0,448,451,5,92,0,0,449,452,3,97,48,0,450,452,9,0,0,0,451,449,1,0,0,0,451,450,1,0,0,0,452,96,1,0,0,0,453,454,5,117,0,0,454,455,3,99,49,0,455,456,3,99,49,0,456,457,3,99,49,0,457,458,3,99,49,0,458,98,1,0,0,0,459,460,7,15,0,0,460,100,1,0,0,0,35,0,226,239,290,300,303,308,314,317,321,326,328,336,338,341,346,354,356,361,363,370,372,376,381,396,405,411,425,427,429,434,439,444,446,451,1,0,1,0];y.DecisionsToDFA=y._ATN.decisionToState.map((o,e)=>new fe.DFA(o,e));var Ta=y;var h=require("@browsery/antlr4");var _=class _ extends h.Parser{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return _.literalNames}get symbolicNames(){return _.symbolicNames}get ruleNames(){return _.ruleNames}get serializedATN(){return _._serializedATN}createFailedPredicateException(e,t){return new h.FailedPredicateException(this,e,t)}constructor(e){super(e),this._interp=new h.ParserATNSimulator(this,_._ATN,_.DecisionsToDFA,new h.PredictionContextCache)}root(){let e=new Vo(this,this._ctx,this.state);this.enterRule(e,0,_.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(_.EOF)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}expression(e){e===void 0&&(e=0);let t=this._ctx,r=this.state,i=new te(this,this._ctx,r),n=i,s=2;this.enterRecursionRule(i,2,_.RULE_expression,e);let p;try{let c;this.enterOuterAlt(i,1);{switch(this.state=48,this._errHandler.sync(this),this._input.LA(1)){case 35:i=new Jo(this,i),this._ctx=i,n=i,this.state=38,i._left=this.comparisonLeft(),this.state=39,i._operator=this.comparisonOperator(),this.state=40,i._right=this.comparisonRight();break;case 1:i=new Ko(this,i),this._ctx=i,n=i,this.state=42,this.match(_.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(_.T__1);break;case 3:case 4:i=new zo(this,i),this._ctx=i,n=i,this.state=46,p=this._input.LA(1),p===3||p===4?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=47,this.expression(1);break;default:throw new h.NoViableAltException(this)}for(this._ctx.stop=this._input.LT(-1),this.state=56,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx);c!==2&&c!==h.ATN.INVALID_ALT_NUMBER;){if(c===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),n=i;{if(i=new Nr(this,new te(this,t,r)),this.pushNewRecursionContext(i,s,_.RULE_expression),this.state=50,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=51,i._op=this.logicalOperator(),this.state=52,this.expression(4)}}this.state=58,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx)}}}catch(c){if(c instanceof h.RecognitionException)i.exception=c,this._errHandler.reportError(this,c),this._errHandler.recover(this,c);else throw c}finally{this.unrollRecursionContexts(t)}return i}comparisonLeft(){let e=new Qr(this,this._ctx,this.state);this.enterRule(e,4,_.RULE_comparisonLeft);try{this.enterOuterAlt(e,1),this.state=59,this.qualifiedIdentifier()}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}comparisonRight(){let e=new Xr(this,this._ctx,this.state);this.enterRule(e,6,_.RULE_comparisonRight);try{switch(this.state=65,this._errHandler.sync(this),this._input.LA(1)){case 10:case 11:case 12:case 13:case 14:case 37:case 38:case 39:case 40:case 42:this.enterOuterAlt(e,1),this.state=61,this.value();break;case 35:this.enterOuterAlt(e,2),this.state=62,this.qualifiedIdentifier();break;case 6:this.enterOuterAlt(e,3),this.state=63,this.externalConstant();break;case 7:this.enterOuterAlt(e,4),this.state=64,this.arrayValue();break;default:throw new h.NoViableAltException(this)}}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}parenthesizedItem(){let e=new Zr(this,this._ctx,this.state);this.enterRule(e,8,_.RULE_parenthesizedItem);try{this.enterOuterAlt(e,1),this.state=67,this.expression(0)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}value(){let e=new H(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 en(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(_.NUMBER);break;case 13:case 14:e=new Zo(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new Ho(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new Yo(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 38:e=new Go(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(_.DATETIME);break;case 37:e=new Xo(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(_.DATE);break;case 39:e=new Wo(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(_.TIME);break;case 42:e=new Qo(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(_.STRING);break;default:throw new h.NoViableAltException(this)}}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}qualifiedIdentifier(){let e=new Sr(this,this._ctx,this.state);this.enterRule(e,12,_.RULE_qualifiedIdentifier);try{let t;this.enterOuterAlt(e,1);{for(this.state=84,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);t!==2&&t!==h.ATN.INVALID_ALT_NUMBER;)t===1&&(this.state=79,this.identifier(),this.state=80,this.match(_.T__4)),this.state=86,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);this.state=87,this.identifier()}}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}externalConstant(){let e=new Hr(this,this._ctx,this.state);this.enterRule(e,14,_.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(_.T__5),this.state=90,this.identifier()}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}identifier(){let e=new _t(this,this._ctx,this.state);this.enterRule(e,16,_.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(_.IDENTIFIER)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}arrayValue(){let e=new ei(this,this._ctx,this.state);this.enterRule(e,18,_.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(_.T__6),this.state=95,this.value(),this.state=100,this._errHandler.sync(this),t=this._input.LA(1);t===8;)this.state=96,this.match(_.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(_.T__8)}}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}boolean_(){let e=new ti(this,this._ctx,this.state);this.enterRule(e,20,_.RULE_boolean);let t;try{this.enterOuterAlt(e,1),this.state=105,t=this._input.LA(1),t===10||t===11?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}null_(){let e=new ri(this,this._ctx,this.state);this.enterRule(e,22,_.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(_.T__11)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}infinity(){let e=new ii(this,this._ctx,this.state);this.enterRule(e,24,_.RULE_infinity);let t;try{this.enterOuterAlt(e,1),this.state=109,t=this._input.LA(1),t===13||t===14?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}arithmeticOperator(){let e=new tn(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)===0&&(1<<t&491520)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}comparisonOperator(){let e=new oi(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)===0&&(1<<t&2146959360)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}logicalOperator(){let e=new ni(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)===0&&(1<<t-31&15)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}polarityOperator(){let e=new rn(this,this._ctx,this.state);this.enterRule(e,32,_.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(_.POLAR_OP)}catch(t){if(t instanceof h.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}sempred(e,t,r){switch(t){case 1:return this.expression_sempred(e,r)}return!0}expression_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,3)}return!0}static get _ATN(){return _.__ATN||(_.__ATN=new h.ATNDeserializer().deserialize(_._serializedATN)),_.__ATN}};a(_,"OpraFilterParser");var f=_;f.T__0=1;f.T__1=2;f.T__2=3;f.T__3=4;f.T__4=5;f.T__5=6;f.T__6=7;f.T__7=8;f.T__8=9;f.T__9=10;f.T__10=11;f.T__11=12;f.T__12=13;f.T__13=14;f.T__14=15;f.T__15=16;f.T__16=17;f.T__17=18;f.T__18=19;f.T__19=20;f.T__20=21;f.T__21=22;f.T__22=23;f.T__23=24;f.T__24=25;f.T__25=26;f.T__26=27;f.T__27=28;f.T__28=29;f.T__29=30;f.T__30=31;f.T__31=32;f.T__32=33;f.T__33=34;f.IDENTIFIER=35;f.POLAR_OP=36;f.DATE=37;f.DATETIME=38;f.TIME=39;f.NUMBER=40;f.INTEGER=41;f.STRING=42;f.WHITESPACE=43;f.EOF=h.Token.EOF;f.RULE_root=0;f.RULE_expression=1;f.RULE_comparisonLeft=2;f.RULE_comparisonRight=3;f.RULE_parenthesizedItem=4;f.RULE_value=5;f.RULE_qualifiedIdentifier=6;f.RULE_externalConstant=7;f.RULE_identifier=8;f.RULE_arrayValue=9;f.RULE_boolean=10;f.RULE_null=11;f.RULE_infinity=12;f.RULE_arithmeticOperator=13;f.RULE_comparisonOperator=14;f.RULE_logicalOperator=15;f.RULE_polarityOperator=16;f.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];f.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];f.ruleNames=["root","expression","comparisonLeft","comparisonRight","parenthesizedItem","value","qualifiedIdentifier","externalConstant","identifier","arrayValue","boolean","null","infinity","arithmeticOperator","comparisonOperator","logicalOperator","polarityOperator"];f._serializedATN=[4,1,43,120,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,49,8,1,1,1,1,1,1,1,1,1,5,1,55,8,1,10,1,12,1,58,9,1,1,2,1,2,1,3,1,3,1,3,1,3,3,3,66,8,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,78,8,5,1,6,1,6,1,6,5,6,83,8,6,10,6,12,6,86,9,6,1,6,1,6,1,7,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,5,9,99,8,9,10,9,12,9,102,9,9,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,16,0,1,2,17,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,0,6,1,0,3,4,1,0,10,11,1,0,13,14,1,0,15,18,1,0,19,30,1,0,31,34,117,0,34,1,0,0,0,2,48,1,0,0,0,4,59,1,0,0,0,6,65,1,0,0,0,8,67,1,0,0,0,10,77,1,0,0,0,12,84,1,0,0,0,14,89,1,0,0,0,16,92,1,0,0,0,18,94,1,0,0,0,20,105,1,0,0,0,22,107,1,0,0,0,24,109,1,0,0,0,26,111,1,0,0,0,28,113,1,0,0,0,30,115,1,0,0,0,32,117,1,0,0,0,34,35,3,2,1,0,35,36,5,0,0,1,36,1,1,0,0,0,37,38,6,1,-1,0,38,39,3,4,2,0,39,40,3,28,14,0,40,41,3,6,3,0,41,49,1,0,0,0,42,43,5,1,0,0,43,44,3,8,4,0,44,45,5,2,0,0,45,49,1,0,0,0,46,47,7,0,0,0,47,49,3,2,1,1,48,37,1,0,0,0,48,42,1,0,0,0,48,46,1,0,0,0,49,56,1,0,0,0,50,51,10,3,0,0,51,52,3,30,15,0,52,53,3,2,1,4,53,55,1,0,0,0,54,50,1,0,0,0,55,58,1,0,0,0,56,54,1,0,0,0,56,57,1,0,0,0,57,3,1,0,0,0,58,56,1,0,0,0,59,60,3,12,6,0,60,5,1,0,0,0,61,66,3,10,5,0,62,66,3,12,6,0,63,66,3,14,7,0,64,66,3,18,9,0,65,61,1,0,0,0,65,62,1,0,0,0,65,63,1,0,0,0,65,64,1,0,0,0,66,7,1,0,0,0,67,68,3,2,1,0,68,9,1,0,0,0,69,78,5,40,0,0,70,78,3,24,12,0,71,78,3,20,10,0,72,78,3,22,11,0,73,78,5,38,0,0,74,78,5,37,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((o,e)=>new h.DFA(o,e));var Ea=f,on=class on extends h.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)}};a(on,"RootContext");var Vo=on,nn=class nn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_expression}copyFrom(e){super.copyFrom(e)}};a(nn,"ExpressionContext");var te=nn,sn=class sn extends te{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(Zr,0)}enterRule(e){e.enterParenthesizedExpression&&e.enterParenthesizedExpression(this)}exitRule(e){e.exitParenthesizedExpression&&e.exitParenthesizedExpression(this)}accept(e){return e.visitParenthesizedExpression?e.visitParenthesizedExpression(this):e.visitChildren(this)}};a(sn,"ParenthesizedExpressionContext");var Ko=sn,an=class an 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)}};a(an,"NegativeExpressionContext");var zo=an,pn=class pn extends te{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(Qr,0)}comparisonOperator(){return this.getTypedRuleContext(oi,0)}comparisonRight(){return this.getTypedRuleContext(Xr,0)}enterRule(e){e.enterComparisonExpression&&e.enterComparisonExpression(this)}exitRule(e){e.exitComparisonExpression&&e.exitComparisonExpression(this)}accept(e){return e.visitComparisonExpression?e.visitComparisonExpression(this):e.visitChildren(this)}};a(pn,"ComparisonExpressionContext");var Jo=pn,cn=class cn 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(ni,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)}};a(cn,"LogicalExpressionContext");var Nr=cn,ln=class ln extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(Sr,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)}};a(ln,"ComparisonLeftContext");var Qr=ln,fn=class fn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(H,0)}qualifiedIdentifier(){return this.getTypedRuleContext(Sr,0)}externalConstant(){return this.getTypedRuleContext(Hr,0)}arrayValue(){return this.getTypedRuleContext(ei,0)}get ruleIndex(){return f.RULE_comparisonRight}enterRule(e){e.enterComparisonRight&&e.enterComparisonRight(this)}exitRule(e){e.exitComparisonRight&&e.exitComparisonRight(this)}accept(e){return e.visitComparisonRight?e.visitComparisonRight(this):e.visitChildren(this)}};a(fn,"ComparisonRightContext");var Xr=fn,mn=class mn extends h.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)}};a(mn,"ParenthesizedItemContext");var Zr=mn,un=class un extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_value}copyFrom(e){super.copyFrom(e)}};a(un,"ValueContext");var H=un,dn=class dn extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(f.TIME,0)}enterRule(e){e.enterTimeLiteral&&e.enterTimeLiteral(this)}exitRule(e){e.exitTimeLiteral&&e.exitTimeLiteral(this)}accept(e){return e.visitTimeLiteral?e.visitTimeLiteral(this):e.visitChildren(this)}};a(dn,"TimeLiteralContext");var Wo=dn,hn=class hn extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(ri,0)}enterRule(e){e.enterNullLiteral&&e.enterNullLiteral(this)}exitRule(e){e.exitNullLiteral&&e.exitNullLiteral(this)}accept(e){return e.visitNullLiteral?e.visitNullLiteral(this):e.visitChildren(this)}};a(hn,"NullLiteralContext");var Yo=hn,yn=class yn extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(f.DATETIME,0)}enterRule(e){e.enterDateTimeLiteral&&e.enterDateTimeLiteral(this)}exitRule(e){e.exitDateTimeLiteral&&e.exitDateTimeLiteral(this)}accept(e){return e.visitDateTimeLiteral?e.visitDateTimeLiteral(this):e.visitChildren(this)}};a(yn,"DateTimeLiteralContext");var Go=yn,Tn=class Tn extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(f.STRING,0)}enterRule(e){e.enterStringLiteral&&e.enterStringLiteral(this)}exitRule(e){e.exitStringLiteral&&e.exitStringLiteral(this)}accept(e){return e.visitStringLiteral?e.visitStringLiteral(this):e.visitChildren(this)}};a(Tn,"StringLiteralContext");var Qo=Tn,En=class En extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(f.DATE,0)}enterRule(e){e.enterDateLiteral&&e.enterDateLiteral(this)}exitRule(e){e.exitDateLiteral&&e.exitDateLiteral(this)}accept(e){return e.visitDateLiteral?e.visitDateLiteral(this):e.visitChildren(this)}};a(En,"DateLiteralContext");var Xo=En,_n=class _n extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(ii,0)}enterRule(e){e.enterInfinityLiteral&&e.enterInfinityLiteral(this)}exitRule(e){e.exitInfinityLiteral&&e.exitInfinityLiteral(this)}accept(e){return e.visitInfinityLiteral?e.visitInfinityLiteral(this):e.visitChildren(this)}};a(_n,"InfinityLiteralContext");var Zo=_n,xn=class xn extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(ti,0)}enterRule(e){e.enterBooleanLiteral&&e.enterBooleanLiteral(this)}exitRule(e){e.exitBooleanLiteral&&e.exitBooleanLiteral(this)}accept(e){return e.visitBooleanLiteral?e.visitBooleanLiteral(this):e.visitChildren(this)}};a(xn,"BooleanLiteralContext");var Ho=xn,On=class On extends H{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(f.NUMBER,0)}enterRule(e){e.enterNumberLiteral&&e.enterNumberLiteral(this)}exitRule(e){e.exitNumberLiteral&&e.exitNumberLiteral(this)}accept(e){return e.visitNumberLiteral?e.visitNumberLiteral(this):e.visitChildren(this)}};a(On,"NumberLiteralContext");var en=On,gn=class gn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(_t)}identifier(e){return this.getTypedRuleContext(_t,e)}get ruleIndex(){return f.RULE_qualifiedIdentifier}enterRule(e){e.enterQualifiedIdentifier&&e.enterQualifiedIdentifier(this)}exitRule(e){e.exitQualifiedIdentifier&&e.exitQualifiedIdentifier(this)}accept(e){return e.visitQualifiedIdentifier?e.visitQualifiedIdentifier(this):e.visitChildren(this)}};a(gn,"QualifiedIdentifierContext");var Sr=gn,wn=class wn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(_t,0)}get ruleIndex(){return f.RULE_externalConstant}enterRule(e){e.enterExternalConstant&&e.enterExternalConstant(this)}exitRule(e){e.exitExternalConstant&&e.exitExternalConstant(this)}accept(e){return e.visitExternalConstant?e.visitExternalConstant(this):e.visitChildren(this)}};a(wn,"ExternalConstantContext");var Hr=wn,Rn=class Rn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(f.IDENTIFIER,0)}get ruleIndex(){return f.RULE_identifier}enterRule(e){e.enterIdentifier&&e.enterIdentifier(this)}exitRule(e){e.exitIdentifier&&e.exitIdentifier(this)}accept(e){return e.visitIdentifier?e.visitIdentifier(this):e.visitChildren(this)}};a(Rn,"IdentifierContext");var _t=Rn,bn=class bn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(H)}value(e){return this.getTypedRuleContext(H,e)}get ruleIndex(){return f.RULE_arrayValue}enterRule(e){e.enterArrayValue&&e.enterArrayValue(this)}exitRule(e){e.exitArrayValue&&e.exitArrayValue(this)}accept(e){return e.visitArrayValue?e.visitArrayValue(this):e.visitChildren(this)}};a(bn,"ArrayValueContext");var ei=bn,An=class An extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_boolean}enterRule(e){e.enterBoolean&&e.enterBoolean(this)}exitRule(e){e.exitBoolean&&e.exitBoolean(this)}accept(e){return e.visitBoolean?e.visitBoolean(this):e.visitChildren(this)}};a(An,"BooleanContext");var ti=An,Dn=class Dn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_null}enterRule(e){e.enterNull&&e.enterNull(this)}exitRule(e){e.exitNull&&e.exitNull(this)}accept(e){return e.visitNull?e.visitNull(this):e.visitChildren(this)}};a(Dn,"NullContext");var ri=Dn,Nn=class Nn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_infinity}enterRule(e){e.enterInfinity&&e.enterInfinity(this)}exitRule(e){e.exitInfinity&&e.exitInfinity(this)}accept(e){return e.visitInfinity?e.visitInfinity(this):e.visitChildren(this)}};a(Nn,"InfinityContext");var ii=Nn,Sn=class Sn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_arithmeticOperator}enterRule(e){e.enterArithmeticOperator&&e.enterArithmeticOperator(this)}exitRule(e){e.exitArithmeticOperator&&e.exitArithmeticOperator(this)}accept(e){return e.visitArithmeticOperator?e.visitArithmeticOperator(this):e.visitChildren(this)}};a(Sn,"ArithmeticOperatorContext");var tn=Sn,vn=class vn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_comparisonOperator}enterRule(e){e.enterComparisonOperator&&e.enterComparisonOperator(this)}exitRule(e){e.exitComparisonOperator&&e.exitComparisonOperator(this)}accept(e){return e.visitComparisonOperator?e.visitComparisonOperator(this):e.visitChildren(this)}};a(vn,"ComparisonOperatorContext");var oi=vn,Mn=class Mn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_logicalOperator}enterRule(e){e.enterLogicalOperator&&e.enterLogicalOperator(this)}exitRule(e){e.exitLogicalOperator&&e.exitLogicalOperator(this)}accept(e){return e.visitLogicalOperator?e.visitLogicalOperator(this):e.visitChildren(this)}};a(Mn,"LogicalOperatorContext");var ni=Mn,Fn=class Fn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}POLAR_OP(){return this.getToken(f.POLAR_OP,0)}get ruleIndex(){return f.RULE_polarityOperator}enterRule(e){e.enterPolarityOperator&&e.enterPolarityOperator(this)}exitRule(e){e.exitPolarityOperator&&e.exitPolarityOperator(this)}accept(e){return e.visitPolarityOperator?e.visitPolarityOperator(this):e.visitChildren(this)}};a(Fn,"PolarityOperatorContext");var rn=Fn;var _a=require("@browsery/antlr4");var In=class In extends I{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};a(In,"ExternalConstant");var si=In;var Pn=class Pn extends _a.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 be(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new br(t)}visitComparisonExpression(e){return new _e({op:e.comparisonOperator().getText(),left:this.visit(e.comparisonLeft()),right:this.visit(e.comparisonRight())})}visitLogicalExpression(e){let t=[],r=a((i,n)=>{for(let s of i){if(s instanceof Nr&&s.logicalOperator().getText()===n){r(s.expression_list(),s.logicalOperator().getText());continue}let p=this.visit(s);t.push(p)}},"wrapChildren");return r(e.expression_list(),e.logicalOperator().getText()),new xe({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new le(e.getText())}visitExternalConstant(e){return new si(e.identifier().getText())}visitNullLiteral(){return new tt}visitBooleanLiteral(e){return new et(e.getText()==="true")}visitNumberLiteral(e){return new Ae(e.getText())}visitStringLiteral(e){return new rt(Ar(e.getText()))}visitInfinityLiteral(){return new Ae(1/0)}visitDateLiteral(e){return new Me(Ar(e.getText()))}visitDateTimeLiteral(e){return new Dr(Ar(e.getText()))}visitTimeLiteral(e){return new it(Ar(e.getText()))}visitArrayValue(e){return new Re(e.value_list().map(t=>this.visit(t)))}};a(Pn,"FilterTreeVisitor");var vr=Pn;var xa=require("@browsery/antlr4");var Ln=class Ln extends xa.ErrorListener{constructor(e){super(),this.errors=e}syntaxError(e,t,r,i,n,s){this.errors.push(new Yr(n,{recognizer:e,offendingSymbol:t,line:r,column:i,e:s}))}};a(Ln,"OpraErrorListener");var Mr=Ln;function kn(o,e){let t=new ai.CharStream(o),r=new Ta(t),i=new ai.CommonTokenStream(r),n=new Ea(i);n.buildParseTrees=!0;let s=[],p=new Mr(s);r.removeErrorListeners(),r.addErrorListener(p),n.removeErrorListeners(),n.addErrorListener(p);let c=n.root();if(s.length){let l=[];for(let w of s)l.push(w.message+(o.includes(`
|
|
8
|
+
`)?" at line: "+w.line+" column: "+w.column:" at column: "+w.column));let O=new Wr(l.join(`
|
|
9
|
+
`));throw O.errors=s,O}return e=e||new vr,e.visit(c)}a(kn,"parse");var jn=class jn{constructor(e,t){if(this._rules=new M,this._decoderCache=new WeakMap,Object.defineProperty(this,"_rules",{value:new M(null,{caseSensitive:t==null?void 0:t.caseSensitive}),enumerable:!1}),e)for(let[r,i]of Object.entries(e))this.set(r,i)}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,(0,Oa.omitUndefined)({...t,operators:r}))}normalizeFilter(e,t,r){let i=typeof e=="string"?kn(e):e;return this.normalizeFilterAst(i,[],t,r)}normalizeFilterAst(e,t,r,i){if(e instanceof _e){if(t.push(e),this.normalizeFilterAst(e.left,t,r),!(e.left instanceof le&&e.left.field))throw new TypeError("Invalid filter query. Left side should be a data field.");let n=this._rules.get(e.left.value);if(!n)throw new Te({message:`Field '${e.left.value}' is not available for filter operation`,code:"UNACCEPTED_FILTER_FIELD",details:{field:e.left.value}});if(n.operators&&!n.operators.includes(e.op))throw new Te({message:`'${e.left.value}' field do not accept '${e.op}' filter operator`,code:"UNACCEPTED_FILTER_OPERATION",details:{field:e.left.value,operator:e.op}});return n.mappedField&&(e.left.value=n.mappedField),n.prepare&&(e.prepare=n.prepare),this.normalizeFilterAst(e.right,t,r),t.pop(),e}if(e instanceof xe)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof He)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n.expression,t,r)),t.pop(),e;if(e instanceof Re)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof be)return t.push(e),this.normalizeFilterAst(e.expression,t,r),t.pop(),e;if(e instanceof le&&r)return e.value=r.normalizeFieldPath(e.value,{scope:i}),e.field=r.getField(e.value,i),e.dataType=e.field.type,e;if(e instanceof I){let n=t.findLastIndex(s=>s instanceof _e);if(n>=0){let s=t[n];if((e===s.right||t[n+1]===s.right)&&s&&s.left instanceof le&&s.left.field){if(e.value==null&&!s.left.field.required)return e.value;let p;s.op==="like"||s.op==="!like"||s.op==="ilike"||s.op==="!ilike"?p=ga.isString:p=this._decoderCache.get(s.left.field),p||(p=s.left.field.type.generateCodec("decode",{scope:i,projection:"*",ignoreWriteonlyFields:!0,coerce:!0}),this._decoderCache.set(s.left.field,p)),e.value=p(e.value,{coerce:!0})}}}return e}toJSON(){return this._rules.toObject()}[Symbol.iterator](){return this._rules.entries()}};a(jn,"FilterRules");var xt=jn;var Da=yt(require("object-hash"),1),Na=require("ts-gems"),K=require("valgen");var ba=require("@jsopen/objects"),Aa=require("ts-gems");var wa=require("ts-gems"),Ra=require("uid");var m={};yr(m,{ComplexType:()=>Ot,EnumType:()=>gt,HttpController:()=>Fr,HttpOperation:()=>Cn,MappedType:()=>wt,MixinType:()=>Rt,RpcController:()=>Un,RpcOperation:()=>$n,SimpleType:()=>bt,SpecVersion:()=>yd,UnionType:()=>At,isComplexType:()=>ac,isDataType:()=>sc,isEnumType:()=>fc,isHttpController:()=>uc,isMappedType:()=>lc,isMixinType:()=>cc,isSimpleType:()=>pc,isUnionType:()=>mc});var yd="1.0";var Ot;(function(o){o.Kind="ComplexType"})(Ot||(Ot={}));var gt;(function(o){o.Kind="EnumType"})(gt||(gt={}));var wt;(function(o){o.Kind="MappedType"})(wt||(wt={}));var Rt;(function(o){o.Kind="MixinType"})(Rt||(Rt={}));var bt;(function(o){o.Kind="SimpleType"})(bt||(bt={}));var At;(function(o){o.Kind="UnionType"})(At||(At={}));var Fr;(function(o){o.Kind="HttpController"})(Fr||(Fr={}));var Cn;(function(o){o.Kind="HttpOperation"})(Cn||(Cn={}));var Un;(function(o){o.Kind="RpcController"})(Un||(Un={}));var $n;(function(o){o.Kind="RpcOperation"})($n||($n={}));function sc(o){return o&&typeof o=="object"&&(o.kind===Ot.Kind||o.kind===gt.Kind||o.kind===wt.Kind||o.kind===bt.Kind||o.kind===Rt.Kind||o.kind===At.Kind)}a(sc,"isDataType");function ac(o){return o&&typeof o=="object"&&o.kind===Ot.Kind}a(ac,"isComplexType");function pc(o){return o&&typeof o=="object"&&o.kind===bt.Kind}a(pc,"isSimpleType");function cc(o){return o&&typeof o=="object"&&o.kind===Rt.Kind}a(cc,"isMixinType");function lc(o){return o&&typeof o=="object"&&o.kind===wt.Kind}a(lc,"isMappedType");function fc(o){return o&&typeof o=="object"&&o.kind===gt.Kind}a(fc,"isEnumType");function mc(o){return o&&typeof o=="object"&&o.kind===At.Kind}a(mc,"isUnionType");function uc(o){return o&&typeof o=="object"&&o.kind===Fr.Kind}a(uc,"isHttpController");var Bn=class Bn{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[we])return this.element;if(this.parent)return this._document=this.parent.getDocument();throw new Error("ApiDocument not found in document tree")}hasDataType(e,t){return!!this.findDataType(e,t)}findDataType(e,t){var i;let r=(i=this[B])==null?void 0:i.get(e);return r&&r.inScope(t)?r:this.parent?this.parent.findDataType(e,t):void 0}getDataType(e,t){let r=this.findDataType(e,t);if(r)return r;let i="";if(typeof e=="function")i=Reflect.getMetadata(d,e).name;else if(typeof e=="object"){let n=e[d];i=n==null?void 0:n.name}throw i||(e&&typeof e=="string"?i=e:typeof e=="function"&&(i=e.name)),r?new TypeError(`Data type${i?" ("+i+")":""} is not in requested scope (${t})`):new TypeError(`Unknown data type${i?" ("+i+")":""}`)}getDataTypeNameWithNs(e){if(!e.name)return;let t=this.getDocument().getDataTypeNs(e);return t?t+":"+e.name:e.name}getComplexType(e,t){let r=this.getDataType(e,t);if(r.kind===m.ComplexType.Kind)return r;throw new TypeError(`Data type "${r.name}" is not a ComplexType`)}getSimpleType(e,t){let r=this.getDataType(e,t);if(r.kind===m.SimpleType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a SimpleType`)}getEnumType(e,t){let r=this.getDataType(e,t);if(r.kind===m.EnumType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a EnumType`)}getMappedType(e,t){let r=this.getDataType(e,t);if(r.kind===m.MappedType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MappedType`)}getMixinType(e,t){let r=this.getDataType(e,t);if(r.kind===m.MixinType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MixinType`)}getUnionType(e,t){let r=this.getDataType(e,t);if(r.kind===m.UnionType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MixinType`)}};a(Bn,"DocumentNode");var Ir=Bn;var b=a(function(o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=(0,wa.asMutable)(this);e.id=(0,Ra.uid)(16),Object.defineProperty(e,"node",{value:new Ir(this,o==null?void 0:o.node),enumerable:!1,writable:!0}),o&&Object.defineProperty(e,"owner",{value:o,enumerable:!1,writable:!0})},"DocumentElement"),Vn=class Vn{};a(Vn,"DocumentElementClass");var qn=Vn;b.prototype=qn.prototype;var Dt=Symbol.for("nodejs.util.inspect.custom"),ot="\x1B[0m",Nt="\x1B[33m",St="\x1B[35m";function Pr(o,e){return!e||o==="*"?!0:o?Array.isArray(e)?e.some(t=>typeof t=="string"?o===t:t.test(o)):typeof e=="string"?o===e:e.test(o):!1}a(Pr,"testScopeMatch");var x=a(function(o,e,t){if(!this)throw new TypeError('"this" should be passed to call class constructor');if(e!=null&&e.name&&!$.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);b.call(this,o);let r=(0,Aa.asMutable)(this);r.kind=e.kind,r.scopePattern=e.scopePattern?Array.isArray(e.scopePattern)?e.scopePattern:[e.scopePattern]:void 0,r.name=e.name,r.description=e.description,r.abstract=e.abstract,r.examples=e.examples},"DataType"),zn=class zn extends b{get embedded(){return!this.name}inScope(e){return Pr(e,this.scopePattern)}toJSON(e){let t=this._locateBase(r=>!r.inScope(e==null?void 0:e.scope));if(t){let r=this.node.getDataTypeNameWithNs(t);throw new TypeError(`"${r}" model is not available for "${(e==null?void 0:e.scope)||"null"}" scope`)}return(0,ba.omitUndefined)({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[Dt](){return`[${Nt+Object.getPrototypeOf(this).constructor.name+ot} ${St+this.name+ot}]`}};a(zn,"DataTypeClass");var Kn=zn;x.prototype=Kn.prototype;var vt=/^([+-])?([a-z$_][\w.]*)$/i,U=a(function(...o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;x.call(this,e,t,r);let i=(0,Na.asMutable)(this);i._fields=new M},"ComplexTypeBase"),Wn=class Wn extends x{fieldCount(e){if(e==="*")return this._fields.size;let t=0;for(let r of this.fields(e))t++;return t}fieldEntries(e){let t=this._fields.entries();if(e==="*")return t;let r;return{next(){for(;t&&(r=t.next(),!(r.done||r.value&&r.value[1].inScope(e))););return r.done?{done:r.done,value:void 0}:{done:r.done,value:[r.value[0],r.value[1].forScope(e)]}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}fields(e){let t=this.fieldEntries(e),r;return{next(){var i;return t?(r=t.next(),{done:r.done,value:(i=r.value)==null?void 0:i[1]}):{done:!0,value:void 0}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}fieldNames(e){if(e==="*")return this._fields.keys();let t=this.fieldEntries(e),r;return{next(){var i;return t?(r=t.next(),{done:r.done,value:(i=r.value)==null?void 0:i[0]}):{done:!0,value:void 0}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}findField(e,t){if(e.includes(".")){let i=this.parseFieldPath(e,{scope:t});if(i.length===0)throw new Error(`Field "${e}" does not exist in scope "${t}"`);let n=i.pop();return n==null?void 0:n.field}let r=this._fields.get(e);if(r&&r.inScope(t))return r.forScope(t)}getField(e,t){let r=this.findField(e,"*");if(r&&!r.inScope(t))throw new Error(`Field "${e}" does not exist in scope "${t||"null"}"`);if(!r)throw new Error(`Field (${e}) does not exist`);return r.forScope(t)}parseFieldPath(e,t){var w,T,ee;let r=this,i,n=e.split("."),s=n.length,p=[],c=this.owner.node.getDataType("object"),l=t==null?void 0:t.allowSigns,O=a(()=>p.map(j=>j.fieldName).join("."),"getStrPath");for(let j=0;j<s;j++){let z={fieldName:n[j],dataType:c};p.push(z);let Xe=vt.exec(n[j]);if(!Xe)throw new TypeError(`Invalid field name (${O()})`);if(Xe[1]&&((j===0&&l==="first"||l==="each")&&(z.sign=Xe[1]),z.fieldName=Xe[2]),r){if(r instanceof U){if(i=r.findField(z.fieldName,t==null?void 0:t.scope),i){z.fieldName=i.name,z.field=i,z.dataType=i.type,r=i.type;continue}if(((w=r.additionalFields)==null?void 0:w[0])===!0){z.additionalField=!0,z.dataType=c,r=void 0;continue}if(((T=r.additionalFields)==null?void 0:T[0])==="type"&&((ee=r.additionalFields)==null?void 0:ee[1])instanceof x){z.additionalField=!0,z.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(ji=>ji.fieldName).join(".")})`)}throw new TypeError(`"${p.map(ji=>ji.fieldName).join(".")}" field is not a complex type and has no child fields`)}z.additionalField=!0,z.dataType=c}return p}normalizeFieldPath(e,t){return this.parseFieldPath(e,t).map(r=>(r.sign||"")+r.fieldName).join(".")}generateCodec(e,t){var p;let r=t!=null&&t.cache?t:{...t,projection:Array.isArray(t==null?void 0:t.projection)?yo(t.projection):t==null?void 0:t.projection,currentPath:""},i=this._generateSchema(e,r),n;if(this.additionalFields instanceof x)n=this.additionalFields.generateCodec(e,t);else if(typeof this.additionalFields=="boolean")n=this.additionalFields;else if(Array.isArray(this.additionalFields))if(this.additionalFields.length<2)n="error";else{let c=n[1];n=(0,K.validator)((l,O,w)=>O.fail(w,c,l))}let s=K.vg.isObject(i,{ctor:this.name==="object"?Object:this.ctor,additionalFields:n,name:this.name,coerce:!0,caseInSensitive:t==null?void 0:t.caseInSensitive,onFail:t==null?void 0:t.onFail});if(r.level===0&&((p=r.forwardCallbacks)!=null&&p.size))for(let c of r.forwardCallbacks)c();return s}_generateSchema(e,t){var c;t.fieldCache=t.fieldCache||new Map,t.level=t.level||0,t.forwardCallbacks=t.forwardCallbacks||new Set;let r={},{currentPath:i,projection:n}=t,s=!!(n&&Object.values(n).find(l=>!l.sign)),p;for(let l of this.fields("*")){if(!l.inScope(t.scope)||!(t.keepKeyFields&&this.keyField)&&(t.ignoreReadonlyFields&&l.readonly||t.ignoreWriteonlyFields&&l.writeonly)){r[l.name]=K.vg.isUndefined({coerce:!0});continue}p=l.name;let O;if(n!=="*"&&(O=n==null?void 0:n[p.toLowerCase()],(O==null?void 0:O.sign)==="-"||s&&!O||!s&&l.exclusive&&!O)){r[l.name]=K.vg.isUndefined({coerce:!0});continue}let w=typeof n=="object"?((c=n[p])==null?void 0:c.projection)||"*":n,T=t.fieldCache.get(l),ee=typeof w=="string"?w:(0,Da.default)(w||{});T||(T={},t.fieldCache.set(l,T));let j=T[ee];if(j===null)j=K.vg.isAny(),t.forwardCallbacks.add(()=>{j=T[ee],r[p]=t.partial||!l.required?K.vg.optional(j):K.vg.required(j)});else if(!j){let z=a(()=>{T[ee]=null;let Xe=this._generateFieldCodec(e,l,{...t,partial:t.partial==="deep"?t.partial:void 0,projection:w,currentPath:i+(i?".":"")+p});return T[ee]=Xe,Xe},"defaultGenerator");t.fieldHook?j=t.fieldHook(l,t.currentPath,z):j=z()}r[p]=t.partial||!(l.required||j.id==="required")?K.vg.optional(j):j.id==="required"?j:K.vg.required(j)}return t.allowPatchOperators&&(r._$pull=K.vg.optional(K.vg.isAny()),r._$push=K.vg.optional(K.vg.isAny())),r}_generateFieldCodec(e,t,r){let i=t.type.generateCodec(e,{...r,level:r.level+1},{convertToNative:t.convertToNative});return t.fixed&&(i=K.vg.isEqual(t.fixed)),t.isArray&&(i=K.vg.isArray(i)),i}};a(Wn,"ComplexTypeBaseClass");var Jn=Wn;U.prototype=Jn.prototype;var S0=require("reflect-metadata"),pi=require("@jsopen/objects"),Sa=require("ts-gems"),va=require("valgen");var re=a(function(...o){if(!this)return re[N].apply(void 0,o);let[e,t,r]=o;x.call(this,e,t,r);let i=(0,Sa.asMutable)(this);if(i.kind=m.EnumType.Kind,t.base){if(!(t.base instanceof re))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${i.kind}"`);i.base=t.base}i.instance=t.instance,i.ownAttributes=F(t.attributes||{}),i.attributes=i.base?F(i.base.attributes):{};for(let[n,s]of Object.entries(i.ownAttributes))i.attributes[n]=s},"EnumType"),Yn=class Yn extends x{extendsFrom(e){var t;return e instanceof x||(e=this.node.getDataType(e)),e instanceof re?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return va.vg.isEnum(Object.keys(this.attributes))}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return(0,pi.omitUndefined)({...t,kind:this.kind,base:r,attributes:F(this.ownAttributes)})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Yn,"EnumTypeClass");var Lr=Yn;re.prototype=Lr.prototype;Object.assign(re,Lr);function dc(o,...e){let t=e.length>=2?e[0]:void 0,r=e.length>=2?e[1]:e[0],i={},n=o;if(Array.isArray(o)){if(t){if(!Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be array');n=[...t,...o]}i={},o.forEach(p=>{var l;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];i[p]=(0,pi.omitUndefined)({description:c})})}else{if(t){if(Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be enum object');n={...t,...o}}Object.keys(o).forEach(p=>{var l;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];i[o[p]]=(0,pi.omitUndefined)({alias:p,description:c})})}let s={kind:m.EnumType.Kind,attributes:i,base:r==null?void 0:r.base,name:r==null?void 0:r.name,description:r==null?void 0:r.description};return Object.defineProperty(o,d,{value:s,enumerable:!1,configurable:!0,writable:!0}),n}a(dc,"EnumTypeFactory");re.prototype=Lr.prototype;re[N]=dc;var ds={};yr(ds,{Base64Type:()=>ci,DateTimeType:()=>Lt,DateTimeTypeTz:()=>jt,DateType:()=>It,EmailType:()=>ie,FieldPathType:()=>J,FilterType:()=>je,ObjectIdType:()=>hi,OperationResult:()=>ne,PartialDateType:()=>Wt,TimeType:()=>Gt,UrlType:()=>Ti,UuidType:()=>jr});var li=require("tslib"),Fe=require("valgen");var $0=require("reflect-metadata"),Qn=require("@jsopen/objects"),Fa=require("ts-gems"),Xn=require("valgen");function Gn(o){let e=[],t=a(function(r){let i;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!$.test(o.name))throw new TypeError(`"${o.name}" is not a valid type name`);i=o.name}else i=r.name,i=i.toLowerCase();let n=Reflect.getOwnMetadata(d,r)||{};o&&Object.assign(n,o),n.kind=m.SimpleType.Kind,n.name=i,Reflect.defineMetadata(d,n,r);for(let s of e)s(n,r)},"decorator");return t.Example=(r,i)=>(e.push(n=>{n.examples=n.examples||[],n.examples.push({description:i,value:r})}),t),t}a(Gn,"SimpleTypeDecoratorFactory");function Ma(o){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(d,e.constructor)||{},i=Reflect.getMetadata("design:type",e,t),n="string";i===Boolean?n="boolean":i===Number&&(n="number"),r.kind=m.SimpleType.Kind,r.attributes=r.attributes||{},r.attributes[t]={format:(o==null?void 0:o.format)||n,description:o==null?void 0:o.description,deprecated:o==null?void 0:o.deprecated},Reflect.defineMetadata(d,r,e.constructor)}}a(Ma,"AttributeDecoratorFactory");var u=a(function(...o){var n,s;if(!this)return u[N](...o);let[e,t,r]=o;x.call(this,e,t,r);let i=(0,Fa.asMutable)(this);if(i.kind=m.SimpleType.Kind,t.base){if(!(t.base instanceof u))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base}if(i.properties=t.properties,i.ownNameMappings={...t.nameMappings},i.nameMappings={...(n=i.base)==null?void 0:n.nameMappings,...t.nameMappings},i.ownAttributes=F(t.attributes||{}),i.attributes=i.base?F(i.base.attributes):{},i.ownAttributes)for(let[p,c]of Object.entries(i.ownAttributes)){if((s=i.attributes[p])!=null&&s.sealed)throw new TypeError(`Sealed attribute "${p}" can not be overwritten`);i.attributes[p]=c}i._generateDecoder=t.generateDecoder,i._generateEncoder=t.generateEncoder},"SimpleType"),Hn=class Hn extends x{extend(e){return Object.setPrototypeOf(e,this),e}extendsFrom(e){var t;return e instanceof x||(e=this.node.getDataType(e)),e instanceof u?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(e,t,r){let i={...this.properties,...r};if(e==="decode"){let s=this;for(;s;){if(s._generateDecoder)return s._generateDecoder(i,(t==null?void 0:t.documentElement)||this.owner,t==null?void 0:t.scope);s=this.base}return Xn.isAny}let n=this;for(;n;){if(n._generateEncoder)return n._generateEncoder(i,(t==null?void 0:t.documentElement)||this.owner,t==null?void 0:t.scope);n=this.base}return Xn.isAny}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i=(0,Qn.omitUndefined)(this.ownAttributes),n;this.properties&&typeof this.properties.toJSON=="function"?n=this.properties.toJSON(this.properties,this.owner,e):n=this.properties?F(this.properties):{};let s={...t,kind:this.kind,base:r,attributes:i&&Object.keys(i).length?i:void 0,properties:Object.keys(n).length?n:void 0};return Object.keys(this.ownNameMappings).length&&(s.nameMappings={...this.ownNameMappings}),(0,Qn.omitUndefined)(s,!0)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Hn,"SimpleTypeClass");var Zn=Hn;u.prototype=Zn.prototype;Object.assign(u,Gn);u[N]=Gn;u.Attribute=Ma;var Mt,ci=(Mt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=Fe.vg.isBase64({coerce:!0});return e.convertToNative?Fe.vg.pipe([t,hc],{coerce:!0}):t}[g](){return yc}},a(Mt,"Base64Type"),Mt);ci=(0,li.__decorate)([u({name:"base64",description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),(0,li.__metadata)("design:paramtypes",[Object])],ci);var hc=(0,Fe.validator)(o=>Buffer.from(o,"base64")),yc=(0,Fe.validator)(o=>Buffer.isBuffer(o)?o.toString("base64"):(0,Fe.isBase64)(o));var Ie=require("tslib"),G=require("valgen");var fi=G.vg.isDateString({precisionMin:"day",trim:"day",coerce:!0}),Ft,It=(Ft=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=G.vg.isDate({trim:"day",coerce:e==null?void 0:e.convertToNative}),r=[];return e.minValue!=null&&(fi(e.minValue),r.push(G.toString,G.vg.isGte(e.minValue))),e.maxValue!=null&&(fi(e.maxValue),r.push(G.toString,G.vg.isLte(e.maxValue))),r.length>0?G.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){let t=[];return e.minValue!=null&&((0,G.isDateString)(e.minValue),t.push(G.vg.isGte(e.minValue))),e.maxValue!=null&&((0,G.isDateString)(e.maxValue),t.push(G.vg.isLte(e.maxValue))),t.length>0?G.vg.pipe([fi,...t],{returnIndex:0}):fi}},a(Ft,"DateType"),Ft);(0,Ie.__decorate)([u.Attribute({description:"Minimum value"}),(0,Ie.__metadata)("design:type",String)],It.prototype,"minValue",void 0);(0,Ie.__decorate)([u.Attribute({description:"Maximum value"}),(0,Ie.__metadata)("design:type",String)],It.prototype,"maxValue",void 0);It=(0,Ie.__decorate)([u({name:"date",description:"A date without time",nameMappings:{js:"Date",json:"string"}}).Example("2021-04-18","Full date value"),(0,Ie.__metadata)("design:paramtypes",[Object])],It);var Pe=require("tslib"),Q=require("valgen");var mi=Q.vg.isDateString({precisionMin:"day",coerce:!0,trim:"tz"}),Pt,Lt=(Pt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=Q.vg.isDate({coerce:e==null?void 0:e.convertToNative}),r=[];return e.minValue!=null&&(mi(e.minValue),r.push(Q.toString,Q.vg.isGte(e.minValue))),e.maxValue!=null&&(mi(e.maxValue),r.push(Q.toString,Q.vg.isLte(e.maxValue))),r.length>0?Q.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){let t=[];return e.minValue!=null&&((0,Q.isDateString)(e.minValue),t.push(Q.vg.isGte(e.minValue))),e.maxValue!=null&&((0,Q.isDateString)(e.maxValue),t.push(Q.vg.isLte(e.maxValue))),t.length>0?Q.vg.pipe([mi,...t],{returnIndex:0}):mi}},a(Pt,"DateTimeType"),Pt);(0,Pe.__decorate)([u.Attribute({description:"Minimum value"}),(0,Pe.__metadata)("design:type",String)],Lt.prototype,"minValue",void 0);(0,Pe.__decorate)([u.Attribute({description:"Maximum value"}),(0,Pe.__metadata)("design:type",String)],Lt.prototype,"maxValue",void 0);Lt=(0,Pe.__decorate)([u({name:"datetime",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,Pe.__metadata)("design:paramtypes",[Object])],Lt);var Le=require("tslib"),X=require("valgen");var ui=X.vg.isDateString({precisionMin:"tz",coerce:!0}),kt,jt=(kt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=X.vg.isDateString({coerce:!0,precisionMin:"tz"}),r=[];return e.minValue!=null&&(ui(e.minValue),r.push(X.toString,X.vg.isGte(e.minValue))),e.maxValue!=null&&(ui(e.maxValue),r.push(X.toString,X.vg.isLte(e.maxValue))),r.length>0?X.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){let t=[];return e.minValue!=null&&((0,X.isDateString)(e.minValue),t.push(X.vg.isGte(e.minValue))),e.maxValue!=null&&((0,X.isDateString)(e.maxValue),t.push(X.vg.isLte(e.maxValue))),t.length>0?X.vg.pipe([ui,...t],{returnIndex:0}):ui}},a(kt,"DateTimeTypeTz"),kt);(0,Le.__decorate)([u.Attribute({description:"Minimum value"}),(0,Le.__metadata)("design:type",String)],jt.prototype,"minValue",void 0);(0,Le.__decorate)([u.Attribute({description:"Maximum value"}),(0,Le.__metadata)("design:type",String)],jt.prototype,"maxValue",void 0);jt=(0,Le.__decorate)([u({name:"datetimetz",description:"A full datetime value with time zone information",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15+03:00"),(0,Le.__metadata)("design:paramtypes",[Object])],jt);var L=require("tslib"),es=require("valgen");var Ct,ie=(Ct=class{constructor(e){e&&Object.assign(this,e)}[E](e){return es.vg.isEmail({...e,coerce:!0})}[g](e){return es.vg.isEmail({...e,coerce:!0})}},a(Ct,"EmailType"),Ct);(0,L.__decorate)([u.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),(0,L.__metadata)("design:type",Boolean)],ie.prototype,"allowDisplayName",void 0);(0,L.__decorate)([u.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),(0,L.__metadata)("design:type",Boolean)],ie.prototype,"requireDisplayName",void 0);(0,L.__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,L.__metadata)("design:type",Boolean)],ie.prototype,"utf8LocalPart",void 0);(0,L.__decorate)([u.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),(0,L.__metadata)("design:type",Boolean)],ie.prototype,"ignoreMaxLength",void 0);(0,L.__decorate)([u.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),(0,L.__metadata)("design:type",Boolean)],ie.prototype,"allowIpDomain",void 0);(0,L.__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,L.__metadata)("design:type",Boolean)],ie.prototype,"domainSpecificValidation",void 0);(0,L.__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,L.__metadata)("design:type",Array)],ie.prototype,"hostBlacklist",void 0);(0,L.__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,L.__metadata)("design:type",Array)],ie.prototype,"hostWhitelist",void 0);(0,L.__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,L.__metadata)("design:type",String)],ie.prototype,"blacklistedChars",void 0);ie=(0,L.__decorate)([u({name:"email",description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),(0,L.__metadata)("design:paramtypes",[Object])],ie);var ke=require("tslib"),$t=require("valgen");var Ut,J=(Ut=class{constructor(e){e&&Object.assign(this,e)}[E](e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.allowSigns,s=(0,$t.validator)("decodeFieldPath",p=>i.normalizeFieldPath(p,{allowSigns:n,scope:r}));return $t.vg.pipe([$t.toString,s])}[g](e,t,r){return this[E](e,t,r)}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");x.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),allowSigns:e.allowSigns}}},a(Ut,"FieldPathType"),Ut);(0,ke.__decorate)([u.Attribute({description:"Data type which field belong to"}),(0,ke.__metadata)("design:type",Object)],J.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)],J.prototype,"allowSigns",void 0);J=(0,ke.__decorate)([u({name:"fieldpath",description:"Field path",nameMappings:{js:"string",json:"string"}}),(0,ke.__metadata)("design:paramtypes",[Object])],J);var Ce=require("tslib"),ts=require("valgen");var qt={};yr(qt,{$and:()=>Ec,$arithmetic:()=>kc,$array:()=>Ia,$date:()=>_c,$eq:()=>wc,$field:()=>gc,$gt:()=>bc,$gte:()=>Ac,$ilike:()=>Ic,$in:()=>Sc,$like:()=>Mc,$lt:()=>Dc,$lte:()=>Nc,$ne:()=>Rc,$notILike:()=>Pc,$notIn:()=>vc,$notLike:()=>Fc,$number:()=>Oc,$or:()=>Tc,$paren:()=>Lc,$time:()=>xc,ArithmeticExpression:()=>He,ArithmeticExpressionItem:()=>Jr,ArrayExpression:()=>Re,Ast:()=>Rr,BooleanLiteral:()=>et,ComparisonExpression:()=>_e,DateLiteral:()=>Me,DateTimeLiteral:()=>Dr,Expression:()=>V,FilterTreeVisitor:()=>vr,Literal:()=>I,LogicalExpression:()=>xe,NegativeExpression:()=>br,NullLiteral:()=>tt,NumberLiteral:()=>Ae,OpraErrorListener:()=>Mr,ParenthesizedExpression:()=>be,QualifiedIdentifier:()=>le,StringLiteral:()=>rt,Term:()=>Ze,TimeLiteral:()=>it,parse:()=>kn});function Tc(...o){return new xe({op:"or",items:o})}a(Tc,"$or");function Ec(...o){return new xe({op:"and",items:o})}a(Ec,"$and");function _c(o){return new Me(o)}a(_c,"$date");function xc(o){return new it(o)}a(xc,"$time");function Oc(o){return new Ae(o)}a(Oc,"$number");function Ia(...o){return new Re(o.map(di))}a(Ia,"$array");function gc(o){return new le(o)}a(gc,"$field");function wc(o,e){return me("=",o,e)}a(wc,"$eq");function Rc(o,e){return me("!=",o,e)}a(Rc,"$ne");function bc(o,e){return me(">",o,e)}a(bc,"$gt");function Ac(o,e){return me(">=",o,e)}a(Ac,"$gte");function Dc(o,e){return me("<",o,e)}a(Dc,"$lt");function Nc(o,e){return me("<=",o,e)}a(Nc,"$lte");function Sc(o,e){return me("in",o,e)}a(Sc,"$in");function vc(o,e){return me("!in",o,e)}a(vc,"$notIn");function Mc(o,e){return me("like",o,e)}a(Mc,"$like");function Fc(o,e){return me("!like",o,e)}a(Fc,"$notLike");function Ic(o,e){return me("ilike",o,e)}a(Ic,"$ilike");function Pc(o,e){return me("!ilike",o,e)}a(Pc,"$notILike");function Lc(o){return new be(o)}a(Lc,"$paren");function kc(o){let e=new He;return e.add=t=>(e.append("+",Bt(t)),e),e.sub=t=>(e.append("-",Bt(t)),e),e.mul=t=>(e.append("*",Bt(t)),e),e.div=t=>(e.append("/",Bt(t)),e),e.append("+",di(o)),e}a(kc,"$arithmetic");function me(o,e,t){let r=typeof e=="string"?new le(e):di(e),i=di(t);return new _e({op:o,left:r,right:i})}a(me,"comparisonExpression");var di=a(o=>Array.isArray(o)?Ia(...o.map(Bt)):Bt(o),"wrapEntryValue"),Bt=a(o=>o instanceof V?o:typeof o=="boolean"?new et(o):typeof o=="number"||typeof o=="bigint"?new Ae(o):o==null?new tt:o instanceof Date?new Me(o):new rt(""+o),"_wrapEntryValue");var Vt,je=(Vt=class{constructor(e){e&&Object.assign(this,e)}[E](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),i=e.rules?new xt(e.rules):void 0;return jc(r,i)}[g](){return Cc}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");x.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),rules:e.rules}}},a(Vt,"FilterType"),Vt);(0,Ce.__decorate)([u.Attribute({description:"Data type which filtering fields belong to"}),(0,Ce.__metadata)("design:type",Object)],je.prototype,"dataType",void 0);(0,Ce.__decorate)([u.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),(0,Ce.__metadata)("design:type",Object)],je.prototype,"rules",void 0);je=(0,Ce.__decorate)([u({name:"filter",description:"A query filter",nameMappings:{js:"object",json:"string"}}),(0,Ce.__metadata)("design:paramtypes",[Object])],je);var jc=a((o,e,t)=>(0,ts.validator)("decodeFilter",(r,i,n)=>{if(typeof r=="string")try{let s=qt.parse(r);return e?e.normalizeFilter(s,o,t):s}catch(s){i.fail(n,`Not a valid filter expression. ${s.message}`,r);return}i.fail(n,"Nt a valid filter expression string",r)}),"decodeFilter"),Cc=(0,ts.validator)("encodeFilter",(o,e,t)=>{if(o instanceof qt.Ast)return o.toString();e.fail(t,"Not a valid filter expression",o)});var yi=require("tslib"),rs=require("valgen");var Kt,hi=(Kt=class{constructor(e){e&&Object.assign(this,e)}[E](){return rs.vg.isObjectId({coerce:!0})}[g](){return rs.vg.isObjectId({coerce:!0})}},a(Kt,"ObjectIdType"),Kt);hi=(0,yi.__decorate)([u({name:"ObjectId",description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),(0,yi.__metadata)("design:paramtypes",[Object])],hi);var k=require("tslib");var os=require("@jsopen/objects"),La=require("ts-gems");var Pa=require("@jsopen/objects");function is(o){let e=[],t=a(function(r,i){if(typeof i!="string")throw new TypeError("Symbol properties can't be used as a field");let n=Reflect.getOwnMetadata(d,r.constructor)||{};n.kind=m.ComplexType.Kind,n.fields=n.fields||{};let s=Reflect.getMetadata("design:type",r,i),p=n.fields[i]={...o,designType:s};s===Array?p.isArray=!0:p.type=p.type||s,Reflect.defineMetadata(d,n,r.constructor);for(let c of e)c(p)},"decorator");return t.Override=(r,i)=>(e.push(n=>{n.override=n.override||[],n.override.push((0,Pa.omitUndefined)({...i,scopePattern:Array.isArray(r)?r:[r],type:void 0,isArray:void 0,isNestedEntity:void 0}))}),t),t}a(is,"ApiFieldDecoratorFactory");var C=a(function(...o){if(!this){let[n]=o;return C[N](n)}let[e,t]=o;b.call(this,e);let r=(0,La.asMutable)(this);r.name=t.name;let i=t.origin||e;if(!(i instanceof U))throw new Error("Field origin should be one of ComplexType, MappedType or MixinType");r.origin=i,r.type=t.type||e.node.getDataType("any"),r.description=t.description,r.isArray=t.isArray,r.isNestedEntity=t.isNestedEntity,r.default=t.default,r.fixed=t.fixed,r.required=t.required,r.exclusive=t.exclusive,r.localization=t.localization,r.keyField=t.keyField,r.deprecated=t.deprecated,r.readonly=t.readonly,r.writeonly=t.writeonly,r.examples=t.examples,r.override=t.override,r.scopePattern=t.scopePattern?Array.isArray(t.scopePattern)?t.scopePattern:[t.scopePattern]:void 0,r.convertToNative=t.convertToNative??(r.type.kind==="SimpleType"&&typeof t.designType=="function"&&t.designType!==Object),r.override=t.override},"ApiField"),ss=class ss extends b{inScope(e){return Pr(e,this.scopePattern)}forScope(e){if(!(e&&this.override))return this;this._overrideCache=this._overrideCache||{};let t=this._overrideCache[e];if(t)return t;if(e!=="*"){for(let r of this.override)if(Pr(e,r.scopePattern)){t=(0,os.omitUndefined)({...r,id:void 0,owner:void 0,node:void 0,origin:void 0,name:void 0,type:void 0,override:void 0,_overrideCache:void 0,scopePattern:r.scopePattern}),Object.setPrototypeOf(t,this);break}}return t=t||this,this._overrideCache[e]=t,t}toJSON(e){var r;let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return(0,os.omitUndefined)({type:t||((r=this.type)==null?void 0:r.toJSON(e)),description:this.description,isArray:this.isArray||void 0,isNestedEntity:this.isNestedEntity||void 0,default:this.default,fixed:this.fixed,required:this.required||void 0,exclusive:this.exclusive||void 0,localization:this.localization||void 0,keyField:this.keyField||void 0,deprecated:this.deprecated||void 0,readonly:this.readonly||void 0,writeonly:this.writeonly||void 0,examples:this.examples})}};a(ss,"ApiFieldClass");var ns=ss;C.prototype=ns.prototype;Object.assign(C,is);C[N]=is;var sy=require("reflect-metadata"),ja=require("@jsopen/objects"),Ca=require("ts-gems");var as=class as extends Te{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};a(as,"OpraDocumentError");var nt=as;var ps=class ps{constructor(e){this.path="",this.error=new nt,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(i){i!==this.error&&this.addError(i)}finally{this.path=r}}async enterAsync(e,t){let r=this.path;this.path=this.path+e;try{return await t()}catch(i){i!==this.error&&this.addError(i)}finally{this.path=r}}extend(e){let t={...e};return Object.setPrototypeOf(t,this),t}};a(ps,"DocumentInitContext");var ye=ps;var ka=require("@jsopen/objects");function cs(o){return function(e){let t;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!$.test(o.name))throw new TypeError(`"${o.name}" is not a valid type name`);t=o.name}else t=e.name;let r=Reflect.getOwnMetadata(d,e);r||(r={},Reflect.defineMetadata(d,r,e)),r.kind=m.ComplexType.Kind,r.name=t,o&&Object.assign(r,(0,ka.omit)(o,["name"]))}}a(cs,"ComplexTypeDecorator");var oe=a(function(...o){var n;if(!this)return oe[N].apply(void 0,o);let[e,t]=o,r=o[2]||new ye({maxErrors:0});U.call(this,e,t,r);let i=(0,Ca.asMutable)(this);i.kind=m.ComplexType.Kind,i.discriminatorField=t.discriminatorField,i.discriminatorValue=t.discriminatorValue,t.base&&r.enter(".base",()=>{if(!(t.base instanceof U))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base,i.additionalFields=i.base.additionalFields,i.keyField=i.base.keyField;for(let s of i.base.fields("*"))i._fields.set(s.name,new C(this,s))}),t.additionalFields!==void 0&&(i.additionalFields=t.additionalFields),t.keyField!==void 0&&(i.keyField=t.keyField),i.ctor=t.ctor||((n=i.base)==null?void 0:n.ctor),t.fields&&r.enter(".fields",()=>{for(let[s,p]of Object.entries(t.fields)){let c=new C(this,{...p,name:s});this._fields.set(c.name,c)}})},"ComplexType"),fs=class fs extends U{extendsFrom(e){var t;return e instanceof x||(e=this.node.getDataType(e)),e instanceof U?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i={...t,kind:this.kind,base:this.base?r||this.base.toJSON(e):void 0,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue};if(this.additionalFields)if(this.additionalFields instanceof x){let n=this.node.getDataTypeNameWithNs(this.additionalFields);i.additionalFields=n||this.additionalFields.toJSON(e)}else i.additionalFields=this.additionalFields;if(this._fields.size){let n={},s=0;for(let p of this._fields.values())p.origin===this&&p.inScope(e==null?void 0:e.scope)&&(n[p.name]=p.toJSON(e),s++);s&&(i.fields=n)}return(0,ja.omitUndefined)(i)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(fs,"ComplexTypeClass");var ls=fs;oe.prototype=ls.prototype;Object.assign(oe,cs);oe[N]=cs;var zt,ne=(zt=class{constructor(e){e&&Object.assign(this,e)}},a(zt,"OperationResult"),zt);(0,k.__decorate)([C(),(0,k.__metadata)("design:type",Number)],ne.prototype,"affected",void 0);(0,k.__decorate)([C(),(0,k.__metadata)("design:type",Number)],ne.prototype,"totalMatches",void 0);(0,k.__decorate)([C(),(0,k.__metadata)("design:type",String)],ne.prototype,"context",void 0);(0,k.__decorate)([C(),(0,k.__metadata)("design:type",String)],ne.prototype,"type",void 0);(0,k.__decorate)([C(),(0,k.__metadata)("design:type",String)],ne.prototype,"message",void 0);(0,k.__decorate)([C({type:"any"}),(0,k.__metadata)("design:type",Object)],ne.prototype,"payload",void 0);(0,k.__decorate)([C({type:"object"}),(0,k.__metadata)("design:type",Array)],ne.prototype,"errors",void 0);ne=(0,k.__decorate)([oe({name:"OperationResult",description:"Operation result"}),(0,k.__metadata)("design:paramtypes",[Object])],ne);(function(o){function e(t){var i;let r=(i=class extends o{constructor(...s){super(...s)}},a(i,"OperationResult_"),i);return(0,k.__decorate)([C({type:t,required:!0}),(0,k.__metadata)("design:type",Object)],r.prototype,"payload",void 0),r=(0,k.__decorate)([oe({embedded:!0}),(0,k.__metadata)("design:paramtypes",[Object])],r),r}a(e,"forPayload"),o.forPayload=e})(ne||(ne={}));var Ue=require("tslib"),q=require("valgen");var Jt,Wt=(Jt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=$a,r=[];return e.minValue!=null&&((0,q.isDateString)(e.minValue),r.push(q.toString,q.vg.isGte(e.minValue))),e.maxValue!=null&&((0,q.isDateString)(e.maxValue),r.push(q.toString,q.vg.isLte(e.maxValue))),r.length>0?q.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){let t=$a,r=[];return e.minValue!=null&&((0,q.isDateString)(e.minValue),r.push(q.vg.isGte(e.minValue))),e.maxValue!=null&&((0,q.isDateString)(e.maxValue),r.push(q.vg.isLte(e.maxValue))),r.length>0?q.vg.pipe([t,...r],{returnIndex:0}):t}},a(Jt,"PartialDateType"),Jt);(0,Ue.__decorate)([u.Attribute({description:"Minimum value"}),(0,Ue.__metadata)("design:type",String)],Wt.prototype,"minValue",void 0);(0,Ue.__decorate)([u.Attribute({description:"Maximum value"}),(0,Ue.__metadata)("design:type",String)],Wt.prototype,"maxValue",void 0);Wt=(0,Ue.__decorate)([u({name:"partialdate",description:"Specifies a point in time using a 24-hour clock notation.\rFormat: YYYY-[MM-[DD-[T?HH:[MM:[SS[.S[S[S[S]]]]]]]]][+/-ZZ:ZZ].",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15:22+03:00").Example("2021-04-18 22:30").Example("2021-04-18").Example("2021"),(0,Ue.__metadata)("design:paramtypes",[Object])],Wt);var Ua=q.vg.isDateString({precisionMin:"year"}),$a=(0,q.validator)(o=>{if(o instanceof Date){let e=Ua(o,{coerce:!0});return e.endsWith("Z")&&(e=e.substring(0,e.length-1)),e.endsWith(".000")&&(e=e.substring(0,e.length-4)),e.endsWith(":00")&&(e=e.substring(0,e.length-3)),e.endsWith("00:00")&&(e=e.substring(0,e.length-6)),e}return Ua(o,{coerce:!1})});var $e=require("tslib"),kr=require("valgen");var Uc=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,Yt,Gt=(Yt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=kr.vg.matches(Uc,{formatName:"time",coerce:!0}),r=[];return e.minValue!=null&&r.push(kr.vg.isGte(e.minValue)),e.maxValue!=null&&r.push(kr.vg.isLte(e.maxValue)),r.length>0?kr.vg.pipe([t,...r],{returnIndex:0}):t}[g](e){return this[E](e)}},a(Yt,"TimeType"),Yt);(0,$e.__decorate)([u.Attribute({description:"Minimum value"}),(0,$e.__metadata)("design:type",String)],Gt.prototype,"minValue",void 0);(0,$e.__decorate)([u.Attribute({description:"Maximum value"}),(0,$e.__metadata)("design:type",String)],Gt.prototype,"maxValue",void 0);Gt=(0,$e.__decorate)([u({name:"time",description:"Time string in 24h format",nameMappings:{js:"string",json:"string"}}).Example("18:23:00","Full time value").Example("18:23:00","Time value without seconds"),(0,$e.__metadata)("design:paramtypes",[Object])],Gt);var Ei=require("tslib"),ms=require("valgen");var Qt,Ti=(Qt=class{constructor(e){e&&Object.assign(this,e)}[E](){return ms.vg.isURL({coerce:!0})}[g](){return ms.vg.isURL({coerce:!0})}},a(Qt,"UrlType"),Qt);Ti=(0,Ei.__decorate)([u({name:"url",description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),(0,Ei.__metadata)("design:paramtypes",[Object])],Ti);var Zt=require("tslib"),us=require("valgen");var Xt,jr=(Xt=class{constructor(e){e&&Object.assign(this,e)}[E](e){return us.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}[g](e){return us.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}},a(Xt,"UuidType"),Xt);(0,Zt.__decorate)([u.Attribute({description:"Version of the UUID"}),(0,Zt.__metadata)("design:type",Number)],jr.prototype,"version",void 0);jr=(0,Zt.__decorate)([u({name:"uuid",description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),(0,Zt.__metadata)("design:paramtypes",[Object])],jr);var Va=yt(require("path-browserify"),1),Ka=require("@jsopen/objects"),za=require("ts-gems");var Ba,qa,ue=Symbol.for("kMap"),Cr=Symbol.for("kCtorMap"),hs=class hs{constructor(){this[Ba]=new M,this[qa]=new WeakMap}get size(){return this[ue].size}forEach(e,t){this[ue].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[Cr].get(e);if(!t&&typeof e=="function"){let i=Reflect.getMetadata(d,e);t=i==null?void 0:i.name}if(!t&&typeof e=="object"){let i=e[d];t=i==null?void 0:i.name}if(!t)return;let r=this[ue].get(t);if(r)return typeof e=="function"&&r.kind==="ComplexType"?r.ctor===e?r:void 0:r}set(e,t){this[ue].set(e,t),t.ctor?this[Cr].set(t.ctor,e):t.instance&&this[Cr].set(t.instance,e)}has(e){if(e instanceof x)return!!e.name&&this[ue].has(e.name);let t=typeof e=="string"?e:this[Cr].get(e);return t?this[ue].has(t):!1}keys(){return this[ue].keys()}values(){return this[ue].values()}entries(){return this[ue].entries()}sort(e){return this[ue].sort(e),this}[(Ba=ue,qa=Cr,Symbol.iterator)](){return this[ue][Symbol.iterator]()}};a(hs,"DataTypeMap");var se=hs;function v(o,e){let t=a((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={...e,kind:m.HttpOperation.Kind},s=Reflect.getOwnMetadata(pe,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let p of o)p(n);Reflect.defineMetadata(pe,s,r.constructor)},"decorator");return t.Cookie=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"cookie",type:i}:{...i,name:r,location:"cookie"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="cookie"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.Header=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"header",type:i}:{...i,name:r,location:"header"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="header"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.QueryParam=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"query",type:i}:{...i,name:r,location:"query"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="query"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.PathParam=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i}:{...i,name:r,location:"path"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="path"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.Response=(r,i)=>{let n={...i,statusCode:r};return n.type&&(n.contentType=n.contentType||D.opra_response_json,n.contentEncoding=n.contentEncoding||"utf-8"),n.contentType===D.opra_response_json&&(n.contentEncoding=n.contentEncoding||"utf-8"),o.push(s=>{s.responses=s.responses||[],s.responses.push(n)}),t},t.RequestContent=function(r){let i=typeof r=="object"?r:{type:r};return i.type&&(i.contentType=i.contentType||D.json,i.contentEncoding=i.contentEncoding||"utf-8"),o.push(n=>{n.requestBody=n.requestBody||{required:!0,content:[]},n.requestBody.content=n.requestBody.content||[],n.requestBody.content.push(i)}),t},t.MultipartContent=function(r,i){let n={...r,contentType:(r==null?void 0:r.contentType)||"multipart/form-data"};if(o.push(s=>{s.requestBody=s.requestBody||{required:!0,content:[]},s.requestBody.content=s.requestBody.content||[],s.requestBody.content.push(n)}),i){let s={Field(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"field",...c}),s},File(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"file",...c}),s}};i(s)}return t},t.UseType=(...r)=>(o.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(v,"HttpOperationDecoratorFactory");var A=a(function(...o){if(!this){let[i]=o,n=[];return A[N].call(void 0,n,i)}let[e,t]=o;if(b.call(this,e),!$.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,za.asMutable)(this);r.parameters=[],r.responses=[],r.types=r.node[B]=new se,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?F(t.compositionOptions):void 0},"HttpOperation"),Ts=class Ts extends b{findParameter(e,t){let r=e.toLowerCase(),i;for(i of this.parameters)if(!(t&&t!==i.location)&&(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e)))return i}getFullUrl(){let e=this.owner.getFullUrl();return e?this.path?this.mergePath?e+this.path:Va.default.posix.join(e,this.path):e:this.path||"/"}toJSON(e){var r;let t=(0,Ka.omitUndefined)({kind:m.HttpOperation.Kind,description:this.description,method:this.method,path:this.path,mergePath:this.mergePath,composition:this.composition,requestBody:(r=this.requestBody)==null?void 0:r.toJSON(e)});if(this.types.size){t.types={};for(let i of this.types.values())t.types[i.name]=i.toJSON(e)}if(this.parameters.length){t.parameters=[];for(let i of this.parameters)t.parameters.push(i.toJSON(e))}return this.responses.length&&(t.responses=this.responses.map(i=>i.toJSON(e))),t}};a(Ts,"HttpOperationClass");var ys=Ts;A.prototype=ys.prototype;A[N]=v;A.GET=function(o){return v([],{...o,method:"GET"})};A.DELETE=function(o){return v([],{...o,method:"DELETE"})};A.HEAD=function(o){return v([],{...o,method:"HEAD"})};A.OPTIONS=function(o){return v([],{...o,method:"OPTIONS"})};A.PATCH=function(o){return v([],{...o,method:"PATCH"})};A.POST=function(o){return v([],{...o,method:"POST"})};A.PUT=function(o){return v([],{...o,method:"PUT"})};A.SEARCH=function(o){return v([],{...o,method:"SEARCH"})};A.Entity={};function W(o){if(typeof o=="string")return o;let e=Reflect.getMetadata(d,o);if(!e)throw new TypeError(`Type (${o}) 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")}a(W,"getDataTypeName");function Be(o,e){return(t,r)=>{let i=typeof r=="string"||typeof r=="function"?{name:t,location:"path",type:r,keyParam:!0}:{...r,name:t,location:"path",keyParam:!0};return o.PathParam(t,i),e.push(n=>{var s;(s=n.path)!=null&&s.includes(":"+t)||(n.path=(n.path||"")+"@:"+t),n.mergePath=!0}),o}}a(Be,"createKeyParamDecorator");function Ja(o,e){return(...t)=>{let r=typeof t[0]=="object"?t[0]:t.reduce((s,p)=>{let c=p.split(":");return s[c[0]]=c[1]||c[0],s},{}),i=Object.keys(r).reduce((s,p)=>{let c=vt.exec(p),l=vt.exec(r[p]);return c&&l&&(s[c[2]]=l[2]),s},{}),n=Object.keys(r).reduce((s,p)=>{let c=vt.exec(p);return c&&(c[1]!="-"&&(s[c[2]]=c[2]),c[1]!="+"&&(s["-"+c[2]]="-"+c[2])),s},{});return e.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.sortFields=i}),o.QueryParam("sort",{description:"Determines sort fields",type:re(n),isArray:!0,arraySeparator:",",parser:a(s=>s.map(p=>{let c=vt.exec(p);return c?(c[1]||"")+i[c[2]]:p}),"parser")}),o}}a(Ja,"createSortFieldsDecorator");function qe(o,e,t){let r=Reflect.getMetadata("FilterRules",o);r||(r=new xt,Reflect.defineMetadata("FilterRules",r,o));let i=Reflect.getMetadata("FilterType",o);return i||(i=new je({dataType:t}),i.rules={},Reflect.defineMetadata("FilterType",i,o)),(n,s)=>{let p=(Array.isArray(s)?{operators:s}:typeof s=="string"?{operators:s.split(/\s*,\s*/)}:s)||{};if(p.operators=p.operators||["=","!="],n.includes(":")){let c=n.split(":");n=c[0],p.mappedField=c[1]}return e.push(()=>{r.set(n,p),i.rules=r.toJSON()}),o.QueryParam("filter",{type:i,description:"Determines filter fields"}),o}}a(qe,"createFilterDecorator");A.Entity.Create=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.CREATED,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the created resource.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=W(t.type)}),i};A.Entity.Delete=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"DELETE",...t,composition:"Entity.Delete"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=W(t.type)}),i.KeyParam=Be(i,r),i};A.Entity.DeleteMany=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=W(t.type)}),i.Filter=qe(i,r,t.type),i};var Os={};yr(Os,{AnyType:()=>_i,BigintType:()=>Oi,BooleanType:()=>wi,IntegerType:()=>ct,NullType:()=>Ai,NumberType:()=>ge,ObjectType:()=>Ni,StringType:()=>ze});var xi=require("tslib"),Es=require("valgen");var Ht,_i=(Ht=class{constructor(e){e&&Object.assign(this,e)}[E](){return Es.isAny}[g](){return Es.isAny}},a(Ht,"AnyType"),Ht);_i=(0,xi.__decorate)([u({name:"any",description:"Represents any value"}),(0,xi.__metadata)("design:paramtypes",[Object])],_i);var gi=require("tslib"),at=require("valgen");var Ve=require("tslib"),st=require("valgen");var er,ge=(er=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=[];return e.minValue!=null&&t.push(st.vg.isGte(e.minValue)),e.maxValue!=null&&t.push(st.vg.isLte(e.maxValue)),t.length>0?st.vg.pipe([st.toNumber,...t],{returnIndex:0}):st.toNumber}[g](e){return this[E](e)}},a(er,"NumberType"),er);(0,Ve.__decorate)([u.Attribute({description:"Determines the minimum value"}),(0,Ve.__metadata)("design:type",Number)],ge.prototype,"minValue",void 0);(0,Ve.__decorate)([u.Attribute({description:"Determines the maximum value"}),(0,Ve.__metadata)("design:type",Number)],ge.prototype,"maxValue",void 0);ge=(0,Ve.__decorate)([u({name:"number",description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),(0,Ve.__metadata)("design:paramtypes",[Object])],ge);var tr,Oi=(tr=class extends ge{constructor(e){super(e)}[E](e){let t=[];return e.minValue!=null&&t.push(at.vg.isGte(e.minValue)),e.maxValue!=null&&t.push(at.vg.isLte(e.maxValue)),t.length>0?at.vg.pipe([at.toBigint,...t],{returnIndex:0}):at.toBigint}[g](e){return this[E](e)}},a(tr,"BigintType"),tr);Oi=(0,gi.__decorate)([u({name:"bigint",description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),(0,gi.__metadata)("design:paramtypes",[Object])],Oi);var Ri=require("tslib"),_s=require("valgen");var rr,wi=(rr=class{constructor(e){e&&Object.assign(this,e)}[E](){return _s.toBoolean}[g](){return _s.toBoolean}},a(rr,"BooleanType"),rr);wi=(0,Ri.__decorate)([u({name:"boolean",description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),(0,Ri.__metadata)("design:paramtypes",[Object])],wi);var bi=require("tslib"),pt=require("valgen");var ir,ct=(ir=class extends ge{constructor(e){super(e)}[E](e){let t=[];return e.minValue!=null&&t.push(pt.vg.isGte(e.minValue)),e.maxValue!=null&&t.push(pt.vg.isLte(e.maxValue)),t.length>0?pt.vg.pipe([pt.toInteger,...t],{returnIndex:0}):pt.toInteger}[g](e){return this[E](e)}},a(ir,"IntegerType"),ir);ct=(0,bi.__decorate)([u({name:"integer",description:"An integer number",nameMappings:{js:"number",json:"number"}}),(0,bi.__metadata)("design:paramtypes",[Object])],ct);var Di=require("tslib"),xs=require("valgen");var or,Ai=(or=class{constructor(e){e&&Object.assign(this,e)}[E](){return xs.isNull}[g](){return xs.isNull}},a(or,"NullType"),or);Ai=(0,Di.__decorate)([u({name:"null",description:"A Null value",nameMappings:{js:"null",json:"null"}}),(0,Di.__metadata)("design:paramtypes",[Object])],Ai);var Si=require("tslib");var nr,Ni=(nr=class{constructor(e){e&&Object.assign(this,e)}},a(nr,"ObjectType"),nr);Ni=(0,Si.__decorate)([oe({name:"object",description:"A non modelled object",additionalFields:!0}),(0,Si.__metadata)("design:paramtypes",[Object])],Ni);var de=require("tslib"),Ke=require("valgen");var sr,ze=(sr=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(d,Object.getPrototypeOf(this).constructor).name),t.push(Ke.vg.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(Ke.vg.lengthMin(e.minLength)),e.maxLength&&t.push(Ke.vg.lengthMax(e.maxLength)),t.length>0?Ke.vg.pipe([Ke.toString,...t],{returnIndex:0}):Ke.toString}[g](e){return this[E](e)}},a(sr,"StringType"),sr);(0,de.__decorate)([u.Attribute({description:"Regex pattern to be used for validation"}),(0,de.__metadata)("design:type",Object)],ze.prototype,"pattern",void 0);(0,de.__decorate)([u.Attribute({description:"Name of the pattern"}),(0,de.__metadata)("design:type",String)],ze.prototype,"patternName",void 0);(0,de.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,de.__metadata)("design:type",Number)],ze.prototype,"minLength",void 0);(0,de.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,de.__metadata)("design:type",Number)],ze.prototype,"maxLength",void 0);ze=(0,de.__decorate)([u({name:"string",description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),(0,de.__metadata)("design:paramtypes",[Object])],ze);A.Entity.FindMany=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"GET",...t,composition:"Entity.FindMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains list of resources.',contentType:D.opra_response_json,type:t.type,partial:"deep",isArray:!0}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}).QueryParam("limit",{description:"Determines number of returning instances",type:new ct({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new ct({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=W(t.type),t.defaultLimit&&(s.defaultLimit=t.defaultLimit),t.defaultProjection&&(s.defaultProjection=t.defaultProjection),t.maxLimit&&(s.maxLimit=t.maxLimit)}),i.Filter=qe(i,r,t.type),i.DefaultSort=(...n)=>(r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.defaultSort=n}),i),i.SortFields=Ja(i,r),i};A.Entity.Get=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"GET",...t,composition:"Entity.Get"});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=W(t.type)}),i.KeyParam=Be(i,r),i};A.Entity.Replace=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"POST",...t,composition:"Entity.Replace"});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=W(t.type)}),i.KeyParam=Be(i,r),i};A.Entity.Update=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"PATCH",...t,composition:"Entity.Update",requestBody:{partial:"deep",immediateFetch:!0,allowPatchOperators:!0,keepKeyFields:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=W(t.type)}),i.KeyParam=Be(i,r),i.Filter=qe(i,r,t.type),i};A.Entity.UpdateMany=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"PATCH",...t,composition:"Entity.UpdateMany",requestBody:{immediateFetch:!0,partial:"deep",allowPatchOperators:!0,keepKeyFields:!0,...t.requestBody,required:!0}});return i.RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=W(t.type)}),i.Filter=qe(i,r,t.type),i};var vi=require("@jsopen/objects");var $c=/^(.*)(Controller)$/,Wa=[];function ar(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=$c.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(ce,Object.getPrototypeOf(r));s&&(0,vi.merge)(n,s,{deep:!0});let p=Reflect.getOwnMetadata(ce,r);p&&(0,vi.merge)(n,p,{deep:!0}),(0,vi.merge)(n,{...o,kind:m.RpcController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(ce,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(ce,n,r)},"decorator");return t.Header=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,type:i}:{...i,name:r};n.headers=n.headers||[],n.headers.push(s)}),t),t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),Wa.forEach(r=>r(t,e,o)),t}a(ar,"RpcControllerDecoratorFactory");ar.augment=function(o){Wa.push(o)};var Ya=require("@jsopen/objects");var Ga=[];function Ur(o,e,t){let r=!1,i=a((n,s)=>{if(typeof s!="string")throw new TypeError("Symbol properties can not be decorated");let p={kind:m.RpcOperation.Kind,channel:s,payloadType:e,...(0,Ya.omit)(t,["kind","payloadType"])},c=Reflect.getOwnMetadata(ce,n.constructor)||{};c.operations=c.operations||{},c.operations[s]=p;for(let l of o)l(p,n,s);Reflect.defineMetadata(ce,c,n.constructor)},"decorator");return i.UseType=(...n)=>(o.push(s=>{s.types=s.types||[],s.types.push(...n)}),i),i.Header=(n,s)=>(o.push(p=>{let c=typeof s=="string"||typeof s=="function"?{name:n,type:s}:{...s,name:n},l=r?p.response:p;l.headers?l.headers=l.headers.filter(O=>String(O.name)!==String(n)):l.headers=[],l.headers.push(c)}),i),i.Response=(n,s)=>(o.push(p=>{r=!0,p.response={...s,payloadType:n}}),i),Ga.forEach(n=>n(i,o,e,t)),i}a(Ur,"RpcOperationDecoratorFactory");Ur.augment=function(o){Ga.push(o)};var p3=require("reflect-metadata"),Qa=require("@jsopen/objects"),Xa=require("ts-gems");function Mi(o,e){let t=o==null?void 0:o.map(i=>String(i).toLowerCase()),r=e==null?void 0:e.map(i=>String(i).toLowerCase());return i=>r&&r.includes(i.toLowerCase())?!1:t?t.includes(i.toLowerCase()):!0}a(Mi,"getIsInheritedPredicateFn");var Je=a(function(...o){var n;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;U.call(this,e,t,r);let i=(0,Xa.asMutable)(this);if(i.kind=m.MappedType.Kind,t.base){if(!(t.base instanceof U))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base,i.ctor=t.ctor||i.base.ctor,t.pick?i.pick=t.pick.map(l=>i.base.normalizeFieldPath(l)):t.omit?i.omit=t.omit.map(l=>i.base.normalizeFieldPath(l)):t.partial?i.partial=Array.isArray(t.partial)?t.partial.map(l=>i.base.normalizeFieldPath(l)):t.partial:t.required&&(i.required=Array.isArray(t.required)?t.required.map(l=>i.base.normalizeFieldPath(l)):t.required);let s=Mi(i.pick,i.omit),p=Array.isArray(i.partial)?i.partial.map(l=>l.toLowerCase()):i.partial,c=Array.isArray(i.required)?i.required.map(l=>l.toLowerCase()):i.required;for(let[l,O]of i.base.fieldEntries("*")){if(!s(l))continue;let w={...O};p===!0||Array.isArray(p)&&p.includes(O.name.toLowerCase())?w.required=!1:(c===!0||Array.isArray(c)&&c.includes(O.name.toLowerCase()))&&(w.required=!0);let T=new C(this,w);i._fields.set(T.name,T)}(!i.pick||i.base.additionalFields===!1||Array.isArray(i.base.additionalFields)&&((n=i.base.additionalFields)==null?void 0:n[0])==="error")&&(i.additionalFields=i.base.additionalFields),t.base.keyField&&s(t.base.keyField)&&(i.keyField=t.base.keyField),i.discriminatorField=t.base.discriminatorField,i.discriminatorValue=t.base.discriminatorValue}},"MappedType"),ws=class ws extends U{extendsFrom(e){var t;return e instanceof x||(e=this.node.getDataType(e)),e instanceof U?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return(0,Qa.omitUndefined)({...t,base:r||this.base.toJSON(e),kind:this.kind,pick:this.pick,omit:this.omit,partial:this.partial,required:this.required,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(ws,"MappedTypeClass");var gs=ws;Je.prototype=gs.prototype;Je._applyMixin=()=>{};var y3=require("reflect-metadata"),Za=require("@jsopen/objects"),Ha=require("ts-gems");var lt=a(function(...o){if(!this)return lt[N].apply(void 0,o);let[e,t,r]=o;U.call(this,e,t,r);let i=(0,Ha.asMutable)(this);i.kind=m.MixinType.Kind,i.types=[];for(let n of t.types){i.additionalFields!==!0&&(n.additionalFields===!0?i.additionalFields=!0:i.additionalFields||(i.additionalFields=n.additionalFields));for(let s of n.fields("*")){let p=new C(this,s);i._fields.set(p.name,p)}i.types.push(n),n.keyField&&(i.keyField=n.keyField)}},"MixinType"),bs=class bs extends U{extendsFrom(e){if(e instanceof x||(e=this.node.getDataType(e)),!(e instanceof U))return!1;if(e===this)return!0;for(let t of this.types)if(t.extendsFrom(e))return!0;return!1}toJSON(e){let t=super.toJSON(e);return(0,Za.omitUndefined)({...t,kind:this.kind,types:this.types.map(r=>{let i=this.node.getDataTypeNameWithNs(r);return i||r.toJSON(e)})})}_locateBase(e){for(let t of this.types){if(e(t))return t;if(t._locateBase){let r=t._locateBase(e);if(r)return r}}}};a(bs,"MixinTypeClass");var Rs=bs;lt.prototype=Rs.prototype;lt[N]=Vc;function Vc(o,e){if(o=o.filter(n=>typeof n=="function"),!o.length)throw new TypeError("No Class has been provided");if(o.length===1)return o[0];let t=o[0].name+"Mixin",r={[t]:class{constructor(){for(let n of o)Or(this,n)}}}[t],i={...e,kind:m.MixinType.Kind,types:[]};Reflect.defineMetadata(d,i,r);for(let n of o){let s=Reflect.getMetadata(d,n);if(!(s&&(s.kind===m.ComplexType.Kind||s.kind===m.MixinType.Kind||s.kind===m.MappedType.Kind)))throw new TypeError(`Class "${n.name}" is not a ${m.ComplexType.Kind}, ${m.MixinType.Kind} or ${m.MappedType.Kind}`);i.types.push(n),xr(r.prototype,n.prototype)}return r}a(Vc,"MixinTypeFactory");var A3=require("reflect-metadata"),ep=require("@jsopen/objects"),tp=require("ts-gems"),As=require("valgen");var ft=a(function(...o){if(!this)return ft[N].apply(void 0,o);let[e,t,r]=o;x.call(this,e,t,r);let i=(0,tp.asMutable)(this);i.kind=m.UnionType.Kind,i.discriminator=t.discriminator,i.types=[];for(let n of t.types)i.types.push(n)},"UnionType"),Ns=class Ns extends x{toJSON(e){let t=super.toJSON(e);return(0,ep.omitUndefined)({...t,kind:this.kind,discriminator:this.discriminator,types:this.types.map(r=>{let i=this.node.getDataTypeNameWithNs(r);return i||r.toJSON(e)})})}generateCodec(e,t){let r=this.types.map(i=>{let n=i.generateCodec(e,t);return(i.kind===m.ComplexType.Kind||i.kind===m.MappedType.Kind)&&i.discriminatorField?[n,{[i.discriminatorField]:As.vg.isEqual(i.discriminatorValue)}]:n});return As.vg.oneOf(r)}extendsFrom(){return!1}_locateBase(){}};a(Ns,"UnionTypeClass");var Ds=Ns;ft.prototype=Ds.prototype;ft[N]=Kc;function Kc(o,e){let i=class i{};a(i,"UnionClass");let t=i,r={...e,kind:m.UnionType.Kind,types:o};return Reflect.defineMetadata(d,r,t),t}a(Kc,"UnionTypeFactory");var Ss=Symbol("initializing"),Fi=class Fi{static async createDataType(e,t,r){e=e||new ye({maxErrors:0});let i=await this._importDataTypeArgs(e,t,r);if(i)return typeof i=="string"?t.node.getDataType(i):this._createDataType(e,t,i)}static async resolveDataType(e,t,r){if(r){let i=t.node.findDataType(r);if(i)return i}if(typeof r=="object"||typeof r=="function"){let i=await Fi.createDataType(e,t,r);if(i)return i}if(r){let i=t.node.getDataType(r);if(i)return i}return t.node.getDataType("any")}static async addDataTypes(e,t,r){let i=t.node[B];if(!i)throw new TypeError("DocumentElement should has [kDataTypeMap] property");let n=await this.createAllDataTypes(e,t,r);if(n)for(let s of n)s!=null&&s.name&&i.set(s.name,s)}static async createAllDataTypes(e,t,r){e=e||new ye({maxErrors:0});let i=await this._prepareAllInitArgs(e,t,r);if(!i)return;let n=new M;for(let c of i)n.set(c.name,c);let s=e.extend({initArgsMap:n}),p=[];for(let[c,l]of n.entries())e.enter(`[${c}]`,()=>{if(!n.has(c))return;let O=this._createDataType(s,t,l);O&&p.push(O)});return p}static async _prepareAllInitArgs(e,t,r){let i=new M,n=new M,s=e.extend({owner:t,importQueue:i,initArgsMap:n});if(!t.node[B])throw new TypeError("DocumentElement should has [kDataTypeMap] property");if(Array.isArray(r)){let p=0;for(let c of r)await s.enterAsync(`$[${p++}]`,async()=>{c=await he(c);let l=Reflect.getMetadata(d,c)||c[d];if(!(l&&l.name))return typeof c=="function"?s.addError(`Class "${c.name}" doesn't have a valid data type metadata`):s.addError("Object doesn't have a valid data type metadata");i.set(l.name,c)})}else{let p,c;for([c,p]of Object.entries(r))p=await he(p),i.set(c,typeof p=="object"?{...p,name:c}:p)}for(let p of Array.from(i.keys())){if(!i.has(p))continue;let c=await this._importDataTypeArgs(s,t,p);c&&typeof c!="string"&&s.addError("Embedded data type can't be loaded into document node directly")}return Array.from(n.values())}static async _importDataTypeArgs(e,t,r,i){var w;r=await he(r);let{importQueue:n,initArgsMap:s}=e,p=t.node.findDataType(r);if(p instanceof x)return p.name;let c,l,O;if(typeof r!="string"){let ee=t.node.getDocument().types[gr].get(r);ee&&(r=ee)}if(typeof r=="string"){let T=r;if(r=(n==null?void 0:n.get(T))||((w=e.initArgsMap)==null?void 0:w.get(T)),!r)return e.addError(`Unknown data type (${T})`)}if(typeof r=="function"){if(c=Reflect.getMetadata(d,r),!c)return e.addError(`Class "${r.name}" doesn't have a valid DataType metadata`);l=r}else if(typeof r=="object"){if(c=r[d],c)O=r,c.kind!==m.EnumType.Kind&&(c=void 0);else if(m.isDataType(r))c=r,l=c.ctor;else if(l=Object.getPrototypeOf(r).constructor,c=l&&Reflect.getMetadata(d,l),c&&c.kind===m.SimpleType.Kind){let T=await this._importDataTypeArgs(e,t,c.name);return T?typeof T=="object"&&T.kind!==m.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:m.SimpleType.Kind,name:void 0,base:T,properties:r}:void 0}}return c?e.enterAsync(c.name?`[${c.name}]`:"",async()=>{if(c.name){let ee=s==null?void 0:s.get(c.name);if(ee)return i&&ee[Ss]?e.addError("Circular reference detected"):c.name}let T={kind:c.kind,name:c.name};T[Ss]=!0;try{if(T.name)if(n!=null&&n.has(T.name))s==null||s.set(c.name,T),T._instance={name:c.name},T[B]=t.node[B];else return e.addError(`Data Type (${T.name}) must be explicitly added to type list in the document scope`);switch(T.kind){case m.ComplexType.Kind:T.ctor=l,await this._prepareComplexTypeArgs(e,t,T,c);break;case m.EnumType.Kind:T.instance=O,await this._prepareEnumTypeArgs(e,t,T,c);break;case m.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,T,c);break;case m.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,T,c);break;case m.SimpleType.Kind:T.ctor=l,await this._prepareSimpleTypeArgs(e,t,T,c);break;case m.UnionType.Kind:await this._prepareUnionTypeArgs(e,t,T,c);break;default:return e.addError(`Invalid data type kind ${c.kind}`)}}finally{T.name&&(n==null||n.delete(T.name)),delete T[Ss]}return n&&T.name?T.name:T}):e.addError("No DataType metadata found")}static async _prepareDataTypeArgs(e,t,r){t.description=r.description,t.abstract=r.abstract,t.examples=r.examples,t.scopePattern=r.scopePattern}static async _prepareComplexTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.keyField=i.keyField,r.discriminatorField=i.discriminatorField,r.discriminatorValue=i.discriminatorValue,await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=We(n),r.ctor=r.ctor||n.ctor)}),i.additionalFields!=null&&(typeof i.additionalFields=="boolean"||Array.isArray(i.additionalFields)?r.additionalFields=i.additionalFields:await e.enterAsync(".additionalFields",async()=>{let n=await this._importDataTypeArgs(e,t,i.additionalFields);n&&(r.additionalFields=We(n))})),i.fields&&(r.fields={},await e.enterAsync(".fields",async()=>{for(let[n,s]of Object.entries(i.fields))await e.enterAsync(`[${n}]`,async()=>{let p=typeof s=="string"?{type:s}:s;if(p.isArray&&!p.type)return e.addError('"type" must be defined explicitly for array fields');let c=await this._importDataTypeArgs(e,t,p.type||"any");c&&(r.fields[n]={...p,type:We(c)})})}))}static async _prepareEnumTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),i.base&&await e.enterAsync(".base",async()=>{let n=await this._importDataTypeArgs(e,t,i.base);n&&(r.base=We(n))}),r.attributes=F(i.attributes)}static async _prepareSimpleTypeArgs(e,t,r,i){var n,s,p,c;await this._prepareDataTypeArgs(e,r,i),await e.enterAsync(".base",async()=>{let l;if(i.base)l=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let O=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,O)&&(l=await this._importDataTypeArgs(e,t,O))}l&&(r.base=We(l),r.ctor=r.ctor||l.ctor)}),r.properties=i.properties,r.nameMappings=i.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),i.attributes&&(r.attributes=F(i.attributes)),typeof((n=r.properties)==null?void 0:n[E])=="function"&&(r.generateDecoder=(s=r.properties)==null?void 0:s[E].bind(r.properties)),typeof((p=r.properties)==null?void 0:p[g])=="function"&&(r.generateEncoder=(c=r.properties)==null?void 0:c[g].bind(r.properties))}static async _prepareMappedTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.discriminatorField=i.discriminatorField,r.discriminatorValue=i.discriminatorValue,await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=We(n),r.ctor=r.ctor||n.ctor)}),i.pick?r.pick=[...i.pick]:i.omit?r.omit=[...i.omit]:i.partial?r.partial=Array.isArray(i.partial)?[...i.partial]:i.partial:i.required&&(r.required=Array.isArray(i.required)?[...i.required]:i.required)}static async _prepareMixinTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.types=[],await e.enterAsync(".types",async()=>{let n=i.types,s=0;for(let p of n)await e.enterAsync(`[${s++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(We(c))})})}static async _prepareUnionTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.types=[],await e.enterAsync(".types",async()=>{let n=i.types,s=0;for(let p of n)await e.enterAsync(`[${s++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(We(c))})})}static _createDataType(e,t,r){var s;let i=t.node.findDataType(typeof r=="string"?r:r.name||"");if(i instanceof x)return i;let n=typeof r=="string"?(s=e.initArgsMap)==null?void 0:s.get(r):r;if(n){let p=n[B];switch(p||delete n._instance,i=n._instance,i!=null&&i.name&&p&&p.set(i.name,i),n==null?void 0:n.kind){case m.ComplexType.Kind:return this._createComplexType(e,t,n);case m.EnumType.Kind:return this._createEnumType(e,t,n);case m.MappedType.Kind:return this._createMappedType(e,t,n);case m.MixinType.Kind:return this._createMixinType(e,t,n);case m.SimpleType.Kind:return this._createSimpleType(e,t,n);case m.UnionType.Kind:return this._createUnionType(e,t,n);default:break}}e.addError(`Unknown data type (${String(r)})`)}static _createComplexType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,oe.prototype);let n=F(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),r.additionalFields&&e.enter(".additionalFields",()=>{typeof r.additionalFields=="boolean"||Array.isArray(r.additionalFields)?n.additionalFields=r.additionalFields:n.additionalFields=this._createDataType(e,t,r.additionalFields)}),n.fields={},r.fields&&e.enter(".fields",()=>{for(let[s,p]of Object.entries(r.fields))e.enter(`[${s}]`,()=>{let c=this._createDataType(e,t,p.type);c&&(n.fields[s]={...p,name:s,type:c})})}),oe.apply(i,[t,n]),i}static _createEnumType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,re.prototype);let n=F(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),n.attributes=r.attributes,re.apply(i,[t,n]),i}static _createMappedType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Je.prototype);let n=F(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),Je.apply(i,[t,n]),i}static _createMixinType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,lt.prototype);let n=F(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let p of r.types)e.enter(`[${s++}]`,()=>{let c=this._createDataType(e,t,p);if(!(c instanceof U))throw new TypeError(`"${c==null?void 0:c.kind}" can't be set as base for a "${n.kind}"`);n.types.push(c)})}),lt.apply(i,[t,n]),i}static _createSimpleType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,u.prototype);let n=F(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),u.apply(i,[t,n]),i}static _createUnionType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ft.prototype);let n=F(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let p of r.types)e.enter(`[${s++}]`,()=>{let c=this._createDataType(e,t,p);n.types.push(c)})}),ft.apply(i,[t,n]),i}};a(Fi,"DataTypeFactory");var P=Fi;function We(o){return typeof o=="object"&&o.name?o.name:o}a(We,"preferName");var yp=require("@jsopen/objects");var rp=require("@jsopen/objects");var vs=class vs extends b{constructor(e){super(e.owner),this.name="OpraApi",this.name=e.name,this.description=e.description}toJSON(e){return(0,rp.omitUndefined)({transport:this.transport,name:this.name,description:this.description})}async _initialize(e,t){if(!$.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};a(vs,"ApiBase");var mt=vs;var ip=yt(require("path-browserify"),1),op=require("@jsopen/objects"),np=require("ts-gems");var pr=require("@jsopen/objects");var Jc=/^(.*)(Controller)$/;function Ms(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=Jc.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(pe,Object.getPrototypeOf(r));s&&(0,pr.merge)(n,s,{deep:!0});let p=Reflect.getOwnMetadata(pe,r);p&&(0,pr.merge)(n,p,{deep:!0}),(0,pr.merge)(n,{kind:m.HttpController.Kind,name:i,path:i,...(0,pr.omit)(o,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(pe,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(pe,n,r)},"decorator");return t.Cookie=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"cookie",type:i}:{...i,name:r,location:"cookie"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.Header=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"header",type:i}:{...i,name:r,location:"header"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.QueryParam=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"query",type:i}:{...i,name:r,location:"query"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.PathParam=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i}:{...i,name:r,location:"path"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.KeyParam=(r,i)=>(e.push(n=>{var p;(p=n.path)!=null&&p.includes(":"+r)||(n.path=(n.path||"")+"@:"+r);let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i,keyParam:!0}:{...i,name:r,location:"path",keyParam:!0};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(Ms,"HttpControllerDecoratorFactory");var ae=a(function(...o){var i;if(!this)return ae[N].apply(void 0,o);let[e,t]=o;if(b.call(this,e),!$.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,np.asMutable)(this);r.kind=m.HttpController.Kind,r.types=r.node[B]=new se,r.operations=new M,r.controllers=new M,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,(i=r._initialize)==null||i.call(r,t)},"HttpController"),Is=class Is extends b{get isRoot(){return!(this.owner instanceof ae)}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(),i;for(i of this.parameters)if(!(t&&t!==i.location)&&(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e)))return i;if(this.node.parent&&this.node.parent.element instanceof ae)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return ip.default.posix.join(this.owner instanceof ae?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(e){let t=(0,op.omitUndefined)({kind:this.kind,description:this.description,path:this.path});if(this.operations.size){t.operations={};for(let r of this.operations.values())t.operations[r.name]=r.toJSON(e)}if(this.controllers.size){t.controllers={};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON(e)}if(this.types.size){t.types={};for(let r of this.types.values())t.types[r.name]=r.toJSON(e)}if(this.parameters.length){t.parameters=[];for(let r of this.parameters)t.parameters.push(r.toJSON(e))}return t}[Dt](){return`[${Nt}HttpController${St+this.name+ot}]`}};a(Is,"HttpControllerClass");var Fs=Is;ae.prototype=Fs.prototype;Object.assign(ae,Ms);ae[N]=Ms;var Ps=class Ps extends mt{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="http",this.controllers=new M,this.url=e.url}findController(e){return ae.prototype.findController.call(this,e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(e){let r={...super.toJSON(),transport:this.transport,url:this.url,controllers:{}};for(let i of this.controllers.values())r.controllers[i.name]=i.toJSON(e);return r}};a(Ps,"HttpApi");var ut=Ps;var sp=yt(require("@browsery/type-is"),1),ap=require("@jsopen/objects"),pp=require("ts-gems"),Ii=require("valgen");var De=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');b.call(this,o);let t=(0,pp.asMutable)(this);if(e.contentType){let r=Array.isArray(e.contentType)?e.contentType:[e.contentType];r=r.map(i=>i.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 x?e.type:t.owner.node.getDataType(e.type)),t.isArray=e.isArray},"HttpMediaType"),ks=class ks extends b{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(e){var i,n;let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0,r=(0,ap.omitUndefined)({description:this.description,contentType:this.contentType,contentEncoding:this.contentEncoding,type:t||((i=this.type)==null?void 0:i.toJSON(e)),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&&(r.multipartFields=this.multipartFields.map(s=>s.toJSON(e))),r}generateCodec(e,t){let r;return this.type?r=this.type.generateCodec(e,t):this.contentType&&(Array.isArray(this.contentType)?this.contentType:[this.contentType]).find(n=>sp.default.is(n,["json"]))&&(r=this.node.findDataType("object").generateCodec(e)),r=r||Ii.isAny,this.isArray?Ii.vg.isArray(r):r}};a(ks,"HttpMediaTypeClass");var Ls=ks;De.prototype=Ls.prototype;var cp=require("@jsopen/objects");function cr(o,e){let t=o.lastIndexOf("/");if(o.startsWith("/")&&t){let r=o.substring(1,t),i=o.substring(t+1);if(e!=null&&e.includeFlags)for(let n of e.includeFlags)i.includes(n)||(i+=n);if(e!=null&&e.excludeFlags)for(let n of e.excludeFlags)i.replace(n,"");return new RegExp(r,i)}throw new TypeError(`"${o}" is not a valid RegExp string`)}a(cr,"parseRegExp");var js=class js extends De{constructor(e,t){super(e,t),this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?cr(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(e){return(0,cp.omitUndefined)({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON(e)})}};a(js,"HttpMultipartField");var $r=js;var lp=require("@jsopen/objects");var Wc=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,Cs=class Cs{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=Wc.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}}};a(Cs,"HttpStatusRange");var lr=Cs;var Us=class Us extends De{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new lr(r.start,r.end):new lr(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(e){let t=this.statusCode.map(i=>i.toJSON()),r=(0,lp.omitUndefined)({...super.toJSON(e),statusCode:t.length===1&&typeof t[0]=="number"?t[0]:t,partial:this.partial});if(this.parameters.length){r.parameters=[];for(let i of this.parameters)r.parameters.push(i.toJSON(e))}return r}};a(Us,"HttpOperationResponse");var Br=Us;var up=require("@jsopen/objects"),dp=require("ts-gems");var fp=require("@jsopen/objects"),mp=require("ts-gems");var dt=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');b.call(this,o);let t=(0,mp.asMutable)(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),Bs=class Bs extends b{toJSON(e){let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return(0,fp.omitUndefined)({type:this.type?t||this.type.toJSON(e):"any",description:this.description,isArray:this.isArray,examples:this.examples})}};a(Bs,"ValueClass");var $s=Bs;dt.prototype=$s.prototype;var fr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');dt.call(this,o,e);let t=(0,dp.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?cr(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,t.parser=e.parser},"HttpParameter"),Vs=class Vs extends dt{toJSON(e){return(0,up.omitUndefined)({...super.toJSON(e),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}};a(Vs,"HttpParameterClass");var qs=Vs;fr.prototype=qs.prototype;var hp=require("@jsopen/objects");var Ks=class Ks extends b{constructor(e){super(e),this.content=[]}toJSON(e){return(0,hp.omitUndefined)({description:this.description,required:this.required,maxContentSize:this.maxContentSize,content:this.content.length?this.content.map(t=>t.toJSON(e)):[],partial:this.partial,allowPatchOperators:this.allowPatchOperators})}};a(Ks,"HttpRequestBody");var qr=Ks;var zs=class zs{static async createApi(e,t){let r=new ut(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{await this._createControllers(e,r,t.controllers)}),r}static async _createControllers(e,t,r){if(Array.isArray(r)){let i=0;for(let n of r){let s;await e.enterAsync(`[${i++}]`,async()=>{s=await this._resolveControllerMetadata(e,t,n)}),s&&await e.enterAsync(`[${s.metadata.name}]`,async()=>{let p=await this._createController(e,t,s.metadata,s.instance,s.ctor);p&&(t.controllers.get(p.name)&&e.addError(`Duplicate controller name (${s.name})`),t.controllers.set(p.name,p))})}return}for(let[i,n]of Object.entries(r))await e.enterAsync(`[${i}]`,async()=>{let s=await this._resolveControllerMetadata(e,t,n);if(!s)return;let p=await this._createController(e,t,{...s.metadata,name:i},s.instance,s.ctor);p&&(t.controllers.get(p.name)&&e.addError(`Duplicate controller name (${i})`),t.controllers.set(p.name,p))})}static async _resolveControllerMetadata(e,t,r){typeof r=="function"&&!(0,yp.isConstructor)(r)&&(r=t instanceof ae?r(t.instance):r()),r=await he(r);let i,n,s;if(typeof r=="function"){if(n=Reflect.getMetadata(pe,r),!n)return e.addError(`Class "${r.name}" doesn't have a valid HttpController metadata`);i=r}else i=Object.getPrototypeOf(r).constructor,n=Reflect.getMetadata(pe,i),n?s=r:(n=r,r.instance==="object"&&(s=r.instance,i=Object.getPrototypeOf(s).constructor));return n?{metadata:n,instance:s,ctor:i}:e.addError(`Class "${i.name}" is not decorated with HttpController()`)}static async _createController(e,t,r,i,n){if(!r.name)throw new TypeError("Controller name required");let s=new ae(t,{...r,instance:i,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await P.addDataTypes(e,s,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let p=0;for(let c of r.parameters)await e.enterAsync(`[${p++}]`,async()=>{let l={...c};await e.enterAsync(".type",async()=>{l.type=await P.resolveDataType(e,s,c.type)});let O=new fr(s,l);s.parameters.push(O)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[p,c]of Object.entries(r.operations))await e.enterAsync(`[${p}]`,async()=>{let l=new A(s,{name:p,method:"GET"});await this._initHttpOperation(e,l,c),s.operations.set(p,l)})}),r.controllers&&await e.enterAsync(".controllers",async()=>{await this._createControllers(e,s,r.controllers)}),s}static async _initHttpOperation(e,t,r){let i={...r,name:t.name,types:void 0};return A.apply(t,[t.owner,i]),r.types&&await e.enterAsync(".types",async()=>{await P.addDataTypes(e,t,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let n=0;for(let s of r.parameters)await e.enterAsync(`[${n++}]`,async()=>{let p={...s};await e.enterAsync(".type",async()=>{p.type=await P.resolveDataType(e,t,s.type)});let c=new fr(t,p);t.parameters.push(c)})}),r.responses&&await e.enterAsync(".responses",async()=>{let n=0;for(let s of r.responses)await e.enterAsync(`[${n++}]`,async()=>{let p=new Br(t,{statusCode:s.statusCode});await this._initHttpOperationResponse(e,p,s),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let n=new qr(t);await this._initHttpRequestBody(e,n,r.requestBody),t.requestBody=n}),t}static async _initHttpMediaType(e,t,r){De.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{t.type=await P.resolveDataType(e,t,r.type)}),r.multipartFields&&await e.enterAsync(".multipartFields",async()=>{for(let i=0;i<r.multipartFields.length;i++)await e.enterAsync(`[${i}]`,async()=>{let n=r.multipartFields[i],s=new $r(t,{fieldName:n.fieldName,fieldType:n.fieldType});await this._initHttpMediaType(e,s,n),t.multipartFields.push(s)})})}static async _initHttpOperationResponse(e,t,r){await this._initHttpMediaType(e,t,r),t.partial=r.partial,r.parameters&&await e.enterAsync(".parameters",async()=>{let i=0;for(let n of r.parameters)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await P.resolveDataType(e,t,n.type)});let p=new fr(t,s);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,t.allowPatchOperators=r.allowPatchOperators,t.keepKeyFields=r.keepKeyFields,r.content&&await e.enterAsync(".content",async()=>{for(let i=0;i<r.content.length;i++)await e.enterAsync(`[${i}]`,async()=>{let n=r.content[i],s=new De(t,String(i));await this._initHttpMediaType(e,s,n),t.content.push(s)})})}};a(zs,"HttpApiFactory");var mr=zs;var Ep=require("@jsopen/objects"),_p=require("super-fast-md5");var Js=class Js extends mt{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="rpc",this.controllers=new M,this.platform=e.platform}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values())if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;this._controllerReverseMap.set(e,null);return}return this.controllers.get(e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(){let t={...super.toJSON(),transport:this.transport,platform:this.platform,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};a(Js,"RpcApi");var ht=Js;var Tp,Ws=class Ws extends b{constructor(){super(null),this[Tp]=new WeakMap,this.id="",this.info={},this.references=new M,this.types=new se,this.node[B]=this.types,this.node.findDataType=this._findDataType.bind(this)}getDataTypeNs(e){let t=e instanceof x?this._findDataType(e.name||""):this._findDataType(e);if(t)return this[we].get(t)}findDocument(e){if(this.id===e)return this;for(let t of this.references.values()){if(t.id===e)return t;let r=t.findDocument(e);if(r)return r}}get httpApi(){if(!(this.api&&this.api instanceof ut))throw new TypeError("The document do not contains HttpApi instance");return this.api}get rpcApi(){if(!(this.api&&this.api instanceof ht))throw new TypeError("The document do not contains RpcApi instance");return this.api}toJSON(){return this.export()}export(e){let t=(0,Ep.omitUndefined)({spec:m.SpecVersion,id:this.id,url:this.url,info:F(this.info,!0)});if(this.references.size){let r=0,i={};for(let[n,s]of this.references.entries())s[Ne]||(i[n]={id:s.id,url:s.url,info:F(s.info,!0)},r++);r&&(t.references=i)}if(this.types.size){t.types={};for(let r of this.types.values())r.inScope(e==null?void 0:e.scope)&&(t.types[r.name]=r.toJSON(e))}return this.api&&(t.api=this.api.toJSON(e)),t}invalidate(){let e=this.export({});delete e.id,this.id=(0,_p.md5)(JSON.stringify(e)),this[we]=new WeakMap}_findDataType(e,t,r){let i=this.types.get(e);if(i&&i.inScope(t))return i;if(!this.references.size)return;if(typeof e=="string"){let s=uo.exec(e);if(s){let p=s[1];if(p){let c=this.references.get(p);return c?(r=r||new WeakMap,r.set(this,!0),r.set(c,!0),c._findDataType(s[2],t,r)):void 0}e=s[2]}}r=r||new WeakMap,r.set(this,!0);let n=Array.from(this.references.keys()).reverse();for(let s of n){let p=this.references.get(s);if(i=p==null?void 0:p.types.get(e),i)return this[we].set(i,p!=null&&p[Ne]?"":s),i}for(let s of n){let p=this.references.get(s);if(r.set(p,!0),i=p._findDataType(e,t,r),i)return this[we].set(i,p!=null&&p[Ne]?"":s),i}}};a(Ws,"ApiDocument");var Ye=Ws;Tp=we;function Ge(o,e,t){let r=Mi(e.pick,e.omit),i=typeof o=="string"?o.charAt(0).toUpperCase()+o.substring(1):o.name,n=(t==null?void 0:t.name)||i+"Mapped",s={[n]:class{constructor(){typeof o=="function"&&Or(this,o,r)}}}[n];if(typeof o=="function"&&xr(s.prototype,o.prototype),typeof o=="function"){let c=Reflect.getOwnMetadata(d,o);if(!c)throw new TypeError(`Class "${o}" doesn't have datatype metadata information`);if(!(c.kind===m.ComplexType.Kind||c.kind===m.MappedType.Kind||c.kind===m.MixinType.Kind))throw new TypeError(`Class "${o}" is not a ${m.ComplexType.Kind}`)}let p={...t,kind:"MappedType",base:o};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(d,p,s),typeof o=="function"&&Je._applyMixin(s,o,{...e,isInheritedPredicate:r}),s}a(Ge,"createMappedClass");function Gc(o,e,t){return Ge(o,{omit:e},t)}a(Gc,"OmitType");function Qc(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return Ge(o,{partial:t},r)}a(Qc,"PartialType");function Xc(o,e,t){return Ge(o,{pick:e},t)}a(Xc,"PickType");function Zc(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return Ge(o,{required:t},r)}a(Zc,"RequiredType");var Dp=require("@jsopen/objects");var xp=require("@jsopen/objects"),Op=require("ts-gems");var Qe=a(function(...o){var i;if(!this)return Qe[N].apply(void 0,o);let[e,t]=o;if(b.call(this,e),!$.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,Op.asMutable)(this);r.kind=m.RpcController.Kind,r.types=r.node[B]=new se,r.operations=new M,r.headers=[],r.name=t.name,r.description=t.description,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(i=r._initialize)==null||i.call(r,t)},"RpcController"),Gs=class Gs extends b{findHeader(e,t){let r=e.toLowerCase(),i;for(i of this.headers)if(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e))return i;if(this.node.parent&&this.node.parent.element instanceof Qe)return this.node.parent.element.findHeader(e,t)}toString(){return`[RpcController ${this.name}]`}toJSON(){let e=(0,xp.omitUndefined)({kind:this.kind,description:this.description});if(this.operations.size){e.operations={};for(let t of this.operations.values())e.operations[t.name]=t.toJSON()}if(this.types.size){e.types={};for(let t of this.types.values())e.types[t.name]=t.toJSON()}if(this.headers.length){e.headers=[];for(let t of this.headers)e.headers.push(t.toJSON())}return e}[Dt](){return`[${Nt}RpcController${St+this.name+ot}]`}};a(Gs,"RpcControllerClass");var Ys=Gs;Qe.prototype=Ys.prototype;Object.assign(Qe,ar);Qe[N]=ar;var gp=require("@jsopen/objects"),wp=require("ts-gems");var ur=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');dt.call(this,o,e);let t=(0,wp.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?cr(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.deprecated=e.deprecated,t.required=e.required},"RpcHeader"),Xs=class Xs extends dt{toJSON(){return(0,gp.omitUndefined)({...super.toJSON(),name:this.name,required:this.required,deprecated:this.deprecated})}};a(Xs,"RpcHeaderClass");var Qs=Xs;ur.prototype=Qs.prototype;var Rp=require("@jsopen/objects"),bp=require("ts-gems");var dr=a(function(...o){if(!this){let[i,n]=o,s=[];return dr[N].call(void 0,s,i,n)}let[e,t]=o;if(b.call(this,e),!$.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,bp.asMutable)(this);r.headers=[],r.types=r.node[B]=new se,r.name=t.name,r.description=t.description,r.channel=t.channel,t!=null&&t.payloadType&&(r.payloadType=(t==null?void 0:t.payloadType)instanceof x?t.payloadType:r.owner.node.getDataType(t.payloadType)),t!=null&&t.keyType&&(r.keyType=(t==null?void 0:t.keyType)instanceof x?t.keyType:r.owner.node.getDataType(t.keyType))},"RpcOperation"),Hs=class Hs extends b{findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){var t;let e=(0,Rp.omitUndefined)({kind:m.RpcOperation.Kind,description:this.description,channel:this.channel,payloadType:this.payloadType.name?this.payloadType.name:this.payloadType.toJSON(),keyType:this.keyType?this.keyType.name?this.keyType.name:this.keyType.toJSON():void 0,response:(t=this.response)==null?void 0:t.toJSON()});if(this.headers.length){e.headers=[];for(let r of this.headers)e.headers.push(r.toJSON())}return e}};a(Hs,"RpcOperationClass");var Zs=Hs;dr.prototype=Zs.prototype;dr[N]=Ur;var Ap=require("@jsopen/objects");var ea=class ea extends b{constructor(e,t){super(e),this.headers=[],this.channel=t==null?void 0:t.channel,this.description=t==null?void 0:t.description,t!=null&&t.payloadType?this.payloadType=(t==null?void 0:t.payloadType)instanceof x?t.payloadType:this.owner.node.getDataType(t.payloadType):this.payloadType=this.owner.node.getDataType("any"),t!=null&&t.keyType&&(this.keyType=(t==null?void 0:t.keyType)instanceof x?t.keyType:this.owner.node.getDataType(t.keyType))}findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){let e=(0,Ap.omitUndefined)({description:this.description,channel:this.channel,payloadType:this.payloadType.name?this.payloadType.name:this.payloadType.toJSON(),keyType:this.keyType?this.keyType.name?this.keyType.name:this.keyType.toJSON():void 0});if(this.headers.length){e.headers=[];for(let t of this.headers)e.headers.push(t.toJSON())}return e}};a(ea,"RpcOperationResponse");var Pi=ea;var ta=class ta{static async createApi(e,t){let r=new ht(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{if(Array.isArray(t.controllers))for(let i of t.controllers){let n=await this._createController(e,r,i);n&&r.controllers.set(n.name,n)}else for(let[i,n]of Object.entries(t.controllers)){let s=await this._createController(e,r,n,i);s&&r.controllers.set(s.name,s)}}),r}static async _createController(e,t,r,i){typeof r=="function"&&!(0,Dp.isConstructor)(r)&&(r=r()),r=await he(r);let n,s,p;if(typeof r=="function"){if(s=Reflect.getMetadata(ce,r),!s)return e.addError(`Class "${r.name}" doesn't have a valid RpcController metadata`);n=r}else n=Object.getPrototypeOf(r).constructor,s=Reflect.getMetadata(ce,n),s?p=r:(s=r,r.instance==="object"&&(p=r.instance,n=Object.getPrototypeOf(p).constructor));if(!s)return e.addError(`Class "${n.name}" is not decorated with RpcController()`);if(i=i||s.name,!i)throw new TypeError("Controller name required");let c=new Qe(t,{...s,name:i,instance:p,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await P.addDataTypes(e,c,s.types)}),s.headers&&await e.enterAsync(".headers",async()=>{let l=0;for(let O of s.headers)await e.enterAsync(`[${l++}]`,async()=>{let w={...O};await e.enterAsync(".type",async()=>{O.type&&(w.type=c.node.findDataType(O.type)),!w.type&&typeof O.type=="object"&&(w.type=await P.createDataType(e,c,O.type)),w.type||(w.type=c.node.getDataType("any"))});let T=new ur(c,w);c.headers.push(T)})}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[l,O]of Object.entries(s.operations))await e.enterAsync(`[${l}]`,async()=>{let w=new dr(c,{...O,name:l,types:void 0,payloadType:void 0,keyType:void 0});await this._initRpcOperation(e,w,O),c.operations.set(w.name,w)})}),c}static async _initRpcOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await P.addDataTypes(e,t,r.types)}),t.payloadType=await P.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await P.resolveDataType(e,t,r.keyType)),r.headers&&await e.enterAsync(".headers",async()=>{let i=0;for(let n of r.headers)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await P.resolveDataType(e,t,n.type)});let p=new ur(t,s);t.headers.push(p)})}),r.response&&await e.enterAsync(".response",async()=>{let i=new Pi(t,{...r.response,payloadType:void 0,keyType:void 0});await this._initRpcOperationResponse(e,i,r.response),t.response=i})}static async _initRpcOperationResponse(e,t,r){t.payloadType=await P.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await P.resolveDataType(e,t,r.keyType)),r.headers&&await e.enterAsync(".headers",async()=>{let i=0;for(let n of r.headers)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await P.resolveDataType(e,t,n.type)});let p=new ur(t,s);t.headers.push(p)})})}};a(ta,"RpcApiFactory");var Li=ta;var Hc="https://oprajs.com/spec/v"+m.SpecVersion,ki=class ki{constructor(){this._allDocuments={}}static async createDocument(e,t){let r=new ki,i=t instanceof ye?t:new ye(t);try{let n=new Ye;if(await r.initDocument(n,i,e),i.error.details.length)throw i.error;return n}catch(n){try{n instanceof nt||i.addError(n)}catch{}if(!i.error.message){let s=i.error.details.length;i.error.message=`(${s}) error${s>1?"s":""} found in document schema.`,i.showErrorDetails&&(i.error.message+=i.error.details.map(p=>`
|
|
10
10
|
|
|
11
11
|
- ${p.message}`+(p.path?`
|
|
12
|
-
@${p.path}`:"")).join(""))}throw i.error}}async initDocument(e,t,r){let i;if(typeof r=="string"){if(i=await(await fetch(r,{method:"GET"})).json(),!i)return t.addError(`Invalid response returned from url: ${r}`);i.url=r}else i=r;let n;if(!e[Ne]){let s=e.node.findDataType("string");n=s==null?void 0:s.node.getDocument(),n||(n=await this.createBuiltinDocument(t),e.references.set("opra",n))}i.spec=i.spec||m.SpecVersion,e.url=i.url,i.info&&(e.info={...i.info}),i.references&&await t.enterAsync(".references",async()=>{let s,p;for([s,p]of Object.entries(i.references))p=await
|
|
12
|
+
@${p.path}`:"")).join(""))}throw i.error}}async initDocument(e,t,r){let i;if(typeof r=="string"){if(i=await(await fetch(r,{method:"GET"})).json(),!i)return t.addError(`Invalid response returned from url: ${r}`);i.url=r}else i=r;let n;if(!e[Ne]){let s=e.node.findDataType("string");n=s==null?void 0:s.node.getDocument(),n||(n=await this.createBuiltinDocument(t),e.references.set("opra",n))}i.spec=i.spec||m.SpecVersion,e.url=i.url,i.info&&(e.info={...i.info}),i.references&&await t.enterAsync(".references",async()=>{let s,p;for([s,p]of Object.entries(i.references))p=await he(p),await t.enterAsync(`[${s}]`,async()=>{if(!$.test(s))throw new TypeError(`Invalid namespace (${s})`);if(p instanceof Ye){e.references.set(s,p);return}let c=new Ye;n&&c.references.set("opra",n),await this.initDocument(c,t,p),e.references.set(s,this._allDocuments[c.id])})}),i.types&&await t.enterAsync(".types",async()=>{await P.addDataTypes(t,e,i.types)}),i.api&&await t.enterAsync(".api",async()=>{if(i.api&&i.api.transport==="http"){let s=await mr.createApi(t,{...i.api,owner:e});s&&(e.api=s)}else if(i.api&&i.api.transport==="rpc"){let s=await Li.createApi(t,{...i.api,owner:e});s&&(e.api=s)}else t.addError(`Unknown service transport (${i.api.transport})`)}),e.invalidate(),this._allDocuments[e.id]||(this._allDocuments[e.id]=e)}async createBuiltinDocument(e){let t={spec:m.SpecVersion,url:Hc,info:{version:m.SpecVersion,title:"Opra built-in types",license:{url:"https://github.com/oprajs/opra/blob/main/LICENSE",name:"MIT"}},types:[...Object.values(Os),...Object.values(ds)]},r=new Ye;r[Ne]=!0;let i=Object.getPrototypeOf(BigInt(0)).constructor,n=Object.getPrototypeOf(Buffer.from([])),s=r.types[gr];return s.set(Object,"object"),s.set(String,"string"),s.set(Number,"number"),s.set(Boolean,"boolean"),s.set(Object,"any"),s.set(Date,"datetime"),s.set(i,"bigint"),s.set(ArrayBuffer,"base64"),s.set(n,"base64"),await this.initDocument(r,e,t),r}};a(ki,"ApiDocumentFactory");var ra=ki;var ia;(function(o){o.HttpApiFactory=mr,o.DataTypeFactory=P,o.RpcOperationDecoratorFactory=Ur,o.RpcControllerDecoratorFactory=ar})(ia||(ia={}));var Np=require("uid");
|