@opra/common 1.8.0 → 1.9.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.
Files changed (43) hide show
  1. package/browser/index.cjs +5 -5
  2. package/browser/index.mjs +5 -5
  3. package/cjs/document/data-type/enum-type.js +2 -2
  4. package/cjs/document/decorators/http-operation-entity-create.decorator.js +58 -0
  5. package/cjs/document/decorators/http-operation-entity-delete-many.decorator.js +41 -0
  6. package/cjs/document/decorators/http-operation-entity-delete.decorator.js +41 -0
  7. package/cjs/document/decorators/http-operation-entity-find-many.decorator.js +85 -0
  8. package/cjs/document/decorators/http-operation-entity-get.decorator.js +56 -0
  9. package/cjs/document/decorators/http-operation-entity-replace.decorator.js +56 -0
  10. package/cjs/document/decorators/http-operation-entity-update-many.decorator.js +50 -0
  11. package/cjs/document/decorators/http-operation-entity-update.decorator.js +66 -0
  12. package/cjs/document/decorators/http-operation-entity.decorator.js +83 -525
  13. package/cjs/document/http/http-parameter.js +1 -0
  14. package/cjs/document/index.js +9 -1
  15. package/cjs/filter/filter-rules.js +2 -1
  16. package/esm/document/data-type/enum-type.js +2 -2
  17. package/esm/document/decorators/http-operation-entity-create.decorator.js +56 -0
  18. package/esm/document/decorators/http-operation-entity-delete-many.decorator.js +39 -0
  19. package/esm/document/decorators/http-operation-entity-delete.decorator.js +39 -0
  20. package/esm/document/decorators/http-operation-entity-find-many.decorator.js +83 -0
  21. package/esm/document/decorators/http-operation-entity-get.decorator.js +54 -0
  22. package/esm/document/decorators/http-operation-entity-replace.decorator.js +54 -0
  23. package/esm/document/decorators/http-operation-entity-update-many.decorator.js +48 -0
  24. package/esm/document/decorators/http-operation-entity-update.decorator.js +64 -0
  25. package/esm/document/decorators/http-operation-entity.decorator.js +79 -525
  26. package/esm/document/http/http-parameter.js +1 -0
  27. package/esm/document/index.js +9 -1
  28. package/esm/filter/filter-rules.js +2 -1
  29. package/package.json +1 -1
  30. package/types/document/data-type/enum-type.d.ts +3 -3
  31. package/types/document/decorators/http-operation-entity-create.decorator.d.ts +1 -0
  32. package/types/document/decorators/http-operation-entity-delete-many.decorator.d.ts +1 -0
  33. package/types/document/decorators/http-operation-entity-delete.decorator.d.ts +1 -0
  34. package/types/document/decorators/http-operation-entity-find-many.decorator.d.ts +1 -0
  35. package/types/document/decorators/http-operation-entity-get.decorator.d.ts +1 -0
  36. package/types/document/decorators/http-operation-entity-replace.decorator.d.ts +1 -0
  37. package/types/document/decorators/http-operation-entity-update-many.decorator.d.ts +1 -0
  38. package/types/document/decorators/http-operation-entity-update.decorator.d.ts +1 -0
  39. package/types/document/decorators/http-operation-entity.decorator.d.ts +32 -4
  40. package/types/document/http/http-parameter.d.ts +3 -0
  41. package/types/document/index.d.ts +9 -1
  42. package/types/filter/ast/expressions/comparison-expression.d.ts +1 -0
  43. package/types/filter/filter-rules.d.ts +1 -0
package/browser/index.cjs CHANGED
@@ -3,10 +3,10 @@
3
3
  * http://www.panates.com
4
4
  *****************************************/
5
5
 
