@fincity/kirun-js 2.9.0 → 2.11.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/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var e,t,r,s,n,a,i=require("luxon");function o(e,t){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e}function E(e,t,r,s){Object.defineProperty(e,t,{get:r,set:s,enumerable:!0,configurable:!0})}var u={};E(u,"KIRunSchemaRepository",()=>X);var A={};E(A,"AdditionalType",()=>C),E(A,"Schema",()=>D);var T={};E(T,"Namespaces",()=>l);class l{static{this.SYSTEM="System"}static{this.SYSTEM_CTX="System.Context"}static{this.SYSTEM_LOOP="System.Loop"}static{this.SYSTEM_ARRAY="System.Array"}static{this.SYSTEM_OBJECT="System.Object"}static{this.MATH="System.Math"}static{this.STRING="System.String"}static{this.DATE="System.Date"}constructor(){}}var m={};E(m,"ArraySchemaType",()=>g);var h={};function R(e){return null==e}E(h,"isNullValue",()=>R);class g{constructor(e){if(!e)return;this.singleSchema=e.singleSchema?new D(e.singleSchema):void 0,this.tupleSchema=e.tupleSchema?e.tupleSchema.map(e=>new D(e)):void 0}setSingleSchema(e){return this.singleSchema=e,this}setTupleSchema(e){return this.tupleSchema=e,this}getSingleSchema(){return this.singleSchema}getTupleSchema(){return this.tupleSchema}isSingleType(){return!R(this.singleSchema)}static of(...e){return 1==e.length?new g().setSingleSchema(e[0]):new g().setTupleSchema(e)}static from(e){if(!e)return;if(Array.isArray(e))return new g().setTupleSchema(D.fromListOfSchemas(e));let t=Object.keys(e);if(-1!=t.indexOf("singleSchema"))return new g().setSingleSchema(D.from(e.singleSchema));if(-1!=t.indexOf("tupleSchema"))return new g().setTupleSchema(D.fromListOfSchemas(e.tupleSchema));let r=D.from(e);if(r)return new g().setSingleSchema(r)}}var c={};E(c,"SchemaType",()=>p);var p=((e={}).INTEGER="Integer",e.LONG="Long",e.FLOAT="Float",e.DOUBLE="Double",e.STRING="String",e.OBJECT="Object",e.ARRAY="Array",e.BOOLEAN="Boolean",e.NULL="Null",e),N={};E(N,"TypeUtil",()=>d);var f={};E(f,"MultipleType",()=>S);var _={};E(_,"Type",()=>M);class M{}class S extends M{constructor(e){super(),e instanceof S?this.type=new Set(Array.from(e.type)):this.type=new Set(Array.from(e))}getType(){return this.type}setType(e){return this.type=e,this}getAllowedSchemaTypes(){return this.type}contains(e){return this.type?.has(e)}}var O={};E(O,"SingleType",()=>w);class w extends M{constructor(e){super(),e instanceof w?this.type=e.type:this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class d{static of(...e){return 1==e.length?new w(e[0]):new S(new Set(e))}static from(e){return"string"==typeof e?new w(p[d.fromJSONType(e)]):Array.isArray(e)?new S(new Set(e.map(d.fromJSONType).map(e=>e).map(e=>p[e]))):void 0}static fromJSONType(e){let t=e.toUpperCase();return"NUMBER"===t?"DOUBLE":t}}const P="additionalProperty",I="additionalItems",y="enums",x="items",L="System.Schema",v="required",U="version",V="namespace";class C{constructor(e){if(!e||(this.booleanValue=e.booleanValue,!e.schemaValue))return;this.schemaValue=new D(e.schemaValue)}getBooleanValue(){return this.booleanValue}getSchemaValue(){return this.schemaValue}setBooleanValue(e){return this.booleanValue=e,this}setSchemaValue(e){return this.schemaValue=e,this}static from(e){if(R(e))return;let t=new C;if("boolean"==typeof e)t.booleanValue=e;else{let r=Object.keys(e);-1!=r.indexOf("booleanValue")?t.booleanValue=e.booleanValue:-1!=r.indexOf("schemaValue")?t.schemaValue=D.from(e.schemaValue):t.schemaValue=D.from(e)}return t}}class D{static{this.NULL=new D().setNamespace(l.SYSTEM).setName("Null").setType(d.of(p.NULL)).setConstant(void 0)}static{this.TYPE_SCHEMA=new D().setType(d.of(p.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"])}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName("Schema").setType(d.of(p.OBJECT)).setProperties(new Map([[V,D.of(V,p.STRING).setDefaultValue("_")],["name",D.ofString("name")],[U,D.of(U,p.INTEGER).setDefaultValue(1)],["ref",D.ofString("ref")],["type",new D().setAnyOf([D.TYPE_SCHEMA,D.ofArray("type",D.TYPE_SCHEMA)])],["anyOf",D.ofArray("anyOf",D.ofRef(L))],["allOf",D.ofArray("allOf",D.ofRef(L))],["oneOf",D.ofArray("oneOf",D.ofRef(L))],["not",D.ofRef(L)],["title",D.ofString("title")],["description",D.ofString("description")],["id",D.ofString("id")],["examples",D.ofAny("examples")],["defaultValue",D.ofAny("defaultValue")],["comment",D.ofString("comment")],[y,D.ofArray(y,D.ofString(y))],["constant",D.ofAny("constant")],["pattern",D.ofString("pattern")],["format",D.of("format",p.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",D.ofInteger("minLength")],["maxLength",D.ofInteger("maxLength")],["multipleOf",D.ofLong("multipleOf")],["minimum",D.ofNumber("minimum")],["maximum",D.ofNumber("maximum")],["exclusiveMinimum",D.ofNumber("exclusiveMinimum")],["exclusiveMaximum",D.ofNumber("exclusiveMaximum")],["properties",D.of("properties",p.OBJECT).setAdditionalProperties(new C().setSchemaValue(D.ofRef(L)))],["additionalProperties",new D().setName(P).setNamespace(l.SYSTEM).setAnyOf([D.ofBoolean(P),D.ofObject(P).setRef(L)]).setDefaultValue(!0)],[v,D.ofArray(v,D.ofString(v)).setDefaultValue([])],["propertyNames",D.ofRef(L)],["minProperties",D.ofInteger("minProperties")],["maxProperties",D.ofInteger("maxProperties")],["patternProperties",D.of("patternProperties",p.OBJECT).setAdditionalProperties(new C().setSchemaValue(D.ofRef(L)))],[x,new D().setName(x).setAnyOf([D.ofRef(L).setName("item"),D.ofArray("tuple",D.ofRef(L))])],["contains",D.ofRef(L)],["minContains",D.ofInteger("minContains")],["maxContains",D.ofInteger("maxContains")],["minItems",D.ofInteger("minItems")],["maxItems",D.ofInteger("maxItems")],["uniqueItems",D.ofBoolean("uniqueItems")],["additionalItems",new D().setName(I).setNamespace(l.SYSTEM).setAnyOf([D.ofBoolean(I),D.ofObject(I).setRef(L)])],["$defs",D.of("$defs",p.OBJECT).setAdditionalProperties(new C().setSchemaValue(D.ofRef(L)))],["permission",D.ofString("permission")],["details",D.ofObject("details")]])).setRequired([])}static ofString(e){return new D().setType(d.of(p.STRING)).setName(e)}static ofInteger(e){return new D().setType(d.of(p.INTEGER)).setName(e)}static ofFloat(e){return new D().setType(d.of(p.FLOAT)).setName(e)}static ofLong(e){return new D().setType(d.of(p.LONG)).setName(e)}static ofDouble(e){return new D().setType(d.of(p.DOUBLE)).setName(e)}static ofAny(e){return new D().setType(d.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE,p.STRING,p.BOOLEAN,p.ARRAY,p.NULL,p.OBJECT)).setName(e)}static ofAnyNotNull(e){return new D().setType(d.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE,p.STRING,p.BOOLEAN,p.ARRAY,p.OBJECT)).setName(e)}static ofNumber(e){return new D().setType(d.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE)).setName(e)}static ofBoolean(e){return new D().setType(d.of(p.BOOLEAN)).setName(e)}static of(e,...t){return new D().setType(d.of(...t)).setName(e)}static ofObject(e){return new D().setType(d.of(p.OBJECT)).setName(e)}static ofRef(e){return new D().setRef(e)}static ofArray(e,...t){return new D().setType(d.of(p.ARRAY)).setName(e).setItems(g.of(...t))}static fromListOfSchemas(e){if(R(e)&&!Array.isArray(e))return;let t=[];for(let r of Array.from(e)){let e=D.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(R(e))return;let t=new Map;return Object.entries(e).forEach(([e,r])=>{let s=D.from(r);s&&t.set(e,s)}),t}static from(e,t=!1){if(R(e))return;let r=new D;return r.namespace=e.namespace??"_",r.name=e.name,r.version=e.version??1,r.ref=e.ref,t?r.type=new w(p.STRING):r.type=d.from(e.type),r.anyOf=D.fromListOfSchemas(e.anyOf),r.allOf=D.fromListOfSchemas(e.allOf),r.oneOf=D.fromListOfSchemas(e.oneOf),r.not=D.from(e.not),r.description=e.description,r.examples=e.examples?[...e.examples]:void 0,r.defaultValue=e.defaultValue,r.comment=e.comment,r.enums=e.enums?[...e.enums]:void 0,r.constant=e.constant,r.pattern=e.pattern,r.format=e.format,r.minLength=e.minLength,r.maxLength=e.maxLength,r.multipleOf=e.multipleOf,r.minimum=e.minimum,r.maximum=e.maximum,r.exclusiveMinimum=e.exclusiveMinimum,r.exclusiveMaximum=e.exclusiveMaximum,r.properties=D.fromMapOfSchemas(e.properties),r.additionalProperties=C.from(e.additionalProperties),r.required=e.required,r.propertyNames=D.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=D.fromMapOfSchemas(e.patternProperties),r.items=g.from(e.items),r.additionalItems=C.from(e.additionalItems),r.contains=D.from(e.contains),r.minContains=e.minContains,r.maxContains=e.maxContains,r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=D.fromMapOfSchemas(e.$defs),r.permission=e.permission,r.details=e.details?new Map(Object.entries(e.details)):void 0,r}constructor(e){if(this.namespace="_",this.version=1,!e)return;this.namespace=e.namespace,this.name=e.name,this.version=e.version,this.ref=e.ref,R(e.type)||(this.type=e.type instanceof w?new w(e.type):new S(e.type)),this.anyOf=e.anyOf?.map(e=>new D(e)),this.allOf=e.allOf?.map(e=>new D(e)),this.oneOf=e.oneOf?.map(e=>new D(e)),this.not=this.not?new D(this.not):void 0,this.description=e.description,this.examples=e.examples?JSON.parse(JSON.stringify(e.examples)):void 0,this.defaultValue=e.defaultValue?JSON.parse(JSON.stringify(e.defaultValue)):void 0,this.comment=e.comment,this.enums=e.enums?[...e.enums]:void 0,this.constant=e.constant?JSON.parse(JSON.stringify(e.constant)):void 0,this.pattern=e.pattern,this.format=e.format,this.minLength=e.minLength,this.maxLength=e.maxLength,this.multipleOf=e.multipleOf,this.minimum=e.minimum,this.maximum=e.maximum,this.exclusiveMinimum=e.exclusiveMinimum,this.exclusiveMaximum=e.exclusiveMaximum,this.properties=e.properties?new Map(Array.from(e.properties.entries()).map(e=>[e[0],new D(e[1])])):void 0,this.additionalProperties=e.additionalProperties?new C(e.additionalProperties):void 0,this.required=e.required?[...e.required]:void 0,this.propertyNames=e.propertyNames?new D(e.propertyNames):void 0,this.minProperties=e.minProperties,this.maxProperties=e.maxProperties,this.patternProperties=e.patternProperties?new Map(Array.from(e.patternProperties.entries()).map(e=>[e[0],new D(e[1])])):void 0,this.items=e.items?new g(e.items):void 0,this.contains=e.contains?new D(this.contains):void 0,this.minContains=e.minContains,this.maxContains=e.maxContains,this.minItems=e.minItems,this.maxItems=e.maxItems,this.uniqueItems=e.uniqueItems,this.additionalItems=e.additionalItems?new C(e.additionalItems):void 0,this.$defs=e.$defs?new Map(Array.from(e.$defs.entries()).map(e=>[e[0],new D(e[1])])):void 0,this.permission=e.permission,this.details=e.details?new Map(JSON.parse(JSON.stringify(Array.from(e.details.values())))):void 0}getTitle(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}getFullName(){return this.namespace+"."+this.name}get$defs(){return this.$defs}set$defs(e){return this.$defs=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getVersion(){return this.version}setVersion(e){return this.version=e,this}getRef(){return this.ref}setRef(e){return this.ref=e,this}getType(){return this.type}setType(e){return this.type=e,this}getAnyOf(){return this.anyOf}setAnyOf(e){return this.anyOf=e,this}getAllOf(){return this.allOf}setAllOf(e){return this.allOf=e,this}getOneOf(){return this.oneOf}setOneOf(e){return this.oneOf=e,this}getNot(){return this.not}setNot(e){return this.not=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getExamples(){return this.examples}setExamples(e){return this.examples=e,this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}getComment(){return this.comment}setComment(e){return this.comment=e,this}getEnums(){return this.enums}setEnums(e){return this.enums=e,this}getConstant(){return this.constant}setConstant(e){return this.constant=e,this}getPattern(){return this.pattern}setPattern(e){return this.pattern=e,this}getFormat(){return this.format}setFormat(e){return this.format=e,this}getMinLength(){return this.minLength}setMinLength(e){return this.minLength=e,this}getMaxLength(){return this.maxLength}setMaxLength(e){return this.maxLength=e,this}getMultipleOf(){return this.multipleOf}setMultipleOf(e){return this.multipleOf=e,this}getMinimum(){return this.minimum}setMinimum(e){return this.minimum=e,this}getMaximum(){return this.maximum}setMaximum(e){return this.maximum=e,this}getExclusiveMinimum(){return this.exclusiveMinimum}setExclusiveMinimum(e){return this.exclusiveMinimum=e,this}getExclusiveMaximum(){return this.exclusiveMaximum}setExclusiveMaximum(e){return this.exclusiveMaximum=e,this}getProperties(){return this.properties}setProperties(e){return this.properties=e,this}getAdditionalProperties(){return this.additionalProperties}setAdditionalProperties(e){return this.additionalProperties=e,this}getAdditionalItems(){return this.additionalItems}setAdditionalItems(e){return this.additionalItems=e,this}getRequired(){return this.required}setRequired(e){return this.required=e,this}getPropertyNames(){return this.propertyNames}setPropertyNames(e){return this.propertyNames=e,this.propertyNames.type=new w(p.STRING),this}getMinProperties(){return this.minProperties}setMinProperties(e){return this.minProperties=e,this}getMaxProperties(){return this.maxProperties}setMaxProperties(e){return this.maxProperties=e,this}getPatternProperties(){return this.patternProperties}setPatternProperties(e){return this.patternProperties=e,this}getItems(){return this.items}setItems(e){return this.items=e,this}getContains(){return this.contains}setContains(e){return this.contains=e,this}getMinContains(){return this.minContains}setMinContains(e){return this.minContains=e,this}getMaxContains(){return this.maxContains}setMaxContains(e){return this.maxContains=e,this}getMinItems(){return this.minItems}setMinItems(e){return this.minItems=e,this}getMaxItems(){return this.maxItems}setMaxItems(e){return this.maxItems=e,this}getUniqueItems(){return this.uniqueItems}setUniqueItems(e){return this.uniqueItems=e,this}getPermission(){return this.permission}setPermission(e){return this.permission=e,this}getDetails(){return this.details}setDetails(e){return this.details=e,this}}var b={};E(b,"Parameter",()=>k);var G={};E(G,"SchemaReferenceException",()=>F);class F extends Error{constructor(e,t,r){super(e.trim()?e+"-"+t:t),this.schemaPath=e,this.cause=r}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}var B={};E(B,"ParameterType",()=>Y);var Y=((t={}).CONSTANT="CONSTANT",t.EXPRESSION="EXPRESSION",t);const H="value";class k{static{this.SCHEMA_NAME="Parameter"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(k.SCHEMA_NAME).setProperties(new Map([["schema",D.SCHEMA],["parameterName",D.ofString("parameterName")],["variableArgument",D.of("variableArgument",p.BOOLEAN).setDefaultValue(!1)],["type",D.ofString("type").setEnums(["EXPRESSION","CONSTANT"])]]))}static{this.EXPRESSION=new D().setNamespace(l.SYSTEM).setName("ParameterExpression").setType(d.of(p.OBJECT)).setProperties(new Map([["isExpression",D.ofBoolean("isExpression").setDefaultValue(!0)],[H,D.ofAny(H)]]))}constructor(e,t){if(this.variableArgument=!1,this.type=Y.EXPRESSION,e instanceof k)this.schema=new D(e.schema),this.parameterName=e.parameterName,this.variableArgument=e.variableArgument,this.type=e.type;else{if(!t)throw Error("Unknown constructor signature");this.schema=t,this.parameterName=e}}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getParameterName(){return this.parameterName}setParameterName(e){return this.parameterName=e,this}isVariableArgument(){return this.variableArgument}setVariableArgument(e){return this.variableArgument=e,this}getType(){return this.type}setType(e){return this.type=e,this}static ofEntry(e,t,r=!1,s=Y.EXPRESSION){return[e,new k(e,t).setType(s).setVariableArgument(r)]}static of(e,t,r=!1,s=Y.EXPRESSION){return new k(e,t).setType(s).setVariableArgument(r)}static from(e){let t=D.from(e.schema);if(!t)throw new F("","Parameter requires Schema");return new k(e.parameterName,t).setVariableArgument(!!e.variableArgument).setType(e.type??Y.EXPRESSION)}}var $={};E($,"MapUtil",()=>j),E($,"MapEntry",()=>W);class j{static of(e,t,r,s,n,a,i,o,E,u,A,T,l,m,h,g,c,p,N,f){let _=new Map;return R(e)||R(t)||_.set(e,t),R(r)||R(s)||_.set(r,s),R(n)||R(a)||_.set(n,a),R(i)||R(o)||_.set(i,o),R(E)||R(u)||_.set(E,u),R(A)||R(T)||_.set(A,T),R(l)||R(m)||_.set(l,m),R(h)||R(g)||_.set(h,g),R(c)||R(p)||_.set(c,p),R(N)||R(f)||_.set(N,f),_}static ofArrayEntries(...e){let t=new Map;for(let[r,s]of e)t.set(r,s);return t}static entry(e,t){return new W(e,t)}static ofEntries(...e){let t=new Map;for(let r of e)t.set(r.k,r.v);return t}static ofEntriesArray(...e){let t=new Map;for(let r=0;r<e.length;r++)t.set(e[r][0],e[r][1]);return t}constructor(){}}class W{constructor(e,t){this.k=e,this.v=t}}class X{constructor(){this.map=new Map([["any",D.ofAny("any").setNamespace(l.SYSTEM)],["boolean",D.ofBoolean("boolean").setNamespace(l.SYSTEM)],["double",D.ofDouble("double").setNamespace(l.SYSTEM)],["float",D.ofFloat("float").setNamespace(l.SYSTEM)],["integer",D.ofInteger("integer").setNamespace(l.SYSTEM)],["long",D.ofLong("long").setNamespace(l.SYSTEM)],["number",D.ofNumber("number").setNamespace(l.SYSTEM)],["string",D.ofString("string").setNamespace(l.SYSTEM)],["Timestamp",D.ofString("Timestamp").setNamespace(l.DATE)],["Timeunit",D.ofString("Timeunit").setNamespace(l.DATE).setEnums(["YEARS","QUARTERS","MONTHS","WEEKS","DAYS","HOURS","MINUTES","SECONDS","MILLISECONDS"])],["Duration",D.ofObject("Duration").setNamespace(l.DATE).setProperties(j.ofArrayEntries(["years",D.ofNumber("years")],["quarters",D.ofNumber("quarters")],["months",D.ofNumber("months")],["weeks",D.ofNumber("weeks")],["days",D.ofNumber("days")],["hours",D.ofNumber("hours")],["minutes",D.ofNumber("minutes")],["seconds",D.ofNumber("seconds")],["milliseconds",D.ofNumber("milliseconds")])).setAdditionalItems(C.from(!1))],["TimeObject",D.ofObject("TimeObject").setNamespace(l.DATE).setProperties(j.ofArrayEntries(["year",D.ofNumber("year")],["month",D.ofNumber("month")],["day",D.ofNumber("day")],["hour",D.ofNumber("hour")],["minute",D.ofNumber("minute")],["second",D.ofNumber("second")],["millisecond",D.ofNumber("millisecond")])).setAdditionalItems(C.from(!1))],[k.EXPRESSION.getName(),k.EXPRESSION],[D.NULL.getName(),D.NULL],[D.SCHEMA.getName(),D.SCHEMA]]),this.filterableNames=Array.from(this.map.values()).map(e=>e.getFullName())}async find(e,t){return l.SYSTEM!=e&&l.DATE!=e?Promise.resolve(void 0):Promise.resolve(this.map.get(t))}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var J={};function q(e){return[e.getSignature().getName(),e]}E(J,"KIRunFunctionRepository",()=>nD);var z={};E(z,"EventResult",()=>Z);var K={};E(K,"Event",()=>Q);class Q{static{this.OUTPUT="output"}static{this.ERROR="error"}static{this.ITERATION="iteration"}static{this.TRUE="true"}static{this.FALSE="false"}static{this.SCHEMA_NAME="Event"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(Q.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["name",D.ofString("name")],["parameters",D.ofObject("parameter").setAdditionalProperties(new C().setSchemaValue(D.SCHEMA))]]))}constructor(e,t){if(e instanceof Q)this.name=e.name,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new D(e[1])]));else{if(this.name=e,!t)throw Error("Unknown constructor format");this.parameters=t}}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}static outputEventMapEntry(e){return Q.eventMapEntry(Q.OUTPUT,e)}static eventMapEntry(e,t){return[e,new Q(e,t)]}static from(e){return new Q(e.name,new Map(Object.entries(e.parameters??{}).map(e=>{let t=D.from(e[1]);if(!t)throw new F("","Event expects a schema");return[e[0],t]})))}}class Z{constructor(e,t){this.name=e,this.result=t}getName(){return this.name}setName(e){return this.name=e,this}getResult(){return this.result}setResult(e){return this.result=e,this}static outputOf(e){return Z.of(Q.OUTPUT,e)}static of(e,t){return new Z(e,t)}}var ee={};E(ee,"FunctionOutput",()=>es);var et={};E(et,"KIRuntimeException",()=>er);class er extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class es{constructor(e){if(this.index=0,R(e))throw new er("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof Z?this.fo=e:(this.fo=[],Array.isArray(e)||(this.generator=e))}next(){if(!this.generator)return this.index<this.fo.length?this.fo[this.index++]:void 0;let e=this.generator.next();return e&&this.fo.push(e),e}allResults(){return this.fo}}var en={};E(en,"FunctionSignature",()=>ea);class ea{static{this.SCHEMA_NAME="FunctionSignature"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(ea.SCHEMA_NAME).setProperties(new Map([["name",D.ofString("name")],["namespace",D.ofString("namespace")],["parameters",D.ofObject("parameters").setAdditionalProperties(new C().setSchemaValue(k.SCHEMA))],["events",D.ofObject("events").setAdditionalProperties(new C().setSchemaValue(Q.SCHEMA))]]))}constructor(e){this.namespace="_",this.parameters=new Map,this.events=new Map,e instanceof ea?(this.name=e.name,this.namespace=e.namespace,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new k(e[1])])),this.events=new Map(Array.from(e.events.entries()).map(e=>[e[0],new Q(e[1])]))):this.name=e}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getFullName(){return this.namespace+"."+this.name}}var ei={};E(ei,"AbstractFunction",()=>e0);var eo={};E(eo,"SchemaValidator",()=>eZ);var eE={};E(eE,"deepEqual",()=>eh);var eu={};E(eu,"LinkedList",()=>el);var eA={};E(eA,"StringFormatter",()=>eT);class eT{static format(e,...t){if(!t||0==t.length)return e;let r="",s=0,n="",a=n,i=e.length;for(let o=0;o<i;o++)"$"==(n=e.charAt(o))&&"\\"==a?r=r.substring(0,o-1)+n:"$"==n&&s<t.length?r+=t[s++]:r+=n,a=n;return r.toString()}constructor(){}}class el{constructor(e){if(this.head=void 0,this.tail=void 0,this.length=0,e?.length){for(let t of e)if(this.head){let e=new em(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new em(t);this.length=e.length}}push(e){let t=new em(e,void 0,this.head);this.head?(this.head.previous=t,this.head=t):this.tail=this.head=t,this.length++}pop(){if(!this.head)throw Error("List is empty and cannot pop further.");let e=this.head.value;if(this.length--,this.head==this.tail)return this.head=this.tail=void 0,e;let t=this.head;return this.head=t.next,t.next=void 0,t.previous=void 0,this.head.previous=void 0,e}isEmpty(){return!this.length}size(){return this.length}get(e){if(e<0||e>=this.length)throw Error(`${e} is out of bounds [0,${this.length}]`);let t=this.head;for(;e>0;)t=this.head.next,--e;return t.value}set(e,t){if(e<0||e>=this.length)throw new er(eT.format("Index $ out of bound to set the value in linked list.",e));let r=this.head;for(;e>0;)r=this.head.next,--e;return r.value=t,this}toString(){let e=this.head,t="";for(;e;)t+=e.value,(e=e.next)&&(t+=", ");return`[${t}]`}toArray(){let e=[],t=this.head;for(;t;)e.push(t.value),t=t.next;return e}peek(){if(!this.head)throw Error("List is empty so cannot peak");return this.head.value}peekLast(){if(!this.tail)throw Error("List is empty so cannot peak");return this.tail.value}getFirst(){if(!this.head)throw Error("List is empty so cannot get first");return this.head.value}removeFirst(){return this.pop()}removeLast(){if(!this.tail)throw Error("List is empty so cannot remove");--this.length;let e=this.tail.value;if(0==this.length)this.head=this.tail=void 0;else{let e=this.tail.previous;e.next=void 0,this.tail.previous=void 0,this.tail=e}return e}addAll(e){return e&&e.length&&e.forEach(this.add.bind(this)),this}add(e){return++this.length,this.tail||this.head?this.head===this.tail?(this.tail=new em(e,this.head),this.head.next=this.tail):(this.tail=new em(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new em(e),this}map(e,t){let r=new el,s=this.head,n=0;for(;s;)r.add(e(s.value,n)),s=s.next,++n;return r}indexOf(e){let t=this.head,r=0;for(;t;){if(eh(t.value,e))return r;t=t.next,++r}return -1}forEach(e,t){let r=this.head,s=0;for(;r;)e(r.value,s),r=r.next,++s}}class em{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}function eh(e,t){let r=new el;r.push(e);let s=new el;for(s.push(t);!r.isEmpty()&&!s.isEmpty();){let e=r.pop(),t=s.pop();if(e===t)continue;let n=typeof e,a=typeof t;if("undefined"===n||"undefined"===a){if(!e&&!t)continue;return!1}if(n!==a)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!=t.length)return!1;for(let n=0;n<e.length;n++)r.push(e[n]),s.push(t[n]);continue}if("object"===n){if("object"!==a||null===e||null===t)return!1;let n=Object.entries(e),i=Object.entries(t);if(n.length!==i.length)return!1;for(let[e,a]of n)r.push(a),s.push(t[e]);continue}return!1}return!0}var eR={};E(eR,"StringUtil",()=>eg);class eg{constructor(){}static nthIndex(e,t,r=0,s){if(!e)throw new er("String cannot be null");if(r<0||r>=e.length)throw new er(eT.format("Cannot search from index : $",r));if(s<=0||s>e.length)throw new er(eT.format("Cannot search for occurance : $",s));for(;r<e.length;){if(e.charAt(r)==t&&0==--s)return r;++r}return -1}static splitAtFirstOccurance(e,t){if(!e)return[void 0,void 0];let r=e.indexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static splitAtLastOccurance(e,t){if(!e)return[void 0,void 0];let r=e.lastIndexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static isNullOrBlank(e){return!e||""==e.trim()}}var ec={};E(ec,"SchemaUtil",()=>eO);var ep={};E(ep,"Tuple2",()=>eN),E(ep,"Tuple3",()=>ef),E(ep,"Tuple4",()=>e_);class eN{constructor(e,t){this.f=e,this.s=t}getT1(){return this.f}getT2(){return this.s}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}}class ef extends eN{constructor(e,t,r){super(e,t),this.t=r}getT3(){return this.t}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}setT3(e){return this.t=e,this}}class e_ extends ef{constructor(e,t,r,s){super(e,t,r),this.fr=s}getT4(){return this.fr}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}setT3(e){return this.t=e,this}setT4(e){return this.fr=e,this}}var eM={};E(eM,"SchemaValidationException",()=>eS);class eS extends Error{constructor(e,t,r=[],s){super(t+(r?r.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.cause=s}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class eO{static{this.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH="Unable to retrive schema from referenced path"}static{this.CYCLIC_REFERENCE_LIMIT_COUNTER=20}static async getDefaultValue(e,t){if(e)return e.getConstant()?e.getConstant():R(e.getDefaultValue())?eO.getDefaultValue(await eO.getSchemaFromRef(e,t,e.getRef()),t):e.getDefaultValue()}static async hasDefaultValueOrNullSchemaType(e,t){return e?e.getConstant()||!R(e.getDefaultValue())?Promise.resolve(!0):R(e.getRef())?e.getType()?.getAllowedSchemaTypes().has(p.NULL)?Promise.resolve(!0):Promise.resolve(!1):this.hasDefaultValueOrNullSchemaType(await eO.getSchemaFromRef(e,t,e.getRef()),t):Promise.resolve(!1)}static async getSchemaFromRef(e,t,r,s=0){if(++s==eO.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new eS(r??"","Schema has a cyclic reference");if(!e||!r||eg.isNullOrBlank(r))return Promise.resolve(void 0);if(!r.startsWith("#")){var n=await eO.resolveExternalSchema(e,t,r);n&&(e=n.getT1(),r=n.getT2())}let a=r.split("/");return 1===a.length?Promise.resolve(e):Promise.resolve(eO.resolveInternalSchema(e,t,r,s,a,1))}static async resolveInternalSchema(e,t,r,s,n,a){let i=e;if(a!==n.length){for(;a<n.length;){if("$defs"===n[a]){if(++a>=n.length||!i.get$defs())throw new F(r,eO.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);i=i.get$defs()?.get(n[a])}else{if(i&&(!i.getType()?.contains(p.OBJECT)||!i.getProperties()))throw new F(r,"Cannot retrievie schema from non Object type schemas");i=i.getProperties()?.get(n[a])}if(a++,!i||!eg.isNullOrBlank(i.getRef())&&!(i=await eO.getSchemaFromRef(i,t,i.getRef(),s)))throw new F(r,eO.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return Promise.resolve(i)}}static async resolveExternalSchema(e,t,r){if(!t)return Promise.resolve(void 0);let s=eg.splitAtFirstOccurance(r??"","/");if(!s[0])return Promise.resolve(void 0);let n=eg.splitAtLastOccurance(s[0],".");if(!n[0]||!n[1])return Promise.resolve(void 0);let a=await t.find(n[0],n[1]);if(!a)return Promise.resolve(void 0);if(!s[1]||""===s[1])return Promise.resolve(new eN(a,r));if(r="#/"+s[1],!a)throw new F(r,eO.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return Promise.resolve(new eN(a,r))}constructor(){}}var ew={};E(ew,"AnyOfAllOfOneOfValidator",()=>ed);class ed{static async validate(e,t,r,s,n,a){let i=[];return t.getOneOf()&&!t.getOneOf()?await ed.oneOf(e,t,r,s,i,n,a):t.getAllOf()&&!t.getAllOf()?await ed.allOf(e,t,r,s,i,n,a):t.getAnyOf()&&!t.getAnyOf()?await ed.anyOf(e,t,r,s,i,n,a):s}static async anyOf(e,t,r,s,n,a,i){let o=!1;for(let E of t.getAnyOf()??[])try{await ed.validate(e,E,r,s,a,i),o=!0;break}catch(e){o=!1,n.push(e)}if(o)return s;throw new eS(eZ.path(e),"The value don't satisfy any of the schemas.",n)}static async allOf(e,t,r,s,n,a,i){let o=0;for(let E of t.getAllOf()??[])try{await ed.validate(e,E,r,s,a,i),o++}catch(e){n.push(e)}if(o===t.getAllOf()?.length)return s;throw new eS(eZ.path(e),"The value doesn't satisfy some of the schemas.",n)}static async oneOf(e,t,r,s,n,a,i){let o=0;for(let E of t.getOneOf()??[])try{await ed.validate(e,E,r,s,a,i),o++}catch(e){n.push(e)}if(1===o)return s;throw new eS(eZ.path(e),0==o?"The value does not satisfy any schema":"The value satisfy more than one schema",n)}constructor(){}}var eP={};E(eP,"TypeValidator",()=>eQ);var eI={};E(eI,"ArrayValidator",()=>ey);class ey{static async validate(e,t,r,s,n,a){if(R(s))throw new eS(eZ.path(e),"Expected an array but found null");if(!Array.isArray(s))throw new eS(eZ.path(e),s.toString()+" is not an Array");return ey.checkMinMaxItems(e,t,s),await ey.checkItems(e,t,r,s,n,a),ey.checkUniqueItems(e,t,s),await ey.checkContains(t,e,r,s),s}static async checkContains(e,t,r,s){if(R(e.getContains()))return;let n=await ey.countContains(t,e,r,s,R(e.getMinContains())&&R(e.getMaxContains()));if(0===n)throw new eS(eZ.path(t),"None of the items are of type contains schema");if(!R(e.getMinContains())&&e.getMinContains()>n)throw new eS(eZ.path(t),"The minimum number of the items of type contains schema should be "+e.getMinContains()+" but found "+n);if(!R(e.getMaxContains())&&e.getMaxContains()<n)throw new eS(eZ.path(t),"The maximum number of the items of type contains schema should be "+e.getMaxContains()+" but found "+n)}static async countContains(e,t,r,s,n){let a=0;for(let i=0;i<s.length;i++){let o=e?[...e]:[];try{if(await eZ.validate(o,t.getContains(),r,s[i]),a++,n)break}catch(e){}}return a}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()&&new Set(r).size!==r.length)throw new eS(eZ.path(e),"Items on the array are not unique")}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new eS(eZ.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new eS(eZ.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static async checkItems(e,t,r,s,n,a){if(!t.getItems())return;let i=t.getItems();if(i.getSingleSchema())for(let t=0;t<s.length;t++){let o=e?[...e]:[];s[t]=await eZ.validate(o,i.getSingleSchema(),r,s[t],n,a)}if(i.getTupleSchema()){if(i.getTupleSchema().length!==s.length&&R(t?.getAdditionalItems()))throw new eS(eZ.path(e),"Expected an array with only "+i.getTupleSchema().length+" but found "+s.length);await this.checkItemsInTupleSchema(e,r,s,i),await this.checkAdditionalItems(e,t,r,s,i)}}static async checkItemsInTupleSchema(e,t,r,s,n,a){for(let i=0;i<s.getTupleSchema()?.length;i++){let o=e?[...e]:[];r[i]=await eZ.validate(o,s.getTupleSchema()[i],t,r[i],n,a)}}static async checkAdditionalItems(e,t,r,s,n){if(!R(t.getAdditionalItems())){let a=t.getAdditionalItems();if(a?.getBooleanValue()){let i=D.ofAny("item");if(a?.getBooleanValue()===!1&&s.length>n.getTupleSchema()?.length)throw new eS(eZ.path(e),"No Additional Items are defined");await this.checkEachItemInAdditionalItems(e,t,r,s,n,i)}else if(a?.getSchemaValue()){let i=a.getSchemaValue();await this.checkEachItemInAdditionalItems(e,t,r,s,n,i)}}}static async checkEachItemInAdditionalItems(e,t,r,s,n,a){for(let t=n.getTupleSchema()?.length;t<s.length;t++){let n=e?[...e]:[];s[t]=await eZ.validate(n,a,r,s[t])}}constructor(){}}var ex={};E(ex,"BooleanValidator",()=>eL);class eL{static validate(e,t,r){if(R(r))throw new eS(eZ.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new eS(eZ.path(e),r.toString()+" is not a boolean");return r}constructor(){}}var ev={};E(ev,"NullValidator",()=>eU);class eU{static validate(e,t,r){if(R(r))return r;throw new eS(eZ.path(e),"Expected a null but found "+r)}constructor(){}}var eV={};E(eV,"NumberValidator",()=>eC);class eC{static validate(e,t,r,s){if(R(s))throw new eS(eZ.path(t),"Expected a number but found null");if("number"!=typeof s)throw new eS(eZ.path(t),s.toString()+" is not a "+e);let n=eC.extractNumber(e,t,r,s);return eC.checkRange(t,r,s,n),eC.checkMultipleOf(t,r,s,n),s}static extractNumber(e,t,r,s){let n=s;try{(e==p.LONG||e==p.INTEGER)&&(n=Math.round(n))}catch(r){throw new eS(eZ.path(t),s+" is not a number of type "+e,r)}if(R(n)||(e==p.LONG||e==p.INTEGER)&&n!=s)throw new eS(eZ.path(t),s.toString()+" is not a number of type "+e);return n}static checkMultipleOf(e,t,r,s){if(t.getMultipleOf()&&s%t.getMultipleOf()!=0)throw new eS(eZ.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}static checkRange(e,t,r,s){if(!R(t.getMinimum())&&0>eC.numberCompare(s,t.getMinimum()))throw new eS(eZ.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(!R(t.getMaximum())&&eC.numberCompare(s,t.getMaximum())>0)throw new eS(eZ.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(!R(t.getExclusiveMinimum())&&0>=eC.numberCompare(s,t.getExclusiveMinimum()))throw new eS(eZ.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(!R(t.getExclusiveMaximum())&&eC.numberCompare(s,t.getExclusiveMaximum())>0)throw new eS(eZ.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}var eD={};E(eD,"ObjectValidator",()=>eb);class eb{static async validate(e,t,r,s,n,a){if(R(s))throw new eS(eZ.path(e),"Expected an object but found null");if("object"!=typeof s||Array.isArray(s))throw new eS(eZ.path(e),s.toString()+" is not an Object");let i=new Set(Object.keys(s));return eb.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&await eb.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&eb.checkRequired(e,t,s),t.getProperties()&&await eb.checkProperties(e,t,r,s,i,n,a),t.getPatternProperties()&&await eb.checkPatternProperties(e,t,r,s,i),t.getAdditionalProperties()&&await eb.checkAdditionalProperties(e,t,r,s,i),s}static async checkPropertyNameSchema(e,t,r,s){for(let n of Array.from(s.values()))try{await eZ.validate(e,t.getPropertyNames(),r,n)}catch(t){throw new eS(eZ.path(e),"Property name '"+n+"' does not fit the property schema")}}static checkRequired(e,t,r){for(let s of t.getRequired()??[])if(R(r[s]))throw new eS(eZ.path(e),s+" is mandatory")}static async checkAdditionalProperties(e,t,r,s,n){let a=t.getAdditionalProperties();if(a.getSchemaValue())for(let t of Array.from(n.values())){let n=e?[...e]:[];s[t]=await eZ.validate(n,a.getSchemaValue(),r,s[t])}else if(!1===a.getBooleanValue()&&n.size)throw new eS(eZ.path(e),Array.from(n)+" is/are additional properties which are not allowed.")}static async checkPatternProperties(e,t,r,s,n){let a=new Map;for(let e of Array.from(t.getPatternProperties().keys()))a.set(e,new RegExp(e));for(let i of Array.from(n.values())){let o=e?[...e]:[];for(let e of Array.from(a.entries()))if(e[1].test(i)){s[i]=await eZ.validate(o,t.getPatternProperties().get(e[0]),r,s[i]),n.delete(i);break}}}static async checkProperties(e,t,r,s,n,a,i){for(let o of Array.from(t.getProperties())){let t=s[o[0]];if(!s.hasOwnProperty(o[0])&&R(t)&&R(await eO.getDefaultValue(o[1],r)))continue;let E=e?[...e]:[];s[o[0]]=await eZ.validate(E,o[1],r,t,a,i),n.delete(o[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new eS(eZ.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new eS(eZ.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}var eG={};E(eG,"StringValidator",()=>eY);var eF={};E(eF,"StringFormat",()=>eB);var eB=((r={}).DATETIME="DATETIME",r.TIME="TIME",r.DATE="DATE",r.EMAIL="EMAIL",r.REGEX="REGEX",r);class eY{static{this.TIME=/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/}static{this.DATE=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])$/}static{this.DATETIME=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])T([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/}static{this.EMAIL=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/}static validate(e,t,r){if(R(r))throw new eS(eZ.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new eS(eZ.path(e),r.toString()+" is not String");t.getFormat()==eB.TIME?eY.patternMatcher(e,t,r,eY.TIME,"time pattern"):t.getFormat()==eB.DATE?eY.patternMatcher(e,t,r,eY.DATE,"date pattern"):t.getFormat()==eB.DATETIME?eY.patternMatcher(e,t,r,eY.DATETIME,"date time pattern"):t.getFormat()==eB.EMAIL?eY.patternMatcher(e,t,r,eY.EMAIL,"email pattern"):t.getPattern()&&eY.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let s=r.length;if(t.getMinLength()&&s<t.getMinLength())throw new eS(eZ.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&s>t.getMaxLength())throw new eS(eZ.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,s,n){if(!s.test(r))throw new eS(eZ.path(e),r.toString()+" is not matched with the "+n)}constructor(){}}var eH=((s={}).STRICT="STRICT",s.LENIENT="LENIENT",s.USE_DEFAULT="USE_DEFAULT",s.SKIP="SKIP",s);const ek=e=>eH[e.toUpperCase()],e$=()=>Object.values(eH);class ej extends Error{constructor(e,t,r,s,n=[],a){super(r+(n?n.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.source=t??null,this.mode=s??null,this.cause=a}getSchemaPath(){return this.schemaPath}getSource(){return this.source??null}getMode(){return this.mode??null}getCause(){return this.cause}}class eW{static handleUnConvertibleValue(e,t,r,s){return this.handleUnConvertibleValueWithDefault(e,t,r,null,s)}static handleUnConvertibleValueWithDefault(e,t,r,s,n){switch(null===t&&(t=eH.STRICT),t){case eH.STRICT:throw new ej(eZ.path(e),r,n,t);case eH.LENIENT:return null;case eH.USE_DEFAULT:return s;case eH.SKIP:return r;default:throw new ej(eZ.path(e),r,"Invalid conversion mode")}}constructor(){}}class eX{static convert(e,t,r,s){if(R(s))return eW.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Expected a string but found null");let n=s??("object"==typeof s?JSON.stringify(s):String(s));return this.getConvertedString(n,r)}static getConvertedString(e,t){return t===eH.STRICT?e.toString():e.trim()}static getDefault(e){return e.getDefaultValue()??null}constructor(){}}class eJ{static convert(e,t,r,s,n){if(R(n))return eW.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),"Expected a number but found null");if("object"==typeof n||"boolean"==typeof n||Array.isArray(n)||"string"==typeof n&&isNaN(n=Number(n)))return eW.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),n+" is not a "+t);let a=this.extractNumber(t,n,s);return null===a?eW.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),n+" is not a "+t):a}static extractNumber(e,t,r){if("number"!=typeof t)return null;switch(e){case p.INTEGER:return this.isInteger(t,r)?Math.floor(t):null;case p.LONG:return this.isLong(t,r)?Math.floor(t):null;case p.DOUBLE:return t;case p.FLOAT:return this.isFloat(t,r)?t:null;default:return null}}static isInteger(e,t){return t!==eH.STRICT?"number"==typeof e:Number.isInteger(e)}static isLong(e,t){return t!==eH.STRICT?"number"==typeof e:Number.isInteger(e)&&e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER}static isFloat(e,t){return t!==eH.STRICT?"number"==typeof e:e>=-Number.MAX_VALUE&&e<=Number.MAX_VALUE}static getDefault(e){return"number"==typeof e.getDefaultValue()?Number(e.getDefaultValue):null}}class eq{static{this.BOOLEAN_MAP={true:!0,t:!0,yes:!0,y:!0,1:!0,false:!1,f:!1,no:!1,n:!1,0:!1}}static convert(e,t,r,s){return null==s?eW.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Expected a boolean but found null"):this.getBooleanPrimitive(s)??eW.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Unable to convert to boolean")}static getBooleanPrimitive(e){return"boolean"==typeof e?e:"string"==typeof e?this.handleStringValue(e):"number"==typeof e?this.handleNumberValue(e):null}static handleStringValue(e){let t=e.toLowerCase().trim();return eq.BOOLEAN_MAP[t]??null}static handleNumberValue(e){return 0===e||1===e?1===e:null}static getDefault(e){return e.getDefaultValue()??!1}constructor(){}}class ez{static convert(e,t,r,s){return R(s)?s:"string"==typeof s&&"null"===s.toLowerCase()?null:eW.handleUnConvertibleValueWithDefault(e,r,s,null,"Unable to convert to null")}constructor(){}}class eK{static handleValidationError(e,t,r,s,n){switch(t=t??eH.STRICT){case eH.STRICT:throw new eS(eZ.path(e),n);case eH.LENIENT:return null;case eH.USE_DEFAULT:return s;case eH.SKIP:return r}}constructor(){}}class eQ{static async validate(e,t,r,s,n,a,i){return t==p.OBJECT?await eb.validate(e,r,s,n,a,i):t==p.ARRAY?await ey.validate(e,r,s,n,a,i):this.handleTypeValidationAndConversion(e,t,r,n,a,i)}static async handleTypeValidationAndConversion(e,t,r,s,n,a){let i=n?this.convertElement(e,t,r,s,a??eH.STRICT):s;return await this.validateElement(e,t,r,i,a??eH.STRICT)}static convertElement(e,t,r,s,n){if(R(t))return eW.handleUnConvertibleValueWithDefault(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type for conversion.",t));switch(t){case p.STRING:return eX.convert(e,r,n,s);case p.INTEGER:case p.LONG:case p.DOUBLE:case p.FLOAT:return eJ.convert(e,t,r,n,s);case p.BOOLEAN:return eq.convert(e,r,n,s);case p.NULL:return ez.convert(e,r,n,s);default:return eW.handleUnConvertibleValueWithDefault(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type for conversion.",t))}}static validateElement(e,t,r,s,n){if(R(t))return eK.handleValidationError(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type.",t));switch(t){case p.STRING:return eY.validate(e,r,s);case p.INTEGER:case p.LONG:case p.DOUBLE:case p.FLOAT:return eC.validate(t,e,r,s);case p.BOOLEAN:return eL.validate(e,r,s);case p.NULL:return eU.validate(e,r,s);default:return eK.handleValidationError(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type.",t))}}constructor(){}}class eZ{static{this.ORDER={[p.OBJECT]:0,[p.ARRAY]:1,[p.DOUBLE]:2,[p.FLOAT]:3,[p.LONG]:4,[p.INTEGER]:5,[p.STRING]:6,[p.BOOLEAN]:7,[p.NULL]:8}}static path(e){return e?e.map(e=>e.getTitle()??"").filter(e=>!!e).reduce((e,t,r)=>e+(0===r?"":".")+t,""):""}static async validate(e,t,r,s,n,a){if(!t)throw new eS(eZ.path(e),"No schema found to validate");if(e||(e=[]),e.push(t),R(s)&&!R(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(!R(t.getConstant()))return eZ.constantValidation(e,t,s);if(t.getEnums()?.length)return eZ.enumCheck(e,t,s);if(t.getFormat()&&R(t.getType()))throw new eS(this.path(e),"Type is missing in schema for declared "+t.getFormat()?.toString()+" format.");if(!0===n&&R(t.getType()))throw new eS(this.path(e),"Type is missing in schema for declared "+a);if(t.getType()&&(s=await eZ.typeValidation(e,t,r,s,n,a)),!eg.isNullOrBlank(t.getRef()))return await eZ.validate(e,await eO.getSchemaFromRef(e[0],r,t.getRef()),r,s,n,a);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&(s=await ed.validate(e,t,r,s,n,a)),t.getNot()){let i;try{await eZ.validate(e,t.getNot(),r,s,n,a),i=!0}catch(e){i=!1}if(i)throw new eS(eZ.path(e),"Schema validated value in not condition.")}return s}static constantValidation(e,t,r){if(!eh(t.getConstant(),r))throw new eS(eZ.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let s=!1;for(let e of t.getEnums()??[])if(e===r){s=!0;break}if(s)return r;throw new eS(eZ.path(e),"Value is not one of "+t.getEnums())}static async typeValidation(e,t,r,s,n,a){let i=Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]).sort((e,t)=>(this.ORDER[e]??1/0)-(this.ORDER[t]??1/0)),o=[];for(let E of i)try{return await eQ.validate(e,E,t,r,s,n,a)}catch(e){o.push(e)}throw new eS(eZ.path(e),"Value "+JSON.stringify(s)+" is not of valid type(s)",o)}constructor(){}}class e0{async validateArguments(e,t,r){let s=new Map;for(let n of Array.from(this.getSignature().getParameters().entries())){let a=n[1];try{let r=await this.validateArgument(e,t,n,a);s.set(r.getT1(),r.getT2())}catch(t){let e=this.getSignature();throw new er(`Error while executing the function ${e.getNamespace()}.${e.getName()}'s parameter ${a.getParameterName()} with step name '${r?.getStatement().getStatementName()??"Unknown Step"}' with error : ${t?.message}`)}}return s}async validateArgument(e,t,r,s){let n,a=r[0],i=e.get(r[0]);if(R(i)&&!s.isVariableArgument())return new eN(a,await eZ.validate(void 0,s.getSchema(),t,void 0));if(!s?.isVariableArgument())return new eN(a,await eZ.validate(void 0,s.getSchema(),t,i));Array.isArray(i)?n=i:(n=[],R(i)?R(s.getSchema().getDefaultValue())||n.push(s.getSchema().getDefaultValue()):n.push(i));for(let e=0;e<n.length;e++)n[e]=await eZ.validate(void 0,s.getSchema(),t,n[e]);return new eN(a,n)}async execute(e){let t=await this.validateArguments(e.getArguments()??new Map,e.getSchemaRepository(),e.getStatementExecution());e.setArguments(t);try{return await this.internalExecute(e)}catch(r){let t=this.getSignature();throw new er(`Error while executing the function ${t.getNamespace()}.${t.getName()} with step name '${e.getStatementExecution()?.getStatement().getStatementName()??"Unknown Step"}' with error : ${r?.message}`)}}getProbableEventSignature(e){return this.getSignature().getEvents()}}class e1 extends e0{static{this.EVENT_INDEX_NAME="index"}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_INDEX=new Q(Q.OUTPUT,j.of(e1.EVENT_INDEX_NAME,D.ofInteger(e1.EVENT_INDEX_NAME)))}static{this.EVENT_RESULT_INTEGER=new Q(Q.OUTPUT,j.of(e1.EVENT_RESULT_NAME,D.ofInteger(e1.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_BOOLEAN=new Q(Q.OUTPUT,j.of(e1.EVENT_RESULT_NAME,D.ofBoolean(e1.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_ARRAY=new Q(Q.OUTPUT,j.of(e1.EVENT_RESULT_NAME,D.ofArray(e1.EVENT_RESULT_NAME,D.ofAny(e1.EVENT_RESULT_NAME))))}static{this.EVENT_RESULT_EMPTY=new Q(Q.OUTPUT,j.of())}static{this.EVENT_RESULT_ANY=new Q(Q.OUTPUT,j.of(this.EVENT_RESULT_NAME,D.ofAny(this.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_OBJECT=new Q(Q.OUTPUT,j.of(this.EVENT_RESULT_NAME,D.ofObject(this.EVENT_RESULT_NAME)))}static{this.PARAMETER_INT_LENGTH=k.of("length",D.ofInteger("length").setDefaultValue(-1))}static{this.PARAMETER_ARRAY_FIND=k.of("find",D.ofArray("eachFind",D.ofAny("eachFind")))}static{this.PARAMETER_INT_SOURCE_FROM=k.of("srcFrom",D.ofInteger("srcFrom").setDefaultValue(0).setMinimum(0))}static{this.PARAMETER_INT_SECOND_SOURCE_FROM=k.of("secondSrcFrom",D.ofInteger("secondSrcFrom").setDefaultValue(0))}static{this.PARAMETER_INT_FIND_FROM=k.of("findFrom",D.ofInteger("findFrom").setDefaultValue(0))}static{this.PARAMETER_INT_OFFSET=k.of("offset",D.ofInteger("offset").setDefaultValue(0))}static{this.PARAMETER_ROTATE_LENGTH=k.of("rotateLength",D.ofInteger("rotateLength").setDefaultValue(1).setMinimum(1))}static{this.PARAMETER_BOOLEAN_ASCENDING=k.of("ascending",D.ofBoolean("ascending").setDefaultValue(!0))}static{this.PARAMETER_KEY_PATH=k.of("keyPath",D.ofString("keyPath").setDefaultValue(""))}static{this.PARAMETER_FIND_PRIMITIVE=k.of("findPrimitive",D.of("findPrimitive",p.STRING,p.DOUBLE,p.FLOAT,p.INTEGER,p.LONG))}static{this.PARAMETER_ARRAY_SOURCE=k.of("source",D.ofArray("eachSource",D.ofAny("eachSource")))}static{this.PARAMETER_ARRAY_SECOND_SOURCE=k.of("secondSource",D.ofArray("eachSecondSource",D.ofAny("eachSecondSource")))}static{this.PARAMETER_ARRAY_SOURCE_PRIMITIVE=k.of("source",D.ofArray("eachSource",new D().setName("eachSource").setType(d.of(p.STRING,p.NULL,p.INTEGER,p.FLOAT,p.DOUBLE,p.LONG))))}static{this.PARAMETER_BOOLEAN_DEEP_COPY=k.of("deepCopy",D.ofBoolean("deepCopy").setDefaultValue(!0))}static{this.PARAMETER_ANY=k.of("element",D.ofAny("element"))}static{this.PARAMETER_ANY_ELEMENT_OBJECT=k.of("elementObject",D.ofAny("elementObject"))}static{this.PARAMETER_ANY_VAR_ARGS=k.of("element",D.ofAny("element")).setVariableArgument(!0)}static{this.PARAMETER_ARRAY_RESULT=k.of(e1.EVENT_RESULT_NAME,D.ofArray("eachResult",D.ofAny("eachResult")))}constructor(e,t,r){super();let s=new Map;for(let e of t)s.set(e.getParameterName(),e);this.signature=new ea(e).setNamespace(l.SYSTEM_ARRAY).setParameters(s).setEvents(j.of(r.getName(),r))}getSignature(){return this.signature}}class e2 extends e1{constructor(){super("Concatenate",[e1.PARAMETER_ARRAY_SOURCE,e1.PARAMETER_ARRAY_SECOND_SOURCE],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName());return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,[...t,...r]]]))])}}class e9 extends e1{constructor(){super("AddFirst",[e1.PARAMETER_ARRAY_SOURCE,e1.PARAMETER_ANY],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e1.PARAMETER_ANY.getParameterName());if(0==(t=[...t]).length)return t.push(r),new es([Z.outputOf(new Map([]))]);t.push(r);let s=t.length-1;for(;s>0;){let e=t[s-1];t[s-1]=t[s],t[s--]=e}return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}const e3="keyName";class e4 extends e1{constructor(){super("ArrayToArrayOfObjects",[e1.PARAMETER_ARRAY_SOURCE,k.of(e3,D.ofString(e3),!0)],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e3);if(!t?.length)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,[]]]))]);let s=t.map(e=>{let t={};if(Array.isArray(e)){if(r.length)r.forEach((r,s)=>{t[r]=e[s]});else for(let r=0;r<e.length;r++)t[`value${r+1}`]=e[r]}else t[r.length?r[0]:"value"]=e;return t});return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,s]]))])}}var e5={};E(e5,"PrimitiveUtil",()=>e8);var e6={};E(e6,"ExecutionException",()=>e7);class e7 extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class e8{static findPrimitiveNullAsBoolean(e){if(R(e))return new eN(p.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new e7(eT.format("$ is not a primitive type",e));return"boolean"===t?new eN(p.BOOLEAN,e):"string"===t?new eN(p.STRING,e):e8.findPrimitiveNumberType(e)}static findPrimitive(e){if(R(e))return new eN(p.NULL,void 0);let t=typeof e;if("object"===t)throw new e7(eT.format("$ is not a primitive type",e));return"boolean"===t?new eN(p.BOOLEAN,e):"string"===t?new eN(p.STRING,e):e8.findPrimitiveNumberType(e)}static findPrimitiveNumberType(e){if(R(e)||Array.isArray(e)||"object"==typeof e)throw new e7(eT.format("Unable to convert $ to a number.",e));try{if(Number.isInteger(e))return new eN(p.LONG,e);return new eN(p.DOUBLE,e)}catch(t){throw new e7(eT.format("Unable to convert $ to a number.",e),t)}}static compare(e,t){if(e==t)return 0;if(R(e)||R(t))return R(e)?-1:1;if(Array.isArray(e)||Array.isArray(t)){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!=t.length)return e.length-t.length;for(let r=0;r<e.length;r++){let s=this.compare(e[r],t[r]);if(0!=s)return s}return 0}return Array.isArray(e)?-1:1}let r=typeof e,s=typeof t;return"object"===r||"object"===s?("object"===r&&"object"===s&&Object.keys(e).forEach(r=>{let s=this.compare(e[r],t[r]);if(0!=s)return s}),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return R(e)||R(t)?R(e)&&R(t)?0:R(e)?-1:1:e==t?0:"boolean"==typeof e||"boolean"==typeof t?e?-1:1:"string"==typeof e||"string"==typeof t?e+""<t+""?-1:1:"number"==typeof e||"number"==typeof t?e-t:0}static baseNumberType(e){return Number.isInteger(e)?p.LONG:p.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class te extends e1{constructor(){super("BinarySearch",[te.PARAMETER_ARRAY_SOURCE_PRIMITIVE,te.PARAMETER_INT_SOURCE_FROM,te.PARAMETER_FIND_PRIMITIVE,te.PARAMETER_INT_LENGTH],te.EVENT_INDEX)}async internalExecute(e){let t=e?.getArguments()?.get(te.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(te.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(te.PARAMETER_FIND_PRIMITIVE.getParameterName()),n=e?.getArguments()?.get(te.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length||r<0||r>t.length)throw new er("Search source array cannot be empty");if(-1==n&&(n=t.length-r),(n=r+n)>t.length)throw new er("End point for array cannot be more than the size of the source array");let a=-1;for(;r<=n;){let e=Math.floor((r+n)/2);if(0==e8.compare(t[e],s)){a=e;break}e8.compare(t[e],s)>0?n=e-1:r=e+1}return new es([Z.outputOf(new Map([[te.EVENT_INDEX_NAME,a]]))])}}var tt={};E(tt,"ArrayUtil",()=>tr);class tr{static removeAListFrom(e,t){if(!t||!e||!e.length||!t.length)return;let r=new Set(t);for(let t=0;t<e.length;t++)r.has(e[t])&&(e.splice(t,1),t--)}static of(...e){let t=Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r];return t}constructor(){}}class ts extends e1{constructor(){super("Compare",tr.of(ts.PARAMETER_ARRAY_SOURCE,ts.PARAMETER_INT_SOURCE_FROM,ts.PARAMETER_ARRAY_FIND,ts.PARAMETER_INT_FIND_FROM,ts.PARAMETER_INT_LENGTH),ts.EVENT_RESULT_INTEGER)}async internalExecute(e){var t=e?.getArguments()?.get(ts.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ts.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(ts.PARAMETER_ARRAY_FIND.getParameterName()),n=e?.getArguments()?.get(ts.PARAMETER_INT_FIND_FROM.getParameterName()),a=e?.getArguments()?.get(ts.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new er("Compare source array cannot be empty");if(0==s.length)throw new er("Compare find array cannot be empty");if(-1==a&&(a=t.length-r),r+a>t.length)throw new er(eT.format("Source array size $ is less than comparing size $",t.length,r+a));if(n+a>s.length)throw new er(eT.format("Find array size $ is less than comparing size $",s.length,n+a));return new es(tr.of(Z.outputOf(j.of(ts.EVENT_RESULT_NAME,this.compare(t,r,r+a,s,n,n+a)))))}compare(e,t,r,s,n,a){if(r<t){let e=t;t=r,r=e}if(a<n){let e=n;n=a,a=e}if(r-t!=a-n)throw new er(eT.format("Cannot compare uneven arrays from $ to $ in source array with $ to $ in find array",r,t,a,n));for(let a=t,i=n;a<r;a++,i++){let t=1;if(R(e[a])||R(s[i])){let r=R(e[a]);r==R(s[i])?t=0:r&&(t=-1)}else{let r=typeof e[a],n=typeof s[i];if("object"===r||"object"===n)t=1;else if("string"===r||"string"===n){let r=""+e[a],n=""+s[i];r===n?t=0:r<n&&(t=-1)}else"boolean"===r||"boolean"===n?t=r==n?0:1:"number"===r&&"number"===n&&(t=e[a]-s[i])}if(0!=t)return t}return 0}}var tn={};function ta(e){return e?"function"==typeof globalThis.structuredClone?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e)):e}E(tn,"duplicate",()=>ta);class ti extends e1{constructor(){super("Copy",[ti.PARAMETER_ARRAY_SOURCE,ti.PARAMETER_INT_SOURCE_FROM,ti.PARAMETER_INT_LENGTH,ti.PARAMETER_BOOLEAN_DEEP_COPY],ti.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(ti.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ti.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(ti.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),r+s>t.length)throw new er(eT.format("Array has no elements from $ to $ as the array size is $",r,r+s,t.length));var n=e?.getArguments()?.get(ti.PARAMETER_BOOLEAN_DEEP_COPY.getParameterName());let a=Array(s);for(let e=r;e<r+s;e++)R(t[e])||(a[e-r]=n?ta(t[e]):t[e]);return new es([Z.outputOf(j.of(ti.EVENT_RESULT_NAME,a))])}}class to extends e1{constructor(){super("Delete",[e1.PARAMETER_ARRAY_SOURCE,e1.PARAMETER_ANY_VAR_ARGS],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(to.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(to.PARAMETER_ANY_VAR_ARGS.getParameterName());if(null==r)throw new er("The deletable var args are empty. So cannot be proceeded further.");if(0==t.length||0==r.length)throw new er("Expected a source or deletable for an array but not found any");let s=new Set;for(let e=t.length-1;e>=0;e--)for(let n=0;n<r.length;n++)s.has(e)||0!=e8.compare(t[e],r[n])||s.add(t[e]);return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t.filter(e=>!s.has(e))]]))])}}class tE extends e1{constructor(){super("DeleteFirst",[tE.PARAMETER_ARRAY_SOURCE],tE.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tE.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new er("Given source array is empty");return(t=[...t]).shift(),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tu extends e1{constructor(){super("DeleteFrom",[tu.PARAMETER_ARRAY_SOURCE,tu.PARAMETER_INT_SOURCE_FROM,tu.PARAMETER_INT_LENGTH],tu.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tu.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tu.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tu.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new er("There are no elements to be deleted");if(r>=(t=[...t]).length||r<0)throw new er("The int source for the array should be in between 0 and length of the array ");if(-1==s&&(s=t.length-r),r+s>t.length)throw new er("Requested length to be deleted is more than the size of array ");return t.splice(r,s),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tA extends e1{constructor(){super("DeleteLast",[tA.PARAMETER_ARRAY_SOURCE],tA.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tA.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new er("Given source array is empty");return(t=[...t]).pop(),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tT extends e1{constructor(){super("Disjoint",[tT.PARAMETER_ARRAY_SOURCE,tT.PARAMETER_INT_SOURCE_FROM,tT.PARAMETER_ARRAY_SECOND_SOURCE,tT.PARAMETER_INT_SECOND_SOURCE_FROM,tT.PARAMETER_INT_LENGTH],tT.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tT.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tT.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tT.PARAMETER_INT_LENGTH.getParameterName());if(-1==a&&(a=t.length<=s.length?t.length-r:s.length-n),a>t.length||a>s.length||r+a>t.length||n+a>s.length)throw new er("The length which was being requested is more than than the size either source array or second source array");let i=new Set,o=new Set;for(let e=0;e<a;e++)i.add(t[e+r]);for(let e=0;e<a;e++)o.add(s[e+n]);let E=new Set;return i.forEach(e=>{o.has(e)?o.delete(e):E.add(e)}),o.forEach(e=>{i.has(e)||E.add(e)}),new es([Z.outputOf(new Map([[tT.EVENT_RESULT_NAME,[...E]]]))])}}class tl extends e1{constructor(){super("Equals",[tl.PARAMETER_ARRAY_SOURCE,tl.PARAMETER_INT_SOURCE_FROM,tl.PARAMETER_ARRAY_FIND,tl.PARAMETER_INT_FIND_FROM,tl.PARAMETER_INT_LENGTH],tl.EVENT_RESULT_BOOLEAN)}async internalExecute(e){let t=new ts,r=(await t.execute(e)).allResults()[0].getResult().get(tl.EVENT_RESULT_NAME);return new es([Z.outputOf(j.of(tl.EVENT_RESULT_NAME,0==r))])}}class tm extends e1{constructor(){super("Fill",[tm.PARAMETER_ARRAY_SOURCE,tm.PARAMETER_INT_SOURCE_FROM,tm.PARAMETER_INT_LENGTH,tm.PARAMETER_ANY],tm.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tm.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tm.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tm.PARAMETER_INT_LENGTH.getParameterName()),n=e?.getArguments()?.get(tm.PARAMETER_ANY.getParameterName());if(r<0)throw new er(eT.format("Arrays out of bound trying to access $ index",r));-1==s&&(s=t.length-r);let a=r+s-t.length;if(t=[...t],a>0)for(let e=0;e<a;e++)t.push();for(let e=r;e<r+s;e++)t[e]=R(n)?n:ta(n);return new es([Z.outputOf(j.of(e1.EVENT_RESULT_NAME,t))])}}class th extends e1{constructor(){super("Frequency",[th.PARAMETER_ARRAY_SOURCE,th.PARAMETER_ANY,th.PARAMETER_INT_SOURCE_FROM,th.PARAMETER_INT_LENGTH],th.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(th.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(th.PARAMETER_ANY.getParameterName()),s=e?.getArguments()?.get(th.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(th.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[th.EVENT_RESULT_NAME,0]]))]);if(s>t.length)throw new er("Given start point is more than the size of source");let a=s+n;if(-1==n&&(a=t.length-s),a>t.length)throw new er("Given length is more than the size of source");let i=0;for(let e=s;e<a&&e<t.length;e++)0==e8.compare(t[e],r)&&i++;return new es([Z.outputOf(new Map([[th.EVENT_RESULT_NAME,i]]))])}}class tR extends e1{constructor(){super("IndexOf",[tR.PARAMETER_ARRAY_SOURCE,tR.PARAMETER_ANY_ELEMENT_OBJECT,tR.PARAMETER_INT_FIND_FROM],tR.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tR.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tR.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),s=e?.getArguments()?.get(tR.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[tR.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length)throw new er("The size of the search index of the array is greater than the size of the array");let n=-1;for(let e=s;e<t.length;e++)if(0==e8.compare(t[e],r)){n=e;break}return new es([Z.outputOf(new Map([[tR.EVENT_RESULT_NAME,n]]))])}}class tg extends e1{constructor(){super("IndexOfArray",[tg.PARAMETER_ARRAY_SOURCE,tg.PARAMETER_ARRAY_SECOND_SOURCE,tg.PARAMETER_INT_FIND_FROM],tg.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tg.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length||0==r.length)return new es([Z.outputOf(new Map([[tg.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length||t.length<r.length)throw new er("Given from second source is more than the size of the source array");let n=r.length,a=-1;for(let e=s;e<t.length;e++){let s=0;if(0==e8.compare(t[e],r[s])){for(;s<n&&0==e8.compare(t[e+s],r[s]);)s++;if(s==n){a=e;break}}}return new es([Z.outputOf(new Map([[tg.EVENT_RESULT_NAME,a]]))])}}class tc extends e1{constructor(){super("LastIndexOf",[tc.PARAMETER_ARRAY_SOURCE,tc.PARAMETER_ANY_ELEMENT_OBJECT,tc.PARAMETER_INT_FIND_FROM],tc.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tc.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tc.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),s=e?.getArguments()?.get(tc.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[tc.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length)throw new er("The value of length shouldn't the exceed the size of the array or shouldn't be in terms");let n=-1;for(let e=t.length-1;e>=s;e--)if(0==e8.compare(t[e],r)){n=e;break}return new es([Z.outputOf(new Map([[tc.EVENT_RESULT_NAME,n]]))])}}class tp extends e1{constructor(){super("LastIndexOfArray",[tp.PARAMETER_ARRAY_SOURCE,tp.PARAMETER_ARRAY_SECOND_SOURCE,tp.PARAMETER_INT_FIND_FROM],tp.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tp.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[tp.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length||r.length>t.length)throw new er("Given from index is more than the size of the source array");let n=r.length,a=-1;for(let e=s;e<t.length;e++){let s=0;if(0==e8.compare(t[e],r[s])){for(;s<n&&0==e8.compare(t[e+s],r[s]);)s++;s==n&&(a=e)}}return new es([Z.outputOf(new Map([[tp.EVENT_RESULT_NAME,a]]))])}}class tN extends e1{constructor(){super("Max",[tN.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tN.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tN.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==t.length)throw new er("Search source array cannot be empty");let r=t[0];for(let e=1;e<t.length;e++){let s=t[e];e8.comparePrimitive(r,s)>=0||(r=s)}return new es([Z.outputOf(new Map([[tN.EVENT_RESULT_NAME,r]]))])}}class tf extends e1{constructor(){super("Min",[tf.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tf.EVENT_RESULT_ANY)}async internalExecute(e){let t,r=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==r.length)throw new er("Search source array cannot be empty");for(let e=0;e<r.length;e++)!R(r[e])&&(void 0===t||0>e8.comparePrimitive(r[e],t))&&(t=r[e]);return new es([Z.outputOf(new Map([[tf.EVENT_RESULT_NAME,t]]))])}}class t_ extends e1{constructor(){super("MisMatch",[t_.PARAMETER_ARRAY_SOURCE,t_.PARAMETER_INT_FIND_FROM,t_.PARAMETER_ARRAY_SECOND_SOURCE,t_.PARAMETER_INT_SECOND_SOURCE_FROM,t_.PARAMETER_INT_LENGTH],t_.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t_.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(t_.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(t_.PARAMETER_INT_LENGTH.getParameterName()),i=r<t.length&&r>0?r:0,o=n<s.length&&n>0?n:0;if(i+a>=t.length||o+a>s.length)throw new er("The size of the array for first and second which was being requested is more than size of the given array");let E=-1;for(let e=0;e<a;e++)if(t[i+e]!=s[o+e]){E=e;break}return new es([Z.outputOf(new Map([[t_.EVENT_RESULT_NAME,E]]))])}}class tM extends e1{constructor(){super("Reverse",[tM.PARAMETER_ARRAY_SOURCE,tM.PARAMETER_INT_SOURCE_FROM,tM.PARAMETER_INT_LENGTH],tM.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tM.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tM.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tM.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),s>=t.length||s<0||r<0)throw new er("Please provide start point between the start and end indexes or provide the length which was less than the source size ");t=[...t];let n=r+s-1;for(;r<=n;){let e=t[r],s=t[n];t[r++]=s,t[n--]=e}return new es([Z.outputOf(new Map([[tM.EVENT_RESULT_NAME,t]]))])}}class tS extends e1{constructor(){super("Rotate",[tS.PARAMETER_ARRAY_SOURCE,tS.PARAMETER_ROTATE_LENGTH],tS.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tS.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tS.PARAMETER_ROTATE_LENGTH.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);let s=(t=[...t]).length;return r%=s,this.rotate(t,0,r-1),this.rotate(t,r,s-1),this.rotate(t,0,s-1),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}rotate(e,t,r){for(;t<r;){let s=e[t];e[t++]=e[r],e[r--]=s}}}class tO extends e1{constructor(){super("Shuffle",[tO.PARAMETER_ARRAY_SOURCE],tO.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tO.PARAMETER_ARRAY_SOURCE.getParameterName());if(t.length<=1)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);let r=0,s=(t=[...t]).length;for(let e=0;e<s;e++){let e=Math.floor(Math.random()*s)%s,n=t[r];t[r]=t[e],t[e]=n,r=e}return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}var tw={};E(tw,"ObjectValueSetterExtractor",()=>tB);var td={};E(td,"Expression",()=>tb);var tP={};E(tP,"StringBuilder",()=>tI);class tI{constructor(e){this.str=e??""}append(e){return this.str+=e,this}toString(){return""+this.str}trim(){return this.str=this.str.trim(),this}setLength(e){return this.str=this.str.substring(0,e),this}length(){return this.str.length}charAt(e){return this.str.charAt(e)}deleteCharAt(e){return this.checkIndex(e),this.str=this.str.substring(0,e)+this.str.substring(e+1),this}insert(e,t){return this.str=this.str.substring(0,e)+t+this.str.substring(e),this}checkIndex(e){if(e>=this.str.length)throw new er(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var ty={};E(ty,"ExpressionEvaluationException",()=>tx);class tx extends Error{constructor(e,t,r){super(eT.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var tL={};E(tL,"ExpressionToken",()=>tv);class tv{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var tU={};E(tU,"ExpressionTokenValue",()=>tV);class tV extends tv{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return eT.format("$: $",this.expression,this.element)}}var tC={};E(tC,"Operation",()=>tD);class tD{static{this.MULTIPLICATION=new tD("*")}static{this.DIVISION=new tD("/")}static{this.INTEGER_DIVISION=new tD("//")}static{this.MOD=new tD("%")}static{this.ADDITION=new tD("+")}static{this.SUBTRACTION=new tD("-")}static{this.NOT=new tD("not",void 0,!0)}static{this.AND=new tD("and",void 0,!0)}static{this.OR=new tD("or",void 0,!0)}static{this.LESS_THAN=new tD("<")}static{this.LESS_THAN_EQUAL=new tD("<=")}static{this.GREATER_THAN=new tD(">")}static{this.GREATER_THAN_EQUAL=new tD(">=")}static{this.EQUAL=new tD("=")}static{this.NOT_EQUAL=new tD("!=")}static{this.BITWISE_AND=new tD("&")}static{this.BITWISE_OR=new tD("|")}static{this.BITWISE_XOR=new tD("^")}static{this.BITWISE_COMPLEMENT=new tD("~")}static{this.BITWISE_LEFT_SHIFT=new tD("<<")}static{this.BITWISE_RIGHT_SHIFT=new tD(">>")}static{this.BITWISE_UNSIGNED_RIGHT_SHIFT=new tD(">>>")}static{this.UNARY_PLUS=new tD("UN: +","+")}static{this.UNARY_MINUS=new tD("UN: -","-")}static{this.UNARY_LOGICAL_NOT=new tD("UN: not","not")}static{this.UNARY_BITWISE_COMPLEMENT=new tD("UN: ~","~")}static{this.ARRAY_OPERATOR=new tD("[")}static{this.OBJECT_OPERATOR=new tD(".")}static{this.NULLISH_COALESCING_OPERATOR=new tD("??")}static{this.CONDITIONAL_TERNARY_OPERATOR=new tD("?")}static{this.VALUE_OF=new Map([["MULTIPLICATION",tD.MULTIPLICATION],["DIVISION",tD.DIVISION],["INTEGER_DIVISON",tD.INTEGER_DIVISION],["MOD",tD.MOD],["ADDITION",tD.ADDITION],["SUBTRACTION",tD.SUBTRACTION],["NOT",tD.NOT],["AND",tD.AND],["OR",tD.OR],["LESS_THAN",tD.LESS_THAN],["LESS_THAN_EQUAL",tD.LESS_THAN_EQUAL],["GREATER_THAN",tD.GREATER_THAN],["GREATER_THAN_EQUAL",tD.GREATER_THAN_EQUAL],["EQUAL",tD.EQUAL],["NOT_EQUAL",tD.NOT_EQUAL],["BITWISE_AND",tD.BITWISE_AND],["BITWISE_OR",tD.BITWISE_OR],["BITWISE_XOR",tD.BITWISE_XOR],["BITWISE_COMPLEMENT",tD.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",tD.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",tD.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",tD.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",tD.UNARY_PLUS],["UNARY_MINUS",tD.UNARY_MINUS],["UNARY_LOGICAL_NOT",tD.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",tD.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",tD.ARRAY_OPERATOR],["OBJECT_OPERATOR",tD.OBJECT_OPERATOR],["NULLISH_COALESCING_OPERATOR",tD.NULLISH_COALESCING_OPERATOR],["CONDITIONAL_TERNARY_OPERATOR",tD.CONDITIONAL_TERNARY_OPERATOR]])}static{this.UNARY_OPERATORS=new Set([tD.ADDITION,tD.SUBTRACTION,tD.NOT,tD.BITWISE_COMPLEMENT,tD.UNARY_PLUS,tD.UNARY_MINUS,tD.UNARY_LOGICAL_NOT,tD.UNARY_BITWISE_COMPLEMENT])}static{this.ARITHMETIC_OPERATORS=new Set([tD.MULTIPLICATION,tD.DIVISION,tD.INTEGER_DIVISION,tD.MOD,tD.ADDITION,tD.SUBTRACTION])}static{this.LOGICAL_OPERATORS=new Set([tD.NOT,tD.AND,tD.OR,tD.LESS_THAN,tD.LESS_THAN_EQUAL,tD.GREATER_THAN,tD.GREATER_THAN_EQUAL,tD.EQUAL,tD.NOT_EQUAL,tD.NULLISH_COALESCING_OPERATOR])}static{this.BITWISE_OPERATORS=new Set([tD.BITWISE_AND,tD.BITWISE_COMPLEMENT,tD.BITWISE_LEFT_SHIFT,tD.BITWISE_OR,tD.BITWISE_RIGHT_SHIFT,tD.BITWISE_UNSIGNED_RIGHT_SHIFT,tD.BITWISE_XOR])}static{this.CONDITIONAL_OPERATORS=new Set([tD.CONDITIONAL_TERNARY_OPERATOR])}static{this.OPERATOR_PRIORITY=new Map([[tD.UNARY_PLUS,1],[tD.UNARY_MINUS,1],[tD.UNARY_LOGICAL_NOT,1],[tD.UNARY_BITWISE_COMPLEMENT,1],[tD.ARRAY_OPERATOR,1],[tD.OBJECT_OPERATOR,1],[tD.MULTIPLICATION,2],[tD.DIVISION,2],[tD.INTEGER_DIVISION,2],[tD.MOD,2],[tD.ADDITION,3],[tD.SUBTRACTION,3],[tD.BITWISE_LEFT_SHIFT,4],[tD.BITWISE_RIGHT_SHIFT,4],[tD.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[tD.LESS_THAN,5],[tD.LESS_THAN_EQUAL,5],[tD.GREATER_THAN,5],[tD.GREATER_THAN_EQUAL,5],[tD.EQUAL,6],[tD.NOT_EQUAL,6],[tD.BITWISE_AND,7],[tD.BITWISE_XOR,8],[tD.BITWISE_OR,9],[tD.AND,10],[tD.OR,11],[tD.NULLISH_COALESCING_OPERATOR,11],[tD.CONDITIONAL_TERNARY_OPERATOR,12]])}static{this.OPERATORS=new Set([...Array.from(tD.ARITHMETIC_OPERATORS),...Array.from(tD.LOGICAL_OPERATORS),...Array.from(tD.BITWISE_OPERATORS),tD.ARRAY_OPERATOR,tD.OBJECT_OPERATOR,...Array.from(tD.CONDITIONAL_OPERATORS)].map(e=>e.getOperator()))}static{this.OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(tD.ARITHMETIC_OPERATORS),...Array.from(tD.LOGICAL_OPERATORS),...Array.from(tD.BITWISE_OPERATORS),tD.ARRAY_OPERATOR,tD.OBJECT_OPERATOR,...Array.from(tD.CONDITIONAL_OPERATORS)].filter(e=>!e.shouldBeWrappedInSpace()).map(e=>e.getOperator()))}static{this.OPERATION_VALUE_OF=new Map(Array.from(tD.VALUE_OF.entries()).map(([e,t])=>[t.getOperator(),t]))}static{this.UNARY_MAP=new Map([[tD.ADDITION,tD.UNARY_PLUS],[tD.SUBTRACTION,tD.UNARY_MINUS],[tD.NOT,tD.UNARY_LOGICAL_NOT],[tD.BITWISE_COMPLEMENT,tD.UNARY_BITWISE_COMPLEMENT],[tD.UNARY_PLUS,tD.UNARY_PLUS],[tD.UNARY_MINUS,tD.UNARY_MINUS],[tD.UNARY_LOGICAL_NOT,tD.UNARY_LOGICAL_NOT],[tD.UNARY_BITWISE_COMPLEMENT,tD.UNARY_BITWISE_COMPLEMENT]])}static{this.BIGGEST_OPERATOR_SIZE=Array.from(tD.VALUE_OF.values()).map(e=>e.getOperator()).filter(e=>!e.startsWith("UN: ")).map(e=>e.length).reduce((e,t)=>e>t?e:t,0)}constructor(e,t,r=!1){this.operator=e,this.operatorName=t??e,this._shouldBeWrappedInSpace=r}getOperator(){return this.operator}getOperatorName(){return this.operatorName}shouldBeWrappedInSpace(){return this._shouldBeWrappedInSpace}valueOf(e){return tD.VALUE_OF.get(e)}toString(){return this.operator}}class tb extends tv{constructor(e,t,r,s){super(e||""),this.tokens=new el,this.ops=new el,t&&this.tokens.push(t),r&&this.tokens.push(r),s&&this.ops.push(s),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){let e;let t=this.expression.length,r="",s=new tI(""),n=0,a=!1;for(;n<t;){switch(r=this.expression[n],e=s.toString(),r){case" ":a=this.processTokenSepearator(s,e,a);break;case"(":n=this.processSubExpression(t,s,e,n,a),a=!1;break;case")":throw new tx(this.expression,"Extra closing parenthesis found");case"]":throw new tx(this.expression,"Extra closing square bracket found");case"'":case'"':{let e=this.processStringLiteral(t,r,n);n=e.getT1(),a=e.getT2();break}case"?":if(n+1<t&&"?"!=this.expression.charAt(n+1)&&0!=n&&"?"!=this.expression.charAt(n-1))n=this.processTernaryOperator(t,s,e,n,a);else{let i=this.processOthers(r,t,s,e,n,a);n=i.getT1(),(a=i.getT2())&&this.ops.peek()==tD.ARRAY_OPERATOR&&(n=(i=this.process(t,s,n)).getT1(),a=i.getT2())}break;default:let i=this.processOthers(r,t,s,e,n,a);n=i.getT1(),(a=i.getT2())&&this.ops.peek()==tD.ARRAY_OPERATOR&&(n=(i=this.process(t,s,n)).getT1(),a=i.getT2())}++n}if(e=s.toString(),!eg.isNullOrBlank(e)){if(tD.OPERATORS.has(e))throw new tx(this.expression,"Expression is ending with an operator");this.tokens.push(new tv(e))}}processStringLiteral(e,t,r){let s="",n=r+1;for(;n<e;n++){let e=this.expression.charAt(n);if(e==t&&"\\"!=this.expression.charAt(n-1))break;s+=e}if(n==e&&this.expression.charAt(n-1)!=t)throw new tx(this.expression,"Missing string ending marker "+t);let a=new eN(n,!1);return this.tokens.push(new tV(s,s)),a}process(e,t,r){let s=1;for(++r;r<e&&0!=s;){let e=this.expression.charAt(r);"]"==e?--s:"["==e&&++s,0!=s&&(t.append(e),r++)}return this.tokens.push(new tb(t.toString())),t.setLength(0),new eN(r,!1)}processOthers(e,t,r,s,n,a){let i=t-n;i=i<tD.BIGGEST_OPERATOR_SIZE?i:tD.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(n,n+e);if(tD.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return eg.isNullOrBlank(s)||(this.tokens.push(new tv(s)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,tD.OPERATION_VALUE_OF.get(t),a),a=!0,r.setLength(0),new eN(n+e-1,a)}return r.append(e),new eN(n,!1)}processTernaryOperator(e,t,r,s,n){if(n)throw new tx(this.expression,"Ternary operator is followed by an operator");""!=r.trim()&&(this.tokens.push(new tb(r)),t.setLength(0));let a=1,i="",o=++s;for(;s<e&&a>0;)"?"==(i=this.expression.charAt(s))?++a:":"==i&&--a,++s;if(":"!=i)throw new tx(this.expression,"':' operater is missing");if(s>=e)throw new tx(this.expression,"Third part of the ternary expression is missing");for(;!this.ops.isEmpty()&&this.hasPrecedence(tD.CONDITIONAL_TERNARY_OPERATOR,this.ops.peek());){let e=this.ops.pop();if(tD.UNARY_OPERATORS.has(e)){let t=this.tokens.pop();this.tokens.push(new tb("",t,void 0,e))}else{let t=this.tokens.pop(),r=this.tokens.pop();this.tokens.push(new tb("",r,t,e))}}this.ops.push(tD.CONDITIONAL_TERNARY_OPERATOR),this.tokens.push(new tb(this.expression.substring(o,s-1)));let E=this.expression.substring(s);if(""===E.trim())throw new tx(this.expression,"Third part of the ternary expression is missing");return this.tokens.push(new tb(E)),e-1}processSubExpression(e,t,r,s,n){if(tD.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,tD.OPERATION_VALUE_OF.get(r),n),t.setLength(0);else if(!eg.isNullOrBlank(r))throw new tx(this.expression,eT.format("Unkown token : $ found.",r));let a=1,i=new tI,o=this.expression.charAt(s);for(s++;s<e&&a>0;)"("==(o=this.expression.charAt(s))?a++:")"==o&&a--,0!=a&&(i.append(o),s++);if(")"!=o)throw new tx(this.expression,"Missing a closed parenthesis");for(;i.length()>2&&"("==i.charAt(0)&&")"==i.charAt(i.length()-1);)i.deleteCharAt(0),i.setLength(i.length()-1);return this.tokens.push(new tb(i.toString().trim())),s}processTokenSepearator(e,t,r){return eg.isNullOrBlank(t)||(tD.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,tD.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new tv(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,s){if(r){if(s||e.isEmpty()){if(tD.UNARY_OPERATORS.has(r)){let e=tD.UNARY_MAP.get(r);e&&t.push(e)}else throw new tx(this.expression,eT.format("Extra operator $ found.",r))}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(tD.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new tb("",t,void 0,r))}else{let t=e.pop(),s=e.pop();e.push(new tb("",s,t,r))}}t.push(r)}}}hasPrecedence(e,t){let r=tD.OPERATOR_PRIORITY.get(e),s=tD.OPERATOR_PRIORITY.get(t);if(!r||!s)throw Error("Unknown operators provided");return s<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new tI,t=0,r=this.ops.toArray(),s=this.tokens.toArray();for(let n=0;n<r.length;n++)if(r[n].getOperator().startsWith("UN: "))e.append("(").append(r[n].getOperator().substring(4)).append(s[t]instanceof tb?s[t].toString():s[t]).append(")"),t++;else if(r[n]==tD.CONDITIONAL_TERNARY_OPERATOR){let r=s[t++];e.insert(0,r.toString()),e.insert(0,":"),r=s[t++],e.insert(0,r.toString()),e.insert(0,"?"),r=s[t++],e.insert(0,r.toString()).append(")"),e.insert(0,"(")}else{if(0==t){let r=s[t++];e.insert(0,r.toString())}let a=s[t++];e.insert(0,r[n].getOperator()).insert(0,a.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var tG={};E(tG,"TokenValueExtractor",()=>tF);class tF{static{this.REGEX_SQUARE_BRACKETS=/[\[\]]/}static{this.REGEX_DOT=/\./}getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new er(eT.format("Token $ doesn't start with $",e,t));if(e.endsWith(".__index")){let t=e.substring(0,e.length-8),r=this.getValueInternal(t);if(!R(r?.__index))return r.__index;if(!t.endsWith("]"))return t.substring(t.lastIndexOf(".")+1);{let e=t.substring(t.lastIndexOf("[")+1,t.length-1),r=parseInt(e);return isNaN(r)?e:r}}return this.getValueInternal(e)}retrieveElementFrom(e,t,r,s){if(R(s))return;if(t.length==r)return s;let n=t[r].split(tF.REGEX_SQUARE_BRACKETS).map(e=>e.trim()).filter(e=>!eg.isNullOrBlank(e)).reduce((s,n)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,n,s),s);return this.retrieveElementFrom(e,t,r+1,n)}resolveForEachPartOfTokenWithBrackets(e,t,r,s,n){if(!R(n))return"length"===s?this.getLength(e,n):Array.isArray(n)?this.handleArrayAccess(e,s,n):this.handleObjectAccess(e,t,r,s,n)}getLength(e,t){let r=typeof t;if("string"===r||Array.isArray(t))return t.length;if("object"===r)return"length"in t?t.length:Object.keys(t).length;throw new tx(e,eT.format("Length can't be found in token $",e))}handleArrayAccess(e,t,r){let s=parseInt(t);if(isNaN(s))throw new tx(e,eT.format("$ is not a number",t));if(!(s<0)&&!(s>=r.length))return r[s]}handleObjectAccess(e,t,r,s,n){if(s.startsWith('"')){if(!s.endsWith('"')||1==s.length||2==s.length)throw new tx(e,eT.format("$ is missing a double quote or empty key found",e));s=s.substring(1,t.length-2)}return this.checkIfObject(e,t,r,n),n[s]}checkIfObject(e,t,r,s){if("object"!=typeof s||Array.isArray(s))throw new tx(e,eT.format("Unable to retrieve $ from $ in the path $",t[r],s.toString(),e))}}class tB extends tF{constructor(e,t){super(),this.store=e,this.prefix=t}getValueInternal(e){let t=e.split(tF.REGEX_DOT);return this.retrieveElementFrom(e,t,1,this.store)}getStore(){return this.store}setStore(e){return this.store=e,this}setValue(e,t,r=!0,s=!1){this.store=ta(this.store),this.modifyStore(e,t,r,s)}modifyStore(e,t,r,s){let n=new tb(e),a=n.getTokens();a.removeLast();let i=n.getOperations(),o=i.removeLast(),E=a.removeLast(),u=E instanceof tV?E.getElement():E.getExpression(),A=this.store;for(;!i.isEmpty();)A=o==tD.OBJECT_OPERATOR?this.getDataFromObject(A,u,i.peekLast()):this.getDataFromArray(A,u,i.peekLast()),o=i.removeLast(),u=(E=a.removeLast())instanceof tV?E.getElement():E.getExpression();o==tD.OBJECT_OPERATOR?this.putDataInObject(A,u,t,r,s):this.putDataInArray(A,u,t,r,s)}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new er(eT.format("Expected an array index but found $",t));if(s<0)throw new er(eT.format("Array index is out of bound - $",t));let n=e[s];return R(n)&&(n=r==tD.OBJECT_OPERATOR?{}:[],e[s]=n),n}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));let s=e[t];return R(s)&&(s=r==tD.OBJECT_OPERATOR?{}:[],e[t]=s),s}putDataInArray(e,t,r,s,n){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let a=parseInt(t);if(isNaN(a))throw new er(eT.format("Expected an array index but found $",t));if(a<0)throw new er(eT.format("Array index is out of bound - $",t));(s||R(e[a]))&&(n&&R(r)?e.splice(a,1):e[a]=r)}putDataInObject(e,t,r,s,n){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));(s||R(e[t]))&&(n&&R(r)?delete e[t]:e[t]=r)}getPrefix(){return this.prefix}}class tY extends e1{constructor(){super("Sort",[tY.PARAMETER_ARRAY_SOURCE,tY.PARAMETER_INT_FIND_FROM,tY.PARAMETER_INT_LENGTH,tY.PARAMETER_BOOLEAN_ASCENDING,tY.PARAMETER_KEY_PATH],tY.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tY.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tY.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(tY.PARAMETER_INT_LENGTH.getParameterName()),n=e?.getArguments()?.get(tY.PARAMETER_BOOLEAN_ASCENDING.getParameterName()),a=e?.getArguments()?.get(tY.PARAMETER_KEY_PATH.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);if(t=[...t],-1==s&&(s=t.length-r),r<0||r>=t.length||r+s>t.length)throw new er("Given start point is more than the size of the array or not available at that point");let i=t.slice(r,r+s+1),o=new tB({},"Data.");return i.sort((e,t)=>"object"==typeof e&&"object"==typeof t&&a.length?(o.setStore({a:e,b:t}),tH(o.getValue("Data.a."+a),o.getValue("Data.b."+a),n)):tH(e,t,n)),t.splice(r,s,...i),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}function tH(e,t,r){return e===t?0:null===e?1:null===t?-1:r?e<t?-1:1:e<t?1:-1}class tk extends e1{constructor(){super("SubArray",[tk.PARAMETER_ARRAY_SOURCE,tk.PARAMETER_INT_FIND_FROM,tk.PARAMETER_INT_LENGTH],tk.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tk.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tk.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(tk.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),s<=0)return new es([Z.outputOf(new Map([]))]);if(!(r>=0&&r<t.length)||r+s>t.length)throw new er("Given find from point is more than the source size array or the Requested length for the subarray was more than the source size");let n=t.slice(r,r+s);return new es([Z.outputOf(new Map([[tk.EVENT_RESULT_NAME,n]]))])}}class t$ extends e1{constructor(){super("Insert",[t$.PARAMETER_ARRAY_SOURCE,t$.PARAMETER_INT_OFFSET,t$.PARAMETER_ANY],t$.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(t$.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t$.PARAMETER_INT_OFFSET.getParameterName());var s=e?.getArguments()?.get(t$.PARAMETER_ANY.getParameterName());if(R(s)||R(r)||r>t.length)throw new er("Please valid resouces to insert at the correct location");if(0==(t=[...t]).length)return 0==r&&t.push(s),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);t.push(s);let n=t.length-1;for(r++;n>=r;){let e=t[n-1];t[n-1]=t[n],t[n--]=e}return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tj extends e1{constructor(){super("InsertLast",[tj.PARAMETER_ARRAY_SOURCE,tj.PARAMETER_ANY],tj.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tj.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tj.PARAMETER_ANY.getParameterName());return(t=[...t]).push(r),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tW extends e1{constructor(){super("RemoveDuplicates",[tW.PARAMETER_ARRAY_SOURCE,tW.PARAMETER_INT_SOURCE_FROM,tW.PARAMETER_INT_LENGTH],tW.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tW.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tW.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tW.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),r+s>t.length)throw new er(eT.format("Array has no elements from $ to $ as the array size is $",r,r+s,t.length));let n=[...t],a=r+s;for(let e=a-1;e>=r;e--)for(let t=e-1;t>=r;t--)if(eh(n[e],n[t])){n.splice(e,1);break}return new es([Z.outputOf(j.of(tW.EVENT_RESULT_NAME,n))])}}const tX="keyPath",tJ="valuePath",tq="ignoreNullValues",tz="ignoreNullKeys",tK="ignoreDuplicateKeys";class tQ extends e1{constructor(){super("ArrayToObjects",[e1.PARAMETER_ARRAY_SOURCE,k.of(tX,D.ofString(tX)),k.of(tJ,D.of(tJ,p.STRING,p.NULL)),k.of(tq,D.ofBoolean(tq).setDefaultValue(!1)),k.of(tz,D.ofBoolean(tz).setDefaultValue(!0)),k.of(tK,D.ofBoolean(tK).setDefaultValue(!1))],e1.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tX),s=e?.getArguments()?.get(tJ)??"",n=e?.getArguments()?.get(tq),a=e?.getArguments()?.get(tz),i=e?.getArguments()?.get(tK),o=new tB({},"Data."),E=t.filter(e=>!R(e)).reduce((e,t)=>{o.setStore(t);let E=o.getValue("Data."+r);if(a&&R(E))return e;let u=s?o.getValue("Data."+s):t;return n&&R(u)||i&&e.hasOwnProperty(E)||(e[E]=u),e},{});return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,E]]))])}}const tZ="source",t0="delimiter",t1="result";class t2 extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(tZ),r=e?.getArguments()?.get(t0);return new es([Z.outputOf(new Map([[t1,t.join(r)]]))])}constructor(...e){super(...e),this.signature=new ea("Join").setNamespace(l.SYSTEM_ARRAY).setParameters(new Map([[tZ,new k(tZ,D.ofArray(tZ,D.of("each",p.STRING,p.INTEGER,p.LONG,p.DOUBLE,p.FLOAT,p.NULL)))],[t0,new k(t0,D.ofString(t0).setDefaultValue(""))]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[t1,D.ofString(t1)]]))]))}}class t9{async find(e,t){return e!=l.SYSTEM_ARRAY?Promise.resolve(void 0):Promise.resolve(this.repoMap.get(t))}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}constructor(){this.repoMap=j.ofArrayEntries(q(new e2),q(new e9),q(new te),q(new ts),q(new ti),q(new to),q(new tE),q(new tu),q(new tA),q(new tT),q(new tl),q(new tm),q(new th),q(new tR),q(new tg),q(new tc),q(new tp),q(new tN),q(new tf),q(new t_),q(new tM),q(new tS),q(new tO),q(new tY),q(new tk),q(new e4),q(new t$),q(new tj),q(new tW),q(new tQ),q(new t2)),this.filterableNames=Array.from(this.repoMap.values()).map(e=>e.getSignature().getFullName())}}var t3={};E(t3,"ContextElement",()=>t4);class t4{static{this.NULL=new t4(D.NULL,void 0)}constructor(e,t){this.schema=e,this.element=t}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getElement(){return this.element}setElement(e){return this.element=e,this}}const t5="name",t6="schema";class t7 extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(t5);if(e?.getContext()?.has(t))throw new er(eT.format("Context already has an element for '$' ",t));let r=D.from(e?.getArguments()?.get(t6));if(!r)throw new er("Schema is not supplied.");return e.getContext().set(t,new t4(r,R(r.getDefaultValue())?void 0:r.getDefaultValue())),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Create").setNamespace(l.SYSTEM_CTX).setParameters(new Map([k.ofEntry(t5,new D().setName(t5).setType(d.of(p.STRING)).setMinLength(1).setFormat(eB.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,Y.CONSTANT),k.ofEntry(t6,D.SCHEMA,!1,Y.CONSTANT)])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}const t8="name",re="value";class rt extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(t8);if(!e.getContext()?.has(t))throw new er(eT.format("Context don't have an element for '$' ",t));return new es([Z.outputOf(new Map([re,e.getContext()?.get(t)?.getElement()]))])}constructor(...e){super(...e),this.signature=new ea("Get").setNamespace(l.SYSTEM_CTX).setParameters(new Map([k.ofEntry(t8,new D().setName(t8).setType(d.of(p.STRING)).setMinLength(1).setFormat(eB.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,Y.CONSTANT)])).setEvents(new Map([Q.outputEventMapEntry(new Map([[re,D.ofAny(re)]]))]))}}var rr={};E(rr,"ExpressionEvaluator",()=>sa);var rs={};E(rs,"LogicalNullishCoalescingOperator",()=>ri);var rn={};E(rn,"BinaryOperator",()=>ra);class ra{nullCheck(e,t,r){if(R(e)||R(t))throw new e7(eT.format("$ cannot be applied to a null value",r.getOperatorName()))}}class ri extends ra{apply(e,t){return R(e)?t:e}}var ro={};E(ro,"ArithmeticAdditionOperator",()=>rE);class rE extends ra{apply(e,t){return R(e)?t:R(t)?e:e+t}}var ru={};E(ru,"ArithmeticDivisionOperator",()=>rA);class rA extends ra{apply(e,t){return this.nullCheck(e,t,tD.DIVISION),e/t}}var rT={};E(rT,"ArithmeticIntegerDivisionOperator",()=>rl);class rl extends ra{apply(e,t){return this.nullCheck(e,t,tD.DIVISION),Math.floor(e/t)}}var rm={};E(rm,"ArithmeticModulusOperator",()=>rh);class rh extends ra{apply(e,t){return this.nullCheck(e,t,tD.MOD),e%t}}var rR={};E(rR,"ArithmeticMultiplicationOperator",()=>rg);class rg extends ra{apply(e,t){this.nullCheck(e,t,tD.MULTIPLICATION);let r="string"==typeof e,s=typeof t;if(r||"string"===s){let s=r?e:t,n=r?t:e,a="",i=n<0,o=Math.floor(n=Math.abs(n));for(;o-- >0;)a+=s;let E=Math.floor(s.length*(n-Math.floor(n)));if(E<0&&(E=-E),0!=E&&(a+=s.substring(0,E)),i){let e="";for(let t=a.length-1;t>=0;t--)e+=a[t];return e}return a}return e*t}}var rc={};E(rc,"ArithmeticSubtractionOperator",()=>rp);class rp extends ra{apply(e,t){return this.nullCheck(e,t,tD.SUBTRACTION),e-t}}var rN={};E(rN,"ArrayOperator",()=>rf);class rf extends ra{apply(e,t){if(!e)throw new e7("Cannot apply array operator on a null value");if(!t)throw new e7("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new e7(eT.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new e7(eT.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var r_={};E(r_,"BitwiseAndOperator",()=>rM);class rM extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_AND),e&t}}var rS={};E(rS,"BitwiseLeftShiftOperator",()=>rO);class rO extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_LEFT_SHIFT),e<<t}}var rw={};E(rw,"BitwiseOrOperator",()=>rd);class rd extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_OR),e|t}}var rP={};E(rP,"BitwiseRightShiftOperator",()=>rI);class rI extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_RIGHT_SHIFT),e>>t}}var ry={};E(ry,"BitwiseUnsignedRightShiftOperator",()=>rx);class rx extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var rL={};E(rL,"BitwiseXorOperator",()=>rv);class rv extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_XOR),e^t}}var rU={};E(rU,"LogicalAndOperator",()=>rV);class rV extends ra{apply(e,t){return!!e&&""!==e&&!!t&&""!==t}}var rC={};E(rC,"LogicalEqualOperator",()=>rD);class rD extends ra{apply(e,t){return eh(e,t)}}var rb={};E(rb,"LogicalGreaterThanEqualOperator",()=>rG);class rG extends ra{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare >= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>=s.getT2()}}var rF={};E(rF,"LogicalGreaterThanOperator",()=>rB);class rB extends ra{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare > with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>s.getT2()}}var rY={};E(rY,"LogicalLessThanEqualOperator",()=>rH);class rH extends ra{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare <= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<=s.getT2()}}var rk={};E(rk,"LogicalLessThanOperator",()=>r$);class r$ extends ra{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare < with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<s.getT2()}}var rj={};E(rj,"LogicalNotEqualOperator",()=>rW);class rW extends ra{apply(e,t){return!eh(e,t)}}var rX={};E(rX,"LogicalOrOperator",()=>rJ);class rJ extends ra{apply(e,t){return!!e&&""!==e||!!t&&""!==t}}var rq={};E(rq,"ObjectOperator",()=>rz);class rz extends ra{apply(e,t){if(!e)throw new e7("Cannot apply array operator on a null value");if(!t)throw new e7("Cannot retrive null property value");let r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new e7(eT.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var rK={};E(rK,"ArithmeticUnaryMinusOperator",()=>r0);var rQ={};E(rQ,"UnaryOperator",()=>rZ);class rZ{nullCheck(e,t){if(R(e))throw new e7(eT.format("$ cannot be applied to a null value",t.getOperatorName()))}}class r0 extends rZ{apply(e){return this.nullCheck(e,tD.UNARY_MINUS),e8.findPrimitiveNumberType(e),-e}}var r1={};E(r1,"ArithmeticUnaryPlusOperator",()=>r2);class r2 extends rZ{apply(e){return this.nullCheck(e,tD.UNARY_PLUS),e8.findPrimitiveNumberType(e),e}}var r9={};E(r9,"BitwiseComplementOperator",()=>r3);class r3 extends rZ{apply(e){this.nullCheck(e,tD.UNARY_BITWISE_COMPLEMENT);let t=e8.findPrimitiveNumberType(e);if(t.getT1()!=p.INTEGER&&t.getT1()!=p.LONG)throw new e7(eT.format("Unable to apply bitwise operator on $",e));return~e}}var r4={};E(r4,"LogicalNotOperator",()=>r5);class r5 extends rZ{apply(e){return!e&&""!==e}}var r6={};E(r6,"LiteralTokenValueExtractor",()=>r8);const r7=new Map([["true",!0],["false",!1],["null",void 0],["undefined",void 0]]);class r8 extends tF{static{this.INSTANCE=new r8}getValueInternal(e){if(!eg.isNullOrBlank(e))return(e=e.trim(),r7.has(e))?r7.get(e):e.startsWith('"')?this.processString(e):this.processNumbers(e)}processNumbers(e){try{let t=Number(e);if(isNaN(t))throw Error("Parse number error");return t}catch(t){throw new tx(e,eT.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new tx(e,eT.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}getStore(){}getValueFromExtractors(e,t){return t.has(e+".")?t.get(e+".")?.getStore():this.getValue(e)}}var se={},st={};E(st,"ConditionalTernaryOperator",()=>ss);class sr{nullCheck(e,t,r,s){if(R(e)||R(t)||R(r))throw new e7(eT.format("$ cannot be applied to a null value",s.getOperatorName()))}}class ss extends sr{apply(e,t,r){return e?t:r}}o(se,st);class sn extends tF{static{this.PREFIX="_internal."}addValue(e,t){this.values.set(e,t)}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.values.get(r))}getPrefix(){return sn.PREFIX}getStore(){}constructor(...e){super(...e),this.values=new Map}}class sa{static{this.UNARY_OPERATORS_MAP=new Map([[tD.UNARY_BITWISE_COMPLEMENT,new r3],[tD.UNARY_LOGICAL_NOT,new r5],[tD.UNARY_MINUS,new r0],[tD.UNARY_PLUS,new r2]])}static{this.TERNARY_OPERATORS_MAP=new Map([[tD.CONDITIONAL_TERNARY_OPERATOR,new ss]])}static{this.BINARY_OPERATORS_MAP=new Map([[tD.ADDITION,new rE],[tD.DIVISION,new rA],[tD.INTEGER_DIVISION,new rl],[tD.MOD,new rh],[tD.MULTIPLICATION,new rg],[tD.SUBTRACTION,new rp],[tD.BITWISE_AND,new rM],[tD.BITWISE_LEFT_SHIFT,new rO],[tD.BITWISE_OR,new rd],[tD.BITWISE_RIGHT_SHIFT,new rI],[tD.BITWISE_UNSIGNED_RIGHT_SHIFT,new rx],[tD.BITWISE_XOR,new rv],[tD.AND,new rV],[tD.EQUAL,new rD],[tD.GREATER_THAN,new rB],[tD.GREATER_THAN_EQUAL,new rG],[tD.LESS_THAN,new r$],[tD.LESS_THAN_EQUAL,new rH],[tD.OR,new rJ],[tD.NOT_EQUAL,new rW],[tD.NULLISH_COALESCING_OPERATOR,new ri],[tD.ARRAY_OPERATOR,new rf],[tD.OBJECT_OPERATOR,new rz]])}static{this.UNARY_OPERATORS_MAP_KEY_SET=new Set(sa.UNARY_OPERATORS_MAP.keys())}constructor(e){this.internalTokenValueExtractor=new sn,e instanceof tb?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){let t=this.processNestingExpression(this.expression,e);return this.expression=t.getT1(),this.exp=t.getT2(),(e=new Map(e.entries())).set(this.internalTokenValueExtractor.getPrefix(),this.internalTokenValueExtractor),this.evaluateExpression(this.exp,e)}processNestingExpression(e,t){let r=0,s=0,n=new el;for(;s<e.length-1;){if("{"==e.charAt(s)&&"{"==e.charAt(s+1))0==r&&n.push(new eN(s+2,-1)),r++,s++;else if("}"==e.charAt(s)&&"}"==e.charAt(s+1)){if(--r<0)throw new tx(e,"Expecting {{ nesting path operator to be started before closing");0==r&&n.push(n.pop().setT2(s)),s++}s++}let a=this.replaceNestingExpression(e,t,n);return new eN(a,new tb(a))}replaceNestingExpression(e,t,r){let s=e;for(let n of r.toArray()){if(-1==n.getT2())throw new tx(e,"Expecting }} nesting path operator to be closed");let r=new sa(s.substring(n.getT1(),n.getT2())).evaluate(t);s=s.substring(0,n.getT1()-2)+r+s.substring(n.getT2()+2)}return s}getExpression(){return this.exp||(this.exp=new tb(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),s=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),n=s.pop();if(sa.UNARY_OPERATORS_MAP_KEY_SET.has(e))s.push(this.applyUnaryOperation(e,this.getValueFromToken(t,n)));else if(e==tD.OBJECT_OPERATOR||e==tD.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,s,e,n);else if(e==tD.CONDITIONAL_TERNARY_OPERATOR){let r=s.pop(),a=s.pop(),i=this.getValueFromToken(t,a),o=this.getValueFromToken(t,r),E=this.getValueFromToken(t,n);s.push(this.applyTernaryOperation(e,i,o,E))}else{let r=s.pop(),a=this.getValueFromToken(t,r),i=this.getValueFromToken(t,n);s.push(this.applyBinaryOperation(e,a,i))}}if(s.isEmpty())throw new e7(eT.format("Expression : $ evaluated to null",e));if(1!=s.size())throw new e7(eT.format("Expression : $ evaluated multiple values $",e,s));let n=s.get(0);if(n instanceof tV)return n.getElement();if(!(n instanceof tb))return this.getValueFromToken(t,n);throw new e7(eT.format("Expression : $ evaluated to $",e,s.get(0)))}processObjectOrArrayOperator(e,t,r,s,n){let a=new el,i=new el;if(!s||!n)return;do i.push(s),n instanceof tb?a.push(new tV(n.toString(),this.evaluateExpression(n,e))):n&&a.push(n),n=r.isEmpty()?void 0:r.pop(),s=t.isEmpty()?void 0:t.pop();while(s==tD.OBJECT_OPERATOR||s==tD.ARRAY_OPERATOR)n&&(n instanceof tb?a.push(new tV(n.toString(),this.evaluateExpression(n,e))):a.push(n)),s&&t.push(s);let o=a.pop();if(o instanceof tV&&"object"==typeof o.getTokenValue()){let e=new Date().getTime()+""+Math.round(1e3*Math.random());this.internalTokenValueExtractor.addValue(e,o.getTokenValue()),o=new tv(sn.PREFIX+e)}let E=new tI(o instanceof tV?o.getTokenValue():o.toString());for(;!a.isEmpty();)o=a.pop(),s=i.pop(),E.append(s.getOperator()).append(o instanceof tV?o.getTokenValue():o.toString()),s==tD.ARRAY_OPERATOR&&E.append("]");let u=E.toString(),A=u.substring(0,u.indexOf(".")+1);if(A.length>2&&e.has(A))r.push(new tV(u,this.getValue(u,e)));else{let e;try{e=r8.INSTANCE.getValue(u)}catch(t){e=u}r.push(new tV(u,e))}}applyTernaryOperation(e,t,r,s){let n=sa.TERNARY_OPERATORS_MAP.get(e);if(!n)throw new tx(this.expression,eT.format("No operator found to evaluate $",this.getExpression()));return new tV(e.toString(),n.apply(t,r,s))}applyBinaryOperation(e,t,r){let s=typeof t,n=typeof r,a=sa.BINARY_OPERATORS_MAP.get(e);if(("object"===s||"object"===n)&&e!==tD.EQUAL&&e!==tD.NOT_EQUAL&&e!==tD.NULLISH_COALESCING_OPERATOR&&e!==tD.AND&&e!==tD.OR)throw new tx(this.expression,eT.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));if(!a)throw new tx(this.expression,eT.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new tV(e.toString(),a.apply(t,r))}applyUnaryOperation(e,t){let r=typeof t;if(e.getOperator()!=tD.NOT.getOperator()&&e.getOperator()!=tD.UNARY_LOGICAL_NOT.getOperator()&&("object"===r||Array.isArray(t)))throw new tx(this.expression,eT.format("The operator $ cannot be applied to $",e.getOperator(),t));let s=sa.UNARY_OPERATORS_MAP.get(e);if(!s)throw new tx(this.expression,eT.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new tV(e.toString(),s.apply(t))}getValueFromToken(e,t){return t instanceof tb?this.evaluateExpression(t,e):t instanceof tV?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){let r=e.substring(0,e.indexOf(".")+1);return t.has(r)?t.get(r).getValue(e):r8.INSTANCE.getValueFromExtractors(e,t)}}const si="name",so="value";class sE extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(si);if(eg.isNullOrBlank(t))throw new er("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get(so),s=new tb(t),n=s.getTokens().peekLast();if(!n.getExpression().startsWith("Context")||n instanceof tb||n instanceof tV&&!n.getElement().toString().startsWith("Context"))throw new e7(eT.format("The context path $ is not a valid path in context",t));for(let e of s.getOperations().toArray())if(e!=tD.ARRAY_OPERATOR&&e!=tD.OBJECT_OPERATOR)throw new e7(eT.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<s.getTokens().size();r++){let n=s.getTokens().get(r);n instanceof tb&&s.getTokens().set(r,new tV(t,new sa(n).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,s)}modifyContext(e,t,r,s){let n=s.getTokens();n.removeLast();let a=s.getOperations();a.removeLast();let i=e.getContext()?.get(n.removeLast().getExpression());if(R(i))throw new er(eT.format("Context doesn't have any element with name '$' ",t));if(a.isEmpty())return i.setElement(r),new es([Z.outputOf(new Map)]);let o=i.getElement(),E=a.removeLast(),u=n.removeLast(),A=u instanceof tV?u.getElement():u.getExpression();for(R(o)&&(o=E==tD.OBJECT_OPERATOR?{}:[],i.setElement(o));!a.isEmpty();)o=E==tD.OBJECT_OPERATOR?this.getDataFromObject(o,A,a.peekLast()):this.getDataFromArray(o,A,a.peekLast()),E=a.removeLast(),A=(u=n.removeLast())instanceof tV?u.getElement():u.getExpression();return E==tD.OBJECT_OPERATOR?this.putDataInObject(o,A,r):this.putDataInArray(o,A,r),new es([Z.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new er(eT.format("Expected an array index but found $",t));if(s<0)throw new er(eT.format("Array index is out of bound - $",t));let n=e[s];return R(n)&&(n=r==tD.OBJECT_OPERATOR?{}:[],e[s]=n),n}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));let s=e[t];return R(s)&&(s=r==tD.OBJECT_OPERATOR?{}:[],e[t]=s),s}putDataInArray(e,t,r){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new er(eT.format("Expected an array index but found $",t));if(s<0)throw new er(eT.format("Array index is out of bound - $",t));e[s]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));e[t]=r}constructor(...e){super(...e),this.signature=new ea("Set").setNamespace(l.SYSTEM_CTX).setParameters(new Map([k.ofEntry(si,new D().setName(si).setType(d.of(p.STRING)).setMinLength(1),!1),k.ofEntry(so,D.ofAny(so))])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}const su="value",sA="eventName",sT="results";class sl extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getEvents(),r=e.getArguments(),s=r?.get(sA),n=e?.getArguments()?.get(sT).map(t=>{let r=t[su];if(R(r))throw new er("Expect a value object");let s=r.value;return r.isExpression&&(s=new sa(s).evaluate(e.getValuesMap())),[t.name,s]}).reduce((e,t)=>(e.set(t[0],t[1]),e),new Map);return t?.has(s)||t?.set(s,[]),t?.get(s)?.push(n),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("GenerateEvent").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(sA,D.ofString(sA).setDefaultValue("output")),k.ofEntry(sT,D.ofObject(sT).setProperties(new Map([["name",D.ofString("name")],[su,k.EXPRESSION]])),!0)])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}class sm extends e0{static{this.CONDITION="condition"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sm.CONDITION);return new es([Z.of(t||""===t?Q.TRUE:Q.FALSE,new Map),Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("If").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(sm.CONDITION,D.ofAny(sm.CONDITION))])).setEvents(new Map([Q.eventMapEntry(Q.TRUE,new Map),Q.eventMapEntry(Q.FALSE,new Map),Q.outputEventMapEntry(new Map)]))}}const sh="stepName";class sR extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sh);return e.getExecutionContext().set(t,!0),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Break").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sh,D.of(sh,p.STRING))])).setEvents(new Map([Q.outputEventMapEntry(new Map([]))]))}}const sg="count",sc="value",sp="index";class sN extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sg),r=0,s=e.getStatementExecution()?.getStatement()?.getStatementName();return new es({next(){if(r>=t||s&&e.getExecutionContext()?.get(s))return s&&e.getExecutionContext()?.delete(s),Z.outputOf(new Map([[sc,r]]));let n=Z.of(Q.ITERATION,new Map([[sp,r]]));return++r,n}})}constructor(...e){super(...e),this.signature=new ea("CountLoop").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sg,D.of(sg,p.INTEGER))])).setEvents(new Map([Q.eventMapEntry(Q.ITERATION,new Map([[sp,D.of(sp,p.INTEGER)]])),Q.outputEventMapEntry(new Map([[sc,D.of(sc,p.INTEGER)]]))]))}}const sf="source",s_="each",sM="index",sS="value";class sO extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sf),r=0,s=e.getStatementExecution()?.getStatement()?.getStatementName();return new es({next(){if(r>=t.length||s&&e.getExecutionContext()?.get(s))return s&&e.getExecutionContext()?.delete(s),Z.outputOf(new Map([[sS,r]]));let n=Z.of(Q.ITERATION,new Map([[sM,r],[s_,t[r]]]));return++r,n}})}constructor(...e){super(...e),this.signature=new ea("ForEachLoop").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sf,D.ofArray(sf,D.ofAny(sf)))])).setEvents(new Map([Q.eventMapEntry(Q.ITERATION,new Map([[sM,D.of(sM,p.INTEGER)],[s_,D.ofAny(s_)]])),Q.outputEventMapEntry(new Map([[sS,D.of(sS,p.INTEGER)]]))]))}}const sw="from",sd="step",sP="value",sI="index";class sy extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sw),r=e.getArguments()?.get("to"),s=e.getArguments()?.get(sd),n=s>0,a=t,i=!1,o=e.getStatementExecution()?.getStatement()?.getStatementName();return new es({next(){if(i)return;if(n&&a>=r||!n&&a<=r||o&&e.getExecutionContext()?.get(o))return i=!0,o&&e.getExecutionContext()?.delete(o),Z.outputOf(new Map([[sP,a]]));let t=Z.of(Q.ITERATION,new Map([[sI,a]]));return a+=s,t}})}constructor(...e){super(...e),this.signature=new ea("RangeLoop").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sw,D.of(sw,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE).setDefaultValue(0)),k.ofEntry("to",D.of("to",p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE).setDefaultValue(1)),k.ofEntry(sd,D.of(sd,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE).setDefaultValue(1).setNot(new D().setConstant(0)))])).setEvents(new Map([Q.eventMapEntry(Q.ITERATION,new Map([[sI,D.of(sI,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE)]])),Q.outputEventMapEntry(new Map([[sP,D.of(sP,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE)]]))]))}}const sx="value";class sL extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sx);return new es([Z.outputOf(new Map([[sx,t.reduce((e,t)=>e+=t,0)]]))])}constructor(...e){super(...e),this.signature=new ea("Add").setNamespace(l.MATH).setParameters(new Map([[sx,new k(sx,D.ofNumber(sx)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sx,D.ofNumber(sx)]]))]))}}const sv="value",sU="value1",sV="value2";class sC extends e0{constructor(e,t,r=1,...s){super(),this.paramFunctions=[()=>new Map([[sv,new k(sv,D.ofNumber(sv))]]),()=>new Map([[sU,new k(sU,D.ofNumber(sU))],[sV,new k(sV,D.ofNumber(sV))]])],s&&s.length||(s=[p.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new ea(e).setNamespace(l.MATH).setParameters(this.paramFunctions[r-1]()).setEvents(new Map([Q.outputEventMapEntry(new Map([[sv,new D().setType(d.of(...s)).setName(sv)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=e8.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?sv:sU)).getT2();return 2==this.parametersNumber&&(t=e8.findPrimitiveNumberType(e.getArguments()?.get(sV)).getT2()),new es([Z.outputOf(new Map([[sv,this.mathFunction.call(this,r,t)]]))])}}const sD="value";class sb extends e0{constructor(){super(),this.signature=new ea("Hypotenuse").setNamespace(l.MATH).setParameters(new Map([[sD,new k(sD,D.ofNumber(sD)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sD,new D().setType(d.of(p.DOUBLE)).setName(sD)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sD);return new es([Z.outputOf(new Map([[sD,Math.sqrt(t.reduce((e,t)=>e+=t*t,0))]]))])}}const sG="value";class sF extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sG);return new es([Z.outputOf(new Map([[sG,t.reduce((e,t)=>!e&&0!==e||t>e?t:e)]]))])}constructor(...e){super(...e),this.signature=new ea("Maximum").setNamespace(l.MATH).setParameters(new Map([[sG,new k(sG,D.ofNumber(sG)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sG,D.ofNumber(sG)]]))]))}}const sB="value";class sY extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sB);return new es([Z.outputOf(new Map([[sB,t.reduce((e,t)=>!e&&0!==e||t<e?t:e)]]))])}constructor(...e){super(...e),this.signature=new ea("Minimum").setNamespace(l.MATH).setParameters(new Map([[sB,new k(sB,D.ofNumber(sB)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sB,D.ofNumber(sB)]]))]))}}const sH="value";class sk extends e0{getSignature(){return this.signature}async internalExecute(e){return new es([Z.outputOf(new Map([[sH,Math.random()]]))])}constructor(...e){super(...e),this.signature=new ea("Random").setNamespace(l.MATH).setEvents(new Map([Q.outputEventMapEntry(j.of(sH,D.ofDouble(sH)))]))}}class s$ extends e0{static{this.MIN_VALUE="minValue"}static{this.MAX_VALUE="maxValue"}static{this.VALUE="value"}constructor(e,t,r,s,n){super(),this.signature=new ea(e).setParameters(j.of(s$.MIN_VALUE,t,s$.MAX_VALUE,r)).setNamespace(l.MATH).setEvents(new Map([Q.outputEventMapEntry(j.of(s$.VALUE,s))])),this.randomFunction=n}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(s$.MIN_VALUE),r=e.getArguments()?.get(s$.MAX_VALUE),s=this.randomFunction(t,r);return new es([Z.outputOf(new Map([[s$.VALUE,s]]))])}}class sj{constructor(){this.functionObjectsIndex={Absolute:new sC("Absolute",e=>Math.abs(e),1,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE),ArcCosine:new sC("ArcCosine",e=>Math.acos(e)),ArcSine:new sC("ArcSine",e=>Math.asin(e)),ArcTangent:new sC("ArcTangent",e=>Math.atan(e)),Ceiling:new sC("Ceiling",e=>Math.ceil(e)),Cosine:new sC("Cosine",e=>Math.cos(e)),HyperbolicCosine:new sC("HyperbolicCosine",e=>Math.cosh(e)),CubeRoot:new sC("CubeRoot",e=>Math.cbrt(e)),Exponential:new sC("Exponential",e=>Math.exp(e)),ExponentialMinus1:new sC("ExponentialMinus1",e=>Math.expm1(e)),Floor:new sC("Floor",e=>Math.floor(e)),LogNatural:new sC("LogNatural",e=>Math.log(e)),Log10:new sC("Log10",e=>Math.log10(e)),Round:new sC("Round",e=>Math.round(e),1,p.INTEGER,p.LONG),Sine:new sC("Sine",e=>Math.sin(e)),HyperbolicSine:new sC("HyperbolicSine",e=>Math.sinh(e)),Tangent:new sC("Tangent",e=>Math.tan(e)),HyperbolicTangent:new sC("HyperbolicTangent",e=>Math.tanh(e)),ToDegrees:new sC("ToDegrees",e=>Math.PI/180*e),ToRadians:new sC("ToRadians",e=>180/Math.PI*e),SquareRoot:new sC("SquareRoot",e=>Math.sqrt(e)),ArcTangent2:new sC("ArcTangent2",(e,t)=>Math.atan2(e,t),2),Power:new sC("Power",(e,t)=>Math.pow(e,t),2),Add:new sL,Hypotenuse:new sb,Maximum:new sF,Minimum:new sY,Random:new sk,RandomFloat:new s$("RandomFloat",k.of(s$.MIN_VALUE,D.ofFloat(s$.MIN_VALUE).setDefaultValue(0)),k.of(s$.MAX_VALUE,D.ofFloat(s$.MAX_VALUE).setDefaultValue(0x7fffffff)),D.ofFloat(s$.VALUE),(e,t)=>Math.random()*(t-e)+e),RandomInt:new s$("RandomInt",k.of(s$.MIN_VALUE,D.ofInteger(s$.MIN_VALUE).setDefaultValue(0)),k.of(s$.MAX_VALUE,D.ofInteger(s$.MAX_VALUE).setDefaultValue(0x7fffffff)),D.ofInteger(s$.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomLong:new s$("RandomLong",k.of(s$.MIN_VALUE,D.ofLong(s$.MIN_VALUE).setDefaultValue(0)),k.of(s$.MAX_VALUE,D.ofLong(s$.MAX_VALUE).setDefaultValue(Number.MAX_SAFE_INTEGER)),D.ofLong(s$.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomDouble:new s$("RandomDouble",k.of(s$.MIN_VALUE,D.ofDouble(s$.MIN_VALUE).setDefaultValue(0)),k.of(s$.MAX_VALUE,D.ofDouble(s$.MAX_VALUE).setDefaultValue(Number.MAX_VALUE)),D.ofDouble(s$.VALUE),(e,t)=>Math.random()*(t-e)+e)},this.filterableNames=Object.values(this.functionObjectsIndex).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=l.MATH?Promise.resolve(void 0):Promise.resolve(this.functionObjectsIndex[t])}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sW extends e0{static{this.SOURCE="source"}static{this.SCHEMA="schema"}static{this.VALUE="value"}static{this.CONVERSION_MODE="conversionMode"}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(sW.SOURCE),r=D.from(e?.getArguments()?.get(sW.SCHEMA));if(!r)throw new er("Schema is not supplied.");let s=ek(e.getArguments()?.get(sW.CONVERSION_MODE))||eH.STRICT;return this.convertToSchema(r,e.getSchemaRepository(),t,s)}async convertToSchema(e,t,r,s){try{return new es([Z.outputOf(j.of(sW.VALUE,eZ.validate([],e,t,r,!0,s)))])}catch(e){throw new er(e?.message)}}constructor(...e){super(...e),this.signature=new ea("ObjectConvert").setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(sW.SOURCE,D.ofAny(sW.SCHEMA)),k.ofEntry(sW.SCHEMA,D.SCHEMA,!1,Y.CONSTANT),k.ofEntry(sW.CONVERSION_MODE,D.ofString(sW.CONVERSION_MODE).setEnums(e$()))])).setEvents(new Map([Q.outputEventMapEntry(j.of(sW.VALUE,D.ofAny(sW.VALUE)))]))}}const sX="value",sJ="source";class sq extends e0{constructor(){super(),this.signature=new ea("ObjectDeleteKey").setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(sJ,D.ofAny(sJ)),k.ofEntry("key",D.ofString("key"))])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sX,D.ofAny(sX)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sJ),r=e.getArguments()?.get("key");return R(t)?new es([Z.outputOf(new Map([[sX,void 0]]))]):(t=ta(t),delete t[r],new es([Z.outputOf(new Map([[sX,t]]))]))}}const sz="source";class sK extends e0{constructor(e,t){super(),this.signature=new ea(e).setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(sz,D.ofAny(sz))])).setEvents(new Map([Q.outputEventMapEntry(new Map([["value",t]]))]))}getSignature(){return this.signature}}const sQ="value";class sZ extends sK{constructor(){super("ObjectEntries",D.ofArray(sQ,D.ofArray("tuple",D.ofString("key"),D.ofAny("value"))))}async internalExecute(e){var t=e.getArguments()?.get("source");if(R(t))return new es([Z.outputOf(new Map([[sQ,[]]]))]);let r=Object.entries(ta(t)).sort((e,t)=>e[0].localeCompare(t[0]));return new es([Z.outputOf(new Map([[sQ,r]]))])}}const s0="value";class s1 extends sK{constructor(){super("ObjectKeys",D.ofArray(s0,D.ofString(s0)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(R(t))return new es([Z.outputOf(new Map([[s0,[]]]))]);let r=Object.keys(ta(t)).sort((e,t)=>e.localeCompare(t));return new es([Z.outputOf(new Map([[s0,r]]))])}}const s2="value",s9="source",s3="overwrite",s4="deleteKeyOnNull";class s5 extends e0{constructor(){super(),this.signature=new ea("ObjectPutValue").setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(s9,D.ofObject(s9)),k.ofEntry("key",D.ofString("key")),k.ofEntry(s2,D.ofAny(s2)),k.ofEntry(s3,D.ofBoolean(s3).setDefaultValue(!0)),k.ofEntry(s4,D.ofBoolean(s4).setDefaultValue(!1))])).setEvents(new Map([Q.outputEventMapEntry(new Map([[s2,D.ofObject(s2)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(s9),r=e.getArguments()?.get("key"),s=e.getArguments()?.get(s2),n=e.getArguments()?.get(s3),a=e.getArguments()?.get(s4),i=new tB(t,"Data.");return i.setValue(r,s,n,a),new es([Z.outputOf(new Map([[s2,i.getStore()]]))])}}const s6="value";class s7 extends sK{constructor(){super("ObjectValues",D.ofArray(s6,D.ofAny(s6)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(R(t))return new es([Z.outputOf(new Map([[s6,[]]]))]);let r=Object.entries(ta(t)).sort((e,t)=>e[0].localeCompare(t[0])).map(e=>e[1]);return new es([Z.outputOf(new Map([[s6,r]]))])}}class s8{constructor(){this.functionObjectsIndex={ObjectValues:new s7,ObjectKeys:new s1,ObjectEntries:new sZ,ObjectDeleteKey:new sq,ObjectPutValue:new s5,ObjectConvert:new sW},this.filterableNames=Object.values(this.functionObjectsIndex).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=l.SYSTEM_OBJECT?Promise.resolve(void 0):Promise.resolve(this.functionObjectsIndex[t])}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class ne extends e0{static{this.VALUES="values"}static{this.STREAM="stream"}static{this.LOG="LOG"}static{this.ERROR="ERROR"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(ne.VALUES),r=e.getArguments()?.get(ne.STREAM);return(r===ne.LOG?console?.log:console?.error)?.(...t),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Print").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(ne.VALUES,D.ofAny(ne.VALUES),!0),k.ofEntry(ne.STREAM,D.ofString(ne.STREAM).setEnums([ne.LOG,ne.ERROR]).setDefaultValue(ne.LOG))])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}class nt extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_SEARCH_STRING_NAME="searchString"}static{this.PARAMETER_SECOND_STRING_NAME="secondString"}static{this.PARAMETER_THIRD_STRING_NAME="thirdString"}static{this.PARAMETER_INDEX_NAME="index"}static{this.PARAMETER_SECOND_INDEX_NAME="secondIndex"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nt.PARAMETER_STRING_NAME,D.ofString(nt.PARAMETER_STRING_NAME))}static{this.PARAMETER_SECOND_STRING=new k(nt.PARAMETER_SECOND_STRING_NAME,D.ofString(nt.PARAMETER_SECOND_STRING_NAME))}static{this.PARAMETER_THIRD_STRING=new k(nt.PARAMETER_THIRD_STRING_NAME,D.ofString(nt.PARAMETER_THIRD_STRING_NAME))}static{this.PARAMETER_INDEX=new k(nt.PARAMETER_INDEX_NAME,D.ofInteger(nt.PARAMETER_INDEX_NAME))}static{this.PARAMETER_SECOND_INDEX=new k(nt.PARAMETER_SECOND_INDEX_NAME,D.ofInteger(nt.PARAMETER_SECOND_INDEX_NAME))}static{this.PARAMETER_SEARCH_STRING=new k(nt.PARAMETER_SEARCH_STRING_NAME,D.ofString(nt.PARAMETER_STRING_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,j.of(nt.EVENT_RESULT_NAME,D.ofString(nt.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new Q(Q.OUTPUT,j.of(nt.EVENT_RESULT_NAME,D.ofBoolean(nt.EVENT_RESULT_NAME)))}static{this.EVENT_INT=new Q(Q.OUTPUT,j.of(nt.EVENT_RESULT_NAME,D.ofInteger(nt.EVENT_RESULT_NAME)))}static{this.EVENT_ARRAY=new Q(Q.OUTPUT,j.of(nt.EVENT_RESULT_NAME,D.ofArray(nt.EVENT_RESULT_NAME)))}constructor(e,t,r,...s){super();let n=new Map;s.forEach(e=>n.set(e.getParameterName(),e)),this.signature=new ea(t).setNamespace(e).setParameters(n).setEvents(j.of(r.getName(),r))}getSignature(){return this.signature}static ofEntryStringStringAndBooleanOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_SEARCH_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s)))])}}(l.STRING,e,nt.EVENT_BOOLEAN,nt.PARAMETER_STRING,nt.PARAMETER_SEARCH_STRING)]}static ofEntryStringIntegerAndStringOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_INDEX_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s)))])}}(l.STRING,e,nt.EVENT_STRING,nt.PARAMETER_STRING,nt.PARAMETER_INDEX)]}static ofEntryStringStringAndIntegerOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_SEARCH_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s)))])}}(l.STRING,e,nt.EVENT_INT,nt.PARAMETER_STRING,nt.PARAMETER_SEARCH_STRING)]}static ofEntryStringAndStringOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r)))])}}(l.STRING,e,nt.EVENT_STRING,nt.PARAMETER_STRING)]}static ofEntryStringAndBooleanOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r)))])}}(l.STRING,e,nt.EVENT_BOOLEAN,nt.PARAMETER_STRING)]}static ofEntryStringStringIntegerAndIntegerOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_SEARCH_STRING_NAME),n=e?.getArguments()?.get(nt.PARAMETER_INDEX_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s,n)))])}}(l.STRING,e,nt.EVENT_INT,nt.PARAMETER_STRING,nt.PARAMETER_SEARCH_STRING,nt.PARAMETER_INDEX)]}static ofEntryStringIntegerIntegerAndStringOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_INDEX_NAME),n=e?.getArguments()?.get(nt.PARAMETER_SECOND_INDEX_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s,n)))])}}(l.STRING,e,nt.EVENT_STRING,nt.PARAMETER_STRING,nt.PARAMETER_INDEX,nt.PARAMETER_SECOND_INDEX)]}static ofEntryStringStringStringAndStringOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_SECOND_STRING_NAME),n=e?.getArguments()?.get(nt.PARAMETER_THIRD_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s,n)))])}}(l.STRING,e,nt.EVENT_STRING,nt.PARAMETER_STRING,nt.PARAMETER_SECOND_STRING,nt.PARAMETER_THIRD_STRING)]}static ofEntryStringAndIntegerOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r)))])}}(l.STRING,e,nt.EVENT_INT,nt.PARAMETER_STRING)]}}class nr extends e0{static{this.VALUE="value"}constructor(){super(),this.signature=new ea("Concatenate").setNamespace(l.STRING).setParameters(new Map([[nr.VALUE,new k(nr.VALUE,new D().setName(nr.VALUE).setType(new w(p.STRING))).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[nr.VALUE,D.ofString(nr.VALUE)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nr.VALUE),r="";return t.reduce((e,t)=>r=e+t,r),new es([Z.outputOf(new Map([[nr.VALUE,r]]))])}}class ns extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_START_NAME="startPosition"}static{this.PARAMETER_AT_END_NAME="endPosition"}static{this.EVENT_RESULT_NAME="result"}constructor(){super(),this.PARAMETER_STRING=new k(ns.PARAMETER_STRING_NAME,D.ofString(ns.PARAMETER_STRING_NAME)),this.PARAMETER_AT_START=new k(ns.PARAMETER_AT_START_NAME,D.ofInteger(ns.PARAMETER_AT_START_NAME)),this.PARAMETER_AT_END=new k(ns.PARAMETER_AT_END_NAME,D.ofInteger(ns.PARAMETER_AT_END_NAME)),this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[ns.EVENT_RESULT_NAME,D.ofString(ns.EVENT_RESULT_NAME)]])),this.signature=new ea("DeleteForGivenLength").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_START.getParameterName(),this.PARAMETER_AT_START],[this.PARAMETER_AT_END.getParameterName(),this.PARAMETER_AT_END]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(ns.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(ns.PARAMETER_AT_START_NAME),s=e?.getArguments()?.get(ns.PARAMETER_AT_END_NAME);if(s>=r){let e="";return e+=t.substring(0,r),e+=t.substring(s),new es([Z.outputOf(new Map([[ns.EVENT_RESULT_NAME,e.toString()]]))])}return new es([Z.outputOf(new Map([[ns.EVENT_RESULT_NAME,t]]))])}}class nn extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_POSITION_NAME="position"}static{this.PARAMETER_INSERT_STRING_NAME="insertString"}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(nn.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nn.PARAMETER_AT_POSITION_NAME),s=e?.getArguments()?.get(nn.PARAMETER_INSERT_STRING_NAME),n="";return n+=t.substring(0,r),n+=s,n+=t.substring(r),new es([Z.outputOf(new Map([[this.EVENT_RESULT_NAME,n]]))])}constructor(...e){super(...e),this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new k(nn.PARAMETER_STRING_NAME,D.ofString(nn.PARAMETER_STRING_NAME)),this.PARAMETER_AT_POSITION=new k(nn.PARAMETER_AT_POSITION_NAME,D.ofInteger(nn.PARAMETER_AT_POSITION_NAME)),this.PARAMETER_INSERT_STRING=new k(nn.PARAMETER_INSERT_STRING_NAME,D.ofString(nn.PARAMETER_INSERT_STRING_NAME)),this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[this.EVENT_RESULT_NAME,D.ofString(this.EVENT_RESULT_NAME)]])),this.signature=new ea("InsertAtGivenPosition").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_POSITION.getParameterName(),this.PARAMETER_AT_POSITION],[this.PARAMETER_INSERT_STRING.getParameterName(),this.PARAMETER_INSERT_STRING]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,D.ofString(this.EVENT_RESULT_NAME)]]))]))}}class na extends e0{static{this.PARAMETER_REGEX_NAME="regex"}static{this.PARAMETER_STRING_NAME="string"}static{this.EVENT_RESULT_NAME="result"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(na.PARAMETER_REGEX_NAME),r=e.getArguments()?.get(na.PARAMETER_STRING_NAME);return new es([Z.outputOf(new Map([[na.EVENT_RESULT_NAME,!!r.match(t)?.length]]))])}constructor(...e){super(...e),this.signature=new ea("Matches").setNamespace(l.STRING).setParameters(j.ofEntries(j.entry(...k.ofEntry(na.PARAMETER_REGEX_NAME,D.ofString(na.PARAMETER_REGEX_NAME))),j.entry(...k.ofEntry(na.PARAMETER_STRING_NAME,D.ofString(na.PARAMETER_STRING_NAME))))).setEvents(j.ofEntries(j.entry(...Q.outputEventMapEntry(new Map([[na.EVENT_RESULT_NAME,D.ofBoolean(na.EVENT_RESULT_NAME)]])))))}}class ni extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_POSTPAD_STRING_NAME="postpadString"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(ni.PARAMETER_STRING_NAME,D.ofString(ni.PARAMETER_STRING_NAME))}static{this.PARAMETER_POSTPAD_STRING=new k(ni.PARAMETER_POSTPAD_STRING_NAME,D.ofString(ni.PARAMETER_POSTPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new k(ni.PARAMETER_LENGTH_NAME,D.ofInteger(ni.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[ni.EVENT_RESULT_NAME,D.ofString(ni.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new ea("PostPad").setNamespace(l.STRING).setParameters(new Map([[ni.PARAMETER_STRING.getParameterName(),ni.PARAMETER_STRING],[ni.PARAMETER_POSTPAD_STRING.getParameterName(),ni.PARAMETER_POSTPAD_STRING],[ni.PARAMETER_LENGTH.getParameterName(),ni.PARAMETER_LENGTH]])).setEvents(new Map([[ni.EVENT_STRING.getName(),ni.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(ni.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(ni.PARAMETER_POSTPAD_STRING_NAME),s=e.getArguments()?.get(ni.PARAMETER_LENGTH_NAME),n="",a=r.length;for(n+=t;a<=s;)n+=r,a+=r.length;return n.length-t.length<s&&(n+=r.substring(0,s-(n.length-t.length))),new es([Z.outputOf(new Map([[ni.EVENT_RESULT_NAME,n.toString()]]))])}}class no extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_PREPAD_STRING_NAME="prepadString"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(no.PARAMETER_STRING_NAME,D.ofString(no.PARAMETER_STRING_NAME))}static{this.PARAMETER_PREPAD_STRING=new k(no.PARAMETER_PREPAD_STRING_NAME,D.ofString(no.PARAMETER_PREPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new k(no.PARAMETER_LENGTH_NAME,D.ofInteger(no.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[no.EVENT_RESULT_NAME,D.ofString(no.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new ea("PrePad").setNamespace(l.STRING).setParameters(new Map([[no.PARAMETER_STRING.getParameterName(),no.PARAMETER_STRING],[no.PARAMETER_PREPAD_STRING.getParameterName(),no.PARAMETER_PREPAD_STRING],[no.PARAMETER_LENGTH.getParameterName(),no.PARAMETER_LENGTH]])).setEvents(new Map([[no.EVENT_STRING.getName(),no.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(no.PARAMETER_STRING_NAME),r=e.getArguments()?.get(no.PARAMETER_PREPAD_STRING_NAME),s=e.getArguments()?.get(no.PARAMETER_LENGTH_NAME),n="",a=r.length;for(;a<=s;)n+=r,a+=r.length;return n.length<s&&(n+=r.substring(0,s-n.length)),n+=t,new es([Z.outputOf(new Map([[no.EVENT_RESULT_NAME,n]]))])}}class nE extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_BOOLEAN_NAME="boolean"}static{this.PARAMETER_FIRST_OFFSET_NAME="firstOffset"}static{this.PARAMETER_OTHER_STRING_NAME="otherString"}static{this.PARAMETER_SECOND_OFFSET_NAME="secondOffset"}static{this.PARAMETER_INTEGER_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nE.PARAMETER_STRING_NAME,D.ofString(nE.PARAMETER_STRING_NAME))}static{this.PARAMETER_OTHER_STRING=new k(nE.PARAMETER_OTHER_STRING_NAME,D.ofString(nE.PARAMETER_OTHER_STRING_NAME))}static{this.PARAMETER_FIRST_OFFSET=new k(nE.PARAMETER_FIRST_OFFSET_NAME,D.ofInteger(nE.PARAMETER_FIRST_OFFSET_NAME))}static{this.PARAMETER_SECOND_OFFSET=new k(nE.PARAMETER_SECOND_OFFSET_NAME,D.ofInteger(nE.PARAMETER_SECOND_OFFSET_NAME))}static{this.PARAMETER_INTEGER=new k(nE.PARAMETER_INTEGER_NAME,D.ofInteger(nE.PARAMETER_INTEGER_NAME))}static{this.PARAMETER_BOOLEAN=new k(nE.PARAMETER_BOOLEAN_NAME,D.ofBoolean(nE.PARAMETER_BOOLEAN_NAME))}static{this.EVENT_BOOLEAN=new Q(Q.OUTPUT,new Map([[nE.EVENT_RESULT_NAME,D.ofBoolean(nE.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new ea("RegionMatches").setNamespace(l.STRING).setParameters(new Map([[nE.PARAMETER_STRING.getParameterName(),nE.PARAMETER_STRING],[nE.PARAMETER_BOOLEAN.getParameterName(),nE.PARAMETER_BOOLEAN],[nE.PARAMETER_FIRST_OFFSET.getParameterName(),nE.PARAMETER_FIRST_OFFSET],[nE.PARAMETER_OTHER_STRING.getParameterName(),nE.PARAMETER_OTHER_STRING],[nE.PARAMETER_SECOND_OFFSET.getParameterName(),nE.PARAMETER_SECOND_OFFSET],[nE.PARAMETER_INTEGER.getParameterName(),nE.PARAMETER_INTEGER]])).setEvents(new Map([[nE.EVENT_BOOLEAN.getName(),nE.EVENT_BOOLEAN]]))}async internalExecute(e){let t=e.getArguments()?.get(nE.PARAMETER_STRING_NAME),r=e.getArguments()?.get(nE.PARAMETER_BOOLEAN_NAME),s=e.getArguments()?.get(nE.PARAMETER_FIRST_OFFSET_NAME),n=e?.getArguments()?.get(nE.PARAMETER_OTHER_STRING_NAME),a=e?.getArguments()?.get(nE.PARAMETER_SECOND_OFFSET_NAME),i=e.getArguments()?.get(nE.PARAMETER_INTEGER_NAME),o=!1;return o=!(s<0)&&!(a<0)&&!(s+i>t.length)&&!(a+i>n.length)&&(r?(t=t.substring(s,s+i).toUpperCase())==n.substring(a,a+i).toUpperCase():(t=t.substring(s,s+i))==n.substring(a,i)),new es([Z.outputOf(new Map([[nE.EVENT_RESULT_NAME,o]]))])}}class nu extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_START_NAME="startPosition"}static{this.PARAMETER_AT_LENGTH_NAME="lengthPosition"}static{this.PARAMETER_REPLACE_STRING_NAME="replaceString"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nu.PARAMETER_STRING_NAME,D.ofString(nu.PARAMETER_STRING_NAME))}static{this.PARAMETER_AT_START=new k(nu.PARAMETER_AT_START_NAME,D.ofInteger(nu.PARAMETER_AT_START_NAME))}static{this.PARAMETER_AT_LENGTH=new k(nu.PARAMETER_AT_LENGTH_NAME,D.ofInteger(nu.PARAMETER_AT_LENGTH_NAME))}static{this.PARAMETER_REPLACE_STRING=new k(nu.PARAMETER_REPLACE_STRING_NAME,D.ofString(nu.PARAMETER_REPLACE_STRING_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[nu.EVENT_RESULT_NAME,D.ofString(nu.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new ea("ReplaceAtGivenPosition").setNamespace(l.STRING).setParameters(new Map([[nu.PARAMETER_STRING.getParameterName(),nu.PARAMETER_STRING],[nu.PARAMETER_AT_START.getParameterName(),nu.PARAMETER_AT_START],[nu.PARAMETER_AT_LENGTH.getParameterName(),nu.PARAMETER_AT_LENGTH],[nu.PARAMETER_REPLACE_STRING.getParameterName(),nu.PARAMETER_REPLACE_STRING]])).setEvents(new Map([[nu.EVENT_STRING.getName(),nu.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(nu.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nu.PARAMETER_AT_START_NAME),s=e?.getArguments()?.get(nu.PARAMETER_AT_LENGTH_NAME),n=e?.getArguments()?.get(nu.PARAMETER_REPLACE_STRING_NAME);if(t.length,r<s){let e="";e+=t.substring(0,r),e+=n,e+=t.substring(r+s)}return new es([Z.outputOf(new Map([[nu.EVENT_RESULT_NAME,t]]))])}}class nA extends e0{constructor(){super(),this.VALUE="value",this.signature=new ea("Reverse").setNamespace(l.STRING).setParameters(new Map([[this.VALUE,new k(this.VALUE,D.ofString(this.VALUE)).setVariableArgument(!1)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[this.VALUE,new D().setType(d.of(p.STRING)).setName(this.VALUE)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(this.VALUE),r=t.length-1,s="";for(;r>=0;)s+=t.charAt(r--);return new es([Z.outputOf(j.of(this.VALUE,s))])}}class nT extends e0{getSignature(){return this.signature}constructor(){super(),this.PARAMETER_STRING_NAME="string",this.PARAMETER_SPLIT_STRING_NAME="searchString",this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new k(this.PARAMETER_STRING_NAME,D.ofString(this.PARAMETER_STRING_NAME)),this.PARAMETER_SPLIT_STRING=new k(this.PARAMETER_SPLIT_STRING_NAME,D.ofString(this.PARAMETER_SPLIT_STRING_NAME)),this.EVENT_ARRAY=new Q(Q.OUTPUT,j.of(this.EVENT_RESULT_NAME,D.ofArray(this.EVENT_RESULT_NAME))),this.signature=new ea("Split").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_STRING_NAME,this.PARAMETER_STRING],[this.PARAMETER_SPLIT_STRING_NAME,this.PARAMETER_SPLIT_STRING]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,D.ofArray(this.EVENT_RESULT_NAME)]]))]))}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_STRING_NAME),r=e.getArguments()?.get(this.PARAMETER_SPLIT_STRING_NAME);return new es([Z.outputOf(j.of(this.EVENT_RESULT_NAME,t.split(r)))])}}class nl extends e0{getSignature(){return this.signature}constructor(){super(),this.PARAMETER_INPUT_ANYTYPE_NAME="anytype",this.EVENT_RESULT_NAME="result",this.PARAMETER_INPUT_ANYTYPE=new k(this.PARAMETER_INPUT_ANYTYPE_NAME,D.ofAny(this.PARAMETER_INPUT_ANYTYPE_NAME)),this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[this.EVENT_RESULT_NAME,D.ofString(this.EVENT_RESULT_NAME)]])),this.signature=new ea("ToString").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_INPUT_ANYTYPE.getParameterName(),this.PARAMETER_INPUT_ANYTYPE]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_INPUT_ANYTYPE_NAME),r="";return r="object"==typeof t?JSON.stringify(t,void 0,2):""+t,new es([Z.outputOf(new Map([[this.EVENT_RESULT_NAME,r]]))])}}class nm extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nm.PARAMETER_STRING_NAME,D.ofString(nm.PARAMETER_STRING_NAME))}static{this.PARAMETER_LENGTH=new k(nm.PARAMETER_LENGTH_NAME,D.ofInteger(nm.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[nm.EVENT_RESULT_NAME,D.ofString(nm.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new ea("TrimTo").setNamespace(l.STRING).setParameters(new Map([[nm.PARAMETER_STRING.getParameterName(),nm.PARAMETER_STRING],[nm.PARAMETER_LENGTH.getParameterName(),nm.PARAMETER_LENGTH]])).setEvents(new Map([[nm.EVENT_STRING.getName(),nm.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(nm.PARAMETER_STRING_NAME),r=e.getArguments()?.get(nm.PARAMETER_LENGTH_NAME);return new es([Z.outputOf(new Map([[nm.EVENT_RESULT_NAME,t.substring(0,r)]]))])}}class nh{async find(e,t){return e!=l.STRING?Promise.resolve(void 0):Promise.resolve(this.repoMap.get(t))}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}constructor(){this.repoMap=j.ofArrayEntries(nt.ofEntryStringAndStringOutput("Trim",e=>e.trim()),nt.ofEntryStringAndStringOutput("TrimStart",e=>e.trimStart()),nt.ofEntryStringAndStringOutput("TrimEnd",e=>e.trimEnd()),nt.ofEntryStringAndIntegerOutput("Length",e=>e.length),nt.ofEntryStringStringAndIntegerOutput("Frequency",(e,t)=>{let r=0,s=e.indexOf(t);for(;-1!=s;)r++,s=e.indexOf(t,s+1);return r}),nt.ofEntryStringAndStringOutput("LowerCase",e=>e.toLocaleLowerCase()),nt.ofEntryStringAndStringOutput("UpperCase",e=>e.toUpperCase()),nt.ofEntryStringAndBooleanOutput("IsBlank",e=>""===e.trim()),nt.ofEntryStringAndBooleanOutput("IsEmpty",e=>""===e),nt.ofEntryStringStringAndBooleanOutput("Contains",(e,t)=>-1!=e.indexOf(t)),nt.ofEntryStringStringAndBooleanOutput("EndsWith",(e,t)=>e.endsWith(t)),nt.ofEntryStringStringAndBooleanOutput("StartsWith",(e,t)=>e.startsWith(t)),nt.ofEntryStringStringAndBooleanOutput("EqualsIgnoreCase",(e,t)=>e.toUpperCase()==t.toUpperCase()),nt.ofEntryStringStringAndBooleanOutput("Matches",(e,t)=>new RegExp(t).test(e)),nt.ofEntryStringStringAndIntegerOutput("IndexOf",(e,t)=>e.indexOf(t)),nt.ofEntryStringStringAndIntegerOutput("LastIndexOf",(e,t)=>e.lastIndexOf(t)),nt.ofEntryStringIntegerAndStringOutput("Repeat",(e,t)=>e.repeat(t)),nt.ofEntryStringStringIntegerAndIntegerOutput("IndexOfWithStartPoint",(e,t,r)=>e.indexOf(t,r)),nt.ofEntryStringStringIntegerAndIntegerOutput("LastIndexOfWithStartPoint",(e,t,r)=>e.lastIndexOf(t,r)),nt.ofEntryStringStringStringAndStringOutput("Replace",(e,t,r)=>e.replaceAll(t,r)),nt.ofEntryStringStringStringAndStringOutput("ReplaceFirst",(e,t,r)=>e.replace(t,r)),nt.ofEntryStringIntegerIntegerAndStringOutput("SubString",(e,t,r)=>e.substring(t,r)),q(new nr),q(new ns),q(new nn),q(new ni),q(new no),q(new nE),q(new nu),q(new nA),q(new nT),q(new nl),q(new nm),q(new na)),this.filterableNames=Array.from(this.repoMap.values()).map(e=>e.getSignature().getFullName())}}class nR extends e0{static{this.PARAMETER_TIMESTAMP_NAME="isoTimeStamp"}static{this.PARAMETER_TIMESTAMP_NAME_ONE="isoTimeStamp1"}static{this.PARAMETER_TIMESTAMP_NAME_TWO="isoTimeStamp2"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_NUMBER_NAME="number"}static{this.PARAMETER_TIMESTAMP=new k(nR.PARAMETER_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_ONE=new k(nR.PARAMETER_TIMESTAMP_NAME_ONE,D.ofRef(l.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_TWO=new k(nR.PARAMETER_TIMESTAMP_NAME_TWO,D.ofRef(l.DATE+".Timestamp"))}static{this.PARAMETER_VARIABLE_UNIT=new k(nR.PARAMETER_UNIT_NAME,D.ofRef(l.DATE+".Timeunit")).setVariableArgument(!0)}static{this.PARAMETER_UNIT=new k(nR.PARAMETER_UNIT_NAME,D.ofRef(l.DATE+".Timeunit"))}static{this.PARAMETER_NUMBER=new k(nR.PARAMETER_NUMBER_NAME,D.ofInteger(nR.PARAMETER_NUMBER_NAME))}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_TIMESTAMP_NAME="isoTimeStamp"}static{this.EVENT_INT=new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofInteger(nR.EVENT_RESULT_NAME)))}static{this.EVENT_STRING=new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofString(nR.EVENT_RESULT_NAME)))}static{this.EVENT_LONG=new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofLong(nR.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME)))}static{this.EVENT_TIMESTAMP=new Q(Q.OUTPUT,j.of(nR.EVENT_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")))}getSignature(){return this.signature}constructor(e,t,...r){if(super(),this.signature=new ea(e).setNamespace(l.DATE).setEvents(j.of(t.getName(),t)),!r?.length)return;let s=new Map;r.forEach(e=>s.set(e.getParameterName(),e)),this.signature.setParameters(s)}static ofEntryTimestampAndIntegerOutput(e,t){return[e,new class extends nR{async internalExecute(e){return new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,t(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME))))])}}(e,nR.EVENT_INT,nR.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndBooleanOutput(e,t){return[e,new class extends nR{async internalExecute(e){return new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,t(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME))))])}}(e,nR.EVENT_BOOLEAN,nR.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndStringOutput(e,t){return[e,new class extends nR{async internalExecute(e){return new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,t(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME))))])}}(e,nR.EVENT_STRING,nR.PARAMETER_TIMESTAMP)]}static ofEntryTimestampIntegerAndTimestampOutput(e,t){return[e,new class extends nR{async internalExecute(e){return new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,t(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME),e.getArguments()?.get(nR.PARAMETER_NUMBER_NAME))))])}}(e,nR.EVENT_TIMESTAMP,nR.PARAMETER_TIMESTAMP,nR.PARAMETER_NUMBER)]}static ofEntryTimestampTimestampAndTOutput(e,t,r,...s){return[e,new class extends nR{async internalExecute(e){let t=[];return s?.length&&t.push(...s.map(t=>e.getArguments()?.get(t.getParameterName()))),new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,r(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME_ONE),e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME_TWO),t)))])}}(e,t,nR.PARAMETER_TIMESTAMP_ONE,nR.PARAMETER_TIMESTAMP_TWO,...s)]}}function ng(e){let t=(0,i.DateTime).fromISO(e,{setZone:!0});if(!t?.isValid)throw Error("Invalid ISO timestamp");return t}class nc extends nR{static{this.PARAMETER_YEARS_NAME="years"}static{this.PARAMETER_MONTHS_NAME="months"}static{this.PARAMETER_DAYS_NAME="days"}static{this.PARAMETER_HOURS_NAME="hours"}static{this.PARAMETER_MINUTES_NAME="minutes"}static{this.PARAMETER_SECONDS_NAME="seconds"}static{this.PARAMETER_MILLISECONDS_NAME="milliseconds"}constructor(e){super(e?"AddTime":"SubtractTime",nR.EVENT_TIMESTAMP,nR.PARAMETER_TIMESTAMP,k.of(nc.PARAMETER_YEARS_NAME,D.ofNumber(nc.PARAMETER_YEARS_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_MONTHS_NAME,D.ofNumber(nc.PARAMETER_MONTHS_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_DAYS_NAME,D.ofNumber(nc.PARAMETER_DAYS_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_HOURS_NAME,D.ofNumber(nc.PARAMETER_HOURS_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_MINUTES_NAME,D.ofNumber(nc.PARAMETER_MINUTES_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_SECONDS_NAME,D.ofNumber(nc.PARAMETER_SECONDS_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_MILLISECONDS_NAME,D.ofNumber(nc.PARAMETER_MILLISECONDS_NAME).setDefaultValue(0))),this.isAdd=e}async internalExecute(e){let t;let r=ng(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME)),s=e.getArguments()?.get(nc.PARAMETER_YEARS_NAME),n=e.getArguments()?.get(nc.PARAMETER_MONTHS_NAME),a=e.getArguments()?.get(nc.PARAMETER_DAYS_NAME),i=e.getArguments()?.get(nc.PARAMETER_HOURS_NAME),o={years:s,months:n,days:a,hours:i,minutes:e.getArguments()?.get(nc.PARAMETER_MINUTES_NAME),seconds:e.getArguments()?.get(nc.PARAMETER_SECONDS_NAME),milliseconds:e.getArguments()?.get(nc.PARAMETER_MILLISECONDS_NAME)};return t=this.isAdd?r.plus(o):r.minus(o),new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,t.toISO()))])}}class np extends e0{constructor(e,t){super(),this.paramName=`epoch${t?"Seconds":"Milliseconds"}`,this.isSeconds=t,this.signature=new ea(e).setNamespace(l.DATE).setParameters(new Map([[this.paramName,k.of(this.paramName,new D().setName(this.paramName).setType(d.of(p.LONG,p.INTEGER,p.STRING)))]])).setEvents(new Map([[nR.EVENT_TIMESTAMP.getName(),nR.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=parseInt(e.getArguments()?.get(this.paramName)),r=this.isSeconds?1e3*t:t;if(isNaN(r))throw Error(`Please provide a valid value for ${this.paramName}.`);return Promise.resolve(new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,new Date(r).toISOString()))]))}}class nN extends e0{constructor(e,t){super(),this.isSeconds=t,this.signature=new ea(e).setNamespace(l.DATE).setParameters(new Map([[nR.PARAMETER_TIMESTAMP_NAME,nR.PARAMETER_TIMESTAMP]])).setEvents(new Map([[nR.EVENT_TIMESTAMP.getName(),nR.EVENT_LONG]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME),r=this.isSeconds?(0,i.DateTime).fromISO(t).toSeconds():(0,i.DateTime).fromISO(t).toMillis();return Promise.resolve(new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,r))]))}}class nf extends nR{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("ToDateString",nR.EVENT_STRING,nR.PARAMETER_TIMESTAMP,k.of(nf.PARAMETER_FORMAT_NAME,D.ofString(nf.PARAMETER_FORMAT_NAME)),k.of(nf.PARAMETER_LOCALE_NAME,D.ofString(nf.PARAMETER_LOCALE_NAME).setDefaultValue("")))}async internalExecute(e){let t=ng(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(nf.PARAMETER_FORMAT_NAME),s=e.getArguments()?.get(nf.PARAMETER_LOCALE_NAME);return""===s&&(s="system"),new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,t.toFormat(r,{locale:s})))])}}class n_ extends nR{static{this.PARAMETER_TIMEZONE_NAME="timezone"}constructor(){super("SetTimeZone",nR.EVENT_TIMESTAMP,nR.PARAMETER_TIMESTAMP,k.of(n_.PARAMETER_TIMEZONE_NAME,D.ofString(n_.PARAMETER_TIMEZONE_NAME)))}async internalExecute(e){let t=ng(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(n_.PARAMETER_TIMEZONE_NAME);return new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,t.setZone(r).toISO()))])}}class nM extends nR{static{this.PARAMETER_START_TIMESTAMP_NAME="startTimestamp"}static{this.PARAMETER_END_TIMESTAMP_NAME="endTimestamp"}static{this.PARAMETER_CHECK_TIMESTAMP_NAME="checkTimestamp"}constructor(){super("IsBetween",nM.EVENT_BOOLEAN,k.of(nM.PARAMETER_START_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")),k.of(nM.PARAMETER_END_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")),k.of(nM.PARAMETER_CHECK_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")))}async internalExecute(e){let t=e.getArguments()?.get(nM.PARAMETER_START_TIMESTAMP_NAME),r=e.getArguments()?.get(nM.PARAMETER_END_TIMESTAMP_NAME),s=e.getArguments()?.get(nM.PARAMETER_CHECK_TIMESTAMP_NAME),n=ng(t),a=ng(r),i=ng(s);return n>a&&([n,a]=[a,n]),new es([Z.outputOf(j.of(nM.EVENT_RESULT_NAME,n<=i&&i<=a))])}}class nS extends e0{constructor(e){super(),this.isLast=e,this.signature=new ea(e?"LastOf":"FirstOf").setNamespace(l.DATE).setParameters(new Map([[nR.PARAMETER_TIMESTAMP_NAME,new k(nR.PARAMETER_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")).setVariableArgument(!0)]])).setEvents(new Map([[nR.EVENT_TIMESTAMP.getName(),nR.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME);if(!t?.length)throw Error("No timestamps provided");let r=t.map(e=>ng(e));return r.sort((e,t)=>e.toMillis()-t.toMillis()),Promise.resolve(new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,r[this.isLast?r.length-1:0].toISO()))]))}}class nO extends nR{static{this.EVENT_TIME_OBJECT_NAME="object"}static{this.EVENT_TIME_ARRAY_NAME="array"}constructor(e){super(e?"TimeAsArray":"TimeAsObject",new Q(Q.OUTPUT,j.of(e?nO.EVENT_TIME_ARRAY_NAME:nO.EVENT_TIME_OBJECT_NAME,e?D.ofArray(nO.EVENT_TIME_ARRAY_NAME,D.ofInteger("timeParts")):D.ofRef(l.DATE+".TimeObject"))),nR.PARAMETER_TIMESTAMP),this.isArray=e}async internalExecute(e){let t=ng(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME)).toObject();return new es([Z.outputOf(j.of(this.isArray?nO.EVENT_TIME_ARRAY_NAME:nO.EVENT_TIME_OBJECT_NAME,this.isArray?[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond]:t))])}}class nw extends nR{constructor(e){super(e?"StartOf":"EndOf",nR.EVENT_TIMESTAMP,nR.PARAMETER_TIMESTAMP,nR.PARAMETER_UNIT),this.isStart=e}async internalExecute(e){let t=ng(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(nR.PARAMETER_UNIT_NAME)?.toLowerCase();r=r.substring(0,r.length-1);let s=this.isStart?t.startOf(r):t.endOf(r);return new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,s.toISO({includeOffset:!0})))])}}class nd extends nR{static{this.EVENT_NAMES_NAME="names"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("GetNames",new Q(nd.EVENT_NAMES_NAME,j.of(nd.EVENT_NAMES_NAME,D.ofArray(nd.EVENT_NAMES_NAME,D.ofString(nd.EVENT_NAMES_NAME)))),new k(nd.PARAMETER_UNIT_NAME,D.ofString(nd.PARAMETER_UNIT_NAME).setEnums(["TIMEZONES","MONTHS","WEEKDAYS"])),new k(nd.PARAMETER_LOCALE_NAME,D.ofString(nd.PARAMETER_LOCALE_NAME).setDefaultValue("system")))}async internalExecute(e){let t=e.getArguments()?.get(nd.PARAMETER_UNIT_NAME),r=e.getArguments()?.get(nd.PARAMETER_LOCALE_NAME);return new es([Z.outputOf(j.of(nd.EVENT_NAMES_NAME,this.getNames(t,r)))])}getNames(e,t){return"TIMEZONES"===e?Intl.supportedValuesOf("timeZone"):"MONTHS"===e?[1,2,3,4,5,6,7,8,9,10,11,12].map(e=>(0,i.DateTime).now().setLocale(t).set({month:e}).toFormat("MMMM")):"WEEKDAYS"===e?[1,2,3,4,5,6,7].map(e=>(0,i.DateTime).now().setLocale(t).set({month:7,day:e}).toFormat("EEEE")):[]}}class nP extends e0{internalExecute(e){let t=e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME),r=(0,i.DateTime).fromISO(t);return Promise.resolve(new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,r.isValid))]))}getSignature(){return this.signature}constructor(...e){super(...e),this.signature=new ea("IsValidISODate").setNamespace(l.DATE).setParameters(new Map([k.ofEntry(nR.PARAMETER_TIMESTAMP_NAME,D.ofString(nR.PARAMETER_TIMESTAMP_NAME))])).setEvents(new Map([Q.outputEventMapEntry(j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME)))]))}}class nI extends nR{static{this.PARAMETER_BASE_NAME="base"}static{this.PARAMETER_BASE=new k(nI.PARAMETER_BASE_NAME,D.ofRef(l.DATE+".Timestamp").setDefaultValue(""))}static{this.PARAMETER_LOCALE_NAME="locale"}static{this.PARAMETER_LOCALE=new k(nI.PARAMETER_LOCALE_NAME,D.ofString(nI.PARAMETER_LOCALE_NAME).setDefaultValue("system"))}static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_FORMAT=new k(nI.PARAMETER_FORMAT_NAME,D.ofString(nI.PARAMETER_FORMAT_NAME).setEnums(["LONG","SHORT","NARROW"]).setDefaultValue("LONG"))}static{this.PARAMETER_ROUND_NAME="round"}static{this.PARAMETER_ROUND=new k(nI.PARAMETER_ROUND_NAME,D.ofBoolean(nI.PARAMETER_ROUND_NAME).setDefaultValue(!0))}constructor(){super("FromNow",nR.EVENT_STRING,nR.PARAMETER_TIMESTAMP,nI.PARAMETER_FORMAT,nI.PARAMETER_BASE,nR.PARAMETER_VARIABLE_UNIT,nI.PARAMETER_ROUND,nI.PARAMETER_LOCALE)}internalExecute(e){let t=e.getArguments()?.get(nI.PARAMETER_BASE_NAME),r=""===t?(0,i.DateTime).now():(0,i.DateTime).fromISO(t),s=e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME),n=(0,i.DateTime).fromISO(s),a=e.getArguments()?.get(nI.PARAMETER_UNIT_NAME),o=e.getArguments()?.get(nI.PARAMETER_FORMAT_NAME),E=e.getArguments()?.get(nI.PARAMETER_ROUND_NAME),u=e.getArguments()?.get(nI.PARAMETER_LOCALE_NAME),A={base:r,style:o?.toLowerCase(),round:E,locale:u};return a?.length>0&&(A.unit=a.map(e=>e.toLowerCase())),Promise.resolve(new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,n.toRelative(A)??"Unknown"))]))}}class ny extends nR{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_TIMESTAMP_STRING_NAME="timestampString"}constructor(){super("FromDateString",nR.EVENT_TIMESTAMP,k.of(ny.PARAMETER_TIMESTAMP_STRING_NAME,D.ofString(ny.PARAMETER_TIMESTAMP_STRING_NAME)),k.of(ny.PARAMETER_FORMAT_NAME,D.ofString(ny.PARAMETER_FORMAT_NAME)))}async internalExecute(e){let t=e.getArguments()?.get(ny.PARAMETER_TIMESTAMP_STRING_NAME),r=e.getArguments()?.get(ny.PARAMETER_FORMAT_NAME),s=(0,i.DateTime).fromFormat(t,r);return new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,s.toISO()))])}}class nx extends nR{constructor(){super("GetCurrentTimestamp",nR.EVENT_TIMESTAMP)}async internalExecute(e){return new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,(0,i.DateTime).now().toISO()))])}}class nL{find(e,t){return e!=l.DATE?Promise.resolve(void 0):Promise.resolve(this.repoMap.get(t))}filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}constructor(){this.repoMap=j.ofArrayEntries(["EpochSecondsToTimestamp",new np("EpochSecondsToTimestamp",!0)],["EpochMillisecondsToTimestamp",new np("EpochMillisecondsToTimestamp",!1)],nR.ofEntryTimestampAndIntegerOutput("GetDay",e=>ng(e).day),nR.ofEntryTimestampAndIntegerOutput("GetDayOfWeek",e=>ng(e).weekday),nR.ofEntryTimestampAndIntegerOutput("GetMonth",e=>ng(e).month),nR.ofEntryTimestampAndIntegerOutput("GetYear",e=>ng(e).year),nR.ofEntryTimestampAndIntegerOutput("GetHours",e=>ng(e).hour),nR.ofEntryTimestampAndIntegerOutput("GetMinutes",e=>ng(e).minute),nR.ofEntryTimestampAndIntegerOutput("GetSeconds",e=>ng(e).second),nR.ofEntryTimestampAndIntegerOutput("GetMilliseconds",e=>ng(e).millisecond),nR.ofEntryTimestampAndIntegerOutput("GetDaysInMonth",e=>ng(e).daysInMonth),nR.ofEntryTimestampAndIntegerOutput("GetDaysInYear",e=>ng(e).daysInYear),["TimestampToEpochSeconds",new nN("TimestampToEpochSeconds",!0)],["TimestampToEpochMilliseconds",new nN("TimestampToEpochMilliseconds",!1)],nR.ofEntryTimestampAndStringOutput("GetTimeZoneName",e=>ng(e).zoneName),nR.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetLong",e=>ng(e).offsetNameLong),nR.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetShort",e=>ng(e).offsetNameShort),nR.ofEntryTimestampAndIntegerOutput("GetTimeZoneOffset",e=>ng(e).offset),["ToDateString",new nf],["AddTime",new nc(!0)],["SubtractTime",new nc(!1)],["GetCurrentTimestamp",new nx],nR.ofEntryTimestampTimestampAndTOutput("Difference",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofRef(`${l.DATE}.Duration`))),(e,t,r)=>{let s;let n=ng(e),a=ng(t);r?.[0]?.length&&(s=r[0]?.filter(e=>!!e).map(e=>e.toLowerCase()));let i=n.diff(a);return s?.length?i.shiftTo(...s).toObject():i.toObject()},nR.PARAMETER_VARIABLE_UNIT),nR.ofEntryTimestampIntegerAndTimestampOutput("SetDay",(e,t)=>ng(e).set({day:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetMonth",(e,t)=>ng(e).set({month:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetYear",(e,t)=>ng(e).set({year:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetHours",(e,t)=>ng(e).set({hour:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetMinutes",(e,t)=>ng(e).set({minute:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetSeconds",(e,t)=>ng(e).set({second:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetMilliseconds",(e,t)=>ng(e).set({millisecond:t}).toISO()),["SetTimeZone",new n_],nR.ofEntryTimestampTimestampAndTOutput("IsBefore",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME))),(e,t)=>ng(e)<ng(t)),nR.ofEntryTimestampTimestampAndTOutput("IsAfter",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME))),(e,t)=>ng(e)>ng(t)),nR.ofEntryTimestampTimestampAndTOutput("IsSame",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME))),(e,t)=>ng(e)===ng(t)),nR.ofEntryTimestampTimestampAndTOutput("IsSameOrBefore",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME))),(e,t)=>ng(e)<=ng(t)),nR.ofEntryTimestampTimestampAndTOutput("IsSameOrAfter",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME))),(e,t)=>ng(e)>=ng(t)),nR.ofEntryTimestampAndBooleanOutput("IsInLeapYear",e=>ng(e).isInLeapYear),nR.ofEntryTimestampAndBooleanOutput("IsInDST",e=>ng(e).isInDST),["IsBetween",new nM],["LastOf",new nS(!0)],["FirstOf",new nS(!1)],["StartOf",new nw(!0)],["EndOf",new nw(!1)],["TimeAsObject",new nO(!1)],["TimeAsArray",new nO(!0)],["GetNames",new nd],["IsValidISODate",new nP],["FromNow",new nI],["FromDateString",new ny]),this.filterableNames=Array.from(this.repoMap.values()).map(e=>e.getSignature().getFullName())}}class nv extends e0{static{this.MILLIS="millis"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nv.MILLIS);return await new Promise(e=>setTimeout(e,t)),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Wait").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(nv.MILLIS,D.ofNumber(nv.MILLIS).setMinimum(0).setDefaultValue(0))])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}var nU={};E(nU,"HybridRepository",()=>nV);class nV{constructor(...e){this.repos=e}async find(e,t){for(let r of this.repos){let s=await r.find(e,t);if(s)return s}}async filter(e){let t=new Set;for(let r of this.repos)(await r.filter(e)).forEach(e=>t.add(e));return Array.from(t)}}class nC{constructor(){this.map=new Map([[l.SYSTEM_CTX,new Map([q(new t7),q(new rt),q(new sE)])],[l.SYSTEM_LOOP,new Map([q(new sy),q(new sN),q(new sR),q(new sO)])],[l.SYSTEM,new Map([q(new sm),q(new sl),q(new ne),q(new nv),q(new t2)])]]),this.filterableNames=Array.from(this.map.values()).flatMap(e=>Array.from(e.values())).map(e=>e.getSignature().getFullName())}async find(e,t){return this.map.get(e)?.get(t)}async filter(e){return Array.from(this.filterableNames).filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase()))}}class nD extends nV{constructor(){super(new nC,new sj,new nh,new t9,new s8,new nL)}}var nb={};E(nb,"StatementExecution",()=>nB);var nG={};E(nG,"StatementMessage",()=>nF);class nF{constructor(e,t){this.message=t,this.messageType=e}getMessageType(){return this.messageType}setMessageType(e){return this.messageType=e,this}getMessage(){return this.message}setMessage(e){return this.message=e,this}toString(){return`${this.messageType} : ${this.message}`}}class nB{constructor(e){this.messages=[],this.dependencies=new Set,this.statement=e}getStatement(){return this.statement}setStatement(e){return this.statement=e,this}getMessages(){return this.messages}setMessages(e){return this.messages=e,this}getDependencies(){return this.dependencies}setDependencies(e){return this.dependencies=e,this}getUniqueKey(){return this.statement.getStatementName()}addMessage(e,t){this.messages.push(new nF(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){return e instanceof nB&&e.statement.equals(this.statement)}}var nY={};E(nY,"ContextTokenValueExtractor",()=>nH);class nH extends tF{static{this.PREFIX="Context."}constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.context.get(r)?.getElement())}getPrefix(){return nH.PREFIX}getStore(){return R(this.context)?this.context:Array.from(this.context.entries()).reduce((e,[t,r])=>(R(r)||(e[t]=r.getElement()),e),{})}}var nk={};E(nk,"OutputMapTokenValueExtractor",()=>n$);class n$ extends tF{static{this.PREFIX="Steps."}constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=1,s=this.output.get(t[r++]);if(!s||r>=t.length)return;let n=s.get(t[r++]);if(!n||r>t.length)return;if(r===t.length)return n;let a=t[r].indexOf("[");if(-1===a){let s=n.get(t[r++]);return this.retrieveElementFrom(e,t,r,s)}let i=t[r].substring(0,a),o=n.get(i);return this.retrieveElementFrom(e,t,r,{[i]:o})}getPrefix(){return n$.PREFIX}getStore(){return this.convertMapToObj(this.output)}convertMapToObj(e){return 0===e.size?{}:Array.from(e.entries()).reduce((e,[t,r])=>(e[t]=r instanceof Map?this.convertMapToObj(r):r,e),{})}}var nj={};E(nj,"ArgumentsTokenValueExtractor",()=>nW);class nW extends tF{static{this.PREFIX="Arguments."}constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.args.get(r))}getPrefix(){return nW.PREFIX}getStore(){return R(this.args)?this.args:Array.from(this.args.entries()).reduce((e,[t,r])=>(e[t]=r,e),{})}}var nX={};E(nX,"GraphVertex",()=>nz);var nJ={};E(nJ,"ExecutionGraph",()=>nq);class nq{constructor(e=!1){this.nodeMap=new Map,this.isSubGrph=e}getVerticesData(){return Array.from(this.nodeMap.values()).map(e=>e.getData())}addVertex(e){if(!this.nodeMap.has(e.getUniqueKey())){let t=new nz(this,e);this.nodeMap.set(e.getUniqueKey(),t)}return this.nodeMap.get(e.getUniqueKey())}getVertex(e){return this.nodeMap.get(e)}getVertexData(e){if(this.nodeMap.has(e))return this.nodeMap.get(e).getData()}getVerticesWithNoIncomingEdges(){return Array.from(this.nodeMap.values()).filter(e=>!e.hasIncomingEdges())}isCyclic(){let e,t=new el(this.getVerticesWithNoIncomingEdges()),r=new Set;for(;!t.isEmpty();){if(r.has(t.getFirst().getKey()))return!0;e=t.removeFirst(),r.add(e.getKey()),e.hasOutgoingEdges()&&t.addAll(Array.from(e.getOutVertices().values()).flatMap(e=>Array.from(e)))}return!1}addVertices(e){for(let t of e)this.addVertex(t)}getNodeMap(){return this.nodeMap}isSubGraph(){return this.isSubGrph}toString(){return"Execution Graph : \n"+Array.from(this.nodeMap.values()).map(e=>e.toString()).join("\n")}}class nz{constructor(e,t){this.outVertices=new Map,this.inVertices=new Set,this.data=t,this.graph=e}getData(){return this.data}setData(e){return this.data=e,this}getOutVertices(){return this.outVertices}setOutVertices(e){return this.outVertices=e,this}getInVertices(){return this.inVertices}setInVertices(e){return this.inVertices=e,this}getGraph(){return this.graph}setGraph(e){return this.graph=e,this}getKey(){return this.data.getUniqueKey()}addOutEdgeTo(e,t){return this.outVertices.has(e)||this.outVertices.set(e,new Set),this.outVertices.get(e).add(t),t.inVertices.add(new eN(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new eN(e,t)),e.outVertices.has(t)||e.outVertices.set(t,new Set),e.outVertices.get(t).add(this),e}hasIncomingEdges(){return!!this.inVertices.size}hasOutgoingEdges(){return!!this.outVertices.size}getSubGraphOfType(e){let t=new nq(!0);var r=new el(Array.from(this.outVertices.get(e)??[]));for(r.map(e=>e.getData()).forEach(e=>t.addVertex(e));!r.isEmpty();)Array.from(r.pop().outVertices.values()).flatMap(e=>Array.from(e)).forEach(e=>{t.addVertex(e.getData()),r.add(e)});return t}toString(){var e=Array.from(this.getInVertices()).map(e=>e.getT1().getKey()+"("+e.getT2()+")").join(", "),t=Array.from(this.outVertices.entries()).map(([e,t])=>e+": "+Array.from(t).map(e=>e.getKey()).join(",")).join("\n ");return this.getKey()+":\n In: "+e+"\n Out: \n "+t}}var nK={};E(nK,"KIRuntime",()=>n6);var nQ={};E(nQ,"JsonExpression",()=>nZ);class nZ{constructor(e){this.expression=e}getExpression(){return this.expression}}var n0={};E(n0,"ParameterReferenceType",()=>n1);var n1=((n={}).VALUE="VALUE",n.EXPRESSION="EXPRESSION",n),n2={};function n9(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|8).toString(16)})}E(n2,"FunctionExecutionParameters",()=>n3);class n3{constructor(e,t,r){this.count=0,this.executionContext=new Map,this.valueExtractors=new Map,this.functionRepository=e,this.schemaRepository=t,this.executionId=r??n9()}getExecutionId(){return this.executionId}getContext(){return this.context}setContext(e){this.context=e;let t=new nH(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){return this.args=e,this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getStatementExecution(){return this.statementExecution}setStatementExecution(e){return this.statementExecution=e,this}getSteps(){return this.steps}setSteps(e){this.steps=e;let t=new n$(e);return this.valueExtractors.set(t.getPrefix(),t),this}getCount(){return this.count}setCount(e){return this.count=e,this}getValuesMap(){return this.valueExtractors}getFunctionRepository(){return this.functionRepository}setFunctionRepository(e){return this.functionRepository=e,this}getSchemaRepository(){return this.schemaRepository}setSchemaRepository(e){return this.schemaRepository=e,this}addTokenValueExtractor(...e){for(let t of e)this.valueExtractors.set(t.getPrefix(),t);return this}setValuesMap(e){for(let[t,r]of e.entries())this.valueExtractors.set(t,r);return this}setExecutionContext(e){return this.executionContext=e,this}getExecutionContext(){return this.executionContext}}var n4={};E(n4,"StatementMessageType",()=>n5);var n5=((a={}).ERROR="ERROR",a.WARNING="WARNING",a.MESSAGE="MESSAGE",a);class n6 extends e0{static{this.PARAMETER_NEEDS_A_VALUE='Parameter "$" needs a value'}static{this.STEP_REGEX_PATTERN=RegExp("Steps\\.([a-zA-Z0-9\\\\-]{1,})\\.([a-zA-Z0-9\\\\-]{1,})","g")}static{this.VERSION=1}static{this.MAX_EXECUTION_ITERATIONS=1e7}constructor(e,t=!1){if(super(),this.debugMode=!1,this.debugMode=t,this.fd=e,this.fd.getVersion()>n6.VERSION)throw new er("Runtime is at a lower version "+n6.VERSION+" and trying to run code from version "+this.fd.getVersion()+".")}getSignature(){return this.fd}async getExecutionPlan(e,t){let r=new nq;for(let s of Array.from(this.fd.getSteps().values()))r.addVertex(await this.prepareStatementExecution(s,e,t));return Array.from(this.makeEdges(r).getT2().entries()).forEach(e=>{let t=r.getNodeMap().get(e[0])?.getData();t&&t.addMessage(n5.ERROR,e[1])}),r}async internalExecute(e){e.getContext()||e.setContext(new Map),e.getEvents()||e.setEvents(new Map),e.getSteps()||e.setSteps(new Map),e.getArguments()&&e.addTokenValueExtractor(new nW(e.getArguments())),this.debugMode&&(console.log(`EID: ${e.getExecutionId()} Executing: ${this.fd.getNamespace()}.${this.fd.getName()}`),console.log(`EID: ${e.getExecutionId()} Parameters: `,e));let t=await this.getExecutionPlan(e.getFunctionRepository(),e.getSchemaRepository());this.debugMode&&console.log(`EID: ${e.getExecutionId()} ${t?.toString()}`);let r=t.getVerticesData().filter(e=>e.getMessages().length).map(e=>e.getStatement().getStatementName()+": \n"+e.getMessages().join(","));if(r?.length)throw new er("Please fix the errors in the function definition before execution : \n"+r.join(",\n"));return await this.executeGraph(t,e)}async executeGraph(e,t){let r=new el;r.addAll(e.getVerticesWithNoIncomingEdges());let s=new el;for(;(!r.isEmpty()||!s.isEmpty())&&!t.getEvents()?.has(Q.OUTPUT);)if(await this.processBranchQue(t,r,s),await this.processExecutionQue(t,r,s),t.setCount(t.getCount()+1),t.getCount()==n6.MAX_EXECUTION_ITERATIONS)throw new er("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size){let e=this.getSignature().getEvents();if(e.size&&e.get(Q.OUTPUT)?.getParameters()?.size)throw new er("No events raised")}let n=Array.from(t.getEvents()?.entries()??[]).flatMap(e=>e[1].map(t=>Z.of(e[0],t)));return new es(n.length||e.isSubGraph()?n:[Z.of(Q.OUTPUT,new Map)])}async processExecutionQue(e,t,r){if(!t.isEmpty()){let s=t.pop();await this.allDependenciesResolvedVertex(s,e.getSteps())?await this.executeVertex(s,e,r,t,e.getFunctionRepository()):t.add(s)}}async processBranchQue(e,t,r){if(r.length){let s=r.pop();await this.allDependenciesResolvedTuples(s.getT2(),e.getSteps())?await this.executeBranch(e,t,s):r.add(s)}}async executeBranch(e,t,r){let s,n=r.getT4();do if(r.getT1().getVerticesData().map(e=>e.getStatement().getStatementName()).forEach(t=>e.getSteps()?.delete(t)),await this.executeGraph(r.getT1(),e),(s=r.getT3().next())&&(e.getSteps()?.has(n.getData().getStatement().getStatementName())||e.getSteps()?.set(n.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(n.getData().getStatement().getStatementName())?.set(s.getName(),this.resolveInternalExpressions(s.getResult(),e)),this.debugMode)){let t=n.getData().getStatement();console.log(`EID: ${e.getExecutionId()} Step : ${t.getStatementName()} => ${t.getNamespace()}.${t.getName()}`),console.log(`EID: ${e.getExecutionId()} Event : ${s.getName()} : `,e.getSteps().get(t.getStatementName()).get(s.getName()))}while(s&&s.getName()!=Q.OUTPUT)s?.getName()==Q.OUTPUT&&n.getOutVertices().has(Q.OUTPUT)&&(n?.getOutVertices()?.get(Q.OUTPUT)??[]).forEach(async r=>{await this.allDependenciesResolvedVertex(r,e.getSteps())&&t.add(r)})}async executeVertex(e,t,r,s,n){let a,i=e.getData().getStatement();if(i.getExecuteIftrue().size&&!(Array.from(i.getExecuteIftrue().entries())??[]).filter(e=>e[1]).map(([e])=>new sa(e).evaluate(t.getValuesMap())).every(e=>!R(e)&&!1!==e))return;let o=await n.find(i.getNamespace(),i.getName());if(!o)throw new er(eT.format("$.$ function is not found.",i.getNamespace(),i.getName()));let E=o?.getSignature().getParameters(),u=this.getArgumentsFromParametersMap(t,i,E??new Map);this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Arguments : `,u));let A=t.getContext();a=o instanceof n6?new n3(t.getFunctionRepository(),t.getSchemaRepository(),`${t.getExecutionId()}_${i.getStatementName()}`).setArguments(u).setValuesMap(new Map(Array.from(t.getValuesMap().values()).filter(e=>e.getPrefix()!==nW.PREFIX&&e.getPrefix()!==n$.PREFIX&&e.getPrefix()!==nH.PREFIX).map(e=>[e.getPrefix(),e]))):new n3(t.getFunctionRepository(),t.getSchemaRepository(),t.getExecutionId()).setValuesMap(t.getValuesMap()).setContext(A).setArguments(u).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount()).setExecutionContext(t.getExecutionContext());let T=await o.execute(a),l=T.next();if(!l)throw new er(eT.format("Executing $ returned no events",i.getStatementName()));let m=l.getName()==Q.OUTPUT;if(t.getSteps()?.has(i.getStatementName())||t.getSteps().set(i.getStatementName(),new Map),t.getSteps().get(i.getStatementName()).set(l.getName(),this.resolveInternalExpressions(l.getResult(),t)),this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Event : ${l.getName()} : `,t.getSteps().get(i.getStatementName()).get(l.getName()))),m){let r=e.getOutVertices().get(Q.OUTPUT);r&&r.forEach(async e=>{await this.allDependenciesResolvedVertex(e,t.getSteps())&&s.add(e)})}else{let t=e.getSubGraphOfType(l.getName()),s=this.makeEdges(t).getT1();r.push(new e_(t,s,T,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map(e=>new eN(e[0],this.resolveInternalExpression(e[1],t))).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map):e}resolveInternalExpression(e,t){if(R(e)||"object"!=typeof e)return e;if(e instanceof nZ)return new sa(e.getExpression()).evaluate(t.getValuesMap());if(Array.isArray(e)){let r=[];for(let s of e)r.push(this.resolveInternalExpression(s,t));return r}if("object"==typeof e){let r={};for(let s of Object.entries(e))r[s[0]]=this.resolveInternalExpression(s[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e)if(!t.has(r.getT1())||!t.get(r.getT1())?.get(r.getT2()))return!1;return!0}allDependenciesResolvedVertex(e,t){return!e.getInVertices().size||0==Array.from(e.getInVertices()).filter(e=>{let r=e.getT1().getData().getStatement().getStatementName(),s=e.getT2();return!(t.has(r)&&t.get(r)?.has(s))}).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map(t=>{let s,n=Array.from(t[1]?.values()??[]);if(!n?.length)return new eN(t[0],s);let a=r.get(t[0]);return a?(s=a.isVariableArgument()?n.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)).filter(e=>!R(e)).map(t=>this.parameterReferenceEvaluation(e,t)).flatMap(e=>Array.isArray(e)?e:[e]):this.parameterReferenceEvaluation(e,n[0]),new eN(t[0],s)):new eN(t[0],void 0)}).filter(e=>!R(e.getT2())).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map)}parameterReferenceEvaluation(e,t){let r;return t.getType()==n1.VALUE?r=this.resolveInternalExpression(t.getValue(),e):t.getType()!=n1.EXPRESSION||eg.isNullOrBlank(t.getExpression())||(r=new sa(t.getExpression()??"").evaluate(e.getValuesMap())),r}async prepareStatementExecution(e,t,r){let s=new nB(e),n=await t.find(e.getNamespace(),e.getName());if(!n)return s.addMessage(n5.ERROR,eT.format("$.$ is not available",e.getNamespace(),e.getName())),Promise.resolve(s);let a=new Map(n.getSignature().getParameters());if(!e.getParameterMap())return Promise.resolve(s);for(let t of Array.from(e.getParameterMap().entries())){let e=a.get(t[0]);if(!e)continue;let n=Array.from(t[1]?.values()??[]);if(!n.length&&!e.isVariableArgument()){await eO.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||s.addMessage(n5.ERROR,eT.format(n6.PARAMETER_NEEDS_A_VALUE,e.getParameterName())),a.delete(e.getParameterName());continue}if(e.isVariableArgument())for(let t of(n.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)),n))this.parameterReferenceValidation(s,e,t,r);else if(n.length){let t=n[0];this.parameterReferenceValidation(s,e,t,r)}a.delete(e.getParameterName())}if(!R(s.getStatement().getDependentStatements()))for(let e of Array.from(s.getStatement().getDependentStatements().entries()))e[1]&&s.addDependency(e[0]);if(!R(s.getStatement().getExecuteIftrue()))for(let e of Array.from(s.getStatement().getExecuteIftrue().entries()))e[1]&&this.addDependencies(s,e[0]);if(a.size)for(let e of Array.from(a.values()))e.isVariableArgument()||await eO.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||s.addMessage(n5.ERROR,eT.format(n6.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return Promise.resolve(s)}async parameterReferenceValidation(e,t,r,s){if(r){if(r.getType()==n1.VALUE){if(R(r.getValue())&&!await eO.hasDefaultValueOrNullSchemaType(t.getSchema(),s)&&e.addMessage(n5.ERROR,eT.format(n6.PARAMETER_NEEDS_A_VALUE,t.getParameterName())),R(r.getValue()))return;let n=new el;for(n.push(new eN(t.getSchema(),r.getValue()));!n.isEmpty();){let t=n.pop();if(t.getT2()instanceof nZ)this.addDependencies(e,t.getT2().getExpression());else{if(R(t.getT1())||R(t.getT1().getType()))continue;if(t.getT1().getType()?.contains(p.ARRAY)&&Array.isArray(t.getT2())){let e=t.getT1().getItems();if(!e)continue;if(e.isSingleType())for(let r of t.getT2())n.push(new eN(e.getSingleSchema(),r));else{let r=t.getT2();for(let t=0;t<r.length;t++)n.push(new eN(e.getTupleSchema()[t],r[t]))}}else if(t.getT1().getType()?.contains(p.OBJECT)&&"object"==typeof t.getT2()){let r=t.getT1();if(r.getName()===k.EXPRESSION.getName()&&r.getNamespace()===k.EXPRESSION.getNamespace()){let r=t.getT2();r.isExpression&&this.addDependencies(e,r.value)}else if(r.getProperties())for(let e of Object.entries(t.getT2()))r.getProperties().has(e[0])&&n.push(new eN(r.getProperties().get(e[0]),e[1]))}}}}else if(r.getType()==n1.EXPRESSION){if(eg.isNullOrBlank(r.getExpression()))R(eO.getDefaultValue(t.getSchema(),s))&&e.addMessage(n5.ERROR,eT.format(n6.PARAMETER_NEEDS_A_VALUE,t.getParameterName()));else try{this.addDependencies(e,r.getExpression())}catch(t){e.addMessage(n5.ERROR,eT.format("Error evaluating $ : $",r.getExpression(),t))}}}else R(await eO.getDefaultValue(t.getSchema(),s))&&e.addMessage(n5.ERROR,eT.format(n6.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(n6.STEP_REGEX_PATTERN)??[]).forEach(t=>e.addDependency(t))}makeEdges(e){let t=e.getNodeMap().values(),r=[],s=new Map;for(let n of Array.from(t))for(let t of Array.from(n.getData().getDependencies())){let a=t.indexOf(".",6),i=t.substring(6,a),o=t.indexOf(".",a+1),E=-1==o?t.substring(a+1):t.substring(a+1,o);e.getNodeMap().has(i)?n.addInEdgeTo(e.getNodeMap().get(i),E):(r.push(new eN(i,E)),s.set(n.getData().getStatement().getStatementName(),eT.format("Unable to find the step with name $",i)))}return new eN(r,s)}}var n7={};E(n7,"KIRunConstants",()=>n8);class n8{static{this.NAMESPACE="namespace"}static{this.NAME="name"}static{this.ID="id"}constructor(){}}var ae={};E(ae,"Position",()=>at);class at{static{this.SCHEMA_NAME="Position"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(at.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["left",D.ofFloat("left")],["top",D.ofFloat("top")]]))}constructor(e,t){this.left=e,this.top=t}getLeft(){return this.left}setLeft(e){return this.left=e,this}getTop(){return this.top}setTop(e){return this.top=e,this}static from(e){if(e)return new at(e.left,e.top)}}var ar={};E(ar,"FunctionDefinition",()=>al);var as={};E(as,"Statement",()=>aE);var an={};E(an,"AbstractStatement",()=>aa);class aa{constructor(e){if(this.override=!1,!e)return;this.comment=e.comment,this.description=e.description,this.position=e.position?new at(e.position.getLeft(),e.position.getTop()):void 0,this.override=e.override}getComment(){return this.comment}setComment(e){return this.comment=e,this}isOverride(){return this.override}setOverride(e){return this.override=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getPosition(){return this.position}setPosition(e){return this.position=e,this}}var ai={};E(ai,"ParameterReference",()=>ao);class ao{static{this.SCHEMA_NAME="ParameterReference"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(ao.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["key",D.ofString("key")],["value",D.ofAny("value")],["expression",D.ofString("expression")],["type",D.ofString("type").setEnums(["EXPRESSION","VALUE"])],["order",D.ofInteger("order")]]))}constructor(e){e instanceof ao?(this.key=e.key,this.type=e.type,this.value=R(e.value)?void 0:JSON.parse(JSON.stringify(e.value)),this.expression=e.expression,this.order=e.order):(this.type=e,this.key=n9())}getType(){return this.type}setType(e){return this.type=e,this}getKey(){return this.key}setKey(e){return this.key=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}getExpression(){return this.expression}setExpression(e){return this.expression=e,this}setOrder(e){return this.order=e,this}getOrder(){return this.order}static ofExpression(e){let t=new ao(n1.EXPRESSION).setExpression(e);return[t.getKey(),t]}static ofValue(e){let t=new ao(n1.VALUE).setValue(e);return[t.getKey(),t]}static from(e){return new ao(e.type).setValue(e.value).setExpression(e.expression).setKey(e.key).setOrder(e.order)}}class aE extends aa{static{this.SCHEMA_NAME="Statement"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(aE.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["statementName",D.ofString("statementName")],["comment",D.ofString("comment")],["description",D.ofString("description")],["namespace",D.ofString("namespace")],["name",D.ofString("name")],["dependentStatements",D.ofObject("dependentstatement").setAdditionalProperties(new C().setSchemaValue(D.ofBoolean("exists"))).setDefaultValue({})],["executeIftrue",D.ofObject("executeIftrue").setAdditionalProperties(new C().setSchemaValue(D.ofBoolean("exists"))).setDefaultValue({})],["parameterMap",new D().setName("parameterMap").setAdditionalProperties(new C().setSchemaValue(D.ofObject("parameterReference").setAdditionalProperties(new C().setSchemaValue(ao.SCHEMA))))],["position",at.SCHEMA]]))}constructor(e,t,r){if(super(e instanceof aE?e:void 0),e instanceof aE)this.statementName=e.statementName,this.name=e.name,this.namespace=e.namespace,e.parameterMap&&(this.parameterMap=new Map(Array.from(e.parameterMap.entries()).map(e=>[e[0],new Map(Array.from(e[1].entries()).map(e=>[e[0],new ao(e[1])]))]))),e.dependentStatements&&(this.dependentStatements=new Map(Array.from(e.dependentStatements.entries())));else{if(this.statementName=e,!r||!t)throw Error("Unknown constructor");this.namespace=t,this.name=r}}getStatementName(){return this.statementName}setStatementName(e){return this.statementName=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getParameterMap(){return this.parameterMap||(this.parameterMap=new Map),this.parameterMap}setParameterMap(e){return this.parameterMap=e,this}getDependentStatements(){return this.dependentStatements??new Map}setDependentStatements(e){return this.dependentStatements=e,this}getExecuteIftrue(){return this.executeIftrue??new Map}setExecuteIftrue(e){return this.executeIftrue=e,this}equals(e){return e instanceof aE&&e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}static from(e){return new aE(e.statementName,e.namespace,e.name).setParameterMap(new Map(Object.entries(e.parameterMap??{}).map(([e,t])=>[e,new Map(Object.entries(t??{}).map(([e,t])=>ao.from(t)).map(e=>[e.getKey(),e]))]))).setDependentStatements(new Map(Object.entries(e.dependentStatements??{}))).setExecuteIftrue(new Map(Object.entries(e.executeIftrue??{}))).setPosition(at.from(e.position)).setComment(e.comment).setDescription(e.description)}}var au={};E(au,"StatementGroup",()=>aA);class aA extends aa{static{this.SCHEMA_NAME="StatementGroup"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(aA.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["statementGroupName",D.ofString("statementGroupName")],["comment",D.ofString("comment")],["description",D.ofString("description")],["position",at.SCHEMA]]))}constructor(e,t=new Map){super(),this.statementGroupName=e,this.statements=t}getStatementGroupName(){return this.statementGroupName}setStatementGroupName(e){return this.statementGroupName=e,this}getStatements(){return this.statements}setStatements(e){return this.statements=e,this}static from(e){return new aA(e.statementGroupName,new Map(Object.entries(e.statements||{}).map(([e,t])=>[e,(""+t)?.toLowerCase()=="true"]))).setPosition(at.from(e.position)).setComment(e.comment).setDescription(e.description)}}const aT=new D().setNamespace(l.SYSTEM).setName("FunctionDefinition").setProperties(new Map([["name",D.ofString("name")],["namespace",D.ofString("namespace")],["parameters",D.ofArray("parameters",k.SCHEMA)],["events",D.ofObject("events").setAdditionalProperties(new C().setSchemaValue(Q.SCHEMA))],["steps",D.ofObject("steps").setAdditionalProperties(new C().setSchemaValue(aE.SCHEMA))]]));aT.getProperties()?.set("parts",D.ofArray("parts",aT));class al extends ea{static{this.SCHEMA=aT}constructor(e){super(e),this.version=1}getVersion(){return this.version}setVersion(e){return this.version=e,this}getSteps(){return this.steps??new Map}setSteps(e){return this.steps=e,this}getStepGroups(){return this.stepGroups}setStepGroups(e){return this.stepGroups=e,this}getParts(){return this.parts}setParts(e){return this.parts=e,this}static from(e){return e?new al(e.name).setSteps(new Map(Object.values(e.steps??{}).filter(e=>!!e).map(e=>[e.statementName,aE.from(e)]))).setStepGroups(new Map(Object.values(e.stepGroups??{}).filter(e=>!!e).map(e=>[e.statementGroupName,aA.from(e)]))).setParts(Array.from(e.parts??[]).filter(e=>!!e).map(e=>al.from(e))).setVersion(e.version??1).setEvents(new Map(Object.values(e.events??{}).filter(e=>!!e).map(e=>[e.name,Q.from(e)]))).setParameters(new Map(Object.values(e.parameters??{}).filter(e=>!!e).map(e=>[e.parameterName,k.from(e)]))).setNamespace(e.namespace):new al("unknown")}}var am={};E(am,"Argument",()=>ah);class ah{constructor(e,t,r){this.argumentIndex=0,this.argumentIndex=e,this.name=t,this.value=r}getArgumentIndex(){return this.argumentIndex}setArgumentIndex(e){return this.argumentIndex=e,this}getName(){return this.name}setName(e){return this.name=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}static of(e,t){return new ah(0,e,t)}}var aR={};o(aR,rK),o(aR,r1),o(aR,r9),o(aR,r4),o(aR,rQ);var ag={};o(ag,ro),o(ag,ru),o(ag,rT),o(ag,rm),o(ag,rR),o(ag,rc),o(ag,rN),o(ag,rn),o(ag,r_),o(ag,rS),o(ag,rw),o(ag,rP),o(ag,ry),o(ag,rL),o(ag,rU),o(ag,rC),o(ag,rb),o(ag,rF),o(ag,rY),o(ag,rj),o(ag,rk),o(ag,rX),o(ag,rq),o(ag,rs),o(module.exports,u),o(module.exports,J),o(module.exports,{}),o(module.exports,e5),o(module.exports,$),o(module.exports,h),o(module.exports,eu),o(module.exports,tP),o(module.exports,eA),o(module.exports,eR),o(module.exports,ep),o(module.exports,tt),o(module.exports,eE),o(module.exports,tn),o(module.exports,nb),o(module.exports,nG),o(module.exports,t3),o(module.exports,nY),o(module.exports,nk),o(module.exports,nj),o(module.exports,nX),o(module.exports,{}),o(module.exports,nJ),o(module.exports,nK),o(module.exports,n4),o(module.exports,n2),o(module.exports,td),o(module.exports,tG),o(module.exports,r6),o(module.exports,tw),o(module.exports,rr),o(module.exports,tC),o(module.exports,tL),o(module.exports,ty),o(module.exports,tU),o(module.exports,{}),o(module.exports,ei),o(module.exports,T),o(module.exports,nQ),o(module.exports,A),o(module.exports,eV),o(module.exports,ex),o(module.exports,ev),o(module.exports,eI),o(module.exports,ew),o(module.exports,eG),o(module.exports,eD),o(module.exports,eo),o(module.exports,eM),o(module.exports,G),o(module.exports,eP),o(module.exports,m),o(module.exports,O),o(module.exports,N),o(module.exports,f),o(module.exports,_),o(module.exports,c),o(module.exports,ec),o(module.exports,eF),o(module.exports,nU),o(module.exports,n7),o(module.exports,b),o(module.exports,ee),o(module.exports,ae),o(module.exports,ar),o(module.exports,n0),o(module.exports,z),o(module.exports,an),o(module.exports,as),o(module.exports,{}),o(module.exports,au),o(module.exports,en),o(module.exports,K),o(module.exports,B),o(module.exports,am),o(module.exports,ai),o(module.exports,e6),o(module.exports,et),o(module.exports,aR),o(module.exports,ag),o(module.exports,se);
1
+ var e,t,r,s,n,a,i=require("luxon");function o(e,t){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e}function E(e,t,r,s){Object.defineProperty(e,t,{get:r,set:s,enumerable:!0,configurable:!0})}var u={};E(u,"KIRunSchemaRepository",()=>X);var A={};E(A,"AdditionalType",()=>C),E(A,"Schema",()=>D);var T={};E(T,"Namespaces",()=>l);class l{static{this.SYSTEM="System"}static{this.SYSTEM_CTX="System.Context"}static{this.SYSTEM_LOOP="System.Loop"}static{this.SYSTEM_ARRAY="System.Array"}static{this.SYSTEM_OBJECT="System.Object"}static{this.MATH="System.Math"}static{this.STRING="System.String"}static{this.DATE="System.Date"}constructor(){}}var m={};E(m,"ArraySchemaType",()=>g);var R={};function h(e){return null==e}E(R,"isNullValue",()=>h);class g{constructor(e){if(!e)return;this.singleSchema=e.singleSchema?new D(e.singleSchema):void 0,this.tupleSchema=e.tupleSchema?e.tupleSchema.map(e=>new D(e)):void 0}setSingleSchema(e){return this.singleSchema=e,this}setTupleSchema(e){return this.tupleSchema=e,this}getSingleSchema(){return this.singleSchema}getTupleSchema(){return this.tupleSchema}isSingleType(){return!h(this.singleSchema)}static of(...e){return 1==e.length?new g().setSingleSchema(e[0]):new g().setTupleSchema(e)}static from(e){if(!e)return;if(Array.isArray(e))return new g().setTupleSchema(D.fromListOfSchemas(e));let t=Object.keys(e);if(-1!=t.indexOf("singleSchema"))return new g().setSingleSchema(D.from(e.singleSchema));if(-1!=t.indexOf("tupleSchema"))return new g().setTupleSchema(D.fromListOfSchemas(e.tupleSchema));let r=D.from(e);if(r)return new g().setSingleSchema(r)}}var c={};E(c,"SchemaType",()=>p);var p=((e={}).INTEGER="Integer",e.LONG="Long",e.FLOAT="Float",e.DOUBLE="Double",e.STRING="String",e.OBJECT="Object",e.ARRAY="Array",e.BOOLEAN="Boolean",e.NULL="Null",e),N={};E(N,"TypeUtil",()=>d);var f={};E(f,"MultipleType",()=>S);var _={};E(_,"Type",()=>M);class M{}class S extends M{constructor(e){super(),e instanceof S?this.type=new Set(Array.from(e.type)):this.type=new Set(Array.from(e))}getType(){return this.type}setType(e){return this.type=e,this}getAllowedSchemaTypes(){return this.type}contains(e){return this.type?.has(e)}}var O={};E(O,"SingleType",()=>w);class w extends M{constructor(e){super(),e instanceof w?this.type=e.type:this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class d{static of(...e){return 1==e.length?new w(e[0]):new S(new Set(e))}static from(e){return"string"==typeof e?new w(p[d.fromJSONType(e)]):Array.isArray(e)?new S(new Set(e.map(d.fromJSONType).map(e=>e).map(e=>p[e]))):void 0}static fromJSONType(e){let t=e.toUpperCase();return"NUMBER"===t?"DOUBLE":t}}const I="additionalProperty",P="additionalItems",y="enums",x="items",L="System.Schema",v="required",U="version",V="namespace";class C{constructor(e){if(!e||(this.booleanValue=e.booleanValue,!e.schemaValue))return;this.schemaValue=new D(e.schemaValue)}getBooleanValue(){return this.booleanValue}getSchemaValue(){return this.schemaValue}setBooleanValue(e){return this.booleanValue=e,this}setSchemaValue(e){return this.schemaValue=e,this}static from(e){if(h(e))return;let t=new C;if("boolean"==typeof e)t.booleanValue=e;else{let r=Object.keys(e);-1!=r.indexOf("booleanValue")?t.booleanValue=e.booleanValue:-1!=r.indexOf("schemaValue")?t.schemaValue=D.from(e.schemaValue):t.schemaValue=D.from(e)}return t}}class D{static{this.NULL=new D().setNamespace(l.SYSTEM).setName("Null").setType(d.of(p.NULL)).setConstant(void 0)}static{this.TYPE_SCHEMA=new D().setType(d.of(p.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"])}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName("Schema").setType(d.of(p.OBJECT)).setProperties(new Map([[V,D.of(V,p.STRING).setDefaultValue("_")],["name",D.ofString("name")],[U,D.of(U,p.INTEGER).setDefaultValue(1)],["ref",D.ofString("ref")],["type",new D().setAnyOf([D.TYPE_SCHEMA,D.ofArray("type",D.TYPE_SCHEMA)])],["anyOf",D.ofArray("anyOf",D.ofRef(L))],["allOf",D.ofArray("allOf",D.ofRef(L))],["oneOf",D.ofArray("oneOf",D.ofRef(L))],["not",D.ofRef(L)],["title",D.ofString("title")],["description",D.ofString("description")],["id",D.ofString("id")],["examples",D.ofAny("examples")],["defaultValue",D.ofAny("defaultValue")],["comment",D.ofString("comment")],[y,D.ofArray(y,D.ofString(y))],["constant",D.ofAny("constant")],["pattern",D.ofString("pattern")],["format",D.of("format",p.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",D.ofInteger("minLength")],["maxLength",D.ofInteger("maxLength")],["multipleOf",D.ofLong("multipleOf")],["minimum",D.ofNumber("minimum")],["maximum",D.ofNumber("maximum")],["exclusiveMinimum",D.ofNumber("exclusiveMinimum")],["exclusiveMaximum",D.ofNumber("exclusiveMaximum")],["properties",D.of("properties",p.OBJECT).setAdditionalProperties(new C().setSchemaValue(D.ofRef(L)))],["additionalProperties",new D().setName(I).setNamespace(l.SYSTEM).setAnyOf([D.ofBoolean(I),D.ofObject(I).setRef(L)]).setDefaultValue(!0)],[v,D.ofArray(v,D.ofString(v)).setDefaultValue([])],["propertyNames",D.ofRef(L)],["minProperties",D.ofInteger("minProperties")],["maxProperties",D.ofInteger("maxProperties")],["patternProperties",D.of("patternProperties",p.OBJECT).setAdditionalProperties(new C().setSchemaValue(D.ofRef(L)))],[x,new D().setName(x).setAnyOf([D.ofRef(L).setName("item"),D.ofArray("tuple",D.ofRef(L))])],["contains",D.ofRef(L)],["minContains",D.ofInteger("minContains")],["maxContains",D.ofInteger("maxContains")],["minItems",D.ofInteger("minItems")],["maxItems",D.ofInteger("maxItems")],["uniqueItems",D.ofBoolean("uniqueItems")],["additionalItems",new D().setName(P).setNamespace(l.SYSTEM).setAnyOf([D.ofBoolean(P),D.ofObject(P).setRef(L)])],["$defs",D.of("$defs",p.OBJECT).setAdditionalProperties(new C().setSchemaValue(D.ofRef(L)))],["permission",D.ofString("permission")],["details",D.ofObject("details")]])).setRequired([])}static ofString(e){return new D().setType(d.of(p.STRING)).setName(e)}static ofInteger(e){return new D().setType(d.of(p.INTEGER)).setName(e)}static ofFloat(e){return new D().setType(d.of(p.FLOAT)).setName(e)}static ofLong(e){return new D().setType(d.of(p.LONG)).setName(e)}static ofDouble(e){return new D().setType(d.of(p.DOUBLE)).setName(e)}static ofAny(e){return new D().setType(d.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE,p.STRING,p.BOOLEAN,p.ARRAY,p.NULL,p.OBJECT)).setName(e)}static ofAnyNotNull(e){return new D().setType(d.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE,p.STRING,p.BOOLEAN,p.ARRAY,p.OBJECT)).setName(e)}static ofNumber(e){return new D().setType(d.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE)).setName(e)}static ofBoolean(e){return new D().setType(d.of(p.BOOLEAN)).setName(e)}static of(e,...t){return new D().setType(d.of(...t)).setName(e)}static ofObject(e){return new D().setType(d.of(p.OBJECT)).setName(e)}static ofRef(e){return new D().setRef(e)}static ofArray(e,...t){return new D().setType(d.of(p.ARRAY)).setName(e).setItems(g.of(...t))}static fromListOfSchemas(e){if(h(e)&&!Array.isArray(e))return;let t=[];for(let r of Array.from(e)){let e=D.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(h(e))return;let t=new Map;return Object.entries(e).forEach(([e,r])=>{let s=D.from(r);s&&t.set(e,s)}),t}static from(e,t=!1){if(h(e))return;let r=new D;return r.namespace=e.namespace??"_",r.name=e.name,r.version=e.version??1,r.ref=e.ref,t?r.type=new w(p.STRING):r.type=d.from(e.type),r.anyOf=D.fromListOfSchemas(e.anyOf),r.allOf=D.fromListOfSchemas(e.allOf),r.oneOf=D.fromListOfSchemas(e.oneOf),r.not=D.from(e.not),r.description=e.description,r.examples=e.examples?[...e.examples]:void 0,r.defaultValue=e.defaultValue,r.comment=e.comment,r.enums=e.enums?[...e.enums]:void 0,r.constant=e.constant,r.pattern=e.pattern,r.format=e.format,r.minLength=e.minLength,r.maxLength=e.maxLength,r.multipleOf=e.multipleOf,r.minimum=e.minimum,r.maximum=e.maximum,r.exclusiveMinimum=e.exclusiveMinimum,r.exclusiveMaximum=e.exclusiveMaximum,r.properties=D.fromMapOfSchemas(e.properties),r.additionalProperties=C.from(e.additionalProperties),r.required=e.required,r.propertyNames=D.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=D.fromMapOfSchemas(e.patternProperties),r.items=g.from(e.items),r.additionalItems=C.from(e.additionalItems),r.contains=D.from(e.contains),r.minContains=e.minContains,r.maxContains=e.maxContains,r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=D.fromMapOfSchemas(e.$defs),r.permission=e.permission,r.details=e.details?new Map(Object.entries(e.details)):void 0,r}constructor(e){if(this.namespace="_",this.version=1,!e)return;this.namespace=e.namespace,this.name=e.name,this.version=e.version,this.ref=e.ref,h(e.type)||(this.type=e.type instanceof w?new w(e.type):new S(e.type)),this.anyOf=e.anyOf?.map(e=>new D(e)),this.allOf=e.allOf?.map(e=>new D(e)),this.oneOf=e.oneOf?.map(e=>new D(e)),this.not=this.not?new D(this.not):void 0,this.description=e.description,this.examples=e.examples?JSON.parse(JSON.stringify(e.examples)):void 0,this.defaultValue=e.defaultValue?JSON.parse(JSON.stringify(e.defaultValue)):void 0,this.comment=e.comment,this.enums=e.enums?[...e.enums]:void 0,this.constant=e.constant?JSON.parse(JSON.stringify(e.constant)):void 0,this.pattern=e.pattern,this.format=e.format,this.minLength=e.minLength,this.maxLength=e.maxLength,this.multipleOf=e.multipleOf,this.minimum=e.minimum,this.maximum=e.maximum,this.exclusiveMinimum=e.exclusiveMinimum,this.exclusiveMaximum=e.exclusiveMaximum,this.properties=e.properties?new Map(Array.from(e.properties.entries()).map(e=>[e[0],new D(e[1])])):void 0,this.additionalProperties=e.additionalProperties?new C(e.additionalProperties):void 0,this.required=e.required?[...e.required]:void 0,this.propertyNames=e.propertyNames?new D(e.propertyNames):void 0,this.minProperties=e.minProperties,this.maxProperties=e.maxProperties,this.patternProperties=e.patternProperties?new Map(Array.from(e.patternProperties.entries()).map(e=>[e[0],new D(e[1])])):void 0,this.items=e.items?new g(e.items):void 0,this.contains=e.contains?new D(this.contains):void 0,this.minContains=e.minContains,this.maxContains=e.maxContains,this.minItems=e.minItems,this.maxItems=e.maxItems,this.uniqueItems=e.uniqueItems,this.additionalItems=e.additionalItems?new C(e.additionalItems):void 0,this.$defs=e.$defs?new Map(Array.from(e.$defs.entries()).map(e=>[e[0],new D(e[1])])):void 0,this.permission=e.permission,this.details=e.details?new Map(JSON.parse(JSON.stringify(Array.from(e.details.values())))):void 0}getTitle(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}getFullName(){return this.namespace+"."+this.name}get$defs(){return this.$defs}set$defs(e){return this.$defs=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getVersion(){return this.version}setVersion(e){return this.version=e,this}getRef(){return this.ref}setRef(e){return this.ref=e,this}getType(){return this.type}setType(e){return this.type=e,this}getAnyOf(){return this.anyOf}setAnyOf(e){return this.anyOf=e,this}getAllOf(){return this.allOf}setAllOf(e){return this.allOf=e,this}getOneOf(){return this.oneOf}setOneOf(e){return this.oneOf=e,this}getNot(){return this.not}setNot(e){return this.not=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getExamples(){return this.examples}setExamples(e){return this.examples=e,this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}getComment(){return this.comment}setComment(e){return this.comment=e,this}getEnums(){return this.enums}setEnums(e){return this.enums=e,this}getConstant(){return this.constant}setConstant(e){return this.constant=e,this}getPattern(){return this.pattern}setPattern(e){return this.pattern=e,this}getFormat(){return this.format}setFormat(e){return this.format=e,this}getMinLength(){return this.minLength}setMinLength(e){return this.minLength=e,this}getMaxLength(){return this.maxLength}setMaxLength(e){return this.maxLength=e,this}getMultipleOf(){return this.multipleOf}setMultipleOf(e){return this.multipleOf=e,this}getMinimum(){return this.minimum}setMinimum(e){return this.minimum=e,this}getMaximum(){return this.maximum}setMaximum(e){return this.maximum=e,this}getExclusiveMinimum(){return this.exclusiveMinimum}setExclusiveMinimum(e){return this.exclusiveMinimum=e,this}getExclusiveMaximum(){return this.exclusiveMaximum}setExclusiveMaximum(e){return this.exclusiveMaximum=e,this}getProperties(){return this.properties}setProperties(e){return this.properties=e,this}getAdditionalProperties(){return this.additionalProperties}setAdditionalProperties(e){return this.additionalProperties=e,this}getAdditionalItems(){return this.additionalItems}setAdditionalItems(e){return this.additionalItems=e,this}getRequired(){return this.required}setRequired(e){return this.required=e,this}getPropertyNames(){return this.propertyNames}setPropertyNames(e){return this.propertyNames=e,this.propertyNames.type=new w(p.STRING),this}getMinProperties(){return this.minProperties}setMinProperties(e){return this.minProperties=e,this}getMaxProperties(){return this.maxProperties}setMaxProperties(e){return this.maxProperties=e,this}getPatternProperties(){return this.patternProperties}setPatternProperties(e){return this.patternProperties=e,this}getItems(){return this.items}setItems(e){return this.items=e,this}getContains(){return this.contains}setContains(e){return this.contains=e,this}getMinContains(){return this.minContains}setMinContains(e){return this.minContains=e,this}getMaxContains(){return this.maxContains}setMaxContains(e){return this.maxContains=e,this}getMinItems(){return this.minItems}setMinItems(e){return this.minItems=e,this}getMaxItems(){return this.maxItems}setMaxItems(e){return this.maxItems=e,this}getUniqueItems(){return this.uniqueItems}setUniqueItems(e){return this.uniqueItems=e,this}getPermission(){return this.permission}setPermission(e){return this.permission=e,this}getDetails(){return this.details}setDetails(e){return this.details=e,this}}var b={};E(b,"Parameter",()=>k);var G={};E(G,"SchemaReferenceException",()=>F);class F extends Error{constructor(e,t,r){super(e.trim()?e+"-"+t:t),this.schemaPath=e,this.cause=r}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}var Y={};E(Y,"ParameterType",()=>B);var B=((t={}).CONSTANT="CONSTANT",t.EXPRESSION="EXPRESSION",t);const H="value";class k{static{this.SCHEMA_NAME="Parameter"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(k.SCHEMA_NAME).setProperties(new Map([["schema",D.SCHEMA],["parameterName",D.ofString("parameterName")],["variableArgument",D.of("variableArgument",p.BOOLEAN).setDefaultValue(!1)],["type",D.ofString("type").setEnums(["EXPRESSION","CONSTANT"])]]))}static{this.EXPRESSION=new D().setNamespace(l.SYSTEM).setName("ParameterExpression").setType(d.of(p.OBJECT)).setProperties(new Map([["isExpression",D.ofBoolean("isExpression").setDefaultValue(!0)],[H,D.ofAny(H)]]))}constructor(e,t){if(this.variableArgument=!1,this.type=B.EXPRESSION,e instanceof k)this.schema=new D(e.schema),this.parameterName=e.parameterName,this.variableArgument=e.variableArgument,this.type=e.type;else{if(!t)throw Error("Unknown constructor signature");this.schema=t,this.parameterName=e}}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getParameterName(){return this.parameterName}setParameterName(e){return this.parameterName=e,this}isVariableArgument(){return this.variableArgument}setVariableArgument(e){return this.variableArgument=e,this}getType(){return this.type}setType(e){return this.type=e,this}static ofEntry(e,t,r=!1,s=B.EXPRESSION){return[e,new k(e,t).setType(s).setVariableArgument(r)]}static of(e,t,r=!1,s=B.EXPRESSION){return new k(e,t).setType(s).setVariableArgument(r)}static from(e){let t=D.from(e.schema);if(!t)throw new F("","Parameter requires Schema");return new k(e.parameterName,t).setVariableArgument(!!e.variableArgument).setType(e.type??B.EXPRESSION)}}var $={};E($,"MapUtil",()=>j),E($,"MapEntry",()=>W);class j{static of(e,t,r,s,n,a,i,o,E,u,A,T,l,m,R,g,c,p,N,f){let _=new Map;return h(e)||h(t)||_.set(e,t),h(r)||h(s)||_.set(r,s),h(n)||h(a)||_.set(n,a),h(i)||h(o)||_.set(i,o),h(E)||h(u)||_.set(E,u),h(A)||h(T)||_.set(A,T),h(l)||h(m)||_.set(l,m),h(R)||h(g)||_.set(R,g),h(c)||h(p)||_.set(c,p),h(N)||h(f)||_.set(N,f),_}static ofArrayEntries(...e){let t=new Map;for(let[r,s]of e)t.set(r,s);return t}static entry(e,t){return new W(e,t)}static ofEntries(...e){let t=new Map;for(let r of e)t.set(r.k,r.v);return t}static ofEntriesArray(...e){let t=new Map;for(let r=0;r<e.length;r++)t.set(e[r][0],e[r][1]);return t}constructor(){}}class W{constructor(e,t){this.k=e,this.v=t}}class X{constructor(){this.map=new Map([["any",D.ofAny("any").setNamespace(l.SYSTEM)],["boolean",D.ofBoolean("boolean").setNamespace(l.SYSTEM)],["double",D.ofDouble("double").setNamespace(l.SYSTEM)],["float",D.ofFloat("float").setNamespace(l.SYSTEM)],["integer",D.ofInteger("integer").setNamespace(l.SYSTEM)],["long",D.ofLong("long").setNamespace(l.SYSTEM)],["number",D.ofNumber("number").setNamespace(l.SYSTEM)],["string",D.ofString("string").setNamespace(l.SYSTEM)],["Timestamp",D.ofString("Timestamp").setNamespace(l.DATE)],["Timeunit",D.ofString("Timeunit").setNamespace(l.DATE).setEnums(["YEARS","QUARTERS","MONTHS","WEEKS","DAYS","HOURS","MINUTES","SECONDS","MILLISECONDS"])],["Duration",D.ofObject("Duration").setNamespace(l.DATE).setProperties(j.ofArrayEntries(["years",D.ofNumber("years")],["quarters",D.ofNumber("quarters")],["months",D.ofNumber("months")],["weeks",D.ofNumber("weeks")],["days",D.ofNumber("days")],["hours",D.ofNumber("hours")],["minutes",D.ofNumber("minutes")],["seconds",D.ofNumber("seconds")],["milliseconds",D.ofNumber("milliseconds")])).setAdditionalItems(C.from(!1))],["TimeObject",D.ofObject("TimeObject").setNamespace(l.DATE).setProperties(j.ofArrayEntries(["year",D.ofNumber("year")],["month",D.ofNumber("month")],["day",D.ofNumber("day")],["hour",D.ofNumber("hour")],["minute",D.ofNumber("minute")],["second",D.ofNumber("second")],["millisecond",D.ofNumber("millisecond")])).setAdditionalItems(C.from(!1))],[k.EXPRESSION.getName(),k.EXPRESSION],[D.NULL.getName(),D.NULL],[D.SCHEMA.getName(),D.SCHEMA]]),this.filterableNames=Array.from(this.map.values()).map(e=>e.getFullName())}async find(e,t){return l.SYSTEM!=e&&l.DATE!=e?Promise.resolve(void 0):Promise.resolve(this.map.get(t))}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var J={};function q(e){return[e.getSignature().getName(),e]}E(J,"KIRunFunctionRepository",()=>nB);var z={};E(z,"EventResult",()=>Z);var K={};E(K,"Event",()=>Q);class Q{static{this.OUTPUT="output"}static{this.ERROR="error"}static{this.ITERATION="iteration"}static{this.TRUE="true"}static{this.FALSE="false"}static{this.SCHEMA_NAME="Event"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(Q.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["name",D.ofString("name")],["parameters",D.ofObject("parameter").setAdditionalProperties(new C().setSchemaValue(D.SCHEMA))]]))}constructor(e,t){if(e instanceof Q)this.name=e.name,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new D(e[1])]));else{if(this.name=e,!t)throw Error("Unknown constructor format");this.parameters=t}}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}static outputEventMapEntry(e){return Q.eventMapEntry(Q.OUTPUT,e)}static eventMapEntry(e,t){return[e,new Q(e,t)]}static from(e){return new Q(e.name,new Map(Object.entries(e.parameters??{}).map(e=>{let t=D.from(e[1]);if(!t)throw new F("","Event expects a schema");return[e[0],t]})))}}class Z{constructor(e,t){this.name=e,this.result=t}getName(){return this.name}setName(e){return this.name=e,this}getResult(){return this.result}setResult(e){return this.result=e,this}static outputOf(e){return Z.of(Q.OUTPUT,e)}static of(e,t){return new Z(e,t)}}var ee={};E(ee,"FunctionOutput",()=>es);var et={};E(et,"KIRuntimeException",()=>er);class er extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class es{constructor(e){if(this.index=0,h(e))throw new er("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof Z?this.fo=e:(this.fo=[],Array.isArray(e)||(this.generator=e))}next(){if(!this.generator)return this.index<this.fo.length?this.fo[this.index++]:void 0;let e=this.generator.next();return e&&this.fo.push(e),e}allResults(){return this.fo}}var en={};E(en,"FunctionSignature",()=>ea);class ea{static{this.SCHEMA_NAME="FunctionSignature"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(ea.SCHEMA_NAME).setProperties(new Map([["name",D.ofString("name")],["namespace",D.ofString("namespace")],["parameters",D.ofObject("parameters").setAdditionalProperties(new C().setSchemaValue(k.SCHEMA))],["events",D.ofObject("events").setAdditionalProperties(new C().setSchemaValue(Q.SCHEMA))]]))}constructor(e){this.namespace="_",this.parameters=new Map,this.events=new Map,e instanceof ea?(this.name=e.name,this.namespace=e.namespace,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new k(e[1])])),this.events=new Map(Array.from(e.events.entries()).map(e=>[e[0],new Q(e[1])]))):this.name=e}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getFullName(){return this.namespace+"."+this.name}}var ei={};E(ei,"AbstractFunction",()=>e0);var eo={};E(eo,"SchemaValidator",()=>eZ);var eE={};E(eE,"deepEqual",()=>eR);var eu={};E(eu,"LinkedList",()=>el);var eA={};E(eA,"StringFormatter",()=>eT);class eT{static format(e,...t){if(!t||0==t.length)return e;let r="",s=0,n="",a=n,i=e.length;for(let o=0;o<i;o++)"$"==(n=e.charAt(o))&&"\\"==a?r=r.substring(0,o-1)+n:"$"==n&&s<t.length?r+=t[s++]:r+=n,a=n;return r.toString()}constructor(){}}class el{constructor(e){if(this.head=void 0,this.tail=void 0,this.length=0,e?.length){for(let t of e)if(this.head){let e=new em(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new em(t);this.length=e.length}}push(e){let t=new em(e,void 0,this.head);this.head?(this.head.previous=t,this.head=t):this.tail=this.head=t,this.length++}pop(){if(!this.head)throw Error("List is empty and cannot pop further.");let e=this.head.value;if(this.length--,this.head==this.tail)return this.head=this.tail=void 0,e;let t=this.head;return this.head=t.next,t.next=void 0,t.previous=void 0,this.head.previous=void 0,e}isEmpty(){return!this.length}size(){return this.length}get(e){if(e<0||e>=this.length)throw Error(`${e} is out of bounds [0,${this.length}]`);let t=this.head;for(;e>0;)t=this.head.next,--e;return t.value}set(e,t){if(e<0||e>=this.length)throw new er(eT.format("Index $ out of bound to set the value in linked list.",e));let r=this.head;for(;e>0;)r=this.head.next,--e;return r.value=t,this}toString(){let e=this.head,t="";for(;e;)t+=e.value,(e=e.next)&&(t+=", ");return`[${t}]`}toArray(){let e=[],t=this.head;for(;t;)e.push(t.value),t=t.next;return e}peek(){if(!this.head)throw Error("List is empty so cannot peak");return this.head.value}peekLast(){if(!this.tail)throw Error("List is empty so cannot peak");return this.tail.value}getFirst(){if(!this.head)throw Error("List is empty so cannot get first");return this.head.value}removeFirst(){return this.pop()}removeLast(){if(!this.tail)throw Error("List is empty so cannot remove");--this.length;let e=this.tail.value;if(0==this.length)this.head=this.tail=void 0;else{let e=this.tail.previous;e.next=void 0,this.tail.previous=void 0,this.tail=e}return e}addAll(e){return e&&e.length&&e.forEach(this.add.bind(this)),this}add(e){return++this.length,this.tail||this.head?this.head===this.tail?(this.tail=new em(e,this.head),this.head.next=this.tail):(this.tail=new em(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new em(e),this}map(e,t){let r=new el,s=this.head,n=0;for(;s;)r.add(e(s.value,n)),s=s.next,++n;return r}indexOf(e){let t=this.head,r=0;for(;t;){if(eR(t.value,e))return r;t=t.next,++r}return -1}forEach(e,t){let r=this.head,s=0;for(;r;)e(r.value,s),r=r.next,++s}}class em{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}function eR(e,t){let r=new el;r.push(e);let s=new el;for(s.push(t);!r.isEmpty()&&!s.isEmpty();){let e=r.pop(),t=s.pop();if(e===t)continue;let n=typeof e,a=typeof t;if("undefined"===n||"undefined"===a){if(!e&&!t)continue;return!1}if(n!==a)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!=t.length)return!1;for(let n=0;n<e.length;n++)r.push(e[n]),s.push(t[n]);continue}if("object"===n){if("object"!==a||null===e||null===t)return!1;let n=Object.entries(e),i=Object.entries(t);if(n.length!==i.length)return!1;for(let[e,a]of n)r.push(a),s.push(t[e]);continue}return!1}return!0}var eh={};E(eh,"StringUtil",()=>eg);class eg{constructor(){}static nthIndex(e,t,r=0,s){if(!e)throw new er("String cannot be null");if(r<0||r>=e.length)throw new er(eT.format("Cannot search from index : $",r));if(s<=0||s>e.length)throw new er(eT.format("Cannot search for occurance : $",s));for(;r<e.length;){if(e.charAt(r)==t&&0==--s)return r;++r}return -1}static splitAtFirstOccurance(e,t){if(!e)return[void 0,void 0];let r=e.indexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static splitAtLastOccurance(e,t){if(!e)return[void 0,void 0];let r=e.lastIndexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static isNullOrBlank(e){return!e||""==e.trim()}}var ec={};E(ec,"SchemaUtil",()=>eO);var ep={};E(ep,"Tuple2",()=>eN),E(ep,"Tuple3",()=>ef),E(ep,"Tuple4",()=>e_);class eN{constructor(e,t){this.f=e,this.s=t}getT1(){return this.f}getT2(){return this.s}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}}class ef extends eN{constructor(e,t,r){super(e,t),this.t=r}getT3(){return this.t}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}setT3(e){return this.t=e,this}}class e_ extends ef{constructor(e,t,r,s){super(e,t,r),this.fr=s}getT4(){return this.fr}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}setT3(e){return this.t=e,this}setT4(e){return this.fr=e,this}}var eM={};E(eM,"SchemaValidationException",()=>eS);class eS extends Error{constructor(e,t,r=[],s){super(t+(r?r.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.cause=s}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class eO{static{this.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH="Unable to retrive schema from referenced path"}static{this.CYCLIC_REFERENCE_LIMIT_COUNTER=20}static async getDefaultValue(e,t){if(e)return e.getConstant()?e.getConstant():h(e.getDefaultValue())?eO.getDefaultValue(await eO.getSchemaFromRef(e,t,e.getRef()),t):e.getDefaultValue()}static async hasDefaultValueOrNullSchemaType(e,t){return e?e.getConstant()||!h(e.getDefaultValue())?Promise.resolve(!0):h(e.getRef())?e.getType()?.getAllowedSchemaTypes().has(p.NULL)?Promise.resolve(!0):Promise.resolve(!1):this.hasDefaultValueOrNullSchemaType(await eO.getSchemaFromRef(e,t,e.getRef()),t):Promise.resolve(!1)}static async getSchemaFromRef(e,t,r,s=0){if(++s==eO.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new eS(r??"","Schema has a cyclic reference");if(!e||!r||eg.isNullOrBlank(r))return Promise.resolve(void 0);if(!r.startsWith("#")){var n=await eO.resolveExternalSchema(e,t,r);n&&(e=n.getT1(),r=n.getT2())}let a=r.split("/");return 1===a.length?Promise.resolve(e):Promise.resolve(eO.resolveInternalSchema(e,t,r,s,a,1))}static async resolveInternalSchema(e,t,r,s,n,a){let i=e;if(a!==n.length){for(;a<n.length;){if("$defs"===n[a]){if(++a>=n.length||!i.get$defs())throw new F(r,eO.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);i=i.get$defs()?.get(n[a])}else{if(i&&(!i.getType()?.contains(p.OBJECT)||!i.getProperties()))throw new F(r,"Cannot retrievie schema from non Object type schemas");i=i.getProperties()?.get(n[a])}if(a++,!i||!eg.isNullOrBlank(i.getRef())&&!(i=await eO.getSchemaFromRef(i,t,i.getRef(),s)))throw new F(r,eO.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return Promise.resolve(i)}}static async resolveExternalSchema(e,t,r){if(!t)return Promise.resolve(void 0);let s=eg.splitAtFirstOccurance(r??"","/");if(!s[0])return Promise.resolve(void 0);let n=eg.splitAtLastOccurance(s[0],".");if(!n[0]||!n[1])return Promise.resolve(void 0);let a=await t.find(n[0],n[1]);if(!a)return Promise.resolve(void 0);if(!s[1]||""===s[1])return Promise.resolve(new eN(a,r));if(r="#/"+s[1],!a)throw new F(r,eO.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return Promise.resolve(new eN(a,r))}constructor(){}}var ew={};E(ew,"AnyOfAllOfOneOfValidator",()=>ed);class ed{static async validate(e,t,r,s,n,a){let i=[];return t.getOneOf()&&!t.getOneOf()?await ed.oneOf(e,t,r,s,i,n,a):t.getAllOf()&&!t.getAllOf()?await ed.allOf(e,t,r,s,i,n,a):t.getAnyOf()&&!t.getAnyOf()?await ed.anyOf(e,t,r,s,i,n,a):s}static async anyOf(e,t,r,s,n,a,i){let o=!1;for(let E of t.getAnyOf()??[])try{await ed.validate(e,E,r,s,a,i),o=!0;break}catch(e){o=!1,n.push(e)}if(o)return s;throw new eS(eZ.path(e),"The value don't satisfy any of the schemas.",n)}static async allOf(e,t,r,s,n,a,i){let o=0;for(let E of t.getAllOf()??[])try{await ed.validate(e,E,r,s,a,i),o++}catch(e){n.push(e)}if(o===t.getAllOf()?.length)return s;throw new eS(eZ.path(e),"The value doesn't satisfy some of the schemas.",n)}static async oneOf(e,t,r,s,n,a,i){let o=0;for(let E of t.getOneOf()??[])try{await ed.validate(e,E,r,s,a,i),o++}catch(e){n.push(e)}if(1===o)return s;throw new eS(eZ.path(e),0==o?"The value does not satisfy any schema":"The value satisfy more than one schema",n)}constructor(){}}var eI={};E(eI,"TypeValidator",()=>eQ);var eP={};E(eP,"ArrayValidator",()=>ey);class ey{static async validate(e,t,r,s,n,a){if(h(s))throw new eS(eZ.path(e),"Expected an array but found null");if(!Array.isArray(s))throw new eS(eZ.path(e),s.toString()+" is not an Array");return ey.checkMinMaxItems(e,t,s),await ey.checkItems(e,t,r,s,n,a),ey.checkUniqueItems(e,t,s),await ey.checkContains(t,e,r,s),s}static async checkContains(e,t,r,s){if(h(e.getContains()))return;let n=await ey.countContains(t,e,r,s,h(e.getMinContains())&&h(e.getMaxContains()));if(0===n)throw new eS(eZ.path(t),"None of the items are of type contains schema");if(!h(e.getMinContains())&&e.getMinContains()>n)throw new eS(eZ.path(t),"The minimum number of the items of type contains schema should be "+e.getMinContains()+" but found "+n);if(!h(e.getMaxContains())&&e.getMaxContains()<n)throw new eS(eZ.path(t),"The maximum number of the items of type contains schema should be "+e.getMaxContains()+" but found "+n)}static async countContains(e,t,r,s,n){let a=0;for(let i=0;i<s.length;i++){let o=e?[...e]:[];try{if(await eZ.validate(o,t.getContains(),r,s[i]),a++,n)break}catch(e){}}return a}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()&&new Set(r).size!==r.length)throw new eS(eZ.path(e),"Items on the array are not unique")}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new eS(eZ.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new eS(eZ.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static async checkItems(e,t,r,s,n,a){if(!t.getItems())return;let i=t.getItems();if(i.getSingleSchema())for(let t=0;t<s.length;t++){let o=e?[...e]:[];s[t]=await eZ.validate(o,i.getSingleSchema(),r,s[t],n,a)}if(i.getTupleSchema()){if(i.getTupleSchema().length!==s.length&&h(t?.getAdditionalItems()))throw new eS(eZ.path(e),"Expected an array with only "+i.getTupleSchema().length+" but found "+s.length);await this.checkItemsInTupleSchema(e,r,s,i),await this.checkAdditionalItems(e,t,r,s,i)}}static async checkItemsInTupleSchema(e,t,r,s,n,a){for(let i=0;i<s.getTupleSchema()?.length;i++){let o=e?[...e]:[];r[i]=await eZ.validate(o,s.getTupleSchema()[i],t,r[i],n,a)}}static async checkAdditionalItems(e,t,r,s,n){if(!h(t.getAdditionalItems())){let a=t.getAdditionalItems();if(a?.getBooleanValue()){let i=D.ofAny("item");if(a?.getBooleanValue()===!1&&s.length>n.getTupleSchema()?.length)throw new eS(eZ.path(e),"No Additional Items are defined");await this.checkEachItemInAdditionalItems(e,t,r,s,n,i)}else if(a?.getSchemaValue()){let i=a.getSchemaValue();await this.checkEachItemInAdditionalItems(e,t,r,s,n,i)}}}static async checkEachItemInAdditionalItems(e,t,r,s,n,a){for(let t=n.getTupleSchema()?.length;t<s.length;t++){let n=e?[...e]:[];s[t]=await eZ.validate(n,a,r,s[t])}}constructor(){}}var ex={};E(ex,"BooleanValidator",()=>eL);class eL{static validate(e,t,r){if(h(r))throw new eS(eZ.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new eS(eZ.path(e),r.toString()+" is not a boolean");return r}constructor(){}}var ev={};E(ev,"NullValidator",()=>eU);class eU{static validate(e,t,r){if(h(r))return r;throw new eS(eZ.path(e),"Expected a null but found "+r)}constructor(){}}var eV={};E(eV,"NumberValidator",()=>eC);class eC{static validate(e,t,r,s){if(h(s))throw new eS(eZ.path(t),"Expected a number but found null");if("number"!=typeof s)throw new eS(eZ.path(t),s.toString()+" is not a "+e);let n=eC.extractNumber(e,t,r,s);return eC.checkRange(t,r,s,n),eC.checkMultipleOf(t,r,s,n),s}static extractNumber(e,t,r,s){let n=s;try{(e==p.LONG||e==p.INTEGER)&&(n=Math.round(n))}catch(r){throw new eS(eZ.path(t),s+" is not a number of type "+e,r)}if(h(n)||(e==p.LONG||e==p.INTEGER)&&n!=s)throw new eS(eZ.path(t),s.toString()+" is not a number of type "+e);return n}static checkMultipleOf(e,t,r,s){if(t.getMultipleOf()&&s%t.getMultipleOf()!=0)throw new eS(eZ.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}static checkRange(e,t,r,s){if(!h(t.getMinimum())&&0>eC.numberCompare(s,t.getMinimum()))throw new eS(eZ.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(!h(t.getMaximum())&&eC.numberCompare(s,t.getMaximum())>0)throw new eS(eZ.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(!h(t.getExclusiveMinimum())&&0>=eC.numberCompare(s,t.getExclusiveMinimum()))throw new eS(eZ.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(!h(t.getExclusiveMaximum())&&eC.numberCompare(s,t.getExclusiveMaximum())>0)throw new eS(eZ.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}var eD={};E(eD,"ObjectValidator",()=>eb);class eb{static async validate(e,t,r,s,n,a){if(h(s))throw new eS(eZ.path(e),"Expected an object but found null");if("object"!=typeof s||Array.isArray(s))throw new eS(eZ.path(e),s.toString()+" is not an Object");let i=new Set(Object.keys(s));return eb.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&await eb.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&eb.checkRequired(e,t,s),t.getProperties()&&await eb.checkProperties(e,t,r,s,i,n,a),t.getPatternProperties()&&await eb.checkPatternProperties(e,t,r,s,i),t.getAdditionalProperties()&&await eb.checkAdditionalProperties(e,t,r,s,i),s}static async checkPropertyNameSchema(e,t,r,s){for(let n of Array.from(s.values()))try{await eZ.validate(e,t.getPropertyNames(),r,n)}catch(t){throw new eS(eZ.path(e),"Property name '"+n+"' does not fit the property schema")}}static checkRequired(e,t,r){for(let s of t.getRequired()??[])if(h(r[s]))throw new eS(eZ.path(e),s+" is mandatory")}static async checkAdditionalProperties(e,t,r,s,n){let a=t.getAdditionalProperties();if(a.getSchemaValue())for(let t of Array.from(n.values())){let n=e?[...e]:[];s[t]=await eZ.validate(n,a.getSchemaValue(),r,s[t])}else if(!1===a.getBooleanValue()&&n.size)throw new eS(eZ.path(e),Array.from(n)+" is/are additional properties which are not allowed.")}static async checkPatternProperties(e,t,r,s,n){let a=new Map;for(let e of Array.from(t.getPatternProperties().keys()))a.set(e,new RegExp(e));for(let i of Array.from(n.values())){let o=e?[...e]:[];for(let e of Array.from(a.entries()))if(e[1].test(i)){s[i]=await eZ.validate(o,t.getPatternProperties().get(e[0]),r,s[i]),n.delete(i);break}}}static async checkProperties(e,t,r,s,n,a,i){for(let o of Array.from(t.getProperties())){let t=s[o[0]];if(!s.hasOwnProperty(o[0])&&h(t)&&h(await eO.getDefaultValue(o[1],r)))continue;let E=e?[...e]:[];s[o[0]]=await eZ.validate(E,o[1],r,t,a,i),n.delete(o[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new eS(eZ.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new eS(eZ.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}var eG={};E(eG,"StringValidator",()=>eB);var eF={};E(eF,"StringFormat",()=>eY);var eY=((r={}).DATETIME="DATETIME",r.TIME="TIME",r.DATE="DATE",r.EMAIL="EMAIL",r.REGEX="REGEX",r);class eB{static{this.TIME=/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/}static{this.DATE=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])$/}static{this.DATETIME=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])T([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/}static{this.EMAIL=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/}static validate(e,t,r){if(h(r))throw new eS(eZ.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new eS(eZ.path(e),r.toString()+" is not String");t.getFormat()==eY.TIME?eB.patternMatcher(e,t,r,eB.TIME,"time pattern"):t.getFormat()==eY.DATE?eB.patternMatcher(e,t,r,eB.DATE,"date pattern"):t.getFormat()==eY.DATETIME?eB.patternMatcher(e,t,r,eB.DATETIME,"date time pattern"):t.getFormat()==eY.EMAIL?eB.patternMatcher(e,t,r,eB.EMAIL,"email pattern"):t.getPattern()&&eB.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let s=r.length;if(t.getMinLength()&&s<t.getMinLength())throw new eS(eZ.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&s>t.getMaxLength())throw new eS(eZ.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,s,n){if(!s.test(r))throw new eS(eZ.path(e),r.toString()+" is not matched with the "+n)}constructor(){}}var eH=((s={}).STRICT="STRICT",s.LENIENT="LENIENT",s.USE_DEFAULT="USE_DEFAULT",s.SKIP="SKIP",s);const ek=e=>eH[e.toUpperCase()],e$=()=>Object.values(eH);class ej extends Error{constructor(e,t,r,s,n=[],a){super(r+(n?n.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.source=t??null,this.mode=s??null,this.cause=a}getSchemaPath(){return this.schemaPath}getSource(){return this.source??null}getMode(){return this.mode??null}getCause(){return this.cause}}class eW{static handleUnConvertibleValue(e,t,r,s){return this.handleUnConvertibleValueWithDefault(e,t,r,null,s)}static handleUnConvertibleValueWithDefault(e,t,r,s,n){switch(null===t&&(t=eH.STRICT),t){case eH.STRICT:throw new ej(eZ.path(e),r,n,t);case eH.LENIENT:return null;case eH.USE_DEFAULT:return s;case eH.SKIP:return r;default:throw new ej(eZ.path(e),r,"Invalid conversion mode")}}constructor(){}}class eX{static convert(e,t,r,s){if(h(s))return eW.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Expected a string but found null");let n=s??("object"==typeof s?JSON.stringify(s):String(s));return this.getConvertedString(n,r)}static getConvertedString(e,t){return t===eH.STRICT?e.toString():e.trim()}static getDefault(e){return e.getDefaultValue()??null}constructor(){}}class eJ{static convert(e,t,r,s,n){if(h(n))return eW.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),"Expected a number but found null");if("object"==typeof n||"boolean"==typeof n||Array.isArray(n)||"string"==typeof n&&isNaN(n=Number(n)))return eW.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),n+" is not a "+t);let a=this.extractNumber(t,n,s);return null===a?eW.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),n+" is not a "+t):a}static extractNumber(e,t,r){if("number"!=typeof t)return null;switch(e){case p.INTEGER:return this.isInteger(t,r)?Math.floor(t):null;case p.LONG:return this.isLong(t,r)?Math.floor(t):null;case p.DOUBLE:return t;case p.FLOAT:return this.isFloat(t,r)?t:null;default:return null}}static isInteger(e,t){return t!==eH.STRICT?"number"==typeof e:Number.isInteger(e)}static isLong(e,t){return t!==eH.STRICT?"number"==typeof e:Number.isInteger(e)&&e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER}static isFloat(e,t){return t!==eH.STRICT?"number"==typeof e:e>=-Number.MAX_VALUE&&e<=Number.MAX_VALUE}static getDefault(e){return"number"==typeof e.getDefaultValue()?Number(e.getDefaultValue):null}}class eq{static{this.BOOLEAN_MAP={true:!0,t:!0,yes:!0,y:!0,1:!0,false:!1,f:!1,no:!1,n:!1,0:!1}}static convert(e,t,r,s){return null==s?eW.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Expected a boolean but found null"):this.getBooleanPrimitive(s)??eW.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Unable to convert to boolean")}static getBooleanPrimitive(e){return"boolean"==typeof e?e:"string"==typeof e?this.handleStringValue(e):"number"==typeof e?this.handleNumberValue(e):null}static handleStringValue(e){let t=e.toLowerCase().trim();return eq.BOOLEAN_MAP[t]??null}static handleNumberValue(e){return 0===e||1===e?1===e:null}static getDefault(e){return e.getDefaultValue()??!1}constructor(){}}class ez{static convert(e,t,r,s){return h(s)?s:"string"==typeof s&&"null"===s.toLowerCase()?null:eW.handleUnConvertibleValueWithDefault(e,r,s,null,"Unable to convert to null")}constructor(){}}class eK{static handleValidationError(e,t,r,s,n){switch(t=t??eH.STRICT){case eH.STRICT:throw new eS(eZ.path(e),n);case eH.LENIENT:return null;case eH.USE_DEFAULT:return s;case eH.SKIP:return r}}constructor(){}}class eQ{static async validate(e,t,r,s,n,a,i){return t==p.OBJECT?await eb.validate(e,r,s,n,a,i):t==p.ARRAY?await ey.validate(e,r,s,n,a,i):this.handleTypeValidationAndConversion(e,t,r,n,a,i)}static async handleTypeValidationAndConversion(e,t,r,s,n,a){let i=n?this.convertElement(e,t,r,s,a??eH.STRICT):s;return await this.validateElement(e,t,r,i,a??eH.STRICT)}static convertElement(e,t,r,s,n){if(h(t))return eW.handleUnConvertibleValueWithDefault(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type for conversion.",t));switch(t){case p.STRING:return eX.convert(e,r,n,s);case p.INTEGER:case p.LONG:case p.DOUBLE:case p.FLOAT:return eJ.convert(e,t,r,n,s);case p.BOOLEAN:return eq.convert(e,r,n,s);case p.NULL:return ez.convert(e,r,n,s);default:return eW.handleUnConvertibleValueWithDefault(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type for conversion.",t))}}static validateElement(e,t,r,s,n){if(h(t))return eK.handleValidationError(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type.",t));switch(t){case p.STRING:return eB.validate(e,r,s);case p.INTEGER:case p.LONG:case p.DOUBLE:case p.FLOAT:return eC.validate(t,e,r,s);case p.BOOLEAN:return eL.validate(e,r,s);case p.NULL:return eU.validate(e,r,s);default:return eK.handleValidationError(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type.",t))}}constructor(){}}class eZ{static{this.ORDER={[p.OBJECT]:0,[p.ARRAY]:1,[p.DOUBLE]:2,[p.FLOAT]:3,[p.LONG]:4,[p.INTEGER]:5,[p.STRING]:6,[p.BOOLEAN]:7,[p.NULL]:8}}static path(e){return e?e.map(e=>e.getTitle()??"").filter(e=>!!e).reduce((e,t,r)=>e+(0===r?"":".")+t,""):""}static async validate(e,t,r,s,n,a){if(!t)throw new eS(eZ.path(e),"No schema found to validate");if(e||(e=[]),e.push(t),h(s)&&!h(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(!h(t.getConstant()))return eZ.constantValidation(e,t,s);if(t.getEnums()?.length)return eZ.enumCheck(e,t,s);if(t.getFormat()&&h(t.getType()))throw new eS(this.path(e),"Type is missing in schema for declared "+t.getFormat()?.toString()+" format.");if(!0===n&&h(t.getType()))throw new eS(this.path(e),"Type is missing in schema for declared "+a);if(t.getType()&&(s=await eZ.typeValidation(e,t,r,s,n,a)),!eg.isNullOrBlank(t.getRef()))return await eZ.validate(e,await eO.getSchemaFromRef(e[0],r,t.getRef()),r,s,n,a);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&(s=await ed.validate(e,t,r,s,n,a)),t.getNot()){let i;try{await eZ.validate(e,t.getNot(),r,s,n,a),i=!0}catch(e){i=!1}if(i)throw new eS(eZ.path(e),"Schema validated value in not condition.")}return s}static constantValidation(e,t,r){if(!eR(t.getConstant(),r))throw new eS(eZ.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let s=!1;for(let e of t.getEnums()??[])if(e===r){s=!0;break}if(s)return r;throw new eS(eZ.path(e),"Value is not one of "+t.getEnums())}static async typeValidation(e,t,r,s,n,a){let i=Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]).sort((e,t)=>(this.ORDER[e]??1/0)-(this.ORDER[t]??1/0)),o=[];for(let E of i)try{return await eQ.validate(e,E,t,r,s,n,a)}catch(e){o.push(e)}throw new eS(eZ.path(e),"Value "+JSON.stringify(s)+" is not of valid type(s)",o)}constructor(){}}class e0{async validateArguments(e,t,r){let s=new Map;for(let n of Array.from(this.getSignature().getParameters().entries())){let a=n[1];try{let r=await this.validateArgument(e,t,n,a);s.set(r.getT1(),r.getT2())}catch(t){let e=this.getSignature();throw new er(`Error while executing the function ${e.getNamespace()}.${e.getName()}'s parameter ${a.getParameterName()} with step name '${r?.getStatement().getStatementName()??"Unknown Step"}' with error : ${t?.message}`)}}return s}async validateArgument(e,t,r,s){let n,a=r[0],i=e.get(r[0]);if(h(i)&&!s.isVariableArgument())return new eN(a,await eZ.validate(void 0,s.getSchema(),t,void 0));if(!s?.isVariableArgument())return new eN(a,await eZ.validate(void 0,s.getSchema(),t,i));Array.isArray(i)?n=i:(n=[],h(i)?h(s.getSchema().getDefaultValue())||n.push(s.getSchema().getDefaultValue()):n.push(i));for(let e=0;e<n.length;e++)n[e]=await eZ.validate(void 0,s.getSchema(),t,n[e]);return new eN(a,n)}async execute(e){let t=await this.validateArguments(e.getArguments()??new Map,e.getSchemaRepository(),e.getStatementExecution());e.setArguments(t);try{return await this.internalExecute(e)}catch(r){let t=this.getSignature();throw new er(`Error while executing the function ${t.getNamespace()}.${t.getName()} with step name '${e.getStatementExecution()?.getStatement().getStatementName()??"Unknown Step"}' with error : ${r?.message}`)}}getProbableEventSignature(e){return this.getSignature().getEvents()}}class e1 extends e0{static{this.EVENT_INDEX_NAME="index"}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_INDEX=new Q(Q.OUTPUT,j.of(e1.EVENT_INDEX_NAME,D.ofInteger(e1.EVENT_INDEX_NAME)))}static{this.EVENT_RESULT_INTEGER=new Q(Q.OUTPUT,j.of(e1.EVENT_RESULT_NAME,D.ofInteger(e1.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_BOOLEAN=new Q(Q.OUTPUT,j.of(e1.EVENT_RESULT_NAME,D.ofBoolean(e1.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_ARRAY=new Q(Q.OUTPUT,j.of(e1.EVENT_RESULT_NAME,D.ofArray(e1.EVENT_RESULT_NAME,D.ofAny(e1.EVENT_RESULT_NAME))))}static{this.EVENT_RESULT_EMPTY=new Q(Q.OUTPUT,j.of())}static{this.EVENT_RESULT_ANY=new Q(Q.OUTPUT,j.of(this.EVENT_RESULT_NAME,D.ofAny(this.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_OBJECT=new Q(Q.OUTPUT,j.of(this.EVENT_RESULT_NAME,D.ofObject(this.EVENT_RESULT_NAME)))}static{this.PARAMETER_INT_LENGTH=k.of("length",D.ofInteger("length").setDefaultValue(-1))}static{this.PARAMETER_ARRAY_FIND=k.of("find",D.ofArray("eachFind",D.ofAny("eachFind")))}static{this.PARAMETER_INT_SOURCE_FROM=k.of("srcFrom",D.ofInteger("srcFrom").setDefaultValue(0).setMinimum(0))}static{this.PARAMETER_INT_SECOND_SOURCE_FROM=k.of("secondSrcFrom",D.ofInteger("secondSrcFrom").setDefaultValue(0))}static{this.PARAMETER_INT_FIND_FROM=k.of("findFrom",D.ofInteger("findFrom").setDefaultValue(0))}static{this.PARAMETER_INT_OFFSET=k.of("offset",D.ofInteger("offset").setDefaultValue(0))}static{this.PARAMETER_ROTATE_LENGTH=k.of("rotateLength",D.ofInteger("rotateLength").setDefaultValue(1).setMinimum(1))}static{this.PARAMETER_BOOLEAN_ASCENDING=k.of("ascending",D.ofBoolean("ascending").setDefaultValue(!0))}static{this.PARAMETER_KEY_PATH=k.of("keyPath",D.ofString("keyPath").setDefaultValue(""))}static{this.PARAMETER_FIND_PRIMITIVE=k.of("findPrimitive",D.of("findPrimitive",p.STRING,p.DOUBLE,p.FLOAT,p.INTEGER,p.LONG))}static{this.PARAMETER_ARRAY_SOURCE=k.of("source",D.ofArray("eachSource",D.ofAny("eachSource")))}static{this.PARAMETER_ARRAY_SECOND_SOURCE=k.of("secondSource",D.ofArray("eachSecondSource",D.ofAny("eachSecondSource")))}static{this.PARAMETER_ARRAY_SOURCE_PRIMITIVE=k.of("source",D.ofArray("eachSource",new D().setName("eachSource").setType(d.of(p.STRING,p.NULL,p.INTEGER,p.FLOAT,p.DOUBLE,p.LONG))))}static{this.PARAMETER_BOOLEAN_DEEP_COPY=k.of("deepCopy",D.ofBoolean("deepCopy").setDefaultValue(!0))}static{this.PARAMETER_ANY=k.of("element",D.ofAny("element"))}static{this.PARAMETER_ANY_ELEMENT_OBJECT=k.of("elementObject",D.ofAny("elementObject"))}static{this.PARAMETER_ANY_VAR_ARGS=k.of("element",D.ofAny("element")).setVariableArgument(!0)}static{this.PARAMETER_ARRAY_RESULT=k.of(e1.EVENT_RESULT_NAME,D.ofArray("eachResult",D.ofAny("eachResult")))}constructor(e,t,r){super();let s=new Map;for(let e of t)s.set(e.getParameterName(),e);this.signature=new ea(e).setNamespace(l.SYSTEM_ARRAY).setParameters(s).setEvents(j.of(r.getName(),r))}getSignature(){return this.signature}}class e2 extends e1{constructor(){super("Concatenate",[e1.PARAMETER_ARRAY_SOURCE,e1.PARAMETER_ARRAY_SECOND_SOURCE],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName());return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,[...t,...r]]]))])}}class e9 extends e1{constructor(){super("AddFirst",[e1.PARAMETER_ARRAY_SOURCE,e1.PARAMETER_ANY],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e1.PARAMETER_ANY.getParameterName());if(0==(t=[...t]).length)return t.push(r),new es([Z.outputOf(new Map([]))]);t.push(r);let s=t.length-1;for(;s>0;){let e=t[s-1];t[s-1]=t[s],t[s--]=e}return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}const e3="keyName";class e4 extends e1{constructor(){super("ArrayToArrayOfObjects",[e1.PARAMETER_ARRAY_SOURCE,k.of(e3,D.ofString(e3),!0)],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e3);if(!t?.length)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,[]]]))]);let s=t.map(e=>{let t={};if(Array.isArray(e)){if(r.length)r.forEach((r,s)=>{t[r]=e[s]});else for(let r=0;r<e.length;r++)t[`value${r+1}`]=e[r]}else t[r.length?r[0]:"value"]=e;return t});return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,s]]))])}}var e5={};E(e5,"PrimitiveUtil",()=>e8);var e6={};E(e6,"ExecutionException",()=>e7);class e7 extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class e8{static findPrimitiveNullAsBoolean(e){if(h(e))return new eN(p.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new e7(eT.format("$ is not a primitive type",e));return"boolean"===t?new eN(p.BOOLEAN,e):"string"===t?new eN(p.STRING,e):e8.findPrimitiveNumberType(e)}static findPrimitive(e){if(h(e))return new eN(p.NULL,void 0);let t=typeof e;if("object"===t)throw new e7(eT.format("$ is not a primitive type",e));return"boolean"===t?new eN(p.BOOLEAN,e):"string"===t?new eN(p.STRING,e):e8.findPrimitiveNumberType(e)}static findPrimitiveNumberType(e){if(h(e)||Array.isArray(e)||"object"==typeof e)throw new e7(eT.format("Unable to convert $ to a number.",e));try{if(Number.isInteger(e))return new eN(p.LONG,e);return new eN(p.DOUBLE,e)}catch(t){throw new e7(eT.format("Unable to convert $ to a number.",e),t)}}static compare(e,t){if(e==t)return 0;if(h(e)||h(t))return h(e)?-1:1;if(Array.isArray(e)||Array.isArray(t)){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!=t.length)return e.length-t.length;for(let r=0;r<e.length;r++){let s=this.compare(e[r],t[r]);if(0!=s)return s}return 0}return Array.isArray(e)?-1:1}let r=typeof e,s=typeof t;return"object"===r||"object"===s?("object"===r&&"object"===s&&Object.keys(e).forEach(r=>{let s=this.compare(e[r],t[r]);if(0!=s)return s}),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return h(e)||h(t)?h(e)&&h(t)?0:h(e)?-1:1:e==t?0:"boolean"==typeof e||"boolean"==typeof t?e?-1:1:"string"==typeof e||"string"==typeof t?e+""<t+""?-1:1:"number"==typeof e||"number"==typeof t?e-t:0}static baseNumberType(e){return Number.isInteger(e)?p.LONG:p.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class te extends e1{constructor(){super("BinarySearch",[te.PARAMETER_ARRAY_SOURCE_PRIMITIVE,te.PARAMETER_INT_SOURCE_FROM,te.PARAMETER_FIND_PRIMITIVE,te.PARAMETER_INT_LENGTH],te.EVENT_INDEX)}async internalExecute(e){let t=e?.getArguments()?.get(te.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(te.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(te.PARAMETER_FIND_PRIMITIVE.getParameterName()),n=e?.getArguments()?.get(te.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length||r<0||r>t.length)throw new er("Search source array cannot be empty");if(-1==n&&(n=t.length-r),(n=r+n)>t.length)throw new er("End point for array cannot be more than the size of the source array");let a=-1;for(;r<=n;){let e=Math.floor((r+n)/2);if(0==e8.compare(t[e],s)){a=e;break}e8.compare(t[e],s)>0?n=e-1:r=e+1}return new es([Z.outputOf(new Map([[te.EVENT_INDEX_NAME,a]]))])}}var tt={};E(tt,"ArrayUtil",()=>tr);class tr{static removeAListFrom(e,t){if(!t||!e||!e.length||!t.length)return;let r=new Set(t);for(let t=0;t<e.length;t++)r.has(e[t])&&(e.splice(t,1),t--)}static of(...e){let t=Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r];return t}constructor(){}}class ts extends e1{constructor(){super("Compare",tr.of(ts.PARAMETER_ARRAY_SOURCE,ts.PARAMETER_INT_SOURCE_FROM,ts.PARAMETER_ARRAY_FIND,ts.PARAMETER_INT_FIND_FROM,ts.PARAMETER_INT_LENGTH),ts.EVENT_RESULT_INTEGER)}async internalExecute(e){var t=e?.getArguments()?.get(ts.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ts.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(ts.PARAMETER_ARRAY_FIND.getParameterName()),n=e?.getArguments()?.get(ts.PARAMETER_INT_FIND_FROM.getParameterName()),a=e?.getArguments()?.get(ts.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new er("Compare source array cannot be empty");if(0==s.length)throw new er("Compare find array cannot be empty");if(-1==a&&(a=t.length-r),r+a>t.length)throw new er(eT.format("Source array size $ is less than comparing size $",t.length,r+a));if(n+a>s.length)throw new er(eT.format("Find array size $ is less than comparing size $",s.length,n+a));return new es(tr.of(Z.outputOf(j.of(ts.EVENT_RESULT_NAME,this.compare(t,r,r+a,s,n,n+a)))))}compare(e,t,r,s,n,a){if(r<t){let e=t;t=r,r=e}if(a<n){let e=n;n=a,a=e}if(r-t!=a-n)throw new er(eT.format("Cannot compare uneven arrays from $ to $ in source array with $ to $ in find array",r,t,a,n));for(let a=t,i=n;a<r;a++,i++){let t=1;if(h(e[a])||h(s[i])){let r=h(e[a]);r==h(s[i])?t=0:r&&(t=-1)}else{let r=typeof e[a],n=typeof s[i];if("object"===r||"object"===n)t=1;else if("string"===r||"string"===n){let r=""+e[a],n=""+s[i];r===n?t=0:r<n&&(t=-1)}else"boolean"===r||"boolean"===n?t=r==n?0:1:"number"===r&&"number"===n&&(t=e[a]-s[i])}if(0!=t)return t}return 0}}var tn={};function ta(e){return e?"function"==typeof globalThis.structuredClone?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e)):e}E(tn,"duplicate",()=>ta);class ti extends e1{constructor(){super("Copy",[ti.PARAMETER_ARRAY_SOURCE,ti.PARAMETER_INT_SOURCE_FROM,ti.PARAMETER_INT_LENGTH,ti.PARAMETER_BOOLEAN_DEEP_COPY],ti.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(ti.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ti.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(ti.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),r+s>t.length)throw new er(eT.format("Array has no elements from $ to $ as the array size is $",r,r+s,t.length));var n=e?.getArguments()?.get(ti.PARAMETER_BOOLEAN_DEEP_COPY.getParameterName());let a=Array(s);for(let e=r;e<r+s;e++)h(t[e])||(a[e-r]=n?ta(t[e]):t[e]);return new es([Z.outputOf(j.of(ti.EVENT_RESULT_NAME,a))])}}class to extends e1{constructor(){super("Delete",[e1.PARAMETER_ARRAY_SOURCE,e1.PARAMETER_ANY_VAR_ARGS],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(to.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(to.PARAMETER_ANY_VAR_ARGS.getParameterName());if(null==r)throw new er("The deletable var args are empty. So cannot be proceeded further.");if(0==t.length||0==r.length)throw new er("Expected a source or deletable for an array but not found any");let s=new Set;for(let e=t.length-1;e>=0;e--)for(let n=0;n<r.length;n++)s.has(e)||0!=e8.compare(t[e],r[n])||s.add(t[e]);return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t.filter(e=>!s.has(e))]]))])}}class tE extends e1{constructor(){super("DeleteFirst",[tE.PARAMETER_ARRAY_SOURCE],tE.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tE.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new er("Given source array is empty");return(t=[...t]).shift(),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tu extends e1{constructor(){super("DeleteFrom",[tu.PARAMETER_ARRAY_SOURCE,tu.PARAMETER_INT_SOURCE_FROM,tu.PARAMETER_INT_LENGTH],tu.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tu.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tu.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tu.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new er("There are no elements to be deleted");if(r>=(t=[...t]).length||r<0)throw new er("The int source for the array should be in between 0 and length of the array ");if(-1==s&&(s=t.length-r),r+s>t.length)throw new er("Requested length to be deleted is more than the size of array ");return t.splice(r,s),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tA extends e1{constructor(){super("DeleteLast",[tA.PARAMETER_ARRAY_SOURCE],tA.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tA.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new er("Given source array is empty");return(t=[...t]).pop(),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tT extends e1{constructor(){super("Disjoint",[tT.PARAMETER_ARRAY_SOURCE,tT.PARAMETER_INT_SOURCE_FROM,tT.PARAMETER_ARRAY_SECOND_SOURCE,tT.PARAMETER_INT_SECOND_SOURCE_FROM,tT.PARAMETER_INT_LENGTH],tT.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tT.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tT.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tT.PARAMETER_INT_LENGTH.getParameterName());if(-1==a&&(a=t.length<=s.length?t.length-r:s.length-n),a>t.length||a>s.length||r+a>t.length||n+a>s.length)throw new er("The length which was being requested is more than than the size either source array or second source array");let i=new Set,o=new Set;for(let e=0;e<a;e++)i.add(t[e+r]);for(let e=0;e<a;e++)o.add(s[e+n]);let E=new Set;return i.forEach(e=>{o.has(e)?o.delete(e):E.add(e)}),o.forEach(e=>{i.has(e)||E.add(e)}),new es([Z.outputOf(new Map([[tT.EVENT_RESULT_NAME,[...E]]]))])}}class tl extends e1{constructor(){super("Equals",[tl.PARAMETER_ARRAY_SOURCE,tl.PARAMETER_INT_SOURCE_FROM,tl.PARAMETER_ARRAY_FIND,tl.PARAMETER_INT_FIND_FROM,tl.PARAMETER_INT_LENGTH],tl.EVENT_RESULT_BOOLEAN)}async internalExecute(e){let t=new ts,r=(await t.execute(e)).allResults()[0].getResult().get(tl.EVENT_RESULT_NAME);return new es([Z.outputOf(j.of(tl.EVENT_RESULT_NAME,0==r))])}}class tm extends e1{constructor(){super("Fill",[tm.PARAMETER_ARRAY_SOURCE,tm.PARAMETER_INT_SOURCE_FROM,tm.PARAMETER_INT_LENGTH,tm.PARAMETER_ANY],tm.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tm.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tm.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tm.PARAMETER_INT_LENGTH.getParameterName()),n=e?.getArguments()?.get(tm.PARAMETER_ANY.getParameterName());if(r<0)throw new er(eT.format("Arrays out of bound trying to access $ index",r));-1==s&&(s=t.length-r);let a=r+s-t.length;if(t=[...t],a>0)for(let e=0;e<a;e++)t.push();for(let e=r;e<r+s;e++)t[e]=h(n)?n:ta(n);return new es([Z.outputOf(j.of(e1.EVENT_RESULT_NAME,t))])}}class tR extends e1{constructor(){super("Frequency",[tR.PARAMETER_ARRAY_SOURCE,tR.PARAMETER_ANY,tR.PARAMETER_INT_SOURCE_FROM,tR.PARAMETER_INT_LENGTH],tR.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tR.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tR.PARAMETER_ANY.getParameterName()),s=e?.getArguments()?.get(tR.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tR.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[tR.EVENT_RESULT_NAME,0]]))]);if(s>t.length)throw new er("Given start point is more than the size of source");let a=s+n;if(-1==n&&(a=t.length-s),a>t.length)throw new er("Given length is more than the size of source");let i=0;for(let e=s;e<a&&e<t.length;e++)0==e8.compare(t[e],r)&&i++;return new es([Z.outputOf(new Map([[tR.EVENT_RESULT_NAME,i]]))])}}class th extends e1{constructor(){super("IndexOf",[th.PARAMETER_ARRAY_SOURCE,th.PARAMETER_ANY_ELEMENT_OBJECT,th.PARAMETER_INT_FIND_FROM],th.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(th.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(th.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),s=e?.getArguments()?.get(th.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[th.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length)throw new er("The size of the search index of the array is greater than the size of the array");let n=-1;for(let e=s;e<t.length;e++)if(0==e8.compare(t[e],r)){n=e;break}return new es([Z.outputOf(new Map([[th.EVENT_RESULT_NAME,n]]))])}}class tg extends e1{constructor(){super("IndexOfArray",[tg.PARAMETER_ARRAY_SOURCE,tg.PARAMETER_ARRAY_SECOND_SOURCE,tg.PARAMETER_INT_FIND_FROM],tg.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tg.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length||0==r.length)return new es([Z.outputOf(new Map([[tg.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length||t.length<r.length)throw new er("Given from second source is more than the size of the source array");let n=r.length,a=-1;for(let e=s;e<t.length;e++){let s=0;if(0==e8.compare(t[e],r[s])){for(;s<n&&0==e8.compare(t[e+s],r[s]);)s++;if(s==n){a=e;break}}}return new es([Z.outputOf(new Map([[tg.EVENT_RESULT_NAME,a]]))])}}class tc extends e1{constructor(){super("LastIndexOf",[tc.PARAMETER_ARRAY_SOURCE,tc.PARAMETER_ANY_ELEMENT_OBJECT,tc.PARAMETER_INT_FIND_FROM],tc.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tc.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tc.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),s=e?.getArguments()?.get(tc.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[tc.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length)throw new er("The value of length shouldn't the exceed the size of the array or shouldn't be in terms");let n=-1;for(let e=t.length-1;e>=s;e--)if(0==e8.compare(t[e],r)){n=e;break}return new es([Z.outputOf(new Map([[tc.EVENT_RESULT_NAME,n]]))])}}class tp extends e1{constructor(){super("LastIndexOfArray",[tp.PARAMETER_ARRAY_SOURCE,tp.PARAMETER_ARRAY_SECOND_SOURCE,tp.PARAMETER_INT_FIND_FROM],tp.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tp.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[tp.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length||r.length>t.length)throw new er("Given from index is more than the size of the source array");let n=r.length,a=-1;for(let e=s;e<t.length;e++){let s=0;if(0==e8.compare(t[e],r[s])){for(;s<n&&0==e8.compare(t[e+s],r[s]);)s++;s==n&&(a=e)}}return new es([Z.outputOf(new Map([[tp.EVENT_RESULT_NAME,a]]))])}}class tN extends e1{constructor(){super("Max",[tN.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tN.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tN.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==t.length)throw new er("Search source array cannot be empty");let r=t[0];for(let e=1;e<t.length;e++){let s=t[e];e8.comparePrimitive(r,s)>=0||(r=s)}return new es([Z.outputOf(new Map([[tN.EVENT_RESULT_NAME,r]]))])}}class tf extends e1{constructor(){super("Min",[tf.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tf.EVENT_RESULT_ANY)}async internalExecute(e){let t,r=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==r.length)throw new er("Search source array cannot be empty");for(let e=0;e<r.length;e++)!h(r[e])&&(void 0===t||0>e8.comparePrimitive(r[e],t))&&(t=r[e]);return new es([Z.outputOf(new Map([[tf.EVENT_RESULT_NAME,t]]))])}}class t_ extends e1{constructor(){super("MisMatch",[t_.PARAMETER_ARRAY_SOURCE,t_.PARAMETER_INT_FIND_FROM,t_.PARAMETER_ARRAY_SECOND_SOURCE,t_.PARAMETER_INT_SECOND_SOURCE_FROM,t_.PARAMETER_INT_LENGTH],t_.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t_.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(t_.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(t_.PARAMETER_INT_LENGTH.getParameterName()),i=r<t.length&&r>0?r:0,o=n<s.length&&n>0?n:0;if(i+a>=t.length||o+a>s.length)throw new er("The size of the array for first and second which was being requested is more than size of the given array");let E=-1;for(let e=0;e<a;e++)if(t[i+e]!=s[o+e]){E=e;break}return new es([Z.outputOf(new Map([[t_.EVENT_RESULT_NAME,E]]))])}}class tM extends e1{constructor(){super("Reverse",[tM.PARAMETER_ARRAY_SOURCE,tM.PARAMETER_INT_SOURCE_FROM,tM.PARAMETER_INT_LENGTH],tM.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tM.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tM.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tM.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),s>=t.length||s<0||r<0)throw new er("Please provide start point between the start and end indexes or provide the length which was less than the source size ");t=[...t];let n=r+s-1;for(;r<=n;){let e=t[r],s=t[n];t[r++]=s,t[n--]=e}return new es([Z.outputOf(new Map([[tM.EVENT_RESULT_NAME,t]]))])}}class tS extends e1{constructor(){super("Rotate",[tS.PARAMETER_ARRAY_SOURCE,tS.PARAMETER_ROTATE_LENGTH],tS.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tS.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tS.PARAMETER_ROTATE_LENGTH.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);let s=(t=[...t]).length;return r%=s,this.rotate(t,0,r-1),this.rotate(t,r,s-1),this.rotate(t,0,s-1),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}rotate(e,t,r){for(;t<r;){let s=e[t];e[t++]=e[r],e[r--]=s}}}class tO extends e1{constructor(){super("Shuffle",[tO.PARAMETER_ARRAY_SOURCE],tO.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tO.PARAMETER_ARRAY_SOURCE.getParameterName());if(t.length<=1)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);let r=0,s=(t=[...t]).length;for(let e=0;e<s;e++){let e=Math.floor(Math.random()*s)%s,n=t[r];t[r]=t[e],t[e]=n,r=e}return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}var tw={};E(tw,"ObjectValueSetterExtractor",()=>tY);var td={};E(td,"Expression",()=>tb);var tI={};E(tI,"StringBuilder",()=>tP);class tP{constructor(e){this.str=e??""}append(e){return this.str+=e,this}toString(){return""+this.str}trim(){return this.str=this.str.trim(),this}setLength(e){return this.str=this.str.substring(0,e),this}length(){return this.str.length}charAt(e){return this.str.charAt(e)}deleteCharAt(e){return this.checkIndex(e),this.str=this.str.substring(0,e)+this.str.substring(e+1),this}insert(e,t){return this.str=this.str.substring(0,e)+t+this.str.substring(e),this}checkIndex(e){if(e>=this.str.length)throw new er(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var ty={};E(ty,"ExpressionEvaluationException",()=>tx);class tx extends Error{constructor(e,t,r){super(eT.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var tL={};E(tL,"ExpressionToken",()=>tv);class tv{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var tU={};E(tU,"ExpressionTokenValue",()=>tV);class tV extends tv{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return eT.format("$: $",this.expression,this.element)}}var tC={};E(tC,"Operation",()=>tD);class tD{static{this.MULTIPLICATION=new tD("*")}static{this.DIVISION=new tD("/")}static{this.INTEGER_DIVISION=new tD("//")}static{this.MOD=new tD("%")}static{this.ADDITION=new tD("+")}static{this.SUBTRACTION=new tD("-")}static{this.NOT=new tD("not",void 0,!0)}static{this.AND=new tD("and",void 0,!0)}static{this.OR=new tD("or",void 0,!0)}static{this.LESS_THAN=new tD("<")}static{this.LESS_THAN_EQUAL=new tD("<=")}static{this.GREATER_THAN=new tD(">")}static{this.GREATER_THAN_EQUAL=new tD(">=")}static{this.EQUAL=new tD("=")}static{this.NOT_EQUAL=new tD("!=")}static{this.BITWISE_AND=new tD("&")}static{this.BITWISE_OR=new tD("|")}static{this.BITWISE_XOR=new tD("^")}static{this.BITWISE_COMPLEMENT=new tD("~")}static{this.BITWISE_LEFT_SHIFT=new tD("<<")}static{this.BITWISE_RIGHT_SHIFT=new tD(">>")}static{this.BITWISE_UNSIGNED_RIGHT_SHIFT=new tD(">>>")}static{this.UNARY_PLUS=new tD("UN: +","+")}static{this.UNARY_MINUS=new tD("UN: -","-")}static{this.UNARY_LOGICAL_NOT=new tD("UN: not","not")}static{this.UNARY_BITWISE_COMPLEMENT=new tD("UN: ~","~")}static{this.ARRAY_OPERATOR=new tD("[")}static{this.ARRAY_RANGE_INDEX_OPERATOR=new tD("..")}static{this.OBJECT_OPERATOR=new tD(".")}static{this.NULLISH_COALESCING_OPERATOR=new tD("??")}static{this.CONDITIONAL_TERNARY_OPERATOR=new tD("?")}static{this.VALUE_OF=new Map([["MULTIPLICATION",tD.MULTIPLICATION],["DIVISION",tD.DIVISION],["INTEGER_DIVISION",tD.INTEGER_DIVISION],["MOD",tD.MOD],["ADDITION",tD.ADDITION],["SUBTRACTION",tD.SUBTRACTION],["NOT",tD.NOT],["AND",tD.AND],["OR",tD.OR],["LESS_THAN",tD.LESS_THAN],["LESS_THAN_EQUAL",tD.LESS_THAN_EQUAL],["GREATER_THAN",tD.GREATER_THAN],["GREATER_THAN_EQUAL",tD.GREATER_THAN_EQUAL],["EQUAL",tD.EQUAL],["NOT_EQUAL",tD.NOT_EQUAL],["BITWISE_AND",tD.BITWISE_AND],["BITWISE_OR",tD.BITWISE_OR],["BITWISE_XOR",tD.BITWISE_XOR],["BITWISE_COMPLEMENT",tD.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",tD.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",tD.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",tD.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",tD.UNARY_PLUS],["UNARY_MINUS",tD.UNARY_MINUS],["UNARY_LOGICAL_NOT",tD.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",tD.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",tD.ARRAY_OPERATOR],["ARRAY_RANGE_INDEX_OPERATOR",tD.ARRAY_RANGE_INDEX_OPERATOR],["OBJECT_OPERATOR",tD.OBJECT_OPERATOR],["NULLISH_COALESCING_OPERATOR",tD.NULLISH_COALESCING_OPERATOR],["CONDITIONAL_TERNARY_OPERATOR",tD.CONDITIONAL_TERNARY_OPERATOR]])}static{this.UNARY_OPERATORS=new Set([tD.ADDITION,tD.SUBTRACTION,tD.NOT,tD.BITWISE_COMPLEMENT,tD.UNARY_PLUS,tD.UNARY_MINUS,tD.UNARY_LOGICAL_NOT,tD.UNARY_BITWISE_COMPLEMENT])}static{this.ARITHMETIC_OPERATORS=new Set([tD.MULTIPLICATION,tD.DIVISION,tD.INTEGER_DIVISION,tD.MOD,tD.ADDITION,tD.SUBTRACTION])}static{this.LOGICAL_OPERATORS=new Set([tD.NOT,tD.AND,tD.OR,tD.LESS_THAN,tD.LESS_THAN_EQUAL,tD.GREATER_THAN,tD.GREATER_THAN_EQUAL,tD.EQUAL,tD.NOT_EQUAL,tD.NULLISH_COALESCING_OPERATOR])}static{this.BITWISE_OPERATORS=new Set([tD.BITWISE_AND,tD.BITWISE_COMPLEMENT,tD.BITWISE_LEFT_SHIFT,tD.BITWISE_OR,tD.BITWISE_RIGHT_SHIFT,tD.BITWISE_UNSIGNED_RIGHT_SHIFT,tD.BITWISE_XOR])}static{this.CONDITIONAL_OPERATORS=new Set([tD.CONDITIONAL_TERNARY_OPERATOR])}static{this.OPERATOR_PRIORITY=new Map([[tD.UNARY_PLUS,1],[tD.UNARY_MINUS,1],[tD.UNARY_LOGICAL_NOT,1],[tD.UNARY_BITWISE_COMPLEMENT,1],[tD.ARRAY_OPERATOR,1],[tD.OBJECT_OPERATOR,1],[tD.ARRAY_RANGE_INDEX_OPERATOR,2],[tD.MULTIPLICATION,2],[tD.DIVISION,2],[tD.INTEGER_DIVISION,2],[tD.MOD,2],[tD.ADDITION,3],[tD.SUBTRACTION,3],[tD.BITWISE_LEFT_SHIFT,4],[tD.BITWISE_RIGHT_SHIFT,4],[tD.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[tD.LESS_THAN,5],[tD.LESS_THAN_EQUAL,5],[tD.GREATER_THAN,5],[tD.GREATER_THAN_EQUAL,5],[tD.EQUAL,6],[tD.NOT_EQUAL,6],[tD.BITWISE_AND,7],[tD.BITWISE_XOR,8],[tD.BITWISE_OR,9],[tD.AND,10],[tD.OR,11],[tD.NULLISH_COALESCING_OPERATOR,11],[tD.CONDITIONAL_TERNARY_OPERATOR,12]])}static{this.OPERATORS=new Set([...Array.from(tD.ARITHMETIC_OPERATORS),...Array.from(tD.LOGICAL_OPERATORS),...Array.from(tD.BITWISE_OPERATORS),tD.ARRAY_OPERATOR,tD.ARRAY_RANGE_INDEX_OPERATOR,tD.OBJECT_OPERATOR,...Array.from(tD.CONDITIONAL_OPERATORS)].map(e=>e.getOperator()))}static{this.OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(tD.ARITHMETIC_OPERATORS),...Array.from(tD.LOGICAL_OPERATORS),...Array.from(tD.BITWISE_OPERATORS),tD.ARRAY_OPERATOR,tD.ARRAY_RANGE_INDEX_OPERATOR,tD.OBJECT_OPERATOR,...Array.from(tD.CONDITIONAL_OPERATORS)].filter(e=>!e.shouldBeWrappedInSpace()).map(e=>e.getOperator()))}static{this.OPERATION_VALUE_OF=new Map(Array.from(tD.VALUE_OF.entries()).map(([e,t])=>[t.getOperator(),t]))}static{this.UNARY_MAP=new Map([[tD.ADDITION,tD.UNARY_PLUS],[tD.SUBTRACTION,tD.UNARY_MINUS],[tD.NOT,tD.UNARY_LOGICAL_NOT],[tD.BITWISE_COMPLEMENT,tD.UNARY_BITWISE_COMPLEMENT],[tD.UNARY_PLUS,tD.UNARY_PLUS],[tD.UNARY_MINUS,tD.UNARY_MINUS],[tD.UNARY_LOGICAL_NOT,tD.UNARY_LOGICAL_NOT],[tD.UNARY_BITWISE_COMPLEMENT,tD.UNARY_BITWISE_COMPLEMENT]])}static{this.BIGGEST_OPERATOR_SIZE=Array.from(tD.VALUE_OF.values()).map(e=>e.getOperator()).filter(e=>!e.startsWith("UN: ")).map(e=>e.length).reduce((e,t)=>e>t?e:t,0)}constructor(e,t,r=!1){this.operator=e,this.operatorName=t??e,this._shouldBeWrappedInSpace=r}getOperator(){return this.operator}getOperatorName(){return this.operatorName}shouldBeWrappedInSpace(){return this._shouldBeWrappedInSpace}valueOf(e){return tD.VALUE_OF.get(e)}toString(){return this.operator}}class tb extends tv{constructor(e,t,r,s){super(e||""),this.tokens=new el,this.ops=new el,s?.getOperator()!=".."||(t?r||(r=new tV("","")):t=new tV("","")),t&&this.tokens.push(t),r&&this.tokens.push(r),s&&this.ops.push(s),this.evaluate(),this.ops.isEmpty()||".."!=this.ops.peekLast().getOperator()||1!=this.tokens.length||this.tokens.push(new tv(""))}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){let e;let t=this.expression.length,r="",s=new tP(""),n=0,a=!1;for(;n<t;){switch(r=this.expression[n],e=s.toString(),r){case" ":a=this.processTokenSepearator(s,e,a);break;case"(":n=this.processSubExpression(t,s,e,n,a),a=!1;break;case")":throw new tx(this.expression,"Extra closing parenthesis found");case"]":throw new tx(this.expression,"Extra closing square bracket found");case"'":case'"':{let e=this.processStringLiteral(t,r,n);n=e.getT1(),a=e.getT2();break}case"?":if(n+1<t&&"?"!=this.expression.charAt(n+1)&&0!=n&&"?"!=this.expression.charAt(n-1))n=this.processTernaryOperator(t,s,e,n,a);else{let i=this.processOthers(r,t,s,e,n,a);n=i.getT1(),(a=i.getT2())&&this.ops.peek()==tD.ARRAY_OPERATOR&&(n=(i=this.process(t,s,n)).getT1(),a=i.getT2())}break;default:let i=this.processOthers(r,t,s,e,n,a);n=i.getT1(),(a=i.getT2())&&this.ops.peek()==tD.ARRAY_OPERATOR&&(n=(i=this.process(t,s,n)).getT1(),a=i.getT2())}++n}if(e=s.toString(),!eg.isNullOrBlank(e)){if(tD.OPERATORS.has(e))throw new tx(this.expression,"Expression is ending with an operator");this.tokens.push(new tv(e))}}processStringLiteral(e,t,r){let s="",n=r+1;for(;n<e;n++){let e=this.expression.charAt(n);if(e==t&&"\\"!=this.expression.charAt(n-1))break;s+=e}if(n==e&&this.expression.charAt(n-1)!=t)throw new tx(this.expression,"Missing string ending marker "+t);let a=new eN(n,!1);return this.tokens.push(new tV(s,s)),a}process(e,t,r){let s=1;for(++r;r<e&&0!=s;){let e=this.expression.charAt(r);"]"==e?--s:"["==e&&++s,0!=s&&(t.append(e),r++)}return this.tokens.push(new tb(t.toString())),t.setLength(0),new eN(r,!1)}processOthers(e,t,r,s,n,a){let i=t-n;i=i<tD.BIGGEST_OPERATOR_SIZE?i:tD.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(n,n+e);if(tD.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return eg.isNullOrBlank(s)?".."==t&&this.tokens.isEmpty()&&(this.tokens.push(new tv("0")),a=!1):(this.tokens.push(new tv(s)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,tD.OPERATION_VALUE_OF.get(t),a),a=!0,r.setLength(0),new eN(n+e-1,a)}return r.append(e),new eN(n,!1)}processTernaryOperator(e,t,r,s,n){if(n)throw new tx(this.expression,"Ternary operator is followed by an operator");""!=r.trim()&&(this.tokens.push(new tb(r)),t.setLength(0));let a=1,i="",o=++s;for(;s<e&&a>0;)"?"==(i=this.expression.charAt(s))?++a:":"==i&&--a,++s;if(":"!=i)throw new tx(this.expression,"':' operater is missing");if(s>=e)throw new tx(this.expression,"Third part of the ternary expression is missing");for(;!this.ops.isEmpty()&&this.hasPrecedence(tD.CONDITIONAL_TERNARY_OPERATOR,this.ops.peek());){let e=this.ops.pop();if(tD.UNARY_OPERATORS.has(e)){let t=this.tokens.pop();this.tokens.push(new tb("",t,void 0,e))}else{let t=this.tokens.pop(),r=this.tokens.pop();this.tokens.push(new tb("",r,t,e))}}this.ops.push(tD.CONDITIONAL_TERNARY_OPERATOR),this.tokens.push(new tb(this.expression.substring(o,s-1)));let E=this.expression.substring(s);if(""===E.trim())throw new tx(this.expression,"Third part of the ternary expression is missing");return this.tokens.push(new tb(E)),e-1}processSubExpression(e,t,r,s,n){if(tD.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,tD.OPERATION_VALUE_OF.get(r),n),t.setLength(0);else if(!eg.isNullOrBlank(r))throw new tx(this.expression,eT.format("Unkown token : $ found.",r));let a=1,i=new tP,o=this.expression.charAt(s);for(s++;s<e&&a>0;)"("==(o=this.expression.charAt(s))?a++:")"==o&&a--,0!=a&&(i.append(o),s++);if(")"!=o)throw new tx(this.expression,"Missing a closed parenthesis");for(;i.length()>2&&"("==i.charAt(0)&&")"==i.charAt(i.length()-1);)i.deleteCharAt(0),i.setLength(i.length()-1);return this.tokens.push(new tb(i.toString().trim())),s}processTokenSepearator(e,t,r){return eg.isNullOrBlank(t)||(tD.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,tD.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new tv(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,s){if(r){if(s||e.isEmpty()){if(tD.UNARY_OPERATORS.has(r)){let e=tD.UNARY_MAP.get(r);e&&t.push(e)}else throw new tx(this.expression,eT.format("Extra operator $ found.",r))}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(tD.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new tb("",t,void 0,r))}else{let t=e.pop(),s=e.pop();e.push(new tb("",s,t,r))}}t.push(r)}}}hasPrecedence(e,t){let r=tD.OPERATOR_PRIORITY.get(e),s=tD.OPERATOR_PRIORITY.get(t);if(!r||!s)throw Error("Unknown operators provided");return s<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new tP,t=0,r=this.ops.toArray(),s=this.tokens.toArray();for(let n=0;n<r.length;n++)if(r[n].getOperator().startsWith("UN: "))e.append("(").append(r[n].getOperator().substring(4)).append(s[t]instanceof tb?s[t].toString():s[t]).append(")"),t++;else if(r[n]==tD.CONDITIONAL_TERNARY_OPERATOR){let r=s[t++];e.insert(0,r.toString()),e.insert(0,":"),r=s[t++],e.insert(0,r.toString()),e.insert(0,"?"),r=s[t++],e.insert(0,r.toString()).append(")"),e.insert(0,"(")}else{if(0==t){let r=s[t++];e.insert(0,r.toString())}let a=s[t++];e.insert(0,r[n].getOperator()).insert(0,a instanceof tb?a.toString():a?.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var tG={};E(tG,"TokenValueExtractor",()=>tF);class tF{static{this.REGEX_SQUARE_BRACKETS=/[\[\]]/}static{this.REGEX_DOT=/(?<!\.)\.(?!\.)/}getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new er(eT.format("Token $ doesn't start with $",e,t));if(e.endsWith(".__index")){let t=e.substring(0,e.length-8),r=this.getValueInternal(t);if(!h(r?.__index))return r.__index;if(!t.endsWith("]"))return t.substring(t.lastIndexOf(".")+1);{let e=t.substring(t.lastIndexOf("[")+1,t.length-1),r=parseInt(e);return isNaN(r)?e:r}}return this.getValueInternal(e)}retrieveElementFrom(e,t,r,s){if(h(s))return;if(t.length==r)return s;let n=t[r].split(tF.REGEX_SQUARE_BRACKETS).map(e=>e.trim()).filter(e=>!eg.isNullOrBlank(e)).reduce((s,n)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,n,s),s);return this.retrieveElementFrom(e,t,r+1,n)}resolveForEachPartOfTokenWithBrackets(e,t,r,s,n){if(!h(n))return"length"===s?this.getLength(e,n):"string"==typeof n||Array.isArray(n)?this.handleArrayAccess(e,s,n):this.handleObjectAccess(e,t,r,s,n)}getLength(e,t){let r=typeof t;if("string"===r||Array.isArray(t))return t.length;if("object"===r)return"length"in t?t.length:Object.keys(t).length;throw new tx(e,eT.format("Length can't be found in token $",e))}handleArrayAccess(e,t,r){let s=t.indexOf("..");if(s>=0){let e=t.substring(0,s),n=t.substring(s+2),a=0==e.length?0:parseInt(e),i=0==n.length?r.length:parseInt(n);if(isNaN(a)||isNaN(i))return;for(;a<0;)a+=r.length;for(;i<0;)i+=r.length;let o=typeof r;return a>=i?"string"==o?"":[]:"string"==o?r.substring(a,i):r.slice(a,i)}let n=parseInt(t);if(isNaN(n))throw new tx(e,eT.format("$ is not a number",t));for(;n<0;)n=r.length+n;if(!(n>=r.length))return r[n]}handleObjectAccess(e,t,r,s,n){if(s.startsWith('"')){if(!s.endsWith('"')||1==s.length||2==s.length)throw new tx(e,eT.format("$ is missing a double quote or empty key found",e));s=s.substring(1,t.length-2)}return this.checkIfObject(e,t,r,n),n[s]}checkIfObject(e,t,r,s){let n=typeof s;if("object"!=n&&"string"!=n||Array.isArray(s))throw new tx(e,eT.format("Unable to retrieve $ from $ in the path $",t[r],s.toString(),e))}}class tY extends tF{constructor(e,t){super(),this.store=e,this.prefix=t}getValueInternal(e){let t=e.split(tF.REGEX_DOT);return this.retrieveElementFrom(e,t,1,this.store)}getStore(){return this.store}setStore(e){return this.store=e,this}setValue(e,t,r=!0,s=!1){this.store=ta(this.store),this.modifyStore(e,t,r,s)}modifyStore(e,t,r,s){let n=new tb(e),a=n.getTokens();a.removeLast();let i=n.getOperations(),o=i.removeLast(),E=a.removeLast(),u=E instanceof tV?E.getElement():E.getExpression(),A=this.store;for(;!i.isEmpty();)A=o==tD.OBJECT_OPERATOR?this.getDataFromObject(A,u,i.peekLast()):this.getDataFromArray(A,u,i.peekLast()),o=i.removeLast(),u=(E=a.removeLast())instanceof tV?E.getElement():E.getExpression();o==tD.OBJECT_OPERATOR?this.putDataInObject(A,u,t,r,s):this.putDataInArray(A,u,t,r,s)}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new er(eT.format("Expected an array index but found $",t));if(s<0)throw new er(eT.format("Array index is out of bound - $",t));let n=e[s];return h(n)&&(n=r==tD.OBJECT_OPERATOR?{}:[],e[s]=n),n}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));let s=e[t];return h(s)&&(s=r==tD.OBJECT_OPERATOR?{}:[],e[t]=s),s}putDataInArray(e,t,r,s,n){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let a=parseInt(t);if(isNaN(a))throw new er(eT.format("Expected an array index but found $",t));if(a<0)throw new er(eT.format("Array index is out of bound - $",t));(s||h(e[a]))&&(n&&h(r)?e.splice(a,1):e[a]=r)}putDataInObject(e,t,r,s,n){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));(s||h(e[t]))&&(n&&h(r)?delete e[t]:e[t]=r)}getPrefix(){return this.prefix}}class tB extends e1{constructor(){super("Sort",[tB.PARAMETER_ARRAY_SOURCE,tB.PARAMETER_INT_FIND_FROM,tB.PARAMETER_INT_LENGTH,tB.PARAMETER_BOOLEAN_ASCENDING,tB.PARAMETER_KEY_PATH],tB.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tB.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tB.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(tB.PARAMETER_INT_LENGTH.getParameterName()),n=e?.getArguments()?.get(tB.PARAMETER_BOOLEAN_ASCENDING.getParameterName()),a=e?.getArguments()?.get(tB.PARAMETER_KEY_PATH.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);if(t=[...t],-1==s&&(s=t.length-r),r<0||r>=t.length||r+s>t.length)throw new er("Given start point is more than the size of the array or not available at that point");let i=t.slice(r,r+s+1),o=new tY({},"Data.");return i.sort((e,t)=>"object"==typeof e&&"object"==typeof t&&a.length?(o.setStore({a:e,b:t}),tH(o.getValue("Data.a."+a),o.getValue("Data.b."+a),n)):tH(e,t,n)),t.splice(r,s,...i),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}function tH(e,t,r){return e===t?0:null===e?1:null===t?-1:r?e<t?-1:1:e<t?1:-1}class tk extends e1{constructor(){super("SubArray",[tk.PARAMETER_ARRAY_SOURCE,tk.PARAMETER_INT_FIND_FROM,tk.PARAMETER_INT_LENGTH],tk.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tk.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tk.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(tk.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),s<=0)return new es([Z.outputOf(new Map([]))]);if(!(r>=0&&r<t.length)||r+s>t.length)throw new er("Given find from point is more than the source size array or the Requested length for the subarray was more than the source size");let n=t.slice(r,r+s);return new es([Z.outputOf(new Map([[tk.EVENT_RESULT_NAME,n]]))])}}class t$ extends e1{constructor(){super("Insert",[t$.PARAMETER_ARRAY_SOURCE,t$.PARAMETER_INT_OFFSET,t$.PARAMETER_ANY],t$.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(t$.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t$.PARAMETER_INT_OFFSET.getParameterName());var s=e?.getArguments()?.get(t$.PARAMETER_ANY.getParameterName());if(h(s)||h(r)||r>t.length)throw new er("Please valid resouces to insert at the correct location");if(0==(t=[...t]).length)return 0==r&&t.push(s),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);t.push(s);let n=t.length-1;for(r++;n>=r;){let e=t[n-1];t[n-1]=t[n],t[n--]=e}return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tj extends e1{constructor(){super("InsertLast",[tj.PARAMETER_ARRAY_SOURCE,tj.PARAMETER_ANY],tj.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tj.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tj.PARAMETER_ANY.getParameterName());return(t=[...t]).push(r),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tW extends e1{constructor(){super("RemoveDuplicates",[tW.PARAMETER_ARRAY_SOURCE,tW.PARAMETER_INT_SOURCE_FROM,tW.PARAMETER_INT_LENGTH],tW.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tW.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tW.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tW.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),r+s>t.length)throw new er(eT.format("Array has no elements from $ to $ as the array size is $",r,r+s,t.length));let n=[...t],a=r+s;for(let e=a-1;e>=r;e--)for(let t=e-1;t>=r;t--)if(eR(n[e],n[t])){n.splice(e,1);break}return new es([Z.outputOf(j.of(tW.EVENT_RESULT_NAME,n))])}}const tX="keyPath",tJ="valuePath",tq="ignoreNullValues",tz="ignoreNullKeys",tK="ignoreDuplicateKeys";class tQ extends e1{constructor(){super("ArrayToObjects",[e1.PARAMETER_ARRAY_SOURCE,k.of(tX,D.ofString(tX)),k.of(tJ,D.of(tJ,p.STRING,p.NULL)),k.of(tq,D.ofBoolean(tq).setDefaultValue(!1)),k.of(tz,D.ofBoolean(tz).setDefaultValue(!0)),k.of(tK,D.ofBoolean(tK).setDefaultValue(!1))],e1.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tX),s=e?.getArguments()?.get(tJ)??"",n=e?.getArguments()?.get(tq),a=e?.getArguments()?.get(tz),i=e?.getArguments()?.get(tK),o=new tY({},"Data."),E=t.filter(e=>!h(e)).reduce((e,t)=>{o.setStore(t);let E=o.getValue("Data."+r);if(a&&h(E))return e;let u=s?o.getValue("Data."+s):t;return n&&h(u)||i&&e.hasOwnProperty(E)||(e[E]=u),e},{});return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,E]]))])}}const tZ="source",t0="delimiter",t1="result";class t2 extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(tZ),r=e?.getArguments()?.get(t0);return new es([Z.outputOf(new Map([[t1,t.join(r)]]))])}constructor(...e){super(...e),this.signature=new ea("Join").setNamespace(l.SYSTEM_ARRAY).setParameters(new Map([[tZ,new k(tZ,D.ofArray(tZ,D.of("each",p.STRING,p.INTEGER,p.LONG,p.DOUBLE,p.FLOAT,p.NULL)))],[t0,new k(t0,D.ofString(t0).setDefaultValue(""))]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[t1,D.ofString(t1)]]))]))}}class t9{async find(e,t){return e!=l.SYSTEM_ARRAY?Promise.resolve(void 0):Promise.resolve(this.repoMap.get(t))}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}constructor(){this.repoMap=j.ofArrayEntries(q(new e2),q(new e9),q(new te),q(new ts),q(new ti),q(new to),q(new tE),q(new tu),q(new tA),q(new tT),q(new tl),q(new tm),q(new tR),q(new th),q(new tg),q(new tc),q(new tp),q(new tN),q(new tf),q(new t_),q(new tM),q(new tS),q(new tO),q(new tB),q(new tk),q(new e4),q(new t$),q(new tj),q(new tW),q(new tQ),q(new t2)),this.filterableNames=Array.from(this.repoMap.values()).map(e=>e.getSignature().getFullName())}}var t3={};E(t3,"ContextElement",()=>t4);class t4{static{this.NULL=new t4(D.NULL,void 0)}constructor(e,t){this.schema=e,this.element=t}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getElement(){return this.element}setElement(e){return this.element=e,this}}const t5="name",t6="schema";class t7 extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(t5);if(e?.getContext()?.has(t))throw new er(eT.format("Context already has an element for '$' ",t));let r=D.from(e?.getArguments()?.get(t6));if(!r)throw new er("Schema is not supplied.");return e.getContext().set(t,new t4(r,h(r.getDefaultValue())?void 0:r.getDefaultValue())),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Create").setNamespace(l.SYSTEM_CTX).setParameters(new Map([k.ofEntry(t5,new D().setName(t5).setType(d.of(p.STRING)).setMinLength(1).setFormat(eY.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,B.CONSTANT),k.ofEntry(t6,D.SCHEMA,!1,B.CONSTANT)])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}const t8="name",re="value";class rt extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(t8);if(!e.getContext()?.has(t))throw new er(eT.format("Context don't have an element for '$' ",t));return new es([Z.outputOf(new Map([re,e.getContext()?.get(t)?.getElement()]))])}constructor(...e){super(...e),this.signature=new ea("Get").setNamespace(l.SYSTEM_CTX).setParameters(new Map([k.ofEntry(t8,new D().setName(t8).setType(d.of(p.STRING)).setMinLength(1).setFormat(eY.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,B.CONSTANT)])).setEvents(new Map([Q.outputEventMapEntry(new Map([[re,D.ofAny(re)]]))]))}}var rr={};E(rr,"ExpressionEvaluator",()=>su);var rs={},rn={};E(rn,"ArithmeticAdditionOperator",()=>ro);var ra={};E(ra,"BinaryOperator",()=>ri);class ri{nullCheck(e,t,r){if(h(e)||h(t))throw new e7(eT.format("$ cannot be applied to a null value",r.getOperatorName()))}}class ro extends ri{apply(e,t){return h(e)?t:h(t)?e:e+t}}var rE={};E(rE,"ArithmeticDivisionOperator",()=>ru);class ru extends ri{apply(e,t){return this.nullCheck(e,t,tD.DIVISION),e/t}}var rA={};E(rA,"ArithmeticIntegerDivisionOperator",()=>rT);class rT extends ri{apply(e,t){return this.nullCheck(e,t,tD.DIVISION),Math.floor(e/t)}}var rl={};E(rl,"ArithmeticModulusOperator",()=>rm);class rm extends ri{apply(e,t){return this.nullCheck(e,t,tD.MOD),e%t}}var rR={};E(rR,"ArithmeticMultiplicationOperator",()=>rh);class rh extends ri{apply(e,t){this.nullCheck(e,t,tD.MULTIPLICATION);let r="string"==typeof e,s=typeof t;if(r||"string"===s){let s=r?e:t,n=r?t:e,a="",i=n<0,o=Math.floor(n=Math.abs(n));for(;o-- >0;)a+=s;let E=Math.floor(s.length*(n-Math.floor(n)));if(E<0&&(E=-E),0!=E&&(a+=s.substring(0,E)),i){let e="";for(let t=a.length-1;t>=0;t--)e+=a[t];return e}return a}return e*t}}var rg={};E(rg,"ArithmeticSubtractionOperator",()=>rc);class rc extends ri{apply(e,t){return this.nullCheck(e,t,tD.SUBTRACTION),e-t}}var rp={};E(rp,"ArrayOperator",()=>rN);class rN extends ri{apply(e,t){if(!e)throw new e7("Cannot apply array operator on a null value");if(!t)throw new e7("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new e7(eT.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new e7(eT.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var rf={};E(rf,"BitwiseAndOperator",()=>r_);class r_ extends ri{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_AND),e&t}}var rM={};E(rM,"BitwiseLeftShiftOperator",()=>rS);class rS extends ri{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_LEFT_SHIFT),e<<t}}var rO={};E(rO,"BitwiseOrOperator",()=>rw);class rw extends ri{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_OR),e|t}}var rd={};E(rd,"BitwiseRightShiftOperator",()=>rI);class rI extends ri{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_RIGHT_SHIFT),e>>t}}var rP={};E(rP,"BitwiseUnsignedRightShiftOperator",()=>ry);class ry extends ri{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var rx={};E(rx,"BitwiseXorOperator",()=>rL);class rL extends ri{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_XOR),e^t}}var rv={};E(rv,"LogicalAndOperator",()=>rU);class rU extends ri{apply(e,t){return!!e&&""!==e&&!!t&&""!==t}}var rV={};E(rV,"LogicalEqualOperator",()=>rC);class rC extends ri{apply(e,t){return eR(e,t)}}var rD={};E(rD,"LogicalGreaterThanEqualOperator",()=>rb);class rb extends ri{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare >= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>=s.getT2()}}var rG={};E(rG,"LogicalGreaterThanOperator",()=>rF);class rF extends ri{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare > with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>s.getT2()}}var rY={};E(rY,"LogicalLessThanEqualOperator",()=>rB);class rB extends ri{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare <= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<=s.getT2()}}var rH={};E(rH,"LogicalNotEqualOperator",()=>rk);class rk extends ri{apply(e,t){return!eR(e,t)}}var r$={};E(r$,"LogicalLessThanOperator",()=>rj);class rj extends ri{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare < with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<s.getT2()}}var rW={};E(rW,"LogicalOrOperator",()=>rX);class rX extends ri{apply(e,t){return!!e&&""!==e||!!t&&""!==t}}var rJ={};E(rJ,"ObjectOperator",()=>rq);class rq extends ri{apply(e,t){if(!e)throw new e7("Cannot apply array operator on a null value");if(!t)throw new e7("Cannot retrive null property value");let r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new e7(eT.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var rz={};E(rz,"LogicalNullishCoalescingOperator",()=>rK);class rK extends ri{apply(e,t){return h(e)?t:e}}var rQ={};E(rQ,"ArrayRangeOperator",()=>rZ);class rZ extends ri{apply(e,t){return`${e??""}..${t??""}`}}o(rs,rn),o(rs,rE),o(rs,rA),o(rs,rl),o(rs,rR),o(rs,rg),o(rs,rp),o(rs,ra),o(rs,rf),o(rs,rM),o(rs,rO),o(rs,rd),o(rs,rP),o(rs,rx),o(rs,rv),o(rs,rV),o(rs,rD),o(rs,rG),o(rs,rY),o(rs,rH),o(rs,r$),o(rs,rW),o(rs,rJ),o(rs,rz),o(rs,rQ);var r0={},r1={};E(r1,"ArithmeticUnaryMinusOperator",()=>r3);var r2={};E(r2,"UnaryOperator",()=>r9);class r9{nullCheck(e,t){if(h(e))throw new e7(eT.format("$ cannot be applied to a null value",t.getOperatorName()))}}class r3 extends r9{apply(e){return this.nullCheck(e,tD.UNARY_MINUS),e8.findPrimitiveNumberType(e),-e}}var r4={};E(r4,"ArithmeticUnaryPlusOperator",()=>r5);class r5 extends r9{apply(e){return this.nullCheck(e,tD.UNARY_PLUS),e8.findPrimitiveNumberType(e),e}}var r6={};E(r6,"BitwiseComplementOperator",()=>r7);class r7 extends r9{apply(e){this.nullCheck(e,tD.UNARY_BITWISE_COMPLEMENT);let t=e8.findPrimitiveNumberType(e);if(t.getT1()!=p.INTEGER&&t.getT1()!=p.LONG)throw new e7(eT.format("Unable to apply bitwise operator on $",e));return~e}}var r8={};E(r8,"LogicalNotOperator",()=>se);class se extends r9{apply(e){return!e&&""!==e}}o(r0,r1),o(r0,r4),o(r0,r6),o(r0,r8),o(r0,r2);var st={};E(st,"LiteralTokenValueExtractor",()=>ss);const sr=new Map([["true",!0],["false",!1],["null",void 0],["undefined",void 0]]);class ss extends tF{static{this.INSTANCE=new ss}getValueInternal(e){if(!eg.isNullOrBlank(e))return(e=e.trim(),sr.has(e))?sr.get(e):e.startsWith('"')?this.processString(e):this.processNumbers(e)}processNumbers(e){try{let t=Number(e);if(isNaN(t))throw Error("Parse number error");return t}catch(t){throw new tx(e,eT.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new tx(e,eT.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}getStore(){}getValueFromExtractors(e,t){return t.has(e+".")?t.get(e+".")?.getStore():this.getValue(e)}}var sn={},sa={};E(sa,"ConditionalTernaryOperator",()=>so);class si{nullCheck(e,t,r,s){if(h(e)||h(t)||h(r))throw new e7(eT.format("$ cannot be applied to a null value",s.getOperatorName()))}}class so extends si{apply(e,t,r){return e?t:r}}o(sn,sa);class sE extends tF{static{this.PREFIX="_internal."}addValue(e,t){this.values.set(e,t)}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.values.get(r))}getPrefix(){return sE.PREFIX}getStore(){}constructor(...e){super(...e),this.values=new Map}}class su{static{this.UNARY_OPERATORS_MAP=new Map([[tD.UNARY_BITWISE_COMPLEMENT,new r7],[tD.UNARY_LOGICAL_NOT,new se],[tD.UNARY_MINUS,new r3],[tD.UNARY_PLUS,new r5]])}static{this.TERNARY_OPERATORS_MAP=new Map([[tD.CONDITIONAL_TERNARY_OPERATOR,new so]])}static{this.BINARY_OPERATORS_MAP=new Map([[tD.ADDITION,new ro],[tD.DIVISION,new ru],[tD.INTEGER_DIVISION,new rT],[tD.MOD,new rm],[tD.MULTIPLICATION,new rh],[tD.SUBTRACTION,new rc],[tD.BITWISE_AND,new r_],[tD.BITWISE_LEFT_SHIFT,new rS],[tD.BITWISE_OR,new rw],[tD.BITWISE_RIGHT_SHIFT,new rI],[tD.BITWISE_UNSIGNED_RIGHT_SHIFT,new ry],[tD.BITWISE_XOR,new rL],[tD.AND,new rU],[tD.EQUAL,new rC],[tD.GREATER_THAN,new rF],[tD.GREATER_THAN_EQUAL,new rb],[tD.LESS_THAN,new rj],[tD.LESS_THAN_EQUAL,new rB],[tD.OR,new rX],[tD.NOT_EQUAL,new rk],[tD.NULLISH_COALESCING_OPERATOR,new rK],[tD.ARRAY_OPERATOR,new rN],[tD.ARRAY_RANGE_INDEX_OPERATOR,new rZ],[tD.OBJECT_OPERATOR,new rq]])}static{this.UNARY_OPERATORS_MAP_KEY_SET=new Set(su.UNARY_OPERATORS_MAP.keys())}constructor(e){this.internalTokenValueExtractor=new sE,e instanceof tb?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){let t=this.processNestingExpression(this.expression,e);return this.expression=t.getT1(),this.exp=t.getT2(),(e=new Map(e.entries())).set(this.internalTokenValueExtractor.getPrefix(),this.internalTokenValueExtractor),this.evaluateExpression(this.exp,e)}processNestingExpression(e,t){let r=0,s=0,n=new el;for(;s<e.length-1;){if("{"==e.charAt(s)&&"{"==e.charAt(s+1))0==r&&n.push(new eN(s+2,-1)),r++,s++;else if("}"==e.charAt(s)&&"}"==e.charAt(s+1)){if(--r<0)throw new tx(e,"Expecting {{ nesting path operator to be started before closing");0==r&&n.push(n.pop().setT2(s)),s++}s++}let a=this.replaceNestingExpression(e,t,n);return new eN(a,new tb(a))}replaceNestingExpression(e,t,r){let s=e;for(let n of r.toArray()){if(-1==n.getT2())throw new tx(e,"Expecting }} nesting path operator to be closed");let r=new su(s.substring(n.getT1(),n.getT2())).evaluate(t);s=s.substring(0,n.getT1()-2)+r+s.substring(n.getT2()+2)}return s}getExpression(){return this.exp||(this.exp=new tb(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),s=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),n=s.pop();if(su.UNARY_OPERATORS_MAP_KEY_SET.has(e))s.push(this.applyUnaryOperation(e,this.getValueFromToken(t,n)));else if(e==tD.OBJECT_OPERATOR||e==tD.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,s,e,n);else if(e==tD.CONDITIONAL_TERNARY_OPERATOR){let r=s.pop(),a=s.pop(),i=this.getValueFromToken(t,a),o=this.getValueFromToken(t,r),E=this.getValueFromToken(t,n);s.push(this.applyTernaryOperation(e,i,o,E))}else{let r=s.pop(),a=this.getValueFromToken(t,r),i=this.getValueFromToken(t,n);s.push(this.applyBinaryOperation(e,a,i))}}if(s.isEmpty())throw new e7(eT.format("Expression : $ evaluated to null",e));if(1!=s.size())throw new e7(eT.format("Expression : $ evaluated multiple values $",e,s));let n=s.get(0);if(n instanceof tV)return n.getElement();if(!(n instanceof tb))return this.getValueFromToken(t,n);throw new e7(eT.format("Expression : $ evaluated to $",e,s.get(0)))}processObjectOrArrayOperator(e,t,r,s,n){let a=new el,i=new el;if(!s||!n)return;do i.push(s),n instanceof tb?a.push(new tV(n.toString(),this.evaluateExpression(n,e))):n&&a.push(n),n=r.isEmpty()?void 0:r.pop(),s=t.isEmpty()?void 0:t.pop();while(s==tD.OBJECT_OPERATOR||s==tD.ARRAY_OPERATOR)n&&(n instanceof tb?a.push(new tV(n.toString(),this.evaluateExpression(n,e))):a.push(n)),s&&t.push(s);let o=a.pop();if(o instanceof tV&&"object"==typeof o.getTokenValue()){let e=new Date().getTime()+""+Math.round(1e3*Math.random());this.internalTokenValueExtractor.addValue(e,o.getTokenValue()),o=new tv(sE.PREFIX+e)}let E=new tP(o instanceof tV?o.getTokenValue():o.toString());for(;!a.isEmpty();)o=a.pop(),s=i.pop(),E.append(s.getOperator()).append(o instanceof tV?o.getTokenValue():o.toString()),s==tD.ARRAY_OPERATOR&&E.append("]");let u=E.toString(),A=u.substring(0,u.indexOf(".")+1);if(A.length>2&&e.has(A))r.push(new tV(u,this.getValue(u,e)));else{let e;try{e=ss.INSTANCE.getValue(u)}catch(t){e=u}r.push(new tV(u,e))}}applyTernaryOperation(e,t,r,s){let n=su.TERNARY_OPERATORS_MAP.get(e);if(!n)throw new tx(this.expression,eT.format("No operator found to evaluate $",this.getExpression()));return new tV(e.toString(),n.apply(t,r,s))}applyBinaryOperation(e,t,r){let s=typeof t,n=typeof r,a=su.BINARY_OPERATORS_MAP.get(e);if(("object"===s||"object"===n)&&e!==tD.EQUAL&&e!==tD.NOT_EQUAL&&e!==tD.NULLISH_COALESCING_OPERATOR&&e!==tD.AND&&e!==tD.OR)throw new tx(this.expression,eT.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));if(!a)throw new tx(this.expression,eT.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new tV(e.toString(),a.apply(t,r))}applyUnaryOperation(e,t){let r=typeof t;if(e.getOperator()!=tD.NOT.getOperator()&&e.getOperator()!=tD.UNARY_LOGICAL_NOT.getOperator()&&("object"===r||Array.isArray(t)))throw new tx(this.expression,eT.format("The operator $ cannot be applied to $",e.getOperator(),t));let s=su.UNARY_OPERATORS_MAP.get(e);if(!s)throw new tx(this.expression,eT.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new tV(e.toString(),s.apply(t))}getValueFromToken(e,t){return t instanceof tb?this.evaluateExpression(t,e):t instanceof tV?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){let r=e.substring(0,e.indexOf(".")+1);return t.has(r)?t.get(r).getValue(e):ss.INSTANCE.getValueFromExtractors(e,t)}}const sA="name",sT="value";class sl extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(sA);if(eg.isNullOrBlank(t))throw new er("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get(sT),s=new tb(t),n=s.getTokens().peekLast();if(!n.getExpression().startsWith("Context")||n instanceof tb||n instanceof tV&&!n.getElement().toString().startsWith("Context"))throw new e7(eT.format("The context path $ is not a valid path in context",t));for(let e of s.getOperations().toArray())if(e!=tD.ARRAY_OPERATOR&&e!=tD.OBJECT_OPERATOR)throw new e7(eT.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<s.getTokens().size();r++){let n=s.getTokens().get(r);n instanceof tb&&s.getTokens().set(r,new tV(t,new su(n).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,s)}modifyContext(e,t,r,s){let n=s.getTokens();n.removeLast();let a=s.getOperations();a.removeLast();let i=e.getContext()?.get(n.removeLast().getExpression());if(h(i))throw new er(eT.format("Context doesn't have any element with name '$' ",t));if(a.isEmpty())return i.setElement(r),new es([Z.outputOf(new Map)]);let o=i.getElement(),E=a.removeLast(),u=n.removeLast(),A=u instanceof tV?u.getElement():u.getExpression();for(h(o)&&(o=E==tD.OBJECT_OPERATOR?{}:[],i.setElement(o));!a.isEmpty();)o=E==tD.OBJECT_OPERATOR?this.getDataFromObject(o,A,a.peekLast()):this.getDataFromArray(o,A,a.peekLast()),E=a.removeLast(),A=(u=n.removeLast())instanceof tV?u.getElement():u.getExpression();return E==tD.OBJECT_OPERATOR?this.putDataInObject(o,A,r):this.putDataInArray(o,A,r),new es([Z.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new er(eT.format("Expected an array index but found $",t));if(s<0)throw new er(eT.format("Array index is out of bound - $",t));let n=e[s];return h(n)&&(n=r==tD.OBJECT_OPERATOR?{}:[],e[s]=n),n}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));let s=e[t];return h(s)&&(s=r==tD.OBJECT_OPERATOR?{}:[],e[t]=s),s}putDataInArray(e,t,r){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new er(eT.format("Expected an array index but found $",t));if(s<0)throw new er(eT.format("Array index is out of bound - $",t));e[s]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));e[t]=r}constructor(...e){super(...e),this.signature=new ea("Set").setNamespace(l.SYSTEM_CTX).setParameters(new Map([k.ofEntry(sA,new D().setName(sA).setType(d.of(p.STRING)).setMinLength(1),!1),k.ofEntry(sT,D.ofAny(sT))])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}const sm="value",sR="eventName",sh="results";class sg extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getEvents(),r=e.getArguments(),s=r?.get(sR),n=e?.getArguments()?.get(sh).map(t=>{let r=t[sm];if(h(r))throw new er("Expect a value object");let s=r.value;return r.isExpression&&(s=new su(s).evaluate(e.getValuesMap())),[t.name,s]}).reduce((e,t)=>(e.set(t[0],t[1]),e),new Map);return t?.has(s)||t?.set(s,[]),t?.get(s)?.push(n),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("GenerateEvent").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(sR,D.ofString(sR).setDefaultValue("output")),k.ofEntry(sh,D.ofObject(sh).setProperties(new Map([["name",D.ofString("name")],[sm,k.EXPRESSION]])),!0)])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}class sc extends e0{static{this.CONDITION="condition"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sc.CONDITION);return new es([Z.of(t||""===t?Q.TRUE:Q.FALSE,new Map),Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("If").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(sc.CONDITION,D.ofAny(sc.CONDITION))])).setEvents(new Map([Q.eventMapEntry(Q.TRUE,new Map),Q.eventMapEntry(Q.FALSE,new Map),Q.outputEventMapEntry(new Map)]))}}const sp="stepName";class sN extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sp);return e.getExecutionContext().set(t,!0),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Break").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sp,D.of(sp,p.STRING))])).setEvents(new Map([Q.outputEventMapEntry(new Map([]))]))}}const sf="count",s_="value",sM="index";class sS extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sf),r=0,s=e.getStatementExecution()?.getStatement()?.getStatementName();return new es({next(){if(r>=t||s&&e.getExecutionContext()?.get(s))return s&&e.getExecutionContext()?.delete(s),Z.outputOf(new Map([[s_,r]]));let n=Z.of(Q.ITERATION,new Map([[sM,r]]));return++r,n}})}constructor(...e){super(...e),this.signature=new ea("CountLoop").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sf,D.of(sf,p.INTEGER))])).setEvents(new Map([Q.eventMapEntry(Q.ITERATION,new Map([[sM,D.of(sM,p.INTEGER)]])),Q.outputEventMapEntry(new Map([[s_,D.of(s_,p.INTEGER)]]))]))}}const sO="source",sw="each",sd="index",sI="value";class sP extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sO),r=0,s=e.getStatementExecution()?.getStatement()?.getStatementName();return new es({next(){if(r>=t.length||s&&e.getExecutionContext()?.get(s))return s&&e.getExecutionContext()?.delete(s),Z.outputOf(new Map([[sI,r]]));let n=Z.of(Q.ITERATION,new Map([[sd,r],[sw,t[r]]]));return++r,n}})}constructor(...e){super(...e),this.signature=new ea("ForEachLoop").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sO,D.ofArray(sO,D.ofAny(sO)))])).setEvents(new Map([Q.eventMapEntry(Q.ITERATION,new Map([[sd,D.of(sd,p.INTEGER)],[sw,D.ofAny(sw)]])),Q.outputEventMapEntry(new Map([[sI,D.of(sI,p.INTEGER)]]))]))}}const sy="from",sx="step",sL="value",sv="index";class sU extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sy),r=e.getArguments()?.get("to"),s=e.getArguments()?.get(sx),n=s>0,a=t,i=!1,o=e.getStatementExecution()?.getStatement()?.getStatementName();return new es({next(){if(i)return;if(n&&a>=r||!n&&a<=r||o&&e.getExecutionContext()?.get(o))return i=!0,o&&e.getExecutionContext()?.delete(o),Z.outputOf(new Map([[sL,a]]));let t=Z.of(Q.ITERATION,new Map([[sv,a]]));return a+=s,t}})}constructor(...e){super(...e),this.signature=new ea("RangeLoop").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sy,D.of(sy,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE).setDefaultValue(0)),k.ofEntry("to",D.of("to",p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE).setDefaultValue(1)),k.ofEntry(sx,D.of(sx,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE).setDefaultValue(1).setNot(new D().setConstant(0)))])).setEvents(new Map([Q.eventMapEntry(Q.ITERATION,new Map([[sv,D.of(sv,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE)]])),Q.outputEventMapEntry(new Map([[sL,D.of(sL,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE)]]))]))}}const sV="value";class sC extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sV);return new es([Z.outputOf(new Map([[sV,t.reduce((e,t)=>e+=t,0)]]))])}constructor(...e){super(...e),this.signature=new ea("Add").setNamespace(l.MATH).setParameters(new Map([[sV,new k(sV,D.ofNumber(sV)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sV,D.ofNumber(sV)]]))]))}}const sD="value",sb="value1",sG="value2";class sF extends e0{constructor(e,t,r=1,...s){super(),this.paramFunctions=[()=>new Map([[sD,new k(sD,D.ofNumber(sD))]]),()=>new Map([[sb,new k(sb,D.ofNumber(sb))],[sG,new k(sG,D.ofNumber(sG))]])],s&&s.length||(s=[p.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new ea(e).setNamespace(l.MATH).setParameters(this.paramFunctions[r-1]()).setEvents(new Map([Q.outputEventMapEntry(new Map([[sD,new D().setType(d.of(...s)).setName(sD)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=e8.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?sD:sb)).getT2();return 2==this.parametersNumber&&(t=e8.findPrimitiveNumberType(e.getArguments()?.get(sG)).getT2()),new es([Z.outputOf(new Map([[sD,this.mathFunction.call(this,r,t)]]))])}}const sY="value";class sB extends e0{constructor(){super(),this.signature=new ea("Hypotenuse").setNamespace(l.MATH).setParameters(new Map([[sY,new k(sY,D.ofNumber(sY)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sY,new D().setType(d.of(p.DOUBLE)).setName(sY)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sY);return new es([Z.outputOf(new Map([[sY,Math.sqrt(t.reduce((e,t)=>e+=t*t,0))]]))])}}const sH="value";class sk extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sH);return new es([Z.outputOf(new Map([[sH,t.reduce((e,t)=>!e&&0!==e||t>e?t:e)]]))])}constructor(...e){super(...e),this.signature=new ea("Maximum").setNamespace(l.MATH).setParameters(new Map([[sH,new k(sH,D.ofNumber(sH)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sH,D.ofNumber(sH)]]))]))}}const s$="value";class sj extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(s$);return new es([Z.outputOf(new Map([[s$,t.reduce((e,t)=>!e&&0!==e||t<e?t:e)]]))])}constructor(...e){super(...e),this.signature=new ea("Minimum").setNamespace(l.MATH).setParameters(new Map([[s$,new k(s$,D.ofNumber(s$)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[s$,D.ofNumber(s$)]]))]))}}const sW="value";class sX extends e0{getSignature(){return this.signature}async internalExecute(e){return new es([Z.outputOf(new Map([[sW,Math.random()]]))])}constructor(...e){super(...e),this.signature=new ea("Random").setNamespace(l.MATH).setEvents(new Map([Q.outputEventMapEntry(j.of(sW,D.ofDouble(sW)))]))}}class sJ extends e0{static{this.MIN_VALUE="minValue"}static{this.MAX_VALUE="maxValue"}static{this.VALUE="value"}constructor(e,t,r,s,n){super(),this.signature=new ea(e).setParameters(j.of(sJ.MIN_VALUE,t,sJ.MAX_VALUE,r)).setNamespace(l.MATH).setEvents(new Map([Q.outputEventMapEntry(j.of(sJ.VALUE,s))])),this.randomFunction=n}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sJ.MIN_VALUE),r=e.getArguments()?.get(sJ.MAX_VALUE),s=this.randomFunction(t,r);return new es([Z.outputOf(new Map([[sJ.VALUE,s]]))])}}class sq{constructor(){this.functionObjectsIndex={Absolute:new sF("Absolute",e=>Math.abs(e),1,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE),ArcCosine:new sF("ArcCosine",e=>Math.acos(e)),ArcSine:new sF("ArcSine",e=>Math.asin(e)),ArcTangent:new sF("ArcTangent",e=>Math.atan(e)),Ceiling:new sF("Ceiling",e=>Math.ceil(e)),Cosine:new sF("Cosine",e=>Math.cos(e)),HyperbolicCosine:new sF("HyperbolicCosine",e=>Math.cosh(e)),CubeRoot:new sF("CubeRoot",e=>Math.cbrt(e)),Exponential:new sF("Exponential",e=>Math.exp(e)),ExponentialMinus1:new sF("ExponentialMinus1",e=>Math.expm1(e)),Floor:new sF("Floor",e=>Math.floor(e)),LogNatural:new sF("LogNatural",e=>Math.log(e)),Log10:new sF("Log10",e=>Math.log10(e)),Round:new sF("Round",e=>Math.round(e),1,p.INTEGER,p.LONG),Sine:new sF("Sine",e=>Math.sin(e)),HyperbolicSine:new sF("HyperbolicSine",e=>Math.sinh(e)),Tangent:new sF("Tangent",e=>Math.tan(e)),HyperbolicTangent:new sF("HyperbolicTangent",e=>Math.tanh(e)),ToDegrees:new sF("ToDegrees",e=>Math.PI/180*e),ToRadians:new sF("ToRadians",e=>180/Math.PI*e),SquareRoot:new sF("SquareRoot",e=>Math.sqrt(e)),ArcTangent2:new sF("ArcTangent2",(e,t)=>Math.atan2(e,t),2),Power:new sF("Power",(e,t)=>Math.pow(e,t),2),Add:new sC,Hypotenuse:new sB,Maximum:new sk,Minimum:new sj,Random:new sX,RandomFloat:new sJ("RandomFloat",k.of(sJ.MIN_VALUE,D.ofFloat(sJ.MIN_VALUE).setDefaultValue(0)),k.of(sJ.MAX_VALUE,D.ofFloat(sJ.MAX_VALUE).setDefaultValue(0x7fffffff)),D.ofFloat(sJ.VALUE),(e,t)=>Math.random()*(t-e)+e),RandomInt:new sJ("RandomInt",k.of(sJ.MIN_VALUE,D.ofInteger(sJ.MIN_VALUE).setDefaultValue(0)),k.of(sJ.MAX_VALUE,D.ofInteger(sJ.MAX_VALUE).setDefaultValue(0x7fffffff)),D.ofInteger(sJ.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomLong:new sJ("RandomLong",k.of(sJ.MIN_VALUE,D.ofLong(sJ.MIN_VALUE).setDefaultValue(0)),k.of(sJ.MAX_VALUE,D.ofLong(sJ.MAX_VALUE).setDefaultValue(Number.MAX_SAFE_INTEGER)),D.ofLong(sJ.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomDouble:new sJ("RandomDouble",k.of(sJ.MIN_VALUE,D.ofDouble(sJ.MIN_VALUE).setDefaultValue(0)),k.of(sJ.MAX_VALUE,D.ofDouble(sJ.MAX_VALUE).setDefaultValue(Number.MAX_VALUE)),D.ofDouble(sJ.VALUE),(e,t)=>Math.random()*(t-e)+e)},this.filterableNames=Object.values(this.functionObjectsIndex).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=l.MATH?Promise.resolve(void 0):Promise.resolve(this.functionObjectsIndex[t])}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sz extends e0{static{this.SOURCE="source"}static{this.SCHEMA="schema"}static{this.VALUE="value"}static{this.CONVERSION_MODE="conversionMode"}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(sz.SOURCE),r=D.from(e?.getArguments()?.get(sz.SCHEMA));if(!r)throw new er("Schema is not supplied.");let s=ek(e.getArguments()?.get(sz.CONVERSION_MODE))||eH.STRICT;return this.convertToSchema(r,e.getSchemaRepository(),t,s)}async convertToSchema(e,t,r,s){try{return new es([Z.outputOf(j.of(sz.VALUE,eZ.validate([],e,t,r,!0,s)))])}catch(e){throw new er(e?.message)}}constructor(...e){super(...e),this.signature=new ea("ObjectConvert").setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(sz.SOURCE,D.ofAny(sz.SCHEMA)),k.ofEntry(sz.SCHEMA,D.SCHEMA,!1,B.CONSTANT),k.ofEntry(sz.CONVERSION_MODE,D.ofString(sz.CONVERSION_MODE).setEnums(e$()))])).setEvents(new Map([Q.outputEventMapEntry(j.of(sz.VALUE,D.ofAny(sz.VALUE)))]))}}const sK="value",sQ="source";class sZ extends e0{constructor(){super(),this.signature=new ea("ObjectDeleteKey").setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(sQ,D.ofAny(sQ)),k.ofEntry("key",D.ofString("key"))])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sK,D.ofAny(sK)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sQ),r=e.getArguments()?.get("key");return h(t)?new es([Z.outputOf(new Map([[sK,void 0]]))]):(t=ta(t),delete t[r],new es([Z.outputOf(new Map([[sK,t]]))]))}}const s0="source";class s1 extends e0{constructor(e,t){super(),this.signature=new ea(e).setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(s0,D.ofAny(s0))])).setEvents(new Map([Q.outputEventMapEntry(new Map([["value",t]]))]))}getSignature(){return this.signature}}const s2="value";class s9 extends s1{constructor(){super("ObjectEntries",D.ofArray(s2,D.ofArray("tuple",D.ofString("key"),D.ofAny("value"))))}async internalExecute(e){var t=e.getArguments()?.get("source");if(h(t))return new es([Z.outputOf(new Map([[s2,[]]]))]);let r=Object.entries(ta(t)).sort((e,t)=>e[0].localeCompare(t[0]));return new es([Z.outputOf(new Map([[s2,r]]))])}}const s3="value";class s4 extends s1{constructor(){super("ObjectKeys",D.ofArray(s3,D.ofString(s3)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(h(t))return new es([Z.outputOf(new Map([[s3,[]]]))]);let r=Object.keys(ta(t)).sort((e,t)=>e.localeCompare(t));return new es([Z.outputOf(new Map([[s3,r]]))])}}const s5="value",s6="source",s7="overwrite",s8="deleteKeyOnNull";class ne extends e0{constructor(){super(),this.signature=new ea("ObjectPutValue").setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(s6,D.ofObject(s6)),k.ofEntry("key",D.ofString("key")),k.ofEntry(s5,D.ofAny(s5)),k.ofEntry(s7,D.ofBoolean(s7).setDefaultValue(!0)),k.ofEntry(s8,D.ofBoolean(s8).setDefaultValue(!1))])).setEvents(new Map([Q.outputEventMapEntry(new Map([[s5,D.ofObject(s5)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(s6),r=e.getArguments()?.get("key"),s=e.getArguments()?.get(s5),n=e.getArguments()?.get(s7),a=e.getArguments()?.get(s8),i=new tY(t,"Data.");return i.setValue(r,s,n,a),new es([Z.outputOf(new Map([[s5,i.getStore()]]))])}}const nt="value";class nr extends s1{constructor(){super("ObjectValues",D.ofArray(nt,D.ofAny(nt)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(h(t))return new es([Z.outputOf(new Map([[nt,[]]]))]);let r=Object.entries(ta(t)).sort((e,t)=>e[0].localeCompare(t[0])).map(e=>e[1]);return new es([Z.outputOf(new Map([[nt,r]]))])}}class ns{constructor(){this.functionObjectsIndex={ObjectValues:new nr,ObjectKeys:new s4,ObjectEntries:new s9,ObjectDeleteKey:new sZ,ObjectPutValue:new ne,ObjectConvert:new sz},this.filterableNames=Object.values(this.functionObjectsIndex).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=l.SYSTEM_OBJECT?Promise.resolve(void 0):Promise.resolve(this.functionObjectsIndex[t])}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class nn extends e0{static{this.VALUES="values"}static{this.STREAM="stream"}static{this.LOG="LOG"}static{this.ERROR="ERROR"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nn.VALUES),r=e.getArguments()?.get(nn.STREAM);return(r===nn.LOG?console?.log:console?.error)?.(...t),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Print").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(nn.VALUES,D.ofAny(nn.VALUES),!0),k.ofEntry(nn.STREAM,D.ofString(nn.STREAM).setEnums([nn.LOG,nn.ERROR]).setDefaultValue(nn.LOG))])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}class na extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_SEARCH_STRING_NAME="searchString"}static{this.PARAMETER_SECOND_STRING_NAME="secondString"}static{this.PARAMETER_THIRD_STRING_NAME="thirdString"}static{this.PARAMETER_INDEX_NAME="index"}static{this.PARAMETER_SECOND_INDEX_NAME="secondIndex"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(na.PARAMETER_STRING_NAME,D.ofString(na.PARAMETER_STRING_NAME))}static{this.PARAMETER_SECOND_STRING=new k(na.PARAMETER_SECOND_STRING_NAME,D.ofString(na.PARAMETER_SECOND_STRING_NAME))}static{this.PARAMETER_THIRD_STRING=new k(na.PARAMETER_THIRD_STRING_NAME,D.ofString(na.PARAMETER_THIRD_STRING_NAME))}static{this.PARAMETER_INDEX=new k(na.PARAMETER_INDEX_NAME,D.ofInteger(na.PARAMETER_INDEX_NAME))}static{this.PARAMETER_SECOND_INDEX=new k(na.PARAMETER_SECOND_INDEX_NAME,D.ofInteger(na.PARAMETER_SECOND_INDEX_NAME))}static{this.PARAMETER_SEARCH_STRING=new k(na.PARAMETER_SEARCH_STRING_NAME,D.ofString(na.PARAMETER_STRING_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,j.of(na.EVENT_RESULT_NAME,D.ofString(na.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new Q(Q.OUTPUT,j.of(na.EVENT_RESULT_NAME,D.ofBoolean(na.EVENT_RESULT_NAME)))}static{this.EVENT_INT=new Q(Q.OUTPUT,j.of(na.EVENT_RESULT_NAME,D.ofInteger(na.EVENT_RESULT_NAME)))}static{this.EVENT_ARRAY=new Q(Q.OUTPUT,j.of(na.EVENT_RESULT_NAME,D.ofArray(na.EVENT_RESULT_NAME)))}constructor(e,t,r,...s){super();let n=new Map;s.forEach(e=>n.set(e.getParameterName(),e)),this.signature=new ea(t).setNamespace(e).setParameters(n).setEvents(j.of(r.getName(),r))}getSignature(){return this.signature}static ofEntryStringStringAndBooleanOutput(e,t){return[e,new class extends na{async internalExecute(e){let r=e?.getArguments()?.get(na.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(na.PARAMETER_SEARCH_STRING_NAME);return new es([Z.outputOf(j.of(na.EVENT_RESULT_NAME,t(r,s)))])}}(l.STRING,e,na.EVENT_BOOLEAN,na.PARAMETER_STRING,na.PARAMETER_SEARCH_STRING)]}static ofEntryStringIntegerAndStringOutput(e,t){return[e,new class extends na{async internalExecute(e){let r=e?.getArguments()?.get(na.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(na.PARAMETER_INDEX_NAME);return new es([Z.outputOf(j.of(na.EVENT_RESULT_NAME,t(r,s)))])}}(l.STRING,e,na.EVENT_STRING,na.PARAMETER_STRING,na.PARAMETER_INDEX)]}static ofEntryStringStringAndIntegerOutput(e,t){return[e,new class extends na{async internalExecute(e){let r=e?.getArguments()?.get(na.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(na.PARAMETER_SEARCH_STRING_NAME);return new es([Z.outputOf(j.of(na.EVENT_RESULT_NAME,t(r,s)))])}}(l.STRING,e,na.EVENT_INT,na.PARAMETER_STRING,na.PARAMETER_SEARCH_STRING)]}static ofEntryStringAndStringOutput(e,t){return[e,new class extends na{async internalExecute(e){let r=e?.getArguments()?.get(na.PARAMETER_STRING_NAME);return new es([Z.outputOf(j.of(na.EVENT_RESULT_NAME,t(r)))])}}(l.STRING,e,na.EVENT_STRING,na.PARAMETER_STRING)]}static ofEntryStringAndBooleanOutput(e,t){return[e,new class extends na{async internalExecute(e){let r=e?.getArguments()?.get(na.PARAMETER_STRING_NAME);return new es([Z.outputOf(j.of(na.EVENT_RESULT_NAME,t(r)))])}}(l.STRING,e,na.EVENT_BOOLEAN,na.PARAMETER_STRING)]}static ofEntryStringStringIntegerAndIntegerOutput(e,t){return[e,new class extends na{async internalExecute(e){let r=e?.getArguments()?.get(na.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(na.PARAMETER_SEARCH_STRING_NAME),n=e?.getArguments()?.get(na.PARAMETER_INDEX_NAME);return new es([Z.outputOf(j.of(na.EVENT_RESULT_NAME,t(r,s,n)))])}}(l.STRING,e,na.EVENT_INT,na.PARAMETER_STRING,na.PARAMETER_SEARCH_STRING,na.PARAMETER_INDEX)]}static ofEntryStringIntegerIntegerAndStringOutput(e,t){return[e,new class extends na{async internalExecute(e){let r=e?.getArguments()?.get(na.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(na.PARAMETER_INDEX_NAME),n=e?.getArguments()?.get(na.PARAMETER_SECOND_INDEX_NAME);return new es([Z.outputOf(j.of(na.EVENT_RESULT_NAME,t(r,s,n)))])}}(l.STRING,e,na.EVENT_STRING,na.PARAMETER_STRING,na.PARAMETER_INDEX,na.PARAMETER_SECOND_INDEX)]}static ofEntryStringStringStringAndStringOutput(e,t){return[e,new class extends na{async internalExecute(e){let r=e?.getArguments()?.get(na.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(na.PARAMETER_SECOND_STRING_NAME),n=e?.getArguments()?.get(na.PARAMETER_THIRD_STRING_NAME);return new es([Z.outputOf(j.of(na.EVENT_RESULT_NAME,t(r,s,n)))])}}(l.STRING,e,na.EVENT_STRING,na.PARAMETER_STRING,na.PARAMETER_SECOND_STRING,na.PARAMETER_THIRD_STRING)]}static ofEntryStringAndIntegerOutput(e,t){return[e,new class extends na{async internalExecute(e){let r=e?.getArguments()?.get(na.PARAMETER_STRING_NAME);return new es([Z.outputOf(j.of(na.EVENT_RESULT_NAME,t(r)))])}}(l.STRING,e,na.EVENT_INT,na.PARAMETER_STRING)]}}class ni extends e0{static{this.VALUE="value"}constructor(){super(),this.signature=new ea("Concatenate").setNamespace(l.STRING).setParameters(new Map([[ni.VALUE,new k(ni.VALUE,new D().setName(ni.VALUE).setType(new w(p.STRING))).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[ni.VALUE,D.ofString(ni.VALUE)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(ni.VALUE),r="";return t.reduce((e,t)=>r=e+t,r),new es([Z.outputOf(new Map([[ni.VALUE,r]]))])}}class no extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_START_NAME="startPosition"}static{this.PARAMETER_AT_END_NAME="endPosition"}static{this.EVENT_RESULT_NAME="result"}constructor(){super(),this.PARAMETER_STRING=new k(no.PARAMETER_STRING_NAME,D.ofString(no.PARAMETER_STRING_NAME)),this.PARAMETER_AT_START=new k(no.PARAMETER_AT_START_NAME,D.ofInteger(no.PARAMETER_AT_START_NAME)),this.PARAMETER_AT_END=new k(no.PARAMETER_AT_END_NAME,D.ofInteger(no.PARAMETER_AT_END_NAME)),this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[no.EVENT_RESULT_NAME,D.ofString(no.EVENT_RESULT_NAME)]])),this.signature=new ea("DeleteForGivenLength").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_START.getParameterName(),this.PARAMETER_AT_START],[this.PARAMETER_AT_END.getParameterName(),this.PARAMETER_AT_END]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(no.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(no.PARAMETER_AT_START_NAME),s=e?.getArguments()?.get(no.PARAMETER_AT_END_NAME);if(s>=r){let e="";return e+=t.substring(0,r),e+=t.substring(s),new es([Z.outputOf(new Map([[no.EVENT_RESULT_NAME,e.toString()]]))])}return new es([Z.outputOf(new Map([[no.EVENT_RESULT_NAME,t]]))])}}class nE extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_POSITION_NAME="position"}static{this.PARAMETER_INSERT_STRING_NAME="insertString"}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(nE.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nE.PARAMETER_AT_POSITION_NAME),s=e?.getArguments()?.get(nE.PARAMETER_INSERT_STRING_NAME),n="";return n+=t.substring(0,r),n+=s,n+=t.substring(r),new es([Z.outputOf(new Map([[this.EVENT_RESULT_NAME,n]]))])}constructor(...e){super(...e),this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new k(nE.PARAMETER_STRING_NAME,D.ofString(nE.PARAMETER_STRING_NAME)),this.PARAMETER_AT_POSITION=new k(nE.PARAMETER_AT_POSITION_NAME,D.ofInteger(nE.PARAMETER_AT_POSITION_NAME)),this.PARAMETER_INSERT_STRING=new k(nE.PARAMETER_INSERT_STRING_NAME,D.ofString(nE.PARAMETER_INSERT_STRING_NAME)),this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[this.EVENT_RESULT_NAME,D.ofString(this.EVENT_RESULT_NAME)]])),this.signature=new ea("InsertAtGivenPosition").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_POSITION.getParameterName(),this.PARAMETER_AT_POSITION],[this.PARAMETER_INSERT_STRING.getParameterName(),this.PARAMETER_INSERT_STRING]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,D.ofString(this.EVENT_RESULT_NAME)]]))]))}}class nu extends e0{static{this.PARAMETER_REGEX_NAME="regex"}static{this.PARAMETER_STRING_NAME="string"}static{this.EVENT_RESULT_NAME="result"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nu.PARAMETER_REGEX_NAME),r=e.getArguments()?.get(nu.PARAMETER_STRING_NAME);return new es([Z.outputOf(new Map([[nu.EVENT_RESULT_NAME,!!r.match(t)?.length]]))])}constructor(...e){super(...e),this.signature=new ea("Matches").setNamespace(l.STRING).setParameters(j.ofEntries(j.entry(...k.ofEntry(nu.PARAMETER_REGEX_NAME,D.ofString(nu.PARAMETER_REGEX_NAME))),j.entry(...k.ofEntry(nu.PARAMETER_STRING_NAME,D.ofString(nu.PARAMETER_STRING_NAME))))).setEvents(j.ofEntries(j.entry(...Q.outputEventMapEntry(new Map([[nu.EVENT_RESULT_NAME,D.ofBoolean(nu.EVENT_RESULT_NAME)]])))))}}class nA extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_POSTPAD_STRING_NAME="postpadString"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nA.PARAMETER_STRING_NAME,D.ofString(nA.PARAMETER_STRING_NAME))}static{this.PARAMETER_POSTPAD_STRING=new k(nA.PARAMETER_POSTPAD_STRING_NAME,D.ofString(nA.PARAMETER_POSTPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new k(nA.PARAMETER_LENGTH_NAME,D.ofInteger(nA.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[nA.EVENT_RESULT_NAME,D.ofString(nA.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new ea("PostPad").setNamespace(l.STRING).setParameters(new Map([[nA.PARAMETER_STRING.getParameterName(),nA.PARAMETER_STRING],[nA.PARAMETER_POSTPAD_STRING.getParameterName(),nA.PARAMETER_POSTPAD_STRING],[nA.PARAMETER_LENGTH.getParameterName(),nA.PARAMETER_LENGTH]])).setEvents(new Map([[nA.EVENT_STRING.getName(),nA.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nA.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nA.PARAMETER_POSTPAD_STRING_NAME),s=e.getArguments()?.get(nA.PARAMETER_LENGTH_NAME),n="",a=r.length;for(n+=t;a<=s;)n+=r,a+=r.length;return n.length-t.length<s&&(n+=r.substring(0,s-(n.length-t.length))),new es([Z.outputOf(new Map([[nA.EVENT_RESULT_NAME,n.toString()]]))])}}class nT extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_PREPAD_STRING_NAME="prepadString"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nT.PARAMETER_STRING_NAME,D.ofString(nT.PARAMETER_STRING_NAME))}static{this.PARAMETER_PREPAD_STRING=new k(nT.PARAMETER_PREPAD_STRING_NAME,D.ofString(nT.PARAMETER_PREPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new k(nT.PARAMETER_LENGTH_NAME,D.ofInteger(nT.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[nT.EVENT_RESULT_NAME,D.ofString(nT.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new ea("PrePad").setNamespace(l.STRING).setParameters(new Map([[nT.PARAMETER_STRING.getParameterName(),nT.PARAMETER_STRING],[nT.PARAMETER_PREPAD_STRING.getParameterName(),nT.PARAMETER_PREPAD_STRING],[nT.PARAMETER_LENGTH.getParameterName(),nT.PARAMETER_LENGTH]])).setEvents(new Map([[nT.EVENT_STRING.getName(),nT.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(nT.PARAMETER_STRING_NAME),r=e.getArguments()?.get(nT.PARAMETER_PREPAD_STRING_NAME),s=e.getArguments()?.get(nT.PARAMETER_LENGTH_NAME),n="",a=r.length;for(;a<=s;)n+=r,a+=r.length;return n.length<s&&(n+=r.substring(0,s-n.length)),n+=t,new es([Z.outputOf(new Map([[nT.EVENT_RESULT_NAME,n]]))])}}class nl extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_BOOLEAN_NAME="boolean"}static{this.PARAMETER_FIRST_OFFSET_NAME="firstOffset"}static{this.PARAMETER_OTHER_STRING_NAME="otherString"}static{this.PARAMETER_SECOND_OFFSET_NAME="secondOffset"}static{this.PARAMETER_INTEGER_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nl.PARAMETER_STRING_NAME,D.ofString(nl.PARAMETER_STRING_NAME))}static{this.PARAMETER_OTHER_STRING=new k(nl.PARAMETER_OTHER_STRING_NAME,D.ofString(nl.PARAMETER_OTHER_STRING_NAME))}static{this.PARAMETER_FIRST_OFFSET=new k(nl.PARAMETER_FIRST_OFFSET_NAME,D.ofInteger(nl.PARAMETER_FIRST_OFFSET_NAME))}static{this.PARAMETER_SECOND_OFFSET=new k(nl.PARAMETER_SECOND_OFFSET_NAME,D.ofInteger(nl.PARAMETER_SECOND_OFFSET_NAME))}static{this.PARAMETER_INTEGER=new k(nl.PARAMETER_INTEGER_NAME,D.ofInteger(nl.PARAMETER_INTEGER_NAME))}static{this.PARAMETER_BOOLEAN=new k(nl.PARAMETER_BOOLEAN_NAME,D.ofBoolean(nl.PARAMETER_BOOLEAN_NAME))}static{this.EVENT_BOOLEAN=new Q(Q.OUTPUT,new Map([[nl.EVENT_RESULT_NAME,D.ofBoolean(nl.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new ea("RegionMatches").setNamespace(l.STRING).setParameters(new Map([[nl.PARAMETER_STRING.getParameterName(),nl.PARAMETER_STRING],[nl.PARAMETER_BOOLEAN.getParameterName(),nl.PARAMETER_BOOLEAN],[nl.PARAMETER_FIRST_OFFSET.getParameterName(),nl.PARAMETER_FIRST_OFFSET],[nl.PARAMETER_OTHER_STRING.getParameterName(),nl.PARAMETER_OTHER_STRING],[nl.PARAMETER_SECOND_OFFSET.getParameterName(),nl.PARAMETER_SECOND_OFFSET],[nl.PARAMETER_INTEGER.getParameterName(),nl.PARAMETER_INTEGER]])).setEvents(new Map([[nl.EVENT_BOOLEAN.getName(),nl.EVENT_BOOLEAN]]))}async internalExecute(e){let t=e.getArguments()?.get(nl.PARAMETER_STRING_NAME),r=e.getArguments()?.get(nl.PARAMETER_BOOLEAN_NAME),s=e.getArguments()?.get(nl.PARAMETER_FIRST_OFFSET_NAME),n=e?.getArguments()?.get(nl.PARAMETER_OTHER_STRING_NAME),a=e?.getArguments()?.get(nl.PARAMETER_SECOND_OFFSET_NAME),i=e.getArguments()?.get(nl.PARAMETER_INTEGER_NAME),o=!1;return o=!(s<0)&&!(a<0)&&!(s+i>t.length)&&!(a+i>n.length)&&(r?(t=t.substring(s,s+i).toUpperCase())==n.substring(a,a+i).toUpperCase():(t=t.substring(s,s+i))==n.substring(a,i)),new es([Z.outputOf(new Map([[nl.EVENT_RESULT_NAME,o]]))])}}class nm extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_START_NAME="startPosition"}static{this.PARAMETER_AT_LENGTH_NAME="lengthPosition"}static{this.PARAMETER_REPLACE_STRING_NAME="replaceString"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nm.PARAMETER_STRING_NAME,D.ofString(nm.PARAMETER_STRING_NAME))}static{this.PARAMETER_AT_START=new k(nm.PARAMETER_AT_START_NAME,D.ofInteger(nm.PARAMETER_AT_START_NAME))}static{this.PARAMETER_AT_LENGTH=new k(nm.PARAMETER_AT_LENGTH_NAME,D.ofInteger(nm.PARAMETER_AT_LENGTH_NAME))}static{this.PARAMETER_REPLACE_STRING=new k(nm.PARAMETER_REPLACE_STRING_NAME,D.ofString(nm.PARAMETER_REPLACE_STRING_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[nm.EVENT_RESULT_NAME,D.ofString(nm.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new ea("ReplaceAtGivenPosition").setNamespace(l.STRING).setParameters(new Map([[nm.PARAMETER_STRING.getParameterName(),nm.PARAMETER_STRING],[nm.PARAMETER_AT_START.getParameterName(),nm.PARAMETER_AT_START],[nm.PARAMETER_AT_LENGTH.getParameterName(),nm.PARAMETER_AT_LENGTH],[nm.PARAMETER_REPLACE_STRING.getParameterName(),nm.PARAMETER_REPLACE_STRING]])).setEvents(new Map([[nm.EVENT_STRING.getName(),nm.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(nm.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nm.PARAMETER_AT_START_NAME),s=e?.getArguments()?.get(nm.PARAMETER_AT_LENGTH_NAME),n=e?.getArguments()?.get(nm.PARAMETER_REPLACE_STRING_NAME);if(t.length,r<s){let e="";e+=t.substring(0,r),e+=n,e+=t.substring(r+s)}return new es([Z.outputOf(new Map([[nm.EVENT_RESULT_NAME,t]]))])}}class nR extends e0{constructor(){super(),this.VALUE="value",this.signature=new ea("Reverse").setNamespace(l.STRING).setParameters(new Map([[this.VALUE,new k(this.VALUE,D.ofString(this.VALUE)).setVariableArgument(!1)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[this.VALUE,new D().setType(d.of(p.STRING)).setName(this.VALUE)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(this.VALUE),r=t.length-1,s="";for(;r>=0;)s+=t.charAt(r--);return new es([Z.outputOf(j.of(this.VALUE,s))])}}class nh extends e0{getSignature(){return this.signature}constructor(){super(),this.PARAMETER_STRING_NAME="string",this.PARAMETER_SPLIT_STRING_NAME="searchString",this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new k(this.PARAMETER_STRING_NAME,D.ofString(this.PARAMETER_STRING_NAME)),this.PARAMETER_SPLIT_STRING=new k(this.PARAMETER_SPLIT_STRING_NAME,D.ofString(this.PARAMETER_SPLIT_STRING_NAME)),this.EVENT_ARRAY=new Q(Q.OUTPUT,j.of(this.EVENT_RESULT_NAME,D.ofArray(this.EVENT_RESULT_NAME))),this.signature=new ea("Split").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_STRING_NAME,this.PARAMETER_STRING],[this.PARAMETER_SPLIT_STRING_NAME,this.PARAMETER_SPLIT_STRING]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,D.ofArray(this.EVENT_RESULT_NAME)]]))]))}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_STRING_NAME),r=e.getArguments()?.get(this.PARAMETER_SPLIT_STRING_NAME);return new es([Z.outputOf(j.of(this.EVENT_RESULT_NAME,t.split(r)))])}}class ng extends e0{getSignature(){return this.signature}constructor(){super(),this.PARAMETER_INPUT_ANYTYPE_NAME="anytype",this.EVENT_RESULT_NAME="result",this.PARAMETER_INPUT_ANYTYPE=new k(this.PARAMETER_INPUT_ANYTYPE_NAME,D.ofAny(this.PARAMETER_INPUT_ANYTYPE_NAME)),this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[this.EVENT_RESULT_NAME,D.ofString(this.EVENT_RESULT_NAME)]])),this.signature=new ea("ToString").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_INPUT_ANYTYPE.getParameterName(),this.PARAMETER_INPUT_ANYTYPE]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_INPUT_ANYTYPE_NAME),r="";return r="object"==typeof t?JSON.stringify(t,void 0,2):""+t,new es([Z.outputOf(new Map([[this.EVENT_RESULT_NAME,r]]))])}}class nc extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nc.PARAMETER_STRING_NAME,D.ofString(nc.PARAMETER_STRING_NAME))}static{this.PARAMETER_LENGTH=new k(nc.PARAMETER_LENGTH_NAME,D.ofInteger(nc.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[nc.EVENT_RESULT_NAME,D.ofString(nc.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new ea("TrimTo").setNamespace(l.STRING).setParameters(new Map([[nc.PARAMETER_STRING.getParameterName(),nc.PARAMETER_STRING],[nc.PARAMETER_LENGTH.getParameterName(),nc.PARAMETER_LENGTH]])).setEvents(new Map([[nc.EVENT_STRING.getName(),nc.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(nc.PARAMETER_STRING_NAME),r=e.getArguments()?.get(nc.PARAMETER_LENGTH_NAME);return new es([Z.outputOf(new Map([[nc.EVENT_RESULT_NAME,t.substring(0,r)]]))])}}class np{async find(e,t){return e!=l.STRING?Promise.resolve(void 0):Promise.resolve(this.repoMap.get(t))}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}constructor(){this.repoMap=j.ofArrayEntries(na.ofEntryStringAndStringOutput("Trim",e=>e.trim()),na.ofEntryStringAndStringOutput("TrimStart",e=>e.trimStart()),na.ofEntryStringAndStringOutput("TrimEnd",e=>e.trimEnd()),na.ofEntryStringAndIntegerOutput("Length",e=>e.length),na.ofEntryStringStringAndIntegerOutput("Frequency",(e,t)=>{let r=0,s=e.indexOf(t);for(;-1!=s;)r++,s=e.indexOf(t,s+1);return r}),na.ofEntryStringAndStringOutput("LowerCase",e=>e.toLocaleLowerCase()),na.ofEntryStringAndStringOutput("UpperCase",e=>e.toUpperCase()),na.ofEntryStringAndBooleanOutput("IsBlank",e=>""===e.trim()),na.ofEntryStringAndBooleanOutput("IsEmpty",e=>""===e),na.ofEntryStringStringAndBooleanOutput("Contains",(e,t)=>-1!=e.indexOf(t)),na.ofEntryStringStringAndBooleanOutput("EndsWith",(e,t)=>e.endsWith(t)),na.ofEntryStringStringAndBooleanOutput("StartsWith",(e,t)=>e.startsWith(t)),na.ofEntryStringStringAndBooleanOutput("EqualsIgnoreCase",(e,t)=>e.toUpperCase()==t.toUpperCase()),na.ofEntryStringStringAndBooleanOutput("Matches",(e,t)=>new RegExp(t).test(e)),na.ofEntryStringStringAndIntegerOutput("IndexOf",(e,t)=>e.indexOf(t)),na.ofEntryStringStringAndIntegerOutput("LastIndexOf",(e,t)=>e.lastIndexOf(t)),na.ofEntryStringIntegerAndStringOutput("Repeat",(e,t)=>e.repeat(t)),na.ofEntryStringStringIntegerAndIntegerOutput("IndexOfWithStartPoint",(e,t,r)=>e.indexOf(t,r)),na.ofEntryStringStringIntegerAndIntegerOutput("LastIndexOfWithStartPoint",(e,t,r)=>e.lastIndexOf(t,r)),na.ofEntryStringStringStringAndStringOutput("Replace",(e,t,r)=>e.replaceAll(t,r)),na.ofEntryStringStringStringAndStringOutput("ReplaceFirst",(e,t,r)=>e.replace(t,r)),na.ofEntryStringIntegerIntegerAndStringOutput("SubString",(e,t,r)=>e.substring(t,r)),q(new ni),q(new no),q(new nE),q(new nA),q(new nT),q(new nl),q(new nm),q(new nR),q(new nh),q(new ng),q(new nc),q(new nu)),this.filterableNames=Array.from(this.repoMap.values()).map(e=>e.getSignature().getFullName())}}class nN extends e0{static{this.PARAMETER_TIMESTAMP_NAME="isoTimeStamp"}static{this.PARAMETER_TIMESTAMP_NAME_ONE="isoTimeStamp1"}static{this.PARAMETER_TIMESTAMP_NAME_TWO="isoTimeStamp2"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_NUMBER_NAME="number"}static{this.PARAMETER_TIMESTAMP=new k(nN.PARAMETER_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_ONE=new k(nN.PARAMETER_TIMESTAMP_NAME_ONE,D.ofRef(l.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_TWO=new k(nN.PARAMETER_TIMESTAMP_NAME_TWO,D.ofRef(l.DATE+".Timestamp"))}static{this.PARAMETER_VARIABLE_UNIT=new k(nN.PARAMETER_UNIT_NAME,D.ofRef(l.DATE+".Timeunit")).setVariableArgument(!0)}static{this.PARAMETER_UNIT=new k(nN.PARAMETER_UNIT_NAME,D.ofRef(l.DATE+".Timeunit"))}static{this.PARAMETER_NUMBER=new k(nN.PARAMETER_NUMBER_NAME,D.ofInteger(nN.PARAMETER_NUMBER_NAME))}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_TIMESTAMP_NAME="isoTimeStamp"}static{this.EVENT_INT=new Q(Q.OUTPUT,j.of(nN.EVENT_RESULT_NAME,D.ofInteger(nN.EVENT_RESULT_NAME)))}static{this.EVENT_STRING=new Q(Q.OUTPUT,j.of(nN.EVENT_RESULT_NAME,D.ofString(nN.EVENT_RESULT_NAME)))}static{this.EVENT_LONG=new Q(Q.OUTPUT,j.of(nN.EVENT_RESULT_NAME,D.ofLong(nN.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new Q(Q.OUTPUT,j.of(nN.EVENT_RESULT_NAME,D.ofBoolean(nN.EVENT_RESULT_NAME)))}static{this.EVENT_TIMESTAMP=new Q(Q.OUTPUT,j.of(nN.EVENT_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")))}getSignature(){return this.signature}constructor(e,t,...r){if(super(),this.signature=new ea(e).setNamespace(l.DATE).setEvents(j.of(t.getName(),t)),!r?.length)return;let s=new Map;r.forEach(e=>s.set(e.getParameterName(),e)),this.signature.setParameters(s)}static ofEntryTimestampAndIntegerOutput(e,t){return[e,new class extends nN{async internalExecute(e){return new es([Z.outputOf(j.of(nN.EVENT_RESULT_NAME,t(e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME))))])}}(e,nN.EVENT_INT,nN.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndBooleanOutput(e,t){return[e,new class extends nN{async internalExecute(e){return new es([Z.outputOf(j.of(nN.EVENT_RESULT_NAME,t(e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME))))])}}(e,nN.EVENT_BOOLEAN,nN.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndStringOutput(e,t){return[e,new class extends nN{async internalExecute(e){return new es([Z.outputOf(j.of(nN.EVENT_RESULT_NAME,t(e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME))))])}}(e,nN.EVENT_STRING,nN.PARAMETER_TIMESTAMP)]}static ofEntryTimestampIntegerAndTimestampOutput(e,t){return[e,new class extends nN{async internalExecute(e){return new es([Z.outputOf(j.of(nN.EVENT_RESULT_NAME,t(e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME),e.getArguments()?.get(nN.PARAMETER_NUMBER_NAME))))])}}(e,nN.EVENT_TIMESTAMP,nN.PARAMETER_TIMESTAMP,nN.PARAMETER_NUMBER)]}static ofEntryTimestampTimestampAndTOutput(e,t,r,...s){return[e,new class extends nN{async internalExecute(e){let t=[];return s?.length&&t.push(...s.map(t=>e.getArguments()?.get(t.getParameterName()))),new es([Z.outputOf(j.of(nN.EVENT_RESULT_NAME,r(e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME_ONE),e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME_TWO),t)))])}}(e,t,nN.PARAMETER_TIMESTAMP_ONE,nN.PARAMETER_TIMESTAMP_TWO,...s)]}}function nf(e){let t=(0,i.DateTime).fromISO(e,{setZone:!0});if(!t?.isValid)throw Error("Invalid ISO timestamp");return t}class n_ extends nN{static{this.PARAMETER_YEARS_NAME="years"}static{this.PARAMETER_MONTHS_NAME="months"}static{this.PARAMETER_DAYS_NAME="days"}static{this.PARAMETER_HOURS_NAME="hours"}static{this.PARAMETER_MINUTES_NAME="minutes"}static{this.PARAMETER_SECONDS_NAME="seconds"}static{this.PARAMETER_MILLISECONDS_NAME="milliseconds"}constructor(e){super(e?"AddTime":"SubtractTime",nN.EVENT_TIMESTAMP,nN.PARAMETER_TIMESTAMP,k.of(n_.PARAMETER_YEARS_NAME,D.ofNumber(n_.PARAMETER_YEARS_NAME).setDefaultValue(0)),k.of(n_.PARAMETER_MONTHS_NAME,D.ofNumber(n_.PARAMETER_MONTHS_NAME).setDefaultValue(0)),k.of(n_.PARAMETER_DAYS_NAME,D.ofNumber(n_.PARAMETER_DAYS_NAME).setDefaultValue(0)),k.of(n_.PARAMETER_HOURS_NAME,D.ofNumber(n_.PARAMETER_HOURS_NAME).setDefaultValue(0)),k.of(n_.PARAMETER_MINUTES_NAME,D.ofNumber(n_.PARAMETER_MINUTES_NAME).setDefaultValue(0)),k.of(n_.PARAMETER_SECONDS_NAME,D.ofNumber(n_.PARAMETER_SECONDS_NAME).setDefaultValue(0)),k.of(n_.PARAMETER_MILLISECONDS_NAME,D.ofNumber(n_.PARAMETER_MILLISECONDS_NAME).setDefaultValue(0))),this.isAdd=e}async internalExecute(e){let t;let r=nf(e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME)),s=e.getArguments()?.get(n_.PARAMETER_YEARS_NAME),n=e.getArguments()?.get(n_.PARAMETER_MONTHS_NAME),a=e.getArguments()?.get(n_.PARAMETER_DAYS_NAME),i=e.getArguments()?.get(n_.PARAMETER_HOURS_NAME),o={years:s,months:n,days:a,hours:i,minutes:e.getArguments()?.get(n_.PARAMETER_MINUTES_NAME),seconds:e.getArguments()?.get(n_.PARAMETER_SECONDS_NAME),milliseconds:e.getArguments()?.get(n_.PARAMETER_MILLISECONDS_NAME)};return t=this.isAdd?r.plus(o):r.minus(o),new es([Z.outputOf(j.of(nN.EVENT_TIMESTAMP_NAME,t.toISO()))])}}class nM extends e0{constructor(e,t){super(),this.paramName=`epoch${t?"Seconds":"Milliseconds"}`,this.isSeconds=t,this.signature=new ea(e).setNamespace(l.DATE).setParameters(new Map([[this.paramName,k.of(this.paramName,new D().setName(this.paramName).setType(d.of(p.LONG,p.INTEGER,p.STRING)))]])).setEvents(new Map([[nN.EVENT_TIMESTAMP.getName(),nN.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=parseInt(e.getArguments()?.get(this.paramName)),r=this.isSeconds?1e3*t:t;if(isNaN(r))throw Error(`Please provide a valid value for ${this.paramName}.`);return Promise.resolve(new es([Z.outputOf(j.of(nN.EVENT_TIMESTAMP_NAME,new Date(r).toISOString()))]))}}class nS extends e0{constructor(e,t){super(),this.isSeconds=t,this.signature=new ea(e).setNamespace(l.DATE).setParameters(new Map([[nN.PARAMETER_TIMESTAMP_NAME,nN.PARAMETER_TIMESTAMP]])).setEvents(new Map([[nN.EVENT_TIMESTAMP.getName(),nN.EVENT_LONG]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME),r=this.isSeconds?(0,i.DateTime).fromISO(t).toSeconds():(0,i.DateTime).fromISO(t).toMillis();return Promise.resolve(new es([Z.outputOf(j.of(nN.EVENT_RESULT_NAME,r))]))}}class nO extends nN{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("ToDateString",nN.EVENT_STRING,nN.PARAMETER_TIMESTAMP,k.of(nO.PARAMETER_FORMAT_NAME,D.ofString(nO.PARAMETER_FORMAT_NAME)),k.of(nO.PARAMETER_LOCALE_NAME,D.ofString(nO.PARAMETER_LOCALE_NAME).setDefaultValue("")))}async internalExecute(e){let t=nf(e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(nO.PARAMETER_FORMAT_NAME),s=e.getArguments()?.get(nO.PARAMETER_LOCALE_NAME);return""===s&&(s="system"),new es([Z.outputOf(j.of(nN.EVENT_RESULT_NAME,t.toFormat(r,{locale:s})))])}}class nw extends nN{static{this.PARAMETER_TIMEZONE_NAME="timezone"}constructor(){super("SetTimeZone",nN.EVENT_TIMESTAMP,nN.PARAMETER_TIMESTAMP,k.of(nw.PARAMETER_TIMEZONE_NAME,D.ofString(nw.PARAMETER_TIMEZONE_NAME)))}async internalExecute(e){let t=nf(e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(nw.PARAMETER_TIMEZONE_NAME);return new es([Z.outputOf(j.of(nN.EVENT_TIMESTAMP_NAME,t.setZone(r).toISO()))])}}class nd extends nN{static{this.PARAMETER_START_TIMESTAMP_NAME="startTimestamp"}static{this.PARAMETER_END_TIMESTAMP_NAME="endTimestamp"}static{this.PARAMETER_CHECK_TIMESTAMP_NAME="checkTimestamp"}constructor(){super("IsBetween",nd.EVENT_BOOLEAN,k.of(nd.PARAMETER_START_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")),k.of(nd.PARAMETER_END_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")),k.of(nd.PARAMETER_CHECK_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")))}async internalExecute(e){let t=e.getArguments()?.get(nd.PARAMETER_START_TIMESTAMP_NAME),r=e.getArguments()?.get(nd.PARAMETER_END_TIMESTAMP_NAME),s=e.getArguments()?.get(nd.PARAMETER_CHECK_TIMESTAMP_NAME),n=nf(t),a=nf(r),i=nf(s);return n>a&&([n,a]=[a,n]),new es([Z.outputOf(j.of(nd.EVENT_RESULT_NAME,n<=i&&i<=a))])}}class nI extends e0{constructor(e){super(),this.isLast=e,this.signature=new ea(e?"LastOf":"FirstOf").setNamespace(l.DATE).setParameters(new Map([[nN.PARAMETER_TIMESTAMP_NAME,new k(nN.PARAMETER_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")).setVariableArgument(!0)]])).setEvents(new Map([[nN.EVENT_TIMESTAMP.getName(),nN.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME);if(!t?.length)throw Error("No timestamps provided");let r=t.map(e=>nf(e));return r.sort((e,t)=>e.toMillis()-t.toMillis()),Promise.resolve(new es([Z.outputOf(j.of(nN.EVENT_TIMESTAMP_NAME,r[this.isLast?r.length-1:0].toISO()))]))}}class nP extends nN{static{this.EVENT_TIME_OBJECT_NAME="object"}static{this.EVENT_TIME_ARRAY_NAME="array"}constructor(e){super(e?"TimeAsArray":"TimeAsObject",new Q(Q.OUTPUT,j.of(e?nP.EVENT_TIME_ARRAY_NAME:nP.EVENT_TIME_OBJECT_NAME,e?D.ofArray(nP.EVENT_TIME_ARRAY_NAME,D.ofInteger("timeParts")):D.ofRef(l.DATE+".TimeObject"))),nN.PARAMETER_TIMESTAMP),this.isArray=e}async internalExecute(e){let t=nf(e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME)).toObject();return new es([Z.outputOf(j.of(this.isArray?nP.EVENT_TIME_ARRAY_NAME:nP.EVENT_TIME_OBJECT_NAME,this.isArray?[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond]:t))])}}class ny extends nN{constructor(e){super(e?"StartOf":"EndOf",nN.EVENT_TIMESTAMP,nN.PARAMETER_TIMESTAMP,nN.PARAMETER_UNIT),this.isStart=e}async internalExecute(e){let t=nf(e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(nN.PARAMETER_UNIT_NAME)?.toLowerCase();r=r.substring(0,r.length-1);let s=this.isStart?t.startOf(r):t.endOf(r);return new es([Z.outputOf(j.of(nN.EVENT_TIMESTAMP_NAME,s.toISO({includeOffset:!0})))])}}class nx extends nN{static{this.EVENT_NAMES_NAME="names"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("GetNames",new Q(nx.EVENT_NAMES_NAME,j.of(nx.EVENT_NAMES_NAME,D.ofArray(nx.EVENT_NAMES_NAME,D.ofString(nx.EVENT_NAMES_NAME)))),new k(nx.PARAMETER_UNIT_NAME,D.ofString(nx.PARAMETER_UNIT_NAME).setEnums(["TIMEZONES","MONTHS","WEEKDAYS"])),new k(nx.PARAMETER_LOCALE_NAME,D.ofString(nx.PARAMETER_LOCALE_NAME).setDefaultValue("system")))}async internalExecute(e){let t=e.getArguments()?.get(nx.PARAMETER_UNIT_NAME),r=e.getArguments()?.get(nx.PARAMETER_LOCALE_NAME);return new es([Z.outputOf(j.of(nx.EVENT_NAMES_NAME,this.getNames(t,r)))])}getNames(e,t){return"TIMEZONES"===e?Intl.supportedValuesOf("timeZone"):"MONTHS"===e?[1,2,3,4,5,6,7,8,9,10,11,12].map(e=>(0,i.DateTime).now().setLocale(t).set({month:e}).toFormat("MMMM")):"WEEKDAYS"===e?[1,2,3,4,5,6,7].map(e=>(0,i.DateTime).now().setLocale(t).set({month:7,year:2024,day:e}).toFormat("EEEE")):[]}}class nL extends e0{internalExecute(e){let t=e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME),r=(0,i.DateTime).fromISO(t);return Promise.resolve(new es([Z.outputOf(j.of(nN.EVENT_RESULT_NAME,r.isValid))]))}getSignature(){return this.signature}constructor(...e){super(...e),this.signature=new ea("IsValidISODate").setNamespace(l.DATE).setParameters(new Map([k.ofEntry(nN.PARAMETER_TIMESTAMP_NAME,D.ofString(nN.PARAMETER_TIMESTAMP_NAME))])).setEvents(new Map([Q.outputEventMapEntry(j.of(nN.EVENT_RESULT_NAME,D.ofBoolean(nN.EVENT_RESULT_NAME)))]))}}class nv extends nN{static{this.PARAMETER_BASE_NAME="base"}static{this.PARAMETER_BASE=new k(nv.PARAMETER_BASE_NAME,D.ofRef(l.DATE+".Timestamp").setDefaultValue(""))}static{this.PARAMETER_LOCALE_NAME="locale"}static{this.PARAMETER_LOCALE=new k(nv.PARAMETER_LOCALE_NAME,D.ofString(nv.PARAMETER_LOCALE_NAME).setDefaultValue("system"))}static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_FORMAT=new k(nv.PARAMETER_FORMAT_NAME,D.ofString(nv.PARAMETER_FORMAT_NAME).setEnums(["LONG","SHORT","NARROW"]).setDefaultValue("LONG"))}static{this.PARAMETER_ROUND_NAME="round"}static{this.PARAMETER_ROUND=new k(nv.PARAMETER_ROUND_NAME,D.ofBoolean(nv.PARAMETER_ROUND_NAME).setDefaultValue(!0))}constructor(){super("FromNow",nN.EVENT_STRING,nN.PARAMETER_TIMESTAMP,nv.PARAMETER_FORMAT,nv.PARAMETER_BASE,nN.PARAMETER_VARIABLE_UNIT,nv.PARAMETER_ROUND,nv.PARAMETER_LOCALE)}internalExecute(e){let t=e.getArguments()?.get(nv.PARAMETER_BASE_NAME),r=""===t?(0,i.DateTime).now():(0,i.DateTime).fromISO(t),s=e.getArguments()?.get(nN.PARAMETER_TIMESTAMP_NAME),n=(0,i.DateTime).fromISO(s),a=e.getArguments()?.get(nv.PARAMETER_UNIT_NAME),o=e.getArguments()?.get(nv.PARAMETER_FORMAT_NAME),E=e.getArguments()?.get(nv.PARAMETER_ROUND_NAME),u=e.getArguments()?.get(nv.PARAMETER_LOCALE_NAME),A={base:r,style:o?.toLowerCase(),round:E,locale:u};return a?.length>0&&(A.unit=a.map(e=>e.toLowerCase())),Promise.resolve(new es([Z.outputOf(j.of(nN.EVENT_RESULT_NAME,n.toRelative(A)??"Unknown"))]))}}class nU extends nN{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_TIMESTAMP_STRING_NAME="timestampString"}constructor(){super("FromDateString",nN.EVENT_TIMESTAMP,k.of(nU.PARAMETER_TIMESTAMP_STRING_NAME,D.ofString(nU.PARAMETER_TIMESTAMP_STRING_NAME)),k.of(nU.PARAMETER_FORMAT_NAME,D.ofString(nU.PARAMETER_FORMAT_NAME)))}async internalExecute(e){let t=e.getArguments()?.get(nU.PARAMETER_TIMESTAMP_STRING_NAME),r=e.getArguments()?.get(nU.PARAMETER_FORMAT_NAME),s=(0,i.DateTime).fromFormat(t,r);return new es([Z.outputOf(j.of(nN.EVENT_RESULT_NAME,s.toISO()))])}}class nV extends nN{constructor(){super("GetCurrentTimestamp",nN.EVENT_TIMESTAMP)}async internalExecute(e){return new es([Z.outputOf(j.of(nN.EVENT_TIMESTAMP_NAME,(0,i.DateTime).now().toISO()))])}}class nC{find(e,t){return e!=l.DATE?Promise.resolve(void 0):Promise.resolve(this.repoMap.get(t))}filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}constructor(){this.repoMap=j.ofArrayEntries(["EpochSecondsToTimestamp",new nM("EpochSecondsToTimestamp",!0)],["EpochMillisecondsToTimestamp",new nM("EpochMillisecondsToTimestamp",!1)],nN.ofEntryTimestampAndIntegerOutput("GetDay",e=>nf(e).day),nN.ofEntryTimestampAndIntegerOutput("GetDayOfWeek",e=>nf(e).weekday),nN.ofEntryTimestampAndIntegerOutput("GetMonth",e=>nf(e).month),nN.ofEntryTimestampAndIntegerOutput("GetYear",e=>nf(e).year),nN.ofEntryTimestampAndIntegerOutput("GetHours",e=>nf(e).hour),nN.ofEntryTimestampAndIntegerOutput("GetMinutes",e=>nf(e).minute),nN.ofEntryTimestampAndIntegerOutput("GetSeconds",e=>nf(e).second),nN.ofEntryTimestampAndIntegerOutput("GetMilliseconds",e=>nf(e).millisecond),nN.ofEntryTimestampAndIntegerOutput("GetDaysInMonth",e=>nf(e).daysInMonth),nN.ofEntryTimestampAndIntegerOutput("GetDaysInYear",e=>nf(e).daysInYear),["TimestampToEpochSeconds",new nS("TimestampToEpochSeconds",!0)],["TimestampToEpochMilliseconds",new nS("TimestampToEpochMilliseconds",!1)],nN.ofEntryTimestampAndStringOutput("GetTimeZoneName",e=>nf(e).zoneName),nN.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetLong",e=>nf(e).offsetNameLong),nN.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetShort",e=>nf(e).offsetNameShort),nN.ofEntryTimestampAndIntegerOutput("GetTimeZoneOffset",e=>nf(e).offset),["ToDateString",new nO],["AddTime",new n_(!0)],["SubtractTime",new n_(!1)],["GetCurrentTimestamp",new nV],nN.ofEntryTimestampTimestampAndTOutput("Difference",new Q(Q.OUTPUT,j.of(nN.EVENT_RESULT_NAME,D.ofRef(`${l.DATE}.Duration`))),(e,t,r)=>{let s;let n=nf(e),a=nf(t);r?.[0]?.length&&(s=r[0]?.filter(e=>!!e).map(e=>e.toLowerCase()));let i=n.diff(a);return s?.length?i.shiftTo(...s).toObject():i.toObject()},nN.PARAMETER_VARIABLE_UNIT),nN.ofEntryTimestampIntegerAndTimestampOutput("SetDay",(e,t)=>nf(e).set({day:t}).toISO()),nN.ofEntryTimestampIntegerAndTimestampOutput("SetMonth",(e,t)=>nf(e).set({month:t}).toISO()),nN.ofEntryTimestampIntegerAndTimestampOutput("SetYear",(e,t)=>nf(e).set({year:t}).toISO()),nN.ofEntryTimestampIntegerAndTimestampOutput("SetHours",(e,t)=>nf(e).set({hour:t}).toISO()),nN.ofEntryTimestampIntegerAndTimestampOutput("SetMinutes",(e,t)=>nf(e).set({minute:t}).toISO()),nN.ofEntryTimestampIntegerAndTimestampOutput("SetSeconds",(e,t)=>nf(e).set({second:t}).toISO()),nN.ofEntryTimestampIntegerAndTimestampOutput("SetMilliseconds",(e,t)=>nf(e).set({millisecond:t}).toISO()),["SetTimeZone",new nw],nN.ofEntryTimestampTimestampAndTOutput("IsBefore",new Q(Q.OUTPUT,j.of(nN.EVENT_RESULT_NAME,D.ofBoolean(nN.EVENT_RESULT_NAME))),(e,t)=>nf(e)<nf(t)),nN.ofEntryTimestampTimestampAndTOutput("IsAfter",new Q(Q.OUTPUT,j.of(nN.EVENT_RESULT_NAME,D.ofBoolean(nN.EVENT_RESULT_NAME))),(e,t)=>nf(e)>nf(t)),nN.ofEntryTimestampTimestampAndTOutput("IsSame",new Q(Q.OUTPUT,j.of(nN.EVENT_RESULT_NAME,D.ofBoolean(nN.EVENT_RESULT_NAME))),(e,t)=>nf(e)===nf(t)),nN.ofEntryTimestampTimestampAndTOutput("IsSameOrBefore",new Q(Q.OUTPUT,j.of(nN.EVENT_RESULT_NAME,D.ofBoolean(nN.EVENT_RESULT_NAME))),(e,t)=>nf(e)<=nf(t)),nN.ofEntryTimestampTimestampAndTOutput("IsSameOrAfter",new Q(Q.OUTPUT,j.of(nN.EVENT_RESULT_NAME,D.ofBoolean(nN.EVENT_RESULT_NAME))),(e,t)=>nf(e)>=nf(t)),nN.ofEntryTimestampAndBooleanOutput("IsInLeapYear",e=>nf(e).isInLeapYear),nN.ofEntryTimestampAndBooleanOutput("IsInDST",e=>nf(e).isInDST),["IsBetween",new nd],["LastOf",new nI(!0)],["FirstOf",new nI(!1)],["StartOf",new ny(!0)],["EndOf",new ny(!1)],["TimeAsObject",new nP(!1)],["TimeAsArray",new nP(!0)],["GetNames",new nx],["IsValidISODate",new nL],["FromNow",new nv],["FromDateString",new nU]),this.filterableNames=Array.from(this.repoMap.values()).map(e=>e.getSignature().getFullName())}}class nD extends e0{static{this.MILLIS="millis"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nD.MILLIS);return await new Promise(e=>setTimeout(e,t)),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Wait").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(nD.MILLIS,D.ofNumber(nD.MILLIS).setMinimum(0).setDefaultValue(0))])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}var nb={};E(nb,"HybridRepository",()=>nG);class nG{constructor(...e){this.repos=e}async find(e,t){for(let r of this.repos){let s=await r.find(e,t);if(s)return s}}async filter(e){let t=new Set;for(let r of this.repos)(await r.filter(e)).forEach(e=>t.add(e));return Array.from(t)}}class nF extends e0{static{this.SOURCE="source"}static{this.SCHEMA="schema"}static{this.IS_VALID="isValid"}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(nF.SOURCE),r=D.from(e?.getArguments()?.get(nF.SCHEMA));if(!r)throw new er("Schema is not supplied.");return this.validateSchema(r,e.getSchemaRepository(),t)}async validateSchema(e,t,r){try{return await eZ.validate([],e,t,r,!0),new es([Z.outputOf(j.of(nF.IS_VALID,!0))])}catch(e){return new es([Z.outputOf(j.of(nF.IS_VALID,!1))])}}constructor(...e){super(...e),this.signature=new ea("ValidateSchema").setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(nF.SOURCE,D.ofAny(nF.SCHEMA)),k.ofEntry(nF.SCHEMA,D.SCHEMA,!1,B.CONSTANT)])).setEvents(new Map([Q.outputEventMapEntry(j.of(nF.IS_VALID,D.ofBoolean(nF.IS_VALID)))]))}}class nY{constructor(){this.map=new Map([[l.SYSTEM_CTX,new Map([q(new t7),q(new rt),q(new sl)])],[l.SYSTEM_LOOP,new Map([q(new sU),q(new sS),q(new sN),q(new sP)])],[l.SYSTEM,new Map([q(new sc),q(new sg),q(new nn),q(new nD),q(new t2),q(new nF)])]]),this.filterableNames=Array.from(this.map.values()).flatMap(e=>Array.from(e.values())).map(e=>e.getSignature().getFullName())}async find(e,t){return this.map.get(e)?.get(t)}async filter(e){return Array.from(this.filterableNames).filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase()))}}class nB extends nG{constructor(){super(new nY,new sq,new np,new t9,new ns,new nC)}}var nH={};E(nH,"StatementExecution",()=>nj);var nk={};E(nk,"StatementMessage",()=>n$);class n${constructor(e,t){this.message=t,this.messageType=e}getMessageType(){return this.messageType}setMessageType(e){return this.messageType=e,this}getMessage(){return this.message}setMessage(e){return this.message=e,this}toString(){return`${this.messageType} : ${this.message}`}}class nj{constructor(e){this.messages=[],this.dependencies=new Set,this.statement=e}getStatement(){return this.statement}setStatement(e){return this.statement=e,this}getMessages(){return this.messages}setMessages(e){return this.messages=e,this}getDependencies(){return this.dependencies}setDependencies(e){return this.dependencies=e,this}getUniqueKey(){return this.statement.getStatementName()}addMessage(e,t){this.messages.push(new n$(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){return e instanceof nj&&e.statement.equals(this.statement)}}var nW={};E(nW,"ContextTokenValueExtractor",()=>nX);class nX extends tF{static{this.PREFIX="Context."}constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.context.get(r)?.getElement())}getPrefix(){return nX.PREFIX}getStore(){return h(this.context)?this.context:Array.from(this.context.entries()).reduce((e,[t,r])=>(h(r)||(e[t]=r.getElement()),e),{})}}var nJ={};E(nJ,"OutputMapTokenValueExtractor",()=>nq);class nq extends tF{static{this.PREFIX="Steps."}constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=1,s=this.output.get(t[r++]);if(!s||r>=t.length)return;let n=s.get(t[r++]);if(!n||r>t.length)return;if(r===t.length)return n;let a=t[r].indexOf("[");if(-1===a){let s=n.get(t[r++]);return this.retrieveElementFrom(e,t,r,s)}let i=t[r].substring(0,a),o=n.get(i);return this.retrieveElementFrom(e,t,r,{[i]:o})}getPrefix(){return nq.PREFIX}getStore(){return this.convertMapToObj(this.output)}convertMapToObj(e){return 0===e.size?{}:Array.from(e.entries()).reduce((e,[t,r])=>(e[t]=r instanceof Map?this.convertMapToObj(r):r,e),{})}}var nz={};E(nz,"ArgumentsTokenValueExtractor",()=>nK);class nK extends tF{static{this.PREFIX="Arguments."}constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.args.get(r))}getPrefix(){return nK.PREFIX}getStore(){return h(this.args)?this.args:Array.from(this.args.entries()).reduce((e,[t,r])=>(e[t]=r,e),{})}}var nQ={};E(nQ,"GraphVertex",()=>n1);var nZ={};E(nZ,"ExecutionGraph",()=>n0);class n0{constructor(e=!1){this.nodeMap=new Map,this.isSubGrph=e}getVerticesData(){return Array.from(this.nodeMap.values()).map(e=>e.getData())}addVertex(e){if(!this.nodeMap.has(e.getUniqueKey())){let t=new n1(this,e);this.nodeMap.set(e.getUniqueKey(),t)}return this.nodeMap.get(e.getUniqueKey())}getVertex(e){return this.nodeMap.get(e)}getVertexData(e){if(this.nodeMap.has(e))return this.nodeMap.get(e).getData()}getVerticesWithNoIncomingEdges(){return Array.from(this.nodeMap.values()).filter(e=>!e.hasIncomingEdges())}isCyclic(){let e,t=new el(this.getVerticesWithNoIncomingEdges()),r=new Set;for(;!t.isEmpty();){if(r.has(t.getFirst().getKey()))return!0;e=t.removeFirst(),r.add(e.getKey()),e.hasOutgoingEdges()&&t.addAll(Array.from(e.getOutVertices().values()).flatMap(e=>Array.from(e)))}return!1}addVertices(e){for(let t of e)this.addVertex(t)}getNodeMap(){return this.nodeMap}isSubGraph(){return this.isSubGrph}toString(){return"Execution Graph : \n"+Array.from(this.nodeMap.values()).map(e=>e.toString()).join("\n")}}class n1{constructor(e,t){this.outVertices=new Map,this.inVertices=new Set,this.data=t,this.graph=e}getData(){return this.data}setData(e){return this.data=e,this}getOutVertices(){return this.outVertices}setOutVertices(e){return this.outVertices=e,this}getInVertices(){return this.inVertices}setInVertices(e){return this.inVertices=e,this}getGraph(){return this.graph}setGraph(e){return this.graph=e,this}getKey(){return this.data.getUniqueKey()}addOutEdgeTo(e,t){return this.outVertices.has(e)||this.outVertices.set(e,new Set),this.outVertices.get(e).add(t),t.inVertices.add(new eN(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new eN(e,t)),e.outVertices.has(t)||e.outVertices.set(t,new Set),e.outVertices.get(t).add(this),e}hasIncomingEdges(){return!!this.inVertices.size}hasOutgoingEdges(){return!!this.outVertices.size}getSubGraphOfType(e){let t=new n0(!0);var r=new el(Array.from(this.outVertices.get(e)??[]));for(r.map(e=>e.getData()).forEach(e=>t.addVertex(e));!r.isEmpty();)Array.from(r.pop().outVertices.values()).flatMap(e=>Array.from(e)).forEach(e=>{t.addVertex(e.getData()),r.add(e)});return t}toString(){var e=Array.from(this.getInVertices()).map(e=>e.getT1().getKey()+"("+e.getT2()+")").join(", "),t=Array.from(this.outVertices.entries()).map(([e,t])=>e+": "+Array.from(t).map(e=>e.getKey()).join(",")).join("\n ");return this.getKey()+":\n In: "+e+"\n Out: \n "+t}}var n2={};E(n2,"KIRuntime",()=>ar);var n9={};E(n9,"JsonExpression",()=>n3);class n3{constructor(e){this.expression=e}getExpression(){return this.expression}}var n4={};E(n4,"ParameterReferenceType",()=>n5);var n5=((n={}).VALUE="VALUE",n.EXPRESSION="EXPRESSION",n),n6={};function n7(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|8).toString(16)})}E(n6,"FunctionExecutionParameters",()=>n8);class n8{constructor(e,t,r){this.count=0,this.executionContext=new Map,this.valueExtractors=new Map,this.functionRepository=e,this.schemaRepository=t,this.executionId=r??n7()}getExecutionId(){return this.executionId}getContext(){return this.context}setContext(e){this.context=e;let t=new nX(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){return this.args=e,this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getStatementExecution(){return this.statementExecution}setStatementExecution(e){return this.statementExecution=e,this}getSteps(){return this.steps}setSteps(e){this.steps=e;let t=new nq(e);return this.valueExtractors.set(t.getPrefix(),t),this}getCount(){return this.count}setCount(e){return this.count=e,this}getValuesMap(){return this.valueExtractors}getFunctionRepository(){return this.functionRepository}setFunctionRepository(e){return this.functionRepository=e,this}getSchemaRepository(){return this.schemaRepository}setSchemaRepository(e){return this.schemaRepository=e,this}addTokenValueExtractor(...e){for(let t of e)this.valueExtractors.set(t.getPrefix(),t);return this}setValuesMap(e){for(let[t,r]of e.entries())this.valueExtractors.set(t,r);return this}setExecutionContext(e){return this.executionContext=e,this}getExecutionContext(){return this.executionContext}}var ae={};E(ae,"StatementMessageType",()=>at);var at=((a={}).ERROR="ERROR",a.WARNING="WARNING",a.MESSAGE="MESSAGE",a);class ar extends e0{static{this.PARAMETER_NEEDS_A_VALUE='Parameter "$" needs a value'}static{this.STEP_REGEX_PATTERN=RegExp("Steps\\.([a-zA-Z0-9\\\\-]{1,})\\.([a-zA-Z0-9\\\\-]{1,})","g")}static{this.VERSION=1}static{this.MAX_EXECUTION_ITERATIONS=1e7}constructor(e,t=!1){if(super(),this.debugMode=!1,this.debugMode=t,this.fd=e,this.fd.getVersion()>ar.VERSION)throw new er("Runtime is at a lower version "+ar.VERSION+" and trying to run code from version "+this.fd.getVersion()+".")}getSignature(){return this.fd}async getExecutionPlan(e,t){let r=new n0;for(let s of Array.from(this.fd.getSteps().values()))r.addVertex(await this.prepareStatementExecution(s,e,t));return Array.from(this.makeEdges(r).getT2().entries()).forEach(e=>{let t=r.getNodeMap().get(e[0])?.getData();t&&t.addMessage(at.ERROR,e[1])}),r}async internalExecute(e){e.getContext()||e.setContext(new Map),e.getEvents()||e.setEvents(new Map),e.getSteps()||e.setSteps(new Map),e.getArguments()&&e.addTokenValueExtractor(new nK(e.getArguments())),this.debugMode&&(console.log(`EID: ${e.getExecutionId()} Executing: ${this.fd.getNamespace()}.${this.fd.getName()}`),console.log(`EID: ${e.getExecutionId()} Parameters: `,e));let t=await this.getExecutionPlan(e.getFunctionRepository(),e.getSchemaRepository());this.debugMode&&console.log(`EID: ${e.getExecutionId()} ${t?.toString()}`);let r=t.getVerticesData().filter(e=>e.getMessages().length).map(e=>e.getStatement().getStatementName()+": \n"+e.getMessages().join(","));if(r?.length)throw new er("Please fix the errors in the function definition before execution : \n"+r.join(",\n"));return await this.executeGraph(t,e)}async executeGraph(e,t){let r=new el;r.addAll(e.getVerticesWithNoIncomingEdges());let s=new el;for(;(!r.isEmpty()||!s.isEmpty())&&!t.getEvents()?.has(Q.OUTPUT);)if(await this.processBranchQue(t,r,s),await this.processExecutionQue(t,r,s),t.setCount(t.getCount()+1),t.getCount()==ar.MAX_EXECUTION_ITERATIONS)throw new er("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size){let e=this.getSignature().getEvents();if(e.size&&e.get(Q.OUTPUT)?.getParameters()?.size)throw new er("No events raised")}let n=Array.from(t.getEvents()?.entries()??[]).flatMap(e=>e[1].map(t=>Z.of(e[0],t)));return new es(n.length||e.isSubGraph()?n:[Z.of(Q.OUTPUT,new Map)])}async processExecutionQue(e,t,r){if(!t.isEmpty()){let s=t.pop();await this.allDependenciesResolvedVertex(s,e.getSteps())?await this.executeVertex(s,e,r,t,e.getFunctionRepository()):t.add(s)}}async processBranchQue(e,t,r){if(r.length){let s=r.pop();await this.allDependenciesResolvedTuples(s.getT2(),e.getSteps())?await this.executeBranch(e,t,s):r.add(s)}}async executeBranch(e,t,r){let s,n=r.getT4();do if(r.getT1().getVerticesData().map(e=>e.getStatement().getStatementName()).forEach(t=>e.getSteps()?.delete(t)),await this.executeGraph(r.getT1(),e),(s=r.getT3().next())&&(e.getSteps()?.has(n.getData().getStatement().getStatementName())||e.getSteps()?.set(n.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(n.getData().getStatement().getStatementName())?.set(s.getName(),this.resolveInternalExpressions(s.getResult(),e)),this.debugMode)){let t=n.getData().getStatement();console.log(`EID: ${e.getExecutionId()} Step : ${t.getStatementName()} => ${t.getNamespace()}.${t.getName()}`),console.log(`EID: ${e.getExecutionId()} Event : ${s.getName()} : `,e.getSteps().get(t.getStatementName()).get(s.getName()))}while(s&&s.getName()!=Q.OUTPUT)s?.getName()==Q.OUTPUT&&n.getOutVertices().has(Q.OUTPUT)&&(n?.getOutVertices()?.get(Q.OUTPUT)??[]).forEach(async r=>{await this.allDependenciesResolvedVertex(r,e.getSteps())&&t.add(r)})}async executeVertex(e,t,r,s,n){let a,i=e.getData().getStatement();if(i.getExecuteIftrue().size&&!(Array.from(i.getExecuteIftrue().entries())??[]).filter(e=>e[1]).map(([e])=>new su(e).evaluate(t.getValuesMap())).every(e=>!h(e)&&!1!==e))return;let o=await n.find(i.getNamespace(),i.getName());if(!o)throw new er(eT.format("$.$ function is not found.",i.getNamespace(),i.getName()));let E=o?.getSignature().getParameters(),u=this.getArgumentsFromParametersMap(t,i,E??new Map);this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Arguments : `,u));let A=t.getContext();a=o instanceof ar?new n8(t.getFunctionRepository(),t.getSchemaRepository(),`${t.getExecutionId()}_${i.getStatementName()}`).setArguments(u).setValuesMap(new Map(Array.from(t.getValuesMap().values()).filter(e=>e.getPrefix()!==nK.PREFIX&&e.getPrefix()!==nq.PREFIX&&e.getPrefix()!==nX.PREFIX).map(e=>[e.getPrefix(),e]))):new n8(t.getFunctionRepository(),t.getSchemaRepository(),t.getExecutionId()).setValuesMap(t.getValuesMap()).setContext(A).setArguments(u).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount()).setExecutionContext(t.getExecutionContext());let T=await o.execute(a),l=T.next();if(!l)throw new er(eT.format("Executing $ returned no events",i.getStatementName()));let m=l.getName()==Q.OUTPUT;if(t.getSteps()?.has(i.getStatementName())||t.getSteps().set(i.getStatementName(),new Map),t.getSteps().get(i.getStatementName()).set(l.getName(),this.resolveInternalExpressions(l.getResult(),t)),this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Event : ${l.getName()} : `,t.getSteps().get(i.getStatementName()).get(l.getName()))),m){let r=e.getOutVertices().get(Q.OUTPUT);r&&r.forEach(async e=>{await this.allDependenciesResolvedVertex(e,t.getSteps())&&s.add(e)})}else{let t=e.getSubGraphOfType(l.getName()),s=this.makeEdges(t).getT1();r.push(new e_(t,s,T,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map(e=>new eN(e[0],this.resolveInternalExpression(e[1],t))).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map):e}resolveInternalExpression(e,t){if(h(e)||"object"!=typeof e)return e;if(e instanceof n3)return new su(e.getExpression()).evaluate(t.getValuesMap());if(Array.isArray(e)){let r=[];for(let s of e)r.push(this.resolveInternalExpression(s,t));return r}if("object"==typeof e){let r={};for(let s of Object.entries(e))r[s[0]]=this.resolveInternalExpression(s[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e)if(!t.has(r.getT1())||!t.get(r.getT1())?.get(r.getT2()))return!1;return!0}allDependenciesResolvedVertex(e,t){return!e.getInVertices().size||0==Array.from(e.getInVertices()).filter(e=>{let r=e.getT1().getData().getStatement().getStatementName(),s=e.getT2();return!(t.has(r)&&t.get(r)?.has(s))}).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map(t=>{let s,n=Array.from(t[1]?.values()??[]);if(!n?.length)return new eN(t[0],s);let a=r.get(t[0]);return a?(s=a.isVariableArgument()?n.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)).filter(e=>!h(e)).map(t=>this.parameterReferenceEvaluation(e,t)).flatMap(e=>Array.isArray(e)?e:[e]):this.parameterReferenceEvaluation(e,n[0]),new eN(t[0],s)):new eN(t[0],void 0)}).filter(e=>!h(e.getT2())).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map)}parameterReferenceEvaluation(e,t){let r;return t.getType()==n5.VALUE?r=this.resolveInternalExpression(t.getValue(),e):t.getType()!=n5.EXPRESSION||eg.isNullOrBlank(t.getExpression())||(r=new su(t.getExpression()??"").evaluate(e.getValuesMap())),r}async prepareStatementExecution(e,t,r){let s=new nj(e),n=await t.find(e.getNamespace(),e.getName());if(!n)return s.addMessage(at.ERROR,eT.format("$.$ is not available",e.getNamespace(),e.getName())),Promise.resolve(s);let a=new Map(n.getSignature().getParameters());if(!e.getParameterMap())return Promise.resolve(s);for(let t of Array.from(e.getParameterMap().entries())){let e=a.get(t[0]);if(!e)continue;let n=Array.from(t[1]?.values()??[]);if(!n.length&&!e.isVariableArgument()){await eO.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||s.addMessage(at.ERROR,eT.format(ar.PARAMETER_NEEDS_A_VALUE,e.getParameterName())),a.delete(e.getParameterName());continue}if(e.isVariableArgument())for(let t of(n.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)),n))this.parameterReferenceValidation(s,e,t,r);else if(n.length){let t=n[0];this.parameterReferenceValidation(s,e,t,r)}a.delete(e.getParameterName())}if(!h(s.getStatement().getDependentStatements()))for(let e of Array.from(s.getStatement().getDependentStatements().entries()))e[1]&&s.addDependency(e[0]);if(!h(s.getStatement().getExecuteIftrue()))for(let e of Array.from(s.getStatement().getExecuteIftrue().entries()))e[1]&&this.addDependencies(s,e[0]);if(a.size)for(let e of Array.from(a.values()))e.isVariableArgument()||await eO.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||s.addMessage(at.ERROR,eT.format(ar.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return Promise.resolve(s)}async parameterReferenceValidation(e,t,r,s){if(r){if(r.getType()==n5.VALUE){if(h(r.getValue())&&!await eO.hasDefaultValueOrNullSchemaType(t.getSchema(),s)&&e.addMessage(at.ERROR,eT.format(ar.PARAMETER_NEEDS_A_VALUE,t.getParameterName())),h(r.getValue()))return;let n=new el;for(n.push(new eN(t.getSchema(),r.getValue()));!n.isEmpty();){let t=n.pop();if(t.getT2()instanceof n3)this.addDependencies(e,t.getT2().getExpression());else{if(h(t.getT1())||h(t.getT1().getType()))continue;if(t.getT1().getType()?.contains(p.ARRAY)&&Array.isArray(t.getT2())){let e=t.getT1().getItems();if(!e)continue;if(e.isSingleType())for(let r of t.getT2())n.push(new eN(e.getSingleSchema(),r));else{let r=t.getT2();for(let t=0;t<r.length;t++)n.push(new eN(e.getTupleSchema()[t],r[t]))}}else if(t.getT1().getType()?.contains(p.OBJECT)&&"object"==typeof t.getT2()){let r=t.getT1();if(r.getName()===k.EXPRESSION.getName()&&r.getNamespace()===k.EXPRESSION.getNamespace()){let r=t.getT2();r.isExpression&&this.addDependencies(e,r.value)}else if(r.getProperties())for(let e of Object.entries(t.getT2()))r.getProperties().has(e[0])&&n.push(new eN(r.getProperties().get(e[0]),e[1]))}}}}else if(r.getType()==n5.EXPRESSION){if(eg.isNullOrBlank(r.getExpression()))h(eO.getDefaultValue(t.getSchema(),s))&&e.addMessage(at.ERROR,eT.format(ar.PARAMETER_NEEDS_A_VALUE,t.getParameterName()));else try{this.addDependencies(e,r.getExpression())}catch(t){e.addMessage(at.ERROR,eT.format("Error evaluating $ : $",r.getExpression(),t))}}}else h(await eO.getDefaultValue(t.getSchema(),s))&&e.addMessage(at.ERROR,eT.format(ar.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(ar.STEP_REGEX_PATTERN)??[]).forEach(t=>e.addDependency(t))}makeEdges(e){let t=e.getNodeMap().values(),r=[],s=new Map;for(let n of Array.from(t))for(let t of Array.from(n.getData().getDependencies())){let a=t.indexOf(".",6),i=t.substring(6,a),o=t.indexOf(".",a+1),E=-1==o?t.substring(a+1):t.substring(a+1,o);e.getNodeMap().has(i)?n.addInEdgeTo(e.getNodeMap().get(i),E):(r.push(new eN(i,E)),s.set(n.getData().getStatement().getStatementName(),eT.format("Unable to find the step with name $",i)))}return new eN(r,s)}}var as={};E(as,"KIRunConstants",()=>an);class an{static{this.NAMESPACE="namespace"}static{this.NAME="name"}static{this.ID="id"}constructor(){}}var aa={};E(aa,"Position",()=>ai);class ai{static{this.SCHEMA_NAME="Position"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(ai.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["left",D.ofFloat("left")],["top",D.ofFloat("top")]]))}constructor(e,t){this.left=e,this.top=t}getLeft(){return this.left}setLeft(e){return this.left=e,this}getTop(){return this.top}setTop(e){return this.top=e,this}static from(e){if(e)return new ai(e.left,e.top)}}var ao={};E(ao,"FunctionDefinition",()=>ac);var aE={};E(aE,"Statement",()=>am);var au={};E(au,"AbstractStatement",()=>aA);class aA{constructor(e){if(this.override=!1,!e)return;this.comment=e.comment,this.description=e.description,this.position=e.position?new ai(e.position.getLeft(),e.position.getTop()):void 0,this.override=e.override}getComment(){return this.comment}setComment(e){return this.comment=e,this}isOverride(){return this.override}setOverride(e){return this.override=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getPosition(){return this.position}setPosition(e){return this.position=e,this}}var aT={};E(aT,"ParameterReference",()=>al);class al{static{this.SCHEMA_NAME="ParameterReference"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(al.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["key",D.ofString("key")],["value",D.ofAny("value")],["expression",D.ofString("expression")],["type",D.ofString("type").setEnums(["EXPRESSION","VALUE"])],["order",D.ofInteger("order")]]))}constructor(e){e instanceof al?(this.key=e.key,this.type=e.type,this.value=h(e.value)?void 0:JSON.parse(JSON.stringify(e.value)),this.expression=e.expression,this.order=e.order):(this.type=e,this.key=n7())}getType(){return this.type}setType(e){return this.type=e,this}getKey(){return this.key}setKey(e){return this.key=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}getExpression(){return this.expression}setExpression(e){return this.expression=e,this}setOrder(e){return this.order=e,this}getOrder(){return this.order}static ofExpression(e){let t=new al(n5.EXPRESSION).setExpression(e);return[t.getKey(),t]}static ofValue(e){let t=new al(n5.VALUE).setValue(e);return[t.getKey(),t]}static from(e){return new al(e.type).setValue(e.value).setExpression(e.expression).setKey(e.key).setOrder(e.order)}}class am extends aA{static{this.SCHEMA_NAME="Statement"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(am.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["statementName",D.ofString("statementName")],["comment",D.ofString("comment")],["description",D.ofString("description")],["namespace",D.ofString("namespace")],["name",D.ofString("name")],["dependentStatements",D.ofObject("dependentstatement").setAdditionalProperties(new C().setSchemaValue(D.ofBoolean("exists"))).setDefaultValue({})],["executeIftrue",D.ofObject("executeIftrue").setAdditionalProperties(new C().setSchemaValue(D.ofBoolean("exists"))).setDefaultValue({})],["parameterMap",new D().setName("parameterMap").setAdditionalProperties(new C().setSchemaValue(D.ofObject("parameterReference").setAdditionalProperties(new C().setSchemaValue(al.SCHEMA))))],["position",ai.SCHEMA]]))}constructor(e,t,r){if(super(e instanceof am?e:void 0),e instanceof am)this.statementName=e.statementName,this.name=e.name,this.namespace=e.namespace,e.parameterMap&&(this.parameterMap=new Map(Array.from(e.parameterMap.entries()).map(e=>[e[0],new Map(Array.from(e[1].entries()).map(e=>[e[0],new al(e[1])]))]))),e.dependentStatements&&(this.dependentStatements=new Map(Array.from(e.dependentStatements.entries())));else{if(this.statementName=e,!r||!t)throw Error("Unknown constructor");this.namespace=t,this.name=r}}getStatementName(){return this.statementName}setStatementName(e){return this.statementName=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getParameterMap(){return this.parameterMap||(this.parameterMap=new Map),this.parameterMap}setParameterMap(e){return this.parameterMap=e,this}getDependentStatements(){return this.dependentStatements??new Map}setDependentStatements(e){return this.dependentStatements=e,this}getExecuteIftrue(){return this.executeIftrue??new Map}setExecuteIftrue(e){return this.executeIftrue=e,this}equals(e){return e instanceof am&&e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}static from(e){return new am(e.statementName,e.namespace,e.name).setParameterMap(new Map(Object.entries(e.parameterMap??{}).map(([e,t])=>[e,new Map(Object.entries(t??{}).map(([e,t])=>al.from(t)).map(e=>[e.getKey(),e]))]))).setDependentStatements(new Map(Object.entries(e.dependentStatements??{}))).setExecuteIftrue(new Map(Object.entries(e.executeIftrue??{}))).setPosition(ai.from(e.position)).setComment(e.comment).setDescription(e.description)}}var aR={};E(aR,"StatementGroup",()=>ah);class ah extends aA{static{this.SCHEMA_NAME="StatementGroup"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(ah.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["statementGroupName",D.ofString("statementGroupName")],["comment",D.ofString("comment")],["description",D.ofString("description")],["position",ai.SCHEMA]]))}constructor(e,t=new Map){super(),this.statementGroupName=e,this.statements=t}getStatementGroupName(){return this.statementGroupName}setStatementGroupName(e){return this.statementGroupName=e,this}getStatements(){return this.statements}setStatements(e){return this.statements=e,this}static from(e){return new ah(e.statementGroupName,new Map(Object.entries(e.statements||{}).map(([e,t])=>[e,(""+t)?.toLowerCase()=="true"]))).setPosition(ai.from(e.position)).setComment(e.comment).setDescription(e.description)}}const ag=new D().setNamespace(l.SYSTEM).setName("FunctionDefinition").setProperties(new Map([["name",D.ofString("name")],["namespace",D.ofString("namespace")],["parameters",D.ofArray("parameters",k.SCHEMA)],["events",D.ofObject("events").setAdditionalProperties(new C().setSchemaValue(Q.SCHEMA))],["steps",D.ofObject("steps").setAdditionalProperties(new C().setSchemaValue(am.SCHEMA))]]));ag.getProperties()?.set("parts",D.ofArray("parts",ag));class ac extends ea{static{this.SCHEMA=ag}constructor(e){super(e),this.version=1}getVersion(){return this.version}setVersion(e){return this.version=e,this}getSteps(){return this.steps??new Map}setSteps(e){return this.steps=e,this}getStepGroups(){return this.stepGroups}setStepGroups(e){return this.stepGroups=e,this}getParts(){return this.parts}setParts(e){return this.parts=e,this}static from(e){return e?new ac(e.name).setSteps(new Map(Object.values(e.steps??{}).filter(e=>!!e).map(e=>[e.statementName,am.from(e)]))).setStepGroups(new Map(Object.values(e.stepGroups??{}).filter(e=>!!e).map(e=>[e.statementGroupName,ah.from(e)]))).setParts(Array.from(e.parts??[]).filter(e=>!!e).map(e=>ac.from(e))).setVersion(e.version??1).setEvents(new Map(Object.values(e.events??{}).filter(e=>!!e).map(e=>[e.name,Q.from(e)]))).setParameters(new Map(Object.values(e.parameters??{}).filter(e=>!!e).map(e=>[e.parameterName,k.from(e)]))).setNamespace(e.namespace):new ac("unknown")}}var ap={};E(ap,"Argument",()=>aN);class aN{constructor(e,t,r){this.argumentIndex=0,this.argumentIndex=e,this.name=t,this.value=r}getArgumentIndex(){return this.argumentIndex}setArgumentIndex(e){return this.argumentIndex=e,this}getName(){return this.name}setName(e){return this.name=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}static of(e,t){return new aN(0,e,t)}}o(module.exports,u),o(module.exports,J),o(module.exports,{}),o(module.exports,e5),o(module.exports,$),o(module.exports,R),o(module.exports,eu),o(module.exports,tI),o(module.exports,eA),o(module.exports,eh),o(module.exports,ep),o(module.exports,tt),o(module.exports,eE),o(module.exports,tn),o(module.exports,nH),o(module.exports,nk),o(module.exports,t3),o(module.exports,nW),o(module.exports,nJ),o(module.exports,nz),o(module.exports,nQ),o(module.exports,{}),o(module.exports,nZ),o(module.exports,n2),o(module.exports,ae),o(module.exports,n6),o(module.exports,td),o(module.exports,tG),o(module.exports,st),o(module.exports,tw),o(module.exports,rr),o(module.exports,tC),o(module.exports,tL),o(module.exports,ty),o(module.exports,tU),o(module.exports,{}),o(module.exports,ei),o(module.exports,T),o(module.exports,n9),o(module.exports,A),o(module.exports,eV),o(module.exports,ex),o(module.exports,ev),o(module.exports,eP),o(module.exports,ew),o(module.exports,eG),o(module.exports,eD),o(module.exports,eo),o(module.exports,eM),o(module.exports,G),o(module.exports,eI),o(module.exports,m),o(module.exports,O),o(module.exports,N),o(module.exports,f),o(module.exports,_),o(module.exports,c),o(module.exports,ec),o(module.exports,eF),o(module.exports,nb),o(module.exports,as),o(module.exports,b),o(module.exports,ee),o(module.exports,aa),o(module.exports,ao),o(module.exports,n4),o(module.exports,z),o(module.exports,au),o(module.exports,aE),o(module.exports,{}),o(module.exports,aR),o(module.exports,en),o(module.exports,K),o(module.exports,Y),o(module.exports,ap),o(module.exports,aT),o(module.exports,e6),o(module.exports,et),o(module.exports,r0),o(module.exports,rs),o(module.exports,sn);
2
2
  //# sourceMappingURL=index.js.map