@opra/common 1.7.3 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.cjs +5 -5
- package/browser/index.mjs +5 -5
- package/cjs/document/data-type/api-field.js +2 -0
- package/cjs/document/decorators/api-field-decorator.js +1 -0
- package/cjs/filter/antlr/OpraFilterLexer.js +212 -347
- package/cjs/filter/antlr/OpraFilterListener.js +1 -1
- package/cjs/filter/antlr/OpraFilterParser.js +198 -227
- package/cjs/filter/antlr/OpraFilterVisitor.js +1 -1
- package/cjs/filter/ast/index.js +1 -0
- package/cjs/filter/ast/terms/date-time-literal.js +27 -0
- package/cjs/filter/build.js +3 -1
- package/cjs/filter/filter-tree-visitor.js +1 -1
- package/esm/document/data-type/api-field.js +2 -0
- package/esm/document/decorators/api-field-decorator.js +1 -0
- package/esm/filter/antlr/OpraFilterLexer.js +213 -348
- package/esm/filter/antlr/OpraFilterListener.js +2 -2
- package/esm/filter/antlr/OpraFilterParser.js +198 -227
- package/esm/filter/antlr/OpraFilterVisitor.js +1 -1
- package/esm/filter/ast/index.js +1 -0
- package/esm/filter/ast/terms/date-time-literal.js +23 -0
- package/esm/filter/build.js +3 -1
- package/esm/filter/filter-tree-visitor.js +2 -2
- package/package.json +6 -6
- package/types/document/data-type/api-field.d.ts +2 -1
- package/types/document/decorators/api-field-decorator.d.ts +2 -2
- package/types/filter/antlr/OpraFilterLexer.d.ts +1 -1
- package/types/filter/antlr/OpraFilterListener.d.ts +36 -10
- package/types/filter/antlr/OpraFilterParser.d.ts +1 -1
- package/types/filter/antlr/OpraFilterVisitor.d.ts +31 -5
- package/types/filter/ast/index.d.ts +1 -0
- package/types/filter/ast/terms/date-time-literal.d.ts +6 -0
- package/types/filter/filter-tree-visitor.d.ts +2 -2
- package/types/schema/data-type/field.interface.d.ts +16 -1
package/browser/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* http://www.panates.com
|
|
4
4
|
*****************************************/
|
|
5
5
|
|
|
6
|
-
var ps=Object.defineProperty;var a=(o,e)=>ps(o,"name",{value:e,configurable:!0});var cs=(o,e)=>{for(var t in e)ps(o,t,{get:e[t],enumerable:!0})};import"reflect-metadata";import{merge as ri}from"@jsopen/objects";var m={};cs(m,{ComplexType:()=>We,EnumType:()=>Ge,HttpController:()=>Ut,HttpOperation:()=>Hr,MappedType:()=>Ye,MixinType:()=>Qe,RpcController:()=>ei,RpcOperation:()=>ti,SimpleType:()=>Xe,SpecVersion:()=>ua,isComplexType:()=>da,isDataType:()=>ma,isEnumType:()=>Ea,isHttpController:()=>_a,isMappedType:()=>Ta,isMixinType:()=>ya,isSimpleType:()=>ha});var ua="1.0";var We;(function(o){o.Kind="ComplexType"})(We||(We={}));var Ge;(function(o){o.Kind="EnumType"})(Ge||(Ge={}));var Ye;(function(o){o.Kind="MappedType"})(Ye||(Ye={}));var Qe;(function(o){o.Kind="MixinType"})(Qe||(Qe={}));var Xe;(function(o){o.Kind="SimpleType"})(Xe||(Xe={}));var Ut;(function(o){o.Kind="HttpController"})(Ut||(Ut={}));var Hr;(function(o){o.Kind="HttpOperation"})(Hr||(Hr={}));var ei;(function(o){o.Kind="RpcController"})(ei||(ei={}));var ti;(function(o){o.Kind="RpcOperation"})(ti||(ti={}));function ma(o){return o&&typeof o=="object"&&(o.kind===We.Kind||o.kind===Ge.Kind||o.kind===Ye.Kind||o.kind===Xe.Kind||o.kind===Qe.Kind)}a(ma,"isDataType");function da(o){return o&&typeof o=="object"&&o.kind===We.Kind}a(da,"isComplexType");function ha(o){return o&&typeof o=="object"&&o.kind===Xe.Kind}a(ha,"isSimpleType");function ya(o){return o&&typeof o=="object"&&o.kind===Qe.Kind}a(ya,"isMixinType");function Ta(o){return o&&typeof o=="object"&&o.kind===Ye.Kind}a(Ta,"isMappedType");function Ea(o){return o&&typeof o=="object"&&o.kind===Ge.Kind}a(Ea,"isEnumType");function _a(o){return o&&typeof o=="object"&&o.kind===Ut.Kind}a(_a,"isHttpController");var T=Symbol.for("opra.type.metadata"),te=Symbol("opra.http-controller.metadata"),re=Symbol("opra.rpc-controller.metadata"),y=Symbol.for("opra.type.decoder"),x=Symbol("opra.type.encoder"),w=Symbol.for("DECORATOR"),Me=Symbol.for("BUILTIN"),ls=/([a-z$_]\w+):(.+)/i,k=/^[a-z][\w_]*$/i,j=Symbol.for("kDataTypeMap"),pr=Symbol.for("kCtorMap"),Re=Symbol.for("kTypeNSMap");var xa=/^(.*)(Controller)$/,fs=[];function Ze(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=xa.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(re,Object.getPrototypeOf(r));s&&ri(n,s,{deep:!0});let p=Reflect.getOwnMetadata(re,r);p&&ri(n,p,{deep:!0}),ri(n,{...o,kind:m.RpcController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(re,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(re,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),fs.forEach(r=>r(t,e,o)),t}a(Ze,"RpcControllerDecoratorFactory");Ze.augment=function(o){fs.push(o)};import{omit as ga}from"@jsopen/objects";var us=[];function Bt(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,...ga(t,["kind","payloadType"])},c=Reflect.getOwnMetadata(re,n.constructor)||{};c.operations=c.operations||{},c.operations[s]=p;for(let l of o)l(p,n,s);Reflect.defineMetadata(re,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(_=>String(_.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),us.forEach(n=>n(i,o,e,t)),i}a(Bt,"RpcOperationDecoratorFactory");Bt.augment=function(o){us.push(o)};BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});import{isConstructor as wa}from"@jsopen/objects";import ba from"putil-promisify";async function se(o){return o=ba.isPromise(o)?await o:o,typeof o=="function"?wa(o)?o:await o():o}a(se,"resolveThunk");var ms=/^(?:file:\/\/)?(.+)$/;function pf(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?ms.exec(r):void 0;return i?i[1]:""}return""}a(pf,"getStackFileName");function cf(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?ms.exec(r):void 0;return i?i[1]:""}return""}a(cf,"getErrorStack");function cr(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(cr,"mergePrototype");function lr(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(lr,"inheritPropertyInitializers");import{isPlainObject as ds,merge as Aa}from"@jsopen/objects";function I(o,e){return Aa({},o,{deep:a(t=>ds(t)&&!t[T],"deep"),copyDescriptors:!0,ignoreUndefined:!0,filter(t,r){let i=r[t];return!e||typeof i!="function"&&(typeof i!="object"||ds(i)||Array.isArray(i))}})}a(I,"cloneObject");import{splitString as hs}from"fast-tokenizer";var Na=/^([+-])?([a-z_$]\w*)$/i,Da=/[^.]\(/g,ii=class ii{};a(ii,"FieldsProjection");var Le=ii;(function(o){let t=class t{};a(t,"Item");let e=t;o.Item=e})(Le||(Le={}));function ys(o,e){let t=Array.isArray(o)?o:[o];if(!(t&&t.length))return;let r=new Le;for(let i of t)e||(i=i.toLowerCase()),Ts(i,r);return r}a(ys,"parseFieldsProjection");function Ts(o,e){o=o.replace(Da,r=>r.charAt(0)+"."+r.substring(1));let t=hs(o,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let i=t[r];if(i.includes(",")){let c=hs(i,{delimiters:",",brackets:!0,keepBrackets:!0});for(let l of c)Ts(l,e);continue}let n=Na.exec(i);if(!n)throw new TypeError(`Invalid field path (${o})`);let s=n[2],p=e[s]=e[s]||new Le.Item;n[1]&&(p.sign=n[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new Le}}a(Ts,"parse");function Sa(o){return o&&typeof o.forEach=="function"}a(Sa,"isMap");var K=Symbol.for("kEntries"),ae=Symbol.for("kKeyMap"),fr=Symbol.for("kWellKnownKeys"),oi=Symbol.for("kOptions"),He=Symbol.for("kSize"),ni=class ni{constructor(e,t){Object.defineProperty(this,He,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,K,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,ae,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,fr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,oi,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(i=>{r?this[fr][i]=i:this[fr][i.toLowerCase()]=i}),this.clear(),e&&this.setAll(e)}get size(){return this[He]}clear(){Object.keys(this[K]).forEach(e=>delete this[K][e]),Object.keys(this[ae]).forEach(e=>delete this[ae][e]),this[He]=0}forEach(e,t){for(let[r,i]of this.entries())e.call(t,i,r,this)}get(e){if(e)return this[K][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[K],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let i=Object.prototype.hasOwnProperty.call(this[K],r);return this[K][r]=t,i||this[He]++,this[ae][r]=e,this}setAll(e){return Sa(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[ae])[Symbol.iterator]()}values(){return Object.values(this[K])[Symbol.iterator]()}entries(){return Object.entries(this[K])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[K],t);return delete this[K][t],delete this[ae][t],r||this[He]--,r}sort(e){let t={...this[K]},r={...this[ae]},i=Array.from(this.keys());e?i.sort(e):i.sort(),this.clear();for(let n of i)this[K][n]=t[n],this[ae][n]=r[n];return this[He]=i.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[ae]))e[r]=this[K][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[oi].caseSensitive)return e;let t=this._getStoringKey(e);return this[ae][t]??this[fr][t]??e}_getStoringKey(e){return this[oi].caseSensitive?e:e.toLowerCase()}};a(ni,"ResponsiveMap");var N=ni;function Rf(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(Rf,"safeJsonStringify");function si(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}a(si,"isStream");function Af(o){return si(o)&&typeof o._read=="function"&&typeof o._readableState=="object"}a(Af,"isReadable");function Nf(o){return si(o)&&typeof o._write=="function"}a(Nf,"isWritable");function Df(o){return si(o)&&typeof o.getReader=="function"&&typeof o.pipeThrough=="function"&&typeof o.pipeTo=="function"}a(Df,"isReadableStream");function Sf(o){return o!==null&&typeof o=="object"&&typeof o.size=="number"&&typeof o.arrayBuffer=="function"&&typeof o.stream=="function"}a(Sf,"isBlob");function vf(o){return o!==null&&typeof o.constructor=="function"&&o.constructor.name==="FormData"&&typeof o.append=="function"&&typeof o.getAll=="function"}a(vf,"isFormData");function If(o){return o!==null&&typeof o=="object"&&typeof o.host=="string"&&typeof o.href=="string"}a(If,"isURL");import{omitUndefined as ja}from"@jsopen/objects";import Ma from"@browsery/i18next";import{splitString as La,tokenize as xs}from"fast-tokenizer";var va=/\\(.)/g,Ia=/(\\)/g;function Es(o){return o.replace(Ia,"\\\\")}a(Es,"escapeString");function _s(o){return o.replace(va,"$1")}a(_s,"unescapeString");var Pa=Object.getPrototypeOf(Ma.createInstance()).constructor,$t=class $t extends Pa{async init(e,t){let r=typeof e=="object"?e:{},i=typeof e=="function"?e:t;try{let n=await super.init(r,i),s=this.services.formatter;if(s.add("lowercase",(p,c)=>p.toLocaleLowerCase(c)),s.add("uppercase",(p,c)=>p.toLocaleUpperCase(c)),s.add("upperFirst",(p,c)=>p.charAt(0).toLocaleUpperCase(c)+p.substring(1)),r!=null&&r.resources)for(let p of Object.keys(r.resources)){let c=r.resources[p];for(let l of Object.keys(c))this.addResourceBundle(p,l,c[l],!1,!0)}return i&&i(null,n),n}catch(n){throw i&&i(n,this.t),n}}deep(e,t){if(e==null)return e;let r=new WeakMap;return this._deepTranslate(e,r,t)}createInstance(e,t){return new $t(e,t)}static createInstance(e,t){return new $t(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 xs(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=La(n,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),p=_s(n.substring((s[0]||"").length+1));n=s[0]||"";let c=[],l=null;for(let d of xs(n,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(d.startsWith("{")){l=JSON.parse(d);continue}c.push(d)}let _=c.length>1?"$t("+c.join(",")+")":c[0];i+=p?this.t(_,p,{...r,...l}):this.t(_,{...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 Fa}};a($t,"I18n");var qt=$t,Fa=qt.createInstance();var ka=/(\))/g;function R(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?"?"+Es(i).replace(ka,"\\$1"):"")+")"}a(R,"translate");var ai=qt.createInstance();ai.init().catch(()=>{});var pi=class pi 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 ai.deep(this.message)}toJSON(){var t;let e="production";return ja({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(pi,"OpraException");var Te=pi;var ci=class ci extends Te{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};a(ci,"OpraDocumentError");var et=ci;var li=class li{constructor(e){this.path="",this.error=new et,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(li,"DocumentInitContext");var pe=li;import"reflect-metadata";import{omitUndefined as Ga}from"@jsopen/objects";import{asMutable as Ya}from"ts-gems";import{omit as Ca}from"@jsopen/objects";function fi(o){return function(e){let t;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!k.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(T,e);r||(r={},Reflect.defineMetadata(T,r,e)),r.kind=m.ComplexType.Kind,r.name=t,o&&Object.assign(r,Ca(o,["name"]))}}a(fi,"ComplexTypeDecorator");import{omitUndefined as Os}from"@jsopen/objects";import{asMutable as Wa}from"ts-gems";import{asMutable as Ua}from"ts-gems";import{uid as Ba}from"uid";var ui=class ui{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[Re])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[j])==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(T,e).name;else if(typeof e=="object"){let n=e[T];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(ui,"DocumentNode");var ur=ui;var g=a(function(o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=Ua(this);e.id=Ba(16),Object.defineProperty(e,"node",{value:new ur(this,o==null?void 0:o.node),enumerable:!1,writable:!0}),o&&Object.defineProperty(e,"owner",{value:o,enumerable:!1,writable:!0})},"DocumentElement"),di=class di{};a(di,"DocumentElementClass");var mi=di;g.prototype=mi.prototype;import{omitUndefined as $a}from"@jsopen/objects";function hi(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(T,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(T,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($a({...i,scopePattern:Array.isArray(r)?r:[r],type:void 0,isArray:void 0}))}),t),t}a(hi,"ApiFieldDecoratorFactory");function Kt(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(Kt,"testScopeMatch");import{asMutable as Va}from"ts-gems";import{validator as za,vg as ie}from"valgen";import{omitUndefined as qa}from"@jsopen/objects";import{asMutable as Ka}from"ts-gems";var tt=Symbol.for("nodejs.util.inspect.custom"),Pe="\x1B[0m",rt="\x1B[33m",it="\x1B[35m";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&&!k.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);g.call(this,o);let r=Ka(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"),Ti=class Ti extends g{get embedded(){return!this.name}inScope(e){return Kt(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 qa({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[tt](){return`[${rt+Object.getPrototypeOf(this).constructor.name+Pe} ${it+this.name+Pe}]`}};a(Ti,"DataTypeClass");var yi=Ti;O.prototype=yi.prototype;var Ja=/^([+-])?([a-z$_][\w.]*)$/i,L=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=Va(this);i._fields=new N},"ComplexTypeBase"),_i=class _i 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,$,as;let r=this,i,n=e.split("."),s=n.length,p=[],c=this.owner.node.getDataType("object"),l=t==null?void 0:t.allowSigns,_=a(()=>p.map(Ie=>Ie.fieldName).join("."),"getStrPath");for(let Ie=0;Ie<s;Ie++){let z={fieldName:n[Ie],dataType:c};p.push(z);let ar=Ja.exec(n[Ie]);if(!ar)throw new TypeError(`Invalid field name (${_()})`);if(ar[1]&&((Ie===0&&l==="first"||l==="each")&&(z.sign=ar[1]),z.fieldName=ar[2]),r){if(r instanceof L){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((($=r.additionalFields)==null?void 0:$[0])==="type"&&((as=r.additionalFields)==null?void 0:as[1])instanceof O){z.additionalField=!0,z.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(Zr=>Zr.fieldName).join(".")})`)}throw new TypeError(`"${p.map(Zr=>Zr.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)?ys(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=za((p,c,l)=>c.fail(l,s,p))}return ie.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]=ie.isUndefined({coerce:!0});continue}p=l.name;let _;if(n!=="*"&&(_=n==null?void 0:n[p.toLowerCase()],(_==null?void 0:_.sign)==="-"||s&&!_||!s&&l.exclusive&&!_)){r[l.name]=ie.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?ie.optional(d):ie.required(d)}return t.allowPatchOperators&&(r._$pull=ie.optional(ie.isAny()),r._$push=ie.optional(ie.isAny())),r}_generateFieldCodec(e,t,r){let i=t.type.generateCodec(e,r);return t.fixed&&(i=ie.isEnum([t.fixed])),t.isArray&&(i=ie.isArray(i)),i}};a(_i,"ComplexTypeBaseClass");var Ei=_i;L.prototype=Ei.prototype;var P=a(function(...o){if(!this){let[n]=o;return P[w](n)}let[e,t]=o;g.call(this,e);let r=Wa(this);r.name=t.name;let i=t.origin||e;if(!(i instanceof L))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.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"),Oi=class Oi extends g{inScope(e){return Kt(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(Kt(e,r.scopePattern)){t=Os({...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 Os({type:t||((r=this.type)==null?void 0:r.toJSON(e)),description:this.description,isArray:this.isArray||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(Oi,"ApiFieldClass");var xi=Oi;P.prototype=xi.prototype;Object.assign(P,hi);P[w]=hi;var Q=a(function(...o){var n;if(!this)return Q[w].apply(void 0,o);let[e,t]=o,r=o[2]||new pe({maxErrors:0});L.call(this,e,t,r);let i=Ya(this);i.kind=m.ComplexType.Kind,t.base&&r.enter(".base",()=>{if(!(t.base instanceof L))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 P(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 P(this,{...p,name:s});this._fields.set(c.name,c)}})},"ComplexType"),Ri=class Ri extends L{extendsFrom(e){var t;return e instanceof O||(e=this.node.getDataType(e)),e instanceof L?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 Ga(i)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Ri,"ComplexTypeClass");var gi=Ri;Q.prototype=gi.prototype;Object.assign(Q,fi);Q[w]=fi;import"reflect-metadata";import{omitUndefined as wi}from"@jsopen/objects";import{asMutable as Qa}from"ts-gems";import{vg as Xa}from"valgen";var ce=a(function(...o){if(!this)return ce[w].apply(void 0,o);let[e,t,r]=o;O.call(this,e,t,r);let i=Qa(this);if(i.kind=m.EnumType.Kind,t.base){if(!(t.base instanceof ce))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=I(t.attributes||{}),i.attributes=i.base?I(i.base.attributes):{};for(let[n,s]of Object.entries(i.ownAttributes))i.attributes[n]=s},"EnumType"),bi=class bi extends O{extendsFrom(e){var t;return e instanceof O||(e=this.node.getDataType(e)),e instanceof ce?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return Xa.isEnum(Object.keys(this.attributes))}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return wi({...t,kind:this.kind,base:r,attributes:I(this.ownAttributes)})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(bi,"EnumTypeClass");var Vt=bi;ce.prototype=Vt.prototype;Object.assign(ce,Vt);function Za(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]=wi({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]]=wi({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,T,{value:s,enumerable:!1,configurable:!0,writable:!0}),n}a(Za,"EnumTypeFactory");ce.prototype=Vt.prototype;ce[w]=Za;import"reflect-metadata";import{omitUndefined as Ha}from"@jsopen/objects";import{asMutable as ep}from"ts-gems";function mr(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(mr,"getIsInheritedPredicateFn");var Fe=a(function(...o){var n;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;L.call(this,e,t,r);let i=ep(this);if(i.kind=m.MappedType.Kind,t.base){if(!(t.base instanceof L))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=mr(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,_]of i.base.fieldEntries()){if(!s(l))continue;let d={..._};p===!0||Array.isArray(p)&&p.includes(_.name.toLowerCase())?d.required=!1:(c===!0||Array.isArray(c)&&c.includes(_.name.toLowerCase()))&&(d.required=!0);let $=new P(this,d);i._fields.set($.name,$)}(!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"),Ni=class Ni extends L{extendsFrom(e){var t;return e instanceof O||(e=this.node.getDataType(e)),e instanceof L?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 Ha({...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(Ni,"MappedTypeClass");var Ai=Ni;Fe.prototype=Ai.prototype;Fe._applyMixin=()=>{};import"reflect-metadata";import{omitUndefined as tp}from"@jsopen/objects";import{asMutable as rp}from"ts-gems";var ot=a(function(...o){if(!this)return ot[w].apply(void 0,o);let[e,t,r]=o;L.call(this,e,t,r);let i=rp(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 P(this,s);i._fields.set(p.name,p)}i.types.push(n),n.keyField&&(i.keyField=n.keyField)}},"MixinType"),Si=class Si extends L{extendsFrom(e){if(e instanceof O||(e=this.node.getDataType(e)),!(e instanceof L))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 tp({...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(Si,"MixinTypeClass");var Di=Si;ot.prototype=Di.prototype;ot[w]=ip;function ip(...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)lr(this,s)}}}[r],n={...t,kind:m.MixinType.Kind,types:[]};Reflect.defineMetadata(T,n,i);for(let s of e){let p=Reflect.getMetadata(T,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),cr(i.prototype,s.prototype)}return i}a(ip,"MixinTypeFactory");import"reflect-metadata";import{omitUndefined as Rs}from"@jsopen/objects";import{asMutable as op}from"ts-gems";import{isAny as ws}from"valgen";function vi(o){let e=[],t=a(function(r){let i;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!k.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(T,r)||{};o&&Object.assign(n,o),n.kind=m.SimpleType.Kind,n.name=i,Reflect.defineMetadata(T,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(vi,"SimpleTypeDecoratorFactory");function gs(o){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(T,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(T,r,e.constructor)}}a(gs,"AttributeDecoratorFactory");var u=a(function(...o){var n,s;if(!this)return u[w](...o);let[e,t,r]=o;O.call(this,e,t,r);let i=op(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=I(t.attributes||{}),i.attributes=i.base?I(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"),Mi=class Mi extends O{extendsFrom(e){var t;return e instanceof O||(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 ws}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 ws}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i=Rs(this.ownAttributes),n;this.properties&&typeof this.properties.toJSON=="function"?n=this.properties.toJSON(this.properties,this.owner,e):n=this.properties?I(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}),Rs(s,!0)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Mi,"SimpleTypeClass");var Ii=Mi;u.prototype=Ii.prototype;Object.assign(u,vi);u[w]=vi;u.Attribute=gs;var Li=Symbol("initializing"),dr=class dr{static async createDataType(e,t,r){e=e||new pe({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 dr.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[j];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 pe({maxErrors:0});let i=await this._prepareAllInitArgs(e,t,r);if(!i)return;let n=new N;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 _=this._createDataType(s,t,l);_&&p.push(_)});return p}static async _prepareAllInitArgs(e,t,r){let i=new N,n=new N,s=e.extend({owner:t,importQueue:i,initArgsMap:n});if(!t.node[j])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 se(c);let l=Reflect.getMetadata(T,c)||c[T];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 se(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 _;r=await se(r);let{importQueue:i,initArgsMap:n}=e,s=t.node.findDataType(r);if(s instanceof O)return s.name;let p,c,l;if(typeof r!="string"){let $=t.node.getDocument().types[pr].get(r);$&&(r=$)}if(typeof r=="string"){let d=r;if(r=(i==null?void 0:i.get(d))||((_=e.initArgsMap)==null?void 0:_.get(d)),!r)return e.addError(`Unknown data type (${d})`)}if(typeof r=="function"){if(p=Reflect.getMetadata(T,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[T],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(T,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 $=n==null?void 0:n.get(p.name);if($)return $[Li]?e.addError("Circular reference detected"):p.name}let d={kind:p.kind,name:p.name};d[Li]=!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[j]=t.node[j];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[Li]}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(T,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=ke(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=ke(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:ke(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=ke(n))}),r.attributes=I(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 _=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(T,_)&&(l=await this._importDataTypeArgs(e,t,_))}l&&(r.base=ke(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=I(i.attributes)),typeof((n=r.properties)==null?void 0:n[y])=="function"&&(r.generateDecoder=(s=r.properties)==null?void 0:s[y].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(T,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=ke(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(ke(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[j];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,Q.prototype);let n=I(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})})}),Q.apply(i,[t,n]),i}static _createEnumType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ce.prototype);let n=I(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),n.attributes=r.attributes,ce.apply(i,[t,n]),i}static _createMappedType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Fe.prototype);let n=I(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),Fe.apply(i,[t,n]),i}static _createMixinType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ot.prototype);let n=I(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 L))throw new TypeError(`"${c==null?void 0:c.kind}" can't be set as base for a "${n.kind}"`);n.types.push(c)})}),ot.apply(i,[t,n]),i}static _createSimpleType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,u.prototype);let n=I(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),u.apply(i,[t,n]),i}};a(dr,"DataTypeFactory");var S=dr;function ke(o){return typeof o=="object"&&o.name?o.name:o}a(ke,"preferName");import{isConstructor as Dp}from"@jsopen/objects";import{omitUndefined as sp}from"@jsopen/objects";var Pi=class Pi extends g{constructor(e){super(e.owner),this.name="OpraApi",this.name=e.name,this.description=e.description}toJSON(e){return sp({transport:this.transport,name:this.name,description:this.description})}async _initialize(e,t){if(!k.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};a(Pi,"ApiBase");var nt=Pi;import cp from"path-browserify";import{omitUndefined as lp}from"@jsopen/objects";import{asMutable as fp}from"ts-gems";var bs,As,X=Symbol.for("kMap"),zt=Symbol.for("kCtorMap"),Fi=class Fi{constructor(){this[bs]=new N,this[As]=new WeakMap}get size(){return this[X].size}forEach(e,t){this[X].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[zt].get(e);if(!t&&typeof e=="function"){let i=Reflect.getMetadata(T,e);t=i==null?void 0:i.name}if(!t&&typeof e=="object"){let i=e[T];t=i==null?void 0:i.name}if(!t)return;let r=this[X].get(t);if(r)return typeof e=="function"&&r.kind==="ComplexType"?r.ctor===e?r:void 0:r}set(e,t){this[X].set(e,t),t.ctor?this[zt].set(t.ctor,e):t.instance&&this[zt].set(t.instance,e)}has(e){if(e instanceof O)return!!e.name&&this[X].has(e.name);let t=typeof e=="string"?e:this[zt].get(e);return t?this[X].has(t):!1}keys(){return this[X].keys()}values(){return this[X].values()}entries(){return this[X].entries()}sort(e){return this[X].sort(e),this}[(bs=X,As=zt,Symbol.iterator)](){return this[X][Symbol.iterator]()}};a(Fi,"DataTypeMap");var Z=Fi;import{merge as ki,omit as ap}from"@jsopen/objects";var pp=/^(.*)(Controller)$/;function ji(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=pp.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(te,Object.getPrototypeOf(r));s&&ki(n,s,{deep:!0});let p=Reflect.getOwnMetadata(te,r);p&&ki(n,p,{deep:!0}),ki(n,{kind:m.HttpController.Kind,name:i,path:i,...ap(o,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(te,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(te,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(ji,"HttpControllerDecoratorFactory");var H=a(function(...o){var i;if(!this)return H[w].apply(void 0,o);let[e,t]=o;if(g.call(this,e),!k.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=fp(this);r.kind=m.HttpController.Kind,r.types=r.node[j]=new Z,r.operations=new N,r.controllers=new N,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"),Ui=class Ui extends g{get isRoot(){return!(this.owner instanceof H)}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values()){if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;if(r.controllers.size&&(t=r.findController(e),t))return this._controllerReverseMap.set(e,t),t}this._controllerReverseMap.set(e,null);return}if(e.startsWith("/")&&(e=e.substring(1)),e.includes("/")){let t=e.split("/"),r=this;for(;r&&t.length>0;)r=r.controllers.get(t.shift());return r}return this.controllers.get(e)}findParameter(e,t){let r=e.toLowerCase(),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 H)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return cp.posix.join(this.owner instanceof H?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(e){let t=lp({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}[tt](){return`[${rt}HttpController${it+this.name+Pe}]`}};a(Ui,"HttpControllerClass");var Ci=Ui;H.prototype=Ci.prototype;Object.assign(H,ji);H[w]=ji;var Bi=class Bi extends nt{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="http",this.controllers=new N,this.url=e.url}findController(e){return H.prototype.findController.call(this,e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(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(Bi,"HttpApi");var st=Bi;import up from"@browsery/type-is";import{omitUndefined as mp}from"@jsopen/objects";import{asMutable as dp}from"ts-gems";import{isAny as hp,vg as yp}from"valgen";var we=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');g.call(this,o);let t=dp(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"),qi=class qi extends g{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=mp({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=>up.is(n,["json"]))&&(r=this.node.findDataType("object").generateCodec(e)),r=r||hp,this.isArray?yp.isArray(r):r}};a(qi,"HttpMediaTypeClass");var $i=qi;we.prototype=$i.prototype;import{omitUndefined as Tp}from"@jsopen/objects";function at(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(at,"parseRegExp");var Ki=class Ki extends we{constructor(e,t){super(e,t),this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?at(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(e){return Tp({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON(e)})}};a(Ki,"HttpMultipartField");var hr=Ki;import Ep from"path-browserify";import{omitUndefined as _p}from"@jsopen/objects";import{asMutable as xp}from"ts-gems";var Ns;(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"})(Ns||(Ns={}));var b;(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"})(b||(b={}));var _h={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 v;(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"})(v||(v={}));function F(o,e){let t=a((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={...e,kind:m.HttpOperation.Kind},s=Reflect.getOwnMetadata(te,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let p of o)p(n);Reflect.defineMetadata(te,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||v.opra_response_json,n.contentEncoding=n.contentEncoding||"utf-8"),n.contentType===v.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||v.json,i.contentEncoding=i.contentEncoding||"utf-8"),o.push(n=>{n.requestBody=n.requestBody||{required:!0,content:[]},n.requestBody.content=n.requestBody.content||[],n.requestBody.content.push(i)}),t},t.MultipartContent=function(r,i){let n={...r,contentType:(r==null?void 0:r.contentType)||"multipart/form-data"};if(o.push(s=>{s.requestBody=s.requestBody||{required:!0,content:[]},s.requestBody.content=s.requestBody.content||[],s.requestBody.content.push(n)}),i){let s={Field(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"field",...c}),s},File(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"file",...c}),s}};i(s)}return t},t.UseType=(...r)=>(o.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(F,"HttpOperationDecoratorFactory");var D=a(function(...o){if(!this){let[i]=o,n=[];return D[w].call(void 0,n,i)}let[e,t]=o;if(g.call(this,e),!k.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=xp(this);r.parameters=[],r.responses=[],r.types=r.node[j]=new Z,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?I(t.compositionOptions):void 0},"HttpOperation"),zi=class zi extends g{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:Ep.posix.join(e,this.path):e:this.path||"/"}toJSON(e){var r;let t=_p({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(zi,"HttpOperationClass");var Vi=zi;D.prototype=Vi.prototype;D[w]=F;D.GET=function(o){return F([],{...o,method:"GET"})};D.DELETE=function(o){return F([],{...o,method:"DELETE"})};D.HEAD=function(o){return F([],{...o,method:"HEAD"})};D.OPTIONS=function(o){return F([],{...o,method:"OPTIONS"})};D.PATCH=function(o){return F([],{...o,method:"PATCH"})};D.POST=function(o){return F([],{...o,method:"POST"})};D.PUT=function(o){return F([],{...o,method:"PUT"})};D.SEARCH=function(o){return F([],{...o,method:"SEARCH"})};import{omitUndefined as gp}from"@jsopen/objects";var Op=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,Ji=class Ji{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=Op.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(Ji,"HttpStatusRange");var Jt=Ji;var Wi=class Wi extends we{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new Jt(r.start,r.end):new Jt(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=gp({...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(Wi,"HttpOperationResponse");var yr=Wi;import{omitUndefined as bp}from"@jsopen/objects";import{asMutable as Ap}from"ts-gems";import{omitUndefined as Rp}from"@jsopen/objects";import{asMutable as wp}from"ts-gems";var je=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');g.call(this,o);let t=wp(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),Yi=class Yi extends g{toJSON(e){let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return Rp({type:this.type?t||this.type.toJSON(e):"any",description:this.description,isArray:this.isArray,examples:this.examples})}};a(Yi,"ValueClass");var Gi=Yi;je.prototype=Gi.prototype;var Wt=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');je.call(this,o,e);let t=Ap(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?at(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"),Xi=class Xi extends je{toJSON(e){return bp({...super.toJSON(e),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}};a(Xi,"HttpParameterClass");var Qi=Xi;Wt.prototype=Qi.prototype;import{omitUndefined as Np}from"@jsopen/objects";var Zi=class Zi extends g{constructor(e){super(e),this.content=[]}toJSON(e){return Np({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(Zi,"HttpRequestBody");var Tr=Zi;var Hi=class Hi{static async createApi(e,t){let r=new st(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"&&!Dp(r)&&(r=t instanceof H?r(t.instance):r()),r=await se(r);let i,n,s;if(typeof r=="function"){if(n=Reflect.getMetadata(te,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(te,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 H(t,{...r,instance:i,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await S.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 S.resolveDataType(e,s,c.type)});let _=new Wt(s,l);s.parameters.push(_)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[p,c]of Object.entries(r.operations))await e.enterAsync(`[${p}]`,async()=>{let l=new D(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 D.apply(t,[t.owner,i]),r.types&&await e.enterAsync(".types",async()=>{await S.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 S.resolveDataType(e,t,s.type)});let c=new Wt(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 yr(t,{statusCode:s.statusCode});await this._initHttpOperationResponse(e,p,s),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let n=new Tr(t);await this._initHttpRequestBody(e,n,r.requestBody),t.requestBody=n}),t}static async _initHttpMediaType(e,t,r){we.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{t.type=await S.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 hr(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 S.resolveDataType(e,t,n.type)});let p=new Wt(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 we(t,String(i));await this._initHttpMediaType(e,s,n),t.content.push(s)})})}};a(Hi,"HttpApiFactory");var pt=Hi;import{omitUndefined as vp}from"@jsopen/objects";import{md5 as Ip}from"super-fast-md5";var eo=class eo extends nt{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="rpc",this.controllers=new N,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(eo,"RpcApi");var ct=eo;var Ds,to=class to extends g{constructor(){super(null),this[Ds]=new WeakMap,this.id="",this.info={},this.references=new N,this.types=new Z,this.node[j]=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[Re].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 st))throw new TypeError("The document do not contains HttpApi instance");return this.api}get rpcApi(){if(!(this.api&&this.api instanceof ct))throw new TypeError("The document do not contains RpcApi instance");return this.api}toJSON(){return this.export()}export(e){let t=vp({spec:m.SpecVersion,id:this.id,url:this.url,info:I(this.info,!0)});if(this.references.size){let r=0,i={};for(let[n,s]of this.references.entries())s[Me]||(i[n]={id:s.id,url:s.url,info:I(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=Ip(JSON.stringify(e)),this[Re]=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=ls.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[Re].set(i,p!=null&&p[Me]?"":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[Re].set(i,p!=null&&p[Me]?"":s),i}}};a(to,"ApiDocument");var Ce=to;Ds=Re;import{__decorate as Mp,__metadata as Lp}from"tslib";import{vg as Ss}from"valgen";var lt,Er=(lt=class{constructor(e){e&&Object.assign(this,e)}[y](){return Ss.isBase64({coerce:!0})}[x](){return Ss.isBase64({coerce:!0})}},a(lt,"Base64Type"),lt);Er=Mp([u({name:"base64",description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),Lp("design:paramtypes",[Object])],Er);import{__decorate as ro,__metadata as io}from"tslib";import{isDateString as _r,toString as vs,vg as be}from"valgen";var ft,ut=(ft=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=be.isDate({precision:"date",coerce:!0}),r=[];return e.minValue&&(_r(e.minValue),r.push(vs,be.isGte(e.minValue))),e.maxValue&&(_r(e.maxValue),r.push(vs,be.isLte(e.maxValue))),r.length>0?be.pipe([t,...r],{returnIndex:0}):t}[x](e){let t=be.isDateString({precision:"date",trim:"date",coerce:!0}),r=[];return e.minValue&&(_r(e.minValue),r.push(be.isGte(e.minValue))),e.maxValue&&(_r(e.maxValue),r.push(be.isLte(e.maxValue))),r.length>0?be.pipe([t,...r],{returnIndex:0}):t}},a(ft,"DateType"),ft);ro([u.Attribute({description:"Minimum value"}),io("design:type",String)],ut.prototype,"minValue",void 0);ro([u.Attribute({description:"Maximum value"}),io("design:type",String)],ut.prototype,"maxValue",void 0);ut=ro([u({name:"date",description:"A date without time",nameMappings:{js:"Date",json:"string"}}).Example("2021-04-18","Full date value"),io("design:paramtypes",[Object])],ut);import{__decorate as oo,__metadata as no}from"tslib";import{vg as xr}from"valgen";var mt,dt=(mt=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=xr.isDateString({trim:"date",coerce:!0}),r=[];return e.minValue&&r.push(xr.isGte(e.minValue)),e.maxValue&&r.push(xr.isLte(e.maxValue)),r.length>0?xr.pipe([t,...r],{returnIndex:0}):t}[x](e){return this[y](e)}},a(mt,"DateStringType"),mt);oo([u.Attribute({description:"Minimum value"}),no("design:type",String)],dt.prototype,"minValue",void 0);oo([u.Attribute({description:"Maximum value"}),no("design:type",String)],dt.prototype,"maxValue",void 0);dt=oo([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"),no("design:paramtypes",[Object])],dt);import{__decorate as so,__metadata as ao}from"tslib";import{isDateString as Or,toString as Is,vg as Ae}from"valgen";var ht,yt=(ht=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=Ae.isDate({precision:"time",coerce:!0}),r=[];return e.minValue&&(Or(e.minValue),r.push(Is,Ae.isGte(e.minValue))),e.maxValue&&(Or(e.maxValue),r.push(Is,Ae.isLte(e.maxValue))),r.length>0?Ae.pipe([t,...r],{returnIndex:0}):t}[x](e){let t=Ae.isDateString({precision:"time",trim:"time",coerce:!0}),r=[];return e.minValue&&(Or(e.minValue),r.push(Ae.isGte(e.minValue))),e.maxValue&&(Or(e.maxValue),r.push(Ae.isLte(e.maxValue))),r.length>0?Ae.pipe([t,...r],{returnIndex:0}):t}},a(ht,"DateTimeType"),ht);so([u.Attribute({description:"Minimum value"}),ao("design:type",String)],yt.prototype,"minValue",void 0);so([u.Attribute({description:"Maximum value"}),ao("design:type",String)],yt.prototype,"maxValue",void 0);yt=so([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"),ao("design:paramtypes",[Object])],yt);import{__decorate as po,__metadata as co}from"tslib";import{vg as gr}from"valgen";var Tt,Et=(Tt=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=gr.isDateString({coerce:!0}),r=[];return e.minValue&&r.push(gr.isGte(e.minValue)),e.maxValue&&r.push(gr.isLte(e.maxValue)),r.length>0?gr.pipe([t,...r]):t}[x](e){return this[y](e)}},a(Tt,"DateTimeStringType"),Tt);po([u.Attribute({description:"Minimum value"}),co("design:type",String)],Et.prototype,"minValue",void 0);po([u.Attribute({description:"Maximum value"}),co("design:type",String)],Et.prototype,"maxValue",void 0);Et=po([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"),co("design:paramtypes",[Object])],Et);import{__decorate as le,__metadata as fe}from"tslib";import{vg as Ms}from"valgen";var _t,J=(_t=class{constructor(e){e&&Object.assign(this,e)}[y](e){return Ms.isEmail({...e,coerce:!0})}[x](e){return Ms.isEmail({...e,coerce:!0})}},a(_t,"EmailType"),_t);le([u.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),fe("design:type",Boolean)],J.prototype,"allowDisplayName",void 0);le([u.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),fe("design:type",Boolean)],J.prototype,"requireDisplayName",void 0);le([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}),fe("design:type",Boolean)],J.prototype,"utf8LocalPart",void 0);le([u.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),fe("design:type",Boolean)],J.prototype,"ignoreMaxLength",void 0);le([u.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),fe("design:type",Boolean)],J.prototype,"allowIpDomain",void 0);le([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}),fe("design:type",Boolean)],J.prototype,"domainSpecificValidation",void 0);le([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."}),fe("design:type",Array)],J.prototype,"hostBlacklist",void 0);le([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."}),fe("design:type",Array)],J.prototype,"hostWhitelist",void 0);le([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."}),fe("design:type",String)],J.prototype,"blacklistedChars",void 0);J=le([u({name:"email",description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),fe("design:paramtypes",[Object])],J);import{__decorate as lo,__metadata as fo}from"tslib";import{toString as Pp,validator as Fp,vg as kp}from"valgen";var xt,W=(xt=class{constructor(e){e&&Object.assign(this,e)}[y](e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.allowSigns,s=Fp("decodeFieldPath",p=>i.normalizeFieldPath(p,{allowSigns:n,scope:r}));return kp.pipe([Pp,s])}[x](e,t,r){return this[y](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(xt,"FieldPathType"),xt);lo([u.Attribute({description:"Data type which field belong to"}),fo("design:type",Object)],W.prototype,"dataType",void 0);lo([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'}),fo("design:type",String)],W.prototype,"allowSigns",void 0);W=lo([u({name:"fieldpath",description:"Field path",nameMappings:{js:"string",json:"string"}}),fo("design:paramtypes",[Object])],W);import{__decorate as Vn,__metadata as zn}from"tslib";import{validator as Xs}from"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});import{omitUndefined as pc}from"@jsopen/objects";import{isString as cc}from"valgen";var uo=class uo extends Te{constructor(e,t,r){super(e,t instanceof Error?t:void 0),this.status=(typeof t=="number"?t:Number(r))||500}setStatus(e){return this.status=e,this}initError(e){typeof e.status=="number"?this.status=e.status:typeof e.getStatus=="function"&&(this.status=e.getStatus()),super.initError(e)}};a(uo,"OpraHttpError");var A=uo;var mo=class mo extends A{constructor(){super(...arguments),this.status=400}init(e){super.init({message:R("error:BAD_REQUEST","Bad request"),code:"BAD_REQUEST",...e})}};a(mo,"BadRequestError");var Ls=mo;var ho=class ho extends A{constructor(){super(...arguments),this.status=409}init(e){super.init({message:R("error:CONFLICT","Conflict"),code:"CONFLICT",...e})}};a(ho,"ConflictError");var Ps=ho;var yo=class yo extends A{constructor(){super(...arguments),this.status=424}init(e){super.init({message:R("error:FAILED_DEPENDENCY","The request failed due to failure of a previous request"),code:"FAILED_DEPENDENCY",...e})}};a(yo,"FailedDependencyError");var Fs=yo;var To=class To extends A{constructor(){super(...arguments),this.status=b.FORBIDDEN}init(e){super.init({message:R("error:FORBIDDEN","You are not authorized to perform this action"),code:"FORBIDDEN",...e})}};a(To,"ForbiddenError");var Rr=To;var Eo=class Eo extends A{constructor(){super(...arguments),this.status=500}init(e){super.init({message:R("error:INTERNAL_SERVER_ERROR","Internal server error"),code:"INTERNAL_SERVER_ERROR",severity:"fatal",...e})}};a(Eo,"InternalServerError");var ks=Eo;var _o=class _o extends A{constructor(){super(...arguments),this.status=405}init(e){super.init({message:R("error:METHOD_NOT_ALLOWED","Method not allowed"),code:"METHOD_NOT_ALLOWED",...e})}};a(_o,"MethodNotAllowedError");var js=_o;var xo=class xo extends A{constructor(){super(...arguments),this.status=406}init(e){super.init({message:R("error:NOT_ACCEPTABLE","Not Acceptable"),code:"NOT_ACCEPTABLE",...e})}};a(xo,"NotAcceptableError");var Cs=xo;var Oo=class Oo extends A{constructor(){super(...arguments),this.status=404}init(e){super.init({message:R("error:NOT_FOUND","Not found"),code:"NOT_FOUND",...e})}};a(Oo,"NotFoundError");var Us=Oo;var go=class go extends Rr{init(e){super.init({message:R("error:PERMISSION_ERROR","You dont have permission for this operation"),code:"PERMISSION_ERROR",...e})}};a(go,"PermissionError");var Bs=go;var Ro=class Ro extends A{constructor(e,t,r){super({message:R("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(Ro,"ResourceConflictError");var $s=Ro;var wo=class wo extends A{constructor(e,t,r){super({message:R("error:RESOURCE_NOT_AVAILABLE",`Resource "${e}${t?"/"+t:""}" is not available`),severity:"error",code:"RESOURCE_NOT_AVAILABLE",details:{resource:e,key:t}},r,b.UNPROCESSABLE_ENTITY)}};a(wo,"ResourceNotAvailableError");var qs=wo;var bo=class bo extends A{constructor(){super(...arguments),this.status=401}init(e){super.init({message:R("error:UNAUTHORIZED","You have not been authenticated to perform this action"),code:"UNAUTHORIZED",...e})}};a(bo,"UnauthorizedError");var Ks=bo;var Ao=class Ao extends A{constructor(){super(...arguments),this.status=422}init(e){super.init({message:R("error:UNPROCESSABLE_ENTITY","Unprocessable entity"),severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};a(Ao,"UnprocessableEntityError");var Vs=Ao;var zs;(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"}})(zs||(zs={}));var No=class No{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};a(No,"Ast");var Gt=No;var Do=class Do extends Gt{};a(Do,"Expression");var C=Do;var So=class So extends C{};a(So,"Term");var Ue=So;var vo=class vo extends Ue{constructor(e){super(),this.value=e}toString(){return""+this.value}};a(vo,"Literal");var M=vo;var Io=class Io extends C{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new wr({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};a(Io,"ArithmeticExpression");var Be=Io,Mo=class Mo{constructor(e){Object.assign(this,e)}};a(Mo,"ArithmeticExpressionItem");var wr=Mo;var Lo=class Lo extends Ue{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};a(Lo,"ArrayExpression");var Ee=Lo;var jp=/\w/,Po=class Po extends C{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${jp.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};a(Po,"ComparisonExpression");var ue=Po;var Fo=class Fo extends C{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(Fo,"LogicalExpression");var me=Fo;var ko=class ko extends C{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(ko,"NegativeExpression");var Yt=ko;var jo=class jo extends C{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(jo,"ParenthesizedExpression");var _e=jo;var Co=class Co extends M{constructor(e){super(e)}};a(Co,"BooleanLiteral");var $e=Co;import{toDateDef as Kp}from"putil-varhelpers";var Uo=class Uo extends TypeError{};a(Uo,"SyntaxError");var br=Uo,Bo=class Bo extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};a(Bo,"FilterValidationError");var Ne=Bo,$o=class $o extends Error{constructor(e,t){super(e),Object.assign(this,t)}};a($o,"FilterParseError");var Ar=$o;var Cp=/'/g,Up=/(\\)/g,Bp=/\\(.)/g;function $p(o){return o.replace(Up,"\\\\")}a($p,"escapeString");function qp(o){return o.replace(Bp,"$1")}a(qp,"unescapeString");function Ot(o){return"'"+$p(o).replace(Cp,"\\'")+"'"}a(Ot,"quoteFilterString");function Qt(o){return o&&(o.startsWith("'")||o.startsWith('"'))&&o.endsWith(o.charAt(0))?qp(o.substring(1,o.length-1)):o}a(Qt,"unquoteFilterString");var Js=new Date(0),qo=class qo extends M{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&Kp(e,Js)!==Js){this.value=e;return}throw new Ne(`Invalid date value "${e}"`)}toString(){return Ot(this.value)}};a(qo,"DateLiteral");var xe=qo;var Ko=class Ko extends M{constructor(){super(null),this.value=null}};a(Ko,"NullLiteral");var qe=Ko;var Vo=class Vo 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 Ne(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};a(Vo,"NumberLiteral");var Oe=Vo;var zo=class zo extends M{constructor(e){super(""+e)}};a(zo,"QualifiedIdentifier");var oe=zo;var Jo=class Jo extends M{constructor(e){super(""+e)}toString(){return Ot(this.value)}};a(Jo,"StringLiteral");var Ke=Jo;var Vp=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,Wo=class Wo extends M{constructor(e){if(super(""),e instanceof Date){this.value=Nr(e.getHours())+":"+Nr(e.getMinutes())+(e.getSeconds()?":"+Nr(e.getSeconds()):"")+(e.getMilliseconds()?"."+Nr(e.getMilliseconds()):"");return}if(typeof e=="string"&&Vp.test(e)){this.value=e;return}throw new Ne(`Invalid time value "${e}"`)}toString(){return Ot(this.value)}};a(Wo,"TimeLiteral");var Ve=Wo;function Nr(o){return o<=9?"0"+o:""+o}a(Nr,"pad");import{CharStream as sc,CommonTokenStream as ac}from"@browsery/antlr4";import{ATNDeserializer as zp,DFA as Jp,Lexer as Wp,LexerATNSimulator as Gp,PredictionContextCache as Yp,Token as Qp}from"@browsery/antlr4";var q=class q extends Wp{constructor(e){super(e),this._interp=new Gp(this,q._ATN,q.DecisionsToDFA,new Yp)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return q.literalNames}get symbolicNames(){return q.symbolicNames}get ruleNames(){return q.ruleNames}get serializedATN(){return q._serializedATN}get channelNames(){return q.channelNames}get modeNames(){return q.modeNames}static get _ATN(){return q.__ATN||(q.__ATN=new zp().deserialize(q._serializedATN)),q.__ATN}};a(q,"OpraFilterLexer");var h=q;h.T__0=1;h.T__1=2;h.T__2=3;h.T__3=4;h.T__4=5;h.T__5=6;h.T__6=7;h.T__7=8;h.T__8=9;h.T__9=10;h.T__10=11;h.T__11=12;h.T__12=13;h.T__13=14;h.T__14=15;h.T__15=16;h.T__16=17;h.T__17=18;h.T__18=19;h.T__19=20;h.T__20=21;h.T__21=22;h.T__22=23;h.T__23=24;h.T__24=25;h.T__25=26;h.T__26=27;h.T__27=28;h.T__28=29;h.T__29=30;h.T__30=31;h.T__31=32;h.T__32=33;h.T__33=34;h.IDENTIFIER=35;h.POLAR_OP=36;h.DATE=37;h.DATETIME=38;h.TIME=39;h.NUMBER=40;h.INTEGER=41;h.STRING=42;h.WHITESPACE=43;h.EOF=Qp.EOF;h.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];h.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];h.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"];h.modeNames=["DEFAULT_MODE"];h.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"];h._serializedATN=[4,0,43,426,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,1,0,1,0,1,1,1,1,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,24,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,32,1,32,1,32,1,33,1,33,1,33,1,34,1,34,5,34,225,8,34,10,34,12,34,228,9,34,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,3,36,240,8,36,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,256,8,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,3,38,266,8,38,1,39,3,39,269,8,39,1,39,4,39,272,8,39,11,39,12,39,273,1,39,1,39,5,39,278,8,39,10,39,12,39,281,9,39,3,39,283,8,39,1,39,1,39,3,39,287,8,39,1,39,4,39,290,8,39,11,39,12,39,291,3,39,294,8,39,1,39,1,39,1,39,1,39,4,39,300,8,39,11,39,12,39,301,3,39,304,8,39,1,40,3,40,307,8,40,1,40,4,40,310,8,40,11,40,12,40,311,1,40,1,40,1,40,1,40,4,40,318,8,40,11,40,12,40,319,3,40,322,8,40,1,41,1,41,1,41,5,41,327,8,41,10,41,12,41,330,9,41,1,41,1,41,1,41,1,41,5,41,336,8,41,10,41,12,41,339,9,41,1,41,3,41,342,8,41,1,42,4,42,345,8,42,11,42,12,42,346,1,42,1,42,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,362,8,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,371,8,44,1,45,1,45,1,45,1,45,3,45,377,8,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,4,45,389,8,45,11,45,12,45,390,3,45,393,8,45,3,45,395,8,45,1,46,1,46,1,46,3,46,400,8,46,1,46,1,46,1,46,3,46,405,8,46,1,46,1,46,1,46,3,46,410,8,46,3,46,412,8,46,1,47,1,47,1,47,3,47,417,8,47,1,48,1,48,1,48,1,48,1,48,1,48,1,49,1,49,0,0,50,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,0,89,0,91,0,93,0,95,0,97,0,99,0,1,0,16,4,0,36,36,65,90,95,95,97,122,5,0,36,36,48,57,65,90,95,95,97,122,2,0,43,43,45,45,1,0,39,39,1,0,34,34,3,0,9,10,13,13,32,32,1,0,48,57,1,0,48,48,1,0,49,57,1,0,49,49,1,0,48,50,1,0,49,51,1,0,48,49,1,0,48,51,1,0,48,53,3,0,48,57,65,70,97,102,453,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,1,101,1,0,0,0,3,103,1,0,0,0,5,105,1,0,0,0,7,109,1,0,0,0,9,111,1,0,0,0,11,113,1,0,0,0,13,115,1,0,0,0,15,117,1,0,0,0,17,119,1,0,0,0,19,121,1,0,0,0,21,126,1,0,0,0,23,132,1,0,0,0,25,137,1,0,0,0,27,146,1,0,0,0,29,155,1,0,0,0,31,157,1,0,0,0,33,159,1,0,0,0,35,161,1,0,0,0,37,163,1,0,0,0,39,166,1,0,0,0,41,168,1,0,0,0,43,170,1,0,0,0,45,173,1,0,0,0,47,175,1,0,0,0,49,178,1,0,0,0,51,181,1,0,0,0,53,185,1,0,0,0,55,190,1,0,0,0,57,196,1,0,0,0,59,202,1,0,0,0,61,209,1,0,0,0,63,213,1,0,0,0,65,216,1,0,0,0,67,219,1,0,0,0,69,222,1,0,0,0,71,229,1,0,0,0,73,239,1,0,0,0,75,255,1,0,0,0,77,265,1,0,0,0,79,303,1,0,0,0,81,321,1,0,0,0,83,341,1,0,0,0,85,344,1,0,0,0,87,350,1,0,0,0,89,352,1,0,0,0,91,376,1,0,0,0,93,411,1,0,0,0,95,413,1,0,0,0,97,418,1,0,0,0,99,424,1,0,0,0,101,102,5,40,0,0,102,2,1,0,0,0,103,104,5,41,0,0,104,4,1,0,0,0,105,106,5,110,0,0,106,107,5,111,0,0,107,108,5,116,0,0,108,6,1,0,0,0,109,110,5,33,0,0,110,8,1,0,0,0,111,112,5,46,0,0,112,10,1,0,0,0,113,114,5,64,0,0,114,12,1,0,0,0,115,116,5,91,0,0,116,14,1,0,0,0,117,118,5,44,0,0,118,16,1,0,0,0,119,120,5,93,0,0,120,18,1,0,0,0,121,122,5,116,0,0,122,123,5,114,0,0,123,124,5,117,0,0,124,125,5,101,0,0,125,20,1,0,0,0,126,127,5,102,0,0,127,128,5,97,0,0,128,129,5,108,0,0,129,130,5,115,0,0,130,131,5,101,0,0,131,22,1,0,0,0,132,133,5,110,0,0,133,134,5,117,0,0,134,135,5,108,0,0,135,136,5,108,0,0,136,24,1,0,0,0,137,138,5,73,0,0,138,139,5,110,0,0,139,140,5,102,0,0,140,141,5,105,0,0,141,142,5,110,0,0,142,143,5,105,0,0,143,144,5,116,0,0,144,145,5,121,0,0,145,26,1,0,0,0,146,147,5,105,0,0,147,148,5,110,0,0,148,149,5,102,0,0,149,150,5,105,0,0,150,151,5,110,0,0,151,152,5,105,0,0,152,153,5,116,0,0,153,154,5,121,0,0,154,28,1,0,0,0,155,156,5,43,0,0,156,30,1,0,0,0,157,158,5,45,0,0,158,32,1,0,0,0,159,160,5,42,0,0,160,34,1,0,0,0,161,162,5,47,0,0,162,36,1,0,0,0,163,164,5,60,0,0,164,165,5,61,0,0,165,38,1,0,0,0,166,167,5,60,0,0,167,40,1,0,0,0,168,169,5,62,0,0,169,42,1,0,0,0,170,171,5,62,0,0,171,172,5,61,0,0,172,44,1,0,0,0,173,174,5,61,0,0,174,46,1,0,0,0,175,176,5,33,0,0,176,177,5,61,0,0,177,48,1,0,0,0,178,179,5,105,0,0,179,180,5,110,0,0,180,50,1,0,0,0,181,182,5,33,0,0,182,183,5,105,0,0,183,184,5,110,0,0,184,52,1,0,0,0,185,186,5,108,0,0,186,187,5,105,0,0,187,188,5,107,0,0,188,189,5,101,0,0,189,54,1,0,0,0,190,191,5,33,0,0,191,192,5,108,0,0,192,193,5,105,0,0,193,194,5,107,0,0,194,195,5,101,0,0,195,56,1,0,0,0,196,197,5,105,0,0,197,198,5,108,0,0,198,199,5,105,0,0,199,200,5,107,0,0,200,201,5,101,0,0,201,58,1,0,0,0,202,203,5,33,0,0,203,204,5,105,0,0,204,205,5,108,0,0,205,206,5,105,0,0,206,207,5,107,0,0,207,208,5,101,0,0,208,60,1,0,0,0,209,210,5,97,0,0,210,211,5,110,0,0,211,212,5,100,0,0,212,62,1,0,0,0,213,214,5,111,0,0,214,215,5,114,0,0,215,64,1,0,0,0,216,217,5,38,0,0,217,218,5,38,0,0,218,66,1,0,0,0,219,220,5,124,0,0,220,221,5,124,0,0,221,68,1,0,0,0,222,226,7,0,0,0,223,225,7,1,0,0,224,223,1,0,0,0,225,228,1,0,0,0,226,224,1,0,0,0,226,227,1,0,0,0,227,70,1,0,0,0,228,226,1,0,0,0,229,230,7,2,0,0,230,72,1,0,0,0,231,232,5,39,0,0,232,233,3,89,44,0,233,234,5,39,0,0,234,240,1,0,0,0,235,236,5,34,0,0,236,237,3,89,44,0,237,238,5,34,0,0,238,240,1,0,0,0,239,231,1,0,0,0,239,235,1,0,0,0,240,74,1,0,0,0,241,242,5,39,0,0,242,243,3,89,44,0,243,244,5,84,0,0,244,245,3,91,45,0,245,246,3,93,46,0,246,247,5,39,0,0,247,256,1,0,0,0,248,249,5,34,0,0,249,250,3,89,44,0,250,251,5,84,0,0,251,252,3,91,45,0,252,253,3,93,46,0,253,254,5,34,0,0,254,256,1,0,0,0,255,241,1,0,0,0,255,248,1,0,0,0,256,76,1,0,0,0,257,258,5,39,0,0,258,259,3,91,45,0,259,260,5,39,0,0,260,266,1,0,0,0,261,262,5,34,0,0,262,263,3,91,45,0,263,264,5,34,0,0,264,266,1,0,0,0,265,257,1,0,0,0,265,261,1,0,0,0,266,78,1,0,0,0,267,269,3,71,35,0,268,267,1,0,0,0,268,269,1,0,0,0,269,271,1,0,0,0,270,272,3,87,43,0,271,270,1,0,0,0,272,273,1,0,0,0,273,271,1,0,0,0,273,274,1,0,0,0,274,282,1,0,0,0,275,279,5,46,0,0,276,278,3,87,43,0,277,276,1,0,0,0,278,281,1,0,0,0,279,277,1,0,0,0,279,280,1,0,0,0,280,283,1,0,0,0,281,279,1,0,0,0,282,275,1,0,0,0,282,283,1,0,0,0,283,293,1,0,0,0,284,286,5,69,0,0,285,287,7,2,0,0,286,285,1,0,0,0,286,287,1,0,0,0,287,289,1,0,0,0,288,290,3,87,43,0,289,288,1,0,0,0,290,291,1,0,0,0,291,289,1,0,0,0,291,292,1,0,0,0,292,294,1,0,0,0,293,284,1,0,0,0,293,294,1,0,0,0,294,304,1,0,0,0,295,296,5,48,0,0,296,297,5,120,0,0,297,299,1,0,0,0,298,300,3,99,49,0,299,298,1,0,0,0,300,301,1,0,0,0,301,299,1,0,0,0,301,302,1,0,0,0,302,304,1,0,0,0,303,268,1,0,0,0,303,295,1,0,0,0,304,80,1,0,0,0,305,307,3,71,35,0,306,305,1,0,0,0,306,307,1,0,0,0,307,309,1,0,0,0,308,310,3,87,43,0,309,308,1,0,0,0,310,311,1,0,0,0,311,309,1,0,0,0,311,312,1,0,0,0,312,322,1,0,0,0,313,314,5,48,0,0,314,315,5,120,0,0,315,317,1,0,0,0,316,318,3,99,49,0,317,316,1,0,0,0,318,319,1,0,0,0,319,317,1,0,0,0,319,320,1,0,0,0,320,322,1,0,0,0,321,306,1,0,0,0,321,313,1,0,0,0,322,82,1,0,0,0,323,328,5,39,0,0,324,327,3,95,47,0,325,327,8,3,0,0,326,324,1,0,0,0,326,325,1,0,0,0,327,330,1,0,0,0,328,326,1,0,0,0,328,329,1,0,0,0,329,331,1,0,0,0,330,328,1,0,0,0,331,342,5,39,0,0,332,337,5,34,0,0,333,336,3,95,47,0,334,336,8,4,0,0,335,333,1,0,0,0,335,334,1,0,0,0,336,339,1,0,0,0,337,335,1,0,0,0,337,338,1,0,0,0,338,340,1,0,0,0,339,337,1,0,0,0,340,342,5,34,0,0,341,323,1,0,0,0,341,332,1,0,0,0,342,84,1,0,0,0,343,345,7,5,0,0,344,343,1,0,0,0,345,346,1,0,0,0,346,344,1,0,0,0,346,347,1,0,0,0,347,348,1,0,0,0,348,349,6,42,0,0,349,86,1,0,0,0,350,351,7,6,0,0,351,88,1,0,0,0,352,353,7,6,0,0,353,354,7,6,0,0,354,355,7,6,0,0,355,356,7,6,0,0,356,361,5,45,0,0,357,358,7,7,0,0,358,362,7,8,0,0,359,360,7,9,0,0,360,362,7,10,0,0,361,357,1,0,0,0,361,359,1,0,0,0,362,363,1,0,0,0,363,370,5,45,0,0,364,365,7,11,0,0,365,371,7,7,0,0,366,367,7,10,0,0,367,371,7,8,0,0,368,369,5,51,0,0,369,371,5,49,0,0,370,364,1,0,0,0,370,366,1,0,0,0,370,368,1,0,0,0,371,90,1,0,0,0,372,373,7,12,0,0,373,377,7,6,0,0,374,375,5,50,0,0,375,377,7,13,0,0,376,372,1,0,0,0,376,374,1,0,0,0,377,378,1,0,0,0,378,379,5,58,0,0,379,380,7,14,0,0,380,381,7,6,0,0,381,394,1,0,0,0,382,383,5,58,0,0,383,384,7,14,0,0,384,385,7,6,0,0,385,392,1,0,0,0,386,388,5,46,0,0,387,389,7,6,0,0,388,387,1,0,0,0,389,390,1,0,0,0,390,388,1,0,0,0,390,391,1,0,0,0,391,393,1,0,0,0,392,386,1,0,0,0,392,393,1,0,0,0,393,395,1,0,0,0,394,382,1,0,0,0,394,395,1,0,0,0,395,92,1,0,0,0,396,412,5,90,0,0,397,404,7,2,0,0,398,400,7,12,0,0,399,398,1,0,0,0,399,400,1,0,0,0,400,401,1,0,0,0,401,405,7,6,0,0,402,403,5,50,0,0,403,405,7,13,0,0,404,399,1,0,0,0,404,402,1,0,0,0,405,409,1,0,0,0,406,407,5,58,0,0,407,408,7,14,0,0,408,410,7,6,0,0,409,406,1,0,0,0,409,410,1,0,0,0,410,412,1,0,0,0,411,396,1,0,0,0,411,397,1,0,0,0,412,94,1,0,0,0,413,416,5,92,0,0,414,417,3,97,48,0,415,417,9,0,0,0,416,414,1,0,0,0,416,415,1,0,0,0,417,96,1,0,0,0,418,419,5,117,0,0,419,420,3,99,49,0,420,421,3,99,49,0,421,422,3,99,49,0,422,423,3,99,49,0,423,98,1,0,0,0,424,425,7,15,0,0,425,100,1,0,0,0,35,0,226,239,255,265,268,273,279,282,286,291,293,301,303,306,311,319,321,326,328,335,337,341,346,361,370,376,390,392,394,399,404,409,411,416,1,0,1,0];h.DecisionsToDFA=h._ATN.decisionToState.map((o,e)=>new Jp(o,e));var Ws=h;import{ATN as Gs,ATNDeserializer as Xp,DFA as Zp,FailedPredicateException as Hp,NoViableAltException as Go,Parser as ec,ParserATNSimulator as tc,ParserRuleContext as B,PredictionContextCache as rc,RecognitionException as U,Token as ic}from"@browsery/antlr4";var E=class E extends ec{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return E.literalNames}get symbolicNames(){return E.symbolicNames}get ruleNames(){return E.ruleNames}get serializedATN(){return E._serializedATN}createFailedPredicateException(e,t){return new Hp(this,e,t)}constructor(e){super(e),this._interp=new tc(this,E._ATN,E.DecisionsToDFA,new rc)}root(){let e=new Yo(this,this._ctx,this.state);this.enterRule(e,0,E.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(E.EOF)}catch(t){if(t instanceof U)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 G(this,this._ctx,r),n=i,s=2;this.enterRecursionRule(i,2,E.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 Zo(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 Qo(this,i),this._ctx=i,n=i,this.state=42,this.match(E.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(E.T__1);break;case 3:case 4:i=new Xo(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 Go(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!==Gs.INVALID_ALT_NUMBER;){if(c===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),n=i;{if(i=new Xt(this,new G(this,t,r)),this.pushNewRecursionContext(i,s,E.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 U)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 Dr(this,this._ctx,this.state);this.enterRule(e,4,E.RULE_comparisonLeft);try{this.enterOuterAlt(e,1),this.state=59,this.qualifiedIdentifier()}catch(t){if(t instanceof U)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 Sr(this,this._ctx,this.state);this.enterRule(e,6,E.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 Go(this)}}catch(t){if(t instanceof U)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 vr(this,this._ctx,this.state);this.enterRule(e,8,E.RULE_parenthesizedItem);try{this.enterOuterAlt(e,1),this.state=67,this.expression(0)}catch(t){if(t instanceof U)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 V(this,this._ctx,this.state);this.enterRule(e,10,E.RULE_value);try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 40:e=new an(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(E.NUMBER);break;case 13:case 14:e=new nn(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new sn(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new en(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 37:e=new on(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(E.DATE);break;case 38:e=new tn(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(E.DATETIME);break;case 39:e=new Ho(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(E.TIME);break;case 42:e=new rn(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(E.STRING);break;default:throw new Go(this)}}catch(t){if(t instanceof U)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 Zt(this,this._ctx,this.state);this.enterRule(e,12,E.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!==Gs.INVALID_ALT_NUMBER;)t===1&&(this.state=79,this.identifier(),this.state=80,this.match(E.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 U)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 Ir(this,this._ctx,this.state);this.enterRule(e,14,E.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(E.T__5),this.state=90,this.identifier()}catch(t){if(t instanceof U)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 gt(this,this._ctx,this.state);this.enterRule(e,16,E.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(E.IDENTIFIER)}catch(t){if(t instanceof U)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 Mr(this,this._ctx,this.state);this.enterRule(e,18,E.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(E.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(E.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(E.T__8)}}catch(r){if(r instanceof U)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 Lr(this,this._ctx,this.state);this.enterRule(e,20,E.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 U)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 Pr(this,this._ctx,this.state);this.enterRule(e,22,E.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(E.T__11)}catch(t){if(t instanceof U)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 Fr(this,this._ctx,this.state);this.enterRule(e,24,E.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 U)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 pn(this,this._ctx,this.state);this.enterRule(e,26,E.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 U)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 kr(this,this._ctx,this.state);this.enterRule(e,28,E.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 U)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 jr(this,this._ctx,this.state);this.enterRule(e,30,E.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 U)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 cn(this,this._ctx,this.state);this.enterRule(e,32,E.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(E.POLAR_OP)}catch(t){if(t instanceof U)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 E.__ATN||(E.__ATN=new Xp().deserialize(E._serializedATN)),E.__ATN}};a(E,"OpraFilterParser");var f=E;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=ic.EOF;f.RULE_root=0;f.RULE_expression=1;f.RULE_comparisonLeft=2;f.RULE_comparisonRight=3;f.RULE_parenthesizedItem=4;f.RULE_value=5;f.RULE_qualifiedIdentifier=6;f.RULE_externalConstant=7;f.RULE_identifier=8;f.RULE_arrayValue=9;f.RULE_boolean=10;f.RULE_null=11;f.RULE_infinity=12;f.RULE_arithmeticOperator=13;f.RULE_comparisonOperator=14;f.RULE_logicalOperator=15;f.RULE_polarityOperator=16;f.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];f.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];f.ruleNames=["root","expression","comparisonLeft","comparisonRight","parenthesizedItem","value","qualifiedIdentifier","externalConstant","identifier","arrayValue","boolean","null","infinity","arithmeticOperator","comparisonOperator","logicalOperator","polarityOperator"];f._serializedATN=[4,1,43,120,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,49,8,1,1,1,1,1,1,1,1,1,5,1,55,8,1,10,1,12,1,58,9,1,1,2,1,2,1,3,1,3,1,3,1,3,3,3,66,8,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,78,8,5,1,6,1,6,1,6,5,6,83,8,6,10,6,12,6,86,9,6,1,6,1,6,1,7,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,5,9,99,8,9,10,9,12,9,102,9,9,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,16,0,1,2,17,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,0,6,1,0,3,4,1,0,10,11,1,0,13,14,1,0,15,18,1,0,19,30,1,0,31,34,117,0,34,1,0,0,0,2,48,1,0,0,0,4,59,1,0,0,0,6,65,1,0,0,0,8,67,1,0,0,0,10,77,1,0,0,0,12,84,1,0,0,0,14,89,1,0,0,0,16,92,1,0,0,0,18,94,1,0,0,0,20,105,1,0,0,0,22,107,1,0,0,0,24,109,1,0,0,0,26,111,1,0,0,0,28,113,1,0,0,0,30,115,1,0,0,0,32,117,1,0,0,0,34,35,3,2,1,0,35,36,5,0,0,1,36,1,1,0,0,0,37,38,6,1,-1,0,38,39,3,4,2,0,39,40,3,28,14,0,40,41,3,6,3,0,41,49,1,0,0,0,42,43,5,1,0,0,43,44,3,8,4,0,44,45,5,2,0,0,45,49,1,0,0,0,46,47,7,0,0,0,47,49,3,2,1,1,48,37,1,0,0,0,48,42,1,0,0,0,48,46,1,0,0,0,49,56,1,0,0,0,50,51,10,3,0,0,51,52,3,30,15,0,52,53,3,2,1,4,53,55,1,0,0,0,54,50,1,0,0,0,55,58,1,0,0,0,56,54,1,0,0,0,56,57,1,0,0,0,57,3,1,0,0,0,58,56,1,0,0,0,59,60,3,12,6,0,60,5,1,0,0,0,61,66,3,10,5,0,62,66,3,12,6,0,63,66,3,14,7,0,64,66,3,18,9,0,65,61,1,0,0,0,65,62,1,0,0,0,65,63,1,0,0,0,65,64,1,0,0,0,66,7,1,0,0,0,67,68,3,2,1,0,68,9,1,0,0,0,69,78,5,40,0,0,70,78,3,24,12,0,71,78,3,20,10,0,72,78,3,22,11,0,73,78,5,37,0,0,74,78,5,38,0,0,75,78,5,39,0,0,76,78,5,42,0,0,77,69,1,0,0,0,77,70,1,0,0,0,77,71,1,0,0,0,77,72,1,0,0,0,77,73,1,0,0,0,77,74,1,0,0,0,77,75,1,0,0,0,77,76,1,0,0,0,78,11,1,0,0,0,79,80,3,16,8,0,80,81,5,5,0,0,81,83,1,0,0,0,82,79,1,0,0,0,83,86,1,0,0,0,84,82,1,0,0,0,84,85,1,0,0,0,85,87,1,0,0,0,86,84,1,0,0,0,87,88,3,16,8,0,88,13,1,0,0,0,89,90,5,6,0,0,90,91,3,16,8,0,91,15,1,0,0,0,92,93,5,35,0,0,93,17,1,0,0,0,94,95,5,7,0,0,95,100,3,10,5,0,96,97,5,8,0,0,97,99,3,10,5,0,98,96,1,0,0,0,99,102,1,0,0,0,100,98,1,0,0,0,100,101,1,0,0,0,101,103,1,0,0,0,102,100,1,0,0,0,103,104,5,9,0,0,104,19,1,0,0,0,105,106,7,1,0,0,106,21,1,0,0,0,107,108,5,12,0,0,108,23,1,0,0,0,109,110,7,2,0,0,110,25,1,0,0,0,111,112,7,3,0,0,112,27,1,0,0,0,113,114,7,4,0,0,114,29,1,0,0,0,115,116,7,5,0,0,116,31,1,0,0,0,117,118,5,36,0,0,118,33,1,0,0,0,6,48,56,65,77,84,100];f.DecisionsToDFA=f._ATN.decisionToState.map((o,e)=>new Zp(o,e));var Ys=f,ln=class ln extends B{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(G,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(ln,"RootContext");var Yo=ln,fn=class fn extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_expression}copyFrom(e){super.copyFrom(e)}};a(fn,"ExpressionContext");var G=fn,un=class un extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(vr,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(un,"ParenthesizedExpressionContext");var Qo=un,mn=class mn extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(G,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(mn,"NegativeExpressionContext");var Xo=mn,dn=class dn extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(Dr,0)}comparisonOperator(){return this.getTypedRuleContext(kr,0)}comparisonRight(){return this.getTypedRuleContext(Sr,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(dn,"ComparisonExpressionContext");var Zo=dn,hn=class hn extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(G)}expression(e){return this.getTypedRuleContext(G,e)}logicalOperator(){return this.getTypedRuleContext(jr,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 Xt=hn,yn=class yn extends B{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(Zt,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(yn,"ComparisonLeftContext");var Dr=yn,Tn=class Tn extends B{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(V,0)}qualifiedIdentifier(){return this.getTypedRuleContext(Zt,0)}externalConstant(){return this.getTypedRuleContext(Ir,0)}arrayValue(){return this.getTypedRuleContext(Mr,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(Tn,"ComparisonRightContext");var Sr=Tn,En=class En extends B{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(G,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(En,"ParenthesizedItemContext");var vr=En,_n=class _n extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_value}copyFrom(e){super.copyFrom(e)}};a(_n,"ValueContext");var V=_n,xn=class xn extends V{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(xn,"TimeLiteralContext");var Ho=xn,On=class On extends V{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(Pr,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(On,"NullLiteralContext");var en=On,gn=class gn extends V{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(gn,"DateTimeLiteralContext");var tn=gn,Rn=class Rn extends V{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(Rn,"StringLiteralContext");var rn=Rn,wn=class wn extends V{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(wn,"DateLiteralContext");var on=wn,bn=class bn extends V{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(Fr,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(bn,"InfinityLiteralContext");var nn=bn,An=class An extends V{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(Lr,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(An,"BooleanLiteralContext");var sn=An,Nn=class Nn extends V{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(Nn,"NumberLiteralContext");var an=Nn,Dn=class Dn extends B{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(gt)}identifier(e){return this.getTypedRuleContext(gt,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(Dn,"QualifiedIdentifierContext");var Zt=Dn,Sn=class Sn extends B{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(gt,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(Sn,"ExternalConstantContext");var Ir=Sn,vn=class vn extends B{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(vn,"IdentifierContext");var gt=vn,In=class In extends B{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(V)}value(e){return this.getTypedRuleContext(V,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(In,"ArrayValueContext");var Mr=In,Mn=class Mn extends B{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(Mn,"BooleanContext");var Lr=Mn,Ln=class Ln extends B{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(Ln,"NullContext");var Pr=Ln,Pn=class Pn extends B{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(Pn,"InfinityContext");var Fr=Pn,Fn=class Fn extends B{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(Fn,"ArithmeticOperatorContext");var pn=Fn,kn=class kn extends B{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(kn,"ComparisonOperatorContext");var kr=kn,jn=class jn extends B{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(jn,"LogicalOperatorContext");var jr=jn,Cn=class Cn extends B{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(Cn,"PolarityOperatorContext");var cn=Cn;import{ParseTreeVisitor as oc}from"@browsery/antlr4";var Un=class Un extends M{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};a(Un,"ExternalConstant");var Cr=Un;var Bn=class Bn extends oc{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 _e(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new Yt(t)}visitComparisonExpression(e){return new ue({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 Xt&&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 me({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new oe(e.getText())}visitExternalConstant(e){return new Cr(e.identifier().getText())}visitNullLiteral(){return new qe}visitBooleanLiteral(e){return new $e(e.getText()==="true")}visitNumberLiteral(e){return new Oe(e.getText())}visitStringLiteral(e){return new Ke(Qt(e.getText()))}visitInfinityLiteral(){return new Oe(1/0)}visitDateLiteral(e){return new xe(Qt(e.getText()))}visitDateTimeLiteral(e){return new xe(Qt(e.getText()))}visitTimeLiteral(e){return new Ve(Qt(e.getText()))}visitArrayValue(e){return new Ee(e.value_list().map(t=>this.visit(t)))}};a(Bn,"FilterTreeVisitor");var Ht=Bn;import{ErrorListener as nc}from"@browsery/antlr4";var $n=class $n extends nc{constructor(e){super(),this.errors=e}syntaxError(e,t,r,i,n,s){this.errors.push(new Ar(n,{recognizer:e,offendingSymbol:t,line:r,column:i,e:s}))}};a($n,"OpraErrorListener");var er=$n;function qn(o,e){let t=new sc(o),r=new Ws(t),i=new ac(r),n=new Ys(i);n.buildParseTrees=!0;let s=[],p=new er(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 _=new
|
|
9
|
-
`));throw _.errors=s,_}return e=e||new Ht,e.visit(c)}a(qn,"parse");var Kn=class Kn{constructor(e,t){if(this._rules=new N,this._decoderCache=new WeakMap,Object.defineProperty(this,"_rules",{value:new N(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,pc({...t,operators:r}))}normalizeFilter(e,t,r){let i=typeof e=="string"?qn(e):e;return this.normalizeFilterAst(i,[],t,r)}normalizeFilterAst(e,t,r,i){if(e instanceof ue){if(t.push(e),this.normalizeFilterAst(e.left,t,r),!(e.left instanceof oe&&e.left.field))throw new TypeError("Invalid filter query. Left side should be a data field.");let n=this._rules.get(e.left.value);if(!n)throw new Te({message:R("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 Te({message:R("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 me)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof Be)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n.expression,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 _e)return t.push(e),this.normalizeFilterAst(e.expression,t,r),t.pop(),e;if(e instanceof oe&&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 ue);if(n>=0){let s=t[n];if((e===s.right||t[n+1]===s.right)&&s&&s.left instanceof oe&&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=cc: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(Kn,"FilterRules");var ge=Kn;var tr={};cs(tr,{$and:()=>fc,$arithmetic:()=>Sc,$array:()=>Qs,$date:()=>uc,$eq:()=>yc,$field:()=>hc,$gt:()=>Ec,$gte:()=>_c,$ilike:()=>Ac,$in:()=>gc,$like:()=>wc,$lt:()=>xc,$lte:()=>Oc,$ne:()=>Tc,$notILike:()=>Nc,$notIn:()=>Rc,$notLike:()=>bc,$number:()=>dc,$or:()=>lc,$paren:()=>Dc,$time:()=>mc,ArithmeticExpression:()=>Be,ArithmeticExpressionItem:()=>wr,ArrayExpression:()=>Ee,Ast:()=>Gt,BooleanLiteral:()=>$e,ComparisonExpression:()=>ue,DateLiteral:()=>xe,Expression:()=>C,FilterTreeVisitor:()=>Ht,Literal:()=>M,LogicalExpression:()=>me,NegativeExpression:()=>Yt,NullLiteral:()=>qe,NumberLiteral:()=>Oe,OpraErrorListener:()=>er,ParenthesizedExpression:()=>_e,QualifiedIdentifier:()=>oe,StringLiteral:()=>Ke,Term:()=>Ue,TimeLiteral:()=>Ve,parse:()=>qn});function lc(...o){return new me({op:"or",items:o})}a(lc,"$or");function fc(...o){return new me({op:"and",items:o})}a(fc,"$and");function uc(o){return new xe(o)}a(uc,"$date");function mc(o){return new Ve(o)}a(mc,"$time");function dc(o){return new Oe(o)}a(dc,"$number");function Qs(...o){return new Ee(o.map(Ur))}a(Qs,"$array");function hc(o){return new oe(o)}a(hc,"$field");function yc(o,e){return ee("=",o,e)}a(yc,"$eq");function Tc(o,e){return ee("!=",o,e)}a(Tc,"$ne");function Ec(o,e){return ee(">",o,e)}a(Ec,"$gt");function _c(o,e){return ee(">=",o,e)}a(_c,"$gte");function xc(o,e){return ee("<",o,e)}a(xc,"$lt");function Oc(o,e){return ee("<=",o,e)}a(Oc,"$lte");function gc(o,e){return ee("in",o,e)}a(gc,"$in");function Rc(o,e){return ee("!in",o,e)}a(Rc,"$notIn");function wc(o,e){return ee("like",o,e)}a(wc,"$like");function bc(o,e){return ee("!like",o,e)}a(bc,"$notLike");function Ac(o,e){return ee("ilike",o,e)}a(Ac,"$ilike");function Nc(o,e){return ee("!ilike",o,e)}a(Nc,"$notILike");function Dc(o){return new _e(o)}a(Dc,"$paren");function Sc(o){let e=new Be;return e.add=t=>(e.append("+",Rt(t)),e),e.sub=t=>(e.append("-",Rt(t)),e),e.mul=t=>(e.append("*",Rt(t)),e),e.div=t=>(e.append("/",Rt(t)),e),e.append("+",Ur(o)),e}a(Sc,"$arithmetic");function ee(o,e,t){let r=Ur(e),i=Ur(t);return new ue({op:o,left:r,right:i})}a(ee,"comparisonExpression");var Ur=a(o=>Array.isArray(o)?Qs(...o.map(Rt)):Rt(o),"wrapEntryValue"),Rt=a(o=>o instanceof C?o:typeof o=="boolean"?new $e(o):typeof o=="number"||typeof o=="bigint"?new Oe(o):o==null?new qe:o instanceof Date?new xe(o):new Ke(""+o),"_wrapEntryValue");var wt,ne=(wt=class{constructor(e){e&&Object.assign(this,e)}[y](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),i=e.rules?new ge(e.rules):void 0;return vc(r,i)}[x](){return Ic}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(wt,"FilterType"),wt);Vn([u.Attribute({description:"Data type which filtering fields belong to"}),zn("design:type",Object)],ne.prototype,"dataType",void 0);Vn([u.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),zn("design:type",Object)],ne.prototype,"rules",void 0);ne=Vn([u({name:"filter",description:"A query filter",nameMappings:{js:"object",json:"string"}}),zn("design:paramtypes",[Object])],ne);var vc=a((o,e,t)=>Xs("decodeFilter",(r,i,n)=>{if(typeof r=="string")try{let s=tr.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"),Ic=Xs("encodeFilter",(o,e,t)=>{if(o instanceof tr.Ast)return o.toString();e.fail(t,"Not a valid filter expression",o)});import{__decorate as Mc,__metadata as Lc}from"tslib";import{vg as Zs}from"valgen";var bt,Br=(bt=class{constructor(e){e&&Object.assign(this,e)}[y](){return Zs.isObjectId({coerce:!0})}[x](){return Zs.isObjectId({coerce:!0})}},a(bt,"ObjectIdType"),bt);Br=Mc([u({name:"ObjectId",description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),Lc("design:paramtypes",[Object])],Br);import{__decorate as de,__metadata as he}from"tslib";var At,Y=(At=class{constructor(e){e&&Object.assign(this,e)}},a(At,"OperationResult"),At);de([P(),he("design:type",Number)],Y.prototype,"affected",void 0);de([P(),he("design:type",Number)],Y.prototype,"totalMatches",void 0);de([P(),he("design:type",String)],Y.prototype,"context",void 0);de([P(),he("design:type",String)],Y.prototype,"type",void 0);de([P(),he("design:type",String)],Y.prototype,"message",void 0);de([P({type:"any"}),he("design:type",Object)],Y.prototype,"payload",void 0);de([P({type:"object"}),he("design:type",Array)],Y.prototype,"errors",void 0);Y=de([Q({name:"OperationResult",description:"Operation result"}),he("design:paramtypes",[Object])],Y);(function(o){function e(t){var i;let r=(i=class extends o{constructor(...s){super(...s)}},a(i,"OperationResult_"),i);return de([P({type:t,required:!0}),he("design:type",Object)],r.prototype,"payload",void 0),r=de([Q({embedded:!0}),he("design:paramtypes",[Object])],r),r}a(e,"forPayload"),o.forPayload=e})(Y||(Y={}));import{__decorate as Jn,__metadata as Wn}from"tslib";import{vg as $r}from"valgen";var Pc=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,Nt,Dt=(Nt=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=$r.matches(Pc,{formatName:"time",coerce:!0}),r=[];return e.minValue&&r.push($r.isGte(e.minValue)),e.maxValue&&r.push($r.isLte(e.maxValue)),r.length>0?$r.pipe([t,...r],{returnIndex:0}):t}[x](e){return this[y](e)}},a(Nt,"TimeType"),Nt);Jn([u.Attribute({description:"Minimum value"}),Wn("design:type",String)],Dt.prototype,"minValue",void 0);Jn([u.Attribute({description:"Maximum value"}),Wn("design:type",String)],Dt.prototype,"maxValue",void 0);Dt=Jn([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"),Wn("design:paramtypes",[Object])],Dt);import{__decorate as Fc,__metadata as kc}from"tslib";import{vg as Hs}from"valgen";var St,qr=(St=class{constructor(e){e&&Object.assign(this,e)}[y](){return Hs.isURL({coerce:!0})}[x](){return Hs.isURL({coerce:!0})}},a(St,"UrlType"),St);qr=Fc([u({name:"url",description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),kc("design:paramtypes",[Object])],qr);import{__decorate as ta,__metadata as ra}from"tslib";import{vg as ea}from"valgen";var vt,rr=(vt=class{constructor(e){e&&Object.assign(this,e)}[y](e){return ea.isUUID(e==null?void 0:e.version,{coerce:!0})}[x](e){return ea.isUUID(e==null?void 0:e.version,{coerce:!0})}},a(vt,"UuidType"),vt);ta([u.Attribute({description:"Version of the UUID"}),ra("design:type",Number)],rr.prototype,"version",void 0);rr=ta([u({name:"uuid",description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),ra("design:paramtypes",[Object])],rr);function De(o,e,t){let r=mr(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"&&lr(this,o,r)}}}[n];if(typeof o=="function"&&cr(s.prototype,o.prototype),typeof o=="function"){let c=Reflect.getOwnMetadata(T,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(T,p,s),typeof o=="function"&&Fe._applyMixin(s,o,{...e,isInheritedPredicate:r}),s}a(De,"createMappedClass");function g3(o,e,t){return De(o,{omit:e},t)}a(g3,"OmitType");function A3(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return De(o,{partial:t},r)}a(A3,"PartialType");function v3(o,e,t){return De(o,{pick:e},t)}a(v3,"PickType");import{__decorate as jc,__metadata as Cc}from"tslib";import{isAny as ia}from"valgen";var It,Kr=(It=class{constructor(e){e&&Object.assign(this,e)}[y](){return ia}[x](){return ia}},a(It,"AnyType"),It);Kr=jc([u({name:"any",description:"Represents any value"}),Cc("design:paramtypes",[Object])],Kr);import{__decorate as Uc,__metadata as Bc}from"tslib";import{toBigint as na,vg as Xn}from"valgen";import{__decorate as Yn,__metadata as Qn}from"tslib";import{toNumber as oa,vg as Gn}from"valgen";var Mt,ye=(Mt=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=[];return e.minValue&&t.push(Gn.isGte(e.minValue)),e.maxValue&&t.push(Gn.isLte(e.maxValue)),t.length>0?Gn.pipe([oa,...t],{returnIndex:0}):oa}[x](e){return this[y](e)}},a(Mt,"NumberType"),Mt);Yn([u.Attribute({description:"Determines the minimum value"}),Qn("design:type",Number)],ye.prototype,"minValue",void 0);Yn([u.Attribute({description:"Determines the maximum value"}),Qn("design:type",Number)],ye.prototype,"maxValue",void 0);ye=Yn([u({name:"number",description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),Qn("design:paramtypes",[Object])],ye);var Lt,Vr=(Lt=class extends ye{constructor(e){super(e)}[y](e){let t=[];return e.minValue&&t.push(Xn.isGte(e.minValue)),e.maxValue&&t.push(Xn.isLte(e.maxValue)),t.length>0?Xn.pipe([na,...t],{returnIndex:0}):na}[x](e){return this[y](e)}},a(Lt,"BigintType"),Lt);Vr=Uc([u({name:"bigint",description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),Bc("design:paramtypes",[Object])],Vr);import{__decorate as $c,__metadata as qc}from"tslib";import{toBoolean as sa}from"valgen";var Pt,zr=(Pt=class{constructor(e){e&&Object.assign(this,e)}[y](){return sa}[x](){return sa}},a(Pt,"BooleanType"),Pt);zr=$c([u({name:"boolean",description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),qc("design:paramtypes",[Object])],zr);import{__decorate as Kc,__metadata as Vc}from"tslib";import{toInteger as aa,vg as Zn}from"valgen";var Ft,ze=(Ft=class extends ye{constructor(e){super(e)}[y](e){let t=[];return e.minValue&&t.push(Zn.isGte(e.minValue)),e.maxValue&&t.push(Zn.isLte(e.maxValue)),t.length>0?Zn.pipe([aa,...t],{returnIndex:0}):aa}[x](e){return this[y](e)}},a(Ft,"IntegerType"),Ft);ze=Kc([u({name:"integer",description:"An integer number",nameMappings:{js:"number",json:"number"}}),Vc("design:paramtypes",[Object])],ze);import{__decorate as zc,__metadata as Jc}from"tslib";import{isNull as pa}from"valgen";var kt,Jr=(kt=class{constructor(e){e&&Object.assign(this,e)}[y](){return pa}[x](){return pa}},a(kt,"NullType"),kt);Jr=zc([u({name:"null",description:"A Null value",nameMappings:{js:"null",json:"null"}}),Jc("design:paramtypes",[Object])],Jr);import{__decorate as Wc,__metadata as Gc}from"tslib";var jt,Wr=(jt=class{constructor(e){e&&Object.assign(this,e)}},a(jt,"ObjectType"),jt);Wr=Wc([Q({name:"object",description:"A non modelled object",additionalFields:!0}),Gc("design:paramtypes",[Object])],Wr);import{__decorate as ir,__metadata as or}from"tslib";import{toString as ca,vg as Gr}from"valgen";var Ct,Se=(Ct=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(T,Object.getPrototypeOf(this).constructor).name),t.push(Gr.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(Gr.lengthMin(e.minLength)),e.maxLength&&t.push(Gr.lengthMax(e.maxLength)),t.length>0?Gr.pipe([ca,...t],{returnIndex:0}):ca}[x](e){return this[y](e)}},a(Ct,"StringType"),Ct);ir([u.Attribute({description:"Regex pattern to be used for validation"}),or("design:type",Object)],Se.prototype,"pattern",void 0);ir([u.Attribute({description:"Name of the pattern"}),or("design:type",String)],Se.prototype,"patternName",void 0);ir([u.Attribute({description:"Minimum number of characters"}),or("design:type",Number)],Se.prototype,"minLength",void 0);ir([u.Attribute({description:"Minimum number of characters"}),or("design:type",Number)],Se.prototype,"maxLength",void 0);Se=ir([u({name:"string",description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),or("design:paramtypes",[Object])],Se);function j2(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return De(o,{required:t},r)}a(j2,"RequiredType");D.Entity={};D.Entity.Create=function(o,e){var n;let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(b.CREATED,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the created resource.',contentType:v.opra_response_json,type:t.type,partial:"deep"}).Response(b.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:v.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=ve(t.type)}),i};D.Entity.Delete=function(o,e){let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"DELETE",...t,composition:"Entity.Delete"});return i.Response(b.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:v.opra_response_json}).Response(b.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:v.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};D.Entity.DeleteMany=function(o,e){let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=new ge,n=new ne({dataType:t.type});n.rules={};let s=F(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return s.Response(b.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:v.opra_response_json}).Response(b.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:v.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};D.Entity.FindMany=function(o,e){let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=new ge,n=new ne({dataType:t.type});n.rules={};let s=F(r,{method:"GET",...t,composition:"Entity.FindMany"});return s.Response(b.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains list of resources.',contentType:v.opra_response_json,type:t.type,partial:"deep",isArray:!0}).Response(b.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:v.opra_response_json}).QueryParam("limit",{description:"Determines number of returning instances",type:new ze({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new ze({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).QueryParam("filter",{type:n,description:"Determines filter fields"}).QueryParam("sort",{description:"Determines sort fields",type:new W({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};D.Entity.Get=function(o,e){let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"GET",...t,composition:"Entity.Get"});return i.QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(b.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:v.opra_response_json,type:t.type,partial:"deep"}).Response(b.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(b.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:v.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};D.Entity.Replace=function(o,e){let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"POST",...t,composition:"Entity.Replace"});return i.QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(b.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:v.opra_response_json,type:t.type,partial:"deep"}).Response(b.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(b.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:v.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};D.Entity.UpdateMany=function(o,e){var p;let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=new ne({dataType:t.type});i.rules={};let n=new ge,s=F(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(b.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:v.opra_response_json}).Response(b.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:v.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,_)=>(r.push(()=>{n.set(c,{operators:l,description:_}),i.rules=n.toJSON()}),s),s};D.Entity.Update=function(o,e){var p;let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=new ge,n=new ne({dataType:t.type});n.rules={};let s=F(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 W({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(b.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',contentType:v.opra_response_json,type:t.type,partial:"deep"}).Response(b.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(b.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:v.opra_response_json}),s.KeyParam=(c,l)=>{let _=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,_),r.push(d=>{var $;($=d.path)!=null&&$.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,_)=>(r.push(()=>{i.set(c,{operators:l,description:_}),n.rules=i.toJSON()}),s),s};function ve(o){if(typeof o=="string")return o;let e=Reflect.getMetadata(T,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");import{isConstructor as rl}from"@jsopen/objects";import{omitUndefined as Yc}from"@jsopen/objects";import{asMutable as Qc}from"ts-gems";var Je=a(function(...o){var i;if(!this)return Je[w].apply(void 0,o);let[e,t]=o;if(g.call(this,e),!k.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=Qc(this);r.kind=m.RpcController.Kind,r.types=r.node[j]=new Z,r.operations=new N,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"),es=class es extends g{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=Yc({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}[tt](){return`[${rt}RpcController${it+this.name+Pe}]`}};a(es,"RpcControllerClass");var Hn=es;Je.prototype=Hn.prototype;Object.assign(Je,Ze);Je[w]=Ze;import{omitUndefined as Xc}from"@jsopen/objects";import{asMutable as Zc}from"ts-gems";var nr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');je.call(this,o,e);let t=Zc(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?at(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.deprecated=e.deprecated,t.required=e.required},"RpcHeader"),rs=class rs extends je{toJSON(){return Xc({...super.toJSON(),name:this.name,required:this.required,deprecated:this.deprecated})}};a(rs,"RpcHeaderClass");var ts=rs;nr.prototype=ts.prototype;import{omitUndefined as Hc}from"@jsopen/objects";import{asMutable as el}from"ts-gems";var sr=a(function(...o){if(!this){let[i,n]=o,s=[];return sr[w].call(void 0,s,i,n)}let[e,t]=o;if(g.call(this,e),!k.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=el(this);r.headers=[],r.types=r.node[j]=new Z,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"),os=class os extends g{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=Hc({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(os,"RpcOperationClass");var is=os;sr.prototype=is.prototype;sr[w]=Bt;import{omitUndefined as tl}from"@jsopen/objects";var ns=class ns extends g{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=tl({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(ns,"RpcOperationResponse");var Yr=ns;var ss=class ss{static async createApi(e,t){let r=new ct(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"&&!rl(r)&&(r=r()),r=await se(r);let n,s,p;if(typeof r=="function"){if(s=Reflect.getMetadata(re,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(re,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 S.addDataTypes(e,c,s.types)}),s.headers&&await e.enterAsync(".headers",async()=>{let l=0;for(let _ of s.headers)await e.enterAsync(`[${l++}]`,async()=>{let d={..._};await e.enterAsync(".type",async()=>{_.type&&(d.type=c.node.findDataType(_.type)),!d.type&&typeof _.type=="object"&&(d.type=await S.createDataType(e,c,_.type)),d.type||(d.type=c.node.getDataType("any"))});let $=new nr(c,d);c.headers.push($)})}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[l,_]of Object.entries(s.operations))await e.enterAsync(`[${l}]`,async()=>{let d=new sr(c,{..._,name:l,types:void 0,payloadType:void 0,keyType:void 0});await this._initRpcOperation(e,d,_),c.operations.set(d.name,d)})}),c}static async _initRpcOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await S.addDataTypes(e,t,r.types)}),t.payloadType=await S.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await S.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 S.resolveDataType(e,t,n.type)});let p=new nr(t,s);t.headers.push(p)})}),r.response&&await e.enterAsync(".response",async()=>{let i=new Yr(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 S.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await S.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 S.resolveDataType(e,t,n.type)});let p=new nr(t,s);t.headers.push(p)})})}};a(ss,"RpcApiFactory");var Qr=ss;var il="https://oprajs.com/spec/v"+m.SpecVersion,Xr=class Xr{constructor(){this._allDocuments={}}static async createDocument(e,t){let r=new Xr,i=t instanceof pe?t:new pe(t);try{let n=new Ce;if(await r.initDocument(n,i,e),i.error.details.length)throw i.error;return n}catch(n){try{n instanceof et||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
|
+
var ls=Object.defineProperty;var a=(o,e)=>ls(o,"name",{value:e,configurable:!0});var fs=(o,e)=>{for(var t in e)ls(o,t,{get:e[t],enumerable:!0})};import"reflect-metadata";import{merge as ii}from"@jsopen/objects";var m={};fs(m,{ComplexType:()=>Ge,EnumType:()=>Ye,HttpController:()=>Ut,HttpOperation:()=>ei,MappedType:()=>Qe,MixinType:()=>Xe,RpcController:()=>ti,RpcOperation:()=>ri,SimpleType:()=>Ze,SpecVersion:()=>ha,isComplexType:()=>Ta,isDataType:()=>ya,isEnumType:()=>Oa,isHttpController:()=>ga,isMappedType:()=>xa,isMixinType:()=>_a,isSimpleType:()=>Ea});var ha="1.0";var Ge;(function(o){o.Kind="ComplexType"})(Ge||(Ge={}));var Ye;(function(o){o.Kind="EnumType"})(Ye||(Ye={}));var Qe;(function(o){o.Kind="MappedType"})(Qe||(Qe={}));var Xe;(function(o){o.Kind="MixinType"})(Xe||(Xe={}));var Ze;(function(o){o.Kind="SimpleType"})(Ze||(Ze={}));var Ut;(function(o){o.Kind="HttpController"})(Ut||(Ut={}));var ei;(function(o){o.Kind="HttpOperation"})(ei||(ei={}));var ti;(function(o){o.Kind="RpcController"})(ti||(ti={}));var ri;(function(o){o.Kind="RpcOperation"})(ri||(ri={}));function ya(o){return o&&typeof o=="object"&&(o.kind===Ge.Kind||o.kind===Ye.Kind||o.kind===Qe.Kind||o.kind===Ze.Kind||o.kind===Xe.Kind)}a(ya,"isDataType");function Ta(o){return o&&typeof o=="object"&&o.kind===Ge.Kind}a(Ta,"isComplexType");function Ea(o){return o&&typeof o=="object"&&o.kind===Ze.Kind}a(Ea,"isSimpleType");function _a(o){return o&&typeof o=="object"&&o.kind===Xe.Kind}a(_a,"isMixinType");function xa(o){return o&&typeof o=="object"&&o.kind===Qe.Kind}a(xa,"isMappedType");function Oa(o){return o&&typeof o=="object"&&o.kind===Ye.Kind}a(Oa,"isEnumType");function ga(o){return o&&typeof o=="object"&&o.kind===Ut.Kind}a(ga,"isHttpController");var T=Symbol.for("opra.type.metadata"),re=Symbol("opra.http-controller.metadata"),ie=Symbol("opra.rpc-controller.metadata"),y=Symbol.for("opra.type.decoder"),x=Symbol("opra.type.encoder"),w=Symbol.for("DECORATOR"),Le=Symbol.for("BUILTIN"),us=/([a-z$_]\w+):(.+)/i,k=/^[a-z][\w_]*$/i,j=Symbol.for("kDataTypeMap"),cr=Symbol.for("kCtorMap"),Re=Symbol.for("kTypeNSMap");var Ra=/^(.*)(Controller)$/,ms=[];function He(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=Ra.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(ie,Object.getPrototypeOf(r));s&&ii(n,s,{deep:!0});let p=Reflect.getOwnMetadata(ie,r);p&&ii(n,p,{deep:!0}),ii(n,{...o,kind:m.RpcController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(ie,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(ie,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),ms.forEach(r=>r(t,e,o)),t}a(He,"RpcControllerDecoratorFactory");He.augment=function(o){ms.push(o)};import{omit as ba}from"@jsopen/objects";var ds=[];function Bt(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,...ba(t,["kind","payloadType"])},c=Reflect.getOwnMetadata(ie,n.constructor)||{};c.operations=c.operations||{},c.operations[s]=p;for(let l of o)l(p,n,s);Reflect.defineMetadata(ie,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(_=>String(_.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),ds.forEach(n=>n(i,o,e,t)),i}a(Bt,"RpcOperationDecoratorFactory");Bt.augment=function(o){ds.push(o)};BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});import{isConstructor as Na}from"@jsopen/objects";import Da from"putil-promisify";async function se(o){return o=Da.isPromise(o)?await o:o,typeof o=="function"?Na(o)?o:await o():o}a(se,"resolveThunk");var hs=/^(?:file:\/\/)?(.+)$/;function uf(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?hs.exec(r):void 0;return i?i[1]:""}return""}a(uf,"getStackFileName");function mf(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?hs.exec(r):void 0;return i?i[1]:""}return""}a(mf,"getErrorStack");function lr(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(lr,"mergePrototype");function fr(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(fr,"inheritPropertyInitializers");import{isPlainObject as ys,merge as Sa}from"@jsopen/objects";function M(o,e){return Sa({},o,{deep:a(t=>ys(t)&&!t[T],"deep"),copyDescriptors:!0,ignoreUndefined:!0,filter(t,r){let i=r[t];return!e||typeof i!="function"&&(typeof i!="object"||ys(i)||Array.isArray(i))}})}a(M,"cloneObject");import{splitString as Ts}from"fast-tokenizer";var Ia=/^([+-])?([a-z_$]\w*)$/i,va=/[^.]\(/g,oi=class oi{};a(oi,"FieldsProjection");var Pe=oi;(function(o){let t=class t{};a(t,"Item");let e=t;o.Item=e})(Pe||(Pe={}));function Es(o,e){let t=Array.isArray(o)?o:[o];if(!(t&&t.length))return;let r=new Pe;for(let i of t)e||(i=i.toLowerCase()),_s(i,r);return r}a(Es,"parseFieldsProjection");function _s(o,e){o=o.replace(va,r=>r.charAt(0)+"."+r.substring(1));let t=Ts(o,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let i=t[r];if(i.includes(",")){let c=Ts(i,{delimiters:",",brackets:!0,keepBrackets:!0});for(let l of c)_s(l,e);continue}let n=Ia.exec(i);if(!n)throw new TypeError(`Invalid field path (${o})`);let s=n[2],p=e[s]=e[s]||new Pe.Item;n[1]&&(p.sign=n[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new Pe}}a(_s,"parse");function Ma(o){return o&&typeof o.forEach=="function"}a(Ma,"isMap");var K=Symbol.for("kEntries"),ae=Symbol.for("kKeyMap"),ur=Symbol.for("kWellKnownKeys"),ni=Symbol.for("kOptions"),et=Symbol.for("kSize"),si=class si{constructor(e,t){Object.defineProperty(this,et,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,K,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,ae,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,ur,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,ni,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(i=>{r?this[ur][i]=i:this[ur][i.toLowerCase()]=i}),this.clear(),e&&this.setAll(e)}get size(){return this[et]}clear(){Object.keys(this[K]).forEach(e=>delete this[K][e]),Object.keys(this[ae]).forEach(e=>delete this[ae][e]),this[et]=0}forEach(e,t){for(let[r,i]of this.entries())e.call(t,i,r,this)}get(e){if(e)return this[K][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[K],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let i=Object.prototype.hasOwnProperty.call(this[K],r);return this[K][r]=t,i||this[et]++,this[ae][r]=e,this}setAll(e){return Ma(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[ae])[Symbol.iterator]()}values(){return Object.values(this[K])[Symbol.iterator]()}entries(){return Object.entries(this[K])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[K],t);return delete this[K][t],delete this[ae][t],r||this[et]--,r}sort(e){let t={...this[K]},r={...this[ae]},i=Array.from(this.keys());e?i.sort(e):i.sort(),this.clear();for(let n of i)this[K][n]=t[n],this[ae][n]=r[n];return this[et]=i.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[ae]))e[r]=this[K][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[ni].caseSensitive)return e;let t=this._getStoringKey(e);return this[ae][t]??this[ur][t]??e}_getStoringKey(e){return this[ni].caseSensitive?e:e.toLowerCase()}};a(si,"ResponsiveMap");var N=si;function Nf(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(Nf,"safeJsonStringify");function ai(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}a(ai,"isStream");function If(o){return ai(o)&&typeof o._read=="function"&&typeof o._readableState=="object"}a(If,"isReadable");function vf(o){return ai(o)&&typeof o._write=="function"}a(vf,"isWritable");function Mf(o){return ai(o)&&typeof o.getReader=="function"&&typeof o.pipeThrough=="function"&&typeof o.pipeTo=="function"}a(Mf,"isReadableStream");function Lf(o){return o!==null&&typeof o=="object"&&typeof o.size=="number"&&typeof o.arrayBuffer=="function"&&typeof o.stream=="function"}a(Lf,"isBlob");function Pf(o){return o!==null&&typeof o.constructor=="function"&&o.constructor.name==="FormData"&&typeof o.append=="function"&&typeof o.getAll=="function"}a(Pf,"isFormData");function Ff(o){return o!==null&&typeof o=="object"&&typeof o.host=="string"&&typeof o.href=="string"}a(Ff,"isURL");import{omitUndefined as Ba}from"@jsopen/objects";import Fa from"@browsery/i18next";import{splitString as ka,tokenize as gs}from"fast-tokenizer";var La=/\\(.)/g,Pa=/(\\)/g;function xs(o){return o.replace(Pa,"\\\\")}a(xs,"escapeString");function Os(o){return o.replace(La,"$1")}a(Os,"unescapeString");var ja=Object.getPrototypeOf(Fa.createInstance()).constructor,$t=class $t extends ja{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 $t(e,t)}static createInstance(e,t){return new $t(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 gs(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=ka(n,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),p=Os(n.substring((s[0]||"").length+1));n=s[0]||"";let c=[],l=null;for(let d of gs(n,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(d.startsWith("{")){l=JSON.parse(d);continue}c.push(d)}let _=c.length>1?"$t("+c.join(",")+")":c[0];i+=p?this.t(_,p,{...r,...l}):this.t(_,{...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 Ca}};a($t,"I18n");var qt=$t,Ca=qt.createInstance();var Ua=/(\))/g;function R(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?"?"+xs(i).replace(Ua,"\\$1"):"")+")"}a(R,"translate");var pi=qt.createInstance();pi.init().catch(()=>{});var ci=class ci extends Error{constructor(e,t){super("Unknown error"),this.severity="error",t=t||(e instanceof Error?e:void 0),e instanceof Error&&(t=e),t&&t instanceof Error&&(this.cause=t,t.stack&&(this.stack=t.stack)),typeof e=="string"?this.initString(e):e instanceof Error?this.initError(e):this.init(e),this.message=this.message||this.constructor.name}toString(){return pi.deep(this.message)}toJSON(){var t;let e="production";return Ba({message:this.message,severity:this.severity,system:this.system,code:this.code,details:this.details,stack:e==="dev"||e==="development"||e==="test"?(t=this.stack)==null?void 0:t.split(`
|
|
7
|
+
`):void 0},!0)}init(e){this.message=(e==null?void 0:e.message)||this.constructor.name,this.severity=(e==null?void 0:e.severity)||"error",e&&(this.system=e.system,this.code=e.code,this.details=e.details)}initString(e){this.init({message:String(e||"")||this.constructor.name,severity:"error",code:this.constructor.name})}initError(e){this.init({message:e.message,severity:e.severity||"error",code:e.code||e.constructor.name})}};a(ci,"OpraException");var Ee=ci;var li=class li extends Ee{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};a(li,"OpraDocumentError");var tt=li;var fi=class fi{constructor(e){this.path="",this.error=new tt,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(fi,"DocumentInitContext");var pe=fi;import"reflect-metadata";import{omitUndefined as Xa}from"@jsopen/objects";import{asMutable as Za}from"ts-gems";import{omit as $a}from"@jsopen/objects";function ui(o){return function(e){let t;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!k.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(T,e);r||(r={},Reflect.defineMetadata(T,r,e)),r.kind=m.ComplexType.Kind,r.name=t,o&&Object.assign(r,$a(o,["name"]))}}a(ui,"ComplexTypeDecorator");import{omitUndefined as Rs}from"@jsopen/objects";import{asMutable as Qa}from"ts-gems";import{asMutable as qa}from"ts-gems";import{uid as Ka}from"uid";var mi=class mi{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[Re])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[j])==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(T,e).name;else if(typeof e=="object"){let n=e[T];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(mi,"DocumentNode");var mr=mi;var g=a(function(o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=qa(this);e.id=Ka(16),Object.defineProperty(e,"node",{value:new mr(this,o==null?void 0:o.node),enumerable:!1,writable:!0}),o&&Object.defineProperty(e,"owner",{value:o,enumerable:!1,writable:!0})},"DocumentElement"),hi=class hi{};a(hi,"DocumentElementClass");var di=hi;g.prototype=di.prototype;import{omitUndefined as Va}from"@jsopen/objects";function yi(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(T,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(T,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(Va({...i,scopePattern:Array.isArray(r)?r:[r],type:void 0,isArray:void 0,isNestedEntity:void 0}))}),t),t}a(yi,"ApiFieldDecoratorFactory");function Kt(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(Kt,"testScopeMatch");import{asMutable as Wa}from"ts-gems";import{validator as Ga,vg as oe}from"valgen";import{omitUndefined as za}from"@jsopen/objects";import{asMutable as Ja}from"ts-gems";var rt=Symbol.for("nodejs.util.inspect.custom"),Fe="\x1B[0m",it="\x1B[33m",ot="\x1B[35m";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&&!k.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);g.call(this,o);let r=Ja(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"),Ei=class Ei extends g{get embedded(){return!this.name}inScope(e){return Kt(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 za({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[rt](){return`[${it+Object.getPrototypeOf(this).constructor.name+Fe} ${ot+this.name+Fe}]`}};a(Ei,"DataTypeClass");var Ti=Ei;O.prototype=Ti.prototype;var Ya=/^([+-])?([a-z$_][\w.]*)$/i,L=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=Wa(this);i._fields=new N},"ComplexTypeBase"),xi=class xi 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,$,cs;let r=this,i,n=e.split("."),s=n.length,p=[],c=this.owner.node.getDataType("object"),l=t==null?void 0:t.allowSigns,_=a(()=>p.map(Me=>Me.fieldName).join("."),"getStrPath");for(let Me=0;Me<s;Me++){let z={fieldName:n[Me],dataType:c};p.push(z);let pr=Ya.exec(n[Me]);if(!pr)throw new TypeError(`Invalid field name (${_()})`);if(pr[1]&&((Me===0&&l==="first"||l==="each")&&(z.sign=pr[1]),z.fieldName=pr[2]),r){if(r instanceof L){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((($=r.additionalFields)==null?void 0:$[0])==="type"&&((cs=r.additionalFields)==null?void 0:cs[1])instanceof O){z.additionalField=!0,z.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(Hr=>Hr.fieldName).join(".")})`)}throw new TypeError(`"${p.map(Hr=>Hr.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)?Es(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=Ga((p,c,l)=>c.fail(l,s,p))}return oe.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]=oe.isUndefined({coerce:!0});continue}p=l.name;let _;if(n!=="*"&&(_=n==null?void 0:n[p.toLowerCase()],(_==null?void 0:_.sign)==="-"||s&&!_||!s&&l.exclusive&&!_)){r[l.name]=oe.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?oe.optional(d):oe.required(d)}return t.allowPatchOperators&&(r._$pull=oe.optional(oe.isAny()),r._$push=oe.optional(oe.isAny())),r}_generateFieldCodec(e,t,r){let i=t.type.generateCodec(e,r);return t.fixed&&(i=oe.isEnum([t.fixed])),t.isArray&&(i=oe.isArray(i)),i}};a(xi,"ComplexTypeBaseClass");var _i=xi;L.prototype=_i.prototype;var P=a(function(...o){if(!this){let[n]=o;return P[w](n)}let[e,t]=o;g.call(this,e);let r=Qa(this);r.name=t.name;let i=t.origin||e;if(!(i instanceof L))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"),gi=class gi extends g{inScope(e){return Kt(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(Kt(e,r.scopePattern)){t=Rs({...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 Rs({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(gi,"ApiFieldClass");var Oi=gi;P.prototype=Oi.prototype;Object.assign(P,yi);P[w]=yi;var Q=a(function(...o){var n;if(!this)return Q[w].apply(void 0,o);let[e,t]=o,r=o[2]||new pe({maxErrors:0});L.call(this,e,t,r);let i=Za(this);i.kind=m.ComplexType.Kind,t.base&&r.enter(".base",()=>{if(!(t.base instanceof L))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 P(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 P(this,{...p,name:s});this._fields.set(c.name,c)}})},"ComplexType"),wi=class wi extends L{extendsFrom(e){var t;return e instanceof O||(e=this.node.getDataType(e)),e instanceof L?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 Xa(i)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(wi,"ComplexTypeClass");var Ri=wi;Q.prototype=Ri.prototype;Object.assign(Q,ui);Q[w]=ui;import"reflect-metadata";import{omitUndefined as bi}from"@jsopen/objects";import{asMutable as Ha}from"ts-gems";import{vg as ep}from"valgen";var ce=a(function(...o){if(!this)return ce[w].apply(void 0,o);let[e,t,r]=o;O.call(this,e,t,r);let i=Ha(this);if(i.kind=m.EnumType.Kind,t.base){if(!(t.base instanceof ce))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${i.kind}"`);i.base=t.base}i.instance=t.instance,i.ownAttributes=M(t.attributes||{}),i.attributes=i.base?M(i.base.attributes):{};for(let[n,s]of Object.entries(i.ownAttributes))i.attributes[n]=s},"EnumType"),Ai=class Ai extends O{extendsFrom(e){var t;return e instanceof O||(e=this.node.getDataType(e)),e instanceof ce?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return ep.isEnum(Object.keys(this.attributes))}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return bi({...t,kind:this.kind,base:r,attributes:M(this.ownAttributes)})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Ai,"EnumTypeClass");var Vt=Ai;ce.prototype=Vt.prototype;Object.assign(ce,Vt);function tp(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]=bi({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]]=bi({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,T,{value:s,enumerable:!1,configurable:!0,writable:!0}),n}a(tp,"EnumTypeFactory");ce.prototype=Vt.prototype;ce[w]=tp;import"reflect-metadata";import{omitUndefined as rp}from"@jsopen/objects";import{asMutable as ip}from"ts-gems";function dr(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(dr,"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;L.call(this,e,t,r);let i=ip(this);if(i.kind=m.MappedType.Kind,t.base){if(!(t.base instanceof L))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=dr(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,_]of i.base.fieldEntries()){if(!s(l))continue;let d={..._};p===!0||Array.isArray(p)&&p.includes(_.name.toLowerCase())?d.required=!1:(c===!0||Array.isArray(c)&&c.includes(_.name.toLowerCase()))&&(d.required=!0);let $=new P(this,d);i._fields.set($.name,$)}(!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"),Di=class Di extends L{extendsFrom(e){var t;return e instanceof O||(e=this.node.getDataType(e)),e instanceof L?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 rp({...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(Di,"MappedTypeClass");var Ni=Di;ke.prototype=Ni.prototype;ke._applyMixin=()=>{};import"reflect-metadata";import{omitUndefined as op}from"@jsopen/objects";import{asMutable as np}from"ts-gems";var nt=a(function(...o){if(!this)return nt[w].apply(void 0,o);let[e,t,r]=o;L.call(this,e,t,r);let i=np(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 P(this,s);i._fields.set(p.name,p)}i.types.push(n),n.keyField&&(i.keyField=n.keyField)}},"MixinType"),Ii=class Ii extends L{extendsFrom(e){if(e instanceof O||(e=this.node.getDataType(e)),!(e instanceof L))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 op({...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(Ii,"MixinTypeClass");var Si=Ii;nt.prototype=Si.prototype;nt[w]=sp;function sp(...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)fr(this,s)}}}[r],n={...t,kind:m.MixinType.Kind,types:[]};Reflect.defineMetadata(T,n,i);for(let s of e){let p=Reflect.getMetadata(T,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),lr(i.prototype,s.prototype)}return i}a(sp,"MixinTypeFactory");import"reflect-metadata";import{omitUndefined as bs}from"@jsopen/objects";import{asMutable as ap}from"ts-gems";import{isAny as As}from"valgen";function vi(o){let e=[],t=a(function(r){let i;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!k.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(T,r)||{};o&&Object.assign(n,o),n.kind=m.SimpleType.Kind,n.name=i,Reflect.defineMetadata(T,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(vi,"SimpleTypeDecoratorFactory");function ws(o){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(T,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(T,r,e.constructor)}}a(ws,"AttributeDecoratorFactory");var u=a(function(...o){var n,s;if(!this)return u[w](...o);let[e,t,r]=o;O.call(this,e,t,r);let i=ap(this);if(i.kind=m.SimpleType.Kind,t.base){if(!(t.base instanceof u))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base}if(i.properties=t.properties,i.ownNameMappings={...t.nameMappings},i.nameMappings={...(n=i.base)==null?void 0:n.nameMappings,...t.nameMappings},i.ownAttributes=M(t.attributes||{}),i.attributes=i.base?M(i.base.attributes):{},i.ownAttributes)for(let[p,c]of Object.entries(i.ownAttributes)){if((s=i.attributes[p])!=null&&s.sealed)throw new TypeError(`Sealed attribute "${p}" can not be overwritten`);i.attributes[p]=c}i._generateDecoder=t.generateDecoder,i._generateEncoder=t.generateEncoder},"SimpleType"),Li=class Li extends O{extendsFrom(e){var t;return e instanceof O||(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 As}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 As}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i=bs(this.ownAttributes),n;this.properties&&typeof this.properties.toJSON=="function"?n=this.properties.toJSON(this.properties,this.owner,e):n=this.properties?M(this.properties):{};let s={...t,kind:this.kind,base:r,attributes:i&&Object.keys(i).length?i:void 0,properties:Object.keys(n).length?n:void 0};return Object.keys(this.ownNameMappings).length&&(s.nameMappings={...this.ownNameMappings}),bs(s,!0)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Li,"SimpleTypeClass");var Mi=Li;u.prototype=Mi.prototype;Object.assign(u,vi);u[w]=vi;u.Attribute=ws;var Pi=Symbol("initializing"),hr=class hr{static async createDataType(e,t,r){e=e||new pe({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 hr.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[j];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 pe({maxErrors:0});let i=await this._prepareAllInitArgs(e,t,r);if(!i)return;let n=new N;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 _=this._createDataType(s,t,l);_&&p.push(_)});return p}static async _prepareAllInitArgs(e,t,r){let i=new N,n=new N,s=e.extend({owner:t,importQueue:i,initArgsMap:n});if(!t.node[j])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 se(c);let l=Reflect.getMetadata(T,c)||c[T];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 se(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 _;r=await se(r);let{importQueue:i,initArgsMap:n}=e,s=t.node.findDataType(r);if(s instanceof O)return s.name;let p,c,l;if(typeof r!="string"){let $=t.node.getDocument().types[cr].get(r);$&&(r=$)}if(typeof r=="string"){let d=r;if(r=(i==null?void 0:i.get(d))||((_=e.initArgsMap)==null?void 0:_.get(d)),!r)return e.addError(`Unknown data type (${d})`)}if(typeof r=="function"){if(p=Reflect.getMetadata(T,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[T],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(T,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 $=n==null?void 0:n.get(p.name);if($)return $[Pi]?e.addError("Circular reference detected"):p.name}let d={kind:p.kind,name:p.name};d[Pi]=!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[j]=t.node[j];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[Pi]}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(T,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=je(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=je(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:je(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=je(n))}),r.attributes=M(i.attributes)}static async _prepareSimpleTypeArgs(e,t,r,i){var n,s,p,c;await this._prepareDataTypeArgs(e,r,i),await e.enterAsync(".base",async()=>{let l;if(i.base)l=await this._importDataTypeArgs(e,t,i.base);else if(r.ctor){let _=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(T,_)&&(l=await this._importDataTypeArgs(e,t,_))}l&&(r.base=je(l),r.ctor=r.ctor||l.ctor)}),r.properties=i.properties,r.nameMappings=i.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),i.attributes&&(r.attributes=M(i.attributes)),typeof((n=r.properties)==null?void 0:n[y])=="function"&&(r.generateDecoder=(s=r.properties)==null?void 0:s[y].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(T,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=je(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(je(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[j];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,Q.prototype);let n=M(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),r.additionalFields&&e.enter(".additionalFields",()=>{typeof r.additionalFields=="boolean"||Array.isArray(r.additionalFields)?n.additionalFields=r.additionalFields:n.additionalFields=this._createDataType(e,t,r.additionalFields)}),n.fields={},r.fields&&e.enter(".fields",()=>{for(let[s,p]of Object.entries(r.fields))e.enter(`[${s}]`,()=>{let c=this._createDataType(e,t,p.type);c&&(n.fields[s]={...p,name:s,type:c})})}),Q.apply(i,[t,n]),i}static _createEnumType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ce.prototype);let n=M(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),n.attributes=r.attributes,ce.apply(i,[t,n]),i}static _createMappedType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ke.prototype);let n=M(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,nt.prototype);let n=M(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let p of r.types)e.enter(`[${s++}]`,()=>{let c=this._createDataType(e,t,p);if(!(c instanceof L))throw new TypeError(`"${c==null?void 0:c.kind}" can't be set as base for a "${n.kind}"`);n.types.push(c)})}),nt.apply(i,[t,n]),i}static _createSimpleType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,u.prototype);let n=M(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),u.apply(i,[t,n]),i}};a(hr,"DataTypeFactory");var S=hr;function je(o){return typeof o=="object"&&o.name?o.name:o}a(je,"preferName");import{isConstructor as vp}from"@jsopen/objects";import{omitUndefined as cp}from"@jsopen/objects";var Fi=class Fi extends g{constructor(e){super(e.owner),this.name="OpraApi",this.name=e.name,this.description=e.description}toJSON(e){return cp({transport:this.transport,name:this.name,description:this.description})}async _initialize(e,t){if(!k.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};a(Fi,"ApiBase");var st=Fi;import up from"path-browserify";import{omitUndefined as mp}from"@jsopen/objects";import{asMutable as dp}from"ts-gems";var Ns,Ds,X=Symbol.for("kMap"),zt=Symbol.for("kCtorMap"),ki=class ki{constructor(){this[Ns]=new N,this[Ds]=new WeakMap}get size(){return this[X].size}forEach(e,t){this[X].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[zt].get(e);if(!t&&typeof e=="function"){let i=Reflect.getMetadata(T,e);t=i==null?void 0:i.name}if(!t&&typeof e=="object"){let i=e[T];t=i==null?void 0:i.name}if(!t)return;let r=this[X].get(t);if(r)return typeof e=="function"&&r.kind==="ComplexType"?r.ctor===e?r:void 0:r}set(e,t){this[X].set(e,t),t.ctor?this[zt].set(t.ctor,e):t.instance&&this[zt].set(t.instance,e)}has(e){if(e instanceof O)return!!e.name&&this[X].has(e.name);let t=typeof e=="string"?e:this[zt].get(e);return t?this[X].has(t):!1}keys(){return this[X].keys()}values(){return this[X].values()}entries(){return this[X].entries()}sort(e){return this[X].sort(e),this}[(Ns=X,Ds=zt,Symbol.iterator)](){return this[X][Symbol.iterator]()}};a(ki,"DataTypeMap");var Z=ki;import{merge as ji,omit as lp}from"@jsopen/objects";var fp=/^(.*)(Controller)$/;function Ci(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=fp.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(re,Object.getPrototypeOf(r));s&&ji(n,s,{deep:!0});let p=Reflect.getOwnMetadata(re,r);p&&ji(n,p,{deep:!0}),ji(n,{kind:m.HttpController.Kind,name:i,path:i,...lp(o,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(re,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(re,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(Ci,"HttpControllerDecoratorFactory");var H=a(function(...o){var i;if(!this)return H[w].apply(void 0,o);let[e,t]=o;if(g.call(this,e),!k.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=dp(this);r.kind=m.HttpController.Kind,r.types=r.node[j]=new Z,r.operations=new N,r.controllers=new N,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"),Bi=class Bi extends g{get isRoot(){return!(this.owner instanceof H)}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values()){if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;if(r.controllers.size&&(t=r.findController(e),t))return this._controllerReverseMap.set(e,t),t}this._controllerReverseMap.set(e,null);return}if(e.startsWith("/")&&(e=e.substring(1)),e.includes("/")){let t=e.split("/"),r=this;for(;r&&t.length>0;)r=r.controllers.get(t.shift());return r}return this.controllers.get(e)}findParameter(e,t){let r=e.toLowerCase(),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 H)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return up.posix.join(this.owner instanceof H?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(e){let t=mp({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`[${it}HttpController${ot+this.name+Fe}]`}};a(Bi,"HttpControllerClass");var Ui=Bi;H.prototype=Ui.prototype;Object.assign(H,Ci);H[w]=Ci;var $i=class $i extends st{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="http",this.controllers=new N,this.url=e.url}findController(e){return H.prototype.findController.call(this,e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(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($i,"HttpApi");var at=$i;import hp from"@browsery/type-is";import{omitUndefined as yp}from"@jsopen/objects";import{asMutable as Tp}from"ts-gems";import{isAny as Ep,vg as _p}from"valgen";var we=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');g.call(this,o);let t=Tp(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"),Ki=class Ki extends g{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=yp({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=>hp.is(n,["json"]))&&(r=this.node.findDataType("object").generateCodec(e)),r=r||Ep,this.isArray?_p.isArray(r):r}};a(Ki,"HttpMediaTypeClass");var qi=Ki;we.prototype=qi.prototype;import{omitUndefined as xp}from"@jsopen/objects";function pt(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(pt,"parseRegExp");var Vi=class Vi extends we{constructor(e,t){super(e,t),this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?pt(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(e){return xp({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON(e)})}};a(Vi,"HttpMultipartField");var yr=Vi;import Op from"path-browserify";import{omitUndefined as gp}from"@jsopen/objects";import{asMutable as Rp}from"ts-gems";var Ss;(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"})(Ss||(Ss={}));var b;(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"})(b||(b={}));var R0={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 F(o,e){let t=a((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={...e,kind:m.HttpOperation.Kind},s=Reflect.getOwnMetadata(re,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let p of o)p(n);Reflect.defineMetadata(re,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(F,"HttpOperationDecoratorFactory");var D=a(function(...o){if(!this){let[i]=o,n=[];return D[w].call(void 0,n,i)}let[e,t]=o;if(g.call(this,e),!k.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=Rp(this);r.parameters=[],r.responses=[],r.types=r.node[j]=new Z,r.name=t.name,r.path=t.path,r.mergePath=t.mergePath,r.method=t.method||"GET",r.description=t.description,r.composition=t.composition,r.compositionOptions=t.compositionOptions?M(t.compositionOptions):void 0},"HttpOperation"),Ji=class Ji extends g{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:Op.posix.join(e,this.path):e:this.path||"/"}toJSON(e){var r;let t=gp({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(Ji,"HttpOperationClass");var zi=Ji;D.prototype=zi.prototype;D[w]=F;D.GET=function(o){return F([],{...o,method:"GET"})};D.DELETE=function(o){return F([],{...o,method:"DELETE"})};D.HEAD=function(o){return F([],{...o,method:"HEAD"})};D.OPTIONS=function(o){return F([],{...o,method:"OPTIONS"})};D.PATCH=function(o){return F([],{...o,method:"PATCH"})};D.POST=function(o){return F([],{...o,method:"POST"})};D.PUT=function(o){return F([],{...o,method:"PUT"})};D.SEARCH=function(o){return F([],{...o,method:"SEARCH"})};import{omitUndefined as bp}from"@jsopen/objects";var wp=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,Wi=class Wi{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=wp.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(Wi,"HttpStatusRange");var Jt=Wi;var Gi=class Gi extends we{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new Jt(r.start,r.end):new Jt(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=bp({...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(Gi,"HttpOperationResponse");var Tr=Gi;import{omitUndefined as Dp}from"@jsopen/objects";import{asMutable as Sp}from"ts-gems";import{omitUndefined as Ap}from"@jsopen/objects";import{asMutable as Np}from"ts-gems";var Ce=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');g.call(this,o);let t=Np(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),Qi=class Qi extends g{toJSON(e){let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return Ap({type:this.type?t||this.type.toJSON(e):"any",description:this.description,isArray:this.isArray,examples:this.examples})}};a(Qi,"ValueClass");var Yi=Qi;Ce.prototype=Yi.prototype;var Wt=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');Ce.call(this,o,e);let t=Sp(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?pt(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"),Zi=class Zi extends Ce{toJSON(e){return Dp({...super.toJSON(e),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}};a(Zi,"HttpParameterClass");var Xi=Zi;Wt.prototype=Xi.prototype;import{omitUndefined as Ip}from"@jsopen/objects";var Hi=class Hi extends g{constructor(e){super(e),this.content=[]}toJSON(e){return Ip({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(Hi,"HttpRequestBody");var Er=Hi;var eo=class eo{static async createApi(e,t){let r=new at(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"&&!vp(r)&&(r=t instanceof H?r(t.instance):r()),r=await se(r);let i,n,s;if(typeof r=="function"){if(n=Reflect.getMetadata(re,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(re,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 H(t,{...r,instance:i,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await S.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 S.resolveDataType(e,s,c.type)});let _=new Wt(s,l);s.parameters.push(_)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[p,c]of Object.entries(r.operations))await e.enterAsync(`[${p}]`,async()=>{let l=new D(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 D.apply(t,[t.owner,i]),r.types&&await e.enterAsync(".types",async()=>{await S.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 S.resolveDataType(e,t,s.type)});let c=new Wt(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 Tr(t,{statusCode:s.statusCode});await this._initHttpOperationResponse(e,p,s),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let n=new Er(t);await this._initHttpRequestBody(e,n,r.requestBody),t.requestBody=n}),t}static async _initHttpMediaType(e,t,r){we.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{t.type=await S.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 yr(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 S.resolveDataType(e,t,n.type)});let p=new Wt(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 we(t,String(i));await this._initHttpMediaType(e,s,n),t.content.push(s)})})}};a(eo,"HttpApiFactory");var ct=eo;import{omitUndefined as Lp}from"@jsopen/objects";import{md5 as Pp}from"super-fast-md5";var to=class to extends st{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="rpc",this.controllers=new N,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(to,"RpcApi");var lt=to;var Is,ro=class ro extends g{constructor(){super(null),this[Is]=new WeakMap,this.id="",this.info={},this.references=new N,this.types=new Z,this.node[j]=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[Re].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 at))throw new TypeError("The document do not contains HttpApi instance");return this.api}get rpcApi(){if(!(this.api&&this.api instanceof lt))throw new TypeError("The document do not contains RpcApi instance");return this.api}toJSON(){return this.export()}export(e){let t=Lp({spec:m.SpecVersion,id:this.id,url:this.url,info:M(this.info,!0)});if(this.references.size){let r=0,i={};for(let[n,s]of this.references.entries())s[Le]||(i[n]={id:s.id,url:s.url,info:M(s.info,!0)},r++);r&&(t.references=i)}if(this.types.size){t.types={};for(let r of this.types.values())r.inScope(e==null?void 0:e.scope)&&(t.types[r.name]=r.toJSON(e))}return this.api&&(t.api=this.api.toJSON(e)),t}invalidate(){let e=this.export({});delete e.id,this.id=Pp(JSON.stringify(e)),this[Re]=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=us.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[Re].set(i,p!=null&&p[Le]?"":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[Re].set(i,p!=null&&p[Le]?"":s),i}}};a(ro,"ApiDocument");var Ue=ro;Is=Re;import{__decorate as Fp,__metadata as kp}from"tslib";import{vg as vs}from"valgen";var ft,_r=(ft=class{constructor(e){e&&Object.assign(this,e)}[y](){return vs.isBase64({coerce:!0})}[x](){return vs.isBase64({coerce:!0})}},a(ft,"Base64Type"),ft);_r=Fp([u({name:"base64",description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),kp("design:paramtypes",[Object])],_r);import{__decorate as io,__metadata as oo}from"tslib";import{isDateString as xr,toString as Ms,vg as be}from"valgen";var ut,mt=(ut=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=be.isDate({precision:"date",coerce:!0}),r=[];return e.minValue&&(xr(e.minValue),r.push(Ms,be.isGte(e.minValue))),e.maxValue&&(xr(e.maxValue),r.push(Ms,be.isLte(e.maxValue))),r.length>0?be.pipe([t,...r],{returnIndex:0}):t}[x](e){let t=be.isDateString({precision:"date",trim:"date",coerce:!0}),r=[];return e.minValue&&(xr(e.minValue),r.push(be.isGte(e.minValue))),e.maxValue&&(xr(e.maxValue),r.push(be.isLte(e.maxValue))),r.length>0?be.pipe([t,...r],{returnIndex:0}):t}},a(ut,"DateType"),ut);io([u.Attribute({description:"Minimum value"}),oo("design:type",String)],mt.prototype,"minValue",void 0);io([u.Attribute({description:"Maximum value"}),oo("design:type",String)],mt.prototype,"maxValue",void 0);mt=io([u({name:"date",description:"A date without time",nameMappings:{js:"Date",json:"string"}}).Example("2021-04-18","Full date value"),oo("design:paramtypes",[Object])],mt);import{__decorate as no,__metadata as so}from"tslib";import{vg as Or}from"valgen";var dt,ht=(dt=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=Or.isDateString({trim:"date",coerce:!0}),r=[];return e.minValue&&r.push(Or.isGte(e.minValue)),e.maxValue&&r.push(Or.isLte(e.maxValue)),r.length>0?Or.pipe([t,...r],{returnIndex:0}):t}[x](e){return this[y](e)}},a(dt,"DateStringType"),dt);no([u.Attribute({description:"Minimum value"}),so("design:type",String)],ht.prototype,"minValue",void 0);no([u.Attribute({description:"Maximum value"}),so("design:type",String)],ht.prototype,"maxValue",void 0);ht=no([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"),so("design:paramtypes",[Object])],ht);import{__decorate as ao,__metadata as po}from"tslib";import{isDateString as gr,toString as Ls,vg as Ae}from"valgen";var yt,Tt=(yt=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=Ae.isDate({precision:"time",coerce:!0}),r=[];return e.minValue&&(gr(e.minValue),r.push(Ls,Ae.isGte(e.minValue))),e.maxValue&&(gr(e.maxValue),r.push(Ls,Ae.isLte(e.maxValue))),r.length>0?Ae.pipe([t,...r],{returnIndex:0}):t}[x](e){let t=Ae.isDateString({precision:"time",trim:"time",coerce:!0}),r=[];return e.minValue&&(gr(e.minValue),r.push(Ae.isGte(e.minValue))),e.maxValue&&(gr(e.maxValue),r.push(Ae.isLte(e.maxValue))),r.length>0?Ae.pipe([t,...r],{returnIndex:0}):t}},a(yt,"DateTimeType"),yt);ao([u.Attribute({description:"Minimum value"}),po("design:type",String)],Tt.prototype,"minValue",void 0);ao([u.Attribute({description:"Maximum value"}),po("design:type",String)],Tt.prototype,"maxValue",void 0);Tt=ao([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"),po("design:paramtypes",[Object])],Tt);import{__decorate as co,__metadata as lo}from"tslib";import{vg as Rr}from"valgen";var Et,_t=(Et=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=Rr.isDateString({coerce:!0}),r=[];return e.minValue&&r.push(Rr.isGte(e.minValue)),e.maxValue&&r.push(Rr.isLte(e.maxValue)),r.length>0?Rr.pipe([t,...r]):t}[x](e){return this[y](e)}},a(Et,"DateTimeStringType"),Et);co([u.Attribute({description:"Minimum value"}),lo("design:type",String)],_t.prototype,"minValue",void 0);co([u.Attribute({description:"Maximum value"}),lo("design:type",String)],_t.prototype,"maxValue",void 0);_t=co([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"),lo("design:paramtypes",[Object])],_t);import{__decorate as le,__metadata as fe}from"tslib";import{vg as Ps}from"valgen";var xt,J=(xt=class{constructor(e){e&&Object.assign(this,e)}[y](e){return Ps.isEmail({...e,coerce:!0})}[x](e){return Ps.isEmail({...e,coerce:!0})}},a(xt,"EmailType"),xt);le([u.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),fe("design:type",Boolean)],J.prototype,"allowDisplayName",void 0);le([u.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),fe("design:type",Boolean)],J.prototype,"requireDisplayName",void 0);le([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}),fe("design:type",Boolean)],J.prototype,"utf8LocalPart",void 0);le([u.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),fe("design:type",Boolean)],J.prototype,"ignoreMaxLength",void 0);le([u.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),fe("design:type",Boolean)],J.prototype,"allowIpDomain",void 0);le([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}),fe("design:type",Boolean)],J.prototype,"domainSpecificValidation",void 0);le([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."}),fe("design:type",Array)],J.prototype,"hostBlacklist",void 0);le([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."}),fe("design:type",Array)],J.prototype,"hostWhitelist",void 0);le([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."}),fe("design:type",String)],J.prototype,"blacklistedChars",void 0);J=le([u({name:"email",description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),fe("design:paramtypes",[Object])],J);import{__decorate as fo,__metadata as uo}from"tslib";import{toString as jp,validator as Cp,vg as Up}from"valgen";var Ot,W=(Ot=class{constructor(e){e&&Object.assign(this,e)}[y](e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.allowSigns,s=Cp("decodeFieldPath",p=>i.normalizeFieldPath(p,{allowSigns:n,scope:r}));return Up.pipe([jp,s])}[x](e,t,r){return this[y](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(Ot,"FieldPathType"),Ot);fo([u.Attribute({description:"Data type which field belong to"}),uo("design:type",Object)],W.prototype,"dataType",void 0);fo([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'}),uo("design:type",String)],W.prototype,"allowSigns",void 0);W=fo([u({name:"fieldpath",description:"Field path",nameMappings:{js:"string",json:"string"}}),uo("design:paramtypes",[Object])],W);import{__decorate as Jn,__metadata as Wn}from"tslib";import{validator as ea}from"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});import{omitUndefined as uc}from"@jsopen/objects";import{isString as mc}from"valgen";var mo=class mo extends Ee{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(mo,"OpraHttpError");var A=mo;var ho=class ho extends A{constructor(){super(...arguments),this.status=400}init(e){super.init({message:R("error:BAD_REQUEST","Bad request"),code:"BAD_REQUEST",...e})}};a(ho,"BadRequestError");var Fs=ho;var yo=class yo extends A{constructor(){super(...arguments),this.status=409}init(e){super.init({message:R("error:CONFLICT","Conflict"),code:"CONFLICT",...e})}};a(yo,"ConflictError");var ks=yo;var To=class To extends A{constructor(){super(...arguments),this.status=424}init(e){super.init({message:R("error:FAILED_DEPENDENCY","The request failed due to failure of a previous request"),code:"FAILED_DEPENDENCY",...e})}};a(To,"FailedDependencyError");var js=To;var Eo=class Eo extends A{constructor(){super(...arguments),this.status=b.FORBIDDEN}init(e){super.init({message:R("error:FORBIDDEN","You are not authorized to perform this action"),code:"FORBIDDEN",...e})}};a(Eo,"ForbiddenError");var wr=Eo;var _o=class _o extends A{constructor(){super(...arguments),this.status=500}init(e){super.init({message:R("error:INTERNAL_SERVER_ERROR","Internal server error"),code:"INTERNAL_SERVER_ERROR",severity:"fatal",...e})}};a(_o,"InternalServerError");var Cs=_o;var xo=class xo extends A{constructor(){super(...arguments),this.status=405}init(e){super.init({message:R("error:METHOD_NOT_ALLOWED","Method not allowed"),code:"METHOD_NOT_ALLOWED",...e})}};a(xo,"MethodNotAllowedError");var Us=xo;var Oo=class Oo extends A{constructor(){super(...arguments),this.status=406}init(e){super.init({message:R("error:NOT_ACCEPTABLE","Not Acceptable"),code:"NOT_ACCEPTABLE",...e})}};a(Oo,"NotAcceptableError");var Bs=Oo;var go=class go extends A{constructor(){super(...arguments),this.status=404}init(e){super.init({message:R("error:NOT_FOUND","Not found"),code:"NOT_FOUND",...e})}};a(go,"NotFoundError");var $s=go;var Ro=class Ro extends wr{init(e){super.init({message:R("error:PERMISSION_ERROR","You dont have permission for this operation"),code:"PERMISSION_ERROR",...e})}};a(Ro,"PermissionError");var qs=Ro;var wo=class wo extends A{constructor(e,t,r){super({message:R("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(wo,"ResourceConflictError");var Ks=wo;var bo=class bo extends A{constructor(e,t,r){super({message:R("error:RESOURCE_NOT_AVAILABLE",`Resource "${e}${t?"/"+t:""}" is not available`),severity:"error",code:"RESOURCE_NOT_AVAILABLE",details:{resource:e,key:t}},r,b.UNPROCESSABLE_ENTITY)}};a(bo,"ResourceNotAvailableError");var Vs=bo;var Ao=class Ao extends A{constructor(){super(...arguments),this.status=401}init(e){super.init({message:R("error:UNAUTHORIZED","You have not been authenticated to perform this action"),code:"UNAUTHORIZED",...e})}};a(Ao,"UnauthorizedError");var zs=Ao;var No=class No extends A{constructor(){super(...arguments),this.status=422}init(e){super.init({message:R("error:UNPROCESSABLE_ENTITY","Unprocessable entity"),severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};a(No,"UnprocessableEntityError");var Js=No;var Ws;(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"}})(Ws||(Ws={}));var Do=class Do{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};a(Do,"Ast");var Gt=Do;var So=class So extends Gt{};a(So,"Expression");var C=So;var Io=class Io extends C{};a(Io,"Term");var Be=Io;var vo=class vo extends Be{constructor(e){super(),this.value=e}toString(){return""+this.value}};a(vo,"Literal");var v=vo;var Mo=class Mo extends C{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new br({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};a(Mo,"ArithmeticExpression");var $e=Mo,Lo=class Lo{constructor(e){Object.assign(this,e)}};a(Lo,"ArithmeticExpressionItem");var br=Lo;var Po=class Po extends Be{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};a(Po,"ArrayExpression");var _e=Po;var Bp=/\w/,Fo=class Fo extends C{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${Bp.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};a(Fo,"ComparisonExpression");var ue=Fo;var ko=class ko extends C{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(ko,"LogicalExpression");var me=ko;var jo=class jo extends C{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(jo,"NegativeExpression");var Yt=jo;var Co=class Co extends C{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(Co,"ParenthesizedExpression");var xe=Co;var Uo=class Uo extends v{constructor(e){super(e)}};a(Uo,"BooleanLiteral");var qe=Uo;import{toDateDef as Jp}from"putil-varhelpers";var Bo=class Bo extends TypeError{};a(Bo,"SyntaxError");var Ar=Bo,$o=class $o extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};a($o,"FilterValidationError");var de=$o,qo=class qo extends Error{constructor(e,t){super(e),Object.assign(this,t)}};a(qo,"FilterParseError");var Nr=qo;var $p=/'/g,qp=/(\\)/g,Kp=/\\(.)/g;function Vp(o){return o.replace(qp,"\\\\")}a(Vp,"escapeString");function zp(o){return o.replace(Kp,"$1")}a(zp,"unescapeString");function Ne(o){return"'"+Vp(o).replace($p,"\\'")+"'"}a(Ne,"quoteFilterString");function Qt(o){return o&&(o.startsWith("'")||o.startsWith('"'))&&o.endsWith(o.charAt(0))?zp(o.substring(1,o.length-1)):o}a(Qt,"unquoteFilterString");var Gs=new Date(0),Ko=class Ko extends v{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&Jp(e,Gs)!==Gs){this.value=e;return}throw new de(`Invalid date value "${e}"`)}toString(){return Ne(this.value)}};a(Ko,"DateLiteral");var De=Ko;import{toDateDef as Wp}from"putil-varhelpers";var Ys=new Date(0),Vo=class Vo extends v{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&Wp(e,Ys)!==Ys){this.value=e;return}throw new de(`Invalid date-time value "${e}"`)}toString(){return Ne(this.value)}};a(Vo,"DateTimeLiteral");var Xt=Vo;var zo=class zo extends v{constructor(){super(null),this.value=null}};a(zo,"NullLiteral");var Ke=zo;var Jo=class Jo 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 de(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};a(Jo,"NumberLiteral");var Oe=Jo;var Wo=class Wo extends v{constructor(e){super(""+e)}};a(Wo,"QualifiedIdentifier");var ee=Wo;var Go=class Go extends v{constructor(e){super(""+e)}toString(){return Ne(this.value)}};a(Go,"StringLiteral");var Ve=Go;var Gp=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,Yo=class Yo extends v{constructor(e){if(super(""),e instanceof Date){this.value=Dr(e.getHours())+":"+Dr(e.getMinutes())+(e.getSeconds()?":"+Dr(e.getSeconds()):"")+(e.getMilliseconds()?"."+Dr(e.getMilliseconds()):"");return}if(typeof e=="string"&&Gp.test(e)){this.value=e;return}throw new de(`Invalid time value "${e}"`)}toString(){return Ne(this.value)}};a(Yo,"TimeLiteral");var ze=Yo;function Dr(o){return o<=9?"0"+o:""+o}a(Dr,"pad");import{CharStream as lc,CommonTokenStream as fc}from"@browsery/antlr4";import{ATNDeserializer as Yp,DFA as Qp,Lexer as Xp,LexerATNSimulator as Zp,PredictionContextCache as Hp,Token as ec}from"@browsery/antlr4";var q=class q extends Xp{constructor(e){super(e),this._interp=new Zp(this,q._ATN,q.DecisionsToDFA,new Hp)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return q.literalNames}get symbolicNames(){return q.symbolicNames}get ruleNames(){return q.ruleNames}get serializedATN(){return q._serializedATN}get channelNames(){return q.channelNames}get modeNames(){return q.modeNames}static get _ATN(){return q.__ATN||(q.__ATN=new Yp().deserialize(q._serializedATN)),q.__ATN}};a(q,"OpraFilterLexer");var h=q;h.T__0=1;h.T__1=2;h.T__2=3;h.T__3=4;h.T__4=5;h.T__5=6;h.T__6=7;h.T__7=8;h.T__8=9;h.T__9=10;h.T__10=11;h.T__11=12;h.T__12=13;h.T__13=14;h.T__14=15;h.T__15=16;h.T__16=17;h.T__17=18;h.T__18=19;h.T__19=20;h.T__20=21;h.T__21=22;h.T__22=23;h.T__23=24;h.T__24=25;h.T__25=26;h.T__26=27;h.T__27=28;h.T__28=29;h.T__29=30;h.T__30=31;h.T__31=32;h.T__32=33;h.T__33=34;h.IDENTIFIER=35;h.POLAR_OP=36;h.DATE=37;h.DATETIME=38;h.TIME=39;h.NUMBER=40;h.INTEGER=41;h.STRING=42;h.WHITESPACE=43;h.EOF=ec.EOF;h.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];h.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];h.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"];h.modeNames=["DEFAULT_MODE"];h.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"];h._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];h.DecisionsToDFA=h._ATN.decisionToState.map((o,e)=>new Qp(o,e));var Qs=h;import{ATN as Xs,ATNDeserializer as tc,DFA as rc,FailedPredicateException as ic,NoViableAltException as Qo,Parser as oc,ParserATNSimulator as nc,ParserRuleContext as B,PredictionContextCache as sc,RecognitionException as U,Token as ac}from"@browsery/antlr4";var E=class E extends oc{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return E.literalNames}get symbolicNames(){return E.symbolicNames}get ruleNames(){return E.ruleNames}get serializedATN(){return E._serializedATN}createFailedPredicateException(e,t){return new ic(this,e,t)}constructor(e){super(e),this._interp=new nc(this,E._ATN,E.DecisionsToDFA,new sc)}root(){let e=new Xo(this,this._ctx,this.state);this.enterRule(e,0,E.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(E.EOF)}catch(t){if(t instanceof U)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 G(this,this._ctx,r),n=i,s=2;this.enterRecursionRule(i,2,E.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 en(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 Zo(this,i),this._ctx=i,n=i,this.state=42,this.match(E.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(E.T__1);break;case 3:case 4:i=new Ho(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 Qo(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!==Xs.INVALID_ALT_NUMBER;){if(c===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),n=i;{if(i=new Zt(this,new G(this,t,r)),this.pushNewRecursionContext(i,s,E.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 U)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 Sr(this,this._ctx,this.state);this.enterRule(e,4,E.RULE_comparisonLeft);try{this.enterOuterAlt(e,1),this.state=59,this.qualifiedIdentifier()}catch(t){if(t instanceof U)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 Ir(this,this._ctx,this.state);this.enterRule(e,6,E.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 Qo(this)}}catch(t){if(t instanceof U)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 vr(this,this._ctx,this.state);this.enterRule(e,8,E.RULE_parenthesizedItem);try{this.enterOuterAlt(e,1),this.state=67,this.expression(0)}catch(t){if(t instanceof U)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 V(this,this._ctx,this.state);this.enterRule(e,10,E.RULE_value);try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 40:e=new cn(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(E.NUMBER);break;case 13:case 14:e=new an(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new pn(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new rn(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 38:e=new on(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(E.DATETIME);break;case 37:e=new sn(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(E.DATE);break;case 39:e=new tn(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(E.TIME);break;case 42:e=new nn(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(E.STRING);break;default:throw new Qo(this)}}catch(t){if(t instanceof U)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 Ht(this,this._ctx,this.state);this.enterRule(e,12,E.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!==Xs.INVALID_ALT_NUMBER;)t===1&&(this.state=79,this.identifier(),this.state=80,this.match(E.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 U)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 Mr(this,this._ctx,this.state);this.enterRule(e,14,E.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(E.T__5),this.state=90,this.identifier()}catch(t){if(t instanceof U)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 gt(this,this._ctx,this.state);this.enterRule(e,16,E.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(E.IDENTIFIER)}catch(t){if(t instanceof U)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 Lr(this,this._ctx,this.state);this.enterRule(e,18,E.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(E.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(E.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(E.T__8)}}catch(r){if(r instanceof U)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 Pr(this,this._ctx,this.state);this.enterRule(e,20,E.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 U)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 Fr(this,this._ctx,this.state);this.enterRule(e,22,E.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(E.T__11)}catch(t){if(t instanceof U)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 kr(this,this._ctx,this.state);this.enterRule(e,24,E.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 U)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 ln(this,this._ctx,this.state);this.enterRule(e,26,E.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 U)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 jr(this,this._ctx,this.state);this.enterRule(e,28,E.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 U)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 Cr(this,this._ctx,this.state);this.enterRule(e,30,E.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 U)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 fn(this,this._ctx,this.state);this.enterRule(e,32,E.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(E.POLAR_OP)}catch(t){if(t instanceof U)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 E.__ATN||(E.__ATN=new tc().deserialize(E._serializedATN)),E.__ATN}};a(E,"OpraFilterParser");var f=E;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=ac.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 rc(o,e));var Zs=f,un=class un extends B{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(G,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(un,"RootContext");var Xo=un,mn=class mn extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_expression}copyFrom(e){super.copyFrom(e)}};a(mn,"ExpressionContext");var G=mn,dn=class dn extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(vr,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(dn,"ParenthesizedExpressionContext");var Zo=dn,hn=class hn extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(G,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(hn,"NegativeExpressionContext");var Ho=hn,yn=class yn extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(Sr,0)}comparisonOperator(){return this.getTypedRuleContext(jr,0)}comparisonRight(){return this.getTypedRuleContext(Ir,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(yn,"ComparisonExpressionContext");var en=yn,Tn=class Tn extends G{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(G)}expression(e){return this.getTypedRuleContext(G,e)}logicalOperator(){return this.getTypedRuleContext(Cr,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(Tn,"LogicalExpressionContext");var Zt=Tn,En=class En extends B{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(Ht,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(En,"ComparisonLeftContext");var Sr=En,_n=class _n extends B{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(V,0)}qualifiedIdentifier(){return this.getTypedRuleContext(Ht,0)}externalConstant(){return this.getTypedRuleContext(Mr,0)}arrayValue(){return this.getTypedRuleContext(Lr,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(_n,"ComparisonRightContext");var Ir=_n,xn=class xn extends B{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(G,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(xn,"ParenthesizedItemContext");var vr=xn,On=class On extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_value}copyFrom(e){super.copyFrom(e)}};a(On,"ValueContext");var V=On,gn=class gn extends V{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(gn,"TimeLiteralContext");var tn=gn,Rn=class Rn extends V{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(Fr,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(Rn,"NullLiteralContext");var rn=Rn,wn=class wn extends V{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(wn,"DateTimeLiteralContext");var on=wn,bn=class bn extends V{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(bn,"StringLiteralContext");var nn=bn,An=class An extends V{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(An,"DateLiteralContext");var sn=An,Nn=class Nn extends V{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(kr,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(Nn,"InfinityLiteralContext");var an=Nn,Dn=class Dn extends V{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(Pr,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 pn=Dn,Sn=class Sn extends V{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(Sn,"NumberLiteralContext");var cn=Sn,In=class In extends B{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(gt)}identifier(e){return this.getTypedRuleContext(gt,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(In,"QualifiedIdentifierContext");var Ht=In,vn=class vn extends B{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(gt,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(vn,"ExternalConstantContext");var Mr=vn,Mn=class Mn extends B{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(Mn,"IdentifierContext");var gt=Mn,Ln=class Ln extends B{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(V)}value(e){return this.getTypedRuleContext(V,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(Ln,"ArrayValueContext");var Lr=Ln,Pn=class Pn extends B{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(Pn,"BooleanContext");var Pr=Pn,Fn=class Fn extends B{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(Fn,"NullContext");var Fr=Fn,kn=class kn extends B{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(kn,"InfinityContext");var kr=kn,jn=class jn extends B{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(jn,"ArithmeticOperatorContext");var ln=jn,Cn=class Cn extends B{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(Cn,"ComparisonOperatorContext");var jr=Cn,Un=class Un extends B{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(Un,"LogicalOperatorContext");var Cr=Un,Bn=class Bn extends B{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(Bn,"PolarityOperatorContext");var fn=Bn;import{ParseTreeVisitor as pc}from"@browsery/antlr4";var $n=class $n extends v{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};a($n,"ExternalConstant");var Ur=$n;var qn=class qn extends pc{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 xe(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new Yt(t)}visitComparisonExpression(e){return new ue({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 Zt&&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 me({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new ee(e.getText())}visitExternalConstant(e){return new Ur(e.identifier().getText())}visitNullLiteral(){return new Ke}visitBooleanLiteral(e){return new qe(e.getText()==="true")}visitNumberLiteral(e){return new Oe(e.getText())}visitStringLiteral(e){return new Ve(Qt(e.getText()))}visitInfinityLiteral(){return new Oe(1/0)}visitDateLiteral(e){return new De(Qt(e.getText()))}visitDateTimeLiteral(e){return new Xt(Qt(e.getText()))}visitTimeLiteral(e){return new ze(Qt(e.getText()))}visitArrayValue(e){return new _e(e.value_list().map(t=>this.visit(t)))}};a(qn,"FilterTreeVisitor");var er=qn;import{ErrorListener as cc}from"@browsery/antlr4";var Kn=class Kn extends cc{constructor(e){super(),this.errors=e}syntaxError(e,t,r,i,n,s){this.errors.push(new Nr(n,{recognizer:e,offendingSymbol:t,line:r,column:i,e:s}))}};a(Kn,"OpraErrorListener");var tr=Kn;function Vn(o,e){let t=new lc(o),r=new Qs(t),i=new fc(r),n=new Zs(i);n.buildParseTrees=!0;let s=[],p=new tr(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 _=new Ar(l.join(`
|
|
9
|
+
`));throw _.errors=s,_}return e=e||new er,e.visit(c)}a(Vn,"parse");var zn=class zn{constructor(e,t){if(this._rules=new N,this._decoderCache=new WeakMap,Object.defineProperty(this,"_rules",{value:new N(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,uc({...t,operators:r}))}normalizeFilter(e,t,r){let i=typeof e=="string"?Vn(e):e;return this.normalizeFilterAst(i,[],t,r)}normalizeFilterAst(e,t,r,i){if(e instanceof ue){if(t.push(e),this.normalizeFilterAst(e.left,t,r),!(e.left instanceof ee&&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 Ee({message:R("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 Ee({message:R("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 me)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof $e)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n.expression,t,r)),t.pop(),e;if(e instanceof _e)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof xe)return t.push(e),this.normalizeFilterAst(e.expression,t,r),t.pop(),e;if(e instanceof ee&&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 ue);if(n>=0){let s=t[n];if((e===s.right||t[n+1]===s.right)&&s&&s.left instanceof ee&&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=mc: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(zn,"FilterRules");var ge=zn;var rr={};fs(rr,{$and:()=>hc,$arithmetic:()=>Lc,$array:()=>Hs,$date:()=>yc,$eq:()=>xc,$field:()=>_c,$gt:()=>gc,$gte:()=>Rc,$ilike:()=>Ic,$in:()=>Ac,$like:()=>Dc,$lt:()=>wc,$lte:()=>bc,$ne:()=>Oc,$notILike:()=>vc,$notIn:()=>Nc,$notLike:()=>Sc,$number:()=>Ec,$or:()=>dc,$paren:()=>Mc,$time:()=>Tc,ArithmeticExpression:()=>$e,ArithmeticExpressionItem:()=>br,ArrayExpression:()=>_e,Ast:()=>Gt,BooleanLiteral:()=>qe,ComparisonExpression:()=>ue,DateLiteral:()=>De,DateTimeLiteral:()=>Xt,Expression:()=>C,FilterTreeVisitor:()=>er,Literal:()=>v,LogicalExpression:()=>me,NegativeExpression:()=>Yt,NullLiteral:()=>Ke,NumberLiteral:()=>Oe,OpraErrorListener:()=>tr,ParenthesizedExpression:()=>xe,QualifiedIdentifier:()=>ee,StringLiteral:()=>Ve,Term:()=>Be,TimeLiteral:()=>ze,parse:()=>Vn});function dc(...o){return new me({op:"or",items:o})}a(dc,"$or");function hc(...o){return new me({op:"and",items:o})}a(hc,"$and");function yc(o){return new De(o)}a(yc,"$date");function Tc(o){return new ze(o)}a(Tc,"$time");function Ec(o){return new Oe(o)}a(Ec,"$number");function Hs(...o){return new _e(o.map(Br))}a(Hs,"$array");function _c(o){return new ee(o)}a(_c,"$field");function xc(o,e){return te("=",o,e)}a(xc,"$eq");function Oc(o,e){return te("!=",o,e)}a(Oc,"$ne");function gc(o,e){return te(">",o,e)}a(gc,"$gt");function Rc(o,e){return te(">=",o,e)}a(Rc,"$gte");function wc(o,e){return te("<",o,e)}a(wc,"$lt");function bc(o,e){return te("<=",o,e)}a(bc,"$lte");function Ac(o,e){return te("in",o,e)}a(Ac,"$in");function Nc(o,e){return te("!in",o,e)}a(Nc,"$notIn");function Dc(o,e){return te("like",o,e)}a(Dc,"$like");function Sc(o,e){return te("!like",o,e)}a(Sc,"$notLike");function Ic(o,e){return te("ilike",o,e)}a(Ic,"$ilike");function vc(o,e){return te("!ilike",o,e)}a(vc,"$notILike");function Mc(o){return new xe(o)}a(Mc,"$paren");function Lc(o){let e=new $e;return e.add=t=>(e.append("+",Rt(t)),e),e.sub=t=>(e.append("-",Rt(t)),e),e.mul=t=>(e.append("*",Rt(t)),e),e.div=t=>(e.append("/",Rt(t)),e),e.append("+",Br(o)),e}a(Lc,"$arithmetic");function te(o,e,t){let r=typeof e=="string"?new ee(e):Br(e),i=Br(t);return new ue({op:o,left:r,right:i})}a(te,"comparisonExpression");var Br=a(o=>Array.isArray(o)?Hs(...o.map(Rt)):Rt(o),"wrapEntryValue"),Rt=a(o=>o instanceof C?o:typeof o=="boolean"?new qe(o):typeof o=="number"||typeof o=="bigint"?new Oe(o):o==null?new Ke:o instanceof Date?new De(o):new Ve(""+o),"_wrapEntryValue");var wt,ne=(wt=class{constructor(e){e&&Object.assign(this,e)}[y](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),i=e.rules?new ge(e.rules):void 0;return Pc(r,i)}[x](){return Fc}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(wt,"FilterType"),wt);Jn([u.Attribute({description:"Data type which filtering fields belong to"}),Wn("design:type",Object)],ne.prototype,"dataType",void 0);Jn([u.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),Wn("design:type",Object)],ne.prototype,"rules",void 0);ne=Jn([u({name:"filter",description:"A query filter",nameMappings:{js:"object",json:"string"}}),Wn("design:paramtypes",[Object])],ne);var Pc=a((o,e,t)=>ea("decodeFilter",(r,i,n)=>{if(typeof r=="string")try{let s=rr.parse(r);return e?e.normalizeFilter(s,o,t):s}catch(s){i.fail(n,`Not a valid filter expression. ${s.message}`,r);return}i.fail(n,"Nt a valid filter expression string",r)}),"decodeFilter"),Fc=ea("encodeFilter",(o,e,t)=>{if(o instanceof rr.Ast)return o.toString();e.fail(t,"Not a valid filter expression",o)});import{__decorate as kc,__metadata as jc}from"tslib";import{vg as ta}from"valgen";var bt,$r=(bt=class{constructor(e){e&&Object.assign(this,e)}[y](){return ta.isObjectId({coerce:!0})}[x](){return ta.isObjectId({coerce:!0})}},a(bt,"ObjectIdType"),bt);$r=kc([u({name:"ObjectId",description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),jc("design:paramtypes",[Object])],$r);import{__decorate as he,__metadata as ye}from"tslib";var At,Y=(At=class{constructor(e){e&&Object.assign(this,e)}},a(At,"OperationResult"),At);he([P(),ye("design:type",Number)],Y.prototype,"affected",void 0);he([P(),ye("design:type",Number)],Y.prototype,"totalMatches",void 0);he([P(),ye("design:type",String)],Y.prototype,"context",void 0);he([P(),ye("design:type",String)],Y.prototype,"type",void 0);he([P(),ye("design:type",String)],Y.prototype,"message",void 0);he([P({type:"any"}),ye("design:type",Object)],Y.prototype,"payload",void 0);he([P({type:"object"}),ye("design:type",Array)],Y.prototype,"errors",void 0);Y=he([Q({name:"OperationResult",description:"Operation result"}),ye("design:paramtypes",[Object])],Y);(function(o){function e(t){var i;let r=(i=class extends o{constructor(...s){super(...s)}},a(i,"OperationResult_"),i);return he([P({type:t,required:!0}),ye("design:type",Object)],r.prototype,"payload",void 0),r=he([Q({embedded:!0}),ye("design:paramtypes",[Object])],r),r}a(e,"forPayload"),o.forPayload=e})(Y||(Y={}));import{__decorate as Gn,__metadata as Yn}from"tslib";import{vg as qr}from"valgen";var Cc=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,Nt,Dt=(Nt=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=qr.matches(Cc,{formatName:"time",coerce:!0}),r=[];return e.minValue&&r.push(qr.isGte(e.minValue)),e.maxValue&&r.push(qr.isLte(e.maxValue)),r.length>0?qr.pipe([t,...r],{returnIndex:0}):t}[x](e){return this[y](e)}},a(Nt,"TimeType"),Nt);Gn([u.Attribute({description:"Minimum value"}),Yn("design:type",String)],Dt.prototype,"minValue",void 0);Gn([u.Attribute({description:"Maximum value"}),Yn("design:type",String)],Dt.prototype,"maxValue",void 0);Dt=Gn([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"),Yn("design:paramtypes",[Object])],Dt);import{__decorate as Uc,__metadata as Bc}from"tslib";import{vg as ra}from"valgen";var St,Kr=(St=class{constructor(e){e&&Object.assign(this,e)}[y](){return ra.isURL({coerce:!0})}[x](){return ra.isURL({coerce:!0})}},a(St,"UrlType"),St);Kr=Uc([u({name:"url",description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),Bc("design:paramtypes",[Object])],Kr);import{__decorate as oa,__metadata as na}from"tslib";import{vg as ia}from"valgen";var It,ir=(It=class{constructor(e){e&&Object.assign(this,e)}[y](e){return ia.isUUID(e==null?void 0:e.version,{coerce:!0})}[x](e){return ia.isUUID(e==null?void 0:e.version,{coerce:!0})}},a(It,"UuidType"),It);oa([u.Attribute({description:"Version of the UUID"}),na("design:type",Number)],ir.prototype,"version",void 0);ir=oa([u({name:"uuid",description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),na("design:paramtypes",[Object])],ir);function Se(o,e,t){let r=dr(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"&&fr(this,o,r)}}}[n];if(typeof o=="function"&&lr(s.prototype,o.prototype),typeof o=="function"){let c=Reflect.getOwnMetadata(T,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(T,p,s),typeof o=="function"&&ke._applyMixin(s,o,{...e,isInheritedPredicate:r}),s}a(Se,"createMappedClass");function L_(o,e,t){return Se(o,{omit:e},t)}a(L_,"OmitType");function j_(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return Se(o,{partial:t},r)}a(j_,"PartialType");function $_(o,e,t){return Se(o,{pick:e},t)}a($_,"PickType");import{__decorate as $c,__metadata as qc}from"tslib";import{isAny as sa}from"valgen";var vt,Vr=(vt=class{constructor(e){e&&Object.assign(this,e)}[y](){return sa}[x](){return sa}},a(vt,"AnyType"),vt);Vr=$c([u({name:"any",description:"Represents any value"}),qc("design:paramtypes",[Object])],Vr);import{__decorate as Kc,__metadata as Vc}from"tslib";import{toBigint as pa,vg as Hn}from"valgen";import{__decorate as Xn,__metadata as Zn}from"tslib";import{toNumber as aa,vg as Qn}from"valgen";var Mt,Te=(Mt=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=[];return e.minValue&&t.push(Qn.isGte(e.minValue)),e.maxValue&&t.push(Qn.isLte(e.maxValue)),t.length>0?Qn.pipe([aa,...t],{returnIndex:0}):aa}[x](e){return this[y](e)}},a(Mt,"NumberType"),Mt);Xn([u.Attribute({description:"Determines the minimum value"}),Zn("design:type",Number)],Te.prototype,"minValue",void 0);Xn([u.Attribute({description:"Determines the maximum value"}),Zn("design:type",Number)],Te.prototype,"maxValue",void 0);Te=Xn([u({name:"number",description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),Zn("design:paramtypes",[Object])],Te);var Lt,zr=(Lt=class extends Te{constructor(e){super(e)}[y](e){let t=[];return e.minValue&&t.push(Hn.isGte(e.minValue)),e.maxValue&&t.push(Hn.isLte(e.maxValue)),t.length>0?Hn.pipe([pa,...t],{returnIndex:0}):pa}[x](e){return this[y](e)}},a(Lt,"BigintType"),Lt);zr=Kc([u({name:"bigint",description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),Vc("design:paramtypes",[Object])],zr);import{__decorate as zc,__metadata as Jc}from"tslib";import{toBoolean as ca}from"valgen";var Pt,Jr=(Pt=class{constructor(e){e&&Object.assign(this,e)}[y](){return ca}[x](){return ca}},a(Pt,"BooleanType"),Pt);Jr=zc([u({name:"boolean",description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),Jc("design:paramtypes",[Object])],Jr);import{__decorate as Wc,__metadata as Gc}from"tslib";import{toInteger as la,vg as es}from"valgen";var Ft,Je=(Ft=class extends Te{constructor(e){super(e)}[y](e){let t=[];return e.minValue&&t.push(es.isGte(e.minValue)),e.maxValue&&t.push(es.isLte(e.maxValue)),t.length>0?es.pipe([la,...t],{returnIndex:0}):la}[x](e){return this[y](e)}},a(Ft,"IntegerType"),Ft);Je=Wc([u({name:"integer",description:"An integer number",nameMappings:{js:"number",json:"number"}}),Gc("design:paramtypes",[Object])],Je);import{__decorate as Yc,__metadata as Qc}from"tslib";import{isNull as fa}from"valgen";var kt,Wr=(kt=class{constructor(e){e&&Object.assign(this,e)}[y](){return fa}[x](){return fa}},a(kt,"NullType"),kt);Wr=Yc([u({name:"null",description:"A Null value",nameMappings:{js:"null",json:"null"}}),Qc("design:paramtypes",[Object])],Wr);import{__decorate as Xc,__metadata as Zc}from"tslib";var jt,Gr=(jt=class{constructor(e){e&&Object.assign(this,e)}},a(jt,"ObjectType"),jt);Gr=Xc([Q({name:"object",description:"A non modelled object",additionalFields:!0}),Zc("design:paramtypes",[Object])],Gr);import{__decorate as or,__metadata as nr}from"tslib";import{toString as ua,vg as Yr}from"valgen";var Ct,Ie=(Ct=class{constructor(e){e&&Object.assign(this,e)}[y](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(T,Object.getPrototypeOf(this).constructor).name),t.push(Yr.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(Yr.lengthMin(e.minLength)),e.maxLength&&t.push(Yr.lengthMax(e.maxLength)),t.length>0?Yr.pipe([ua,...t],{returnIndex:0}):ua}[x](e){return this[y](e)}},a(Ct,"StringType"),Ct);or([u.Attribute({description:"Regex pattern to be used for validation"}),nr("design:type",Object)],Ie.prototype,"pattern",void 0);or([u.Attribute({description:"Name of the pattern"}),nr("design:type",String)],Ie.prototype,"patternName",void 0);or([u.Attribute({description:"Minimum number of characters"}),nr("design:type",Number)],Ie.prototype,"minLength",void 0);or([u.Attribute({description:"Minimum number of characters"}),nr("design:type",Number)],Ie.prototype,"maxLength",void 0);Ie=or([u({name:"string",description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),nr("design:paramtypes",[Object])],Ie);function G2(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return Se(o,{required:t},r)}a(G2,"RequiredType");D.Entity={};D.Entity.Create=function(o,e){var n;let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(b.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(b.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};D.Entity.Delete=function(o,e){let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"DELETE",...t,composition:"Entity.Delete"});return i.Response(b.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:I.opra_response_json}).Response(b.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};D.Entity.DeleteMany=function(o,e){let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=new ge,n=new ne({dataType:t.type});n.rules={};let s=F(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return s.Response(b.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:I.opra_response_json}).Response(b.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};D.Entity.FindMany=function(o,e){let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=new ge,n=new ne({dataType:t.type});n.rules={};let s=F(r,{method:"GET",...t,composition:"Entity.FindMany"});return s.Response(b.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(b.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 Je({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new Je({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).QueryParam("filter",{type:n,description:"Determines filter fields"}).QueryParam("sort",{description:"Determines sort fields",type:new W({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};D.Entity.Get=function(o,e){let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"GET",...t,composition:"Entity.Get"});return i.QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(b.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(b.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(b.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};D.Entity.Replace=function(o,e){let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=F(r,{method:"POST",...t,composition:"Entity.Replace"});return i.QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(b.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(b.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(b.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};D.Entity.UpdateMany=function(o,e){var p;let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=new ne({dataType:t.type});i.rules={};let n=new ge,s=F(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(b.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:I.opra_response_json}).Response(b.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,_)=>(r.push(()=>{n.set(c,{operators:l,description:_}),i.rules=n.toJSON()}),s),s};D.Entity.Update=function(o,e){var p;let t;typeof o=="object"&&!o[T]?t=o:t={...e,type:o};let r=[],i=new ge,n=new ne({dataType:t.type});n.rules={};let s=F(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 W({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(b.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(b.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(b.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 _=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,_),r.push(d=>{var $;($=d.path)!=null&&$.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,_)=>(r.push(()=>{i.set(c,{operators:l,description:_}),n.rules=i.toJSON()}),s),s};function ve(o){if(typeof o=="string")return o;let e=Reflect.getMetadata(T,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");import{isConstructor as sl}from"@jsopen/objects";import{omitUndefined as Hc}from"@jsopen/objects";import{asMutable as el}from"ts-gems";var We=a(function(...o){var i;if(!this)return We[w].apply(void 0,o);let[e,t]=o;if(g.call(this,e),!k.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=el(this);r.kind=m.RpcController.Kind,r.types=r.node[j]=new Z,r.operations=new N,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"),rs=class rs extends g{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 We)return this.node.parent.element.findHeader(e,t)}toString(){return`[RpcController ${this.name}]`}toJSON(){let e=Hc({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`[${it}RpcController${ot+this.name+Fe}]`}};a(rs,"RpcControllerClass");var ts=rs;We.prototype=ts.prototype;Object.assign(We,He);We[w]=He;import{omitUndefined as tl}from"@jsopen/objects";import{asMutable as rl}from"ts-gems";var sr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');Ce.call(this,o,e);let t=rl(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?pt(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.deprecated=e.deprecated,t.required=e.required},"RpcHeader"),os=class os extends Ce{toJSON(){return tl({...super.toJSON(),name:this.name,required:this.required,deprecated:this.deprecated})}};a(os,"RpcHeaderClass");var is=os;sr.prototype=is.prototype;import{omitUndefined as il}from"@jsopen/objects";import{asMutable as ol}from"ts-gems";var ar=a(function(...o){if(!this){let[i,n]=o,s=[];return ar[w].call(void 0,s,i,n)}let[e,t]=o;if(g.call(this,e),!k.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=ol(this);r.headers=[],r.types=r.node[j]=new Z,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"),ss=class ss extends g{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=il({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(ss,"RpcOperationClass");var ns=ss;ar.prototype=ns.prototype;ar[w]=Bt;import{omitUndefined as nl}from"@jsopen/objects";var as=class as extends g{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=nl({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(as,"RpcOperationResponse");var Qr=as;var ps=class ps{static async createApi(e,t){let r=new lt(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"&&!sl(r)&&(r=r()),r=await se(r);let n,s,p;if(typeof r=="function"){if(s=Reflect.getMetadata(ie,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(ie,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 We(t,{...s,name:i,instance:p,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await S.addDataTypes(e,c,s.types)}),s.headers&&await e.enterAsync(".headers",async()=>{let l=0;for(let _ of s.headers)await e.enterAsync(`[${l++}]`,async()=>{let d={..._};await e.enterAsync(".type",async()=>{_.type&&(d.type=c.node.findDataType(_.type)),!d.type&&typeof _.type=="object"&&(d.type=await S.createDataType(e,c,_.type)),d.type||(d.type=c.node.getDataType("any"))});let $=new sr(c,d);c.headers.push($)})}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[l,_]of Object.entries(s.operations))await e.enterAsync(`[${l}]`,async()=>{let d=new ar(c,{..._,name:l,types:void 0,payloadType:void 0,keyType:void 0});await this._initRpcOperation(e,d,_),c.operations.set(d.name,d)})}),c}static async _initRpcOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await S.addDataTypes(e,t,r.types)}),t.payloadType=await S.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await S.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 S.resolveDataType(e,t,n.type)});let p=new sr(t,s);t.headers.push(p)})}),r.response&&await e.enterAsync(".response",async()=>{let i=new Qr(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 S.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await S.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 S.resolveDataType(e,t,n.type)});let p=new sr(t,s);t.headers.push(p)})})}};a(ps,"RpcApiFactory");var Xr=ps;var al="https://oprajs.com/spec/v"+m.SpecVersion,Zr=class Zr{constructor(){this._allDocuments={}}static async createDocument(e,t){let r=new Zr,i=t instanceof pe?t:new pe(t);try{let n=new Ue;if(await r.initDocument(n,i,e),i.error.details.length)throw i.error;return n}catch(n){try{n instanceof tt||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[
|
|
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[Le]){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 se(p),await t.enterAsync(`[${s}]`,async()=>{if(!k.test(s))throw new TypeError(`Invalid namespace (${s})`);if(p instanceof Ue){e.references.set(s,p);return}let c=new Ue;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 S.addDataTypes(t,e,i.types)}),i.api&&await t.enterAsync(".api",async()=>{if(i.api&&i.api.transport==="http"){let s=await ct.createApi(t,{...i.api,owner:e});s&&(e.api=s)}else if(i.api&&i.api.transport==="rpc"){let s=await Xr.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:al,info:{version:m.SpecVersion,title:"Opra built-in types",license:{url:"https://github.com/oprajs/opra/blob/main/LICENSE",name:"MIT"}},types:[Vr,zr,Jr,Je,Wr,Te,Gr,Ie,_r,mt,ht,Tt,_t,J,W,ne,$r,Y,Dt,Kr,ir]},r=new Ue;r[Le]=!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(Zr,"ApiDocumentFactory");var ma=Zr;var da;(function(o){o.HttpApiFactory=ct,o.DataTypeFactory=S,o.RpcOperationDecoratorFactory=Bt,o.RpcControllerDecoratorFactory=He})(da||(da={}));import{uid as tO}from"uid";export{Vr as AnyType,st as ApiBase,Ue as ApiDocument,ma as ApiDocumentFactory,P as ApiField,Le as BUILTIN,Fs as BadRequestError,_r as Base64Type,ja as BaseI18n,zr as BigintType,Jr as BooleanType,k as CLASS_NAME_PATTERN,Q as ComplexType,ks as ConflictError,T as DATATYPE_METADATA,y as DECODER,w as DECORATOR,O as DataType,Z as DataTypeMap,ht as DateStringType,_t as DateTimeStringType,Tt as DateTimeType,mt as DateType,g as DocumentElement,pe as DocumentInitContext,mr as DocumentNode,x as ENCODER,J as EmailType,ce as EnumType,js as FailedDependencyError,W as FieldPathType,Pe as FieldsProjection,ne as FilterType,wr as ForbiddenError,re as HTTP_CONTROLLER_METADATA,at as HttpApi,H as HttpController,Ss as HttpHeaderCodes,we as HttpMediaType,yr as HttpMultipartField,D as HttpOperation,Tr as HttpOperationResponse,Wt as HttpParameter,Er as HttpRequestBody,b as HttpStatusCode,R0 as HttpStatusMessages,Jt as HttpStatusRange,qt as I18n,Je as IntegerType,Cs as InternalServerError,Ws as IssueSeverity,ke as MappedType,Us as MethodNotAllowedError,I as MimeTypes,nt as MixinType,us as NAMESPACE_PATTERN,Bs as NotAcceptableError,$s as NotFoundError,Wr as NullType,Te as NumberType,$r as ObjectIdType,Gr as ObjectType,L_ as OmitType,Y as OperationResult,tt as OpraDocumentError,Ee as OpraException,rr as OpraFilter,A as OpraHttpError,m as OpraSchema,j_ as PartialType,qs as PermissionError,$_ as PickType,ie as RPC_CONTROLLER_METADATA,G2 as RequiredType,Ks as ResourceConflictError,Vs as ResourceNotAvailableError,N as ResponsiveMap,lt as RpcApi,We as RpcController,sr as RpcHeader,ar as RpcOperation,u as SimpleType,Ie as StringType,Dt as TimeType,zs as UnauthorizedError,Js as UnprocessableEntityError,Kr as UrlType,ir as UuidType,da as classes,M as cloneObject,mf as getErrorStack,uf as getStackFileName,pi as i18n,fr as inheritPropertyInitializers,Lf as isBlob,Pf as isFormData,If as isReadable,Mf as isReadableStream,ai as isStream,Ff as isURL,vf as isWritable,cr as kCtorMap,j as kDataTypeMap,Re as kTypeNSMap,lr as mergePrototype,_s as parse,Es as parseFieldsProjection,se as resolveThunk,Nf as safeJsonStringify,R as translate,tO as uid};
|