6
- "use strict";var fp=Object.create;var sr=Object.defineProperty;var up=Object.getOwnPropertyDescriptor;var mp=Object.getOwnPropertyNames;var dp=Object.getPrototypeOf,hp=Object.prototype.hasOwnProperty;var a=(o,e)=>sr(o,"name",{value:e,configurable:!0});var Di=(o,e)=>{for(var t in e)sr(o,t,{get:e[t],enumerable:!0})},Js=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of mp(e))!hp.call(o,i)&&i!==t&&sr(o,i,{get:()=>e[i],enumerable:!(r=up(e,i))||r.enumerable});return o};var ar=(o,e,t)=>(t=o!=null?fp(dp(o)):{},Js(e||!o||!o.__esModule?sr(t,"default",{value:o,enumerable:!0}):t,o)),yp=o=>Js(sr({},"__esModule",{value:!0}),o);var Lc={};Di(Lc,{AnyType:()=>Cr,ApiBase:()=>Xe,ApiDocument:()=>Ie,ApiDocumentFactory:()=>Ks,ApiField:()=>k,BUILTIN:()=>Ne,BadRequestError:()=>Uo,Base64Type:()=>Rr,BaseI18n:()=>ra,BigintType:()=>Ur,BooleanType:()=>Br,CLASS_NAME_PATTERN:()=>C,ComplexType:()=>H,ConflictError:()=>$o,DATATYPE_METADATA:()=>E,DECODER:()=>T,DECORATOR:()=>b,DataType:()=>g,DataTypeMap:()=>ee,DateStringType:()=>rt,DateTimeStringType:()=>ot,DateTimeType:()=>it,DateType:()=>tt,DocumentElement:()=>R,DocumentInitContext:()=>ue,DocumentNode:()=>yr,ENCODER:()=>O,EmailType:()=>G,EnumType:()=>me,FailedDependencyError:()=>Ko,FieldPathType:()=>Y,FieldsProjection:()=>De,FilterType:()=>ce,ForbiddenError:()=>Ar,HTTP_CONTROLLER_METADATA:()=>ie,HttpApi:()=>Ze,HttpController:()=>te,HttpHeaderCodes:()=>Ro,HttpMediaType:()=>Oe,HttpMultipartField:()=>xr,HttpOperation:()=>S,HttpOperationResponse:()=>Or,HttpParameter:()=>St,HttpRequestBody:()=>gr,HttpStatusCode:()=>A,HttpStatusMessages:()=>Yp,HttpStatusRange:()=>Dt,I18n:()=>gt,IntegerType:()=>qe,InternalServerError:()=>Jo,IssueSeverity:()=>fn,MappedType:()=>Se,MethodNotAllowedError:()=>Go,MimeTypes:()=>I,MixinType:()=>Ye,NAMESPACE_PATTERN:()=>Mi,NotAcceptableError:()=>Qo,NotFoundError:()=>Zo,NullType:()=>$r,NumberType:()=>de,ObjectIdType:()=>Fr,ObjectType:()=>qr,OmitType:()=>Dc,OperationResult:()=>X,OpraDocumentError:()=>We,OpraException:()=>ye,OpraFilter:()=>$t,OpraHttpError:()=>N,OpraSchema:()=>m,PartialType:()=>Sc,PermissionError:()=>en,PickType:()=>Ic,RPC_CONTROLLER_METADATA:()=>oe,RequiredType:()=>vc,ResourceConflictError:()=>rn,ResourceNotAvailableError:()=>nn,ResponsiveMap:()=>D,RpcApi:()=>et,RpcController:()=>ze,RpcHeader:()=>or,RpcOperation:()=>nr,SimpleType:()=>u,StringType:()=>Ae,TimeType:()=>ft,UnauthorizedError:()=>an,UnprocessableEntityError:()=>cn,UrlType:()=>jr,UuidType:()=>Gt,classes:()=>Vs,cloneObject:()=>L,getErrorStack:()=>Sp,getStackFileName:()=>Dp,i18n:()=>Wr,inheritPropertyInitializers:()=>ur,isBlob:()=>jp,isFormData:()=>Cp,isReadable:()=>Pp,isReadableStream:()=>kp,isStream:()=>Jr,isURL:()=>Up,isWritable:()=>Fp,kCtorMap:()=>cr,kDataTypeMap:()=>U,kTypeNSMap:()=>xe,mergePrototype:()=>fr,parse:()=>Fi,parseFieldsProjection:()=>Pi,resolveThunk:()=>fe,safeJsonStringify:()=>Lp,translate:()=>w,uid:()=>lp.uid});module.exports=yp(Lc);var T_=require("reflect-metadata");var Vr=require("@jsopen/objects");var m={};Di(m,{ComplexType:()=>ht,EnumType:()=>yt,HttpController:()=>pr,HttpOperation:()=>Si,MappedType:()=>Tt,MixinType:()=>Et,RpcController:()=>Ii,RpcOperation:()=>vi,SimpleType:()=>_t,SpecVersion:()=>Tp,isComplexType:()=>_p,isDataType:()=>Ep,isEnumType:()=>Rp,isHttpController:()=>wp,isMappedType:()=>gp,isMixinType:()=>Op,isSimpleType:()=>xp});var Tp="1.0";var ht;(function(o){o.Kind="ComplexType"})(ht||(ht={}));var yt;(function(o){o.Kind="EnumType"})(yt||(yt={}));var Tt;(function(o){o.Kind="MappedType"})(Tt||(Tt={}));var Et;(function(o){o.Kind="MixinType"})(Et||(Et={}));var _t;(function(o){o.Kind="SimpleType"})(_t||(_t={}));var pr;(function(o){o.Kind="HttpController"})(pr||(pr={}));var Si;(function(o){o.Kind="HttpOperation"})(Si||(Si={}));var Ii;(function(o){o.Kind="RpcController"})(Ii||(Ii={}));var vi;(function(o){o.Kind="RpcOperation"})(vi||(vi={}));function Ep(o){return o&&typeof o=="object"&&(o.kind===ht.Kind||o.kind===yt.Kind||o.kind===Tt.Kind||o.kind===_t.Kind||o.kind===Et.Kind)}a(Ep,"isDataType");function _p(o){return o&&typeof o=="object"&&o.kind===ht.Kind}a(_p,"isComplexType");function xp(o){return o&&typeof o=="object"&&o.kind===_t.Kind}a(xp,"isSimpleType");function Op(o){return o&&typeof o=="object"&&o.kind===Et.Kind}a(Op,"isMixinType");function gp(o){return o&&typeof o=="object"&&o.kind===Tt.Kind}a(gp,"isMappedType");function Rp(o){return o&&typeof o=="object"&&o.kind===yt.Kind}a(Rp,"isEnumType");function wp(o){return o&&typeof o=="object"&&o.kind===pr.Kind}a(wp,"isHttpController");var E=Symbol.for("opra.type.metadata"),ie=Symbol("opra.http-controller.metadata"),oe=Symbol("opra.rpc-controller.metadata"),T=Symbol.for("opra.type.decoder"),O=Symbol("opra.type.encoder"),b=Symbol.for("DECORATOR"),Ne=Symbol.for("BUILTIN"),Mi=/([a-z$_]\w+):(.+)/i,C=/^[a-z][\w_]*$/i,U=Symbol.for("kDataTypeMap"),cr=Symbol.for("kCtorMap"),xe=Symbol.for("kTypeNSMap");var bp=/^(.*)(Controller)$/,Ws=[];function xt(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=bp.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(oe,Object.getPrototypeOf(r));s&&(0,Vr.merge)(n,s,{deep:!0});let p=Reflect.getOwnMetadata(oe,r);p&&(0,Vr.merge)(n,p,{deep:!0}),(0,Vr.merge)(n,{...o,kind:m.RpcController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(oe,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(oe,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),Ws.forEach(r=>r(t,e,o)),t}a(xt,"RpcControllerDecoratorFactory");xt.augment=function(o){Ws.push(o)};var Gs=require("@jsopen/objects");var Ys=[];function lr(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,Gs.omit)(t,["kind","payloadType"])},c=Reflect.getOwnMetadata(oe,n.constructor)||{};c.operations=c.operations||{},c.operations[s]=p;for(let l of o)l(p,n,s);Reflect.defineMetadata(oe,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(x=>String(x.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),Ys.forEach(n=>n(i,o,e,t)),i}a(lr,"RpcOperationDecoratorFactory");lr.augment=function(o){Ys.push(o)};BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});var Qs=require("@jsopen/objects"),Xs=ar(require("putil-promisify"),1);async function fe(o){return o=Xs.default.isPromise(o)?await o:o,typeof o=="function"?(0,Qs.isConstructor)(o)?o:await o():o}a(fe,"resolveThunk");var Zs=/^(?:file:\/\/)?(.+)$/;function Dp(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?Zs.exec(r):void 0;return i?i[1]:""}return""}a(Dp,"getStackFileName");function Sp(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?Zs.exec(r):void 0;return i?i[1]:""}return""}a(Sp,"getErrorStack");function fr(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(fr,"mergePrototype");function ur(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(ur,"inheritPropertyInitializers");var mr=require("@jsopen/objects");function L(o,e){return(0,mr.merge)({},o,{deep:a(t=>(0,mr.isPlainObject)(t)&&!t[E],"deep"),copyDescriptors:!0,ignoreUndefined:!0,filter(t,r){let i=r[t];return!e||typeof i!="function"&&(typeof i!="object"||(0,mr.isPlainObject)(i)||Array.isArray(i))}})}a(L,"cloneObject");var Li=require("fast-tokenizer");var Ip=/^([+-])?([a-z_$]\w*)$/i,vp=/[^.]\(/g,ki=class ki{};a(ki,"FieldsProjection");var De=ki;(function(o){let t=class t{};a(t,"Item");let e=t;o.Item=e})(De||(De={}));function Pi(o,e){let t=Array.isArray(o)?o:[o];if(!(t&&t.length))return;let r=new De;for(let i of t)e||(i=i.toLowerCase()),Fi(i,r);return r}a(Pi,"parseFieldsProjection");function Fi(o,e){o=o.replace(vp,r=>r.charAt(0)+"."+r.substring(1));let t=(0,Li.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,Li.splitString)(i,{delimiters:",",brackets:!0,keepBrackets:!0});for(let l of c)Fi(l,e);continue}let n=Ip.exec(i);if(!n)throw new TypeError(`Invalid field path (${o})`);let s=n[2],p=e[s]=e[s]||new De.Item;n[1]&&(p.sign=n[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new De}}a(Fi,"parse");function Mp(o){return o&&typeof o.forEach=="function"}a(Mp,"isMap");var J=Symbol.for("kEntries"),he=Symbol.for("kKeyMap"),zr=Symbol.for("kWellKnownKeys"),ji=Symbol.for("kOptions"),Ot=Symbol.for("kSize"),Ci=class Ci{constructor(e,t){Object.defineProperty(this,Ot,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,J,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,he,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,zr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,ji,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(i=>{r?this[zr][i]=i:this[zr][i.toLowerCase()]=i}),this.clear(),e&&this.setAll(e)}get size(){return this[Ot]}clear(){Object.keys(this[J]).forEach(e=>delete this[J][e]),Object.keys(this[he]).forEach(e=>delete this[he][e]),this[Ot]=0}forEach(e,t){for(let[r,i]of this.entries())e.call(t,i,r,this)}get(e){if(e)return this[J][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[J],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let i=Object.prototype.hasOwnProperty.call(this[J],r);return this[J][r]=t,i||this[Ot]++,this[he][r]=e,this}setAll(e){return Mp(e)?e.forEach((t,r)=>this.set(r,t)):Object.keys(e).forEach(t=>this.set(t,e[t])),this}keys(){return Object.values(this[he])[Symbol.iterator]()}values(){return Object.values(this[J])[Symbol.iterator]()}entries(){return Object.entries(this[J])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[J],t);return delete this[J][t],delete this[he][t],r||this[Ot]--,r}sort(e){let t={...this[J]},r={...this[he]},i=Array.from(this.keys());e?i.sort(e):i.sort(),this.clear();for(let n of i)this[J][n]=t[n],this[he][n]=r[n];return this[Ot]=i.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[he]))e[r]=this[J][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[ji].caseSensitive)return e;let t=this._getStoringKey(e);return this[he][t]??this[zr][t]??e}_getStoringKey(e){return this[ji].caseSensitive?e:e.toLowerCase()}};a(Ci,"ResponsiveMap");var D=Ci;function Lp(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(Lp,"safeJsonStringify");function Jr(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}a(Jr,"isStream");function Pp(o){return Jr(o)&&typeof o._read=="function"&&typeof o._readableState=="object"}a(Pp,"isReadable");function Fp(o){return Jr(o)&&typeof o._write=="function"}a(Fp,"isWritable");function kp(o){return Jr(o)&&typeof o.getReader=="function"&&typeof o.pipeThrough=="function"&&typeof o.pipeTo=="function"}a(kp,"isReadableStream");function jp(o){return o!==null&&typeof o=="object"&&typeof o.size=="number"&&typeof o.arrayBuffer=="function"&&typeof o.stream=="function"}a(jp,"isBlob");function Cp(o){return o!==null&&typeof o.constructor=="function"&&o.constructor.name==="FormData"&&typeof o.append=="function"&&typeof o.getAll=="function"}a(Cp,"isFormData");function Up(o){return o!==null&&typeof o=="object"&&typeof o.host=="string"&&typeof o.href=="string"}a(Up,"isURL");var ia=require("@jsopen/objects");var ta=ar(require("@browsery/i18next"),1),hr=require("fast-tokenizer");var Bp=/\\(.)/g,$p=/(\\)/g;function Hs(o){return o.replace($p,"\\\\")}a(Hs,"escapeString");function ea(o){return o.replace(Bp,"$1")}a(ea,"unescapeString");var ra=Object.getPrototypeOf(ta.default.createInstance()).constructor,dr=class dr extends ra{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 dr(e,t)}static createInstance(e,t){return new dr(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,hr.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,hr.splitString)(n,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),p=ea(n.substring((s[0]||"").length+1));n=s[0]||"";let c=[],l=null;for(let d of(0,hr.tokenize)(n,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(d.startsWith("{")){l=JSON.parse(d);continue}c.push(d)}let x=c.length>1?"$t("+c.join(",")+")":c[0];i+=p?this.t(x,p,{...r,...l}):this.t(x,{...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 qp}};a(dr,"I18n");var gt=dr,qp=gt.createInstance();var Kp=/(\))/g;function w(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?"?"+Hs(i).replace(Kp,"\\$1"):"")+")"}a(w,"translate");var Wr=gt.createInstance();Wr.init().catch(()=>{});var Ui=class Ui extends Error{constructor(e,t){super("Unknown error"),this.severity="error",t=t||(e instanceof Error?e:void 0),e instanceof Error&&(t=e),t&&t instanceof Error&&(this.cause=t,t.stack&&(this.stack=t.stack)),typeof e=="string"?this.initString(e):e instanceof Error?this.initError(e):this.init(e),this.message=this.message||this.constructor.name}toString(){return Wr.deep(this.message)}toJSON(){var t;let e="production";return(0,ia.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(Ui,"OpraException");var ye=Ui;var Bi=class Bi extends ye{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};a(Bi,"OpraDocumentError");var We=Bi;var $i=class $i{constructor(e){this.path="",this.error=new We,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($i,"DocumentInitContext");var ue=$i;var au=require("reflect-metadata"),ua=require("@jsopen/objects"),ma=require("ts-gems");var oa=require("@jsopen/objects");function qi(o){return function(e){let t;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!C.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(E,e);r||(r={},Reflect.defineMetadata(E,r,e)),r.kind=m.ComplexType.Kind,r.name=t,o&&Object.assign(r,(0,oa.omit)(o,["name"]))}}a(qi,"ComplexTypeDecorator");var Xi=require("@jsopen/objects"),fa=require("ts-gems");var na=require("ts-gems"),sa=require("uid");var Ki=class Ki{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[xe])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[U])==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(E,e).name;else if(typeof e=="object"){let n=e[E];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`)}};a(Ki,"DocumentNode");var yr=Ki;var R=a(function(o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=(0,na.asMutable)(this);e.id=(0,sa.uid)(16),Object.defineProperty(e,"node",{value:new yr(this,o==null?void 0:o.node),enumerable:!1,writable:!0}),o&&Object.defineProperty(e,"owner",{value:o,enumerable:!1,writable:!0})},"DocumentElement"),zi=class zi{};a(zi,"DocumentElementClass");var Vi=zi;R.prototype=Vi.prototype;var aa=require("@jsopen/objects");function Ji(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(E,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(E,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,aa.omitUndefined)({...i,scopePattern:Array.isArray(r)?r:[r],type:void 0,isArray:void 0,isNestedEntity:void 0}))}),t),t}a(Ji,"ApiFieldDecoratorFactory");function Tr(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(Tr,"testScopeMatch");var la=require("ts-gems"),W=require("valgen");var pa=require("@jsopen/objects"),ca=require("ts-gems");var Rt=Symbol.for("nodejs.util.inspect.custom"),Ge="\x1B[0m",wt="\x1B[33m",bt="\x1B[35m";var g=a(function(o,e,t){if(!this)throw new TypeError('"this" should be passed to call class constructor');if(e!=null&&e.name&&!C.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);R.call(this,o);let r=(0,ca.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"),Gi=class Gi extends R{get embedded(){return!this.name}inScope(e){return Tr(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,pa.omitUndefined)({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[Rt](){return`[${wt+Object.getPrototypeOf(this).constructor.name+Ge} ${bt+this.name+Ge}]`}};a(Gi,"DataTypeClass");var Wi=Gi;g.prototype=Wi.prototype;var Vp=/^([+-])?([a-z$_][\w.]*)$/i,j=a(function(...o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;g.call(this,e,t,r);let i=(0,la.asMutable)(this);i._fields=new D},"ComplexTypeBase"),Qi=class Qi extends g{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 d,V,zs;let r=this,i,n=e.split("."),s=n.length,p=[],c=this.owner.node.getDataType("object"),l=t==null?void 0:t.allowSigns,x=a(()=>p.map(Je=>Je.fieldName).join("."),"getStrPath");for(let Je=0;Je<s;Je++){let Z={fieldName:n[Je],dataType:c};p.push(Z);let Kr=Vp.exec(n[Je]);if(!Kr)throw new TypeError(`Invalid field name (${x()})`);if(Kr[1]&&((Je===0&&l==="first"||l==="each")&&(Z.sign=Kr[1]),Z.fieldName=Kr[2]),r){if(r instanceof j){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(((d=r.additionalFields)==null?void 0:d[0])===!0){Z.additionalField=!0,Z.dataType=c,r=void 0;continue}if(((V=r.additionalFields)==null?void 0:V[0])==="type"&&((zs=r.additionalFields)==null?void 0:zs[1])instanceof g){Z.additionalField=!0,Z.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(Ni=>Ni.fieldName).join(".")})`)}throw new TypeError(`"${p.map(Ni=>Ni.fieldName).join(".")}" field is not a complex type and has no child fields`)}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){let r=Array.isArray(t==null?void 0:t.projection)?Pi(t.projection):t==null?void 0:t.projection,i=this._generateSchema(e,{...t,projection:r,currentPath:""}),n;if(this.additionalFields instanceof g)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 s=n[1];n=(0,W.validator)((p,c,l)=>c.fail(l,s,p))}return W.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})}_generateSchema(e,t){var c;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]=W.vg.isUndefined({coerce:!0});continue}p=l.name;let x;if(n!=="*"&&(x=n==null?void 0:n[p.toLowerCase()],(x==null?void 0:x.sign)==="-"||s&&!x||!s&&l.exclusive&&!x)){r[l.name]=W.vg.isUndefined({coerce:!0});continue}let d=this._generateFieldCodec(e,l,{...t,partial:t.partial==="deep"?t.partial:void 0,projection:typeof n=="object"?((c=n[p])==null?void 0:c.projection)||"*":n,currentPath:i+(i?".":"")+p});r[p]=t.partial||!l.required?W.vg.optional(d):W.vg.required(d)}return t.allowPatchOperators&&(r._$pull=W.vg.optional(W.vg.isAny()),r._$push=W.vg.optional(W.vg.isAny())),r}_generateFieldCodec(e,t,r){let i=t.type.generateCodec(e,r);return t.fixed&&(i=W.vg.isEnum([t.fixed])),t.isArray&&(i=W.vg.isArray(i)),i}};a(Qi,"ComplexTypeBaseClass");var Yi=Qi;j.prototype=Yi.prototype;var k=a(function(...o){if(!this){let[n]=o;return k[b](n)}let[e,t]=o;R.call(this,e);let r=(0,fa.asMutable)(this);r.name=t.name;let i=t.origin||e;if(!(i instanceof j))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"),Hi=class Hi extends R{inScope(e){return Tr(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(Tr(e,r.scopePattern)){t=(0,Xi.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,Xi.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(Hi,"ApiFieldClass");var Zi=Hi;k.prototype=Zi.prototype;Object.assign(k,Ji);k[b]=Ji;var H=a(function(...o){var n;if(!this)return H[b].apply(void 0,o);let[e,t]=o,r=o[2]||new ue({maxErrors:0});j.call(this,e,t,r);let i=(0,ma.asMutable)(this);i.kind=m.ComplexType.Kind,t.base&&r.enter(".base",()=>{if(!(t.base instanceof j))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 k(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 k(this,{...p,name:s});this._fields.set(c.name,c)}})},"ComplexType"),to=class to extends j{extendsFrom(e){var t;return e instanceof g||(e=this.node.getDataType(e)),e instanceof j?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};if(this.additionalFields)if(this.additionalFields instanceof g){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,ua.omitUndefined)(i)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(to,"ComplexTypeClass");var eo=to;H.prototype=eo.prototype;Object.assign(H,qi);H[b]=qi;var Tu=require("reflect-metadata"),Gr=require("@jsopen/objects"),da=require("ts-gems"),ha=require("valgen");var me=a(function(...o){if(!this)return me[b].apply(void 0,o);let[e,t,r]=o;g.call(this,e,t,r);let i=(0,da.asMutable)(this);if(i.kind=m.EnumType.Kind,t.base){if(!(t.base instanceof me))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${i.kind}"`);i.base=t.base}i.instance=t.instance,i.ownAttributes=L(t.attributes||{}),i.attributes=i.base?L(i.base.attributes):{};for(let[n,s]of Object.entries(i.ownAttributes))i.attributes[n]=s},"EnumType"),ro=class ro extends g{extendsFrom(e){var t;return e instanceof g||(e=this.node.getDataType(e)),e instanceof me?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return ha.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,Gr.omitUndefined)({...t,kind:this.kind,base:r,attributes:L(this.ownAttributes)})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(ro,"EnumTypeClass");var Er=ro;me.prototype=Er.prototype;Object.assign(me,Er);function zp(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,Gr.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,Gr.omitUndefined)({alias:p,description:c})})}let s={kind:m.EnumType.Kind,attributes:i,base:r.base,name:r.name,description:r==null?void 0:r.description};return Object.defineProperty(o,E,{value:s,enumerable:!1,configurable:!0,writable:!0}),n}a(zp,"EnumTypeFactory");me.prototype=Er.prototype;me[b]=zp;var Au=require("reflect-metadata"),ya=require("@jsopen/objects"),Ta=require("ts-gems");function Yr(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(Yr,"getIsInheritedPredicateFn");var Se=a(function(...o){var n;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;j.call(this,e,t,r);let i=(0,Ta.asMutable)(this);if(i.kind=m.MappedType.Kind,t.base){if(!(t.base instanceof j))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=Yr(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,x]of i.base.fieldEntries()){if(!s(l))continue;let d={...x};p===!0||Array.isArray(p)&&p.includes(x.name.toLowerCase())?d.required=!1:(c===!0||Array.isArray(c)&&c.includes(x.name.toLowerCase()))&&(d.required=!0);let V=new k(this,d);i._fields.set(V.name,V)}(!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)}},"MappedType"),oo=class oo extends j{extendsFrom(e){var t;return e instanceof g||(e=this.node.getDataType(e)),e instanceof j?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,ya.omitUndefined)({...t,base:r||this.base.toJSON(e),kind:this.kind,pick:this.pick,omit:this.omit,partial:this.partial,required:this.required})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(oo,"MappedTypeClass");var io=oo;Se.prototype=io.prototype;Se._applyMixin=()=>{};var Pu=require("reflect-metadata"),Ea=require("@jsopen/objects"),_a=require("ts-gems");var Ye=a(function(...o){if(!this)return Ye[b].apply(void 0,o);let[e,t,r]=o;j.call(this,e,t,r);let i=(0,_a.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 k(this,s);i._fields.set(p.name,p)}i.types.push(n),n.keyField&&(i.keyField=n.keyField)}},"MixinType"),so=class so extends j{extendsFrom(e){if(e instanceof g||(e=this.node.getDataType(e)),!(e instanceof j))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,Ea.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(so,"MixinTypeClass");var no=so;Ye.prototype=no.prototype;Ye[b]=Jp;function Jp(...o){let e=o.filter(s=>typeof s=="function"),t=typeof o[o.length-1]=="object"?o[o.length-1]:void 0;if(!e.length)throw new TypeError("No Class has been provided");if(e.length===1)return e[0];let r=e[0].name+"Mixin",i={[r]:class{constructor(){for(let s of e)ur(this,s)}}}[r],n={...t,kind:m.MixinType.Kind,types:[]};Reflect.defineMetadata(E,n,i);for(let s of e){let p=Reflect.getMetadata(E,s);if(!(p&&(p.kind===m.ComplexType.Kind||p.kind===m.MixinType.Kind||p.kind===m.MappedType.Kind)))throw new TypeError(`Class "${s.name}" is not a ${m.ComplexType.Kind}, ${m.MixinType.Kind} or ${m.MappedType.Kind}`);n.types.push(s),fr(i.prototype,s.prototype)}return i}a(Jp,"MixinTypeFactory");var Gu=require("reflect-metadata"),po=require("@jsopen/objects"),Oa=require("ts-gems"),co=require("valgen");function ao(o){let e=[],t=a(function(r){let i;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!C.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(E,r)||{};o&&Object.assign(n,o),n.kind=m.SimpleType.Kind,n.name=i,Reflect.defineMetadata(E,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(ao,"SimpleTypeDecoratorFactory");function xa(o){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(E,e.constructor)||{},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(E,r,e.constructor)}}a(xa,"AttributeDecoratorFactory");var u=a(function(...o){var n,s;if(!this)return u[b](...o);let[e,t,r]=o;g.call(this,e,t,r);let i=(0,Oa.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=L(t.attributes||{}),i.attributes=i.base?L(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"),fo=class fo extends g{extendsFrom(e){var t;return e instanceof g||(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 co.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 co.isAny}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i=(0,po.omitUndefined)(this.ownAttributes),n;this.properties&&typeof this.properties.toJSON=="function"?n=this.properties.toJSON(this.properties,this.owner,e):n=this.properties?L(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,po.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(fo,"SimpleTypeClass");var lo=fo;u.prototype=lo.prototype;Object.assign(u,ao);u[b]=ao;u.Attribute=xa;var uo=Symbol("initializing"),Qr=class Qr{static async createDataType(e,t,r){e=e||new ue({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 Qr.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[U];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 ue({maxErrors:0});let i=await this._prepareAllInitArgs(e,t,r);if(!i)return;let n=new D;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 x=this._createDataType(s,t,l);x&&p.push(x)});return p}static async _prepareAllInitArgs(e,t,r){let i=new D,n=new D,s=e.extend({owner:t,importQueue:i,initArgsMap:n});if(!t.node[U])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 fe(c);let l=Reflect.getMetadata(E,c)||c[E];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 fe(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){var x;r=await fe(r);let{importQueue:i,initArgsMap:n}=e,s=t.node.findDataType(r);if(s instanceof g)return s.name;let p,c,l;if(typeof r!="string"){let V=t.node.getDocument().types[cr].get(r);V&&(r=V)}if(typeof r=="string"){let d=r;if(r=(i==null?void 0:i.get(d))||((x=e.initArgsMap)==null?void 0:x.get(d)),!r)return e.addError(`Unknown data type (${d})`)}if(typeof r=="function"){if(p=Reflect.getMetadata(E,r),!p)return e.addError(`Class "${r.name}" doesn't have a valid DataType metadata`);c=r}else if(typeof r=="object"){if(p=r[E],p)l=r,p.kind!==m.EnumType.Kind&&(p=void 0);else if(m.isDataType(r))p=r,c=p.ctor;else if(c=Object.getPrototypeOf(r).constructor,p=c&&Reflect.getMetadata(E,c),p&&p.kind===m.SimpleType.Kind){let d=await this._importDataTypeArgs(e,t,p.name);return d?typeof d=="object"&&d.kind!==m.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:m.SimpleType.Kind,name:void 0,base:d,properties:r}:void 0}}return p?e.enterAsync(p.name?`[${p.name}]`:"",async()=>{if(p.name){let V=n==null?void 0:n.get(p.name);if(V)return V[uo]?e.addError("Circular reference detected"):p.name}let d={kind:p.kind,name:p.name};d[uo]=!0;try{if(d.name)if(i!=null&&i.has(d.name))n==null||n.set(p.name,d),d._instance={name:p.name},d[U]=t.node[U];else return e.addError(`Data Type (${d.name}) must be explicitly added to type list in the document scope`);switch(d.kind){case m.ComplexType.Kind:d.ctor=c,await this._prepareComplexTypeArgs(e,t,d,p);break;case m.EnumType.Kind:d.instance=l,await this._prepareEnumTypeArgs(e,t,d,p);break;case m.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,d,p);break;case m.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,d,p);break;case m.SimpleType.Kind:d.ctor=c,await this._prepareSimpleTypeArgs(e,t,d,p);break;default:return e.addError(`Invalid data type kind ${p.kind}`)}}finally{d.name&&(i==null||i.delete(d.name)),delete d[uo]}return i&&d.name?d.name:d}):e.addError("No DataType metadata found")}static async _prepareDataTypeArgs(e,t,r){t.description=r.description,t.abstract=r.abstract,t.examples=r.examples,t.scopePattern=r.scopePattern}static async _prepareComplexTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.keyField=i.keyField,await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(E,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=Qe(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=Qe(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:Qe(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=Qe(n))}),r.attributes=L(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);else if(r.ctor){let x=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(E,x)&&(l=await this._importDataTypeArgs(e,t,x))}l&&(r.base=Qe(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=L(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[O])=="function"&&(r.generateEncoder=(c=r.properties)==null?void 0:c[O].bind(r.properties))}static async _prepareMappedTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(E,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=Qe(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(Qe(c))})})}static _createDataType(e,t,r){var s;let i=t.node.findDataType(typeof r=="string"?r:r.name||"");if(i instanceof g)return i;let n=typeof r=="string"?(s=e.initArgsMap)==null?void 0:s.get(r):r;if(n){let p=n[U];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);default:break}}e.addError(`Unknown data type (${String(r)})`)}static _createComplexType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,H.prototype);let n=L(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})})}),H.apply(i,[t,n]),i}static _createEnumType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,me.prototype);let n=L(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),n.attributes=r.attributes,me.apply(i,[t,n]),i}static _createMappedType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Se.prototype);let n=L(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),Se.apply(i,[t,n]),i}static _createMixinType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Ye.prototype);let n=L(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 j))throw new TypeError(`"${c==null?void 0:c.kind}" can't be set as base for a "${n.kind}"`);n.types.push(c)})}),Ye.apply(i,[t,n]),i}static _createSimpleType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,u.prototype);let n=L(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),u.apply(i,[t,n]),i}};a(Qr,"DataTypeFactory");var v=Qr;function Qe(o){return typeof o=="object"&&o.name?o.name:o}a(Qe,"preferName");var $a=require("@jsopen/objects");var ga=require("@jsopen/objects");var mo=class mo extends R{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(!C.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};a(mo,"ApiBase");var Xe=mo;var ba=ar(require("path-browserify"),1),Aa=require("@jsopen/objects"),Na=require("ts-gems");var Ra,wa,ne=Symbol.for("kMap"),_r=Symbol.for("kCtorMap"),ho=class ho{constructor(){this[Ra]=new D,this[wa]=new WeakMap}get size(){return this[ne].size}forEach(e,t){this[ne].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[_r].get(e);if(!t&&typeof e=="function"){let i=Reflect.getMetadata(E,e);t=i==null?void 0:i.name}if(!t&&typeof e=="object"){let i=e[E];t=i==null?void 0:i.name}if(!t)return;let r=this[ne].get(t);if(r)return typeof e=="function"&&r.kind==="ComplexType"?r.ctor===e?r:void 0:r}set(e,t){this[ne].set(e,t),t.ctor?this[_r].set(t.ctor,e):t.instance&&this[_r].set(t.instance,e)}has(e){if(e instanceof g)return!!e.name&&this[ne].has(e.name);let t=typeof e=="string"?e:this[_r].get(e);return t?this[ne].has(t):!1}keys(){return this[ne].keys()}values(){return this[ne].values()}entries(){return this[ne].entries()}sort(e){return this[ne].sort(e),this}[(Ra=ne,wa=_r,Symbol.iterator)](){return this[ne][Symbol.iterator]()}};a(ho,"DataTypeMap");var ee=ho;var At=require("@jsopen/objects");var Gp=/^(.*)(Controller)$/;function yo(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=Gp.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(ie,Object.getPrototypeOf(r));s&&(0,At.merge)(n,s,{deep:!0});let p=Reflect.getOwnMetadata(ie,r);p&&(0,At.merge)(n,p,{deep:!0}),(0,At.merge)(n,{kind:m.HttpController.Kind,name:i,path:i,...(0,At.omit)(o,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(ie,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(ie,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(yo,"HttpControllerDecoratorFactory");var te=a(function(...o){var i;if(!this)return te[b].apply(void 0,o);let[e,t]=o;if(R.call(this,e),!C.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,Na.asMutable)(this);r.kind=m.HttpController.Kind,r.types=r.node[U]=new ee,r.operations=new D,r.controllers=new D,r.parameters=[],r.name=t.name,r.description=t.description,r.path=t.path??t.name,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(i=r._initialize)==null||i.call(r,t)},"HttpController"),Eo=class Eo extends R{get isRoot(){return!(this.owner instanceof te)}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 te)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return ba.default.posix.join(this.owner instanceof te?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(e){let t=(0,Aa.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}[Rt](){return`[${wt}HttpController${bt+this.name+Ge}]`}};a(Eo,"HttpControllerClass");var To=Eo;te.prototype=To.prototype;Object.assign(te,yo);te[b]=yo;var _o=class _o extends Xe{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="http",this.controllers=new D,this.url=e.url}findController(e){return te.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(_o,"HttpApi");var Ze=_o;var Da=ar(require("@browsery/type-is"),1),Sa=require("@jsopen/objects"),Ia=require("ts-gems"),Xr=require("valgen");var Oe=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');R.call(this,o);let t=(0,Ia.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 g?e.type:t.owner.node.getDataType(e.type)),t.isArray=e.isArray},"HttpMediaType"),Oo=class Oo extends R{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,Sa.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=>Da.default.is(n,["json"]))&&(r=this.node.findDataType("object").generateCodec(e)),r=r||Xr.isAny,this.isArray?Xr.vg.isArray(r):r}};a(Oo,"HttpMediaTypeClass");var xo=Oo;Oe.prototype=xo.prototype;var va=require("@jsopen/objects");function Nt(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(Nt,"parseRegExp");var go=class go extends Oe{constructor(e,t){super(e,t),this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?Nt(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(e){return(0,va.omitUndefined)({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON(e)})}};a(go,"HttpMultipartField");var xr=go;var Ma=ar(require("path-browserify"),1),La=require("@jsopen/objects"),Pa=require("ts-gems");var Ro;(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"})(Ro||(Ro={}));var A;(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"})(A||(A={}));var Yp={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 I;(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"})(I||(I={}));function B(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(ie,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let p of o)p(n);Reflect.defineMetadata(ie,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||I.opra_response_json,n.contentEncoding=n.contentEncoding||"utf-8"),n.contentType===I.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||I.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(B,"HttpOperationDecoratorFactory");var S=a(function(...o){if(!this){let[i]=o,n=[];return S[b].call(void 0,n,i)}let[e,t]=o;if(R.call(this,e),!C.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,Pa.asMutable)(this);r.parameters=[],r.responses=[],r.types=r.node[U]=new ee,r.name=t.name,r.path=t.path,r.mergePath=t.mergePath,r.method=t.method||"GET",r.description=t.description,r.composition=t.composition,r.compositionOptions=t.compositionOptions?L(t.compositionOptions):void 0},"HttpOperation"),bo=class bo extends R{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:Ma.default.posix.join(e,this.path):e:this.path||"/"}toJSON(e){var r;let t=(0,La.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(bo,"HttpOperationClass");var wo=bo;S.prototype=wo.prototype;S[b]=B;S.GET=function(o){return B([],{...o,method:"GET"})};S.DELETE=function(o){return B([],{...o,method:"DELETE"})};S.HEAD=function(o){return B([],{...o,method:"HEAD"})};S.OPTIONS=function(o){return B([],{...o,method:"OPTIONS"})};S.PATCH=function(o){return B([],{...o,method:"PATCH"})};S.POST=function(o){return B([],{...o,method:"POST"})};S.PUT=function(o){return B([],{...o,method:"PUT"})};S.SEARCH=function(o){return B([],{...o,method:"SEARCH"})};var Fa=require("@jsopen/objects");var Qp=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,Ao=class Ao{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=Qp.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(Ao,"HttpStatusRange");var Dt=Ao;var No=class No extends Oe{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new Dt(r.start,r.end):new Dt(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,Fa.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(No,"HttpOperationResponse");var Or=No;var Ca=require("@jsopen/objects"),Ua=require("ts-gems");var ka=require("@jsopen/objects"),ja=require("ts-gems");var He=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');R.call(this,o);let t=(0,ja.asMutable)(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),So=class So extends R{toJSON(e){let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return(0,ka.omitUndefined)({type:this.type?t||this.type.toJSON(e):"any",description:this.description,isArray:this.isArray,examples:this.examples})}};a(So,"ValueClass");var Do=So;He.prototype=Do.prototype;var St=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');He.call(this,o,e);let t=(0,Ua.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?Nt(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.location=e.location,t.deprecated=e.deprecated,t.required=e.required,t.required==null&&e.location==="path"&&(t.required=!0),t.arraySeparator=e.arraySeparator,t.keyParam=e.keyParam},"HttpParameter"),vo=class vo extends He{toJSON(e){return(0,Ca.omitUndefined)({...super.toJSON(e),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}};a(vo,"HttpParameterClass");var Io=vo;St.prototype=Io.prototype;var Ba=require("@jsopen/objects");var Mo=class Mo extends R{constructor(e){super(e),this.content=[]}toJSON(e){return(0,Ba.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(Mo,"HttpRequestBody");var gr=Mo;var Lo=class Lo{static async createApi(e,t){let r=new Ze(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,$a.isConstructor)(r)&&(r=t instanceof te?r(t.instance):r()),r=await fe(r);let i,n,s;if(typeof r=="function"){if(n=Reflect.getMetadata(ie,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(ie,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 te(t,{...r,instance:i,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await v.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 v.resolveDataType(e,s,c.type)});let x=new St(s,l);s.parameters.push(x)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[p,c]of Object.entries(r.operations))await e.enterAsync(`[${p}]`,async()=>{let l=new S(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 S.apply(t,[t.owner,i]),r.types&&await e.enterAsync(".types",async()=>{await v.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 v.resolveDataType(e,t,s.type)});let c=new St(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 Or(t,{statusCode:s.statusCode});await this._initHttpOperationResponse(e,p,s),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let n=new gr(t);await this._initHttpRequestBody(e,n,r.requestBody),t.requestBody=n}),t}static async _initHttpMediaType(e,t,r){Oe.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{t.type=await v.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 xr(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 v.resolveDataType(e,t,n.type)});let p=new St(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 Oe(t,String(i));await this._initHttpMediaType(e,s,n),t.content.push(s)})})}};a(Lo,"HttpApiFactory");var It=Lo;var Ka=require("@jsopen/objects"),Va=require("super-fast-md5");var Po=class Po extends Xe{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="rpc",this.controllers=new D,this.platform=e.platform}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values())if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;this._controllerReverseMap.set(e,null);return}return this.controllers.get(e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(){let t={...super.toJSON(),transport:this.transport,platform:this.platform,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};a(Po,"RpcApi");var et=Po;var qa,Fo=class Fo extends R{constructor(){super(null),this[qa]=new WeakMap,this.id="",this.info={},this.references=new D,this.types=new ee,this.node[U]=this.types,this.node.findDataType=this._findDataType.bind(this)}getDataTypeNs(e){let t=e instanceof g?this._findDataType(e.name||""):this._findDataType(e);if(t)return this[xe].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 Ze))throw new TypeError("The document do not contains HttpApi instance");return this.api}get rpcApi(){if(!(this.api&&this.api instanceof et))throw new TypeError("The document do not contains RpcApi instance");return this.api}toJSON(){return this.export()}export(e){let t=(0,Ka.omitUndefined)({spec:m.SpecVersion,id:this.id,url:this.url,info:L(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:L(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,Va.md5)(JSON.stringify(e)),this[xe]=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=Mi.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[xe].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[xe].set(i,p!=null&&p[Ne]?"":s),i}}};a(Fo,"ApiDocument");var Ie=Fo;qa=xe;var Zr=require("tslib"),ko=require("valgen");var vt,Rr=(vt=class{constructor(e){e&&Object.assign(this,e)}[T](){return ko.vg.isBase64({coerce:!0})}[O](){return ko.vg.isBase64({coerce:!0})}},a(vt,"Base64Type"),vt);Rr=(0,Zr.__decorate)([u({name:"base64",description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),(0,Zr.__metadata)("design:paramtypes",[Object])],Rr);var ve=require("tslib"),$=require("valgen");var Mt,tt=(Mt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=$.vg.isDate({precision:"date",coerce:!0}),r=[];return e.minValue&&((0,$.isDateString)(e.minValue),r.push($.toString,$.vg.isGte(e.minValue))),e.maxValue&&((0,$.isDateString)(e.maxValue),r.push($.toString,$.vg.isLte(e.maxValue))),r.length>0?$.vg.pipe([t,...r],{returnIndex:0}):t}[O](e){let t=$.vg.isDateString({precision:"date",trim:"date",coerce:!0}),r=[];return e.minValue&&((0,$.isDateString)(e.minValue),r.push($.vg.isGte(e.minValue))),e.maxValue&&((0,$.isDateString)(e.maxValue),r.push($.vg.isLte(e.maxValue))),r.length>0?$.vg.pipe([t,...r],{returnIndex:0}):t}},a(Mt,"DateType"),Mt);(0,ve.__decorate)([u.Attribute({description:"Minimum value"}),(0,ve.__metadata)("design:type",String)],tt.prototype,"minValue",void 0);(0,ve.__decorate)([u.Attribute({description:"Maximum value"}),(0,ve.__metadata)("design:type",String)],tt.prototype,"maxValue",void 0);tt=(0,ve.__decorate)([u({name:"date",description:"A date without time",nameMappings:{js:"Date",json:"string"}}).Example("2021-04-18","Full date value"),(0,ve.__metadata)("design:paramtypes",[Object])],tt);var Me=require("tslib"),wr=require("valgen");var Lt,rt=(Lt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=wr.vg.isDateString({trim:"date",coerce:!0}),r=[];return e.minValue&&r.push(wr.vg.isGte(e.minValue)),e.maxValue&&r.push(wr.vg.isLte(e.maxValue)),r.length>0?wr.vg.pipe([t,...r],{returnIndex:0}):t}[O](e){return this[T](e)}},a(Lt,"DateStringType"),Lt);(0,Me.__decorate)([u.Attribute({description:"Minimum value"}),(0,Me.__metadata)("design:type",String)],rt.prototype,"minValue",void 0);(0,Me.__decorate)([u.Attribute({description:"Maximum value"}),(0,Me.__metadata)("design:type",String)],rt.prototype,"maxValue",void 0);rt=(0,Me.__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,Me.__metadata)("design:paramtypes",[Object])],rt);var Le=require("tslib"),q=require("valgen");var Pt,it=(Pt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=q.vg.isDate({precision:"time",coerce:!0}),r=[];return e.minValue&&((0,q.isDateString)(e.minValue),r.push(q.toString,q.vg.isGte(e.minValue))),e.maxValue&&((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}[O](e){let t=q.vg.isDateString({precision:"time",trim:"time",coerce:!0}),r=[];return e.minValue&&((0,q.isDateString)(e.minValue),r.push(q.vg.isGte(e.minValue))),e.maxValue&&((0,q.isDateString)(e.maxValue),r.push(q.vg.isLte(e.maxValue))),r.length>0?q.vg.pipe([t,...r],{returnIndex:0}):t}},a(Pt,"DateTimeType"),Pt);(0,Le.__decorate)([u.Attribute({description:"Minimum value"}),(0,Le.__metadata)("design:type",String)],it.prototype,"minValue",void 0);(0,Le.__decorate)([u.Attribute({description:"Maximum value"}),(0,Le.__metadata)("design:type",String)],it.prototype,"maxValue",void 0);it=(0,Le.__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,Le.__metadata)("design:paramtypes",[Object])],it);var Pe=require("tslib"),br=require("valgen");var Ft,ot=(Ft=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=br.vg.isDateString({coerce:!0}),r=[];return e.minValue&&r.push(br.vg.isGte(e.minValue)),e.maxValue&&r.push(br.vg.isLte(e.maxValue)),r.length>0?br.vg.pipe([t,...r]):t}[O](e){return this[T](e)}},a(Ft,"DateTimeStringType"),Ft);(0,Pe.__decorate)([u.Attribute({description:"Minimum value"}),(0,Pe.__metadata)("design:type",String)],ot.prototype,"minValue",void 0);(0,Pe.__decorate)([u.Attribute({description:"Maximum value"}),(0,Pe.__metadata)("design:type",String)],ot.prototype,"maxValue",void 0);ot=(0,Pe.__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,Pe.__metadata)("design:paramtypes",[Object])],ot);var P=require("tslib"),jo=require("valgen");var kt,G=(kt=class{constructor(e){e&&Object.assign(this,e)}[T](e){return jo.vg.isEmail({...e,coerce:!0})}[O](e){return jo.vg.isEmail({...e,coerce:!0})}},a(kt,"EmailType"),kt);(0,P.__decorate)([u.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),(0,P.__metadata)("design:type",Boolean)],G.prototype,"allowDisplayName",void 0);(0,P.__decorate)([u.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),(0,P.__metadata)("design:type",Boolean)],G.prototype,"requireDisplayName",void 0);(0,P.__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,P.__metadata)("design:type",Boolean)],G.prototype,"utf8LocalPart",void 0);(0,P.__decorate)([u.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),(0,P.__metadata)("design:type",Boolean)],G.prototype,"ignoreMaxLength",void 0);(0,P.__decorate)([u.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),(0,P.__metadata)("design:type",Boolean)],G.prototype,"allowIpDomain",void 0);(0,P.__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,P.__metadata)("design:type",Boolean)],G.prototype,"domainSpecificValidation",void 0);(0,P.__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,P.__metadata)("design:type",Array)],G.prototype,"hostBlacklist",void 0);(0,P.__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,P.__metadata)("design:type",Array)],G.prototype,"hostWhitelist",void 0);(0,P.__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,P.__metadata)("design:type",String)],G.prototype,"blacklistedChars",void 0);G=(0,P.__decorate)([u({name:"email",description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),(0,P.__metadata)("design:paramtypes",[Object])],G);var Fe=require("tslib"),Ct=require("valgen");var jt,Y=(jt=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,Ct.validator)("decodeFieldPath",p=>i.normalizeFieldPath(p,{allowSigns:n,scope:r}));return Ct.vg.pipe([Ct.toString,s])}[O](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");g.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),allowSigns:e.allowSigns}}},a(jt,"FieldPathType"),jt);(0,Fe.__decorate)([u.Attribute({description:"Data type which field belong to"}),(0,Fe.__metadata)("design:type",Object)],Y.prototype,"dataType",void 0);(0,Fe.__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,Fe.__metadata)("design:type",String)],Y.prototype,"allowSigns",void 0);Y=(0,Fe.__decorate)([u({name:"fieldpath",description:"Field path",nameMappings:{js:"string",json:"string"}}),(0,Fe.__metadata)("design:paramtypes",[Object])],Y);var Ce=require("tslib"),Ds=require("valgen");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 Ha=require("@jsopen/objects"),ep=require("valgen");var Co=class Co 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(Co,"OpraHttpError");var N=Co;var Bo=class Bo extends N{constructor(){super(...arguments),this.status=400}init(e){super.init({message:w("error:BAD_REQUEST","Bad request"),code:"BAD_REQUEST",...e})}};a(Bo,"BadRequestError");var Uo=Bo;var qo=class qo extends N{constructor(){super(...arguments),this.status=409}init(e){super.init({message:w("error:CONFLICT","Conflict"),code:"CONFLICT",...e})}};a(qo,"ConflictError");var $o=qo;var Vo=class Vo extends N{constructor(){super(...arguments),this.status=424}init(e){super.init({message:w("error:FAILED_DEPENDENCY","The request failed due to failure of a previous request"),code:"FAILED_DEPENDENCY",...e})}};a(Vo,"FailedDependencyError");var Ko=Vo;var zo=class zo extends N{constructor(){super(...arguments),this.status=A.FORBIDDEN}init(e){super.init({message:w("error:FORBIDDEN","You are not authorized to perform this action"),code:"FORBIDDEN",...e})}};a(zo,"ForbiddenError");var Ar=zo;var Wo=class Wo extends N{constructor(){super(...arguments),this.status=500}init(e){super.init({message:w("error:INTERNAL_SERVER_ERROR","Internal server error"),code:"INTERNAL_SERVER_ERROR",severity:"fatal",...e})}};a(Wo,"InternalServerError");var Jo=Wo;var Yo=class Yo extends N{constructor(){super(...arguments),this.status=405}init(e){super.init({message:w("error:METHOD_NOT_ALLOWED","Method not allowed"),code:"METHOD_NOT_ALLOWED",...e})}};a(Yo,"MethodNotAllowedError");var Go=Yo;var Xo=class Xo extends N{constructor(){super(...arguments),this.status=406}init(e){super.init({message:w("error:NOT_ACCEPTABLE","Not Acceptable"),code:"NOT_ACCEPTABLE",...e})}};a(Xo,"NotAcceptableError");var Qo=Xo;var Ho=class Ho extends N{constructor(){super(...arguments),this.status=404}init(e){super.init({message:w("error:NOT_FOUND","Not found"),code:"NOT_FOUND",...e})}};a(Ho,"NotFoundError");var Zo=Ho;var tn=class tn extends Ar{init(e){super.init({message:w("error:PERMISSION_ERROR","You dont have permission for this operation"),code:"PERMISSION_ERROR",...e})}};a(tn,"PermissionError");var en=tn;var on=class on extends N{constructor(e,t,r){super({message:w("error:RESOURCE_CONFLICT",{resource:e,fields:t},"There is already an other {{resource}} resource with same values ({{fields}})"),severity:"error",code:"RESOURCE_CONFLICT",details:{resource:e,location:t}},r),this.status=409}};a(on,"ResourceConflictError");var rn=on;var sn=class sn extends N{constructor(e,t,r){super({message:w("error:RESOURCE_NOT_AVAILABLE",`Resource "${e}${t?"/"+t:""}" is not available`),severity:"error",code:"RESOURCE_NOT_AVAILABLE",details:{resource:e,key:t}},r,A.UNPROCESSABLE_ENTITY)}};a(sn,"ResourceNotAvailableError");var nn=sn;var pn=class pn extends N{constructor(){super(...arguments),this.status=401}init(e){super.init({message:w("error:UNAUTHORIZED","You have not been authenticated to perform this action"),code:"UNAUTHORIZED",...e})}};a(pn,"UnauthorizedError");var an=pn;var ln=class ln extends N{constructor(){super(...arguments),this.status=422}init(e){super.init({message:w("error:UNPROCESSABLE_ENTITY","Unprocessable entity"),severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};a(ln,"UnprocessableEntityError");var cn=ln;var fn;(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"}})(fn||(fn={}));var un=class un{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};a(un,"Ast");var Nr=un;var mn=class mn extends Nr{};a(mn,"Expression");var K=mn;var dn=class dn extends K{};a(dn,"Term");var nt=dn;var hn=class hn extends nt{constructor(e){super(),this.value=e}toString(){return""+this.value}};a(hn,"Literal");var M=hn;var yn=class yn extends K{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new Hr({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};a(yn,"ArithmeticExpression");var st=yn,Tn=class Tn{constructor(e){Object.assign(this,e)}};a(Tn,"ArithmeticExpressionItem");var Hr=Tn;var En=class En extends nt{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};a(En,"ArrayExpression");var ge=En;var Zp=/\w/,_n=class _n extends K{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${Zp.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};a(_n,"ComparisonExpression");var Te=_n;var xn=class xn extends K{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(xn,"LogicalExpression");var Ee=xn;var On=class On extends K{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(On,"NegativeExpression");var Dr=On;var gn=class gn extends K{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(gn,"ParenthesizedExpression");var Re=gn;var Rn=class Rn extends M{constructor(e){super(e)}};a(Rn,"BooleanLiteral");var at=Rn;var Ja=require("putil-varhelpers");var wn=class wn extends TypeError{};a(wn,"SyntaxError");var ei=wn,bn=class bn extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};a(bn,"FilterValidationError");var _e=bn,An=class An extends Error{constructor(e,t){super(e),Object.assign(this,t)}};a(An,"FilterParseError");var ti=An;var Hp=/'/g,ec=/(\\)/g,tc=/\\(.)/g;function rc(o){return o.replace(ec,"\\\\")}a(rc,"escapeString");function ic(o){return o.replace(tc,"$1")}a(ic,"unescapeString");function ke(o){return"'"+rc(o).replace(Hp,"\\'")+"'"}a(ke,"quoteFilterString");function Sr(o){return o&&(o.startsWith("'")||o.startsWith('"'))&&o.endsWith(o.charAt(0))?ic(o.substring(1,o.length-1)):o}a(Sr,"unquoteFilterString");var za=new Date(0),Nn=class Nn extends M{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,Ja.toDateDef)(e,za)!==za){this.value=e;return}throw new _e(`Invalid date value "${e}"`)}toString(){return ke(this.value)}};a(Nn,"DateLiteral");var je=Nn;var Ga=require("putil-varhelpers");var Wa=new Date(0),Dn=class Dn extends M{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,Ga.toDateDef)(e,Wa)!==Wa){this.value=e;return}throw new _e(`Invalid date-time value "${e}"`)}toString(){return ke(this.value)}};a(Dn,"DateTimeLiteral");var Ir=Dn;var Sn=class Sn extends M{constructor(){super(null),this.value=null}};a(Sn,"NullLiteral");var pt=Sn;var In=class In extends M{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 _e(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};a(In,"NumberLiteral");var we=In;var vn=class vn extends M{constructor(e){super(""+e)}};a(vn,"QualifiedIdentifier");var se=vn;var Mn=class Mn extends M{constructor(e){super(""+e)}toString(){return ke(this.value)}};a(Mn,"StringLiteral");var ct=Mn;var oc=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,Ln=class Ln extends M{constructor(e){if(super(""),e instanceof Date){this.value=ri(e.getHours())+":"+ri(e.getMinutes())+(e.getSeconds()?":"+ri(e.getSeconds()):"")+(e.getMilliseconds()?"."+ri(e.getMilliseconds()):"");return}if(typeof e=="string"&&oc.test(e)){this.value=e;return}throw new _e(`Invalid time value "${e}"`)}toString(){return ke(this.value)}};a(Ln,"TimeLiteral");var lt=Ln;function ri(o){return o<=9?"0"+o:""+o}a(ri,"pad");var di=require("@browsery/antlr4");var ae=require("@browsery/antlr4");var z=class z extends ae.Lexer{constructor(e){super(e),this._interp=new ae.LexerATNSimulator(this,z._ATN,z.DecisionsToDFA,new ae.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return z.literalNames}get symbolicNames(){return z.symbolicNames}get ruleNames(){return z.ruleNames}get serializedATN(){return z._serializedATN}get channelNames(){return z.channelNames}get modeNames(){return z.modeNames}static get _ATN(){return z.__ATN||(z.__ATN=new ae.ATNDeserializer().deserialize(z._serializedATN)),z.__ATN}};a(z,"OpraFilterLexer");var y=z;y.T__0=1;y.T__1=2;y.T__2=3;y.T__3=4;y.T__4=5;y.T__5=6;y.T__6=7;y.T__7=8;y.T__8=9;y.T__9=10;y.T__10=11;y.T__11=12;y.T__12=13;y.T__13=14;y.T__14=15;y.T__15=16;y.T__16=17;y.T__17=18;y.T__18=19;y.T__19=20;y.T__20=21;y.T__21=22;y.T__22=23;y.T__23=24;y.T__24=25;y.T__25=26;y.T__26=27;y.T__27=28;y.T__28=29;y.T__29=30;y.T__30=31;y.T__31=32;y.T__32=33;y.T__33=34;y.IDENTIFIER=35;y.POLAR_OP=36;y.DATE=37;y.DATETIME=38;y.TIME=39;y.NUMBER=40;y.INTEGER=41;y.STRING=42;y.WHITESPACE=43;y.EOF=ae.Token.EOF;y.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];y.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];y.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];y.modeNames=["DEFAULT_MODE"];y.ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","T__14","T__15","T__16","T__17","T__18","T__19","T__20","T__21","T__22","T__23","T__24","T__25","T__26","T__27","T__28","T__29","T__30","T__31","T__32","T__33","IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE","DIGIT","DATEFORMAT","TIMEFORMAT","TIMEZONEOFFSETFORMAT","ESC","UNICODE","HEX"];y._serializedATN=[4,0,43,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 ae.DFA(o,e));var Ya=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 Pn(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 re(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 jn(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 Fn(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 kn(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 vr(this,new re(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 ii(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 oi(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 ni(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 Q(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 zn(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(_.NUMBER);break;case 13:case 14:e=new Kn(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new Vn(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new Un(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 38:e=new Bn(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(_.DATETIME);break;case 37:e=new qn(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(_.DATE);break;case 39:e=new Cn(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(_.TIME);break;case 42:e=new $n(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 Mr(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 si(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 Ut(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 ai(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 pi(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 ci(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 li(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 Jn(this,this._ctx,this.state);this.enterRule(e,26,_.RULE_arithmeticOperator);let t;try{this.enterOuterAlt(e,1),this.state=111,t=this._input.LA(1),!(t&-32)&&1<<t&491520?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}comparisonOperator(){let e=new fi(this,this._ctx,this.state);this.enterRule(e,28,_.RULE_comparisonOperator);let t;try{this.enterOuterAlt(e,1),this.state=113,t=this._input.LA(1),!(t&-32)&&1<<t&2146959360?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}logicalOperator(){let e=new ui(this,this._ctx,this.state);this.enterRule(e,30,_.RULE_logicalOperator);let t;try{this.enterOuterAlt(e,1),this.state=115,t=this._input.LA(1),!(t-31&-32)&&1<<t-31&15?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof h.RecognitionException)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}polarityOperator(){let e=new Wn(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 Qa=f,Gn=class Gn extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(re,0)}EOF(){return this.getToken(f.EOF,0)}get ruleIndex(){return f.RULE_root}enterRule(e){e.enterRoot&&e.enterRoot(this)}exitRule(e){e.exitRoot&&e.exitRoot(this)}accept(e){return e.visitRoot?e.visitRoot(this):e.visitChildren(this)}};a(Gn,"RootContext");var Pn=Gn,Yn=class Yn 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(Yn,"ExpressionContext");var re=Yn,Qn=class Qn extends re{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(ni,0)}enterRule(e){e.enterParenthesizedExpression&&e.enterParenthesizedExpression(this)}exitRule(e){e.exitParenthesizedExpression&&e.exitParenthesizedExpression(this)}accept(e){return e.visitParenthesizedExpression?e.visitParenthesizedExpression(this):e.visitChildren(this)}};a(Qn,"ParenthesizedExpressionContext");var Fn=Qn,Xn=class Xn extends re{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(re,0)}enterRule(e){e.enterNegativeExpression&&e.enterNegativeExpression(this)}exitRule(e){e.exitNegativeExpression&&e.exitNegativeExpression(this)}accept(e){return e.visitNegativeExpression?e.visitNegativeExpression(this):e.visitChildren(this)}};a(Xn,"NegativeExpressionContext");var kn=Xn,Zn=class Zn extends re{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(ii,0)}comparisonOperator(){return this.getTypedRuleContext(fi,0)}comparisonRight(){return this.getTypedRuleContext(oi,0)}enterRule(e){e.enterComparisonExpression&&e.enterComparisonExpression(this)}exitRule(e){e.exitComparisonExpression&&e.exitComparisonExpression(this)}accept(e){return e.visitComparisonExpression?e.visitComparisonExpression(this):e.visitChildren(this)}};a(Zn,"ComparisonExpressionContext");var jn=Zn,Hn=class Hn extends re{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(re)}expression(e){return this.getTypedRuleContext(re,e)}logicalOperator(){return this.getTypedRuleContext(ui,0)}enterRule(e){e.enterLogicalExpression&&e.enterLogicalExpression(this)}exitRule(e){e.exitLogicalExpression&&e.exitLogicalExpression(this)}accept(e){return e.visitLogicalExpression?e.visitLogicalExpression(this):e.visitChildren(this)}};a(Hn,"LogicalExpressionContext");var vr=Hn,es=class es extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(Mr,0)}get ruleIndex(){return f.RULE_comparisonLeft}enterRule(e){e.enterComparisonLeft&&e.enterComparisonLeft(this)}exitRule(e){e.exitComparisonLeft&&e.exitComparisonLeft(this)}accept(e){return e.visitComparisonLeft?e.visitComparisonLeft(this):e.visitChildren(this)}};a(es,"ComparisonLeftContext");var ii=es,ts=class ts extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(Q,0)}qualifiedIdentifier(){return this.getTypedRuleContext(Mr,0)}externalConstant(){return this.getTypedRuleContext(si,0)}arrayValue(){return this.getTypedRuleContext(ai,0)}get ruleIndex(){return f.RULE_comparisonRight}enterRule(e){e.enterComparisonRight&&e.enterComparisonRight(this)}exitRule(e){e.exitComparisonRight&&e.exitComparisonRight(this)}accept(e){return e.visitComparisonRight?e.visitComparisonRight(this):e.visitChildren(this)}};a(ts,"ComparisonRightContext");var oi=ts,rs=class rs extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(re,0)}get ruleIndex(){return f.RULE_parenthesizedItem}enterRule(e){e.enterParenthesizedItem&&e.enterParenthesizedItem(this)}exitRule(e){e.exitParenthesizedItem&&e.exitParenthesizedItem(this)}accept(e){return e.visitParenthesizedItem?e.visitParenthesizedItem(this):e.visitChildren(this)}};a(rs,"ParenthesizedItemContext");var ni=rs,is=class is 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(is,"ValueContext");var Q=is,os=class os extends Q{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(os,"TimeLiteralContext");var Cn=os,ns=class ns extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(ci,0)}enterRule(e){e.enterNullLiteral&&e.enterNullLiteral(this)}exitRule(e){e.exitNullLiteral&&e.exitNullLiteral(this)}accept(e){return e.visitNullLiteral?e.visitNullLiteral(this):e.visitChildren(this)}};a(ns,"NullLiteralContext");var Un=ns,ss=class ss extends Q{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(ss,"DateTimeLiteralContext");var Bn=ss,as=class as extends Q{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(as,"StringLiteralContext");var $n=as,ps=class ps extends Q{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(ps,"DateLiteralContext");var qn=ps,cs=class cs extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(li,0)}enterRule(e){e.enterInfinityLiteral&&e.enterInfinityLiteral(this)}exitRule(e){e.exitInfinityLiteral&&e.exitInfinityLiteral(this)}accept(e){return e.visitInfinityLiteral?e.visitInfinityLiteral(this):e.visitChildren(this)}};a(cs,"InfinityLiteralContext");var Kn=cs,ls=class ls extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(pi,0)}enterRule(e){e.enterBooleanLiteral&&e.enterBooleanLiteral(this)}exitRule(e){e.exitBooleanLiteral&&e.exitBooleanLiteral(this)}accept(e){return e.visitBooleanLiteral?e.visitBooleanLiteral(this):e.visitChildren(this)}};a(ls,"BooleanLiteralContext");var Vn=ls,fs=class fs extends Q{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(fs,"NumberLiteralContext");var zn=fs,us=class us extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(Ut)}identifier(e){return this.getTypedRuleContext(Ut,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(us,"QualifiedIdentifierContext");var Mr=us,ms=class ms extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(Ut,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(ms,"ExternalConstantContext");var si=ms,ds=class ds 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(ds,"IdentifierContext");var Ut=ds,hs=class hs extends h.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(Q)}value(e){return this.getTypedRuleContext(Q,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(hs,"ArrayValueContext");var ai=hs,ys=class ys 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(ys,"BooleanContext");var pi=ys,Ts=class Ts 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(Ts,"NullContext");var ci=Ts,Es=class Es 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(Es,"InfinityContext");var li=Es,_s=class _s 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(_s,"ArithmeticOperatorContext");var Jn=_s,xs=class xs 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(xs,"ComparisonOperatorContext");var fi=xs,Os=class Os 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(Os,"LogicalOperatorContext");var ui=Os,gs=class gs 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(gs,"PolarityOperatorContext");var Wn=gs;var Xa=require("@browsery/antlr4");var Rs=class Rs extends M{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};a(Rs,"ExternalConstant");var mi=Rs;var ws=class ws extends Xa.ParseTreeVisitor{constructor(e){super(),this._timeZone=e==null?void 0:e.timeZone}visitChildren(e){let t=super.visitChildren(e);return Array.isArray(t)&&t.length<2?t[0]:t??e.getText()}defaultResult(){}visitRoot(e){return this.visit(e.expression())}visitParenthesizedExpression(e){let t=this.visit(e.parenthesizedItem());return new Re(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new Dr(t)}visitComparisonExpression(e){return new Te({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 vr&&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 Ee({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new se(e.getText())}visitExternalConstant(e){return new mi(e.identifier().getText())}visitNullLiteral(){return new pt}visitBooleanLiteral(e){return new at(e.getText()==="true")}visitNumberLiteral(e){return new we(e.getText())}visitStringLiteral(e){return new ct(Sr(e.getText()))}visitInfinityLiteral(){return new we(1/0)}visitDateLiteral(e){return new je(Sr(e.getText()))}visitDateTimeLiteral(e){return new Ir(Sr(e.getText()))}visitTimeLiteral(e){return new lt(Sr(e.getText()))}visitArrayValue(e){return new ge(e.value_list().map(t=>this.visit(t)))}};a(ws,"FilterTreeVisitor");var Lr=ws;var Za=require("@browsery/antlr4");var bs=class bs extends Za.ErrorListener{constructor(e){super(),this.errors=e}syntaxError(e,t,r,i,n,s){this.errors.push(new ti(n,{recognizer:e,offendingSymbol:t,line:r,column:i,e:s}))}};a(bs,"OpraErrorListener");var Pr=bs;function As(o,e){let t=new di.CharStream(o),r=new Ya(t),i=new di.CommonTokenStream(r),n=new Qa(i);n.buildParseTrees=!0;let s=[],p=new Pr(s);r.removeErrorListeners(),r.addErrorListener(p),n.removeErrorListeners(),n.addErrorListener(p);let c=n.root();if(s.length){let l=[];for(let d of s)l.push(d.message+(o.includes(`
8
- `)?" at line: "+d.line+" column: "+d.column:" at column: "+d.column));let x=new ei(l.join(`
9
- `));throw x.errors=s,x}return e=e||new Lr,e.visit(c)}a(As,"parse");var Ns=class Ns{constructor(e,t){if(this._rules=new D,this._decoderCache=new WeakMap,Object.defineProperty(this,"_rules",{value:new D(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,Ha.omitUndefined)({...t,operators:r}))}normalizeFilter(e,t,r){let i=typeof e=="string"?As(e):e;return this.normalizeFilterAst(i,[],t,r)}normalizeFilterAst(e,t,r,i){if(e instanceof Te){if(t.push(e),this.normalizeFilterAst(e.left,t,r),!(e.left instanceof se&&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:w("error:UNACCEPTED_FILTER_FIELD",{field:e.left.value}),code:"UNACCEPTED_FILTER_FIELD",details:{field:e.left.value}});if(n.operators&&!n.operators.includes(e.op))throw new ye({message:w("error:UNACCEPTED_FILTER_OPERATION",{field:e.left.value}),code:"UNACCEPTED_FILTER_OPERATION",details:{field:e.left.value,operator:e.op}});return this.normalizeFilterAst(e.right,t,r),t.pop(),e}if(e instanceof Ee)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof st)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 Re)return t.push(e),this.normalizeFilterAst(e.expression,t,r),t.pop(),e;if(e instanceof se&&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 M){let n=t.findLastIndex(s=>s instanceof Te);if(n>=0){let s=t[n];if((e===s.right||t[n+1]===s.right)&&s&&s.left instanceof se&&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=ep.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(Ns,"FilterRules");var be=Ns;var $t={};Di($t,{$and:()=>sc,$arithmetic:()=>wc,$array:()=>tp,$date:()=>ac,$eq:()=>fc,$field:()=>lc,$gt:()=>mc,$gte:()=>dc,$ilike:()=>Oc,$in:()=>Tc,$like:()=>_c,$lt:()=>hc,$lte:()=>yc,$ne:()=>uc,$notILike:()=>gc,$notIn:()=>Ec,$notLike:()=>xc,$number:()=>cc,$or:()=>nc,$paren:()=>Rc,$time:()=>pc,ArithmeticExpression:()=>st,ArithmeticExpressionItem:()=>Hr,ArrayExpression:()=>ge,Ast:()=>Nr,BooleanLiteral:()=>at,ComparisonExpression:()=>Te,DateLiteral:()=>je,DateTimeLiteral:()=>Ir,Expression:()=>K,FilterTreeVisitor:()=>Lr,Literal:()=>M,LogicalExpression:()=>Ee,NegativeExpression:()=>Dr,NullLiteral:()=>pt,NumberLiteral:()=>we,OpraErrorListener:()=>Pr,ParenthesizedExpression:()=>Re,QualifiedIdentifier:()=>se,StringLiteral:()=>ct,Term:()=>nt,TimeLiteral:()=>lt,parse:()=>As});function nc(...o){return new Ee({op:"or",items:o})}a(nc,"$or");function sc(...o){return new Ee({op:"and",items:o})}a(sc,"$and");function ac(o){return new je(o)}a(ac,"$date");function pc(o){return new lt(o)}a(pc,"$time");function cc(o){return new we(o)}a(cc,"$number");function tp(...o){return new ge(o.map(hi))}a(tp,"$array");function lc(o){return new se(o)}a(lc,"$field");function fc(o,e){return pe("=",o,e)}a(fc,"$eq");function uc(o,e){return pe("!=",o,e)}a(uc,"$ne");function mc(o,e){return pe(">",o,e)}a(mc,"$gt");function dc(o,e){return pe(">=",o,e)}a(dc,"$gte");function hc(o,e){return pe("<",o,e)}a(hc,"$lt");function yc(o,e){return pe("<=",o,e)}a(yc,"$lte");function Tc(o,e){return pe("in",o,e)}a(Tc,"$in");function Ec(o,e){return pe("!in",o,e)}a(Ec,"$notIn");function _c(o,e){return pe("like",o,e)}a(_c,"$like");function xc(o,e){return pe("!like",o,e)}a(xc,"$notLike");function Oc(o,e){return pe("ilike",o,e)}a(Oc,"$ilike");function gc(o,e){return pe("!ilike",o,e)}a(gc,"$notILike");function Rc(o){return new Re(o)}a(Rc,"$paren");function wc(o){let e=new st;return e.add=t=>(e.append("+",Bt(t)),e),e.sub=t=>(e.append("-",Bt(t)),e),e.mul=t=>(e.append("*",Bt(t)),e),e.div=t=>(e.append("/",Bt(t)),e),e.append("+",hi(o)),e}a(wc,"$arithmetic");function pe(o,e,t){let r=typeof e=="string"?new se(e):hi(e),i=hi(t);return new Te({op:o,left:r,right:i})}a(pe,"comparisonExpression");var hi=a(o=>Array.isArray(o)?tp(...o.map(Bt)):Bt(o),"wrapEntryValue"),Bt=a(o=>o instanceof K?o:typeof o=="boolean"?new at(o):typeof o=="number"||typeof o=="bigint"?new we(o):o==null?new pt:o instanceof Date?new je(o):new ct(""+o),"_wrapEntryValue");var qt,ce=(qt=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 be(e.rules):void 0;return bc(r,i)}[O](){return Ac}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");g.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),rules:e.rules}}},a(qt,"FilterType"),qt);(0,Ce.__decorate)([u.Attribute({description:"Data type which filtering fields belong to"}),(0,Ce.__metadata)("design:type",Object)],ce.prototype,"dataType",void 0);(0,Ce.__decorate)([u.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),(0,Ce.__metadata)("design:type",Object)],ce.prototype,"rules",void 0);ce=(0,Ce.__decorate)([u({name:"filter",description:"A query filter",nameMappings:{js:"object",json:"string"}}),(0,Ce.__metadata)("design:paramtypes",[Object])],ce);var bc=a((o,e,t)=>(0,Ds.validator)("decodeFilter",(r,i,n)=>{if(typeof r=="string")try{let s=$t.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"),Ac=(0,Ds.validator)("encodeFilter",(o,e,t)=>{if(o instanceof $t.Ast)return o.toString();e.fail(t,"Not a valid filter expression",o)});var yi=require("tslib"),Ss=require("valgen");var Kt,Fr=(Kt=class{constructor(e){e&&Object.assign(this,e)}[T](){return Ss.vg.isObjectId({coerce:!0})}[O](){return Ss.vg.isObjectId({coerce:!0})}},a(Kt,"ObjectIdType"),Kt);Fr=(0,yi.__decorate)([u({name:"ObjectId",description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),(0,yi.__metadata)("design:paramtypes",[Object])],Fr);var F=require("tslib");var Vt,X=(Vt=class{constructor(e){e&&Object.assign(this,e)}},a(Vt,"OperationResult"),Vt);(0,F.__decorate)([k(),(0,F.__metadata)("design:type",Number)],X.prototype,"affected",void 0);(0,F.__decorate)([k(),(0,F.__metadata)("design:type",Number)],X.prototype,"totalMatches",void 0);(0,F.__decorate)([k(),(0,F.__metadata)("design:type",String)],X.prototype,"context",void 0);(0,F.__decorate)([k(),(0,F.__metadata)("design:type",String)],X.prototype,"type",void 0);(0,F.__decorate)([k(),(0,F.__metadata)("design:type",String)],X.prototype,"message",void 0);(0,F.__decorate)([k({type:"any"}),(0,F.__metadata)("design:type",Object)],X.prototype,"payload",void 0);(0,F.__decorate)([k({type:"object"}),(0,F.__metadata)("design:type",Array)],X.prototype,"errors",void 0);X=(0,F.__decorate)([H({name:"OperationResult",description:"Operation result"}),(0,F.__metadata)("design:paramtypes",[Object])],X);(function(o){function e(t){var i;let r=(i=class extends o{constructor(...s){super(...s)}},a(i,"OperationResult_"),i);return(0,F.__decorate)([k({type:t,required:!0}),(0,F.__metadata)("design:type",Object)],r.prototype,"payload",void 0),r=(0,F.__decorate)([H({embedded:!0}),(0,F.__metadata)("design:paramtypes",[Object])],r),r}a(e,"forPayload"),o.forPayload=e})(X||(X={}));var Ue=require("tslib"),kr=require("valgen");var Nc=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,zt,ft=(zt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=kr.vg.matches(Nc,{formatName:"time",coerce:!0}),r=[];return e.minValue&&r.push(kr.vg.isGte(e.minValue)),e.maxValue&&r.push(kr.vg.isLte(e.maxValue)),r.length>0?kr.vg.pipe([t,...r],{returnIndex:0}):t}[O](e){return this[T](e)}},a(zt,"TimeType"),zt);(0,Ue.__decorate)([u.Attribute({description:"Minimum value"}),(0,Ue.__metadata)("design:type",String)],ft.prototype,"minValue",void 0);(0,Ue.__decorate)([u.Attribute({description:"Maximum value"}),(0,Ue.__metadata)("design:type",String)],ft.prototype,"maxValue",void 0);ft=(0,Ue.__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,Ue.__metadata)("design:paramtypes",[Object])],ft);var Ti=require("tslib"),Is=require("valgen");var Jt,jr=(Jt=class{constructor(e){e&&Object.assign(this,e)}[T](){return Is.vg.isURL({coerce:!0})}[O](){return Is.vg.isURL({coerce:!0})}},a(Jt,"UrlType"),Jt);jr=(0,Ti.__decorate)([u({name:"url",description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),(0,Ti.__metadata)("design:paramtypes",[Object])],jr);var Yt=require("tslib"),vs=require("valgen");var Wt,Gt=(Wt=class{constructor(e){e&&Object.assign(this,e)}[T](e){return vs.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}[O](e){return vs.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}},a(Wt,"UuidType"),Wt);(0,Yt.__decorate)([u.Attribute({description:"Version of the UUID"}),(0,Yt.__metadata)("design:type",Number)],Gt.prototype,"version",void 0);Gt=(0,Yt.__decorate)([u({name:"uuid",description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),(0,Yt.__metadata)("design:paramtypes",[Object])],Gt);function Be(o,e,t){let r=Yr(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"&&ur(this,o,r)}}}[n];if(typeof o=="function"&&fr(s.prototype,o.prototype),typeof o=="function"){let c=Reflect.getOwnMetadata(E,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(E,p,s),typeof o=="function"&&Se._applyMixin(s,o,{...e,isInheritedPredicate:r}),s}a(Be,"createMappedClass");function Dc(o,e,t){return Be(o,{omit:e},t)}a(Dc,"OmitType");function Sc(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return Be(o,{partial:t},r)}a(Sc,"PartialType");function Ic(o,e,t){return Be(o,{pick:e},t)}a(Ic,"PickType");var Ei=require("tslib"),Ms=require("valgen");var Qt,Cr=(Qt=class{constructor(e){e&&Object.assign(this,e)}[T](){return Ms.isAny}[O](){return Ms.isAny}},a(Qt,"AnyType"),Qt);Cr=(0,Ei.__decorate)([u({name:"any",description:"Represents any value"}),(0,Ei.__metadata)("design:paramtypes",[Object])],Cr);var _i=require("tslib"),mt=require("valgen");var $e=require("tslib"),ut=require("valgen");var Xt,de=(Xt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=[];return e.minValue&&t.push(ut.vg.isGte(e.minValue)),e.maxValue&&t.push(ut.vg.isLte(e.maxValue)),t.length>0?ut.vg.pipe([ut.toNumber,...t],{returnIndex:0}):ut.toNumber}[O](e){return this[T](e)}},a(Xt,"NumberType"),Xt);(0,$e.__decorate)([u.Attribute({description:"Determines the minimum value"}),(0,$e.__metadata)("design:type",Number)],de.prototype,"minValue",void 0);(0,$e.__decorate)([u.Attribute({description:"Determines the maximum value"}),(0,$e.__metadata)("design:type",Number)],de.prototype,"maxValue",void 0);de=(0,$e.__decorate)([u({name:"number",description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),(0,$e.__metadata)("design:paramtypes",[Object])],de);var Zt,Ur=(Zt=class extends de{constructor(e){super(e)}[T](e){let t=[];return e.minValue&&t.push(mt.vg.isGte(e.minValue)),e.maxValue&&t.push(mt.vg.isLte(e.maxValue)),t.length>0?mt.vg.pipe([mt.toBigint,...t],{returnIndex:0}):mt.toBigint}[O](e){return this[T](e)}},a(Zt,"BigintType"),Zt);Ur=(0,_i.__decorate)([u({name:"bigint",description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),(0,_i.__metadata)("design:paramtypes",[Object])],Ur);var xi=require("tslib"),Ls=require("valgen");var Ht,Br=(Ht=class{constructor(e){e&&Object.assign(this,e)}[T](){return Ls.toBoolean}[O](){return Ls.toBoolean}},a(Ht,"BooleanType"),Ht);Br=(0,xi.__decorate)([u({name:"boolean",description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),(0,xi.__metadata)("design:paramtypes",[Object])],Br);var Oi=require("tslib"),dt=require("valgen");var er,qe=(er=class extends de{constructor(e){super(e)}[T](e){let t=[];return e.minValue&&t.push(dt.vg.isGte(e.minValue)),e.maxValue&&t.push(dt.vg.isLte(e.maxValue)),t.length>0?dt.vg.pipe([dt.toInteger,...t],{returnIndex:0}):dt.toInteger}[O](e){return this[T](e)}},a(er,"IntegerType"),er);qe=(0,Oi.__decorate)([u({name:"integer",description:"An integer number",nameMappings:{js:"number",json:"number"}}),(0,Oi.__metadata)("design:paramtypes",[Object])],qe);var gi=require("tslib"),Ps=require("valgen");var tr,$r=(tr=class{constructor(e){e&&Object.assign(this,e)}[T](){return Ps.isNull}[O](){return Ps.isNull}},a(tr,"NullType"),tr);$r=(0,gi.__decorate)([u({name:"null",description:"A Null value",nameMappings:{js:"null",json:"null"}}),(0,gi.__metadata)("design:paramtypes",[Object])],$r);var Ri=require("tslib");var rr,qr=(rr=class{constructor(e){e&&Object.assign(this,e)}},a(rr,"ObjectType"),rr);qr=(0,Ri.__decorate)([H({name:"object",description:"A non modelled object",additionalFields:!0}),(0,Ri.__metadata)("design:paramtypes",[Object])],qr);var le=require("tslib"),Ke=require("valgen");var ir,Ae=(ir=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(E,Object.getPrototypeOf(this).constructor).name),t.push(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}[O](e){return this[T](e)}},a(ir,"StringType"),ir);(0,le.__decorate)([u.Attribute({description:"Regex pattern to be used for validation"}),(0,le.__metadata)("design:type",Object)],Ae.prototype,"pattern",void 0);(0,le.__decorate)([u.Attribute({description:"Name of the pattern"}),(0,le.__metadata)("design:type",String)],Ae.prototype,"patternName",void 0);(0,le.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,le.__metadata)("design:type",Number)],Ae.prototype,"minLength",void 0);(0,le.__decorate)([u.Attribute({description:"Minimum number of characters"}),(0,le.__metadata)("design:type",Number)],Ae.prototype,"maxLength",void 0);Ae=(0,le.__decorate)([u({name:"string",description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),(0,le.__metadata)("design:paramtypes",[Object])],Ae);function vc(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return Be(o,{required:t},r)}a(vc,"RequiredType");S.Entity={};S.Entity.Create=function(o,e){var n;let t;typeof o=="object"&&!o[E]?t=o:t={...e,type:o};let r=[],i=B(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new Y({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(A.CREATED,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the created resource.',contentType:I.opra_response_json,type:t.type,partial:"deep"}).Response(A.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:I.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=Ve(t.type)}),i};S.Entity.Delete=function(o,e){let t;typeof o=="object"&&!o[E]?t=o:t={...e,type:o};let r=[],i=B(r,{method:"DELETE",...t,composition:"Entity.Delete"});return i.Response(A.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:I.opra_response_json}).Response(A.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:I.opra_response_json}),i.KeyParam=(n,s)=>{let p=typeof s=="string"||typeof s=="function"?{name:n,location:"path",type:s,keyParam:!0}:{...s,name:n,location:"path",keyParam:!0};return i.PathParam(n,p),r.push(c=>{var l;(l=c.path)!=null&&l.includes(":"+n)||(c.path=(c.path||"")+"@:"+n),c.mergePath=!0}),i},r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=Ve(t.type)}),i};S.Entity.DeleteMany=function(o,e){let t;typeof o=="object"&&!o[E]?t=o:t={...e,type:o};let r=[],i=new be,n=new ce({dataType:t.type});n.rules={};let s=B(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return s.Response(A.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:I.opra_response_json}).Response(A.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:I.opra_response_json}).QueryParam("filter",{type:n,description:"Determines filter fields"}),r.push(p=>{let c=p.compositionOptions=p.compositionOptions||{};c.type=Ve(t.type)}),s.Filter=(p,c,l)=>(r.push(()=>{i.set(p,{operators:c,description:l}),n.rules=i.toJSON()}),s),s};S.Entity.FindMany=function(o,e){let t;typeof o=="object"&&!o[E]?t=o:t={...e,type:o};let r=[],i=new be,n=new ce({dataType:t.type});n.rules={};let s=B(r,{method:"GET",...t,composition:"Entity.FindMany"});return s.Response(A.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains list of resources.',contentType:I.opra_response_json,type:t.type,partial:"deep",isArray:!0}).Response(A.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:I.opra_response_json}).QueryParam("limit",{description:"Determines number of returning instances",type:new qe({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new qe({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new Y({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).QueryParam("filter",{type:n,description:"Determines filter fields"}).QueryParam("sort",{description:"Determines sort fields",type:new Y({dataType:t.type,allowSigns:"first"}),isArray:!0,arraySeparator:","}),r.push(p=>{let c=p.compositionOptions=p.compositionOptions||{};c.type=Ve(t.type),t.defaultLimit&&(c.defaultLimit=t.defaultLimit),t.defaultProjection&&(c.defaultProjection=t.defaultProjection),t.maxLimit&&(c.maxLimit=t.maxLimit)}),s.DefaultSort=(...p)=>(r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.defaultSort=p}),s),s.SortFields=(...p)=>(r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.sortFields=p}),s),s.Filter=(p,c,l)=>(r.push(()=>{i.set(p,{operators:c,description:l}),n.rules=i.toJSON()}),s),s};S.Entity.Get=function(o,e){let t;typeof o=="object"&&!o[E]?t=o:t={...e,type:o};let r=[],i=B(r,{method:"GET",...t,composition:"Entity.Get"});return i.QueryParam("projection",{description:"Determines fields projection",type:new Y({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(A.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:I.opra_response_json,type:t.type,partial:"deep"}).Response(A.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(A.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:I.opra_response_json}),i.KeyParam=(n,s)=>{let p=typeof s=="string"||typeof s=="function"?{name:n,location:"path",type:s,keyParam:!0}:{...s,name:n,location:"path",keyParam:!0};return i.PathParam(n,p),r.push(c=>{var l;(l=c.path)!=null&&l.includes(":"+n)||(c.path=(c.path||"")+"@:"+n),c.mergePath=!0}),i},r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=Ve(t.type)}),i};S.Entity.Replace=function(o,e){let t;typeof o=="object"&&!o[E]?t=o:t={...e,type:o};let r=[],i=B(r,{method:"POST",...t,composition:"Entity.Replace"});return i.QueryParam("projection",{description:"Determines fields projection",type:new Y({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(A.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:I.opra_response_json,type:t.type,partial:"deep"}).Response(A.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(A.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:I.opra_response_json}),i.KeyParam=(n,s)=>{let p=typeof s=="string"||typeof s=="function"?{name:n,location:"path",type:s,keyParam:!0}:{...s,name:n,location:"path",keyParam:!0};return i.PathParam(n,p),r.push(c=>{var l;(l=c.path)!=null&&l.includes(":"+n)||(c.path=(c.path||"")+"@:"+n),c.mergePath=!0}),i},r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=Ve(t.type)}),i};S.Entity.UpdateMany=function(o,e){var p;let t;typeof o=="object"&&!o[E]?t=o:t={...e,type:o};let r=[],i=new ce({dataType:t.type});i.rules={};let n=new be,s=B(r,{method:"PATCH",...t,composition:"Entity.UpdateMany",requestBody:{immediateFetch:!0,partial:"deep",allowPatchOperators:!0,keepKeyFields:!0,...t.requestBody,required:!0}});return s.RequestContent(((p=t.requestBody)==null?void 0:p.type)||t.type).Response(A.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:I.opra_response_json}).Response(A.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:I.opra_response_json}).QueryParam("filter",{type:i,description:"Determines filter fields"}),r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.type=Ve(t.type)}),s.Filter=(c,l,x)=>(r.push(()=>{n.set(c,{operators:l,description:x}),i.rules=n.toJSON()}),s),s};S.Entity.Update=function(o,e){var p;let t;typeof o=="object"&&!o[E]?t=o:t={...e,type:o};let r=[],i=new be,n=new ce({dataType:t.type});n.rules={};let s=B(r,{method:"PATCH",...t,composition:"Entity.Update",requestBody:{partial:"deep",immediateFetch:!0,allowPatchOperators:!0,keepKeyFields:!0,...t.requestBody,required:!0}});return s.QueryParam("projection",{description:"Determines fields projection",type:new Y({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).QueryParam("filter",{type:n,description:"Determines filter fields"}).RequestContent(((p=t.requestBody)==null?void 0:p.type)||t.type).Response(A.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',contentType:I.opra_response_json,type:t.type,partial:"deep"}).Response(A.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(A.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:I.opra_response_json}),s.KeyParam=(c,l)=>{let x=typeof l=="string"||typeof l=="function"?{name:c,location:"path",type:l,keyParam:!0}:{...l,name:c,location:"path",keyParam:!0};return s.PathParam(c,x),r.push(d=>{var V;(V=d.path)!=null&&V.includes(":"+c)||(d.path=(d.path||"")+"@:"+c),d.mergePath=!0}),s},r.push(c=>{let l=c.compositionOptions=c.compositionOptions||{};l.type=Ve(t.type)}),s.Filter=(c,l,x)=>(r.push(()=>{i.set(c,{operators:l,description:x}),n.rules=i.toJSON()}),s),s};function Ve(o){if(typeof o=="string")return o;let e=Reflect.getMetadata(E,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(Ve,"getDataTypeName");var cp=require("@jsopen/objects");var rp=require("@jsopen/objects"),ip=require("ts-gems");var ze=a(function(...o){var i;if(!this)return ze[b].apply(void 0,o);let[e,t]=o;if(R.call(this,e),!C.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,ip.asMutable)(this);r.kind=m.RpcController.Kind,r.types=r.node[U]=new ee,r.operations=new D,r.headers=[],r.name=t.name,r.description=t.description,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(i=r._initialize)==null||i.call(r,t)},"RpcController"),ks=class ks extends R{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 ze)return this.node.parent.element.findHeader(e,t)}toString(){return`[RpcController ${this.name}]`}toJSON(){let e=(0,rp.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}[Rt](){return`[${wt}RpcController${bt+this.name+Ge}]`}};a(ks,"RpcControllerClass");var Fs=ks;ze.prototype=Fs.prototype;Object.assign(ze,xt);ze[b]=xt;var op=require("@jsopen/objects"),np=require("ts-gems");var or=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');He.call(this,o,e);let t=(0,np.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?Nt(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.deprecated=e.deprecated,t.required=e.required},"RpcHeader"),Cs=class Cs extends He{toJSON(){return(0,op.omitUndefined)({...super.toJSON(),name:this.name,required:this.required,deprecated:this.deprecated})}};a(Cs,"RpcHeaderClass");var js=Cs;or.prototype=js.prototype;var sp=require("@jsopen/objects"),ap=require("ts-gems");var nr=a(function(...o){if(!this){let[i,n]=o,s=[];return nr[b].call(void 0,s,i,n)}let[e,t]=o;if(R.call(this,e),!C.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,ap.asMutable)(this);r.headers=[],r.types=r.node[U]=new ee,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 g?t.payloadType:r.owner.node.getDataType(t.payloadType)),t!=null&&t.keyType&&(r.keyType=(t==null?void 0:t.keyType)instanceof g?t.keyType:r.owner.node.getDataType(t.keyType))},"RpcOperation"),Bs=class Bs extends R{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,sp.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(Bs,"RpcOperationClass");var Us=Bs;nr.prototype=Us.prototype;nr[b]=lr;var pp=require("@jsopen/objects");var $s=class $s extends R{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 g?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 g?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,pp.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($s,"RpcOperationResponse");var wi=$s;var qs=class qs{static async createApi(e,t){let r=new et(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,cp.isConstructor)(r)&&(r=r()),r=await fe(r);let n,s,p;if(typeof r=="function"){if(s=Reflect.getMetadata(oe,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(oe,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 ze(t,{...s,name:i,instance:p,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await v.addDataTypes(e,c,s.types)}),s.headers&&await e.enterAsync(".headers",async()=>{let l=0;for(let x of s.headers)await e.enterAsync(`[${l++}]`,async()=>{let d={...x};await e.enterAsync(".type",async()=>{x.type&&(d.type=c.node.findDataType(x.type)),!d.type&&typeof x.type=="object"&&(d.type=await v.createDataType(e,c,x.type)),d.type||(d.type=c.node.getDataType("any"))});let V=new or(c,d);c.headers.push(V)})}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[l,x]of Object.entries(s.operations))await e.enterAsync(`[${l}]`,async()=>{let d=new nr(c,{...x,name:l,types:void 0,payloadType:void 0,keyType:void 0});await this._initRpcOperation(e,d,x),c.operations.set(d.name,d)})}),c}static async _initRpcOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await v.addDataTypes(e,t,r.types)}),t.payloadType=await v.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await v.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 v.resolveDataType(e,t,n.type)});let p=new or(t,s);t.headers.push(p)})}),r.response&&await e.enterAsync(".response",async()=>{let i=new wi(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 v.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await v.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 v.resolveDataType(e,t,n.type)});let p=new or(t,s);t.headers.push(p)})})}};a(qs,"RpcApiFactory");var bi=qs;var Mc="https://oprajs.com/spec/v"+m.SpecVersion,Ai=class Ai{constructor(){this._allDocuments={}}static async createDocument(e,t){let r=new Ai,i=t instanceof ue?t:new ue(t);try{let n=new Ie;if(await r.initDocument(n,i,e),i.error.details.length)throw i.error;return n}catch(n){try{n instanceof We||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 hp=Object.create;var cr=Object.defineProperty;var yp=Object.getOwnPropertyDescriptor;var Tp=Object.getOwnPropertyNames;var Ep=Object.getPrototypeOf,_p=Object.prototype.hasOwnProperty;var a=(o,e)=>cr(o,"name",{value:e,configurable:!0});var Mi=(o,e)=>{for(var t in e)cr(o,t,{get:e[t],enumerable:!0})},Gs=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Tp(e))!_p.call(o,i)&&i!==t&&cr(o,i,{get:()=>e[i],enumerable:!(r=yp(e,i))||r.enumerable});return o};var lr=(o,e,t)=>(t=o!=null?hp(Ep(o)):{},Gs(e||!o||!o.__esModule?cr(t,"default",{value:o,enumerable:!0}):t,o)),xp=o=>Gs(cr({},"__esModule",{value:!0}),o);var kc={};Mi(kc,{AnyType:()=>jr,ApiBase:()=>mt,ApiDocument:()=>Ve,ApiDocumentFactory:()=>Js,ApiField:()=>j,BUILTIN:()=>De,BadRequestError:()=>Li,Base64Type:()=>Ir,BaseI18n:()=>Hs,BigintType:()=>Cr,BooleanType:()=>Ur,CLASS_NAME_PATTERN:()=>U,ComplexType:()=>re,ConflictError:()=>ki,DATATYPE_METADATA:()=>h,DECODER:()=>E,DECORATOR:()=>N,DataType:()=>O,DataTypeMap:()=>ie,DateStringType:()=>rt,DateTimeStringType:()=>ot,DateTimeType:()=>it,DateType:()=>tt,DocumentElement:()=>w,DocumentInitContext:()=>ue,DocumentNode:()=>Dr,ENCODER:()=>x,EmailType:()=>Q,EnumType:()=>te,FailedDependencyError:()=>Ci,FieldPathType:()=>V,FieldsProjection:()=>Ne,FilterType:()=>we,ForbiddenError:()=>ur,HTTP_CONTROLLER_METADATA:()=>ne,HttpApi:()=>ut,HttpController:()=>oe,HttpHeaderCodes:()=>Bi,HttpMediaType:()=>be,HttpMultipartField:()=>Kr,HttpOperation:()=>A,HttpOperationResponse:()=>Vr,HttpParameter:()=>nr,HttpRequestBody:()=>zr,HttpStatusCode:()=>R,HttpStatusMessages:()=>Ap,HttpStatusRange:()=>or,I18n:()=>yt,IntegerType:()=>$e,InternalServerError:()=>qi,IssueSeverity:()=>so,MappedType:()=>Ke,MethodNotAllowedError:()=>Vi,MimeTypes:()=>b,MixinType:()=>lt,NAMESPACE_PATTERN:()=>ao,NotAcceptableError:()=>Ji,NotFoundError:()=>Yi,NullType:()=>Br,NumberType:()=>de,ObjectIdType:()=>Fr,ObjectType:()=>$r,OmitType:()=>Mc,OperationResult:()=>X,OpraDocumentError:()=>nt,OpraException:()=>he,OpraFilter:()=>Ct,OpraHttpError:()=>S,OpraSchema:()=>u,PartialType:()=>vc,PermissionError:()=>Qi,PickType:()=>Fc,RPC_CONTROLLER_METADATA:()=>se,RequiredType:()=>Lc,ResourceConflictError:()=>Zi,ResourceNotAvailableError:()=>eo,ResponsiveMap:()=>M,RpcApi:()=>ht,RpcController:()=>Je,RpcHeader:()=>ar,RpcOperation:()=>pr,SimpleType:()=>m,StringType:()=>Ae,TimeType:()=>st,UnauthorizedError:()=>ro,UnprocessableEntityError:()=>oo,UrlType:()=>Pr,UuidType:()=>zt,classes:()=>Ws,cloneObject:()=>L,getErrorStack:()=>Dp,getStackFileName:()=>bp,i18n:()=>Wr,inheritPropertyInitializers:()=>hr,isBlob:()=>Pp,isFormData:()=>kp,isReadable:()=>vp,isReadableStream:()=>Lp,isStream:()=>Gr,isURL:()=>jp,isWritable:()=>Fp,kCtorMap:()=>yr,kDataTypeMap:()=>B,kTypeNSMap:()=>xe,mergePrototype:()=>dr,parse:()=>lo,parseFieldsProjection:()=>co,resolveThunk:()=>me,safeJsonStringify:()=>Mp,translate:()=>D,uid:()=>dp.uid});module.exports=xp(kc);var m2=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 ma=require("@jsopen/objects"),ua=require("valgen");var Zs=lr(require("@browsery/i18next"),1),mr=require("fast-tokenizer");var Op=/\\(.)/g,gp=/(\\)/g;function Qs(o){return o.replace(gp,"\\\\")}a(Qs,"escapeString");function Xs(o){return o.replace(Op,"$1")}a(Xs,"unescapeString");var Hs=Object.getPrototypeOf(Zs.default.createInstance()).constructor,fr=class fr extends Hs{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 f of Object.keys(c))this.addResourceBundle(p,f,c[f],!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 fr(e,t)}static createInstance(e,t){return new fr(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,mr.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,mr.splitString)(n,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),p=Xs(n.substring((s[0]||"").length+1));n=s[0]||"";let c=[],f=null;for(let d of(0,mr.tokenize)(n,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(d.startsWith("{")){f=JSON.parse(d);continue}c.push(d)}let g=c.length>1?"$t("+c.join(",")+")":c[0];i+=p?this.t(g,p,{...r,...f}):this.t(g,{...r,...f});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 Rp}};a(fr,"I18n");var yt=fr,Rp=yt.createInstance();var wp=/(\))/g;function D(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?"?"+Qs(i).replace(wp,"\\$1"):"")+")"}a(D,"translate");var Wr=yt.createInstance();Wr.init().catch(()=>{});var ea=require("@jsopen/objects");var vi=class vi extends Error{constructor(e,t){super("Unknown error"),this.severity="error",t=t||(e instanceof Error?e:void 0),e instanceof Error&&(t=e),t&&t instanceof Error&&(this.cause=t,t.stack&&(this.stack=t.stack)),typeof e=="string"?this.initString(e):e instanceof Error?this.initError(e):this.init(e),this.message=this.message||this.constructor.name}toString(){return Wr.deep(this.message)}toJSON(){var t;let e="production";return(0,ea.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(vi,"OpraException");var he=vi;var Fi=class Fi extends he{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(Fi,"OpraHttpError");var S=Fi;var Pi=class Pi extends S{constructor(){super(...arguments),this.status=400}init(e){super.init({message:D("error:BAD_REQUEST","Bad request"),code:"BAD_REQUEST",...e})}};a(Pi,"BadRequestError");var Li=Pi;var ji=class ji extends S{constructor(){super(...arguments),this.status=409}init(e){super.init({message:D("error:CONFLICT","Conflict"),code:"CONFLICT",...e})}};a(ji,"ConflictError");var ki=ji;var Ui=class Ui extends S{constructor(){super(...arguments),this.status=424}init(e){super.init({message:D("error:FAILED_DEPENDENCY","The request failed due to failure of a previous request"),code:"FAILED_DEPENDENCY",...e})}};a(Ui,"FailedDependencyError");var Ci=Ui;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 Ap={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 b;(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"})(b||(b={}));var $i=class $i extends S{constructor(){super(...arguments),this.status=R.FORBIDDEN}init(e){super.init({message:D("error:FORBIDDEN","You are not authorized to perform this action"),code:"FORBIDDEN",...e})}};a($i,"ForbiddenError");var ur=$i;var Ki=class Ki extends S{constructor(){super(...arguments),this.status=500}init(e){super.init({message:D("error:INTERNAL_SERVER_ERROR","Internal server error"),code:"INTERNAL_SERVER_ERROR",severity:"fatal",...e})}};a(Ki,"InternalServerError");var qi=Ki;var zi=class zi extends S{constructor(){super(...arguments),this.status=405}init(e){super.init({message:D("error:METHOD_NOT_ALLOWED","Method not allowed"),code:"METHOD_NOT_ALLOWED",...e})}};a(zi,"MethodNotAllowedError");var Vi=zi;var Wi=class Wi extends S{constructor(){super(...arguments),this.status=406}init(e){super.init({message:D("error:NOT_ACCEPTABLE","Not Acceptable"),code:"NOT_ACCEPTABLE",...e})}};a(Wi,"NotAcceptableError");var Ji=Wi;var Gi=class Gi extends S{constructor(){super(...arguments),this.status=404}init(e){super.init({message:D("error:NOT_FOUND","Not found"),code:"NOT_FOUND",...e})}};a(Gi,"NotFoundError");var Yi=Gi;var Xi=class Xi extends ur{init(e){super.init({message:D("error:PERMISSION_ERROR","You dont have permission for this operation"),code:"PERMISSION_ERROR",...e})}};a(Xi,"PermissionError");var Qi=Xi;var Hi=class Hi extends S{constructor(e,t,r){super({message:D("error:RESOURCE_CONFLICT",{resource:e,fields:t},"There is already an other {{resource}} resource with same values ({{fields}})"),severity:"error",code:"RESOURCE_CONFLICT",details:{resource:e,location:t}},r),this.status=409}};a(Hi,"ResourceConflictError");var Zi=Hi;var to=class to extends S{constructor(e,t,r){super({message:D("error:RESOURCE_NOT_AVAILABLE",`Resource "${e}${t?"/"+t:""}" is not available`),severity:"error",code:"RESOURCE_NOT_AVAILABLE",details:{resource:e,key:t}},r,R.UNPROCESSABLE_ENTITY)}};a(to,"ResourceNotAvailableError");var eo=to;var io=class io extends S{constructor(){super(...arguments),this.status=401}init(e){super.init({message:D("error:UNAUTHORIZED","You have not been authenticated to perform this action"),code:"UNAUTHORIZED",...e})}};a(io,"UnauthorizedError");var ro=io;var no=class no extends S{constructor(){super(...arguments),this.status=422}init(e){super.init({message:D("error:UNPROCESSABLE_ENTITY","Unprocessable entity"),severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};a(no,"UnprocessableEntityError");var oo=no;var so;(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"}})(so||(so={}));BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});var ta=require("@jsopen/objects"),ra=lr(require("putil-promisify"),1);async function me(o){return o=ra.default.isPromise(o)?await o:o,typeof o=="function"?(0,ta.isConstructor)(o)?o:await o():o}a(me,"resolveThunk");var ia=/^(?: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?ia.exec(r):void 0;return i?i[1]:""}return""}a(bp,"getStackFileName");function Dp(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?ia.exec(r):void 0;return i?i[1]:""}return""}a(Dp,"getErrorStack");function dr(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(dr,"mergePrototype");function hr(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(hr,"inheritPropertyInitializers");var Tr=require("@jsopen/objects");var h=Symbol.for("opra.type.metadata"),ne=Symbol("opra.http-controller.metadata"),se=Symbol("opra.rpc-controller.metadata"),E=Symbol.for("opra.type.decoder"),x=Symbol("opra.type.encoder"),N=Symbol.for("DECORATOR"),De=Symbol.for("BUILTIN"),ao=/([a-z$_]\w+):(.+)/i,U=/^[a-z][\w_]*$/i,B=Symbol.for("kDataTypeMap"),yr=Symbol.for("kCtorMap"),xe=Symbol.for("kTypeNSMap");function L(o,e){return(0,Tr.merge)({},o,{deep:a(t=>(0,Tr.isPlainObject)(t)&&!t[h],"deep"),copyDescriptors:!0,ignoreUndefined:!0,filter(t,r){let i=r[t];return!e||typeof i!="function"&&(typeof i!="object"||(0,Tr.isPlainObject)(i)||Array.isArray(i))}})}a(L,"cloneObject");var po=require("fast-tokenizer");var Np=/^([+-])?([a-z_$]\w*)$/i,Sp=/[^.]\(/g,fo=class fo{};a(fo,"FieldsProjection");var Ne=fo;(function(o){let t=class t{};a(t,"Item");let e=t;o.Item=e})(Ne||(Ne={}));function co(o,e){let t=Array.isArray(o)?o:[o];if(!(t&&t.length))return;let r=new Ne;for(let i of t)e||(i=i.toLowerCase()),lo(i,r);return r}a(co,"parseFieldsProjection");function lo(o,e){o=o.replace(Sp,r=>r.charAt(0)+"."+r.substring(1));let t=(0,po.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,po.splitString)(i,{delimiters:",",brackets:!0,keepBrackets:!0});for(let f of c)lo(f,e);continue}let n=Np.exec(i);if(!n)throw new TypeError(`Invalid field path (${o})`);let s=n[2],p=e[s]=e[s]||new Ne.Item;n[1]&&(p.sign=n[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new Ne}}a(lo,"parse");function Ip(o){return o&&typeof o.forEach=="function"}a(Ip,"isMap");var W=Symbol.for("kEntries"),ye=Symbol.for("kKeyMap"),Yr=Symbol.for("kWellKnownKeys"),mo=Symbol.for("kOptions"),Tt=Symbol.for("kSize"),uo=class uo{constructor(e,t){Object.defineProperty(this,Tt,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,W,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,ye,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,Yr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,mo,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(i=>{r?this[Yr][i]=i:this[Yr][i.toLowerCase()]=i}),this.clear(),e&&this.setAll(e)}get size(){return this[Tt]}clear(){Object.keys(this[W]).forEach(e=>delete this[W][e]),Object.keys(this[ye]).forEach(e=>delete this[ye][e]),this[Tt]=0}forEach(e,t){for(let[r,i]of this.entries())e.call(t,i,r,this)}get(e){if(e)return this[W][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[W],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let i=Object.prototype.hasOwnProperty.call(this[W],r);return this[W][r]=t,i||this[Tt]++,this[ye][r]=e,this}setAll(e){return Ip(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[ye])[Symbol.iterator]()}values(){return Object.values(this[W])[Symbol.iterator]()}entries(){return Object.entries(this[W])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[W],t);return delete this[W][t],delete this[ye][t],r||this[Tt]--,r}sort(e){let t={...this[W]},r={...this[ye]},i=Array.from(this.keys());e?i.sort(e):i.sort(),this.clear();for(let n of i)this[W][n]=t[n],this[ye][n]=r[n];return this[Tt]=i.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[ye]))e[r]=this[W][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[mo].caseSensitive)return e;let t=this._getStoringKey(e);return this[ye][t]??this[Yr][t]??e}_getStoringKey(e){return this[mo].caseSensitive?e:e.toLowerCase()}};a(uo,"ResponsiveMap");var M=uo;function Mp(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(Mp,"safeJsonStringify");function Gr(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}a(Gr,"isStream");function vp(o){return Gr(o)&&typeof o._read=="function"&&typeof o._readableState=="object"}a(vp,"isReadable");function Fp(o){return Gr(o)&&typeof o._write=="function"}a(Fp,"isWritable");function Lp(o){return Gr(o)&&typeof o.getReader=="function"&&typeof o.pipeThrough=="function"&&typeof o.pipeTo=="function"}a(Lp,"isReadableStream");function Pp(o){return o!==null&&typeof o=="object"&&typeof o.size=="number"&&typeof o.arrayBuffer=="function"&&typeof o.stream=="function"}a(Pp,"isBlob");function kp(o){return o!==null&&typeof o.constructor=="function"&&o.constructor.name==="FormData"&&typeof o.append=="function"&&typeof o.getAll=="function"}a(kp,"isFormData");function jp(o){return o!==null&&typeof o=="object"&&typeof o.host=="string"&&typeof o.href=="string"}a(jp,"isURL");var ho=class ho{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};a(ho,"Ast");var Er=ho;var yo=class yo extends Er{};a(yo,"Expression");var $=yo;var To=class To extends ${};a(To,"Term");var Ye=To;var Eo=class Eo extends Ye{constructor(e){super(),this.value=e}toString(){return""+this.value}};a(Eo,"Literal");var v=Eo;var _o=class _o extends ${constructor(){super(),this.items=[]}append(e,t){return this.items.push(new Qr({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};a(_o,"ArithmeticExpression");var Ge=_o,xo=class xo{constructor(e){Object.assign(this,e)}};a(xo,"ArithmeticExpressionItem");var Qr=xo;var Oo=class Oo extends Ye{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};a(Oo,"ArrayExpression");var Oe=Oo;var Cp=/\w/,go=class go extends ${constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${Cp.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};a(go,"ComparisonExpression");var Te=go;var Ro=class Ro extends ${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(Ro,"LogicalExpression");var Ee=Ro;var wo=class wo extends ${constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(wo,"NegativeExpression");var _r=wo;var Ao=class Ao extends ${constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(Ao,"ParenthesizedExpression");var ge=Ao;var bo=class bo extends v{constructor(e){super(e)}};a(bo,"BooleanLiteral");var Qe=bo;var na=require("putil-varhelpers");var Do=class Do extends TypeError{};a(Do,"SyntaxError");var Xr=Do,No=class No extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};a(No,"FilterValidationError");var _e=No,So=class So extends Error{constructor(e,t){super(e),Object.assign(this,t)}};a(So,"FilterParseError");var Zr=So;var Up=/'/g,Bp=/(\\)/g,$p=/\\(.)/g;function qp(o){return o.replace(Bp,"\\\\")}a(qp,"escapeString");function Kp(o){return o.replace($p,"$1")}a(Kp,"unescapeString");function Se(o){return"'"+qp(o).replace(Up,"\\'")+"'"}a(Se,"quoteFilterString");function xr(o){return o&&(o.startsWith("'")||o.startsWith('"'))&&o.endsWith(o.charAt(0))?Kp(o.substring(1,o.length-1)):o}a(xr,"unquoteFilterString");var oa=new Date(0),Io=class Io extends v{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,na.toDateDef)(e,oa)!==oa){this.value=e;return}throw new _e(`Invalid date value "${e}"`)}toString(){return Se(this.value)}};a(Io,"DateLiteral");var Ie=Io;var aa=require("putil-varhelpers");var sa=new Date(0),Mo=class Mo extends v{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&(0,aa.toDateDef)(e,sa)!==sa){this.value=e;return}throw new _e(`Invalid date-time value "${e}"`)}toString(){return Se(this.value)}};a(Mo,"DateTimeLiteral");var Or=Mo;var vo=class vo extends v{constructor(){super(null),this.value=null}};a(vo,"NullLiteral");var Xe=vo;var Fo=class Fo extends v{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 _e(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};a(Fo,"NumberLiteral");var Re=Fo;var Lo=class Lo extends v{constructor(e){super(""+e)}};a(Lo,"QualifiedIdentifier");var ae=Lo;var Po=class Po extends v{constructor(e){super(""+e)}toString(){return Se(this.value)}};a(Po,"StringLiteral");var Ze=Po;var Vp=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,ko=class ko extends v{constructor(e){if(super(""),e instanceof Date){this.value=Hr(e.getHours())+":"+Hr(e.getMinutes())+(e.getSeconds()?":"+Hr(e.getSeconds()):"")+(e.getMilliseconds()?"."+Hr(e.getMilliseconds()):"");return}if(typeof e=="string"&&Vp.test(e)){this.value=e;return}throw new _e(`Invalid time value "${e}"`)}toString(){return Se(this.value)}};a(ko,"TimeLiteral");var He=ko;function Hr(o){return o<=9?"0"+o:""+o}a(Hr,"pad");var fi=require("@browsery/antlr4");var pe=require("@browsery/antlr4");var J=class J extends pe.Lexer{constructor(e){super(e),this._interp=new pe.LexerATNSimulator(this,J._ATN,J.DecisionsToDFA,new pe.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return J.literalNames}get symbolicNames(){return J.symbolicNames}get ruleNames(){return J.ruleNames}get serializedATN(){return J._serializedATN}get channelNames(){return J.channelNames}get modeNames(){return J.modeNames}static get _ATN(){return J.__ATN||(J.__ATN=new pe.ATNDeserializer().deserialize(J._serializedATN)),J.__ATN}};a(J,"OpraFilterLexer");var T=J;T.T__0=1;T.T__1=2;T.T__2=3;T.T__3=4;T.T__4=5;T.T__5=6;T.T__6=7;T.T__7=8;T.T__8=9;T.T__9=10;T.T__10=11;T.T__11=12;T.T__12=13;T.T__13=14;T.T__14=15;T.T__15=16;T.T__16=17;T.T__17=18;T.T__18=19;T.T__19=20;T.T__20=21;T.T__21=22;T.T__22=23;T.T__23=24;T.T__24=25;T.T__25=26;T.T__26=27;T.T__27=28;T.T__28=29;T.T__29=30;T.T__30=31;T.T__31=32;T.T__32=33;T.T__33=34;T.IDENTIFIER=35;T.POLAR_OP=36;T.DATE=37;T.DATETIME=38;T.TIME=39;T.NUMBER=40;T.INTEGER=41;T.STRING=42;T.WHITESPACE=43;T.EOF=pe.Token.EOF;T.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];T.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];T.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"];T.modeNames=["DEFAULT_MODE"];T.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"];T._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];T.DecisionsToDFA=T._ATN.decisionToState.map((o,e)=>new pe.DFA(o,e));var pa=T;var y=require("@browsery/antlr4");var _=class _ extends y.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 y.FailedPredicateException(this,e,t)}constructor(e){super(e),this._interp=new y.ParserATNSimulator(this,_._ATN,_.DecisionsToDFA,new y.PredictionContextCache)}root(){let e=new jo(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 y.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 ee(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 Co(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 Uo(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 y.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!==y.ATN.INVALID_ALT_NUMBER;){if(c===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),n=i;{if(i=new gr(this,new ee(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 y.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 ei(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 y.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 ti(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 y.NoViableAltException(this)}}catch(t){if(t instanceof y.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 ri(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 y.RecognitionException)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}value(){let e=new Y(this,this._ctx,this.state);this.enterRule(e,10,_.RULE_value);try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 40:e=new Yo(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(_.NUMBER);break;case 13:case 14:e=new Jo(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new Wo(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new qo(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 38:e=new Ko(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(_.DATETIME);break;case 37:e=new zo(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(_.DATE);break;case 39:e=new $o(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(_.TIME);break;case 42:e=new Vo(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(_.STRING);break;default:throw new y.NoViableAltException(this)}}catch(t){if(t instanceof y.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 Rr(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!==y.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 y.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 ii(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 y.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 Et(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 y.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 oi(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 y.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 ni(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 y.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 si(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 y.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 ai(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 y.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 Go(this,this._ctx,this.state);this.enterRule(e,26,_.RULE_arithmeticOperator);let t;try{this.enterOuterAlt(e,1),this.state=111,t=this._input.LA(1),!(t&-32)&&1<<t&491520?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof y.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 pi(this,this._ctx,this.state);this.enterRule(e,28,_.RULE_comparisonOperator);let t;try{this.enterOuterAlt(e,1),this.state=113,t=this._input.LA(1),!(t&-32)&&1<<t&2146959360?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof y.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 ci(this,this._ctx,this.state);this.enterRule(e,30,_.RULE_logicalOperator);let t;try{this.enterOuterAlt(e,1),this.state=115,t=this._input.LA(1),!(t-31&-32)&&1<<t-31&15?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof y.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 Qo(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 y.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 y.ATNDeserializer().deserialize(_._serializedATN)),_.__ATN}};a(_,"OpraFilterParser");var l=_;l.T__0=1;l.T__1=2;l.T__2=3;l.T__3=4;l.T__4=5;l.T__5=6;l.T__6=7;l.T__7=8;l.T__8=9;l.T__9=10;l.T__10=11;l.T__11=12;l.T__12=13;l.T__13=14;l.T__14=15;l.T__15=16;l.T__16=17;l.T__17=18;l.T__18=19;l.T__19=20;l.T__20=21;l.T__21=22;l.T__22=23;l.T__23=24;l.T__24=25;l.T__25=26;l.T__26=27;l.T__27=28;l.T__28=29;l.T__29=30;l.T__30=31;l.T__31=32;l.T__32=33;l.T__33=34;l.IDENTIFIER=35;l.POLAR_OP=36;l.DATE=37;l.DATETIME=38;l.TIME=39;l.NUMBER=40;l.INTEGER=41;l.STRING=42;l.WHITESPACE=43;l.EOF=y.Token.EOF;l.RULE_root=0;l.RULE_expression=1;l.RULE_comparisonLeft=2;l.RULE_comparisonRight=3;l.RULE_parenthesizedItem=4;l.RULE_value=5;l.RULE_qualifiedIdentifier=6;l.RULE_externalConstant=7;l.RULE_identifier=8;l.RULE_arrayValue=9;l.RULE_boolean=10;l.RULE_null=11;l.RULE_infinity=12;l.RULE_arithmeticOperator=13;l.RULE_comparisonOperator=14;l.RULE_logicalOperator=15;l.RULE_polarityOperator=16;l.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];l.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"];l.ruleNames=["root","expression","comparisonLeft","comparisonRight","parenthesizedItem","value","qualifiedIdentifier","externalConstant","identifier","arrayValue","boolean","null","infinity","arithmeticOperator","comparisonOperator","logicalOperator","polarityOperator"];l._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];l.DecisionsToDFA=l._ATN.decisionToState.map((o,e)=>new y.DFA(o,e));var ca=l,Xo=class Xo extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(ee,0)}EOF(){return this.getToken(l.EOF,0)}get ruleIndex(){return l.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(Xo,"RootContext");var jo=Xo,Zo=class Zo extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return l.RULE_expression}copyFrom(e){super.copyFrom(e)}};a(Zo,"ExpressionContext");var ee=Zo,Ho=class Ho extends ee{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(ri,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(Ho,"ParenthesizedExpressionContext");var Co=Ho,en=class en extends ee{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(ee,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(en,"NegativeExpressionContext");var Uo=en,tn=class tn extends ee{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(ei,0)}comparisonOperator(){return this.getTypedRuleContext(pi,0)}comparisonRight(){return this.getTypedRuleContext(ti,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(tn,"ComparisonExpressionContext");var Bo=tn,rn=class rn extends ee{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(ee)}expression(e){return this.getTypedRuleContext(ee,e)}logicalOperator(){return this.getTypedRuleContext(ci,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(rn,"LogicalExpressionContext");var gr=rn,on=class on extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(Rr,0)}get ruleIndex(){return l.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(on,"ComparisonLeftContext");var ei=on,nn=class nn extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(Y,0)}qualifiedIdentifier(){return this.getTypedRuleContext(Rr,0)}externalConstant(){return this.getTypedRuleContext(ii,0)}arrayValue(){return this.getTypedRuleContext(oi,0)}get ruleIndex(){return l.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(nn,"ComparisonRightContext");var ti=nn,sn=class sn extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(ee,0)}get ruleIndex(){return l.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(sn,"ParenthesizedItemContext");var ri=sn,an=class an extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return l.RULE_value}copyFrom(e){super.copyFrom(e)}};a(an,"ValueContext");var Y=an,pn=class pn extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(l.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(pn,"TimeLiteralContext");var $o=pn,cn=class cn extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(si,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(cn,"NullLiteralContext");var qo=cn,ln=class ln extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(l.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(ln,"DateTimeLiteralContext");var Ko=ln,fn=class fn extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(l.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(fn,"StringLiteralContext");var Vo=fn,mn=class mn extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(l.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(mn,"DateLiteralContext");var zo=mn,un=class un extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(ai,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(un,"InfinityLiteralContext");var Jo=un,dn=class dn extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(ni,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(dn,"BooleanLiteralContext");var Wo=dn,hn=class hn extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(l.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(hn,"NumberLiteralContext");var Yo=hn,yn=class yn extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(Et)}identifier(e){return this.getTypedRuleContext(Et,e)}get ruleIndex(){return l.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(yn,"QualifiedIdentifierContext");var Rr=yn,Tn=class Tn extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(Et,0)}get ruleIndex(){return l.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(Tn,"ExternalConstantContext");var ii=Tn,En=class En extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(l.IDENTIFIER,0)}get ruleIndex(){return l.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(En,"IdentifierContext");var Et=En,_n=class _n extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(Y)}value(e){return this.getTypedRuleContext(Y,e)}get ruleIndex(){return l.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(_n,"ArrayValueContext");var oi=_n,xn=class xn extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return l.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(xn,"BooleanContext");var ni=xn,On=class On extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return l.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(On,"NullContext");var si=On,gn=class gn extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return l.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(gn,"InfinityContext");var ai=gn,Rn=class Rn extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return l.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(Rn,"ArithmeticOperatorContext");var Go=Rn,wn=class wn extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return l.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(wn,"ComparisonOperatorContext");var pi=wn,An=class An extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return l.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(An,"LogicalOperatorContext");var ci=An,bn=class bn extends y.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}POLAR_OP(){return this.getToken(l.POLAR_OP,0)}get ruleIndex(){return l.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(bn,"PolarityOperatorContext");var Qo=bn;var la=require("@browsery/antlr4");var Dn=class Dn extends v{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};a(Dn,"ExternalConstant");var li=Dn;var Nn=class Nn extends la.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 ge(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new _r(t)}visitComparisonExpression(e){return new Te({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 gr&&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 Ee({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new ae(e.getText())}visitExternalConstant(e){return new li(e.identifier().getText())}visitNullLiteral(){return new Xe}visitBooleanLiteral(e){return new Qe(e.getText()==="true")}visitNumberLiteral(e){return new Re(e.getText())}visitStringLiteral(e){return new Ze(xr(e.getText()))}visitInfinityLiteral(){return new Re(1/0)}visitDateLiteral(e){return new Ie(xr(e.getText()))}visitDateTimeLiteral(e){return new Or(xr(e.getText()))}visitTimeLiteral(e){return new He(xr(e.getText()))}visitArrayValue(e){return new Oe(e.value_list().map(t=>this.visit(t)))}};a(Nn,"FilterTreeVisitor");var wr=Nn;var fa=require("@browsery/antlr4");var Sn=class Sn extends fa.ErrorListener{constructor(e){super(),this.errors=e}syntaxError(e,t,r,i,n,s){this.errors.push(new Zr(n,{recognizer:e,offendingSymbol:t,line:r,column:i,e:s}))}};a(Sn,"OpraErrorListener");var Ar=Sn;function In(o,e){let t=new fi.CharStream(o),r=new pa(t),i=new fi.CommonTokenStream(r),n=new ca(i);n.buildParseTrees=!0;let s=[],p=new Ar(s);r.removeErrorListeners(),r.addErrorListener(p),n.removeErrorListeners(),n.addErrorListener(p);let c=n.root();if(s.length){let f=[];for(let d of s)f.push(d.message+(o.includes(`
8
+ `)?" at line: "+d.line+" column: "+d.column:" at column: "+d.column));let g=new Xr(f.join(`
9
+ `));throw g.errors=s,g}return e=e||new wr,e.visit(c)}a(In,"parse");var Mn=class Mn{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,ma.omitUndefined)({...t,operators:r}))}normalizeFilter(e,t,r){let i=typeof e=="string"?In(e):e;return this.normalizeFilterAst(i,[],t,r)}normalizeFilterAst(e,t,r,i){if(e instanceof Te){if(t.push(e),this.normalizeFilterAst(e.left,t,r),!(e.left instanceof ae&&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 he({message:D("error:UNACCEPTED_FILTER_FIELD",{field:e.left.value}),code:"UNACCEPTED_FILTER_FIELD",details:{field:e.left.value}});if(n.operators&&!n.operators.includes(e.op))throw new he({message:D("error:UNACCEPTED_FILTER_OPERATION",{field:e.left.value}),code:"UNACCEPTED_FILTER_OPERATION",details:{field:e.left.value,operator:e.op}});return n.prepare&&(e.prepare=n.prepare),this.normalizeFilterAst(e.right,t,r),t.pop(),e}if(e instanceof Ee)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof Ge)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n.expression,t,r)),t.pop(),e;if(e instanceof Oe)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof ge)return t.push(e),this.normalizeFilterAst(e.expression,t,r),t.pop(),e;if(e instanceof ae&&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 v){let n=t.findLastIndex(s=>s instanceof Te);if(n>=0){let s=t[n];if((e===s.right||t[n+1]===s.right)&&s&&s.left instanceof ae&&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=ua.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(Mn,"FilterRules");var _t=Mn;var Ea=require("ts-gems"),G=require("valgen");var ya=require("@jsopen/objects"),Ta=require("ts-gems");var da=require("ts-gems"),ha=require("uid");var u={};Mi(u,{ComplexType:()=>xt,EnumType:()=>Ot,HttpController:()=>br,HttpOperation:()=>vn,MappedType:()=>gt,MixinType:()=>Rt,RpcController:()=>Fn,RpcOperation:()=>Ln,SimpleType:()=>wt,SpecVersion:()=>zp,isComplexType:()=>Wp,isDataType:()=>Jp,isEnumType:()=>Xp,isHttpController:()=>Zp,isMappedType:()=>Qp,isMixinType:()=>Gp,isSimpleType:()=>Yp});var zp="1.0";var xt;(function(o){o.Kind="ComplexType"})(xt||(xt={}));var Ot;(function(o){o.Kind="EnumType"})(Ot||(Ot={}));var gt;(function(o){o.Kind="MappedType"})(gt||(gt={}));var Rt;(function(o){o.Kind="MixinType"})(Rt||(Rt={}));var wt;(function(o){o.Kind="SimpleType"})(wt||(wt={}));var br;(function(o){o.Kind="HttpController"})(br||(br={}));var vn;(function(o){o.Kind="HttpOperation"})(vn||(vn={}));var Fn;(function(o){o.Kind="RpcController"})(Fn||(Fn={}));var Ln;(function(o){o.Kind="RpcOperation"})(Ln||(Ln={}));function Jp(o){return o&&typeof o=="object"&&(o.kind===xt.Kind||o.kind===Ot.Kind||o.kind===gt.Kind||o.kind===wt.Kind||o.kind===Rt.Kind)}a(Jp,"isDataType");function Wp(o){return o&&typeof o=="object"&&o.kind===xt.Kind}a(Wp,"isComplexType");function Yp(o){return o&&typeof o=="object"&&o.kind===wt.Kind}a(Yp,"isSimpleType");function Gp(o){return o&&typeof o=="object"&&o.kind===Rt.Kind}a(Gp,"isMixinType");function Qp(o){return o&&typeof o=="object"&&o.kind===gt.Kind}a(Qp,"isMappedType");function Xp(o){return o&&typeof o=="object"&&o.kind===Ot.Kind}a(Xp,"isEnumType");function Zp(o){return o&&typeof o=="object"&&o.kind===br.Kind}a(Zp,"isHttpController");var Pn=class Pn{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[xe])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(h,e).name;else if(typeof e=="object"){let n=e[h];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===u.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===u.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===u.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===u.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===u.MixinType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MixinType`)}};a(Pn,"DocumentNode");var Dr=Pn;var w=a(function(o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=(0,da.asMutable)(this);e.id=(0,ha.uid)(16),Object.defineProperty(e,"node",{value:new Dr(this,o==null?void 0:o.node),enumerable:!1,writable:!0}),o&&Object.defineProperty(e,"owner",{value:o,enumerable:!1,writable:!0})},"DocumentElement"),jn=class jn{};a(jn,"DocumentElementClass");var kn=jn;w.prototype=kn.prototype;var At=Symbol.for("nodejs.util.inspect.custom"),et="\x1B[0m",bt="\x1B[33m",Dt="\x1B[35m";function Nr(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(Nr,"testScopeMatch");var O=a(function(o,e,t){if(!this)throw new TypeError('"this" should be passed to call class constructor');if(e!=null&&e.name&&!U.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);w.call(this,o);let r=(0,Ta.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"),Un=class Un extends w{get embedded(){return!this.name}inScope(e){return Nr(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,ya.omitUndefined)({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[At](){return`[${bt+Object.getPrototypeOf(this).constructor.name+et} ${Dt+this.name+et}]`}};a(Un,"DataTypeClass");var Cn=Un;O.prototype=Cn.prototype;var Nt=/^([+-])?([a-z$_][\w.]*)$/i,C=a(function(...o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;O.call(this,e,t,r);let i=(0,Ea.asMutable)(this);i._fields=new M},"ComplexTypeBase"),$n=class $n extends O{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 d,Z,Ys;let r=this,i,n=e.split("."),s=n.length,p=[],c=this.owner.node.getDataType("object"),f=t==null?void 0:t.allowSigns,g=a(()=>p.map(We=>We.fieldName).join("."),"getStrPath");for(let We=0;We<s;We++){let H={fieldName:n[We],dataType:c};p.push(H);let Jr=Nt.exec(n[We]);if(!Jr)throw new TypeError(`Invalid field name (${g()})`);if(Jr[1]&&((We===0&&f==="first"||f==="each")&&(H.sign=Jr[1]),H.fieldName=Jr[2]),r){if(r instanceof C){if(i=r.findField(H.fieldName,t==null?void 0:t.scope),i){H.fieldName=i.name,H.field=i,H.dataType=i.type,r=i.type;continue}if(((d=r.additionalFields)==null?void 0:d[0])===!0){H.additionalField=!0,H.dataType=c,r=void 0;continue}if(((Z=r.additionalFields)==null?void 0:Z[0])==="type"&&((Ys=r.additionalFields)==null?void 0:Ys[1])instanceof O){H.additionalField=!0,H.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(Ii=>Ii.fieldName).join(".")})`)}throw new TypeError(`"${p.map(Ii=>Ii.fieldName).join(".")}" field is not a complex type and has no child fields`)}H.additionalField=!0,H.dataType=c}return p}normalizeFieldPath(e,t){return this.parseFieldPath(e,t).map(r=>(r.sign||"")+r.fieldName).join(".")}generateCodec(e,t){let r=Array.isArray(t==null?void 0:t.projection)?co(t.projection):t==null?void 0:t.projection,i=this._generateSchema(e,{...t,projection:r,currentPath:""}),n;if(this.additionalFields instanceof O)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 s=n[1];n=(0,G.validator)((p,c,f)=>c.fail(f,s,p))}return G.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})}_generateSchema(e,t){var c;let r={},{currentPath:i,projection:n}=t,s=!!(n&&Object.values(n).find(f=>!f.sign)),p;for(let f of this.fields("*")){if(!f.inScope(t.scope)||!(t.keepKeyFields&&this.keyField)&&(t.ignoreReadonlyFields&&f.readonly||t.ignoreWriteonlyFields&&f.writeonly)){r[f.name]=G.vg.isUndefined({coerce:!0});continue}p=f.name;let g;if(n!=="*"&&(g=n==null?void 0:n[p.toLowerCase()],(g==null?void 0:g.sign)==="-"||s&&!g||!s&&f.exclusive&&!g)){r[f.name]=G.vg.isUndefined({coerce:!0});continue}let d=this._generateFieldCodec(e,f,{...t,partial:t.partial==="deep"?t.partial:void 0,projection:typeof n=="object"?((c=n[p])==null?void 0:c.projection)||"*":n,currentPath:i+(i?".":"")+p});r[p]=t.partial||!f.required?G.vg.optional(d):G.vg.required(d)}return t.allowPatchOperators&&(r._$pull=G.vg.optional(G.vg.isAny()),r._$push=G.vg.optional(G.vg.isAny())),r}_generateFieldCodec(e,t,r){let i=t.type.generateCodec(e,r);return t.fixed&&(i=G.vg.isEnum([t.fixed])),t.isArray&&(i=G.vg.isArray(i)),i}};a($n,"ComplexTypeBaseClass");var Bn=$n;C.prototype=Bn.prototype;var O0=require("reflect-metadata"),mi=require("@jsopen/objects"),_a=require("ts-gems"),xa=require("valgen");var te=a(function(...o){if(!this)return te[N].apply(void 0,o);let[e,t,r]=o;O.call(this,e,t,r);let i=(0,_a.asMutable)(this);if(i.kind=u.EnumType.Kind,t.base){if(!(t.base instanceof te))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=L(t.attributes||{}),i.attributes=i.base?L(i.base.attributes):{};for(let[n,s]of Object.entries(i.ownAttributes))i.attributes[n]=s},"EnumType"),qn=class qn extends O{extendsFrom(e){var t;return e instanceof O||(e=this.node.getDataType(e)),e instanceof te?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return xa.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,mi.omitUndefined)({...t,kind:this.kind,base:r,attributes:L(this.ownAttributes)})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(qn,"EnumTypeClass");var Sr=qn;te.prototype=Sr.prototype;Object.assign(te,Sr);function Hp(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 f;let c=(f=r==null?void 0:r.meanings)==null?void 0:f[p];i[p]=(0,mi.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 f;let c=(f=r==null?void 0:r.meanings)==null?void 0:f[p];i[o[p]]=(0,mi.omitUndefined)({alias:p,description:c})})}let s={kind:u.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,h,{value:s,enumerable:!1,configurable:!0,writable:!0}),n}a(Hp,"EnumTypeFactory");te.prototype=Sr.prototype;te[N]=Hp;var ui=require("tslib"),Yn=require("valgen");var v0=require("reflect-metadata"),Vn=require("@jsopen/objects"),ga=require("ts-gems"),zn=require("valgen");function Kn(o){let e=[],t=a(function(r){let i;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!U.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(h,r)||{};o&&Object.assign(n,o),n.kind=u.SimpleType.Kind,n.name=i,Reflect.defineMetadata(h,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(Kn,"SimpleTypeDecoratorFactory");function Oa(o){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(h,e.constructor)||{},i=Reflect.getMetadata("design:type",e,t),n="string";i===Boolean?n="boolean":i===Number&&(n="number"),r.kind=u.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(h,r,e.constructor)}}a(Oa,"AttributeDecoratorFactory");var m=a(function(...o){var n,s;if(!this)return m[N](...o);let[e,t,r]=o;O.call(this,e,t,r);let i=(0,ga.asMutable)(this);if(i.kind=u.SimpleType.Kind,t.base){if(!(t.base instanceof m))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=L(t.attributes||{}),i.attributes=i.base?L(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"),Wn=class Wn extends O{extendsFrom(e){var t;return e instanceof O||(e=this.node.getDataType(e)),e instanceof m?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 zn.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 zn.isAny}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i=(0,Vn.omitUndefined)(this.ownAttributes),n;this.properties&&typeof this.properties.toJSON=="function"?n=this.properties.toJSON(this.properties,this.owner,e):n=this.properties?L(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,Vn.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(Wn,"SimpleTypeClass");var Jn=Wn;m.prototype=Jn.prototype;Object.assign(m,Kn);m[N]=Kn;m.Attribute=Oa;var St,Ir=(St=class{constructor(e){e&&Object.assign(this,e)}[E](){return Yn.vg.isBase64({coerce:!0})}[x](){return Yn.vg.isBase64({coerce:!0})}},a(St,"Base64Type"),St);Ir=(0,ui.__decorate)([m({name:"base64",description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),(0,ui.__metadata)("design:paramtypes",[Object])],Ir);var Me=require("tslib"),q=require("valgen");var It,tt=(It=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=q.vg.isDate({precision:"date",coerce:!0}),r=[];return e.minValue&&((0,q.isDateString)(e.minValue),r.push(q.toString,q.vg.isGte(e.minValue))),e.maxValue&&((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}[x](e){let t=q.vg.isDateString({precision:"date",trim:"date",coerce:!0}),r=[];return e.minValue&&((0,q.isDateString)(e.minValue),r.push(q.vg.isGte(e.minValue))),e.maxValue&&((0,q.isDateString)(e.maxValue),r.push(q.vg.isLte(e.maxValue))),r.length>0?q.vg.pipe([t,...r],{returnIndex:0}):t}},a(It,"DateType"),It);(0,Me.__decorate)([m.Attribute({description:"Minimum value"}),(0,Me.__metadata)("design:type",String)],tt.prototype,"minValue",void 0);(0,Me.__decorate)([m.Attribute({description:"Maximum value"}),(0,Me.__metadata)("design:type",String)],tt.prototype,"maxValue",void 0);tt=(0,Me.__decorate)([m({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])],tt);var ve=require("tslib"),Mr=require("valgen");var Mt,rt=(Mt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=Mr.vg.isDateString({trim:"date",coerce:!0}),r=[];return e.minValue&&r.push(Mr.vg.isGte(e.minValue)),e.maxValue&&r.push(Mr.vg.isLte(e.maxValue)),r.length>0?Mr.vg.pipe([t,...r],{returnIndex:0}):t}[x](e){return this[E](e)}},a(Mt,"DateStringType"),Mt);(0,ve.__decorate)([m.Attribute({description:"Minimum value"}),(0,ve.__metadata)("design:type",String)],rt.prototype,"minValue",void 0);(0,ve.__decorate)([m.Attribute({description:"Maximum value"}),(0,ve.__metadata)("design:type",String)],rt.prototype,"maxValue",void 0);rt=(0,ve.__decorate)([m({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,ve.__metadata)("design:paramtypes",[Object])],rt);var Fe=require("tslib"),K=require("valgen");var vt,it=(vt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=K.vg.isDate({precision:"time",coerce:!0}),r=[];return e.minValue&&((0,K.isDateString)(e.minValue),r.push(K.toString,K.vg.isGte(e.minValue))),e.maxValue&&((0,K.isDateString)(e.maxValue),r.push(K.toString,K.vg.isLte(e.maxValue))),r.length>0?K.vg.pipe([t,...r],{returnIndex:0}):t}[x](e){let t=K.vg.isDateString({precision:"time",trim:"time",coerce:!0}),r=[];return e.minValue&&((0,K.isDateString)(e.minValue),r.push(K.vg.isGte(e.minValue))),e.maxValue&&((0,K.isDateString)(e.maxValue),r.push(K.vg.isLte(e.maxValue))),r.length>0?K.vg.pipe([t,...r],{returnIndex:0}):t}},a(vt,"DateTimeType"),vt);(0,Fe.__decorate)([m.Attribute({description:"Minimum value"}),(0,Fe.__metadata)("design:type",String)],it.prototype,"minValue",void 0);(0,Fe.__decorate)([m.Attribute({description:"Maximum value"}),(0,Fe.__metadata)("design:type",String)],it.prototype,"maxValue",void 0);it=(0,Fe.__decorate)([m({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,Fe.__metadata)("design:paramtypes",[Object])],it);var Le=require("tslib"),vr=require("valgen");var Ft,ot=(Ft=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=vr.vg.isDateString({coerce:!0}),r=[];return e.minValue&&r.push(vr.vg.isGte(e.minValue)),e.maxValue&&r.push(vr.vg.isLte(e.maxValue)),r.length>0?vr.vg.pipe([t,...r]):t}[x](e){return this[E](e)}},a(Ft,"DateTimeStringType"),Ft);(0,Le.__decorate)([m.Attribute({description:"Minimum value"}),(0,Le.__metadata)("design:type",String)],ot.prototype,"minValue",void 0);(0,Le.__decorate)([m.Attribute({description:"Maximum value"}),(0,Le.__metadata)("design:type",String)],ot.prototype,"maxValue",void 0);ot=(0,Le.__decorate)([m({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])],ot);var P=require("tslib"),Gn=require("valgen");var Lt,Q=(Lt=class{constructor(e){e&&Object.assign(this,e)}[E](e){return Gn.vg.isEmail({...e,coerce:!0})}[x](e){return Gn.vg.isEmail({...e,coerce:!0})}},a(Lt,"EmailType"),Lt);(0,P.__decorate)([m.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),(0,P.__metadata)("design:type",Boolean)],Q.prototype,"allowDisplayName",void 0);(0,P.__decorate)([m.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),(0,P.__metadata)("design:type",Boolean)],Q.prototype,"requireDisplayName",void 0);(0,P.__decorate)([m.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,P.__metadata)("design:type",Boolean)],Q.prototype,"utf8LocalPart",void 0);(0,P.__decorate)([m.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),(0,P.__metadata)("design:type",Boolean)],Q.prototype,"ignoreMaxLength",void 0);(0,P.__decorate)([m.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),(0,P.__metadata)("design:type",Boolean)],Q.prototype,"allowIpDomain",void 0);(0,P.__decorate)([m.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,P.__metadata)("design:type",Boolean)],Q.prototype,"domainSpecificValidation",void 0);(0,P.__decorate)([m.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,P.__metadata)("design:type",Array)],Q.prototype,"hostBlacklist",void 0);(0,P.__decorate)([m.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,P.__metadata)("design:type",Array)],Q.prototype,"hostWhitelist",void 0);(0,P.__decorate)([m.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,P.__metadata)("design:type",String)],Q.prototype,"blacklistedChars",void 0);Q=(0,P.__decorate)([m({name:"email",description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),(0,P.__metadata)("design:paramtypes",[Object])],Q);var Pe=require("tslib"),kt=require("valgen");var Pt,V=(Pt=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,kt.validator)("decodeFieldPath",p=>i.normalizeFieldPath(p,{allowSigns:n,scope:r}));return kt.vg.pipe([kt.toString,s])}[x](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");O.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),allowSigns:e.allowSigns}}},a(Pt,"FieldPathType"),Pt);(0,Pe.__decorate)([m.Attribute({description:"Data type which field belong to"}),(0,Pe.__metadata)("design:type",Object)],V.prototype,"dataType",void 0);(0,Pe.__decorate)([m.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,Pe.__metadata)("design:type",String)],V.prototype,"allowSigns",void 0);V=(0,Pe.__decorate)([m({name:"fieldpath",description:"Field path",nameMappings:{js:"string",json:"string"}}),(0,Pe.__metadata)("design:paramtypes",[Object])],V);var ke=require("tslib"),Qn=require("valgen");var Ct={};Mi(Ct,{$and:()=>tc,$arithmetic:()=>_c,$array:()=>Ra,$date:()=>rc,$eq:()=>sc,$field:()=>nc,$gt:()=>pc,$gte:()=>cc,$ilike:()=>yc,$in:()=>mc,$like:()=>dc,$lt:()=>lc,$lte:()=>fc,$ne:()=>ac,$notILike:()=>Tc,$notIn:()=>uc,$notLike:()=>hc,$number:()=>oc,$or:()=>ec,$paren:()=>Ec,$time:()=>ic,ArithmeticExpression:()=>Ge,ArithmeticExpressionItem:()=>Qr,ArrayExpression:()=>Oe,Ast:()=>Er,BooleanLiteral:()=>Qe,ComparisonExpression:()=>Te,DateLiteral:()=>Ie,DateTimeLiteral:()=>Or,Expression:()=>$,FilterTreeVisitor:()=>wr,Literal:()=>v,LogicalExpression:()=>Ee,NegativeExpression:()=>_r,NullLiteral:()=>Xe,NumberLiteral:()=>Re,OpraErrorListener:()=>Ar,ParenthesizedExpression:()=>ge,QualifiedIdentifier:()=>ae,StringLiteral:()=>Ze,Term:()=>Ye,TimeLiteral:()=>He,parse:()=>In});function ec(...o){return new Ee({op:"or",items:o})}a(ec,"$or");function tc(...o){return new Ee({op:"and",items:o})}a(tc,"$and");function rc(o){return new Ie(o)}a(rc,"$date");function ic(o){return new He(o)}a(ic,"$time");function oc(o){return new Re(o)}a(oc,"$number");function Ra(...o){return new Oe(o.map(di))}a(Ra,"$array");function nc(o){return new ae(o)}a(nc,"$field");function sc(o,e){return ce("=",o,e)}a(sc,"$eq");function ac(o,e){return ce("!=",o,e)}a(ac,"$ne");function pc(o,e){return ce(">",o,e)}a(pc,"$gt");function cc(o,e){return ce(">=",o,e)}a(cc,"$gte");function lc(o,e){return ce("<",o,e)}a(lc,"$lt");function fc(o,e){return ce("<=",o,e)}a(fc,"$lte");function mc(o,e){return ce("in",o,e)}a(mc,"$in");function uc(o,e){return ce("!in",o,e)}a(uc,"$notIn");function dc(o,e){return ce("like",o,e)}a(dc,"$like");function hc(o,e){return ce("!like",o,e)}a(hc,"$notLike");function yc(o,e){return ce("ilike",o,e)}a(yc,"$ilike");function Tc(o,e){return ce("!ilike",o,e)}a(Tc,"$notILike");function Ec(o){return new ge(o)}a(Ec,"$paren");function _c(o){let e=new Ge;return e.add=t=>(e.append("+",jt(t)),e),e.sub=t=>(e.append("-",jt(t)),e),e.mul=t=>(e.append("*",jt(t)),e),e.div=t=>(e.append("/",jt(t)),e),e.append("+",di(o)),e}a(_c,"$arithmetic");function ce(o,e,t){let r=typeof e=="string"?new ae(e):di(e),i=di(t);return new Te({op:o,left:r,right:i})}a(ce,"comparisonExpression");var di=a(o=>Array.isArray(o)?Ra(...o.map(jt)):jt(o),"wrapEntryValue"),jt=a(o=>o instanceof $?o:typeof o=="boolean"?new Qe(o):typeof o=="number"||typeof o=="bigint"?new Re(o):o==null?new Xe:o instanceof Date?new Ie(o):new Ze(""+o),"_wrapEntryValue");var Ut,we=(Ut=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 _t(e.rules):void 0;return xc(r,i)}[x](){return Oc}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");O.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),rules:e.rules}}},a(Ut,"FilterType"),Ut);(0,ke.__decorate)([m.Attribute({description:"Data type which filtering fields belong to"}),(0,ke.__metadata)("design:type",Object)],we.prototype,"dataType",void 0);(0,ke.__decorate)([m.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),(0,ke.__metadata)("design:type",Object)],we.prototype,"rules",void 0);we=(0,ke.__decorate)([m({name:"filter",description:"A query filter",nameMappings:{js:"object",json:"string"}}),(0,ke.__metadata)("design:paramtypes",[Object])],we);var xc=a((o,e,t)=>(0,Qn.validator)("decodeFilter",(r,i,n)=>{if(typeof r=="string")try{let s=Ct.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"),Oc=(0,Qn.validator)("encodeFilter",(o,e,t)=>{if(o instanceof Ct.Ast)return o.toString();e.fail(t,"Not a valid filter expression",o)});var hi=require("tslib"),Xn=require("valgen");var Bt,Fr=(Bt=class{constructor(e){e&&Object.assign(this,e)}[E](){return Xn.vg.isObjectId({coerce:!0})}[x](){return Xn.vg.isObjectId({coerce:!0})}},a(Bt,"ObjectIdType"),Bt);Fr=(0,hi.__decorate)([m({name:"ObjectId",description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),(0,hi.__metadata)("design:paramtypes",[Object])],Fr);var k=require("tslib");var Hn=require("@jsopen/objects"),Aa=require("ts-gems");var wa=require("@jsopen/objects");function Zn(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(h,r.constructor)||{};n.kind=u.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(h,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,wa.omitUndefined)({...i,scopePattern:Array.isArray(r)?r:[r],type:void 0,isArray:void 0,isNestedEntity:void 0}))}),t),t}a(Zn,"ApiFieldDecoratorFactory");var j=a(function(...o){if(!this){let[n]=o;return j[N](n)}let[e,t]=o;w.call(this,e);let r=(0,Aa.asMutable)(this);r.name=t.name;let i=t.origin||e;if(!(i instanceof C))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"),ts=class ts extends w{inScope(e){return Nr(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(Nr(e,r.scopePattern)){t=(0,Hn.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,Hn.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(ts,"ApiFieldClass");var es=ts;j.prototype=es.prototype;Object.assign(j,Zn);j[N]=Zn;var ry=require("reflect-metadata"),Da=require("@jsopen/objects"),Na=require("ts-gems");var rs=class rs extends he{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};a(rs,"OpraDocumentError");var nt=rs;var is=class is{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(is,"DocumentInitContext");var ue=is;var ba=require("@jsopen/objects");function os(o){return function(e){let t;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!U.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(h,e);r||(r={},Reflect.defineMetadata(h,r,e)),r.kind=u.ComplexType.Kind,r.name=t,o&&Object.assign(r,(0,ba.omit)(o,["name"]))}}a(os,"ComplexTypeDecorator");var re=a(function(...o){var n;if(!this)return re[N].apply(void 0,o);let[e,t]=o,r=o[2]||new ue({maxErrors:0});C.call(this,e,t,r);let i=(0,Na.asMutable)(this);i.kind=u.ComplexType.Kind,t.base&&r.enter(".base",()=>{if(!(t.base instanceof C))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 j(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 j(this,{...p,name:s});this._fields.set(c.name,c)}})},"ComplexType"),ss=class ss extends C{extendsFrom(e){var t;return e instanceof O||(e=this.node.getDataType(e)),e instanceof C?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};if(this.additionalFields)if(this.additionalFields instanceof O){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,Da.omitUndefined)(i)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(ss,"ComplexTypeClass");var ns=ss;re.prototype=ns.prototype;Object.assign(re,os);re[N]=os;var $t,X=($t=class{constructor(e){e&&Object.assign(this,e)}},a($t,"OperationResult"),$t);(0,k.__decorate)([j(),(0,k.__metadata)("design:type",Number)],X.prototype,"affected",void 0);(0,k.__decorate)([j(),(0,k.__metadata)("design:type",Number)],X.prototype,"totalMatches",void 0);(0,k.__decorate)([j(),(0,k.__metadata)("design:type",String)],X.prototype,"context",void 0);(0,k.__decorate)([j(),(0,k.__metadata)("design:type",String)],X.prototype,"type",void 0);(0,k.__decorate)([j(),(0,k.__metadata)("design:type",String)],X.prototype,"message",void 0);(0,k.__decorate)([j({type:"any"}),(0,k.__metadata)("design:type",Object)],X.prototype,"payload",void 0);(0,k.__decorate)([j({type:"object"}),(0,k.__metadata)("design:type",Array)],X.prototype,"errors",void 0);X=(0,k.__decorate)([re({name:"OperationResult",description:"Operation result"}),(0,k.__metadata)("design:paramtypes",[Object])],X);(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)([j({type:t,required:!0}),(0,k.__metadata)("design:type",Object)],r.prototype,"payload",void 0),r=(0,k.__decorate)([re({embedded:!0}),(0,k.__metadata)("design:paramtypes",[Object])],r),r}a(e,"forPayload"),o.forPayload=e})(X||(X={}));var je=require("tslib"),Lr=require("valgen");var gc=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,qt,st=(qt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=Lr.vg.matches(gc,{formatName:"time",coerce:!0}),r=[];return e.minValue&&r.push(Lr.vg.isGte(e.minValue)),e.maxValue&&r.push(Lr.vg.isLte(e.maxValue)),r.length>0?Lr.vg.pipe([t,...r],{returnIndex:0}):t}[x](e){return this[E](e)}},a(qt,"TimeType"),qt);(0,je.__decorate)([m.Attribute({description:"Minimum value"}),(0,je.__metadata)("design:type",String)],st.prototype,"minValue",void 0);(0,je.__decorate)([m.Attribute({description:"Maximum value"}),(0,je.__metadata)("design:type",String)],st.prototype,"maxValue",void 0);st=(0,je.__decorate)([m({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,je.__metadata)("design:paramtypes",[Object])],st);var yi=require("tslib"),as=require("valgen");var Kt,Pr=(Kt=class{constructor(e){e&&Object.assign(this,e)}[E](){return as.vg.isURL({coerce:!0})}[x](){return as.vg.isURL({coerce:!0})}},a(Kt,"UrlType"),Kt);Pr=(0,yi.__decorate)([m({name:"url",description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),(0,yi.__metadata)("design:paramtypes",[Object])],Pr);var Jt=require("tslib"),ps=require("valgen");var Vt,zt=(Vt=class{constructor(e){e&&Object.assign(this,e)}[E](e){return ps.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}[x](e){return ps.vg.isUUID(e==null?void 0:e.version,{coerce:!0})}},a(Vt,"UuidType"),Vt);(0,Jt.__decorate)([m.Attribute({description:"Version of the UUID"}),(0,Jt.__metadata)("design:type",Number)],zt.prototype,"version",void 0);zt=(0,Jt.__decorate)([m({name:"uuid",description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),(0,Jt.__metadata)("design:paramtypes",[Object])],zt);var Ma=lr(require("path-browserify"),1),va=require("@jsopen/objects"),Fa=require("ts-gems");var Sa,Ia,le=Symbol.for("kMap"),kr=Symbol.for("kCtorMap"),cs=class cs{constructor(){this[Sa]=new M,this[Ia]=new WeakMap}get size(){return this[le].size}forEach(e,t){this[le].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[kr].get(e);if(!t&&typeof e=="function"){let i=Reflect.getMetadata(h,e);t=i==null?void 0:i.name}if(!t&&typeof e=="object"){let i=e[h];t=i==null?void 0:i.name}if(!t)return;let r=this[le].get(t);if(r)return typeof e=="function"&&r.kind==="ComplexType"?r.ctor===e?r:void 0:r}set(e,t){this[le].set(e,t),t.ctor?this[kr].set(t.ctor,e):t.instance&&this[kr].set(t.instance,e)}has(e){if(e instanceof O)return!!e.name&&this[le].has(e.name);let t=typeof e=="string"?e:this[kr].get(e);return t?this[le].has(t):!1}keys(){return this[le].keys()}values(){return this[le].values()}entries(){return this[le].entries()}sort(e){return this[le].sort(e),this}[(Sa=le,Ia=kr,Symbol.iterator)](){return this[le][Symbol.iterator]()}};a(cs,"DataTypeMap");var ie=cs;function I(o,e){let t=a((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={...e,kind:u.HttpOperation.Kind},s=Reflect.getOwnMetadata(ne,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let p of o)p(n);Reflect.defineMetadata(ne,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||b.opra_response_json,n.contentEncoding=n.contentEncoding||"utf-8"),n.contentType===b.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||b.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(I,"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(w.call(this,e),!U.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,Fa.asMutable)(this);r.parameters=[],r.responses=[],r.types=r.node[B]=new ie,r.name=t.name,r.path=t.path,r.mergePath=t.mergePath,r.method=t.method||"GET",r.description=t.description,r.composition=t.composition,r.compositionOptions=t.compositionOptions?L(t.compositionOptions):void 0},"HttpOperation"),fs=class fs extends w{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:Ma.default.posix.join(e,this.path):e:this.path||"/"}toJSON(e){var r;let t=(0,va.omitUndefined)({kind:u.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(fs,"HttpOperationClass");var ls=fs;A.prototype=ls.prototype;A[N]=I;A.GET=function(o){return I([],{...o,method:"GET"})};A.DELETE=function(o){return I([],{...o,method:"DELETE"})};A.HEAD=function(o){return I([],{...o,method:"HEAD"})};A.OPTIONS=function(o){return I([],{...o,method:"OPTIONS"})};A.PATCH=function(o){return I([],{...o,method:"PATCH"})};A.POST=function(o){return I([],{...o,method:"POST"})};A.PUT=function(o){return I([],{...o,method:"PUT"})};A.SEARCH=function(o){return I([],{...o,method:"SEARCH"})};A.Entity={};function z(o){if(typeof o=="string")return o;let e=Reflect.getMetadata(h,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(z,"getDataTypeName");function Ce(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(Ce,"createKeyParamDecorator");function La(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=Nt.exec(p),f=Nt.exec(r[p]);return c&&f&&(s[c[2]]=f[2]),s},{}),n=Object.keys(r).reduce((s,p)=>{let c=Nt.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:te(n),isArray:!0,arraySeparator:",",parser:a(s=>s.map(p=>{let c=Nt.exec(p);return c?(c[1]||"")+i[c[2]]:p}),"parser")}),o}}a(La,"createSortFieldsDecorator");function Ue(o,e,t){let r=Reflect.getMetadata("FilterRules",o);r||(r=new _t,Reflect.defineMetadata("FilterRules",r,o));let i=Reflect.getMetadata("FilterType",o);return i||(i=new we({dataType:t}),i.rules={},Reflect.defineMetadata("FilterType",i,o)),(n,s)=>{let p=(Array.isArray(s)?{operators:s}:typeof s=="string"?{operators:[s]}:s)||{};return e.push(()=>{r.set(n,p),i.rules=r.toJSON()}),o.QueryParam("filter",{type:i,description:"Determines filter fields"}),o}}a(Ue,"createFilterDecorator");A.Entity.Create=function(o,e){var n;let t;typeof o=="object"&&!o[h]?t=o:t={...e,type:o};let r=[],i=I(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new V({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:b.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:b.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=z(t.type)}),i};A.Entity.Delete=function(o,e){let t;typeof o=="object"&&!o[h]?t=o:t={...e,type:o};let r=[],i=I(r,{method:"DELETE",...t,composition:"Entity.Delete"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=Ce(i,r),i};A.Entity.DeleteMany=function(o,e){let t;typeof o=="object"&&!o[h]?t=o:t={...e,type:o};let r=[],i=I(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.Filter=Ue(i,r,t.type),i};var Ti=require("tslib"),ms=require("valgen");var Wt,jr=(Wt=class{constructor(e){e&&Object.assign(this,e)}[E](){return ms.isAny}[x](){return ms.isAny}},a(Wt,"AnyType"),Wt);jr=(0,Ti.__decorate)([m({name:"any",description:"Represents any value"}),(0,Ti.__metadata)("design:paramtypes",[Object])],jr);var Ei=require("tslib"),pt=require("valgen");var Be=require("tslib"),at=require("valgen");var Yt,de=(Yt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=[];return e.minValue&&t.push(at.vg.isGte(e.minValue)),e.maxValue&&t.push(at.vg.isLte(e.maxValue)),t.length>0?at.vg.pipe([at.toNumber,...t],{returnIndex:0}):at.toNumber}[x](e){return this[E](e)}},a(Yt,"NumberType"),Yt);(0,Be.__decorate)([m.Attribute({description:"Determines the minimum value"}),(0,Be.__metadata)("design:type",Number)],de.prototype,"minValue",void 0);(0,Be.__decorate)([m.Attribute({description:"Determines the maximum value"}),(0,Be.__metadata)("design:type",Number)],de.prototype,"maxValue",void 0);de=(0,Be.__decorate)([m({name:"number",description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),(0,Be.__metadata)("design:paramtypes",[Object])],de);var Gt,Cr=(Gt=class extends de{constructor(e){super(e)}[E](e){let t=[];return e.minValue&&t.push(pt.vg.isGte(e.minValue)),e.maxValue&&t.push(pt.vg.isLte(e.maxValue)),t.length>0?pt.vg.pipe([pt.toBigint,...t],{returnIndex:0}):pt.toBigint}[x](e){return this[E](e)}},a(Gt,"BigintType"),Gt);Cr=(0,Ei.__decorate)([m({name:"bigint",description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),(0,Ei.__metadata)("design:paramtypes",[Object])],Cr);var _i=require("tslib"),us=require("valgen");var Qt,Ur=(Qt=class{constructor(e){e&&Object.assign(this,e)}[E](){return us.toBoolean}[x](){return us.toBoolean}},a(Qt,"BooleanType"),Qt);Ur=(0,_i.__decorate)([m({name:"boolean",description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),(0,_i.__metadata)("design:paramtypes",[Object])],Ur);var xi=require("tslib"),ct=require("valgen");var Xt,$e=(Xt=class extends de{constructor(e){super(e)}[E](e){let t=[];return e.minValue&&t.push(ct.vg.isGte(e.minValue)),e.maxValue&&t.push(ct.vg.isLte(e.maxValue)),t.length>0?ct.vg.pipe([ct.toInteger,...t],{returnIndex:0}):ct.toInteger}[x](e){return this[E](e)}},a(Xt,"IntegerType"),Xt);$e=(0,xi.__decorate)([m({name:"integer",description:"An integer number",nameMappings:{js:"number",json:"number"}}),(0,xi.__metadata)("design:paramtypes",[Object])],$e);var Oi=require("tslib"),ds=require("valgen");var Zt,Br=(Zt=class{constructor(e){e&&Object.assign(this,e)}[E](){return ds.isNull}[x](){return ds.isNull}},a(Zt,"NullType"),Zt);Br=(0,Oi.__decorate)([m({name:"null",description:"A Null value",nameMappings:{js:"null",json:"null"}}),(0,Oi.__metadata)("design:paramtypes",[Object])],Br);var gi=require("tslib");var Ht,$r=(Ht=class{constructor(e){e&&Object.assign(this,e)}},a(Ht,"ObjectType"),Ht);$r=(0,gi.__decorate)([re({name:"object",description:"A non modelled object",additionalFields:!0}),(0,gi.__metadata)("design:paramtypes",[Object])],$r);var fe=require("tslib"),qe=require("valgen");var er,Ae=(er=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(h,Object.getPrototypeOf(this).constructor).name),t.push(qe.vg.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(qe.vg.lengthMin(e.minLength)),e.maxLength&&t.push(qe.vg.lengthMax(e.maxLength)),t.length>0?qe.vg.pipe([qe.toString,...t],{returnIndex:0}):qe.toString}[x](e){return this[E](e)}},a(er,"StringType"),er);(0,fe.__decorate)([m.Attribute({description:"Regex pattern to be used for validation"}),(0,fe.__metadata)("design:type",Object)],Ae.prototype,"pattern",void 0);(0,fe.__decorate)([m.Attribute({description:"Name of the pattern"}),(0,fe.__metadata)("design:type",String)],Ae.prototype,"patternName",void 0);(0,fe.__decorate)([m.Attribute({description:"Minimum number of characters"}),(0,fe.__metadata)("design:type",Number)],Ae.prototype,"minLength",void 0);(0,fe.__decorate)([m.Attribute({description:"Minimum number of characters"}),(0,fe.__metadata)("design:type",Number)],Ae.prototype,"maxLength",void 0);Ae=(0,fe.__decorate)([m({name:"string",description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),(0,fe.__metadata)("design:paramtypes",[Object])],Ae);A.Entity.FindMany=function(o,e){let t;typeof o=="object"&&!o[h]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}).QueryParam("limit",{description:"Determines number of returning instances",type:new $e({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new $e({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new V({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type),t.defaultLimit&&(s.defaultLimit=t.defaultLimit),t.defaultProjection&&(s.defaultProjection=t.defaultProjection),t.maxLimit&&(s.maxLimit=t.maxLimit)}),i.Filter=Ue(i,r,t.type),i.DefaultSort=(...n)=>(r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.defaultSort=n}),i),i.SortFields=La(i,r),i};A.Entity.Get=function(o,e){let t;typeof o=="object"&&!o[h]?t=o:t={...e,type:o};let r=[],i=I(r,{method:"GET",...t,composition:"Entity.Get"});return i.QueryParam("projection",{description:"Determines fields projection",type:new V({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:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=Ce(i,r),i};A.Entity.Replace=function(o,e){let t;typeof o=="object"&&!o[h]?t=o:t={...e,type:o};let r=[],i=I(r,{method:"POST",...t,composition:"Entity.Replace"});return i.QueryParam("projection",{description:"Determines fields projection",type:new V({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:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=Ce(i,r),i};A.Entity.Update=function(o,e){var n;let t;typeof o=="object"&&!o[h]?t=o:t={...e,type:o};let r=[],i=I(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 V({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:b.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:b.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=z(t.type)}),i.KeyParam=Ce(i,r),i.Filter=Ue(i,r,t.type),i};A.Entity.UpdateMany=function(o,e){var n;let t;typeof o=="object"&&!o[h]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=z(t.type)}),i.Filter=Ue(i,r,t.type),i};var Ri=require("@jsopen/objects");var Rc=/^(.*)(Controller)$/,Pa=[];function tr(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=Rc.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(se,Object.getPrototypeOf(r));s&&(0,Ri.merge)(n,s,{deep:!0});let p=Reflect.getOwnMetadata(se,r);p&&(0,Ri.merge)(n,p,{deep:!0}),(0,Ri.merge)(n,{...o,kind:u.RpcController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(se,n,r);for(let f of e)f(n,r);Reflect.defineMetadata(se,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),Pa.forEach(r=>r(t,e,o)),t}a(tr,"RpcControllerDecoratorFactory");tr.augment=function(o){Pa.push(o)};var ka=require("@jsopen/objects");var ja=[];function qr(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:u.RpcOperation.Kind,channel:s,payloadType:e,...(0,ka.omit)(t,["kind","payloadType"])},c=Reflect.getOwnMetadata(se,n.constructor)||{};c.operations=c.operations||{},c.operations[s]=p;for(let f of o)f(p,n,s);Reflect.defineMetadata(se,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},f=r?p.response:p;f.headers?f.headers=f.headers.filter(g=>String(g.name)!==String(n)):f.headers=[],f.headers.push(c)}),i),i.Response=(n,s)=>(o.push(p=>{r=!0,p.response={...s,payloadType:n}}),i),ja.forEach(n=>n(i,o,e,t)),i}a(qr,"RpcOperationDecoratorFactory");qr.augment=function(o){ja.push(o)};var r3=require("reflect-metadata"),Ca=require("@jsopen/objects"),Ua=require("ts-gems");function wi(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(wi,"getIsInheritedPredicateFn");var Ke=a(function(...o){var n;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;C.call(this,e,t,r);let i=(0,Ua.asMutable)(this);if(i.kind=u.MappedType.Kind,t.base){if(!(t.base instanceof C))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(f=>i.base.normalizeFieldPath(f)):t.omit?i.omit=t.omit.map(f=>i.base.normalizeFieldPath(f)):t.partial?i.partial=Array.isArray(t.partial)?t.partial.map(f=>i.base.normalizeFieldPath(f)):t.partial:t.required&&(i.required=Array.isArray(t.required)?t.required.map(f=>i.base.normalizeFieldPath(f)):t.required);let s=wi(i.pick,i.omit),p=Array.isArray(i.partial)?i.partial.map(f=>f.toLowerCase()):i.partial,c=Array.isArray(i.required)?i.required.map(f=>f.toLowerCase()):i.required;for(let[f,g]of i.base.fieldEntries()){if(!s(f))continue;let d={...g};p===!0||Array.isArray(p)&&p.includes(g.name.toLowerCase())?d.required=!1:(c===!0||Array.isArray(c)&&c.includes(g.name.toLowerCase()))&&(d.required=!0);let Z=new j(this,d);i._fields.set(Z.name,Z)}(!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)}},"MappedType"),ys=class ys extends C{extendsFrom(e){var t;return e instanceof O||(e=this.node.getDataType(e)),e instanceof C?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,Ca.omitUndefined)({...t,base:r||this.base.toJSON(e),kind:this.kind,pick:this.pick,omit:this.omit,partial:this.partial,required:this.required})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(ys,"MappedTypeClass");var hs=ys;Ke.prototype=hs.prototype;Ke._applyMixin=()=>{};var l3=require("reflect-metadata"),Ba=require("@jsopen/objects"),$a=require("ts-gems");var lt=a(function(...o){if(!this)return lt[N].apply(void 0,o);let[e,t,r]=o;C.call(this,e,t,r);let i=(0,$a.asMutable)(this);i.kind=u.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 j(this,s);i._fields.set(p.name,p)}i.types.push(n),n.keyField&&(i.keyField=n.keyField)}},"MixinType"),Es=class Es extends C{extendsFrom(e){if(e instanceof O||(e=this.node.getDataType(e)),!(e instanceof C))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,Ba.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(Es,"MixinTypeClass");var Ts=Es;lt.prototype=Ts.prototype;lt[N]=bc;function bc(...o){let e=o.filter(s=>typeof s=="function"),t=typeof o[o.length-1]=="object"?o[o.length-1]:void 0;if(!e.length)throw new TypeError("No Class has been provided");if(e.length===1)return e[0];let r=e[0].name+"Mixin",i={[r]:class{constructor(){for(let s of e)hr(this,s)}}}[r],n={...t,kind:u.MixinType.Kind,types:[]};Reflect.defineMetadata(h,n,i);for(let s of e){let p=Reflect.getMetadata(h,s);if(!(p&&(p.kind===u.ComplexType.Kind||p.kind===u.MixinType.Kind||p.kind===u.MappedType.Kind)))throw new TypeError(`Class "${s.name}" is not a ${u.ComplexType.Kind}, ${u.MixinType.Kind} or ${u.MappedType.Kind}`);n.types.push(s),dr(i.prototype,s.prototype)}return i}a(bc,"MixinTypeFactory");var _s=Symbol("initializing"),Ai=class Ai{static async createDataType(e,t,r){e=e||new ue({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 Ai.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 ue({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,f]of n.entries())e.enter(`[${c}]`,()=>{if(!n.has(c))return;let g=this._createDataType(s,t,f);g&&p.push(g)});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 me(c);let f=Reflect.getMetadata(h,c)||c[h];if(!(f&&f.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(f.name,c)})}else{let p,c;for([c,p]of Object.entries(r))p=await me(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){var g;r=await me(r);let{importQueue:i,initArgsMap:n}=e,s=t.node.findDataType(r);if(s instanceof O)return s.name;let p,c,f;if(typeof r!="string"){let Z=t.node.getDocument().types[yr].get(r);Z&&(r=Z)}if(typeof r=="string"){let d=r;if(r=(i==null?void 0:i.get(d))||((g=e.initArgsMap)==null?void 0:g.get(d)),!r)return e.addError(`Unknown data type (${d})`)}if(typeof r=="function"){if(p=Reflect.getMetadata(h,r),!p)return e.addError(`Class "${r.name}" doesn't have a valid DataType metadata`);c=r}else if(typeof r=="object"){if(p=r[h],p)f=r,p.kind!==u.EnumType.Kind&&(p=void 0);else if(u.isDataType(r))p=r,c=p.ctor;else if(c=Object.getPrototypeOf(r).constructor,p=c&&Reflect.getMetadata(h,c),p&&p.kind===u.SimpleType.Kind){let d=await this._importDataTypeArgs(e,t,p.name);return d?typeof d=="object"&&d.kind!==u.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:u.SimpleType.Kind,name:void 0,base:d,properties:r}:void 0}}return p?e.enterAsync(p.name?`[${p.name}]`:"",async()=>{if(p.name){let Z=n==null?void 0:n.get(p.name);if(Z)return Z[_s]?e.addError("Circular reference detected"):p.name}let d={kind:p.kind,name:p.name};d[_s]=!0;try{if(d.name)if(i!=null&&i.has(d.name))n==null||n.set(p.name,d),d._instance={name:p.name},d[B]=t.node[B];else return e.addError(`Data Type (${d.name}) must be explicitly added to type list in the document scope`);switch(d.kind){case u.ComplexType.Kind:d.ctor=c,await this._prepareComplexTypeArgs(e,t,d,p);break;case u.EnumType.Kind:d.instance=f,await this._prepareEnumTypeArgs(e,t,d,p);break;case u.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,d,p);break;case u.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,d,p);break;case u.SimpleType.Kind:d.ctor=c,await this._prepareSimpleTypeArgs(e,t,d,p);break;default:return e.addError(`Invalid data type kind ${p.kind}`)}}finally{d.name&&(i==null||i.delete(d.name)),delete d[_s]}return i&&d.name?d.name:d}):e.addError("No DataType metadata found")}static async _prepareDataTypeArgs(e,t,r){t.description=r.description,t.abstract=r.abstract,t.examples=r.examples,t.scopePattern=r.scopePattern}static async _prepareComplexTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.keyField=i.keyField,await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(h,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=ft(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=ft(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:ft(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=ft(n))}),r.attributes=L(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 f;if(i.base)f=await this._importDataTypeArgs(e,t,i.base);else if(r.ctor){let g=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(h,g)&&(f=await this._importDataTypeArgs(e,t,g))}f&&(r.base=ft(f),r.ctor=r.ctor||f.ctor)}),r.properties=i.properties,r.nameMappings=i.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),i.attributes&&(r.attributes=L(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[x])=="function"&&(r.generateEncoder=(c=r.properties)==null?void 0:c[x].bind(r.properties))}static async _prepareMappedTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(h,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=ft(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(ft(c))})})}static _createDataType(e,t,r){var s;let i=t.node.findDataType(typeof r=="string"?r:r.name||"");if(i instanceof O)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 u.ComplexType.Kind:return this._createComplexType(e,t,n);case u.EnumType.Kind:return this._createEnumType(e,t,n);case u.MappedType.Kind:return this._createMappedType(e,t,n);case u.MixinType.Kind:return this._createMixinType(e,t,n);case u.SimpleType.Kind:return this._createSimpleType(e,t,n);default:break}}e.addError(`Unknown data type (${String(r)})`)}static _createComplexType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,re.prototype);let n=L(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})})}),re.apply(i,[t,n]),i}static _createEnumType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,te.prototype);let n=L(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),n.attributes=r.attributes,te.apply(i,[t,n]),i}static _createMappedType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Ke.prototype);let n=L(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),Ke.apply(i,[t,n]),i}static _createMixinType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,lt.prototype);let n=L(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 C))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,m.prototype);let n=L(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),m.apply(i,[t,n]),i}};a(Ai,"DataTypeFactory");var F=Ai;function ft(o){return typeof o=="object"&&o.name?o.name:o}a(ft,"preferName");var rp=require("@jsopen/objects");var qa=require("@jsopen/objects");var xs=class xs extends w{constructor(e){super(e.owner),this.name="OpraApi",this.name=e.name,this.description=e.description}toJSON(e){return(0,qa.omitUndefined)({transport:this.transport,name:this.name,description:this.description})}async _initialize(e,t){if(!U.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};a(xs,"ApiBase");var mt=xs;var Ka=lr(require("path-browserify"),1),Va=require("@jsopen/objects"),za=require("ts-gems");var rr=require("@jsopen/objects");var Nc=/^(.*)(Controller)$/;function Os(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=Nc.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(ne,Object.getPrototypeOf(r));s&&(0,rr.merge)(n,s,{deep:!0});let p=Reflect.getOwnMetadata(ne,r);p&&(0,rr.merge)(n,p,{deep:!0}),(0,rr.merge)(n,{kind:u.HttpController.Kind,name:i,path:i,...(0,rr.omit)(o,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(ne,n,r);for(let f of e)f(n,r);Reflect.defineMetadata(ne,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(Os,"HttpControllerDecoratorFactory");var oe=a(function(...o){var i;if(!this)return oe[N].apply(void 0,o);let[e,t]=o;if(w.call(this,e),!U.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,za.asMutable)(this);r.kind=u.HttpController.Kind,r.types=r.node[B]=new ie,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"),Rs=class Rs extends w{get isRoot(){return!(this.owner instanceof oe)}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 oe)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return Ka.default.posix.join(this.owner instanceof oe?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(e){let t=(0,Va.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}[At](){return`[${bt}HttpController${Dt+this.name+et}]`}};a(Rs,"HttpControllerClass");var gs=Rs;oe.prototype=gs.prototype;Object.assign(oe,Os);oe[N]=Os;var ws=class ws extends mt{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="http",this.controllers=new M,this.url=e.url}findController(e){return oe.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(ws,"HttpApi");var ut=ws;var Ja=lr(require("@browsery/type-is"),1),Wa=require("@jsopen/objects"),Ya=require("ts-gems"),bi=require("valgen");var be=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');w.call(this,o);let t=(0,Ya.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 O?e.type:t.owner.node.getDataType(e.type)),t.isArray=e.isArray},"HttpMediaType"),bs=class bs extends w{findMultipartField(e,t){if(this.multipartFields){for(let r of this.multipartFields)if((!t||t===r.fieldType)&&(r.fieldName instanceof RegExp&&r.fieldName.test(e)||r.fieldName===e))return r}}toJSON(e){var i,n;let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0,r=(0,Wa.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=>Ja.default.is(n,["json"]))&&(r=this.node.findDataType("object").generateCodec(e)),r=r||bi.isAny,this.isArray?bi.vg.isArray(r):r}};a(bs,"HttpMediaTypeClass");var As=bs;be.prototype=As.prototype;var Ga=require("@jsopen/objects");function ir(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(ir,"parseRegExp");var Ds=class Ds extends be{constructor(e,t){super(e,t),this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?ir(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(e){return(0,Ga.omitUndefined)({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON(e)})}};a(Ds,"HttpMultipartField");var Kr=Ds;var Qa=require("@jsopen/objects");var Sc=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,Ns=class Ns{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=Sc.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(Ns,"HttpStatusRange");var or=Ns;var Ss=class Ss extends be{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new or(r.start,r.end):new or(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,Qa.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(Ss,"HttpOperationResponse");var Vr=Ss;var Ha=require("@jsopen/objects"),ep=require("ts-gems");var Xa=require("@jsopen/objects"),Za=require("ts-gems");var dt=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');w.call(this,o);let t=(0,Za.asMutable)(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),Ms=class Ms extends w{toJSON(e){let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return(0,Xa.omitUndefined)({type:this.type?t||this.type.toJSON(e):"any",description:this.description,isArray:this.isArray,examples:this.examples})}};a(Ms,"ValueClass");var Is=Ms;dt.prototype=Is.prototype;var nr=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,ep.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?ir(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"),Fs=class Fs extends dt{toJSON(e){return(0,Ha.omitUndefined)({...super.toJSON(e),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}};a(Fs,"HttpParameterClass");var vs=Fs;nr.prototype=vs.prototype;var tp=require("@jsopen/objects");var Ls=class Ls extends w{constructor(e){super(e),this.content=[]}toJSON(e){return(0,tp.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(Ls,"HttpRequestBody");var zr=Ls;var Ps=class Ps{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,rp.isConstructor)(r)&&(r=t instanceof oe?r(t.instance):r()),r=await me(r);let i,n,s;if(typeof r=="function"){if(n=Reflect.getMetadata(ne,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(ne,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 oe(t,{...r,instance:i,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await F.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 f={...c};await e.enterAsync(".type",async()=>{f.type=await F.resolveDataType(e,s,c.type)});let g=new nr(s,f);s.parameters.push(g)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[p,c]of Object.entries(r.operations))await e.enterAsync(`[${p}]`,async()=>{let f=new A(s,{name:p,method:"GET"});await this._initHttpOperation(e,f,c),s.operations.set(p,f)})}),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 F.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 F.resolveDataType(e,t,s.type)});let c=new nr(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 Vr(t,{statusCode:s.statusCode});await this._initHttpOperationResponse(e,p,s),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let n=new zr(t);await this._initHttpRequestBody(e,n,r.requestBody),t.requestBody=n}),t}static async _initHttpMediaType(e,t,r){be.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{t.type=await F.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 Kr(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 F.resolveDataType(e,t,n.type)});let p=new nr(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 be(t,String(i));await this._initHttpMediaType(e,s,n),t.content.push(s)})})}};a(Ps,"HttpApiFactory");var sr=Ps;var op=require("@jsopen/objects"),np=require("super-fast-md5");var ks=class ks 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(ks,"RpcApi");var ht=ks;var ip,js=class js extends w{constructor(){super(null),this[ip]=new WeakMap,this.id="",this.info={},this.references=new M,this.types=new ie,this.node[B]=this.types,this.node.findDataType=this._findDataType.bind(this)}getDataTypeNs(e){let t=e instanceof O?this._findDataType(e.name||""):this._findDataType(e);if(t)return this[xe].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,op.omitUndefined)({spec:u.SpecVersion,id:this.id,url:this.url,info:L(this.info,!0)});if(this.references.size){let r=0,i={};for(let[n,s]of this.references.entries())s[De]||(i[n]={id:s.id,url:s.url,info:L(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,np.md5)(JSON.stringify(e)),this[xe]=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=ao.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[xe].set(i,p!=null&&p[De]?"":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[xe].set(i,p!=null&&p[De]?"":s),i}}};a(js,"ApiDocument");var Ve=js;ip=xe;function ze(o,e,t){let r=wi(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"&&hr(this,o,r)}}}[n];if(typeof o=="function"&&dr(s.prototype,o.prototype),typeof o=="function"){let c=Reflect.getOwnMetadata(h,o);if(!c)throw new TypeError(`Class "${o}" doesn't have datatype metadata information`);if(!(c.kind===u.ComplexType.Kind||c.kind===u.MappedType.Kind||c.kind===u.MixinType.Kind))throw new TypeError(`Class "${o}" is not a ${u.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(h,p,s),typeof o=="function"&&Ke._applyMixin(s,o,{...e,isInheritedPredicate:r}),s}a(ze,"createMappedClass");function Mc(o,e,t){return ze(o,{omit:e},t)}a(Mc,"OmitType");function vc(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return ze(o,{partial:t},r)}a(vc,"PartialType");function Fc(o,e,t){return ze(o,{pick:e},t)}a(Fc,"PickType");function Lc(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return ze(o,{required:t},r)}a(Lc,"RequiredType");var up=require("@jsopen/objects");var sp=require("@jsopen/objects"),ap=require("ts-gems");var Je=a(function(...o){var i;if(!this)return Je[N].apply(void 0,o);let[e,t]=o;if(w.call(this,e),!U.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=(0,ap.asMutable)(this);r.kind=u.RpcController.Kind,r.types=r.node[B]=new ie,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"),Us=class Us extends w{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 Je)return this.node.parent.element.findHeader(e,t)}toString(){return`[RpcController ${this.name}]`}toJSON(){let e=(0,sp.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}[At](){return`[${bt}RpcController${Dt+this.name+et}]`}};a(Us,"RpcControllerClass");var Cs=Us;Je.prototype=Cs.prototype;Object.assign(Je,tr);Je[N]=tr;var pp=require("@jsopen/objects"),cp=require("ts-gems");var ar=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,cp.asMutable)(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?ir(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.deprecated=e.deprecated,t.required=e.required},"RpcHeader"),$s=class $s extends dt{toJSON(){return(0,pp.omitUndefined)({...super.toJSON(),name:this.name,required:this.required,deprecated:this.deprecated})}};a($s,"RpcHeaderClass");var Bs=$s;ar.prototype=Bs.prototype;var lp=require("@jsopen/objects"),fp=require("ts-gems");var pr=a(function(...o){if(!this){let[i,n]=o,s=[];return pr[N].call(void 0,s,i,n)}let[e,t]=o;if(w.call(this,e),!U.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=(0,fp.asMutable)(this);r.headers=[],r.types=r.node[B]=new ie,r.name=t.name,r.description=t.description,r.channel=t.channel,t!=null&&t.payloadType&&(r.payloadType=(t==null?void 0:t.payloadType)instanceof O?t.payloadType:r.owner.node.getDataType(t.payloadType)),t!=null&&t.keyType&&(r.keyType=(t==null?void 0:t.keyType)instanceof O?t.keyType:r.owner.node.getDataType(t.keyType))},"RpcOperation"),Ks=class Ks extends w{findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){var t;let e=(0,lp.omitUndefined)({kind:u.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(Ks,"RpcOperationClass");var qs=Ks;pr.prototype=qs.prototype;pr[N]=qr;var mp=require("@jsopen/objects");var Vs=class Vs extends w{constructor(e,t){super(e),this.headers=[],this.channel=t==null?void 0:t.channel,this.description=t==null?void 0:t.description,t!=null&&t.payloadType?this.payloadType=(t==null?void 0:t.payloadType)instanceof O?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 O?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,mp.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(Vs,"RpcOperationResponse");var Di=Vs;var zs=class zs{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,up.isConstructor)(r)&&(r=r()),r=await me(r);let n,s,p;if(typeof r=="function"){if(s=Reflect.getMetadata(se,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(se,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 Je(t,{...s,name:i,instance:p,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await F.addDataTypes(e,c,s.types)}),s.headers&&await e.enterAsync(".headers",async()=>{let f=0;for(let g of s.headers)await e.enterAsync(`[${f++}]`,async()=>{let d={...g};await e.enterAsync(".type",async()=>{g.type&&(d.type=c.node.findDataType(g.type)),!d.type&&typeof g.type=="object"&&(d.type=await F.createDataType(e,c,g.type)),d.type||(d.type=c.node.getDataType("any"))});let Z=new ar(c,d);c.headers.push(Z)})}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[f,g]of Object.entries(s.operations))await e.enterAsync(`[${f}]`,async()=>{let d=new pr(c,{...g,name:f,types:void 0,payloadType:void 0,keyType:void 0});await this._initRpcOperation(e,d,g),c.operations.set(d.name,d)})}),c}static async _initRpcOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await F.addDataTypes(e,t,r.types)}),t.payloadType=await F.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await F.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 F.resolveDataType(e,t,n.type)});let p=new ar(t,s);t.headers.push(p)})}),r.response&&await e.enterAsync(".response",async()=>{let i=new Di(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 F.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await F.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 F.resolveDataType(e,t,n.type)});let p=new ar(t,s);t.headers.push(p)})})}};a(zs,"RpcApiFactory");var Ni=zs;var Pc="https://oprajs.com/spec/v"+u.SpecVersion,Si=class Si{constructor(){this._allDocuments={}}static async createDocument(e,t){let r=new Si,i=t instanceof ue?t:new ue(t);try{let n=new Ve;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 fe(p),await t.enterAsync(`[${s}]`,async()=>{if(!C.test(s))throw new TypeError(`Invalid namespace (${s})`);if(p instanceof Ie){e.references.set(s,p);return}let c=new Ie;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 v.addDataTypes(t,e,i.types)}),i.api&&await t.enterAsync(".api",async()=>{if(i.api&&i.api.transport==="http"){let s=await It.createApi(t,{...i.api,owner:e});s&&(e.api=s)}else if(i.api&&i.api.transport==="rpc"){let s=await bi.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:Mc,info:{version:m.SpecVersion,title:"Opra built-in types",license:{url:"https://github.com/oprajs/opra/blob/main/LICENSE",name:"MIT"}},types:[Cr,Ur,Br,qe,$r,de,qr,Ae,Rr,tt,rt,it,ot,G,Y,ce,Fr,X,ft,jr,Gt]},r=new Ie;r[Ne]=!0;let i=Object.getPrototypeOf(BigInt(0)).constructor,n=Object.getPrototypeOf(Buffer.from([])),s=r.types[cr];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(SharedArrayBuffer,"base64"),s.set(n,"base64"),await this.initDocument(r,e,t),r}};a(Ai,"ApiDocumentFactory");var Ks=Ai;var Vs;(function(o){o.HttpApiFactory=It,o.DataTypeFactory=v,o.RpcOperationDecoratorFactory=lr,o.RpcControllerDecoratorFactory=xt})(Vs||(Vs={}));var lp=require("uid");
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[De]){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||u.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 me(p),await t.enterAsync(`[${s}]`,async()=>{if(!U.test(s))throw new TypeError(`Invalid namespace (${s})`);if(p instanceof Ve){e.references.set(s,p);return}let c=new Ve;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 F.addDataTypes(t,e,i.types)}),i.api&&await t.enterAsync(".api",async()=>{if(i.api&&i.api.transport==="http"){let s=await sr.createApi(t,{...i.api,owner:e});s&&(e.api=s)}else if(i.api&&i.api.transport==="rpc"){let s=await Ni.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:u.SpecVersion,url:Pc,info:{version:u.SpecVersion,title:"Opra built-in types",license:{url:"https://github.com/oprajs/opra/blob/main/LICENSE",name:"MIT"}},types:[jr,Cr,Ur,$e,Br,de,$r,Ae,Ir,tt,rt,it,ot,Q,V,we,Fr,X,st,Pr,zt]},r=new Ve;r[De]=!0;let i=Object.getPrototypeOf(BigInt(0)).constructor,n=Object.getPrototypeOf(Buffer.from([])),s=r.types[yr];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(SharedArrayBuffer,"base64"),s.set(n,"base64"),await this.initDocument(r,e,t),r}};a(Si,"ApiDocumentFactory");var Js=Si;var Ws;(function(o){o.HttpApiFactory=sr,o.DataTypeFactory=F,o.RpcOperationDecoratorFactory=qr,o.RpcControllerDecoratorFactory=tr})(Ws||(Ws={}));var dp=require("uid");