@fincity/kirun-js 2.8.2 → 2.8.3

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,n,s,a,i,o,E,u,A,T,l=require("luxon");function R(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 m(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var g={};m(g,"KIRunSchemaRepository",()=>Z);var h={};m(h,"AdditionalType",()=>B),m(h,"Schema",()=>Y);var c={};m(c,"Namespaces",()=>p);class p{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 N={};m(N,"ArraySchemaType",()=>M);var f={};function _(e){return null==e}m(f,"isNullValue",()=>_);class M{constructor(e){if(!e)return;this.singleSchema=e.singleSchema?new Y(e.singleSchema):void 0,this.tupleSchema=e.tupleSchema?e.tupleSchema.map(e=>new Y(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!_(this.singleSchema)}static of(...e){return 1==e.length?new M().setSingleSchema(e[0]):new M().setTupleSchema(e)}static from(e){if(!e)return;if(Array.isArray(e))return new M().setTupleSchema(Y.fromListOfSchemas(e));let t=Object.keys(e);if(-1!=t.indexOf("singleSchema"))return new M().setSingleSchema(Y.from(e.singleSchema));if(-1!=t.indexOf("tupleSchema"))return new M().setTupleSchema(Y.fromListOfSchemas(e.tupleSchema));let r=Y.from(e);if(r)return new M().setSingleSchema(r)}}var S={};m(S,"SchemaType",()=>i),(e=i||(i={})).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";var O={};m(O,"TypeUtil",()=>L);var w={};m(w,"MultipleType",()=>d);var I={};m(I,"Type",()=>P);class P{}class d extends P{constructor(e){super(),e instanceof d?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 y={};m(y,"SingleType",()=>x);class x extends P{constructor(e){super(),e instanceof x?this.type=e.type:this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class L{static of(...e){return 1==e.length?new x(e[0]):new d(new Set(e))}static from(e){return"string"==typeof e?new x(i[L.fromJSONType(e)]):Array.isArray(e)?new d(new Set(e.map(L.fromJSONType).map(e=>e).map(e=>i[e]))):void 0}static fromJSONType(e){let t=e.toUpperCase();return"NUMBER"===t?"DOUBLE":t}}const v="additionalProperty",U="additionalItems",V="enums",C="items",D="System.Schema",G="required",b="version",F="namespace";class B{constructor(e){if(!e||(this.booleanValue=e.booleanValue,!e.schemaValue))return;this.schemaValue=new Y(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(_(e))return;let t=new B;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=Y.from(e.schemaValue):t.schemaValue=Y.from(e)}return t}}class Y{static{this.NULL=new Y().setNamespace(p.SYSTEM).setName("Null").setType(L.of(i.NULL)).setConstant(void 0)}static{this.TYPE_SCHEMA=new Y().setType(L.of(i.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"])}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName("Schema").setType(L.of(i.OBJECT)).setProperties(new Map([[F,Y.of(F,i.STRING).setDefaultValue("_")],["name",Y.ofString("name")],[b,Y.of(b,i.INTEGER).setDefaultValue(1)],["ref",Y.ofString("ref")],["type",new Y().setAnyOf([Y.TYPE_SCHEMA,Y.ofArray("type",Y.TYPE_SCHEMA)])],["anyOf",Y.ofArray("anyOf",Y.ofRef(D))],["allOf",Y.ofArray("allOf",Y.ofRef(D))],["oneOf",Y.ofArray("oneOf",Y.ofRef(D))],["not",Y.ofRef(D)],["title",Y.ofString("title")],["description",Y.ofString("description")],["id",Y.ofString("id")],["examples",Y.ofAny("examples")],["defaultValue",Y.ofAny("defaultValue")],["comment",Y.ofString("comment")],[V,Y.ofArray(V,Y.ofString(V))],["constant",Y.ofAny("constant")],["pattern",Y.ofString("pattern")],["format",Y.of("format",i.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",Y.ofInteger("minLength")],["maxLength",Y.ofInteger("maxLength")],["multipleOf",Y.ofLong("multipleOf")],["minimum",Y.ofNumber("minimum")],["maximum",Y.ofNumber("maximum")],["exclusiveMinimum",Y.ofNumber("exclusiveMinimum")],["exclusiveMaximum",Y.ofNumber("exclusiveMaximum")],["properties",Y.of("properties",i.OBJECT).setAdditionalProperties(new B().setSchemaValue(Y.ofRef(D)))],["additionalProperties",new Y().setName(v).setNamespace(p.SYSTEM).setAnyOf([Y.ofBoolean(v),Y.ofObject(v).setRef(D)]).setDefaultValue(!0)],[G,Y.ofArray(G,Y.ofString(G)).setDefaultValue([])],["propertyNames",Y.ofRef(D)],["minProperties",Y.ofInteger("minProperties")],["maxProperties",Y.ofInteger("maxProperties")],["patternProperties",Y.of("patternProperties",i.OBJECT).setAdditionalProperties(new B().setSchemaValue(Y.ofRef(D)))],[C,new Y().setName(C).setAnyOf([Y.ofRef(D).setName("item"),Y.ofArray("tuple",Y.ofRef(D))])],["contains",Y.ofRef(D)],["minContains",Y.ofInteger("minContains")],["maxContains",Y.ofInteger("maxContains")],["minItems",Y.ofInteger("minItems")],["maxItems",Y.ofInteger("maxItems")],["uniqueItems",Y.ofBoolean("uniqueItems")],["additionalItems",new Y().setName(U).setNamespace(p.SYSTEM).setAnyOf([Y.ofBoolean(U),Y.ofObject(U).setRef(D)])],["$defs",Y.of("$defs",i.OBJECT).setAdditionalProperties(new B().setSchemaValue(Y.ofRef(D)))],["permission",Y.ofString("permission")]])).setRequired([])}static ofString(e){return new Y().setType(L.of(i.STRING)).setName(e)}static ofInteger(e){return new Y().setType(L.of(i.INTEGER)).setName(e)}static ofFloat(e){return new Y().setType(L.of(i.FLOAT)).setName(e)}static ofLong(e){return new Y().setType(L.of(i.LONG)).setName(e)}static ofDouble(e){return new Y().setType(L.of(i.DOUBLE)).setName(e)}static ofAny(e){return new Y().setType(L.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE,i.STRING,i.BOOLEAN,i.ARRAY,i.NULL,i.OBJECT)).setName(e)}static ofAnyNotNull(e){return new Y().setType(L.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE,i.STRING,i.BOOLEAN,i.ARRAY,i.OBJECT)).setName(e)}static ofNumber(e){return new Y().setType(L.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)).setName(e)}static ofBoolean(e){return new Y().setType(L.of(i.BOOLEAN)).setName(e)}static of(e,...t){return new Y().setType(L.of(...t)).setName(e)}static ofObject(e){return new Y().setType(L.of(i.OBJECT)).setName(e)}static ofRef(e){return new Y().setRef(e)}static ofArray(e,...t){return new Y().setType(L.of(i.ARRAY)).setName(e).setItems(M.of(...t))}static fromListOfSchemas(e){if(_(e)&&!Array.isArray(e))return;let t=[];for(let r of Array.from(e)){let e=Y.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(_(e))return;let t=new Map;return Object.entries(e).forEach(([e,r])=>{let n=Y.from(r);n&&t.set(e,n)}),t}static from(e,t=!1){if(_(e))return;let r=new Y;return r.namespace=e.namespace??"_",r.name=e.name,r.version=e.version??1,r.ref=e.ref,t?r.type=new x(i.STRING):r.type=L.from(e.type),r.anyOf=Y.fromListOfSchemas(e.anyOf),r.allOf=Y.fromListOfSchemas(e.allOf),r.oneOf=Y.fromListOfSchemas(e.oneOf),r.not=Y.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=Y.fromMapOfSchemas(e.properties),r.additionalProperties=B.from(e.additionalProperties),r.required=e.required,r.propertyNames=Y.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=Y.fromMapOfSchemas(e.patternProperties),r.items=M.from(e.items),r.additionalItems=B.from(e.additionalItems),r.contains=Y.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=Y.fromMapOfSchemas(e.$defs),r.permission=e.permission,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,_(e.type)||(this.type=e.type instanceof x?new x(e.type):new d(e.type)),this.anyOf=e.anyOf?.map(e=>new Y(e)),this.allOf=e.allOf?.map(e=>new Y(e)),this.oneOf=e.oneOf?.map(e=>new Y(e)),this.not=this.not?new Y(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 Y(e[1])])):void 0,this.additionalProperties=e.additionalProperties?new B(e.additionalProperties):void 0,this.required=e.required?[...e.required]:void 0,this.propertyNames=e.propertyNames?new Y(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 Y(e[1])])):void 0,this.items=e.items?new M(e.items):void 0,this.contains=e.contains?new Y(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 B(e.additionalItems):void 0,this.$defs=e.$defs?new Map(Array.from(e.$defs.entries()).map(e=>[e[0],new Y(e[1])])):void 0,this.permission=e.permission}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 x(i.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}}var H={};m(H,"Parameter",()=>X);var k={};m(k,"SchemaReferenceException",()=>$);class $ 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 j={};m(j,"ParameterType",()=>o),(t=o||(o={})).CONSTANT="CONSTANT",t.EXPRESSION="EXPRESSION";const W="value";class X{static{this.SCHEMA_NAME="Parameter"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(X.SCHEMA_NAME).setProperties(new Map([["schema",Y.SCHEMA],["parameterName",Y.ofString("parameterName")],["variableArgument",Y.of("variableArgument",i.BOOLEAN).setDefaultValue(!1)],["type",Y.ofString("type").setEnums(["EXPRESSION","CONSTANT"])]]))}static{this.EXPRESSION=new Y().setNamespace(p.SYSTEM).setName("ParameterExpression").setType(L.of(i.OBJECT)).setProperties(new Map([["isExpression",Y.ofBoolean("isExpression").setDefaultValue(!0)],[W,Y.ofAny(W)]]))}constructor(e,t){if(this.variableArgument=!1,this.type=o.EXPRESSION,e instanceof X)this.schema=new Y(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,n=o.EXPRESSION){return[e,new X(e,t).setType(n).setVariableArgument(r)]}static of(e,t,r=!1,n=o.EXPRESSION){return new X(e,t).setType(n).setVariableArgument(r)}static from(e){let t=Y.from(e.schema);if(!t)throw new $("","Parameter requires Schema");return new X(e.parameterName,t).setVariableArgument(!!e.variableArgument).setType(e.type??o.EXPRESSION)}}var J={};m(J,"MapUtil",()=>q),m(J,"MapEntry",()=>z);class q{static of(e,t,r,n,s,a,i,o,E,u,A,T,l,R,m,g,h,c,p,N){let f=new Map;return _(e)||_(t)||f.set(e,t),_(r)||_(n)||f.set(r,n),_(s)||_(a)||f.set(s,a),_(i)||_(o)||f.set(i,o),_(E)||_(u)||f.set(E,u),_(A)||_(T)||f.set(A,T),_(l)||_(R)||f.set(l,R),_(m)||_(g)||f.set(m,g),_(h)||_(c)||f.set(h,c),_(p)||_(N)||f.set(p,N),f}static ofArrayEntries(...e){let t=new Map;for(let[r,n]of e)t.set(r,n);return t}static entry(e,t){return new z(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 z{constructor(e,t){this.k=e,this.v=t}}const K=new Map([["any",Y.ofAny("any").setNamespace(p.SYSTEM)],["boolean",Y.ofBoolean("boolean").setNamespace(p.SYSTEM)],["double",Y.ofDouble("double").setNamespace(p.SYSTEM)],["float",Y.ofFloat("float").setNamespace(p.SYSTEM)],["integer",Y.ofInteger("integer").setNamespace(p.SYSTEM)],["long",Y.ofLong("long").setNamespace(p.SYSTEM)],["number",Y.ofNumber("number").setNamespace(p.SYSTEM)],["string",Y.ofString("string").setNamespace(p.SYSTEM)],["Timestamp",Y.ofString("Timestamp").setNamespace(p.DATE)],["Timeunit",Y.ofString("Timeunit").setNamespace(p.DATE).setEnums(["YEARS","QUARTERS","MONTHS","WEEKS","DAYS","HOURS","MINUTES","SECONDS","MILLISECONDS"])],["Duration",Y.ofObject("Duration").setNamespace(p.DATE).setProperties(q.ofArrayEntries(["years",Y.ofInteger("years")],["quarters",Y.ofInteger("quarters")],["months",Y.ofInteger("months")],["weeks",Y.ofInteger("weeks")],["days",Y.ofInteger("days")],["hours",Y.ofInteger("hours")],["minutes",Y.ofInteger("minutes")],["seconds",Y.ofLong("seconds")],["milliseconds",Y.ofLong("milliseconds")])).setAdditionalItems(B.from(!1))],["TimeObject",Y.ofObject("TimeObject").setNamespace(p.DATE).setProperties(q.ofArrayEntries(["year",Y.ofInteger("year")],["month",Y.ofInteger("month")],["day",Y.ofInteger("day")],["hour",Y.ofInteger("hour")],["minute",Y.ofInteger("minute")],["second",Y.ofLong("second")],["millisecond",Y.ofLong("millisecond")])).setAdditionalItems(B.from(!1))],[X.EXPRESSION.getName(),X.EXPRESSION],[Y.NULL.getName(),Y.NULL],[Y.SCHEMA.getName(),Y.SCHEMA]]),Q=Array.from(K.values()).map(e=>e.getFullName());class Z{async find(e,t){return p.SYSTEM!=e&&p.DATE!=e?Promise.resolve(void 0):Promise.resolve(K.get(t))}async filter(e){return Promise.resolve(Q.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var ee={};function et(e){return[e.getSignature().getName(),e]}m(ee,"KIRunFunctionRepository",()=>sH);var er={};m(er,"EventResult",()=>ea);var en={};m(en,"Event",()=>es);class es{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 Y().setNamespace(p.SYSTEM).setName(es.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["name",Y.ofString("name")],["parameters",Y.ofObject("parameter").setAdditionalProperties(new B().setSchemaValue(Y.SCHEMA))]]))}constructor(e,t){if(e instanceof es)this.name=e.name,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new Y(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 es.eventMapEntry(es.OUTPUT,e)}static eventMapEntry(e,t){return[e,new es(e,t)]}static from(e){return new es(e.name,new Map(Object.entries(e.parameters??{}).map(e=>{let t=Y.from(e[1]);if(!t)throw new $("","Event expects a schema");return[e[0],t]})))}}class ea{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 ea.of(es.OUTPUT,e)}static of(e,t){return new ea(e,t)}}var ei={};m(ei,"FunctionOutput",()=>eu);var eo={};m(eo,"KIRuntimeException",()=>eE);class eE extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class eu{constructor(e){if(this.index=0,_(e))throw new eE("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof ea?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 eA={};m(eA,"FunctionSignature",()=>eT);class eT{static{this.SCHEMA_NAME="FunctionSignature"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(eT.SCHEMA_NAME).setProperties(new Map([["name",Y.ofString("name")],["namespace",Y.ofString("namespace")],["parameters",Y.ofObject("parameters").setAdditionalProperties(new B().setSchemaValue(X.SCHEMA))],["events",Y.ofObject("events").setAdditionalProperties(new B().setSchemaValue(es.SCHEMA))]]))}constructor(e){this.namespace="_",this.parameters=new Map,this.events=new Map,e instanceof eT?(this.name=e.name,this.namespace=e.namespace,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new X(e[1])])),this.events=new Map(Array.from(e.events.entries()).map(e=>[e[0],new es(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 el={};m(el,"AbstractFunction",()=>e3);var eR={};m(eR,"SchemaValidator",()=>e9);var em={};m(em,"deepEqual",()=>ef);var eg={};m(eg,"LinkedList",()=>ep);var eh={};m(eh,"StringFormatter",()=>ec);class ec{static format(e,...t){if(!t||0==t.length)return e;let r="",n=0,s="",a=s,i=e.length;for(let o=0;o<i;o++)"$"==(s=e.charAt(o))&&"\\"==a?r=r.substring(0,o-1)+s:"$"==s&&n<t.length?r+=t[n++]:r+=s,a=s;return r.toString()}constructor(){}}class ep{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 eN(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new eN(t);this.length=e.length}}push(e){let t=new eN(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 eE(ec.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 eN(e,this.head),this.head.next=this.tail):(this.tail=new eN(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new eN(e),this}map(e,t){let r=new ep,n=this.head,s=0;for(;n;)r.add(e(n.value,s)),n=n.next,++s;return r}indexOf(e){let t=this.head,r=0;for(;t;){if(ef(t.value,e))return r;t=t.next,++r}return -1}forEach(e,t){let r=this.head,n=0;for(;r;)e(r.value,n),r=r.next,++n}}class eN{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}function ef(e,t){let r=new ep;r.push(e);let n=new ep;for(n.push(t);!r.isEmpty()&&!n.isEmpty();){let e=r.pop(),t=n.pop();if(e===t)continue;let s=typeof e,a=typeof t;if("undefined"===s||"undefined"===a){if(!e&&!t)continue;return!1}if(s!==a)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!=t.length)return!1;for(let s=0;s<e.length;s++)r.push(e[s]),n.push(t[s]);continue}if("object"===s){if("object"!==a||null===e||null===t)return!1;let s=Object.entries(e),i=Object.entries(t);if(s.length!==i.length)return!1;for(let[e,a]of s)r.push(a),n.push(t[e]);continue}return!1}return!0}var e_={};m(e_,"StringUtil",()=>eM);class eM{constructor(){}static nthIndex(e,t,r=0,n){if(!e)throw new eE("String cannot be null");if(r<0||r>=e.length)throw new eE(ec.format("Cannot search from index : $",r));if(n<=0||n>e.length)throw new eE(ec.format("Cannot search for occurance : $",n));for(;r<e.length;){if(e.charAt(r)==t&&0==--n)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 eS={};m(eS,"SchemaUtil",()=>ex);var eO={};m(eO,"Tuple2",()=>ew),m(eO,"Tuple3",()=>eI),m(eO,"Tuple4",()=>eP);class ew{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 eI extends ew{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 eP extends eI{constructor(e,t,r,n){super(e,t,r),this.fr=n}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 ed={};m(ed,"SchemaValidationException",()=>ey);class ey extends Error{constructor(e,t,r=[],n){super(t+(r?r.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.cause=n}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class ex{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():_(e.getDefaultValue())?ex.getDefaultValue(await ex.getSchemaFromRef(e,t,e.getRef()),t):e.getDefaultValue()}static async hasDefaultValueOrNullSchemaType(e,t){return e?e.getConstant()||!_(e.getDefaultValue())?Promise.resolve(!0):_(e.getRef())?e.getType()?.getAllowedSchemaTypes().has(i.NULL)?Promise.resolve(!0):Promise.resolve(!1):this.hasDefaultValueOrNullSchemaType(await ex.getSchemaFromRef(e,t,e.getRef()),t):Promise.resolve(!1)}static async getSchemaFromRef(e,t,r,n=0){if(++n==ex.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new ey(r??"","Schema has a cyclic reference");if(!e||!r||eM.isNullOrBlank(r))return Promise.resolve(void 0);if(!r.startsWith("#")){var s=await ex.resolveExternalSchema(e,t,r);s&&(e=s.getT1(),r=s.getT2())}let a=r.split("/");return 1===a.length?Promise.resolve(e):Promise.resolve(ex.resolveInternalSchema(e,t,r,n,a,1))}static async resolveInternalSchema(e,t,r,n,s,a){let o=e;if(a!==s.length){for(;a<s.length;){if("$defs"===s[a]){if(++a>=s.length||!o.get$defs())throw new $(r,ex.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);o=o.get$defs()?.get(s[a])}else{if(o&&(!o.getType()?.contains(i.OBJECT)||!o.getProperties()))throw new $(r,"Cannot retrievie schema from non Object type schemas");o=o.getProperties()?.get(s[a])}if(a++,!o||!eM.isNullOrBlank(o.getRef())&&!(o=await ex.getSchemaFromRef(o,t,o.getRef(),n)))throw new $(r,ex.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return Promise.resolve(o)}}static async resolveExternalSchema(e,t,r){if(!t)return Promise.resolve(void 0);let n=eM.splitAtFirstOccurance(r??"","/");if(!n[0])return Promise.resolve(void 0);let s=eM.splitAtLastOccurance(n[0],".");if(!s[0]||!s[1])return Promise.resolve(void 0);let a=await t.find(s[0],s[1]);if(!a)return Promise.resolve(void 0);if(!n[1]||""===n[1])return Promise.resolve(new ew(a,r));if(r="#/"+n[1],!a)throw new $(r,ex.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return Promise.resolve(new ew(a,r))}constructor(){}}var eL={};m(eL,"AnyOfAllOfOneOfValidator",()=>ev);class ev{static async validate(e,t,r,n,s,a){let i=[];return t.getOneOf()&&!t.getOneOf()?await ev.oneOf(e,t,r,n,i,s,a):t.getAllOf()&&!t.getAllOf()?await ev.allOf(e,t,r,n,i,s,a):t.getAnyOf()&&!t.getAnyOf()?await ev.anyOf(e,t,r,n,i,s,a):n}static async anyOf(e,t,r,n,s,a,i){let o=!1;for(let E of t.getAnyOf()??[])try{await ev.validate(e,E,r,n,a,i),o=!0;break}catch(e){o=!1,s.push(e)}if(o)return n;throw new ey(e9.path(e),"The value don't satisfy any of the schemas.",s)}static async allOf(e,t,r,n,s,a,i){let o=0;for(let E of t.getAllOf()??[])try{await ev.validate(e,E,r,n,a,i),o++}catch(e){s.push(e)}if(o===t.getAllOf()?.length)return n;throw new ey(e9.path(e),"The value doesn't satisfy some of the schemas.",s)}static async oneOf(e,t,r,n,s,a,i){let o=0;for(let E of t.getOneOf()??[])try{await ev.validate(e,E,r,n,a,i),o++}catch(e){s.push(e)}if(1===o)return n;throw new ey(e9.path(e),0==o?"The value does not satisfy any schema":"The value satisfy more than one schema",s)}constructor(){}}var eU={};m(eU,"TypeValidator",()=>e2);var eV={};m(eV,"ArrayValidator",()=>eC);class eC{static async validate(e,t,r,n,s,a){if(_(n))throw new ey(e9.path(e),"Expected an array but found null");if(!Array.isArray(n))throw new ey(e9.path(e),n.toString()+" is not an Array");return eC.checkMinMaxItems(e,t,n),await eC.checkItems(e,t,r,n,s,a),eC.checkUniqueItems(e,t,n),await eC.checkContains(t,e,r,n),n}static async checkContains(e,t,r,n){if(_(e.getContains()))return;let s=await eC.countContains(t,e,r,n,_(e.getMinContains())&&_(e.getMaxContains()));if(0===s)throw new ey(e9.path(t),"None of the items are of type contains schema");if(!_(e.getMinContains())&&e.getMinContains()>s)throw new ey(e9.path(t),"The minimum number of the items of type contains schema should be "+e.getMinContains()+" but found "+s);if(!_(e.getMaxContains())&&e.getMaxContains()<s)throw new ey(e9.path(t),"The maximum number of the items of type contains schema should be "+e.getMaxContains()+" but found "+s)}static async countContains(e,t,r,n,s){let a=0;for(let i=0;i<n.length;i++){let o=e?[...e]:[];try{if(await e9.validate(o,t.getContains(),r,n[i]),a++,s)break}catch(e){}}return a}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()&&new Set(r).size!==r.length)throw new ey(e9.path(e),"Items on the array are not unique")}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new ey(e9.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new ey(e9.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static async checkItems(e,t,r,n,s,a){if(!t.getItems())return;let i=t.getItems();if(i.getSingleSchema())for(let t=0;t<n.length;t++){let o=e?[...e]:[];n[t]=await e9.validate(o,i.getSingleSchema(),r,n[t],s,a)}if(i.getTupleSchema()){if(i.getTupleSchema().length!==n.length&&_(t?.getAdditionalItems()))throw new ey(e9.path(e),"Expected an array with only "+i.getTupleSchema().length+" but found "+n.length);await this.checkItemsInTupleSchema(e,r,n,i),await this.checkAdditionalItems(e,t,r,n,i)}}static async checkItemsInTupleSchema(e,t,r,n,s,a){for(let i=0;i<n.getTupleSchema()?.length;i++){let o=e?[...e]:[];r[i]=await e9.validate(o,n.getTupleSchema()[i],t,r[i],s,a)}}static async checkAdditionalItems(e,t,r,n,s){if(!_(t.getAdditionalItems())){let a=t.getAdditionalItems();if(a?.getBooleanValue()){let i=Y.ofAny("item");if(a?.getBooleanValue()===!1&&n.length>s.getTupleSchema()?.length)throw new ey(e9.path(e),"No Additional Items are defined");await this.checkEachItemInAdditionalItems(e,t,r,n,s,i)}else if(a?.getSchemaValue()){let i=a.getSchemaValue();await this.checkEachItemInAdditionalItems(e,t,r,n,s,i)}}}static async checkEachItemInAdditionalItems(e,t,r,n,s,a){for(let t=s.getTupleSchema()?.length;t<n.length;t++){let s=e?[...e]:[];n[t]=await e9.validate(s,a,r,n[t])}}constructor(){}}var eD={};m(eD,"BooleanValidator",()=>eG);class eG{static validate(e,t,r){if(_(r))throw new ey(e9.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new ey(e9.path(e),r.toString()+" is not a boolean");return r}constructor(){}}var eb={};m(eb,"NullValidator",()=>eF);class eF{static validate(e,t,r){if(_(r))return r;throw new ey(e9.path(e),"Expected a null but found "+r)}constructor(){}}var eB={};m(eB,"NumberValidator",()=>eY);class eY{static validate(e,t,r,n){if(_(n))throw new ey(e9.path(t),"Expected a number but found null");if("number"!=typeof n)throw new ey(e9.path(t),n.toString()+" is not a "+e);let s=eY.extractNumber(e,t,r,n);return eY.checkRange(t,r,n,s),eY.checkMultipleOf(t,r,n,s),n}static extractNumber(e,t,r,n){let s=n;try{(e==i.LONG||e==i.INTEGER)&&(s=Math.round(s))}catch(r){throw new ey(e9.path(t),n+" is not a number of type "+e,r)}if(_(s)||(e==i.LONG||e==i.INTEGER)&&s!=n)throw new ey(e9.path(t),n.toString()+" is not a number of type "+e);return s}static checkMultipleOf(e,t,r,n){if(t.getMultipleOf()&&n%t.getMultipleOf()!=0)throw new ey(e9.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}static checkRange(e,t,r,n){if(!_(t.getMinimum())&&0>eY.numberCompare(n,t.getMinimum()))throw new ey(e9.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(!_(t.getMaximum())&&eY.numberCompare(n,t.getMaximum())>0)throw new ey(e9.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(!_(t.getExclusiveMinimum())&&0>=eY.numberCompare(n,t.getExclusiveMinimum()))throw new ey(e9.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(!_(t.getExclusiveMaximum())&&eY.numberCompare(n,t.getExclusiveMaximum())>0)throw new ey(e9.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}var eH={};m(eH,"ObjectValidator",()=>ek);class ek{static async validate(e,t,r,n,s,a){if(_(n))throw new ey(e9.path(e),"Expected an object but found null");if("object"!=typeof n||Array.isArray(n))throw new ey(e9.path(e),n.toString()+" is not an Object");let i=new Set(Object.keys(n));return ek.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&await ek.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&ek.checkRequired(e,t,n),t.getProperties()&&await ek.checkProperties(e,t,r,n,i,s,a),t.getPatternProperties()&&await ek.checkPatternProperties(e,t,r,n,i),t.getAdditionalProperties()&&await ek.checkAdditionalProperties(e,t,r,n,i),n}static async checkPropertyNameSchema(e,t,r,n){for(let s of Array.from(n.values()))try{await e9.validate(e,t.getPropertyNames(),r,s)}catch(t){throw new ey(e9.path(e),"Property name '"+s+"' does not fit the property schema")}}static checkRequired(e,t,r){for(let n of t.getRequired()??[])if(_(r[n]))throw new ey(e9.path(e),n+" is mandatory")}static async checkAdditionalProperties(e,t,r,n,s){let a=t.getAdditionalProperties();if(a.getSchemaValue())for(let t of Array.from(s.values())){let s=e?[...e]:[];n[t]=await e9.validate(s,a.getSchemaValue(),r,n[t])}else if(!1===a.getBooleanValue()&&s.size)throw new ey(e9.path(e),Array.from(s)+" is/are additional properties which are not allowed.")}static async checkPatternProperties(e,t,r,n,s){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(s.values())){let o=e?[...e]:[];for(let e of Array.from(a.entries()))if(e[1].test(i)){n[i]=await e9.validate(o,t.getPatternProperties().get(e[0]),r,n[i]),s.delete(i);break}}}static async checkProperties(e,t,r,n,s,a,i){for(let o of Array.from(t.getProperties())){let t=n[o[0]];if(!n.hasOwnProperty(o[0])&&_(t)&&_(await ex.getDefaultValue(o[1],r)))continue;let E=e?[...e]:[];n[o[0]]=await e9.validate(E,o[1],r,t,a,i),s.delete(o[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new ey(e9.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new ey(e9.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}var e$={};m(e$,"StringValidator",()=>eW);var ej={};m(ej,"StringFormat",()=>E),(r=E||(E={})).DATETIME="DATETIME",r.TIME="TIME",r.DATE="DATE",r.EMAIL="EMAIL",r.REGEX="REGEX";class eW{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))throw new ey(e9.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new ey(e9.path(e),r.toString()+" is not String");t.getFormat()==E.TIME?eW.patternMatcher(e,t,r,eW.TIME,"time pattern"):t.getFormat()==E.DATE?eW.patternMatcher(e,t,r,eW.DATE,"date pattern"):t.getFormat()==E.DATETIME?eW.patternMatcher(e,t,r,eW.DATETIME,"date time pattern"):t.getFormat()==E.EMAIL?eW.patternMatcher(e,t,r,eW.EMAIL,"email pattern"):t.getPattern()&&eW.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let n=r.length;if(t.getMinLength()&&n<t.getMinLength())throw new ey(e9.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&n>t.getMaxLength())throw new ey(e9.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,n,s){if(!n.test(r))throw new ey(e9.path(e),r.toString()+" is not matched with the "+s)}constructor(){}}(n=u||(u={})).STRICT="STRICT",n.LENIENT="LENIENT",n.USE_DEFAULT="USE_DEFAULT",n.SKIP="SKIP";const eX=e=>u[e.toUpperCase()],eJ=()=>Object.values(u);class eq extends Error{constructor(e,t,r,n,s=[],a){super(r+(s?s.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.source=t??null,this.mode=n??null,this.cause=a}getSchemaPath(){return this.schemaPath}getSource(){return this.source??null}getMode(){return this.mode??null}getCause(){return this.cause}}class ez{static handleUnConvertibleValue(e,t,r,n){return this.handleUnConvertibleValueWithDefault(e,t,r,null,n)}static handleUnConvertibleValueWithDefault(e,t,r,n,s){switch(null===t&&(t=u.STRICT),t){case u.STRICT:throw new eq(e9.path(e),r,s,t);case u.LENIENT:return null;case u.USE_DEFAULT:return n;case u.SKIP:return r;default:throw new eq(e9.path(e),r,"Invalid conversion mode")}}constructor(){}}class eK{static convert(e,t,r,n){if(_(n))return ez.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Expected a string but found null");let s=n??("object"==typeof n?JSON.stringify(n):String(n));return this.getConvertedString(s,r)}static getConvertedString(e,t){return t===u.STRICT?e.toString():e.trim()}static getDefault(e){return e.getDefaultValue()??null}constructor(){}}class eQ{static convert(e,t,r,n,s){if(_(s))return ez.handleUnConvertibleValueWithDefault(e,n,s,this.getDefault(r),"Expected a number but found null");if("object"==typeof s||"boolean"==typeof s||Array.isArray(s)||"string"==typeof s&&isNaN(s=Number(s)))return ez.handleUnConvertibleValueWithDefault(e,n,s,this.getDefault(r),s+" is not a "+t);let a=this.extractNumber(t,s,n);return null===a?ez.handleUnConvertibleValueWithDefault(e,n,s,this.getDefault(r),s+" is not a "+t):a}static extractNumber(e,t,r){if("number"!=typeof t)return null;switch(e){case i.INTEGER:return this.isInteger(t,r)?Math.floor(t):null;case i.LONG:return this.isLong(t,r)?Math.floor(t):null;case i.DOUBLE:return t;case i.FLOAT:return this.isFloat(t,r)?t:null;default:return null}}static isInteger(e,t){return t!==u.STRICT?"number"==typeof e:Number.isInteger(e)}static isLong(e,t){return t!==u.STRICT?"number"==typeof e:Number.isInteger(e)&&e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER}static isFloat(e,t){return t!==u.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 eZ{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,n){return null==n?ez.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Expected a boolean but found null"):this.getBooleanPrimitive(n)??ez.handleUnConvertibleValueWithDefault(e,r,n,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 eZ.BOOLEAN_MAP[t]??null}static handleNumberValue(e){return 0===e||1===e?1===e:null}static getDefault(e){return e.getDefaultValue()??!1}constructor(){}}class e0{static convert(e,t,r,n){return _(n)?n:"string"==typeof n&&"null"===n.toLowerCase()?null:ez.handleUnConvertibleValueWithDefault(e,r,n,null,"Unable to convert to null")}constructor(){}}class e1{static handleValidationError(e,t,r,n,s){switch(t=t??u.STRICT){case u.STRICT:throw new ey(e9.path(e),s);case u.LENIENT:return null;case u.USE_DEFAULT:return n;case u.SKIP:return r}}constructor(){}}class e2{static async validate(e,t,r,n,s,a,o){return t==i.OBJECT?await ek.validate(e,r,n,s,a,o):t==i.ARRAY?await eC.validate(e,r,n,s,a,o):this.handleTypeValidationAndConversion(e,t,r,s,a,o)}static async handleTypeValidationAndConversion(e,t,r,n,s,a){let i=s?this.convertElement(e,t,r,n,a??u.STRICT):n;return await this.validateElement(e,t,r,i,a??u.STRICT)}static convertElement(e,t,r,n,s){if(_(t))return ez.handleUnConvertibleValueWithDefault(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type for conversion.",t));switch(t){case i.STRING:return eK.convert(e,r,s,n);case i.INTEGER:case i.LONG:case i.DOUBLE:case i.FLOAT:return eQ.convert(e,t,r,s,n);case i.BOOLEAN:return eZ.convert(e,r,s,n);case i.NULL:return e0.convert(e,r,s,n);default:return ez.handleUnConvertibleValueWithDefault(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type for conversion.",t))}}static validateElement(e,t,r,n,s){if(_(t))return e1.handleValidationError(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type.",t));switch(t){case i.STRING:return eW.validate(e,r,n);case i.INTEGER:case i.LONG:case i.DOUBLE:case i.FLOAT:return eY.validate(t,e,r,n);case i.BOOLEAN:return eG.validate(e,r,n);case i.NULL:return eF.validate(e,r,n);default:return e1.handleValidationError(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type.",t))}}constructor(){}}class e9{static{this.ORDER={[i.OBJECT]:0,[i.ARRAY]:1,[i.DOUBLE]:2,[i.FLOAT]:3,[i.LONG]:4,[i.INTEGER]:5,[i.STRING]:6,[i.BOOLEAN]:7,[i.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,n,s,a){if(!t)throw new ey(e9.path(e),"No schema found to validate");if(e||(e=[]),e.push(t),_(n)&&!_(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(!_(t.getConstant()))return e9.constantValidation(e,t,n);if(t.getEnums()&&!t.getEnums()?.length)return e9.enumCheck(e,t,n);if(t.getFormat()&&_(t.getType()))throw new ey(this.path(e),"Type is missing in schema for declared "+t.getFormat()?.toString()+" format.");if(!0===s&&_(t.getType()))throw new ey(this.path(e),"Type is missing in schema for declared "+a);if(t.getType()&&(n=await e9.typeValidation(e,t,r,n,s,a)),!eM.isNullOrBlank(t.getRef()))return await e9.validate(e,await ex.getSchemaFromRef(e[0],r,t.getRef()),r,n,s,a);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&(n=await ev.validate(e,t,r,n,s,a)),t.getNot()){let i;try{await e9.validate(e,t.getNot(),r,n,s,a),i=!0}catch(e){i=!1}if(i)throw new ey(e9.path(e),"Schema validated value in not condition.")}return n}static constantValidation(e,t,r){if(!ef(t.getConstant(),r))throw new ey(e9.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let n=!1;for(let e of t.getEnums()??[])if(e===r){n=!0;break}if(n)return r;throw new ey(e9.path(e),"Value is not one of "+t.getEnums())}static async typeValidation(e,t,r,n,s,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 e2.validate(e,E,t,r,n,s,a)}catch(e){o.push(e)}throw new ey(e9.path(e),"Value "+JSON.stringify(n)+" is not of valid type(s)",o)}constructor(){}}class e3{async validateArguments(e,t,r){let n=new Map;for(let s of Array.from(this.getSignature().getParameters().entries())){let a=s[1];try{let r=await this.validateArgument(e,t,s,a);n.set(r.getT1(),r.getT2())}catch(t){let e=this.getSignature();throw new eE(`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 n}async validateArgument(e,t,r,n){let s,a=r[0],i=e.get(r[0]);if(_(i)&&!n.isVariableArgument())return new ew(a,await e9.validate(void 0,n.getSchema(),t,void 0));if(!n?.isVariableArgument())return new ew(a,await e9.validate(void 0,n.getSchema(),t,i));Array.isArray(i)?s=i:(s=[],_(i)?_(n.getSchema().getDefaultValue())||s.push(n.getSchema().getDefaultValue()):s.push(i));for(let e=0;e<s.length;e++)s[e]=await e9.validate(void 0,n.getSchema(),t,s[e]);return new ew(a,s)}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 eE(`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 e4 extends e3{static{this.EVENT_INDEX_NAME="index"}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_INDEX=new es(es.OUTPUT,q.of(e4.EVENT_INDEX_NAME,Y.ofInteger(e4.EVENT_INDEX_NAME)))}static{this.EVENT_RESULT_INTEGER=new es(es.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofInteger(e4.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_BOOLEAN=new es(es.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofBoolean(e4.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_ARRAY=new es(es.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofArray(e4.EVENT_RESULT_NAME,Y.ofAny(e4.EVENT_RESULT_NAME))))}static{this.EVENT_RESULT_EMPTY=new es(es.OUTPUT,q.of())}static{this.EVENT_RESULT_ANY=new es(es.OUTPUT,q.of(this.EVENT_RESULT_NAME,Y.ofAny(this.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_OBJECT=new es(es.OUTPUT,q.of(this.EVENT_RESULT_NAME,Y.ofObject(this.EVENT_RESULT_NAME)))}static{this.PARAMETER_INT_LENGTH=X.of("length",Y.ofInteger("length").setDefaultValue(-1))}static{this.PARAMETER_ARRAY_FIND=X.of("find",Y.ofArray("eachFind",Y.ofAny("eachFind")))}static{this.PARAMETER_INT_SOURCE_FROM=X.of("srcFrom",Y.ofInteger("srcFrom").setDefaultValue(0).setMinimum(0))}static{this.PARAMETER_INT_SECOND_SOURCE_FROM=X.of("secondSrcFrom",Y.ofInteger("secondSrcFrom").setDefaultValue(0))}static{this.PARAMETER_INT_FIND_FROM=X.of("findFrom",Y.ofInteger("findFrom").setDefaultValue(0))}static{this.PARAMETER_INT_OFFSET=X.of("offset",Y.ofInteger("offset").setDefaultValue(0))}static{this.PARAMETER_ROTATE_LENGTH=X.of("rotateLength",Y.ofInteger("rotateLength").setDefaultValue(1).setMinimum(1))}static{this.PARAMETER_BOOLEAN_ASCENDING=X.of("ascending",Y.ofBoolean("ascending").setDefaultValue(!0))}static{this.PARAMETER_KEY_PATH=X.of("keyPath",Y.ofString("keyPath").setDefaultValue(""))}static{this.PARAMETER_FIND_PRIMITIVE=X.of("findPrimitive",Y.of("findPrimitive",i.STRING,i.DOUBLE,i.FLOAT,i.INTEGER,i.LONG))}static{this.PARAMETER_ARRAY_SOURCE=X.of("source",Y.ofArray("eachSource",Y.ofAny("eachSource")))}static{this.PARAMETER_ARRAY_SECOND_SOURCE=X.of("secondSource",Y.ofArray("eachSecondSource",Y.ofAny("eachSecondSource")))}static{this.PARAMETER_ARRAY_SOURCE_PRIMITIVE=X.of("source",Y.ofArray("eachSource",new Y().setName("eachSource").setType(L.of(i.STRING,i.NULL,i.INTEGER,i.FLOAT,i.DOUBLE,i.LONG))))}static{this.PARAMETER_BOOLEAN_DEEP_COPY=X.of("deepCopy",Y.ofBoolean("deepCopy").setDefaultValue(!0))}static{this.PARAMETER_ANY=X.of("element",Y.ofAny("element"))}static{this.PARAMETER_ANY_ELEMENT_OBJECT=X.of("elementObject",Y.ofAny("elementObject"))}static{this.PARAMETER_ANY_VAR_ARGS=X.of("element",Y.ofAny("element")).setVariableArgument(!0)}static{this.PARAMETER_ARRAY_RESULT=X.of(e4.EVENT_RESULT_NAME,Y.ofArray("eachResult",Y.ofAny("eachResult")))}constructor(e,t,r){super();let n=new Map;for(let e of t)n.set(e.getParameterName(),e);this.signature=new eT(e).setNamespace(p.SYSTEM_ARRAY).setParameters(n).setEvents(q.of(r.getName(),r))}getSignature(){return this.signature}}class e5 extends e4{constructor(){super("Concatenate",[e4.PARAMETER_ARRAY_SOURCE,e4.PARAMETER_ARRAY_SECOND_SOURCE],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName());return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,[...t,...r]]]))])}}class e6 extends e4{constructor(){super("AddFirst",[e4.PARAMETER_ARRAY_SOURCE,e4.PARAMETER_ANY],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e4.PARAMETER_ANY.getParameterName());if(0==(t=[...t]).length)return t.push(r),new eu([ea.outputOf(new Map([]))]);t.push(r);let n=t.length-1;for(;n>0;){let e=t[n-1];t[n-1]=t[n],t[n--]=e}return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}const e7="keyName";class e8 extends e4{constructor(){super("ArrayToArrayOfObjects",[e4.PARAMETER_ARRAY_SOURCE,X.of(e7,Y.ofString(e7),!0)],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e8.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e7);if(!t?.length)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,[]]]))]);let n=t.map(e=>{let t={};if(Array.isArray(e)){if(r.length)r.forEach((r,n)=>{t[r]=e[n]});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 eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,n]]))])}}var te={};m(te,"PrimitiveUtil",()=>tn);var tt={};m(tt,"ExecutionException",()=>tr);class tr extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class tn{static findPrimitiveNullAsBoolean(e){if(_(e))return new ew(i.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new tr(ec.format("$ is not a primitive type",e));return"boolean"===t?new ew(i.BOOLEAN,e):"string"===t?new ew(i.STRING,e):tn.findPrimitiveNumberType(e)}static findPrimitive(e){if(_(e))return new ew(i.NULL,void 0);let t=typeof e;if("object"===t)throw new tr(ec.format("$ is not a primitive type",e));return"boolean"===t?new ew(i.BOOLEAN,e):"string"===t?new ew(i.STRING,e):tn.findPrimitiveNumberType(e)}static findPrimitiveNumberType(e){if(_(e)||Array.isArray(e)||"object"==typeof e)throw new tr(ec.format("Unable to convert $ to a number.",e));try{if(Number.isInteger(e))return new ew(i.LONG,e);return new ew(i.DOUBLE,e)}catch(t){throw new tr(ec.format("Unable to convert $ to a number.",e),t)}}static compare(e,t){if(e==t)return 0;if(_(e)||_(t))return _(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 n=this.compare(e[r],t[r]);if(0!=n)return n}return 0}return Array.isArray(e)?-1:1}let r=typeof e,n=typeof t;return"object"===r||"object"===n?("object"===r&&"object"===n&&Object.keys(e).forEach(r=>{let n=this.compare(e[r],t[r]);if(0!=n)return n}),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return _(e)||_(t)?_(e)&&_(t)?0:_(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)?i.LONG:i.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class ts extends e4{constructor(){super("BinarySearch",[ts.PARAMETER_ARRAY_SOURCE_PRIMITIVE,ts.PARAMETER_INT_SOURCE_FROM,ts.PARAMETER_FIND_PRIMITIVE,ts.PARAMETER_INT_LENGTH],ts.EVENT_INDEX)}async internalExecute(e){let t=e?.getArguments()?.get(ts.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ts.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(ts.PARAMETER_FIND_PRIMITIVE.getParameterName()),s=e?.getArguments()?.get(ts.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length||r<0||r>t.length)throw new eE("Search source array cannot be empty");if(-1==s&&(s=t.length-r),(s=r+s)>t.length)throw new eE("End point for array cannot be more than the size of the source array");let a=-1;for(;r<=s;){let e=Math.floor((r+s)/2);if(0==tn.compare(t[e],n)){a=e;break}tn.compare(t[e],n)>0?s=e-1:r=e+1}return new eu([ea.outputOf(new Map([[ts.EVENT_INDEX_NAME,a]]))])}}var ta={};m(ta,"ArrayUtil",()=>ti);class ti{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 to extends e4{constructor(){super("Compare",ti.of(to.PARAMETER_ARRAY_SOURCE,to.PARAMETER_INT_SOURCE_FROM,to.PARAMETER_ARRAY_FIND,to.PARAMETER_INT_FIND_FROM,to.PARAMETER_INT_LENGTH),to.EVENT_RESULT_INTEGER)}async internalExecute(e){var t=e?.getArguments()?.get(to.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(to.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(to.PARAMETER_ARRAY_FIND.getParameterName()),s=e?.getArguments()?.get(to.PARAMETER_INT_FIND_FROM.getParameterName()),a=e?.getArguments()?.get(to.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new eE("Compare source array cannot be empty");if(0==n.length)throw new eE("Compare find array cannot be empty");if(-1==a&&(a=t.length-r),r+a>t.length)throw new eE(ec.format("Source array size $ is less than comparing size $",t.length,r+a));if(s+a>n.length)throw new eE(ec.format("Find array size $ is less than comparing size $",n.length,s+a));return new eu(ti.of(ea.outputOf(q.of(to.EVENT_RESULT_NAME,this.compare(t,r,r+a,n,s,s+a)))))}compare(e,t,r,n,s,a){if(r<t){let e=t;t=r,r=e}if(a<s){let e=s;s=a,a=e}if(r-t!=a-s)throw new eE(ec.format("Cannot compare uneven arrays from $ to $ in source array with $ to $ in find array",r,t,a,s));for(let a=t,i=s;a<r;a++,i++){let t=1;if(_(e[a])||_(n[i])){let r=_(e[a]);r==_(n[i])?t=0:r&&(t=-1)}else{let r=typeof e[a],s=typeof n[i];if("object"===r||"object"===s)t=1;else if("string"===r||"string"===s){let r=""+e[a],s=""+n[i];r===s?t=0:r<s&&(t=-1)}else"boolean"===r||"boolean"===s?t=r==s?0:1:"number"===r&&"number"===s&&(t=e[a]-n[i])}if(0!=t)return t}return 0}}var tE={};function tu(e){return e?globalThis.structuredClone?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e)):e}m(tE,"duplicate",()=>tu);class tA extends e4{constructor(){super("Copy",[tA.PARAMETER_ARRAY_SOURCE,tA.PARAMETER_INT_SOURCE_FROM,tA.PARAMETER_INT_LENGTH,tA.PARAMETER_BOOLEAN_DEEP_COPY],tA.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tA.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tA.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tA.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new eE(ec.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));var s=e?.getArguments()?.get(tA.PARAMETER_BOOLEAN_DEEP_COPY.getParameterName());let a=Array(n);for(let e=r;e<r+n;e++)_(t[e])||(a[e-r]=s?tu(t[e]):t[e]);return new eu([ea.outputOf(q.of(tA.EVENT_RESULT_NAME,a))])}}class tT extends e4{constructor(){super("Delete",[e4.PARAMETER_ARRAY_SOURCE,e4.PARAMETER_ANY_VAR_ARGS],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tT.PARAMETER_ANY_VAR_ARGS.getParameterName());if(null==r)throw new eE("The deletable var args are empty. So cannot be proceeded further.");if(0==t.length||0==r.length)throw new eE("Expected a source or deletable for an array but not found any");let n=new Set;for(let e=t.length-1;e>=0;e--)for(let s=0;s<r.length;s++)n.has(e)||0!=tn.compare(t[e],r[s])||n.add(t[e]);return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t.filter(e=>!n.has(e))]]))])}}class tl extends e4{constructor(){super("DeleteFirst",[tl.PARAMETER_ARRAY_SOURCE],tl.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tl.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new eE("Given source array is empty");return(t=[...t]).shift(),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tR extends e4{constructor(){super("DeleteFrom",[tR.PARAMETER_ARRAY_SOURCE,tR.PARAMETER_INT_SOURCE_FROM,tR.PARAMETER_INT_LENGTH],tR.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tR.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tR.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tR.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new eE("There are no elements to be deleted");if(r>=(t=[...t]).length||r<0)throw new eE("The int source for the array should be in between 0 and length of the array ");if(-1==n&&(n=t.length-r),r+n>t.length)throw new eE("Requested length to be deleted is more than the size of array ");return t.splice(r,n),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tm extends e4{constructor(){super("DeleteLast",[tm.PARAMETER_ARRAY_SOURCE],tm.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tm.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new eE("Given source array is empty");return(t=[...t]).pop(),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tg extends e4{constructor(){super("Disjoint",[tg.PARAMETER_ARRAY_SOURCE,tg.PARAMETER_INT_SOURCE_FROM,tg.PARAMETER_ARRAY_SECOND_SOURCE,tg.PARAMETER_INT_SECOND_SOURCE_FROM,tg.PARAMETER_INT_LENGTH],tg.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tg.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tg.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tg.PARAMETER_INT_LENGTH.getParameterName());if(-1==a&&(a=t.length<=n.length?t.length-r:n.length-s),a>t.length||a>n.length||r+a>t.length||s+a>n.length)throw new eE("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(n[e+s]);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 eu([ea.outputOf(new Map([[tg.EVENT_RESULT_NAME,[...E]]]))])}}class th extends e4{constructor(){super("Equals",[th.PARAMETER_ARRAY_SOURCE,th.PARAMETER_INT_SOURCE_FROM,th.PARAMETER_ARRAY_FIND,th.PARAMETER_INT_FIND_FROM,th.PARAMETER_INT_LENGTH],th.EVENT_RESULT_BOOLEAN)}async internalExecute(e){let t=new to,r=(await t.execute(e)).allResults()[0].getResult().get(th.EVENT_RESULT_NAME);return new eu([ea.outputOf(q.of(th.EVENT_RESULT_NAME,0==r))])}}class tc extends e4{constructor(){super("Fill",[tc.PARAMETER_ARRAY_SOURCE,tc.PARAMETER_INT_SOURCE_FROM,tc.PARAMETER_INT_LENGTH,tc.PARAMETER_ANY],tc.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tc.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tc.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tc.PARAMETER_INT_LENGTH.getParameterName()),s=e?.getArguments()?.get(tc.PARAMETER_ANY.getParameterName());if(r<0)throw new eE(ec.format("Arrays out of bound trying to access $ index",r));-1==n&&(n=t.length-r);let a=r+n-t.length;if(t=[...t],a>0)for(let e=0;e<a;e++)t.push();for(let e=r;e<r+n;e++)t[e]=_(s)?s:tu(s);return new eu([ea.outputOf(q.of(e4.EVENT_RESULT_NAME,t))])}}class tp extends e4{constructor(){super("Frequency",[tp.PARAMETER_ARRAY_SOURCE,tp.PARAMETER_ANY,tp.PARAMETER_INT_SOURCE_FROM,tp.PARAMETER_INT_LENGTH],tp.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tp.PARAMETER_ANY.getParameterName()),n=e?.getArguments()?.get(tp.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tp.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[tp.EVENT_RESULT_NAME,0]]))]);if(n>t.length)throw new eE("Given start point is more than the size of source");let a=n+s;if(-1==s&&(a=t.length-n),a>t.length)throw new eE("Given length is more than the size of source");let i=0;for(let e=n;e<a&&e<t.length;e++)0==tn.compare(t[e],r)&&i++;return new eu([ea.outputOf(new Map([[tp.EVENT_RESULT_NAME,i]]))])}}class tN extends e4{constructor(){super("IndexOf",[tN.PARAMETER_ARRAY_SOURCE,tN.PARAMETER_ANY_ELEMENT_OBJECT,tN.PARAMETER_INT_FIND_FROM],tN.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tN.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tN.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),n=e?.getArguments()?.get(tN.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[tN.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new eE("The size of the search index of the array is greater than the size of the array");let s=-1;for(let e=n;e<t.length;e++)if(0==tn.compare(t[e],r)){s=e;break}return new eu([ea.outputOf(new Map([[tN.EVENT_RESULT_NAME,s]]))])}}class tf extends e4{constructor(){super("IndexOfArray",[tf.PARAMETER_ARRAY_SOURCE,tf.PARAMETER_ARRAY_SECOND_SOURCE,tf.PARAMETER_INT_FIND_FROM],tf.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tf.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length||0==r.length)return new eu([ea.outputOf(new Map([[tf.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||t.length<r.length)throw new eE("Given from second source is more than the size of the source array");let s=r.length,a=-1;for(let e=n;e<t.length;e++){let n=0;if(0==tn.compare(t[e],r[n])){for(;n<s&&0==tn.compare(t[e+n],r[n]);)n++;if(n==s){a=e;break}}}return new eu([ea.outputOf(new Map([[tf.EVENT_RESULT_NAME,a]]))])}}class t_ extends e4{constructor(){super("LastIndexOf",[t_.PARAMETER_ARRAY_SOURCE,t_.PARAMETER_ANY_ELEMENT_OBJECT,t_.PARAMETER_INT_FIND_FROM],t_.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t_.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),n=e?.getArguments()?.get(t_.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[t_.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new eE("The value of length shouldn't the exceed the size of the array or shouldn't be in terms");let s=-1;for(let e=t.length-1;e>=n;e--)if(0==tn.compare(t[e],r)){s=e;break}return new eu([ea.outputOf(new Map([[t_.EVENT_RESULT_NAME,s]]))])}}class tM extends e4{constructor(){super("LastIndexOfArray",[tM.PARAMETER_ARRAY_SOURCE,tM.PARAMETER_ARRAY_SECOND_SOURCE,tM.PARAMETER_INT_FIND_FROM],tM.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tM.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tM.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tM.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[tM.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||r.length>t.length)throw new eE("Given from index is more than the size of the source array");let s=r.length,a=-1;for(let e=n;e<t.length;e++){let n=0;if(0==tn.compare(t[e],r[n])){for(;n<s&&0==tn.compare(t[e+n],r[n]);)n++;n==s&&(a=e)}}return new eu([ea.outputOf(new Map([[tM.EVENT_RESULT_NAME,a]]))])}}class tS extends e4{constructor(){super("Max",[tS.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tS.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tS.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==t.length)throw new eE("Search source array cannot be empty");let r=t[0];for(let e=1;e<t.length;e++){let n=t[e];tn.comparePrimitive(r,n)>=0||(r=n)}return new eu([ea.outputOf(new Map([[tS.EVENT_RESULT_NAME,r]]))])}}class tO extends e4{constructor(){super("Min",[tO.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tO.EVENT_RESULT_ANY)}async internalExecute(e){let t,r=e?.getArguments()?.get(tO.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==r.length)throw new eE("Search source array cannot be empty");for(let e=0;e<r.length;e++)!_(r[e])&&(void 0===t||0>tn.comparePrimitive(r[e],t))&&(t=r[e]);return new eu([ea.outputOf(new Map([[tO.EVENT_RESULT_NAME,t]]))])}}class tw extends e4{constructor(){super("MisMatch",[tw.PARAMETER_ARRAY_SOURCE,tw.PARAMETER_INT_FIND_FROM,tw.PARAMETER_ARRAY_SECOND_SOURCE,tw.PARAMETER_INT_SECOND_SOURCE_FROM,tw.PARAMETER_INT_LENGTH],tw.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tw.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tw.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tw.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tw.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tw.PARAMETER_INT_LENGTH.getParameterName()),i=r<t.length&&r>0?r:0,o=s<n.length&&s>0?s:0;if(i+a>=t.length||o+a>n.length)throw new eE("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]!=n[o+e]){E=e;break}return new eu([ea.outputOf(new Map([[tw.EVENT_RESULT_NAME,E]]))])}}class tI extends e4{constructor(){super("Reverse",[tI.PARAMETER_ARRAY_SOURCE,tI.PARAMETER_INT_SOURCE_FROM,tI.PARAMETER_INT_LENGTH],tI.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tI.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tI.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tI.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n>=t.length||n<0||r<0)throw new eE("Please provide start point between the start and end indexes or provide the length which was less than the source size ");t=[...t];let s=r+n-1;for(;r<=s;){let e=t[r],n=t[s];t[r++]=n,t[s--]=e}return new eu([ea.outputOf(new Map([[tI.EVENT_RESULT_NAME,t]]))])}}class tP extends e4{constructor(){super("Rotate",[tP.PARAMETER_ARRAY_SOURCE,tP.PARAMETER_ROTATE_LENGTH],tP.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tP.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tP.PARAMETER_ROTATE_LENGTH.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);let n=(t=[...t]).length;return r%=n,this.rotate(t,0,r-1),this.rotate(t,r,n-1),this.rotate(t,0,n-1),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}rotate(e,t,r){for(;t<r;){let n=e[t];e[t++]=e[r],e[r--]=n}}}class td extends e4{constructor(){super("Shuffle",[td.PARAMETER_ARRAY_SOURCE],td.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(td.PARAMETER_ARRAY_SOURCE.getParameterName());if(t.length<=1)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);let r=0,n=(t=[...t]).length;for(let e=0;e<n;e++){let e=Math.floor(Math.random()*n)%n,s=t[r];t[r]=t[e],t[e]=s,r=e}return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}var ty={};m(ty,"ObjectValueSetterExtractor",()=>t$);var tx={};m(tx,"Expression",()=>tY);var tL={};m(tL,"StringBuilder",()=>tv);class tv{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 eE(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var tU={};m(tU,"ExpressionEvaluationException",()=>tV);class tV extends Error{constructor(e,t,r){super(ec.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var tC={};m(tC,"ExpressionToken",()=>tD);class tD{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var tG={};m(tG,"ExpressionTokenValue",()=>tb);class tb extends tD{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return ec.format("$: $",this.expression,this.element)}}var tF={};m(tF,"Operation",()=>tB);class tB{static{this.MULTIPLICATION=new tB("*")}static{this.DIVISION=new tB("/")}static{this.INTEGER_DIVISION=new tB("//")}static{this.MOD=new tB("%")}static{this.ADDITION=new tB("+")}static{this.SUBTRACTION=new tB("-")}static{this.NOT=new tB("not",void 0,!0)}static{this.AND=new tB("and",void 0,!0)}static{this.OR=new tB("or",void 0,!0)}static{this.LESS_THAN=new tB("<")}static{this.LESS_THAN_EQUAL=new tB("<=")}static{this.GREATER_THAN=new tB(">")}static{this.GREATER_THAN_EQUAL=new tB(">=")}static{this.EQUAL=new tB("=")}static{this.NOT_EQUAL=new tB("!=")}static{this.BITWISE_AND=new tB("&")}static{this.BITWISE_OR=new tB("|")}static{this.BITWISE_XOR=new tB("^")}static{this.BITWISE_COMPLEMENT=new tB("~")}static{this.BITWISE_LEFT_SHIFT=new tB("<<")}static{this.BITWISE_RIGHT_SHIFT=new tB(">>")}static{this.BITWISE_UNSIGNED_RIGHT_SHIFT=new tB(">>>")}static{this.UNARY_PLUS=new tB("UN: +","+")}static{this.UNARY_MINUS=new tB("UN: -","-")}static{this.UNARY_LOGICAL_NOT=new tB("UN: not","not")}static{this.UNARY_BITWISE_COMPLEMENT=new tB("UN: ~","~")}static{this.ARRAY_OPERATOR=new tB("[")}static{this.OBJECT_OPERATOR=new tB(".")}static{this.NULLISH_COALESCING_OPERATOR=new tB("??")}static{this.CONDITIONAL_TERNARY_OPERATOR=new tB("?")}static{this.VALUE_OF=new Map([["MULTIPLICATION",tB.MULTIPLICATION],["DIVISION",tB.DIVISION],["INTEGER_DIVISON",tB.INTEGER_DIVISION],["MOD",tB.MOD],["ADDITION",tB.ADDITION],["SUBTRACTION",tB.SUBTRACTION],["NOT",tB.NOT],["AND",tB.AND],["OR",tB.OR],["LESS_THAN",tB.LESS_THAN],["LESS_THAN_EQUAL",tB.LESS_THAN_EQUAL],["GREATER_THAN",tB.GREATER_THAN],["GREATER_THAN_EQUAL",tB.GREATER_THAN_EQUAL],["EQUAL",tB.EQUAL],["NOT_EQUAL",tB.NOT_EQUAL],["BITWISE_AND",tB.BITWISE_AND],["BITWISE_OR",tB.BITWISE_OR],["BITWISE_XOR",tB.BITWISE_XOR],["BITWISE_COMPLEMENT",tB.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",tB.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",tB.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",tB.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",tB.UNARY_PLUS],["UNARY_MINUS",tB.UNARY_MINUS],["UNARY_LOGICAL_NOT",tB.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",tB.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",tB.ARRAY_OPERATOR],["OBJECT_OPERATOR",tB.OBJECT_OPERATOR],["NULLISH_COALESCING_OPERATOR",tB.NULLISH_COALESCING_OPERATOR],["CONDITIONAL_TERNARY_OPERATOR",tB.CONDITIONAL_TERNARY_OPERATOR]])}static{this.UNARY_OPERATORS=new Set([tB.ADDITION,tB.SUBTRACTION,tB.NOT,tB.BITWISE_COMPLEMENT,tB.UNARY_PLUS,tB.UNARY_MINUS,tB.UNARY_LOGICAL_NOT,tB.UNARY_BITWISE_COMPLEMENT])}static{this.ARITHMETIC_OPERATORS=new Set([tB.MULTIPLICATION,tB.DIVISION,tB.INTEGER_DIVISION,tB.MOD,tB.ADDITION,tB.SUBTRACTION])}static{this.LOGICAL_OPERATORS=new Set([tB.NOT,tB.AND,tB.OR,tB.LESS_THAN,tB.LESS_THAN_EQUAL,tB.GREATER_THAN,tB.GREATER_THAN_EQUAL,tB.EQUAL,tB.NOT_EQUAL,tB.NULLISH_COALESCING_OPERATOR])}static{this.BITWISE_OPERATORS=new Set([tB.BITWISE_AND,tB.BITWISE_COMPLEMENT,tB.BITWISE_LEFT_SHIFT,tB.BITWISE_OR,tB.BITWISE_RIGHT_SHIFT,tB.BITWISE_UNSIGNED_RIGHT_SHIFT,tB.BITWISE_XOR])}static{this.CONDITIONAL_OPERATORS=new Set([tB.CONDITIONAL_TERNARY_OPERATOR])}static{this.OPERATOR_PRIORITY=new Map([[tB.UNARY_PLUS,1],[tB.UNARY_MINUS,1],[tB.UNARY_LOGICAL_NOT,1],[tB.UNARY_BITWISE_COMPLEMENT,1],[tB.ARRAY_OPERATOR,1],[tB.OBJECT_OPERATOR,1],[tB.MULTIPLICATION,2],[tB.DIVISION,2],[tB.INTEGER_DIVISION,2],[tB.MOD,2],[tB.ADDITION,3],[tB.SUBTRACTION,3],[tB.BITWISE_LEFT_SHIFT,4],[tB.BITWISE_RIGHT_SHIFT,4],[tB.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[tB.LESS_THAN,5],[tB.LESS_THAN_EQUAL,5],[tB.GREATER_THAN,5],[tB.GREATER_THAN_EQUAL,5],[tB.EQUAL,6],[tB.NOT_EQUAL,6],[tB.BITWISE_AND,7],[tB.BITWISE_XOR,8],[tB.BITWISE_OR,9],[tB.AND,10],[tB.OR,11],[tB.NULLISH_COALESCING_OPERATOR,11],[tB.CONDITIONAL_TERNARY_OPERATOR,12]])}static{this.OPERATORS=new Set([...Array.from(tB.ARITHMETIC_OPERATORS),...Array.from(tB.LOGICAL_OPERATORS),...Array.from(tB.BITWISE_OPERATORS),tB.ARRAY_OPERATOR,tB.OBJECT_OPERATOR,...Array.from(tB.CONDITIONAL_OPERATORS)].map(e=>e.getOperator()))}static{this.OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(tB.ARITHMETIC_OPERATORS),...Array.from(tB.LOGICAL_OPERATORS),...Array.from(tB.BITWISE_OPERATORS),tB.ARRAY_OPERATOR,tB.OBJECT_OPERATOR,...Array.from(tB.CONDITIONAL_OPERATORS)].filter(e=>!e.shouldBeWrappedInSpace()).map(e=>e.getOperator()))}static{this.OPERATION_VALUE_OF=new Map(Array.from(tB.VALUE_OF.entries()).map(([e,t])=>[t.getOperator(),t]))}static{this.UNARY_MAP=new Map([[tB.ADDITION,tB.UNARY_PLUS],[tB.SUBTRACTION,tB.UNARY_MINUS],[tB.NOT,tB.UNARY_LOGICAL_NOT],[tB.BITWISE_COMPLEMENT,tB.UNARY_BITWISE_COMPLEMENT],[tB.UNARY_PLUS,tB.UNARY_PLUS],[tB.UNARY_MINUS,tB.UNARY_MINUS],[tB.UNARY_LOGICAL_NOT,tB.UNARY_LOGICAL_NOT],[tB.UNARY_BITWISE_COMPLEMENT,tB.UNARY_BITWISE_COMPLEMENT]])}static{this.BIGGEST_OPERATOR_SIZE=Array.from(tB.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 tB.VALUE_OF.get(e)}toString(){return this.operator}}class tY extends tD{constructor(e,t,r,n){super(e||""),this.tokens=new ep,this.ops=new ep,t&&this.tokens.push(t),r&&this.tokens.push(r),n&&this.ops.push(n),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){let e;let t=this.expression.length,r="",n=new tv(""),s=0,a=!1;for(;s<t;){switch(r=this.expression[s],e=n.toString(),r){case" ":a=this.processTokenSepearator(n,e,a);break;case"(":s=this.processSubExpression(t,n,e,s,a),a=!1;break;case")":throw new tV(this.expression,"Extra closing parenthesis found");case"]":throw new tV(this.expression,"Extra closing square bracket found");case"'":case'"':{let e=this.processStringLiteral(t,r,s);s=e.getT1(),a=e.getT2();break}case"?":if(s+1<t&&"?"!=this.expression.charAt(s+1)&&0!=s&&"?"!=this.expression.charAt(s-1))s=this.processTernaryOperator(t,n,e,s,a);else{let i=this.processOthers(r,t,n,e,s,a);s=i.getT1(),(a=i.getT2())&&this.ops.peek()==tB.ARRAY_OPERATOR&&(s=(i=this.process(t,n,s)).getT1(),a=i.getT2())}break;default:let i=this.processOthers(r,t,n,e,s,a);s=i.getT1(),(a=i.getT2())&&this.ops.peek()==tB.ARRAY_OPERATOR&&(s=(i=this.process(t,n,s)).getT1(),a=i.getT2())}++s}if(e=n.toString(),!eM.isNullOrBlank(e)){if(tB.OPERATORS.has(e))throw new tV(this.expression,"Expression is ending with an operator");this.tokens.push(new tD(e))}}processStringLiteral(e,t,r){let n="",s=r+1;for(;s<e;s++){let e=this.expression.charAt(s);if(e==t&&"\\"!=this.expression.charAt(s-1))break;n+=e}if(s==e&&this.expression.charAt(s-1)!=t)throw new tV(this.expression,"Missing string ending marker "+t);let a=new ew(s,!1);return this.tokens.push(new tb(n,n)),a}process(e,t,r){let n=1;for(++r;r<e&&0!=n;){let e=this.expression.charAt(r);"]"==e?--n:"["==e&&++n,0!=n&&(t.append(e),r++)}return this.tokens.push(new tY(t.toString())),t.setLength(0),new ew(r,!1)}processOthers(e,t,r,n,s,a){let i=t-s;i=i<tB.BIGGEST_OPERATOR_SIZE?i:tB.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(s,s+e);if(tB.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return eM.isNullOrBlank(n)||(this.tokens.push(new tD(n)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(t),a),a=!0,r.setLength(0),new ew(s+e-1,a)}return r.append(e),new ew(s,!1)}processTernaryOperator(e,t,r,n,s){if(s)throw new tV(this.expression,"Ternary operator is followed by an operator");""!=r.trim()&&(this.tokens.push(new tY(r)),t.setLength(0));let a=1,i="",o=++n;for(;n<e&&a>0;)"?"==(i=this.expression.charAt(n))?++a:":"==i&&--a,++n;if(":"!=i)throw new tV(this.expression,"':' operater is missing");if(n>=e)throw new tV(this.expression,"Third part of the ternary expression is missing");for(;!this.ops.isEmpty()&&this.hasPrecedence(tB.CONDITIONAL_TERNARY_OPERATOR,this.ops.peek());){let e=this.ops.pop();if(tB.UNARY_OPERATORS.has(e)){let t=this.tokens.pop();this.tokens.push(new tY("",t,void 0,e))}else{let t=this.tokens.pop(),r=this.tokens.pop();this.tokens.push(new tY("",r,t,e))}}this.ops.push(tB.CONDITIONAL_TERNARY_OPERATOR),this.tokens.push(new tY(this.expression.substring(o,n-1)));let E=this.expression.substring(n);if(""===E.trim())throw new tV(this.expression,"Third part of the ternary expression is missing");return this.tokens.push(new tY(E)),e-1}processSubExpression(e,t,r,n,s){if(tB.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(r),s),t.setLength(0);else if(!eM.isNullOrBlank(r))throw new tV(this.expression,ec.format("Unkown token : $ found.",r));let a=1,i=new tv,o=this.expression.charAt(n);for(n++;n<e&&a>0;)"("==(o=this.expression.charAt(n))?a++:")"==o&&a--,0!=a&&(i.append(o),n++);if(")"!=o)throw new tV(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 tY(i.toString().trim())),n}processTokenSepearator(e,t,r){return eM.isNullOrBlank(t)||(tB.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new tD(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,n){if(r){if(n||e.isEmpty()){if(tB.UNARY_OPERATORS.has(r)){let e=tB.UNARY_MAP.get(r);e&&t.push(e)}else throw new tV(this.expression,ec.format("Extra operator $ found.",r))}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(tB.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new tY("",t,void 0,r))}else{let t=e.pop(),n=e.pop();e.push(new tY("",n,t,r))}}t.push(r)}}}hasPrecedence(e,t){let r=tB.OPERATOR_PRIORITY.get(e),n=tB.OPERATOR_PRIORITY.get(t);if(!r||!n)throw Error("Unknown operators provided");return n<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new tv,t=0,r=this.ops.toArray(),n=this.tokens.toArray();for(let s=0;s<r.length;s++)if(r[s].getOperator().startsWith("UN: "))e.append("(").append(r[s].getOperator().substring(4)).append(n[t]instanceof tY?n[t].toString():n[t]).append(")"),t++;else if(r[s]==tB.CONDITIONAL_TERNARY_OPERATOR){let r=n[t++];e.insert(0,r.toString()),e.insert(0,":"),r=n[t++],e.insert(0,r.toString()),e.insert(0,"?"),r=n[t++],e.insert(0,r.toString()).append(")"),e.insert(0,"(")}else{if(0==t){let r=n[t++];e.insert(0,r.toString())}let a=n[t++];e.insert(0,r[s].getOperator()).insert(0,a.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var tH={};m(tH,"TokenValueExtractor",()=>tk);class tk{static{this.REGEX_SQUARE_BRACKETS=/[\[\]]/}static{this.REGEX_DOT=/\./}getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new eE(ec.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?.__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,n){if(_(n))return;if(t.length==r)return n;let s=t[r].split(tk.REGEX_SQUARE_BRACKETS).map(e=>e.trim()).filter(e=>!eM.isNullOrBlank(e)).reduce((n,s)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,s,n),n);return this.retrieveElementFrom(e,t,r+1,s)}resolveForEachPartOfTokenWithBrackets(e,t,r,n,s){if(!_(s))return"length"===n?this.getLength(e,s):Array.isArray(s)?this.handleArrayAccess(e,n,s):this.handleObjectAccess(e,t,r,n,s)}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 tV(e,ec.format("Length can't be found in token $",e))}handleArrayAccess(e,t,r){let n=parseInt(t);if(isNaN(n))throw new tV(e,ec.format("$ is not a number",t));if(n<0||n>=r.length)throw new tV(e,ec.format("Index $ is out of bounds for array of length $",n,r.length));return r[n]}handleObjectAccess(e,t,r,n,s){if(n.startsWith('"')){if(!n.endsWith('"')||1==n.length||2==n.length)throw new tV(e,ec.format("$ is missing a double quote or empty key found",e));n=n.substring(1,t.length-2)}return this.checkIfObject(e,t,r,s),s[n]}checkIfObject(e,t,r,n){if("object"!=typeof n||Array.isArray(n))throw new tV(e,ec.format("Unable to retrieve $ from $ in the path $",t[r],n.toString(),e))}}class t$ extends tk{constructor(e,t){super(),this.store=e,this.prefix=t}getValueInternal(e){let t=e.split(tk.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,n=!1){this.store=tu(this.store),this.modifyStore(e,t,r,n)}modifyStore(e,t,r,n){let s=new tY(e),a=s.getTokens();a.removeLast();let i=s.getOperations(),o=i.removeLast(),E=a.removeLast(),u=E instanceof tb?E.getElement():E.getExpression(),A=this.store;for(;!i.isEmpty();)A=o==tB.OBJECT_OPERATOR?this.getDataFromObject(A,u,i.peekLast()):this.getDataFromArray(A,u,i.peekLast()),o=i.removeLast(),u=(E=a.removeLast())instanceof tb?E.getElement():E.getExpression();o==tB.OBJECT_OPERATOR?this.putDataInObject(A,u,t,r,n):this.putDataInArray(A,u,t,r,n)}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eE(ec.format("Expected an array index but found $",t));if(n<0)throw new eE(ec.format("Array index is out of bound - $",t));let s=e[n];return _(s)&&(s=r==tB.OBJECT_OPERATOR?{}:[],e[n]=s),s}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));let n=e[t];return _(n)&&(n=r==tB.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r,n,s){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let a=parseInt(t);if(isNaN(a))throw new eE(ec.format("Expected an array index but found $",t));if(a<0)throw new eE(ec.format("Array index is out of bound - $",t));(n||_(e[a]))&&(s&&_(r)?e.splice(a,1):e[a]=r)}putDataInObject(e,t,r,n,s){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));(n||_(e[t]))&&(s&&_(r)?delete e[t]:e[t]=r)}getPrefix(){return this.prefix}}class tj extends e4{constructor(){super("Sort",[tj.PARAMETER_ARRAY_SOURCE,tj.PARAMETER_INT_FIND_FROM,tj.PARAMETER_INT_LENGTH,tj.PARAMETER_BOOLEAN_ASCENDING,tj.PARAMETER_KEY_PATH],tj.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tj.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tj.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tj.PARAMETER_INT_LENGTH.getParameterName()),s=e?.getArguments()?.get(tj.PARAMETER_BOOLEAN_ASCENDING.getParameterName()),a=e?.getArguments()?.get(tj.PARAMETER_KEY_PATH.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);if(t=[...t],-1==n&&(n=t.length-r),r<0||r>=t.length||r+n>t.length)throw new eE("Given start point is more than the size of the array or not available at that point");let i=t.slice(r,r+n+1),o=new t$({},"Data.");return i.sort((e,t)=>"object"==typeof e&&"object"==typeof t&&a.length?(o.setStore({a:e,b:t}),tW(o.getValue("Data.a."+a),o.getValue("Data.b."+a),s)):tW(e,t,s)),t.splice(r,n,...i),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}function tW(e,t,r){return e===t?0:null===e?1:null===t?-1:r?e<t?-1:1:e<t?1:-1}class tX extends e4{constructor(){super("SubArray",[tX.PARAMETER_ARRAY_SOURCE,tX.PARAMETER_INT_FIND_FROM,tX.PARAMETER_INT_LENGTH],tX.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tX.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tX.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tX.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n<=0)return new eu([ea.outputOf(new Map([]))]);if(!(r>=0&&r<t.length)||r+n>t.length)throw new eE("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 s=t.slice(r,r+n);return new eu([ea.outputOf(new Map([[tX.EVENT_RESULT_NAME,s]]))])}}class tJ extends e4{constructor(){super("Insert",[tJ.PARAMETER_ARRAY_SOURCE,tJ.PARAMETER_INT_OFFSET,tJ.PARAMETER_ANY],tJ.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tJ.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tJ.PARAMETER_INT_OFFSET.getParameterName());var n=e?.getArguments()?.get(tJ.PARAMETER_ANY.getParameterName());if(_(n)||_(r)||r>t.length)throw new eE("Please valid resouces to insert at the correct location");if(0==(t=[...t]).length)return 0==r&&t.push(n),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);t.push(n);let s=t.length-1;for(r++;s>=r;){let e=t[s-1];t[s-1]=t[s],t[s--]=e}return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tq extends e4{constructor(){super("InsertLast",[tq.PARAMETER_ARRAY_SOURCE,tq.PARAMETER_ANY],tq.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tq.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tq.PARAMETER_ANY.getParameterName());return(t=[...t]).push(r),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tz extends e4{constructor(){super("RemoveDuplicates",[tz.PARAMETER_ARRAY_SOURCE,tz.PARAMETER_INT_SOURCE_FROM,tz.PARAMETER_INT_LENGTH],tz.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tz.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tz.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tz.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new eE(ec.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));let s=[...t],a=r+n;for(let e=a-1;e>=r;e--)for(let t=e-1;t>=r;t--)if(ef(s[e],s[t])){s.splice(e,1);break}return new eu([ea.outputOf(q.of(tz.EVENT_RESULT_NAME,s))])}}const tK="keyPath",tQ="valuePath",tZ="ignoreNullValues",t0="ignoreNullKeys",t1="ignoreDuplicateKeys";class t2 extends e4{constructor(){super("ArrayToObjects",[e4.PARAMETER_ARRAY_SOURCE,X.of(tK,Y.ofString(tK)),X.of(tQ,Y.of(tQ,i.STRING,i.NULL)),X.of(tZ,Y.ofBoolean(tZ).setDefaultValue(!1)),X.of(t0,Y.ofBoolean(t0).setDefaultValue(!0)),X.of(t1,Y.ofBoolean(t1).setDefaultValue(!1))],e4.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tK),n=e?.getArguments()?.get(tQ)??"",s=e?.getArguments()?.get(tZ),a=e?.getArguments()?.get(t0),i=e?.getArguments()?.get(t1),o=new t$({},"Data."),E=t.filter(e=>!_(e)).reduce((e,t)=>{o.setStore(t);let E=o.getValue("Data."+r);if(a&&_(E))return e;let u=n?o.getValue("Data."+n):t;return s&&_(u)||i&&e.hasOwnProperty(E)||(e[E]=u),e},{});return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,E]]))])}}const t9="source",t3="delimiter",t4="result",t5=new eT("Join").setNamespace(p.SYSTEM_ARRAY).setParameters(new Map([[t9,new X(t9,Y.ofArray(t9,Y.of("each",i.STRING,i.INTEGER,i.LONG,i.DOUBLE,i.FLOAT,i.NULL)))],[t3,new X(t3,Y.ofString(t3).setDefaultValue(""))]])).setEvents(new Map([es.outputEventMapEntry(new Map([[t4,Y.ofString(t4)]]))]));class t6 extends e3{getSignature(){return t5}async internalExecute(e){let t=e?.getArguments()?.get(t9),r=e?.getArguments()?.get(t3);return new eu([ea.outputOf(new Map([[t4,t.join(r)]]))])}}class t7{static{this.repoMap=q.ofArrayEntries(et(new e5),et(new e6),et(new ts),et(new to),et(new tA),et(new tT),et(new tl),et(new tR),et(new tm),et(new tg),et(new th),et(new tc),et(new tp),et(new tN),et(new tf),et(new t_),et(new tM),et(new tS),et(new tO),et(new tw),et(new tI),et(new tP),et(new td),et(new tj),et(new tX),et(new e8),et(new tJ),et(new tq),et(new tz),et(new t2),et(new t6))}static{this.filterableNames=Array.from(t7.repoMap.values()).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=p.SYSTEM_ARRAY?Promise.resolve(void 0):Promise.resolve(t7.repoMap.get(t))}async filter(e){return Promise.resolve(t7.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var t8={};m(t8,"ContextElement",()=>re);class re{static{this.NULL=new re(Y.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 rt="name",rr="schema",rn=new eT("Create").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(rt,new Y().setName(rt).setType(L.of(i.STRING)).setMinLength(1).setFormat(E.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,o.CONSTANT),X.ofEntry(rr,Y.SCHEMA,!1,o.CONSTANT)])).setEvents(new Map([es.outputEventMapEntry(new Map)])),rs="name",ra="value",ri=new eT("Get").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(rs,new Y().setName(rs).setType(L.of(i.STRING)).setMinLength(1).setFormat(E.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,o.CONSTANT)])).setEvents(new Map([es.outputEventMapEntry(new Map([[ra,Y.ofAny(ra)]]))]));var ro={};m(ro,"ExpressionEvaluator",()=>nA);var rE={};m(rE,"LogicalNullishCoalescingOperator",()=>rT);var ru={};m(ru,"BinaryOperator",()=>rA);class rA{nullCheck(e,t,r){if(_(e)||_(t))throw new tr(ec.format("$ cannot be applied to a null value",r.getOperatorName()))}}class rT extends rA{apply(e,t){return _(e)?t:e}}var rl={};m(rl,"ArithmeticAdditionOperator",()=>rR);class rR extends rA{apply(e,t){return _(e)?t:_(t)?e:e+t}}var rm={};m(rm,"ArithmeticDivisionOperator",()=>rg);class rg extends rA{apply(e,t){return this.nullCheck(e,t,tB.DIVISION),e/t}}var rh={};m(rh,"ArithmeticIntegerDivisionOperator",()=>rc);class rc extends rA{apply(e,t){return this.nullCheck(e,t,tB.DIVISION),Math.floor(e/t)}}var rp={};m(rp,"ArithmeticModulusOperator",()=>rN);class rN extends rA{apply(e,t){return this.nullCheck(e,t,tB.MOD),e%t}}var rf={};m(rf,"ArithmeticMultiplicationOperator",()=>r_);class r_ extends rA{apply(e,t){this.nullCheck(e,t,tB.MULTIPLICATION);let r="string"==typeof e,n=typeof t;if(r||"string"===n){let n=r?e:t,s=r?t:e,a="",i=s<0,o=Math.floor(s=Math.abs(s));for(;o-- >0;)a+=n;let E=Math.floor(n.length*(s-Math.floor(s)));if(E<0&&(E=-E),0!=E&&(a+=n.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 rM={};m(rM,"ArithmeticSubtractionOperator",()=>rS);class rS extends rA{apply(e,t){return this.nullCheck(e,t,tB.SUBTRACTION),e-t}}var rO={};m(rO,"ArrayOperator",()=>rw);class rw extends rA{apply(e,t){if(!e)throw new tr("Cannot apply array operator on a null value");if(!t)throw new tr("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new tr(ec.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new tr(ec.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var rI={};m(rI,"BitwiseAndOperator",()=>rP);class rP extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_AND),e&t}}var rd={};m(rd,"BitwiseLeftShiftOperator",()=>ry);class ry extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_LEFT_SHIFT),e<<t}}var rx={};m(rx,"BitwiseOrOperator",()=>rL);class rL extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_OR),e|t}}var rv={};m(rv,"BitwiseRightShiftOperator",()=>rU);class rU extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_RIGHT_SHIFT),e>>t}}var rV={};m(rV,"BitwiseUnsignedRightShiftOperator",()=>rC);class rC extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var rD={};m(rD,"BitwiseXorOperator",()=>rG);class rG extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_XOR),e^t}}var rb={};m(rb,"LogicalAndOperator",()=>rF);class rF extends rA{apply(e,t){return!!e&&""!==e&&!!t&&""!==t}}var rB={};m(rB,"LogicalEqualOperator",()=>rY);class rY extends rA{apply(e,t){return ef(e,t)}}var rH={};m(rH,"LogicalGreaterThanEqualOperator",()=>rk);class rk extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare >= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>=n.getT2()}}var r$={};m(r$,"LogicalGreaterThanOperator",()=>rj);class rj extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare > with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>n.getT2()}}var rW={};m(rW,"LogicalLessThanEqualOperator",()=>rX);class rX extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare <= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<=n.getT2()}}var rJ={};m(rJ,"LogicalLessThanOperator",()=>rq);class rq extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare < with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<n.getT2()}}var rz={};m(rz,"LogicalNotEqualOperator",()=>rK);class rK extends rA{apply(e,t){return!ef(e,t)}}var rQ={};m(rQ,"LogicalOrOperator",()=>rZ);class rZ extends rA{apply(e,t){return!!e&&""!==e||!!t&&""!==t}}var r0={};m(r0,"ObjectOperator",()=>r1);class r1 extends rA{apply(e,t){if(!e)throw new tr("Cannot apply array operator on a null value");if(!t)throw new tr("Cannot retrive null property value");let r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new tr(ec.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var r2={};m(r2,"ArithmeticUnaryMinusOperator",()=>r4);var r9={};m(r9,"UnaryOperator",()=>r3);class r3{nullCheck(e,t){if(_(e))throw new tr(ec.format("$ cannot be applied to a null value",t.getOperatorName()))}}class r4 extends r3{apply(e){return this.nullCheck(e,tB.UNARY_MINUS),tn.findPrimitiveNumberType(e),-e}}var r5={};m(r5,"ArithmeticUnaryPlusOperator",()=>r6);class r6 extends r3{apply(e){return this.nullCheck(e,tB.UNARY_PLUS),tn.findPrimitiveNumberType(e),e}}var r7={};m(r7,"BitwiseComplementOperator",()=>r8);class r8 extends r3{apply(e){this.nullCheck(e,tB.UNARY_BITWISE_COMPLEMENT);let t=tn.findPrimitiveNumberType(e);if(t.getT1()!=i.INTEGER&&t.getT1()!=i.LONG)throw new tr(ec.format("Unable to apply bitwise operator on $",e));return~e}}var ne={};m(ne,"LogicalNotOperator",()=>nt);class nt extends r3{apply(e){return!e&&""!==e}}var nr={};m(nr,"LiteralTokenValueExtractor",()=>ns);const nn=new Map([["true",!0],["false",!1],["null",void 0],["undefined",void 0]]);class ns extends tk{static{this.INSTANCE=new ns}getValueInternal(e){if(!eM.isNullOrBlank(e))return(e=e.trim(),nn.has(e))?nn.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 tV(e,ec.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new tV(e,ec.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 na={},ni={};m(ni,"ConditionalTernaryOperator",()=>nE);class no{nullCheck(e,t,r,n){if(_(e)||_(t)||_(r))throw new tr(ec.format("$ cannot be applied to a null value",n.getOperatorName()))}}class nE extends no{apply(e,t,r){return e?t:r}}R(na,ni);class nu extends tk{static{this.PREFIX="_internal."}addValue(e,t){this.values.set(e,t)}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.values.get(r))}getPrefix(){return nu.PREFIX}getStore(){}constructor(...e){super(...e),this.values=new Map}}class nA{static{this.UNARY_OPERATORS_MAP=new Map([[tB.UNARY_BITWISE_COMPLEMENT,new r8],[tB.UNARY_LOGICAL_NOT,new nt],[tB.UNARY_MINUS,new r4],[tB.UNARY_PLUS,new r6]])}static{this.TERNARY_OPERATORS_MAP=new Map([[tB.CONDITIONAL_TERNARY_OPERATOR,new nE]])}static{this.BINARY_OPERATORS_MAP=new Map([[tB.ADDITION,new rR],[tB.DIVISION,new rg],[tB.INTEGER_DIVISION,new rc],[tB.MOD,new rN],[tB.MULTIPLICATION,new r_],[tB.SUBTRACTION,new rS],[tB.BITWISE_AND,new rP],[tB.BITWISE_LEFT_SHIFT,new ry],[tB.BITWISE_OR,new rL],[tB.BITWISE_RIGHT_SHIFT,new rU],[tB.BITWISE_UNSIGNED_RIGHT_SHIFT,new rC],[tB.BITWISE_XOR,new rG],[tB.AND,new rF],[tB.EQUAL,new rY],[tB.GREATER_THAN,new rj],[tB.GREATER_THAN_EQUAL,new rk],[tB.LESS_THAN,new rq],[tB.LESS_THAN_EQUAL,new rX],[tB.OR,new rZ],[tB.NOT_EQUAL,new rK],[tB.NULLISH_COALESCING_OPERATOR,new rT],[tB.ARRAY_OPERATOR,new rw],[tB.OBJECT_OPERATOR,new r1]])}static{this.UNARY_OPERATORS_MAP_KEY_SET=new Set(nA.UNARY_OPERATORS_MAP.keys())}constructor(e){this.internalTokenValueExtractor=new nu,e instanceof tY?(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,n=0,s=new ep;for(;n<e.length-1;){if("{"==e.charAt(n)&&"{"==e.charAt(n+1))0==r&&s.push(new ew(n+2,-1)),r++,n++;else if("}"==e.charAt(n)&&"}"==e.charAt(n+1)){if(--r<0)throw new tV(e,"Expecting {{ nesting path operator to be started before closing");0==r&&s.push(s.pop().setT2(n)),n++}n++}let a=this.replaceNestingExpression(e,t,s);return new ew(a,new tY(a))}replaceNestingExpression(e,t,r){let n=e;for(let s of r.toArray()){if(-1==s.getT2())throw new tV(e,"Expecting }} nesting path operator to be closed");let r=new nA(n.substring(s.getT1(),s.getT2())).evaluate(t);n=n.substring(0,s.getT1()-2)+r+n.substring(s.getT2()+2)}return n}getExpression(){return this.exp||(this.exp=new tY(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),n=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),s=n.pop();if(nA.UNARY_OPERATORS_MAP_KEY_SET.has(e))n.push(this.applyUnaryOperation(e,this.getValueFromToken(t,s)));else if(e==tB.OBJECT_OPERATOR||e==tB.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,n,e,s);else if(e==tB.CONDITIONAL_TERNARY_OPERATOR){let r=n.pop(),a=n.pop(),i=this.getValueFromToken(t,a),o=this.getValueFromToken(t,r),E=this.getValueFromToken(t,s);n.push(this.applyTernaryOperation(e,i,o,E))}else{let r=n.pop(),a=this.getValueFromToken(t,r),i=this.getValueFromToken(t,s);n.push(this.applyBinaryOperation(e,a,i))}}if(n.isEmpty())throw new tr(ec.format("Expression : $ evaluated to null",e));if(1!=n.size())throw new tr(ec.format("Expression : $ evaluated multiple values $",e,n));let s=n.get(0);if(s instanceof tb)return s.getElement();if(!(s instanceof tY))return this.getValueFromToken(t,s);throw new tr(ec.format("Expression : $ evaluated to $",e,n.get(0)))}processObjectOrArrayOperator(e,t,r,n,s){let a=new ep,i=new ep;if(!n||!s)return;do i.push(n),s instanceof tY?a.push(new tb(s.toString(),this.evaluateExpression(s,e))):s&&a.push(s),s=r.isEmpty()?void 0:r.pop(),n=t.isEmpty()?void 0:t.pop();while(n==tB.OBJECT_OPERATOR||n==tB.ARRAY_OPERATOR)s&&(s instanceof tY?a.push(new tb(s.toString(),this.evaluateExpression(s,e))):a.push(s)),n&&t.push(n);let o=a.pop();if(o instanceof tb&&"object"==typeof o.getTokenValue()){let e=new Date().getTime()+""+Math.round(1e3*Math.random());this.internalTokenValueExtractor.addValue(e,o.getTokenValue()),o=new tD(nu.PREFIX+e)}let E=new tv(o instanceof tb?o.getTokenValue():o.toString());for(;!a.isEmpty();)o=a.pop(),n=i.pop(),E.append(n.getOperator()).append(o instanceof tb?o.getTokenValue():o.toString()),n==tB.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 tb(u,this.getValue(u,e)));else{let e;try{e=ns.INSTANCE.getValue(u)}catch(t){e=u}r.push(new tb(u,e))}}applyTernaryOperation(e,t,r,n){let s=nA.TERNARY_OPERATORS_MAP.get(e);if(!s)throw new tV(this.expression,ec.format("No operator found to evaluate $",this.getExpression()));return new tb(e.toString(),s.apply(t,r,n))}applyBinaryOperation(e,t,r){let n=typeof t,s=typeof r,a=nA.BINARY_OPERATORS_MAP.get(e);if(("object"===n||"object"===s)&&e!==tB.EQUAL&&e!==tB.NOT_EQUAL&&e!==tB.NULLISH_COALESCING_OPERATOR&&e!==tB.AND&&e!==tB.OR)throw new tV(this.expression,ec.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));if(!a)throw new tV(this.expression,ec.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new tb(e.toString(),a.apply(t,r))}applyUnaryOperation(e,t){let r=typeof t;if(e.getOperator()!=tB.NOT.getOperator()&&e.getOperator()!=tB.UNARY_LOGICAL_NOT.getOperator()&&("object"===r||Array.isArray(t)))throw new tV(this.expression,ec.format("The operator $ cannot be applied to $",e.getOperator(),t));let n=nA.UNARY_OPERATORS_MAP.get(e);if(!n)throw new tV(this.expression,ec.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new tb(e.toString(),n.apply(t))}getValueFromToken(e,t){return t instanceof tY?this.evaluateExpression(t,e):t instanceof tb?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):ns.INSTANCE.getValueFromExtractors(e,t)}}const nT="name",nl="value",nR=new eT("Set").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(nT,new Y().setName(nT).setType(L.of(i.STRING)).setMinLength(1),!1),X.ofEntry(nl,Y.ofAny(nl))])).setEvents(new Map([es.outputEventMapEntry(new Map)])),nm="value",ng="eventName",nh="results",nc=new eT("GenerateEvent").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(ng,Y.ofString(ng).setDefaultValue("output")),X.ofEntry(nh,Y.ofObject(nh).setProperties(new Map([["name",Y.ofString("name")],[nm,X.EXPRESSION]])),!0)])).setEvents(new Map([es.outputEventMapEntry(new Map)]));class np extends e3{static{this.CONDITION="condition"}static{this.SIGNATURE=new eT("If").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(np.CONDITION,Y.ofAny(np.CONDITION))])).setEvents(new Map([es.eventMapEntry(es.TRUE,new Map),es.eventMapEntry(es.FALSE,new Map),es.outputEventMapEntry(new Map)]))}getSignature(){return np.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(np.CONDITION);return new eu([ea.of(t||""===t?es.TRUE:es.FALSE,new Map),ea.outputOf(new Map)])}}const nN="stepName",nf=new eT("Break").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(nN,Y.of(nN,i.STRING))])).setEvents(new Map([es.outputEventMapEntry(new Map([]))])),n_="count",nM="value",nS="index",nO=new eT("CountLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(n_,Y.of(n_,i.INTEGER))])).setEvents(new Map([es.eventMapEntry(es.ITERATION,new Map([[nS,Y.of(nS,i.INTEGER)]])),es.outputEventMapEntry(new Map([[nM,Y.of(nM,i.INTEGER)]]))])),nw="source",nI="each",nP="index",nd="value",ny=new eT("ForEachLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(nw,Y.ofArray(nw,Y.ofAny(nw)))])).setEvents(new Map([es.eventMapEntry(es.ITERATION,new Map([[nP,Y.of(nP,i.INTEGER)],[nI,Y.ofAny(nI)]])),es.outputEventMapEntry(new Map([[nd,Y.of(nd,i.INTEGER)]]))])),nx="from",nL="step",nv="value",nU="index",nV=new eT("RangeLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(nx,Y.of(nx,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(0)),X.ofEntry("to",Y.of("to",i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(1)),X.ofEntry(nL,Y.of(nL,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(1).setNot(new Y().setConstant(0)))])).setEvents(new Map([es.eventMapEntry(es.ITERATION,new Map([[nU,Y.of(nU,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)]])),es.outputEventMapEntry(new Map([[nv,Y.of(nv,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)]]))])),nC="value",nD=new eT("Add").setNamespace(p.MATH).setParameters(new Map([[nC,new X(nC,Y.ofNumber(nC)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[nC,Y.ofNumber(nC)]]))])),nG="value",nb="value1",nF="value2",nB=[()=>new Map([[nG,new X(nG,Y.ofNumber(nG))]]),()=>new Map([[nb,new X(nb,Y.ofNumber(nb))],[nF,new X(nF,Y.ofNumber(nF))]])];class nY extends e3{constructor(e,t,r=1,...n){super(),n&&n.length||(n=[i.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new eT(e).setNamespace(p.MATH).setParameters(nB[r-1]()).setEvents(new Map([es.outputEventMapEntry(new Map([[nG,new Y().setType(L.of(...n)).setName(nG)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=tn.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?nG:nb)).getT2();return 2==this.parametersNumber&&(t=tn.findPrimitiveNumberType(e.getArguments()?.get(nF)).getT2()),new eu([ea.outputOf(new Map([[nG,this.mathFunction.call(this,r,t)]]))])}}const nH="value";class nk extends e3{static{this.SIGNATURE=new eT("Hypotenuse").setNamespace(p.MATH).setParameters(new Map([[nH,new X(nH,Y.ofNumber(nH)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[nH,new Y().setType(L.of(i.DOUBLE)).setName(nH)]]))]))}constructor(){super()}getSignature(){return nk.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nH);return new eu([ea.outputOf(new Map([[nH,Math.sqrt(t.reduce((e,t)=>e+=t*t,0))]]))])}}const n$="value",nj=new eT("Maximum").setNamespace(p.MATH).setParameters(new Map([[n$,new X(n$,Y.ofNumber(n$)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[n$,Y.ofNumber(n$)]]))])),nW="value",nX=new eT("Minimum").setNamespace(p.MATH).setParameters(new Map([[nW,new X(nW,Y.ofNumber(nW)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[nW,Y.ofNumber(nW)]]))])),nJ="value";class nq extends e3{static{this.SIGNATURE=new eT("Random").setNamespace(p.MATH).setEvents(new Map([es.outputEventMapEntry(q.of(nJ,Y.ofDouble(nJ)))]))}getSignature(){return nq.SIGNATURE}async internalExecute(e){return new eu([ea.outputOf(new Map([[nJ,Math.random()]]))])}}class nz extends e3{static{this.MIN_VALUE="minValue"}static{this.MAX_VALUE="maxValue"}static{this.VALUE="value"}constructor(e,t,r,n,s){super(),this.signature=new eT(e).setParameters(q.of(nz.MIN_VALUE,t,nz.MAX_VALUE,r)).setNamespace(p.MATH).setEvents(new Map([es.outputEventMapEntry(q.of(nz.VALUE,n))])),this.randomFunction=s}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nz.MIN_VALUE),r=e.getArguments()?.get(nz.MAX_VALUE),n=this.randomFunction(t,r);return new eu([ea.outputOf(new Map([[nz.VALUE,n]]))])}}const nK={Absolute:new nY("Absolute",e=>Math.abs(e),1,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE),ArcCosine:new nY("ArcCosine",e=>Math.acos(e)),ArcSine:new nY("ArcSine",e=>Math.asin(e)),ArcTangent:new nY("ArcTangent",e=>Math.atan(e)),Ceiling:new nY("Ceiling",e=>Math.ceil(e)),Cosine:new nY("Cosine",e=>Math.cos(e)),HyperbolicCosine:new nY("HyperbolicCosine",e=>Math.cosh(e)),CubeRoot:new nY("CubeRoot",e=>Math.cbrt(e)),Exponential:new nY("Exponential",e=>Math.exp(e)),ExponentialMinus1:new nY("ExponentialMinus1",e=>Math.expm1(e)),Floor:new nY("Floor",e=>Math.floor(e)),LogNatural:new nY("LogNatural",e=>Math.log(e)),Log10:new nY("Log10",e=>Math.log10(e)),Round:new nY("Round",e=>Math.round(e),1,i.INTEGER,i.LONG),Sine:new nY("Sine",e=>Math.sin(e)),HyperbolicSine:new nY("HyperbolicSine",e=>Math.sinh(e)),Tangent:new nY("Tangent",e=>Math.tan(e)),HyperbolicTangent:new nY("HyperbolicTangent",e=>Math.tanh(e)),ToDegrees:new nY("ToDegrees",e=>Math.PI/180*e),ToRadians:new nY("ToRadians",e=>180/Math.PI*e),SquareRoot:new nY("SquareRoot",e=>Math.sqrt(e)),ArcTangent2:new nY("ArcTangent2",(e,t)=>Math.atan2(e,t),2),Power:new nY("Power",(e,t)=>Math.pow(e,t),2),Add:new class extends e3{getSignature(){return nD}async internalExecute(e){let t=e.getArguments()?.get(nC);return new eu([ea.outputOf(new Map([[nC,t.reduce((e,t)=>e+=t,0)]]))])}},Hypotenuse:new nk,Maximum:new class extends e3{getSignature(){return nj}async internalExecute(e){let t=e.getArguments()?.get(n$);return new eu([ea.outputOf(new Map([[n$,t.reduce((e,t)=>!e&&0!==e||t>e?t:e)]]))])}},Minimum:new class extends e3{getSignature(){return nX}async internalExecute(e){let t=e.getArguments()?.get(nW);return new eu([ea.outputOf(new Map([[nW,t.reduce((e,t)=>!e&&0!==e||t<e?t:e)]]))])}},Random:new nq,RandomFloat:new nz("RandomFloat",X.of(nz.MIN_VALUE,Y.ofFloat(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofFloat(nz.MAX_VALUE).setDefaultValue(0x7fffffff)),Y.ofFloat(nz.VALUE),(e,t)=>Math.random()*(t-e)+e),RandomInt:new nz("RandomInt",X.of(nz.MIN_VALUE,Y.ofInteger(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofInteger(nz.MAX_VALUE).setDefaultValue(0x7fffffff)),Y.ofInteger(nz.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomLong:new nz("RandomLong",X.of(nz.MIN_VALUE,Y.ofLong(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofLong(nz.MAX_VALUE).setDefaultValue(Number.MAX_SAFE_INTEGER)),Y.ofLong(nz.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomDouble:new nz("RandomDouble",X.of(nz.MIN_VALUE,Y.ofDouble(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofDouble(nz.MAX_VALUE).setDefaultValue(Number.MAX_VALUE)),Y.ofDouble(nz.VALUE),(e,t)=>Math.random()*(t-e)+e)},nQ=Object.values(nK).map(e=>e.getSignature().getFullName());class nZ{async find(e,t){return e!=p.MATH?Promise.resolve(void 0):Promise.resolve(nK[t])}async filter(e){return Promise.resolve(nQ.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class n0 extends e3{static{this.SOURCE="source"}static{this.SCHEMA="schema"}static{this.VALUE="value"}static{this.CONVERSION_MODE="conversionMode"}getSignature(){return new eT("ObjectConvert").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n0.SOURCE,Y.ofAny(n0.SCHEMA)),X.ofEntry(n0.SCHEMA,Y.SCHEMA,!1,o.CONSTANT),X.ofEntry(n0.CONVERSION_MODE,Y.ofString(n0.CONVERSION_MODE).setEnums(eJ()))])).setEvents(new Map([es.outputEventMapEntry(q.of(n0.VALUE,Y.ofAny(n0.VALUE)))]))}internalExecute(e){let t=e.getArguments()?.get(n0.SOURCE),r=Y.from(e?.getArguments()?.get(n0.SCHEMA));if(!r)throw new eE("Schema is not supplied.");let n=eX(e.getArguments()?.get(n0.CONVERSION_MODE))||u.STRICT;return this.convertToSchema(r,e.getSchemaRepository(),t,n)}async convertToSchema(e,t,r,n){try{return new eu([ea.outputOf(q.of(n0.VALUE,e9.validate([],e,t,r,!0,n)))])}catch(e){throw new eE(e?.message)}}}const n1="value",n2="source",n9="source";class n3 extends e3{constructor(e,t){super(),this.signature=new eT(e).setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n9,Y.ofAny(n9))])).setEvents(new Map([es.outputEventMapEntry(new Map([["value",t]]))]))}getSignature(){return this.signature}}const n4="value",n5="value",n6="value",n7="source",n8="overwrite",se="deleteKeyOnNull",st="value",sr={ObjectValues:new class extends n3{constructor(){super("ObjectValues",Y.ofArray(st,Y.ofAny(st)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[st,[]]]))]);let r=Object.entries(tu(t)).sort((e,t)=>e[0].localeCompare(t[0])).map(e=>e[1]);return new eu([ea.outputOf(new Map([[st,r]]))])}},ObjectKeys:new class extends n3{constructor(){super("ObjectKeys",Y.ofArray(n5,Y.ofString(n5)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[n5,[]]]))]);let r=Object.keys(tu(t)).sort((e,t)=>e.localeCompare(t));return new eu([ea.outputOf(new Map([[n5,r]]))])}},ObjectEntries:new class extends n3{constructor(){super("ObjectEntries",Y.ofArray(n4,Y.ofArray("tuple",Y.ofString("key"),Y.ofAny("value"))))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[n4,[]]]))]);let r=Object.entries(tu(t)).sort((e,t)=>e[0].localeCompare(t[0]));return new eu([ea.outputOf(new Map([[n4,r]]))])}},ObjectDeleteKey:new class extends e3{constructor(){super(),this.signature=new eT("ObjectDeleteKey").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n2,Y.ofAny(n2)),X.ofEntry("key",Y.ofString("key"))])).setEvents(new Map([es.outputEventMapEntry(new Map([[n1,Y.ofAny(n1)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(n2),r=e.getArguments()?.get("key");return _(t)?new eu([ea.outputOf(new Map([[n1,void 0]]))]):(t=tu(t),delete t[r],new eu([ea.outputOf(new Map([[n1,t]]))]))}},ObjectPutValue:new class extends e3{constructor(){super(),this.signature=new eT("ObjectPutValue").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n7,Y.ofObject(n7)),X.ofEntry("key",Y.ofString("key")),X.ofEntry(n6,Y.ofAny(n6)),X.ofEntry(n8,Y.ofBoolean(n8).setDefaultValue(!0)),X.ofEntry(se,Y.ofBoolean(se).setDefaultValue(!1))])).setEvents(new Map([es.outputEventMapEntry(new Map([[n6,Y.ofObject(n6)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(n7),r=e.getArguments()?.get("key"),n=e.getArguments()?.get(n6),s=e.getArguments()?.get(n8),a=e.getArguments()?.get(se),i=new t$(t,"Data.");return i.setValue(r,n,s,a),new eu([ea.outputOf(new Map([[n6,i.getStore()]]))])}},ObjectConvert:new n0},sn=Object.values(sr).map(e=>e.getSignature().getFullName());class ss{async find(e,t){return e!=p.SYSTEM_OBJECT?Promise.resolve(void 0):Promise.resolve(sr[t])}async filter(e){return Promise.resolve(sn.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sa extends e3{static{this.VALUES="values"}static{this.STREAM="stream"}static{this.LOG="LOG"}static{this.ERROR="ERROR"}static{this.SIGNATURE=new eT("Print").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(sa.VALUES,Y.ofAny(sa.VALUES),!0),X.ofEntry(sa.STREAM,Y.ofString(sa.STREAM).setEnums([sa.LOG,sa.ERROR]).setDefaultValue(sa.LOG))])).setEvents(new Map([es.outputEventMapEntry(new Map)]))}getSignature(){return sa.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(sa.VALUES),r=e.getArguments()?.get(sa.STREAM);return(r===sa.LOG?console?.log:console?.error)?.(...t),new eu([ea.outputOf(new Map)])}}class si extends e3{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 X(si.PARAMETER_STRING_NAME,Y.ofString(si.PARAMETER_STRING_NAME))}static{this.PARAMETER_SECOND_STRING=new X(si.PARAMETER_SECOND_STRING_NAME,Y.ofString(si.PARAMETER_SECOND_STRING_NAME))}static{this.PARAMETER_THIRD_STRING=new X(si.PARAMETER_THIRD_STRING_NAME,Y.ofString(si.PARAMETER_THIRD_STRING_NAME))}static{this.PARAMETER_INDEX=new X(si.PARAMETER_INDEX_NAME,Y.ofInteger(si.PARAMETER_INDEX_NAME))}static{this.PARAMETER_SECOND_INDEX=new X(si.PARAMETER_SECOND_INDEX_NAME,Y.ofInteger(si.PARAMETER_SECOND_INDEX_NAME))}static{this.PARAMETER_SEARCH_STRING=new X(si.PARAMETER_SEARCH_STRING_NAME,Y.ofString(si.PARAMETER_STRING_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofString(si.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofBoolean(si.EVENT_RESULT_NAME)))}static{this.EVENT_INT=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofInteger(si.EVENT_RESULT_NAME)))}static{this.EVENT_ARRAY=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofArray(si.EVENT_RESULT_NAME)))}constructor(e,t,r,...n){super();let s=new Map;n.forEach(e=>s.set(e.getParameterName(),e)),this.signature=new eT(t).setNamespace(e).setParameters(s).setEvents(q.of(r.getName(),r))}getSignature(){return this.signature}static ofEntryStringStringAndBooleanOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SEARCH_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n)))])}}(p.STRING,e,si.EVENT_BOOLEAN,si.PARAMETER_STRING,si.PARAMETER_SEARCH_STRING)]}static ofEntryStringIntegerAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_INDEX_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING,si.PARAMETER_INDEX)]}static ofEntryStringStringAndIntegerOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SEARCH_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n)))])}}(p.STRING,e,si.EVENT_INT,si.PARAMETER_STRING,si.PARAMETER_SEARCH_STRING)]}static ofEntryStringAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING)]}static ofEntryStringAndBooleanOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,si.EVENT_BOOLEAN,si.PARAMETER_STRING)]}static ofEntryStringStringIntegerAndIntegerOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SEARCH_STRING_NAME),s=e?.getArguments()?.get(si.PARAMETER_INDEX_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n,s)))])}}(p.STRING,e,si.EVENT_INT,si.PARAMETER_STRING,si.PARAMETER_SEARCH_STRING,si.PARAMETER_INDEX)]}static ofEntryStringIntegerIntegerAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_INDEX_NAME),s=e?.getArguments()?.get(si.PARAMETER_SECOND_INDEX_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n,s)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING,si.PARAMETER_INDEX,si.PARAMETER_SECOND_INDEX)]}static ofEntryStringStringStringAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SECOND_STRING_NAME),s=e?.getArguments()?.get(si.PARAMETER_THIRD_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n,s)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING,si.PARAMETER_SECOND_STRING,si.PARAMETER_THIRD_STRING)]}static ofEntryStringAndIntegerOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,si.EVENT_INT,si.PARAMETER_STRING)]}}class so extends e3{static{this.VALUE="value"}static{this.SCHEMA=new Y().setName(so.VALUE).setType(new x(i.STRING))}static{this.SIGNATURE=new eT("Concatenate").setNamespace(p.STRING).setParameters(new Map([[so.VALUE,new X(so.VALUE,so.SCHEMA).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[so.VALUE,Y.ofString(so.VALUE)]]))]))}constructor(){super()}getSignature(){return so.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(so.VALUE),r="";return t.reduce((e,t)=>r=e+t,r),new eu([ea.outputOf(new Map([[so.VALUE,r]]))])}}class sE extends e3{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 X(sE.PARAMETER_STRING_NAME,Y.ofString(sE.PARAMETER_STRING_NAME)),this.PARAMETER_AT_START=new X(sE.PARAMETER_AT_START_NAME,Y.ofInteger(sE.PARAMETER_AT_START_NAME)),this.PARAMETER_AT_END=new X(sE.PARAMETER_AT_END_NAME,Y.ofInteger(sE.PARAMETER_AT_END_NAME)),this.EVENT_STRING=new es(es.OUTPUT,new Map([[sE.EVENT_RESULT_NAME,Y.ofString(sE.EVENT_RESULT_NAME)]])),this.signature=new eT("DeleteForGivenLength").setNamespace(p.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(sE.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(sE.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(sE.PARAMETER_AT_END_NAME);if(n>=r){let e="";return e+=t.substring(0,r)+t.substring(n),new eu([ea.outputOf(new Map([[sE.EVENT_RESULT_NAME,e.toString()]]))])}return new eu([ea.outputOf(new Map([[sE.EVENT_RESULT_NAME,t]]))])}}class su extends e3{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(su.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(su.PARAMETER_AT_POSITION_NAME),n=e?.getArguments()?.get(su.PARAMETER_INSERT_STRING_NAME),s="";return s+=t.substring(0,r)+n+t.substring(r),new eu([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,s]]))])}constructor(...e){super(...e),this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new X(su.PARAMETER_STRING_NAME,Y.ofString(su.PARAMETER_STRING_NAME)),this.PARAMETER_AT_POSITION=new X(su.PARAMETER_AT_POSITION_NAME,Y.ofInteger(su.PARAMETER_AT_POSITION_NAME)),this.PARAMETER_INSERT_STRING=new X(su.PARAMETER_INSERT_STRING_NAME,Y.ofString(su.PARAMETER_INSERT_STRING_NAME)),this.EVENT_STRING=new es(es.OUTPUT,new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]])),this.signature=new eT("InsertAtGivenPosition").setNamespace(p.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([es.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]))]))}}class sA extends e3{static{this.PARAMETER_REGEX_NAME="regex"}static{this.PARAMETER_STRING_NAME="string"}static{this.EVENT_RESULT_NAME="result"}static{this.signature=new eT("Matches").setNamespace(p.STRING).setParameters(q.ofEntries(q.entry(...X.ofEntry(sA.PARAMETER_REGEX_NAME,Y.ofString(sA.PARAMETER_REGEX_NAME))),q.entry(...X.ofEntry(sA.PARAMETER_STRING_NAME,Y.ofString(sA.PARAMETER_STRING_NAME))))).setEvents(q.ofEntries(q.entry(...es.outputEventMapEntry(new Map([[sA.EVENT_RESULT_NAME,Y.ofBoolean(sA.EVENT_RESULT_NAME)]])))))}getSignature(){return sA.signature}async internalExecute(e){let t=e.getArguments()?.get(sA.PARAMETER_REGEX_NAME),r=e.getArguments()?.get(sA.PARAMETER_STRING_NAME);return new eu([ea.outputOf(new Map([[sA.EVENT_RESULT_NAME,!!r.match(t)?.length]]))])}}class sT extends e3{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 X(sT.PARAMETER_STRING_NAME,Y.ofString(sT.PARAMETER_STRING_NAME))}static{this.PARAMETER_POSTPAD_STRING=new X(sT.PARAMETER_POSTPAD_STRING_NAME,Y.ofString(sT.PARAMETER_POSTPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(sT.PARAMETER_LENGTH_NAME,Y.ofInteger(sT.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sT.EVENT_RESULT_NAME,Y.ofString(sT.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new eT("PostPad").setNamespace(p.STRING).setParameters(new Map([[sT.PARAMETER_STRING.getParameterName(),sT.PARAMETER_STRING],[sT.PARAMETER_POSTPAD_STRING.getParameterName(),sT.PARAMETER_POSTPAD_STRING],[sT.PARAMETER_LENGTH.getParameterName(),sT.PARAMETER_LENGTH]])).setEvents(new Map([[sT.EVENT_STRING.getName(),sT.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sT.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(sT.PARAMETER_POSTPAD_STRING_NAME),n=e.getArguments()?.get(sT.PARAMETER_LENGTH_NAME),s="",a=r.length;for(s+=t;a<=n;)s+=r,a+=r.length;return s.length-t.length<n&&(s+=r.substring(0,n-(s.length-t.length))),new eu([ea.outputOf(new Map([[sT.EVENT_RESULT_NAME,s.toString()]]))])}}class sl extends e3{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 X(sl.PARAMETER_STRING_NAME,Y.ofString(sl.PARAMETER_STRING_NAME))}static{this.PARAMETER_PREPAD_STRING=new X(sl.PARAMETER_PREPAD_STRING_NAME,Y.ofString(sl.PARAMETER_PREPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(sl.PARAMETER_LENGTH_NAME,Y.ofInteger(sl.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sl.EVENT_RESULT_NAME,Y.ofString(sl.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("PrePad").setNamespace(p.STRING).setParameters(new Map([[sl.PARAMETER_STRING.getParameterName(),sl.PARAMETER_STRING],[sl.PARAMETER_PREPAD_STRING.getParameterName(),sl.PARAMETER_PREPAD_STRING],[sl.PARAMETER_LENGTH.getParameterName(),sl.PARAMETER_LENGTH]])).setEvents(new Map([[sl.EVENT_STRING.getName(),sl.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(sl.PARAMETER_STRING_NAME),r=e.getArguments()?.get(sl.PARAMETER_PREPAD_STRING_NAME),n=e.getArguments()?.get(sl.PARAMETER_LENGTH_NAME),s="",a=r.length;for(;a<=n;)s+=r,a+=r.length;return s.length<n&&(s+=r.substring(0,n-s.length)),s+=t,new eu([ea.outputOf(new Map([[sl.EVENT_RESULT_NAME,s]]))])}}class sR extends e3{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 X(sR.PARAMETER_STRING_NAME,Y.ofString(sR.PARAMETER_STRING_NAME))}static{this.PARAMETER_OTHER_STRING=new X(sR.PARAMETER_OTHER_STRING_NAME,Y.ofString(sR.PARAMETER_OTHER_STRING_NAME))}static{this.PARAMETER_FIRST_OFFSET=new X(sR.PARAMETER_FIRST_OFFSET_NAME,Y.ofInteger(sR.PARAMETER_FIRST_OFFSET_NAME))}static{this.PARAMETER_SECOND_OFFSET=new X(sR.PARAMETER_SECOND_OFFSET_NAME,Y.ofInteger(sR.PARAMETER_SECOND_OFFSET_NAME))}static{this.PARAMETER_INTEGER=new X(sR.PARAMETER_INTEGER_NAME,Y.ofInteger(sR.PARAMETER_INTEGER_NAME))}static{this.PARAMETER_BOOLEAN=new X(sR.PARAMETER_BOOLEAN_NAME,Y.ofBoolean(sR.PARAMETER_BOOLEAN_NAME))}static{this.EVENT_BOOLEAN=new es(es.OUTPUT,new Map([[sR.EVENT_RESULT_NAME,Y.ofBoolean(sR.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("RegionMatches").setNamespace(p.STRING).setParameters(new Map([[sR.PARAMETER_STRING.getParameterName(),sR.PARAMETER_STRING],[sR.PARAMETER_BOOLEAN.getParameterName(),sR.PARAMETER_BOOLEAN],[sR.PARAMETER_FIRST_OFFSET.getParameterName(),sR.PARAMETER_FIRST_OFFSET],[sR.PARAMETER_OTHER_STRING.getParameterName(),sR.PARAMETER_OTHER_STRING],[sR.PARAMETER_SECOND_OFFSET.getParameterName(),sR.PARAMETER_SECOND_OFFSET],[sR.PARAMETER_INTEGER.getParameterName(),sR.PARAMETER_INTEGER]])).setEvents(new Map([[sR.EVENT_BOOLEAN.getName(),sR.EVENT_BOOLEAN]]))}async internalExecute(e){let t=e.getArguments()?.get(sR.PARAMETER_STRING_NAME),r=e.getArguments()?.get(sR.PARAMETER_BOOLEAN_NAME),n=e.getArguments()?.get(sR.PARAMETER_FIRST_OFFSET_NAME),s=e?.getArguments()?.get(sR.PARAMETER_OTHER_STRING_NAME),a=e?.getArguments()?.get(sR.PARAMETER_SECOND_OFFSET_NAME),i=e.getArguments()?.get(sR.PARAMETER_INTEGER_NAME),o=!1;return o=!(n<0)&&!(a<0)&&!(n+i>t.length)&&!(a+i>s.length)&&(r?(t=t.substring(n,n+i).toUpperCase())==s.substring(a,a+i).toUpperCase():(t=t.substring(n,n+i))==s.substring(a,i)),new eu([ea.outputOf(new Map([[sR.EVENT_RESULT_NAME,o]]))])}}class sm extends e3{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 X(sm.PARAMETER_STRING_NAME,Y.ofString(sm.PARAMETER_STRING_NAME))}static{this.PARAMETER_AT_START=new X(sm.PARAMETER_AT_START_NAME,Y.ofInteger(sm.PARAMETER_AT_START_NAME))}static{this.PARAMETER_AT_LENGTH=new X(sm.PARAMETER_AT_LENGTH_NAME,Y.ofInteger(sm.PARAMETER_AT_LENGTH_NAME))}static{this.PARAMETER_REPLACE_STRING=new X(sm.PARAMETER_REPLACE_STRING_NAME,Y.ofString(sm.PARAMETER_REPLACE_STRING_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sm.EVENT_RESULT_NAME,Y.ofString(sm.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new eT("ReplaceAtGivenPosition").setNamespace(p.STRING).setParameters(new Map([[sm.PARAMETER_STRING.getParameterName(),sm.PARAMETER_STRING],[sm.PARAMETER_AT_START.getParameterName(),sm.PARAMETER_AT_START],[sm.PARAMETER_AT_LENGTH.getParameterName(),sm.PARAMETER_AT_LENGTH],[sm.PARAMETER_REPLACE_STRING.getParameterName(),sm.PARAMETER_REPLACE_STRING]])).setEvents(new Map([[sm.EVENT_STRING.getName(),sm.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(sm.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(sm.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(sm.PARAMETER_AT_LENGTH_NAME);return e?.getArguments()?.get(sm.PARAMETER_REPLACE_STRING_NAME),t.length,r<n&&(t.substring(0,r),t.substring(r+n)),new eu([ea.outputOf(new Map([[sm.EVENT_RESULT_NAME,t]]))])}}class sg extends e3{constructor(){super(),this.VALUE="value",this.SIGNATURE=new eT("Reverse").setNamespace(p.STRING).setParameters(new Map([[this.VALUE,new X(this.VALUE,Y.ofString(this.VALUE)).setVariableArgument(!1)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[this.VALUE,new Y().setType(L.of(i.STRING)).setName(this.VALUE)]]))]))}getSignature(){return this.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(this.VALUE),r=t.length-1,n="";for(;r>=0;)n+=t.charAt(r--);return new eu([ea.outputOf(q.of(this.VALUE,n))])}}class sh extends e3{getSignature(){return new eT("Split").setNamespace(p.STRING).setParameters(new Map([[this.PARAMETER_STRING_NAME,this.PARAMETER_STRING],[this.PARAMETER_SPLIT_STRING_NAME,this.PARAMETER_SPLIT_STRING]])).setEvents(new Map([es.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,Y.ofArray(this.EVENT_RESULT_NAME)]]))]))}constructor(){super(),this.PARAMETER_STRING_NAME="string",this.PARAMETER_SPLIT_STRING_NAME="searchString",this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new X(this.PARAMETER_STRING_NAME,Y.ofString(this.PARAMETER_STRING_NAME)),this.PARAMETER_SPLIT_STRING=new X(this.PARAMETER_SPLIT_STRING_NAME,Y.ofString(this.PARAMETER_SPLIT_STRING_NAME)),this.EVENT_ARRAY=new es(es.OUTPUT,q.of(this.EVENT_RESULT_NAME,Y.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 eu([ea.outputOf(q.of(this.EVENT_RESULT_NAME,t.split(r)))])}}class sc extends e3{getSignature(){return new eT("ToString").setNamespace(p.STRING).setParameters(new Map([[this.PARAMETER_INPUT_ANYTYPE.getParameterName(),this.PARAMETER_INPUT_ANYTYPE]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}constructor(){super(),this.PARAMETER_INPUT_ANYTYPE_NAME="anytype",this.EVENT_RESULT_NAME="result",this.PARAMETER_INPUT_ANYTYPE=new X(this.PARAMETER_INPUT_ANYTYPE_NAME,Y.ofAny(this.PARAMETER_INPUT_ANYTYPE_NAME)),this.EVENT_STRING=new es(es.OUTPUT,new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]))}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 eu([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,r]]))])}}class sp extends e3{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new X(sp.PARAMETER_STRING_NAME,Y.ofString(sp.PARAMETER_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(sp.PARAMETER_LENGTH_NAME,Y.ofInteger(sp.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sp.EVENT_RESULT_NAME,Y.ofString(sp.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("TrimTo").setNamespace(p.STRING).setParameters(new Map([[sp.PARAMETER_STRING.getParameterName(),sp.PARAMETER_STRING],[sp.PARAMETER_LENGTH.getParameterName(),sp.PARAMETER_LENGTH]])).setEvents(new Map([[sp.EVENT_STRING.getName(),sp.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(sp.PARAMETER_STRING_NAME),r=e.getArguments()?.get(sp.PARAMETER_LENGTH_NAME);return new eu([ea.outputOf(new Map([[sp.EVENT_RESULT_NAME,t.substring(0,r)]]))])}}class sN{static{this.repoMap=q.ofArrayEntries(si.ofEntryStringAndStringOutput("Trim",e=>e.trim()),si.ofEntryStringAndStringOutput("TrimStart",e=>e.trimStart()),si.ofEntryStringAndStringOutput("TrimEnd",e=>e.trimEnd()),si.ofEntryStringAndIntegerOutput("Length",e=>e.length),si.ofEntryStringStringAndIntegerOutput("Frequency",(e,t)=>{let r=0,n=e.indexOf(t);for(;-1!=n;)r++,n=e.indexOf(t,n+1);return r}),si.ofEntryStringAndStringOutput("LowerCase",e=>e.toLocaleLowerCase()),si.ofEntryStringAndStringOutput("UpperCase",e=>e.toUpperCase()),si.ofEntryStringAndBooleanOutput("IsBlank",e=>""===e.trim()),si.ofEntryStringAndBooleanOutput("IsEmpty",e=>""===e),si.ofEntryStringStringAndBooleanOutput("Contains",(e,t)=>-1!=e.indexOf(t)),si.ofEntryStringStringAndBooleanOutput("EndsWith",(e,t)=>e.endsWith(t)),si.ofEntryStringStringAndBooleanOutput("StartsWith",(e,t)=>e.startsWith(t)),si.ofEntryStringStringAndBooleanOutput("EqualsIgnoreCase",(e,t)=>e.toUpperCase()==t.toUpperCase()),si.ofEntryStringStringAndBooleanOutput("Matches",(e,t)=>new RegExp(t).test(e)),si.ofEntryStringStringAndIntegerOutput("IndexOf",(e,t)=>e.indexOf(t)),si.ofEntryStringStringAndIntegerOutput("LastIndexOf",(e,t)=>e.lastIndexOf(t)),si.ofEntryStringIntegerAndStringOutput("Repeat",(e,t)=>e.repeat(t)),si.ofEntryStringStringIntegerAndIntegerOutput("IndexOfWithStartPoint",(e,t,r)=>e.indexOf(t,r)),si.ofEntryStringStringIntegerAndIntegerOutput("LastIndexOfWithStartPoint",(e,t,r)=>e.lastIndexOf(t,r)),si.ofEntryStringStringStringAndStringOutput("Replace",(e,t,r)=>e.replaceAll(t,r)),si.ofEntryStringStringStringAndStringOutput("ReplaceFirst",(e,t,r)=>e.replace(t,r)),si.ofEntryStringIntegerIntegerAndStringOutput("SubString",(e,t,r)=>e.substring(t,r)),et(new so),et(new sE),et(new su),et(new sT),et(new sl),et(new sR),et(new sm),et(new sg),et(new sh),et(new sc),et(new sp),et(new sA))}static{this.filterableNames=Array.from(sN.repoMap.values()).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=p.STRING?Promise.resolve(void 0):Promise.resolve(sN.repoMap.get(t))}async filter(e){return Promise.resolve(sN.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sf extends e3{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 X(sf.PARAMETER_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_ONE=new X(sf.PARAMETER_TIMESTAMP_NAME_ONE,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_TWO=new X(sf.PARAMETER_TIMESTAMP_NAME_TWO,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_VARIABLE_UNIT=new X(sf.PARAMETER_UNIT_NAME,Y.ofRef(p.DATE+".Timeunit")).setVariableArgument(!0)}static{this.PARAMETER_UNIT=new X(sf.PARAMETER_UNIT_NAME,Y.ofRef(p.DATE+".Timeunit"))}static{this.PARAMETER_NUMBER=new X(sf.PARAMETER_NUMBER_NAME,Y.ofInteger(sf.PARAMETER_NUMBER_NAME))}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_TIMESTAMP_NAME="isoTimeStamp"}static{this.EVENT_INT=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofInteger(sf.EVENT_RESULT_NAME)))}static{this.EVENT_STRING=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofString(sf.EVENT_RESULT_NAME)))}static{this.EVENT_LONG=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofLong(sf.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME)))}static{this.EVENT_TIMESTAMP=new es(es.OUTPUT,q.of(sf.EVENT_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")))}getSignature(){return this.signature}constructor(e,t,...r){if(super(),this.signature=new eT(e).setNamespace(p.DATE).setEvents(q.of(t.getName(),t)),!r?.length)return;let n=new Map;r.forEach(e=>n.set(e.getParameterName(),e)),this.signature.setParameters(n)}static ofEntryTimestampAndIntegerOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME))))])}}(e,sf.EVENT_INT,sf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndBooleanOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME))))])}}(e,sf.EVENT_BOOLEAN,sf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndStringOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME))))])}}(e,sf.EVENT_STRING,sf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampIntegerAndTimestampOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),e.getArguments()?.get(sf.PARAMETER_NUMBER_NAME))))])}}(e,sf.EVENT_INT,sf.PARAMETER_TIMESTAMP,sf.PARAMETER_NUMBER)]}static ofEntryTimestampTimestampAndTOutput(e,t,r,...n){return[e,new class extends sf{async internalExecute(e){let t=[];return n?.length&&t.push(...n.map(t=>e.getArguments()?.get(t.getParameterName()))),new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,r(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME_ONE),e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME_TWO),t)))])}}(e,t,sf.PARAMETER_TIMESTAMP_ONE,sf.PARAMETER_TIMESTAMP_TWO,...n)]}}function s_(e){let t=(0,l.DateTime).fromISO(e);if(!t?.isValid)throw Error("Invalid ISO timestamp");return t}class sM extends sf{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",sf.EVENT_TIMESTAMP,sf.PARAMETER_TIMESTAMP,X.of(sM.PARAMETER_YEARS_NAME,Y.ofNumber(sM.PARAMETER_YEARS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_MONTHS_NAME,Y.ofNumber(sM.PARAMETER_MONTHS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_DAYS_NAME,Y.ofNumber(sM.PARAMETER_DAYS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_HOURS_NAME,Y.ofNumber(sM.PARAMETER_HOURS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_MINUTES_NAME,Y.ofNumber(sM.PARAMETER_MINUTES_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_SECONDS_NAME,Y.ofNumber(sM.PARAMETER_SECONDS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_MILLISECONDS_NAME,Y.ofNumber(sM.PARAMETER_MILLISECONDS_NAME).setDefaultValue(0))),this.isAdd=e}async internalExecute(e){let t;let r=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),n=e.getArguments()?.get(sM.PARAMETER_YEARS_NAME),s=e.getArguments()?.get(sM.PARAMETER_MONTHS_NAME),a=e.getArguments()?.get(sM.PARAMETER_DAYS_NAME),i=e.getArguments()?.get(sM.PARAMETER_HOURS_NAME),o={years:n,months:s,days:a,hours:i,minutes:e.getArguments()?.get(sM.PARAMETER_MINUTES_NAME),seconds:e.getArguments()?.get(sM.PARAMETER_SECONDS_NAME),milliseconds:e.getArguments()?.get(sM.PARAMETER_MILLISECONDS_NAME)};return t=this.isAdd?r.plus(o):r.minus(o),new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,t.toISO()))])}}class sS extends e3{constructor(e,t){super(),this.paramName=`epoch${t?"Seconds":"Milliseconds"}`,this.isSeconds=t,this.signature=new eT(e).setNamespace(p.DATE).setParameters(new Map([[this.paramName,X.of(this.paramName,new Y().setName(this.paramName).setType(L.of(i.LONG,i.INTEGER,i.STRING)))]])).setEvents(new Map([[sf.EVENT_TIMESTAMP_NAME,sf.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 eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,new Date(r).toISOString()))]))}}class sO extends e3{constructor(e,t){super(),this.isSeconds=t,this.signature=new eT(e).setNamespace(p.DATE).setParameters(new Map([[sf.PARAMETER_TIMESTAMP_NAME,sf.PARAMETER_TIMESTAMP]])).setEvents(new Map([[sf.EVENT_RESULT_NAME,sf.EVENT_LONG]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),r=this.isSeconds?(0,l.DateTime).fromISO(t).toSeconds():(0,l.DateTime).fromISO(t).toMillis();return Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,r))]))}}class sw extends sf{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("ToDateString",sf.EVENT_STRING,sf.PARAMETER_TIMESTAMP,X.of(sw.PARAMETER_FORMAT_NAME,Y.ofString(sw.PARAMETER_FORMAT_NAME)),X.of(sw.PARAMETER_LOCALE_NAME,Y.ofString(sw.PARAMETER_LOCALE_NAME).setDefaultValue("")))}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(sw.PARAMETER_FORMAT_NAME),n=e.getArguments()?.get(sw.PARAMETER_LOCALE_NAME);return""===n&&(n="system"),new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t.toFormat(r,{locale:n})))])}}class sI extends sf{static{this.PARAMETER_TIMEZONE_NAME="timezone"}constructor(){super("SetTimeZone",sf.EVENT_TIMESTAMP,sf.PARAMETER_TIMESTAMP,X.of(sI.PARAMETER_TIMEZONE_NAME,Y.ofString(sI.PARAMETER_TIMEZONE_NAME)))}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(sI.PARAMETER_TIMEZONE_NAME);return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t.setZone(r).toISO()))])}}class sP extends sf{static{this.PARAMETER_START_TIMESTAMP_NAME="startTimestamp"}static{this.PARAMETER_END_TIMESTAMP_NAME="endTimestamp"}static{this.PARAMETER_CHECK_TIMESTAMP_NAME="checkTimestamp"}constructor(){super("IsBetween",sP.EVENT_BOOLEAN,X.of(sP.PARAMETER_START_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")),X.of(sP.PARAMETER_END_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")),X.of(sP.PARAMETER_CHECK_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")))}async internalExecute(e){let t=e.getArguments()?.get(sP.PARAMETER_START_TIMESTAMP_NAME),r=e.getArguments()?.get(sP.PARAMETER_END_TIMESTAMP_NAME),n=e.getArguments()?.get(sP.PARAMETER_CHECK_TIMESTAMP_NAME),s=s_(t),a=s_(r),i=s_(n);return s>a&&([s,a]=[a,s]),new eu([ea.outputOf(q.of(sP.EVENT_RESULT_NAME,s<=i&&i<=a))])}}class sd extends e3{constructor(e){super(),this.isLast=e,this.signature=new eT(e?"LastOf":"FirstOf").setNamespace(p.DATE).setParameters(new Map([[sf.PARAMETER_TIMESTAMP_NAME,new X(sf.PARAMETER_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")).setVariableArgument(!0)]])).setEvents(new Map([[sf.EVENT_TIMESTAMP_NAME,sf.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME);if(!t?.length)throw Error("No timestamps provided");let r=t.map(e=>s_(e));return r.sort((e,t)=>e.toMillis()-t.toMillis()),Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,r[this.isLast?r.length-1:0].toISO()))]))}}class sy extends sf{static{this.EVENT_TIME_OBJECT_NAME="object"}static{this.EVENT_TIME_ARRAY_NAME="array"}constructor(e){super(e?"TimeAsArray":"TimeAsObject",new es(es.OUTPUT,q.of(e?sy.EVENT_TIME_ARRAY_NAME:sy.EVENT_TIME_OBJECT_NAME,e?Y.ofArray(sy.EVENT_TIME_ARRAY_NAME,Y.ofInteger("timeParts")):Y.ofRef(p.DATE+".TimeObject"))),sf.PARAMETER_TIMESTAMP),this.isArray=e}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)).toObject();return new eu([ea.outputOf(q.of(this.isArray?sy.EVENT_TIME_ARRAY_NAME:sy.EVENT_TIME_OBJECT_NAME,this.isArray?[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond]:t))])}}class sx extends sf{constructor(e){super(e?"StartOf":"EndOf",sf.EVENT_TIMESTAMP,sf.PARAMETER_TIMESTAMP,sf.PARAMETER_UNIT),this.isStart=e}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(sf.PARAMETER_UNIT_NAME)?.toLowerCase(),n=this.isStart?t.startOf(r):t.endOf(r);return new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,n.toISO()))])}}class sL extends sf{static{this.EVENT_NAMES_NAME="names"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("GetNames",new es(sL.EVENT_NAMES_NAME,q.of(sL.EVENT_NAMES_NAME,Y.ofArray(sL.EVENT_NAMES_NAME,Y.ofString(sL.EVENT_NAMES_NAME)))),new X(sL.PARAMETER_UNIT_NAME,Y.ofString(sL.PARAMETER_UNIT_NAME).setEnums(["TIMEZONES","MONTHS","WEEKDAYS"])),new X(sL.PARAMETER_LOCALE_NAME,Y.ofString(sL.PARAMETER_LOCALE_NAME).setDefaultValue("system")))}async internalExecute(e){let t=e.getArguments()?.get(sL.PARAMETER_UNIT_NAME),r=e.getArguments()?.get(sL.PARAMETER_LOCALE_NAME);return new eu([ea.outputOf(q.of(sL.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,l.DateTime).now().setLocale(t).set({month:e}).toFormat("MMMM")):"WEEKDAYS"===e?[1,2,3,4,5,6,7].map(e=>(0,l.DateTime).now().setLocale(t).set({month:7,day:e}).toFormat("EEEE")):[]}}class sv extends e3{static{this.SIGNATURE=new eT("IsValidISODate").setNamespace(p.DATE).setParameters(new Map([X.ofEntry(sf.PARAMETER_TIMESTAMP_NAME,Y.ofString(sf.PARAMETER_TIMESTAMP_NAME))])).setEvents(new Map([es.outputEventMapEntry(q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME)))]))}internalExecute(e){let t=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),r=(0,l.DateTime).fromISO(t);return Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,r.isValid))]))}getSignature(){return sv.SIGNATURE}}class sU extends sf{static{this.PARAMETER_FROM_NAME="from"}static{this.PARAMETER_FROM=new X(sU.PARAMETER_FROM_NAME,Y.ofRef(p.DATE+".Timestamp").setDefaultValue(""))}static{this.PARAMETER_LOCALE_NAME="locale"}static{this.PARAMETER_LOCALE=new X(sU.PARAMETER_LOCALE_NAME,Y.ofString(sU.PARAMETER_LOCALE_NAME).setDefaultValue("system"))}static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_FORMAT=new X(sU.PARAMETER_FORMAT_NAME,Y.ofString(sU.PARAMETER_FORMAT_NAME).setEnums(["LONG","SHORT","NARROW"]).setDefaultValue("LONG"))}static{this.PARAMETER_ROUND_NAME="round"}static{this.PARAMETER_ROUND=new X(sU.PARAMETER_ROUND_NAME,Y.ofBoolean(sU.PARAMETER_ROUND_NAME).setDefaultValue(!0))}constructor(){super("FromNow",sf.EVENT_STRING,sf.PARAMETER_TIMESTAMP,sU.PARAMETER_FORMAT,sU.PARAMETER_FROM,sf.PARAMETER_VARIABLE_UNIT,sU.PARAMETER_ROUND,sU.PARAMETER_LOCALE)}internalExecute(e){let t=e.getArguments()?.get(sU.PARAMETER_FROM_NAME),r=""===t?(0,l.DateTime).now():(0,l.DateTime).fromISO(t),n=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),s=(0,l.DateTime).fromISO(n),a=e.getArguments()?.get(sU.PARAMETER_UNIT_NAME),i=e.getArguments()?.get(sU.PARAMETER_FORMAT_NAME),o=e.getArguments()?.get(sU.PARAMETER_ROUND_NAME),E=e.getArguments()?.get(sU.PARAMETER_LOCALE_NAME),u={base:r,style:i?.toLowerCase(),round:o,locale:E};return a?.length>0&&(u.unit=a.map(e=>e.toLowerCase())),Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,s.toRelative(u)??"Unknown"))]))}}class sV extends sf{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_TIMESTAMP_STRING_NAME="timestampString"}constructor(){super("FromDateString",sf.EVENT_TIMESTAMP,X.of(sV.PARAMETER_TIMESTAMP_STRING_NAME,Y.ofString(sV.PARAMETER_TIMESTAMP_STRING_NAME)),X.of(sV.PARAMETER_FORMAT_NAME,Y.ofString(sV.PARAMETER_FORMAT_NAME)))}async internalExecute(e){let t=e.getArguments()?.get(sV.PARAMETER_TIMESTAMP_STRING_NAME),r=e.getArguments()?.get(sV.PARAMETER_FORMAT_NAME),n=(0,l.DateTime).fromFormat(t,r);return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,n.toISO()))])}}class sC extends sf{constructor(){super("GetCurrentTimestamp",sf.EVENT_TIMESTAMP)}async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,(0,l.DateTime).now().toISO()))])}}class sD{static{this.repoMap=q.ofArrayEntries(["EpochSecondsToTimestamp",new sS("EpochSecondsToTimestamp",!0)],["EpochMillisecondsToTimestamp",new sS("EpochMillisecondsToTimestamp",!1)],sf.ofEntryTimestampAndIntegerOutput("GetDay",e=>s_(e).day),sf.ofEntryTimestampAndIntegerOutput("GetDayOfWeek",e=>s_(e).weekday),sf.ofEntryTimestampAndIntegerOutput("GetMonth",e=>s_(e).month),sf.ofEntryTimestampAndIntegerOutput("GetYear",e=>s_(e).year),sf.ofEntryTimestampAndIntegerOutput("GetHours",e=>s_(e).hour),sf.ofEntryTimestampAndIntegerOutput("GetMinutes",e=>s_(e).minute),sf.ofEntryTimestampAndIntegerOutput("GetSeconds",e=>s_(e).second),sf.ofEntryTimestampAndIntegerOutput("GetMilliseconds",e=>s_(e).millisecond),sf.ofEntryTimestampAndIntegerOutput("GetDaysInMonth",e=>s_(e).daysInMonth),sf.ofEntryTimestampAndIntegerOutput("GetDaysInYear",e=>s_(e).daysInYear),["TimestampToEpochSeconds",new sO("TimestampToEpochSeconds",!0)],["TimestampToEpochMilliseconds",new sO("TimestampToEpochMilliseconds",!1)],sf.ofEntryTimestampAndStringOutput("GetTimeZoneName",e=>s_(e).zoneName),sf.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetLong",e=>s_(e).offsetNameLong),sf.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetShort",e=>s_(e).offsetNameShort),sf.ofEntryTimestampAndIntegerOutput("GetTimeZoneOffset",e=>s_(e).offset),["ToDateString",new sw],["AddTime",new sM(!0)],["SubtractTime",new sM(!1)],["GetCurrentTimestamp",new sC],sf.ofEntryTimestampTimestampAndTOutput("Difference",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofRef(`${p.DATE}.Duration`))),(e,t,r)=>{let n;let s=s_(e),a=s_(t);return r?.[0]?.length&&(n=r[0]?.filter(e=>!!e).map(e=>e.toLowerCase())),s.diff(a,n).toObject()},sf.PARAMETER_VARIABLE_UNIT),sf.ofEntryTimestampIntegerAndTimestampOutput("SetDay",(e,t)=>s_(e).set({day:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetMonth",(e,t)=>s_(e).set({month:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetYear",(e,t)=>s_(e).set({year:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetHours",(e,t)=>s_(e).set({hour:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetMinutes",(e,t)=>s_(e).set({minute:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetSeconds",(e,t)=>s_(e).set({second:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetMilliseconds",(e,t)=>s_(e).set({millisecond:t}).toISO()),["SetTimeZone",new sI],sf.ofEntryTimestampTimestampAndTOutput("IsBefore",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)<s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsAfter",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)>s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsSame",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)===s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsSameOrBefore",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)<=s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsSameOrAfter",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)>=s_(t)),sf.ofEntryTimestampAndBooleanOutput("IsInLeapYear",e=>s_(e).isInLeapYear),sf.ofEntryTimestampAndBooleanOutput("IsInDST",e=>s_(e).isInDST),["IsBetween",new sP],["LastOf",new sd(!0)],["FirstOf",new sd(!1)],["StartOf",new sx(!0)],["EndOf",new sx(!1)],["TimeAsObject",new sy(!1)],["TimeAsArray",new sy(!0)],["GetNames",new sL],["IsValidISODate",new sv],["FromNow",new sU],["FromDateString",new sV])}static{this.filterableNames=Array.from(sD.repoMap.values()).map(e=>e.getSignature().getFullName())}find(e,t){return e!=p.DATE?Promise.resolve(void 0):Promise.resolve(sD.repoMap.get(t))}filter(e){return Promise.resolve(sD.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sG extends e3{static{this.MILLIS="millis"}static{this.SIGNATURE=new eT("Wait").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(sG.MILLIS,Y.ofNumber(sG.MILLIS).setMinimum(0).setDefaultValue(0))])).setEvents(new Map([es.outputEventMapEntry(new Map)]))}getSignature(){return sG.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(sG.MILLIS);return await new Promise(e=>setTimeout(e,t)),new eu([ea.outputOf(new Map)])}}var sb={};m(sb,"HybridRepository",()=>sF);class sF{constructor(...e){this.repos=e}async find(e,t){for(let r of this.repos){let n=await r.find(e,t);if(n)return n}}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)}}const sB=new Map([[p.SYSTEM_CTX,new Map([et(new class extends e3{getSignature(){return rn}async internalExecute(e){let t=e?.getArguments()?.get(rt);if(e?.getContext()?.has(t))throw new eE(ec.format("Context already has an element for '$' ",t));let r=Y.from(e?.getArguments()?.get(rr));if(!r)throw new eE("Schema is not supplied.");return e.getContext().set(t,new re(r,_(r.getDefaultValue())?void 0:r.getDefaultValue())),new eu([ea.outputOf(new Map)])}}),et(new class extends e3{getSignature(){return ri}async internalExecute(e){let t=e?.getArguments()?.get(rs);if(!e.getContext()?.has(t))throw new eE(ec.format("Context don't have an element for '$' ",t));return new eu([ea.outputOf(new Map([ra,e.getContext()?.get(t)?.getElement()]))])}}),et(new class extends e3{getSignature(){return nR}async internalExecute(e){let t=e?.getArguments()?.get(nT);if(eM.isNullOrBlank(t))throw new eE("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get(nl),n=new tY(t),s=n.getTokens().peekLast();if(!s.getExpression().startsWith("Context")||s instanceof tY||s instanceof tb&&!s.getElement().toString().startsWith("Context"))throw new tr(ec.format("The context path $ is not a valid path in context",t));for(let e of n.getOperations().toArray())if(e!=tB.ARRAY_OPERATOR&&e!=tB.OBJECT_OPERATOR)throw new tr(ec.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<n.getTokens().size();r++){let s=n.getTokens().get(r);s instanceof tY&&n.getTokens().set(r,new tb(t,new nA(s).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,n)}modifyContext(e,t,r,n){let s=n.getTokens();s.removeLast();let a=n.getOperations();a.removeLast();let i=e.getContext()?.get(s.removeLast().getExpression());if(_(i))throw new eE(ec.format("Context doesn't have any element with name '$' ",t));if(a.isEmpty())return i.setElement(r),new eu([ea.outputOf(new Map)]);let o=i.getElement(),E=a.removeLast(),u=s.removeLast(),A=u instanceof tb?u.getElement():u.getExpression();for(_(o)&&(o=E==tB.OBJECT_OPERATOR?{}:[],i.setElement(o));!a.isEmpty();)o=E==tB.OBJECT_OPERATOR?this.getDataFromObject(o,A,a.peekLast()):this.getDataFromArray(o,A,a.peekLast()),E=a.removeLast(),A=(u=s.removeLast())instanceof tb?u.getElement():u.getExpression();return E==tB.OBJECT_OPERATOR?this.putDataInObject(o,A,r):this.putDataInArray(o,A,r),new eu([ea.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eE(ec.format("Expected an array index but found $",t));if(n<0)throw new eE(ec.format("Array index is out of bound - $",t));let s=e[n];return _(s)&&(s=r==tB.OBJECT_OPERATOR?{}:[],e[n]=s),s}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));let n=e[t];return _(n)&&(n=r==tB.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eE(ec.format("Expected an array index but found $",t));if(n<0)throw new eE(ec.format("Array index is out of bound - $",t));e[n]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));e[t]=r}})])],[p.SYSTEM_LOOP,new Map([et(new class extends e3{getSignature(){return nV}async internalExecute(e){let t=e.getArguments()?.get(nx),r=e.getArguments()?.get("to"),n=e.getArguments()?.get(nL),s=n>0,a=t,i=!1,o=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(i)return;if(s&&a>=r||!s&&a<=r||o&&e.getExecutionContext()?.get(o))return i=!0,o&&e.getExecutionContext()?.delete(o),ea.outputOf(new Map([[nv,a]]));let t=ea.of(es.ITERATION,new Map([[nU,a]]));return a+=n,t}})}}),et(new class extends e3{getSignature(){return nO}async internalExecute(e){let t=e.getArguments()?.get(n_),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(r>=t||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),ea.outputOf(new Map([[nM,r]]));let s=ea.of(es.ITERATION,new Map([[nS,r]]));return++r,s}})}}),et(new class extends e3{getSignature(){return nf}async internalExecute(e){let t=e.getArguments()?.get(nN);return e.getExecutionContext().set(t,!0),new eu([ea.outputOf(new Map)])}}),et(new class extends e3{getSignature(){return ny}async internalExecute(e){let t=e.getArguments()?.get(nw),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(r>=t.length||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),ea.outputOf(new Map([[nd,r]]));let s=ea.of(es.ITERATION,new Map([[nP,r],[nI,t[r]]]));return++r,s}})}})])],[p.SYSTEM,new Map([et(new np),et(new class extends e3{getSignature(){return nc}async internalExecute(e){let t=e.getEvents(),r=e.getArguments(),n=r?.get(ng),s=e?.getArguments()?.get(nh).map(t=>{let r=t[nm];if(_(r))throw new eE("Expect a value object");let n=r.value;return r.isExpression&&(n=new nA(n).evaluate(e.getValuesMap())),[t.name,n]}).reduce((e,t)=>(e.set(t[0],t[1]),e),new Map);return t?.has(n)||t?.set(n,[]),t?.get(n)?.push(s),new eu([ea.outputOf(new Map)])}}),et(new sa),et(new sG),et(new t6)])]]),sY=Array.from(sB.values()).flatMap(e=>Array.from(e.values())).map(e=>e.getSignature().getFullName());class sH extends sF{constructor(){super({find:async(e,t)=>sB.get(e)?.get(t),filter:async e=>Array.from(sY).filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase()))},new nZ,new sN,new t7,new ss,new sD)}}var sk={};m(sk,"StatementExecution",()=>sW);var s$={};m(s$,"StatementMessage",()=>sj);class sj{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 sW{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 sj(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){return e instanceof sW&&e.statement.equals(this.statement)}}var sX={};m(sX,"ContextTokenValueExtractor",()=>sJ);class sJ extends tk{static{this.PREFIX="Context."}constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.context.get(r)?.getElement())}getPrefix(){return sJ.PREFIX}getStore(){return _(this.context)?this.context:Array.from(this.context.entries()).reduce((e,[t,r])=>(_(r)||(e[t]=r.getElement()),e),{})}}var sq={};m(sq,"OutputMapTokenValueExtractor",()=>sz);class sz extends tk{static{this.PREFIX="Steps."}constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=1,n=this.output.get(t[r++]);if(!n||r>=t.length)return;let s=n.get(t[r++]);if(!s||r>t.length)return;if(r===t.length)return s;let a=t[r].indexOf("[");if(-1===a){let n=s.get(t[r++]);return this.retrieveElementFrom(e,t,r,n)}let i=t[r].substring(0,a),o=s.get(i);return this.retrieveElementFrom(e,t,r,{[i]:o})}getPrefix(){return sz.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 sK={};m(sK,"ArgumentsTokenValueExtractor",()=>sQ);class sQ extends tk{static{this.PREFIX="Arguments."}constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.args.get(r))}getPrefix(){return sQ.PREFIX}getStore(){return _(this.args)?this.args:Array.from(this.args.entries()).reduce((e,[t,r])=>(e[t]=r,e),{})}}var sZ={};m(sZ,"GraphVertex",()=>s2);var s0={};m(s0,"ExecutionGraph",()=>s1);class s1{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 s2(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 ep(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 s2{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 ew(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new ew(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 s1(!0);var r=new ep(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 s9={};m(s9,"KIRuntime",()=>at);var s3={};m(s3,"JsonExpression",()=>s4);class s4{constructor(e){this.expression=e}getExpression(){return this.expression}}var s5={};m(s5,"ParameterReferenceType",()=>A),(s=A||(A={})).VALUE="VALUE",s.EXPRESSION="EXPRESSION";var s6={};function s7(){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)})}m(s6,"FunctionExecutionParameters",()=>s8);class s8{constructor(e,t,r){this.count=0,this.executionContext=new Map,this.valueExtractors=new Map,this.functionRepository=e,this.schemaRepository=t,this.executionId=r??s7()}getExecutionId(){return this.executionId}getContext(){return this.context}setContext(e){this.context=e;let t=new sJ(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 sz(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={};m(ae,"StatementMessageType",()=>T),(a=T||(T={})).ERROR="ERROR",a.WARNING="WARNING",a.MESSAGE="MESSAGE";class at extends e3{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()>at.VERSION)throw new eE("Runtime is at a lower version "+at.VERSION+" and trying to run code from version "+this.fd.getVersion()+".")}getSignature(){return this.fd}async getExecutionPlan(e,t){let r=new s1;for(let n of Array.from(this.fd.getSteps().values()))r.addVertex(await this.prepareStatementExecution(n,e,t));return Array.from(this.makeEdges(r).getT2().entries()).forEach(e=>{let t=r.getNodeMap().get(e[0])?.getData();t&&t.addMessage(T.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 sQ(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 eE("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 ep;r.addAll(e.getVerticesWithNoIncomingEdges());let n=new ep;for(;(!r.isEmpty()||!n.isEmpty())&&!t.getEvents()?.has(es.OUTPUT);)if(await this.processBranchQue(t,r,n),await this.processExecutionQue(t,r,n),t.setCount(t.getCount()+1),t.getCount()==at.MAX_EXECUTION_ITERATIONS)throw new eE("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size){let e=this.getSignature().getEvents();if(e.size&&e.get(es.OUTPUT)?.getParameters()?.size)throw new eE("No events raised")}let s=Array.from(t.getEvents()?.entries()??[]).flatMap(e=>e[1].map(t=>ea.of(e[0],t)));return new eu(s.length||e.isSubGraph()?s:[ea.of(es.OUTPUT,new Map)])}async processExecutionQue(e,t,r){if(!t.isEmpty()){let n=t.pop();await this.allDependenciesResolvedVertex(n,e.getSteps())?await this.executeVertex(n,e,r,t,e.getFunctionRepository()):t.add(n)}}async processBranchQue(e,t,r){if(r.length){let n=r.pop();await this.allDependenciesResolvedTuples(n.getT2(),e.getSteps())?await this.executeBranch(e,t,n):r.add(n)}}async executeBranch(e,t,r){let n,s=r.getT4();do if(r.getT1().getVerticesData().map(e=>e.getStatement().getStatementName()).forEach(t=>e.getSteps()?.delete(t)),await this.executeGraph(r.getT1(),e),(n=r.getT3().next())&&(e.getSteps()?.has(s.getData().getStatement().getStatementName())||e.getSteps()?.set(s.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(s.getData().getStatement().getStatementName())?.set(n.getName(),this.resolveInternalExpressions(n.getResult(),e)),this.debugMode)){let t=s.getData().getStatement();console.log(`EID: ${e.getExecutionId()} Step : ${t.getStatementName()} => ${t.getNamespace()}.${t.getName()}`),console.log(`EID: ${e.getExecutionId()} Event : ${n.getName()} : `,e.getSteps().get(t.getStatementName()).get(n.getName()))}while(n&&n.getName()!=es.OUTPUT)n?.getName()==es.OUTPUT&&s.getOutVertices().has(es.OUTPUT)&&(s?.getOutVertices()?.get(es.OUTPUT)??[]).forEach(async r=>{await this.allDependenciesResolvedVertex(r,e.getSteps())&&t.add(r)})}async executeVertex(e,t,r,n,s){let a,i=e.getData().getStatement();if(i.getExecuteIftrue().size&&!(Array.from(i.getExecuteIftrue().entries())??[]).filter(e=>e[1]).map(([e])=>new nA(e).evaluate(t.getValuesMap())).every(e=>!_(e)&&!1!==e))return;let o=await s.find(i.getNamespace(),i.getName());if(!o)throw new eE(ec.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 at?new s8(t.getFunctionRepository(),t.getSchemaRepository(),`${t.getExecutionId()}_${i.getStatementName()}`).setArguments(u).setValuesMap(new Map(Array.from(t.getValuesMap().values()).filter(e=>e.getPrefix()!==sQ.PREFIX&&e.getPrefix()!==sz.PREFIX&&e.getPrefix()!==sJ.PREFIX).map(e=>[e.getPrefix(),e]))):new s8(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 eE(ec.format("Executing $ returned no events",i.getStatementName()));let R=l.getName()==es.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()))),R){let r=e.getOutVertices().get(es.OUTPUT);r&&r.forEach(async e=>{await this.allDependenciesResolvedVertex(e,t.getSteps())&&n.add(e)})}else{let t=e.getSubGraphOfType(l.getName()),n=this.makeEdges(t).getT1();r.push(new eP(t,n,T,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map(e=>new ew(e[0],this.resolveInternalExpression(e[1],t))).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map):e}resolveInternalExpression(e,t){if(_(e)||"object"!=typeof e)return e;if(e instanceof s4)return new nA(e.getExpression()).evaluate(t.getValuesMap());if(Array.isArray(e)){let r=[];for(let n of e)r.push(this.resolveInternalExpression(n,t));return r}if("object"==typeof e){let r={};for(let n of Object.entries(e))r[n[0]]=this.resolveInternalExpression(n[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(),n=e.getT2();return!(t.has(r)&&t.get(r)?.has(n))}).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map(t=>{let n,s=Array.from(t[1]?.values()??[]);if(!s?.length)return new ew(t[0],n);let a=r.get(t[0]);return a?(n=a.isVariableArgument()?s.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)).filter(e=>!_(e)).map(t=>this.parameterReferenceEvaluation(e,t)).flatMap(e=>Array.isArray(e)?e:[e]):this.parameterReferenceEvaluation(e,s[0]),new ew(t[0],n)):new ew(t[0],void 0)}).filter(e=>!_(e.getT2())).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map)}parameterReferenceEvaluation(e,t){let r;return t.getType()==A.VALUE?r=this.resolveInternalExpression(t.getValue(),e):t.getType()!=A.EXPRESSION||eM.isNullOrBlank(t.getExpression())||(r=new nA(t.getExpression()??"").evaluate(e.getValuesMap())),r}async prepareStatementExecution(e,t,r){let n=new sW(e),s=await t.find(e.getNamespace(),e.getName());if(!s)return n.addMessage(T.ERROR,ec.format("$.$ is not available",e.getNamespace(),e.getName())),Promise.resolve(n);let a=new Map(s.getSignature().getParameters());if(!e.getParameterMap())return Promise.resolve(n);for(let t of Array.from(e.getParameterMap().entries())){let e=a.get(t[0]);if(!e)continue;let s=Array.from(t[1]?.values()??[]);if(!s.length&&!e.isVariableArgument()){await ex.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,e.getParameterName())),a.delete(e.getParameterName());continue}if(e.isVariableArgument())for(let t of(s.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)),s))this.parameterReferenceValidation(n,e,t,r);else if(s.length){let t=s[0];this.parameterReferenceValidation(n,e,t,r)}a.delete(e.getParameterName())}if(!_(n.getStatement().getDependentStatements()))for(let e of Array.from(n.getStatement().getDependentStatements().entries()))e[1]&&n.addDependency(e[0]);if(!_(n.getStatement().getExecuteIftrue()))for(let e of Array.from(n.getStatement().getExecuteIftrue().entries()))e[1]&&this.addDependencies(n,e[0]);if(a.size)for(let e of Array.from(a.values()))e.isVariableArgument()||await ex.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return Promise.resolve(n)}async parameterReferenceValidation(e,t,r,n){if(r){if(r.getType()==A.VALUE){if(_(r.getValue())&&!await ex.hasDefaultValueOrNullSchemaType(t.getSchema(),n)&&e.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,t.getParameterName())),_(r.getValue()))return;let s=new ep;for(s.push(new ew(t.getSchema(),r.getValue()));!s.isEmpty();){let t=s.pop();if(t.getT2() instanceof s4)this.addDependencies(e,t.getT2().getExpression());else{if(_(t.getT1())||_(t.getT1().getType()))continue;if(t.getT1().getType()?.contains(i.ARRAY)&&Array.isArray(t.getT2())){let e=t.getT1().getItems();if(!e)continue;if(e.isSingleType())for(let r of t.getT2())s.push(new ew(e.getSingleSchema(),r));else{let r=t.getT2();for(let t=0;t<r.length;t++)s.push(new ew(e.getTupleSchema()[t],r[t]))}}else if(t.getT1().getType()?.contains(i.OBJECT)&&"object"==typeof t.getT2()){let r=t.getT1();if(r.getName()===X.EXPRESSION.getName()&&r.getNamespace()===X.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])&&s.push(new ew(r.getProperties().get(e[0]),e[1]))}}}}else if(r.getType()==A.EXPRESSION){if(eM.isNullOrBlank(r.getExpression()))_(ex.getDefaultValue(t.getSchema(),n))&&e.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,t.getParameterName()));else try{this.addDependencies(e,r.getExpression())}catch(t){e.addMessage(T.ERROR,ec.format("Error evaluating $ : $",r.getExpression(),t))}}}else _(await ex.getDefaultValue(t.getSchema(),n))&&e.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(at.STEP_REGEX_PATTERN)??[]).forEach(t=>e.addDependency(t))}makeEdges(e){let t=e.getNodeMap().values(),r=[],n=new Map;for(let s of Array.from(t))for(let t of Array.from(s.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)?s.addInEdgeTo(e.getNodeMap().get(i),E):(r.push(new ew(i,E)),n.set(s.getData().getStatement().getStatementName(),ec.format("Unable to find the step with name $",i)))}return new ew(r,n)}}var ar={};m(ar,"KIRunConstants",()=>an);class an{static{this.NAMESPACE="namespace"}static{this.NAME="name"}static{this.ID="id"}constructor(){}}var as={};m(as,"Position",()=>aa);class aa{static{this.SCHEMA_NAME="Position"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(aa.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["left",Y.ofFloat("left")],["top",Y.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 aa(e.left,e.top)}}var ai={};m(ai,"FunctionDefinition",()=>ah);var ao={};m(ao,"Statement",()=>al);var aE={};m(aE,"AbstractStatement",()=>au);class au{constructor(e){if(this.override=!1,!e)return;this.comment=e.comment,this.description=e.description,this.position=e.position?new aa(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 aA={};m(aA,"ParameterReference",()=>aT);class aT{static{this.SCHEMA_NAME="ParameterReference"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(aT.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["key",Y.ofString("key")],["value",Y.ofAny("value")],["expression",Y.ofString("expression")],["type",Y.ofString("type").setEnums(["EXPRESSION","VALUE"])],["order",Y.ofInteger("order")]]))}constructor(e){e instanceof aT?(this.key=e.key,this.type=e.type,this.value=_(e.value)?void 0:JSON.parse(JSON.stringify(e.value)),this.expression=e.expression,this.order=e.order):(this.type=e,this.key=s7())}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 aT(A.EXPRESSION).setExpression(e);return[t.getKey(),t]}static ofValue(e){let t=new aT(A.VALUE).setValue(e);return[t.getKey(),t]}static from(e){return new aT(e.type).setValue(e.value).setExpression(e.expression).setKey(e.key).setOrder(e.order)}}class al extends au{static{this.SCHEMA_NAME="Statement"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(al.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["statementName",Y.ofString("statementName")],["comment",Y.ofString("comment")],["description",Y.ofString("description")],["namespace",Y.ofString("namespace")],["name",Y.ofString("name")],["dependentStatements",Y.ofObject("dependentstatement").setAdditionalProperties(new B().setSchemaValue(Y.ofBoolean("exists"))).setDefaultValue({})],["executeIftrue",Y.ofObject("executeIftrue").setAdditionalProperties(new B().setSchemaValue(Y.ofBoolean("exists"))).setDefaultValue({})],["parameterMap",new Y().setName("parameterMap").setAdditionalProperties(new B().setSchemaValue(Y.ofObject("parameterReference").setAdditionalProperties(new B().setSchemaValue(aT.SCHEMA))))],["position",aa.SCHEMA]]))}constructor(e,t,r){if(super(e instanceof al?e:void 0),e instanceof al)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 aT(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 al&&e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}static from(e){return new al(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])=>aT.from(t)).map(e=>[e.getKey(),e]))]))).setDependentStatements(new Map(Object.entries(e.dependentStatements??{}))).setExecuteIftrue(new Map(Object.entries(e.executeIftrue??{}))).setPosition(aa.from(e.position)).setComment(e.comment).setDescription(e.description)}}var aR={};m(aR,"StatementGroup",()=>am);class am extends au{static{this.SCHEMA_NAME="StatementGroup"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(am.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["statementGroupName",Y.ofString("statementGroupName")],["comment",Y.ofString("comment")],["description",Y.ofString("description")],["position",aa.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 am(e.statementGroupName,new Map(Object.entries(e.statements||{}).map(([e,t])=>[e,(""+t)?.toLowerCase()=="true"]))).setPosition(aa.from(e.position)).setComment(e.comment).setDescription(e.description)}}const ag=new Y().setNamespace(p.SYSTEM).setName("FunctionDefinition").setProperties(new Map([["name",Y.ofString("name")],["namespace",Y.ofString("namespace")],["parameters",Y.ofArray("parameters",X.SCHEMA)],["events",Y.ofObject("events").setAdditionalProperties(new B().setSchemaValue(es.SCHEMA))],["steps",Y.ofObject("steps").setAdditionalProperties(new B().setSchemaValue(al.SCHEMA))]]));ag.getProperties()?.set("parts",Y.ofArray("parts",ag));class ah extends eT{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 ah(e.name).setSteps(new Map(Object.values(e.steps??{}).filter(e=>!!e).map(e=>[e.statementName,al.from(e)]))).setStepGroups(new Map(Object.values(e.stepGroups??{}).filter(e=>!!e).map(e=>[e.statementGroupName,am.from(e)]))).setParts(Array.from(e.parts??[]).filter(e=>!!e).map(e=>ah.from(e))).setVersion(e.version??1).setEvents(new Map(Object.values(e.events??{}).filter(e=>!!e).map(e=>[e.name,es.from(e)]))).setParameters(new Map(Object.values(e.parameters??{}).filter(e=>!!e).map(e=>[e.parameterName,X.from(e)]))).setNamespace(e.namespace):new ah("unknown")}}var ac={};m(ac,"Argument",()=>ap);class ap{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 ap(0,e,t)}}var aN={};R(aN,r2),R(aN,r5),R(aN,r7),R(aN,ne),R(aN,r9);var af={};R(af,rl),R(af,rm),R(af,rh),R(af,rp),R(af,rf),R(af,rM),R(af,rO),R(af,ru),R(af,rI),R(af,rd),R(af,rx),R(af,rv),R(af,rV),R(af,rD),R(af,rb),R(af,rB),R(af,rH),R(af,r$),R(af,rW),R(af,rz),R(af,rJ),R(af,rQ),R(af,r0),R(af,rE),R(module.exports,g),R(module.exports,ee),R(module.exports,{}),R(module.exports,te),R(module.exports,J),R(module.exports,f),R(module.exports,eg),R(module.exports,tL),R(module.exports,eh),R(module.exports,e_),R(module.exports,eO),R(module.exports,ta),R(module.exports,em),R(module.exports,tE),R(module.exports,sk),R(module.exports,s$),R(module.exports,t8),R(module.exports,sX),R(module.exports,sq),R(module.exports,sK),R(module.exports,sZ),R(module.exports,{}),R(module.exports,s0),R(module.exports,s9),R(module.exports,ae),R(module.exports,s6),R(module.exports,tx),R(module.exports,tH),R(module.exports,nr),R(module.exports,ty),R(module.exports,ro),R(module.exports,tF),R(module.exports,tC),R(module.exports,tU),R(module.exports,tG),R(module.exports,{}),R(module.exports,el),R(module.exports,c),R(module.exports,s3),R(module.exports,h),R(module.exports,eB),R(module.exports,eD),R(module.exports,eb),R(module.exports,eV),R(module.exports,eL),R(module.exports,e$),R(module.exports,eH),R(module.exports,eR),R(module.exports,ed),R(module.exports,k),R(module.exports,eU),R(module.exports,N),R(module.exports,y),R(module.exports,O),R(module.exports,w),R(module.exports,I),R(module.exports,S),R(module.exports,eS),R(module.exports,ej),R(module.exports,sb),R(module.exports,ar),R(module.exports,H),R(module.exports,ei),R(module.exports,as),R(module.exports,ai),R(module.exports,s5),R(module.exports,er),R(module.exports,aE),R(module.exports,ao),R(module.exports,{}),R(module.exports,aR),R(module.exports,eA),R(module.exports,en),R(module.exports,j),R(module.exports,ac),R(module.exports,aA),R(module.exports,tt),R(module.exports,eo),R(module.exports,aN),R(module.exports,af),R(module.exports,na);
1
+ var e,t,r,n,s,a,i,o,E,u,A,T,l=require("luxon");function R(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 m(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var g={};m(g,"KIRunSchemaRepository",()=>Z);var h={};m(h,"AdditionalType",()=>B),m(h,"Schema",()=>Y);var c={};m(c,"Namespaces",()=>p);class p{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 N={};m(N,"ArraySchemaType",()=>M);var f={};function _(e){return null==e}m(f,"isNullValue",()=>_);class M{constructor(e){if(!e)return;this.singleSchema=e.singleSchema?new Y(e.singleSchema):void 0,this.tupleSchema=e.tupleSchema?e.tupleSchema.map(e=>new Y(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!_(this.singleSchema)}static of(...e){return 1==e.length?new M().setSingleSchema(e[0]):new M().setTupleSchema(e)}static from(e){if(!e)return;if(Array.isArray(e))return new M().setTupleSchema(Y.fromListOfSchemas(e));let t=Object.keys(e);if(-1!=t.indexOf("singleSchema"))return new M().setSingleSchema(Y.from(e.singleSchema));if(-1!=t.indexOf("tupleSchema"))return new M().setTupleSchema(Y.fromListOfSchemas(e.tupleSchema));let r=Y.from(e);if(r)return new M().setSingleSchema(r)}}var S={};m(S,"SchemaType",()=>i),(e=i||(i={})).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";var O={};m(O,"TypeUtil",()=>L);var w={};m(w,"MultipleType",()=>d);var I={};m(I,"Type",()=>P);class P{}class d extends P{constructor(e){super(),e instanceof d?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 y={};m(y,"SingleType",()=>x);class x extends P{constructor(e){super(),e instanceof x?this.type=e.type:this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class L{static of(...e){return 1==e.length?new x(e[0]):new d(new Set(e))}static from(e){return"string"==typeof e?new x(i[L.fromJSONType(e)]):Array.isArray(e)?new d(new Set(e.map(L.fromJSONType).map(e=>e).map(e=>i[e]))):void 0}static fromJSONType(e){let t=e.toUpperCase();return"NUMBER"===t?"DOUBLE":t}}const v="additionalProperty",U="additionalItems",V="enums",C="items",D="System.Schema",G="required",b="version",F="namespace";class B{constructor(e){if(!e||(this.booleanValue=e.booleanValue,!e.schemaValue))return;this.schemaValue=new Y(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(_(e))return;let t=new B;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=Y.from(e.schemaValue):t.schemaValue=Y.from(e)}return t}}class Y{static{this.NULL=new Y().setNamespace(p.SYSTEM).setName("Null").setType(L.of(i.NULL)).setConstant(void 0)}static{this.TYPE_SCHEMA=new Y().setType(L.of(i.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"])}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName("Schema").setType(L.of(i.OBJECT)).setProperties(new Map([[F,Y.of(F,i.STRING).setDefaultValue("_")],["name",Y.ofString("name")],[b,Y.of(b,i.INTEGER).setDefaultValue(1)],["ref",Y.ofString("ref")],["type",new Y().setAnyOf([Y.TYPE_SCHEMA,Y.ofArray("type",Y.TYPE_SCHEMA)])],["anyOf",Y.ofArray("anyOf",Y.ofRef(D))],["allOf",Y.ofArray("allOf",Y.ofRef(D))],["oneOf",Y.ofArray("oneOf",Y.ofRef(D))],["not",Y.ofRef(D)],["title",Y.ofString("title")],["description",Y.ofString("description")],["id",Y.ofString("id")],["examples",Y.ofAny("examples")],["defaultValue",Y.ofAny("defaultValue")],["comment",Y.ofString("comment")],[V,Y.ofArray(V,Y.ofString(V))],["constant",Y.ofAny("constant")],["pattern",Y.ofString("pattern")],["format",Y.of("format",i.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",Y.ofInteger("minLength")],["maxLength",Y.ofInteger("maxLength")],["multipleOf",Y.ofLong("multipleOf")],["minimum",Y.ofNumber("minimum")],["maximum",Y.ofNumber("maximum")],["exclusiveMinimum",Y.ofNumber("exclusiveMinimum")],["exclusiveMaximum",Y.ofNumber("exclusiveMaximum")],["properties",Y.of("properties",i.OBJECT).setAdditionalProperties(new B().setSchemaValue(Y.ofRef(D)))],["additionalProperties",new Y().setName(v).setNamespace(p.SYSTEM).setAnyOf([Y.ofBoolean(v),Y.ofObject(v).setRef(D)]).setDefaultValue(!0)],[G,Y.ofArray(G,Y.ofString(G)).setDefaultValue([])],["propertyNames",Y.ofRef(D)],["minProperties",Y.ofInteger("minProperties")],["maxProperties",Y.ofInteger("maxProperties")],["patternProperties",Y.of("patternProperties",i.OBJECT).setAdditionalProperties(new B().setSchemaValue(Y.ofRef(D)))],[C,new Y().setName(C).setAnyOf([Y.ofRef(D).setName("item"),Y.ofArray("tuple",Y.ofRef(D))])],["contains",Y.ofRef(D)],["minContains",Y.ofInteger("minContains")],["maxContains",Y.ofInteger("maxContains")],["minItems",Y.ofInteger("minItems")],["maxItems",Y.ofInteger("maxItems")],["uniqueItems",Y.ofBoolean("uniqueItems")],["additionalItems",new Y().setName(U).setNamespace(p.SYSTEM).setAnyOf([Y.ofBoolean(U),Y.ofObject(U).setRef(D)])],["$defs",Y.of("$defs",i.OBJECT).setAdditionalProperties(new B().setSchemaValue(Y.ofRef(D)))],["permission",Y.ofString("permission")]])).setRequired([])}static ofString(e){return new Y().setType(L.of(i.STRING)).setName(e)}static ofInteger(e){return new Y().setType(L.of(i.INTEGER)).setName(e)}static ofFloat(e){return new Y().setType(L.of(i.FLOAT)).setName(e)}static ofLong(e){return new Y().setType(L.of(i.LONG)).setName(e)}static ofDouble(e){return new Y().setType(L.of(i.DOUBLE)).setName(e)}static ofAny(e){return new Y().setType(L.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE,i.STRING,i.BOOLEAN,i.ARRAY,i.NULL,i.OBJECT)).setName(e)}static ofAnyNotNull(e){return new Y().setType(L.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE,i.STRING,i.BOOLEAN,i.ARRAY,i.OBJECT)).setName(e)}static ofNumber(e){return new Y().setType(L.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)).setName(e)}static ofBoolean(e){return new Y().setType(L.of(i.BOOLEAN)).setName(e)}static of(e,...t){return new Y().setType(L.of(...t)).setName(e)}static ofObject(e){return new Y().setType(L.of(i.OBJECT)).setName(e)}static ofRef(e){return new Y().setRef(e)}static ofArray(e,...t){return new Y().setType(L.of(i.ARRAY)).setName(e).setItems(M.of(...t))}static fromListOfSchemas(e){if(_(e)&&!Array.isArray(e))return;let t=[];for(let r of Array.from(e)){let e=Y.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(_(e))return;let t=new Map;return Object.entries(e).forEach(([e,r])=>{let n=Y.from(r);n&&t.set(e,n)}),t}static from(e,t=!1){if(_(e))return;let r=new Y;return r.namespace=e.namespace??"_",r.name=e.name,r.version=e.version??1,r.ref=e.ref,t?r.type=new x(i.STRING):r.type=L.from(e.type),r.anyOf=Y.fromListOfSchemas(e.anyOf),r.allOf=Y.fromListOfSchemas(e.allOf),r.oneOf=Y.fromListOfSchemas(e.oneOf),r.not=Y.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=Y.fromMapOfSchemas(e.properties),r.additionalProperties=B.from(e.additionalProperties),r.required=e.required,r.propertyNames=Y.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=Y.fromMapOfSchemas(e.patternProperties),r.items=M.from(e.items),r.additionalItems=B.from(e.additionalItems),r.contains=Y.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=Y.fromMapOfSchemas(e.$defs),r.permission=e.permission,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,_(e.type)||(this.type=e.type instanceof x?new x(e.type):new d(e.type)),this.anyOf=e.anyOf?.map(e=>new Y(e)),this.allOf=e.allOf?.map(e=>new Y(e)),this.oneOf=e.oneOf?.map(e=>new Y(e)),this.not=this.not?new Y(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 Y(e[1])])):void 0,this.additionalProperties=e.additionalProperties?new B(e.additionalProperties):void 0,this.required=e.required?[...e.required]:void 0,this.propertyNames=e.propertyNames?new Y(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 Y(e[1])])):void 0,this.items=e.items?new M(e.items):void 0,this.contains=e.contains?new Y(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 B(e.additionalItems):void 0,this.$defs=e.$defs?new Map(Array.from(e.$defs.entries()).map(e=>[e[0],new Y(e[1])])):void 0,this.permission=e.permission}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 x(i.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}}var H={};m(H,"Parameter",()=>X);var k={};m(k,"SchemaReferenceException",()=>$);class $ 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 j={};m(j,"ParameterType",()=>o),(t=o||(o={})).CONSTANT="CONSTANT",t.EXPRESSION="EXPRESSION";const W="value";class X{static{this.SCHEMA_NAME="Parameter"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(X.SCHEMA_NAME).setProperties(new Map([["schema",Y.SCHEMA],["parameterName",Y.ofString("parameterName")],["variableArgument",Y.of("variableArgument",i.BOOLEAN).setDefaultValue(!1)],["type",Y.ofString("type").setEnums(["EXPRESSION","CONSTANT"])]]))}static{this.EXPRESSION=new Y().setNamespace(p.SYSTEM).setName("ParameterExpression").setType(L.of(i.OBJECT)).setProperties(new Map([["isExpression",Y.ofBoolean("isExpression").setDefaultValue(!0)],[W,Y.ofAny(W)]]))}constructor(e,t){if(this.variableArgument=!1,this.type=o.EXPRESSION,e instanceof X)this.schema=new Y(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,n=o.EXPRESSION){return[e,new X(e,t).setType(n).setVariableArgument(r)]}static of(e,t,r=!1,n=o.EXPRESSION){return new X(e,t).setType(n).setVariableArgument(r)}static from(e){let t=Y.from(e.schema);if(!t)throw new $("","Parameter requires Schema");return new X(e.parameterName,t).setVariableArgument(!!e.variableArgument).setType(e.type??o.EXPRESSION)}}var J={};m(J,"MapUtil",()=>q),m(J,"MapEntry",()=>z);class q{static of(e,t,r,n,s,a,i,o,E,u,A,T,l,R,m,g,h,c,p,N){let f=new Map;return _(e)||_(t)||f.set(e,t),_(r)||_(n)||f.set(r,n),_(s)||_(a)||f.set(s,a),_(i)||_(o)||f.set(i,o),_(E)||_(u)||f.set(E,u),_(A)||_(T)||f.set(A,T),_(l)||_(R)||f.set(l,R),_(m)||_(g)||f.set(m,g),_(h)||_(c)||f.set(h,c),_(p)||_(N)||f.set(p,N),f}static ofArrayEntries(...e){let t=new Map;for(let[r,n]of e)t.set(r,n);return t}static entry(e,t){return new z(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 z{constructor(e,t){this.k=e,this.v=t}}const K=new Map([["any",Y.ofAny("any").setNamespace(p.SYSTEM)],["boolean",Y.ofBoolean("boolean").setNamespace(p.SYSTEM)],["double",Y.ofDouble("double").setNamespace(p.SYSTEM)],["float",Y.ofFloat("float").setNamespace(p.SYSTEM)],["integer",Y.ofInteger("integer").setNamespace(p.SYSTEM)],["long",Y.ofLong("long").setNamespace(p.SYSTEM)],["number",Y.ofNumber("number").setNamespace(p.SYSTEM)],["string",Y.ofString("string").setNamespace(p.SYSTEM)],["Timestamp",Y.ofString("Timestamp").setNamespace(p.DATE)],["Timeunit",Y.ofString("Timeunit").setNamespace(p.DATE).setEnums(["YEARS","QUARTERS","MONTHS","WEEKS","DAYS","HOURS","MINUTES","SECONDS","MILLISECONDS"])],["Duration",Y.ofObject("Duration").setNamespace(p.DATE).setProperties(q.ofArrayEntries(["years",Y.ofInteger("years")],["quarters",Y.ofInteger("quarters")],["months",Y.ofInteger("months")],["weeks",Y.ofInteger("weeks")],["days",Y.ofInteger("days")],["hours",Y.ofInteger("hours")],["minutes",Y.ofInteger("minutes")],["seconds",Y.ofLong("seconds")],["milliseconds",Y.ofLong("milliseconds")])).setAdditionalItems(B.from(!1))],["TimeObject",Y.ofObject("TimeObject").setNamespace(p.DATE).setProperties(q.ofArrayEntries(["year",Y.ofInteger("year")],["month",Y.ofInteger("month")],["day",Y.ofInteger("day")],["hour",Y.ofInteger("hour")],["minute",Y.ofInteger("minute")],["second",Y.ofLong("second")],["millisecond",Y.ofLong("millisecond")])).setAdditionalItems(B.from(!1))],[X.EXPRESSION.getName(),X.EXPRESSION],[Y.NULL.getName(),Y.NULL],[Y.SCHEMA.getName(),Y.SCHEMA]]),Q=Array.from(K.values()).map(e=>e.getFullName());class Z{async find(e,t){return p.SYSTEM!=e&&p.DATE!=e?Promise.resolve(void 0):Promise.resolve(K.get(t))}async filter(e){return Promise.resolve(Q.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var ee={};function et(e){return[e.getSignature().getName(),e]}m(ee,"KIRunFunctionRepository",()=>sH);var er={};m(er,"EventResult",()=>ea);var en={};m(en,"Event",()=>es);class es{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 Y().setNamespace(p.SYSTEM).setName(es.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["name",Y.ofString("name")],["parameters",Y.ofObject("parameter").setAdditionalProperties(new B().setSchemaValue(Y.SCHEMA))]]))}constructor(e,t){if(e instanceof es)this.name=e.name,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new Y(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 es.eventMapEntry(es.OUTPUT,e)}static eventMapEntry(e,t){return[e,new es(e,t)]}static from(e){return new es(e.name,new Map(Object.entries(e.parameters??{}).map(e=>{let t=Y.from(e[1]);if(!t)throw new $("","Event expects a schema");return[e[0],t]})))}}class ea{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 ea.of(es.OUTPUT,e)}static of(e,t){return new ea(e,t)}}var ei={};m(ei,"FunctionOutput",()=>eu);var eo={};m(eo,"KIRuntimeException",()=>eE);class eE extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class eu{constructor(e){if(this.index=0,_(e))throw new eE("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof ea?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 eA={};m(eA,"FunctionSignature",()=>eT);class eT{static{this.SCHEMA_NAME="FunctionSignature"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(eT.SCHEMA_NAME).setProperties(new Map([["name",Y.ofString("name")],["namespace",Y.ofString("namespace")],["parameters",Y.ofObject("parameters").setAdditionalProperties(new B().setSchemaValue(X.SCHEMA))],["events",Y.ofObject("events").setAdditionalProperties(new B().setSchemaValue(es.SCHEMA))]]))}constructor(e){this.namespace="_",this.parameters=new Map,this.events=new Map,e instanceof eT?(this.name=e.name,this.namespace=e.namespace,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new X(e[1])])),this.events=new Map(Array.from(e.events.entries()).map(e=>[e[0],new es(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 el={};m(el,"AbstractFunction",()=>e3);var eR={};m(eR,"SchemaValidator",()=>e9);var em={};m(em,"deepEqual",()=>ef);var eg={};m(eg,"LinkedList",()=>ep);var eh={};m(eh,"StringFormatter",()=>ec);class ec{static format(e,...t){if(!t||0==t.length)return e;let r="",n=0,s="",a=s,i=e.length;for(let o=0;o<i;o++)"$"==(s=e.charAt(o))&&"\\"==a?r=r.substring(0,o-1)+s:"$"==s&&n<t.length?r+=t[n++]:r+=s,a=s;return r.toString()}constructor(){}}class ep{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 eN(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new eN(t);this.length=e.length}}push(e){let t=new eN(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 eE(ec.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 eN(e,this.head),this.head.next=this.tail):(this.tail=new eN(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new eN(e),this}map(e,t){let r=new ep,n=this.head,s=0;for(;n;)r.add(e(n.value,s)),n=n.next,++s;return r}indexOf(e){let t=this.head,r=0;for(;t;){if(ef(t.value,e))return r;t=t.next,++r}return -1}forEach(e,t){let r=this.head,n=0;for(;r;)e(r.value,n),r=r.next,++n}}class eN{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}function ef(e,t){let r=new ep;r.push(e);let n=new ep;for(n.push(t);!r.isEmpty()&&!n.isEmpty();){let e=r.pop(),t=n.pop();if(e===t)continue;let s=typeof e,a=typeof t;if("undefined"===s||"undefined"===a){if(!e&&!t)continue;return!1}if(s!==a)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!=t.length)return!1;for(let s=0;s<e.length;s++)r.push(e[s]),n.push(t[s]);continue}if("object"===s){if("object"!==a||null===e||null===t)return!1;let s=Object.entries(e),i=Object.entries(t);if(s.length!==i.length)return!1;for(let[e,a]of s)r.push(a),n.push(t[e]);continue}return!1}return!0}var e_={};m(e_,"StringUtil",()=>eM);class eM{constructor(){}static nthIndex(e,t,r=0,n){if(!e)throw new eE("String cannot be null");if(r<0||r>=e.length)throw new eE(ec.format("Cannot search from index : $",r));if(n<=0||n>e.length)throw new eE(ec.format("Cannot search for occurance : $",n));for(;r<e.length;){if(e.charAt(r)==t&&0==--n)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 eS={};m(eS,"SchemaUtil",()=>ex);var eO={};m(eO,"Tuple2",()=>ew),m(eO,"Tuple3",()=>eI),m(eO,"Tuple4",()=>eP);class ew{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 eI extends ew{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 eP extends eI{constructor(e,t,r,n){super(e,t,r),this.fr=n}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 ed={};m(ed,"SchemaValidationException",()=>ey);class ey extends Error{constructor(e,t,r=[],n){super(t+(r?r.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.cause=n}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class ex{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():_(e.getDefaultValue())?ex.getDefaultValue(await ex.getSchemaFromRef(e,t,e.getRef()),t):e.getDefaultValue()}static async hasDefaultValueOrNullSchemaType(e,t){return e?e.getConstant()||!_(e.getDefaultValue())?Promise.resolve(!0):_(e.getRef())?e.getType()?.getAllowedSchemaTypes().has(i.NULL)?Promise.resolve(!0):Promise.resolve(!1):this.hasDefaultValueOrNullSchemaType(await ex.getSchemaFromRef(e,t,e.getRef()),t):Promise.resolve(!1)}static async getSchemaFromRef(e,t,r,n=0){if(++n==ex.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new ey(r??"","Schema has a cyclic reference");if(!e||!r||eM.isNullOrBlank(r))return Promise.resolve(void 0);if(!r.startsWith("#")){var s=await ex.resolveExternalSchema(e,t,r);s&&(e=s.getT1(),r=s.getT2())}let a=r.split("/");return 1===a.length?Promise.resolve(e):Promise.resolve(ex.resolveInternalSchema(e,t,r,n,a,1))}static async resolveInternalSchema(e,t,r,n,s,a){let o=e;if(a!==s.length){for(;a<s.length;){if("$defs"===s[a]){if(++a>=s.length||!o.get$defs())throw new $(r,ex.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);o=o.get$defs()?.get(s[a])}else{if(o&&(!o.getType()?.contains(i.OBJECT)||!o.getProperties()))throw new $(r,"Cannot retrievie schema from non Object type schemas");o=o.getProperties()?.get(s[a])}if(a++,!o||!eM.isNullOrBlank(o.getRef())&&!(o=await ex.getSchemaFromRef(o,t,o.getRef(),n)))throw new $(r,ex.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return Promise.resolve(o)}}static async resolveExternalSchema(e,t,r){if(!t)return Promise.resolve(void 0);let n=eM.splitAtFirstOccurance(r??"","/");if(!n[0])return Promise.resolve(void 0);let s=eM.splitAtLastOccurance(n[0],".");if(!s[0]||!s[1])return Promise.resolve(void 0);let a=await t.find(s[0],s[1]);if(!a)return Promise.resolve(void 0);if(!n[1]||""===n[1])return Promise.resolve(new ew(a,r));if(r="#/"+n[1],!a)throw new $(r,ex.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return Promise.resolve(new ew(a,r))}constructor(){}}var eL={};m(eL,"AnyOfAllOfOneOfValidator",()=>ev);class ev{static async validate(e,t,r,n,s,a){let i=[];return t.getOneOf()&&!t.getOneOf()?await ev.oneOf(e,t,r,n,i,s,a):t.getAllOf()&&!t.getAllOf()?await ev.allOf(e,t,r,n,i,s,a):t.getAnyOf()&&!t.getAnyOf()?await ev.anyOf(e,t,r,n,i,s,a):n}static async anyOf(e,t,r,n,s,a,i){let o=!1;for(let E of t.getAnyOf()??[])try{await ev.validate(e,E,r,n,a,i),o=!0;break}catch(e){o=!1,s.push(e)}if(o)return n;throw new ey(e9.path(e),"The value don't satisfy any of the schemas.",s)}static async allOf(e,t,r,n,s,a,i){let o=0;for(let E of t.getAllOf()??[])try{await ev.validate(e,E,r,n,a,i),o++}catch(e){s.push(e)}if(o===t.getAllOf()?.length)return n;throw new ey(e9.path(e),"The value doesn't satisfy some of the schemas.",s)}static async oneOf(e,t,r,n,s,a,i){let o=0;for(let E of t.getOneOf()??[])try{await ev.validate(e,E,r,n,a,i),o++}catch(e){s.push(e)}if(1===o)return n;throw new ey(e9.path(e),0==o?"The value does not satisfy any schema":"The value satisfy more than one schema",s)}constructor(){}}var eU={};m(eU,"TypeValidator",()=>e2);var eV={};m(eV,"ArrayValidator",()=>eC);class eC{static async validate(e,t,r,n,s,a){if(_(n))throw new ey(e9.path(e),"Expected an array but found null");if(!Array.isArray(n))throw new ey(e9.path(e),n.toString()+" is not an Array");return eC.checkMinMaxItems(e,t,n),await eC.checkItems(e,t,r,n,s,a),eC.checkUniqueItems(e,t,n),await eC.checkContains(t,e,r,n),n}static async checkContains(e,t,r,n){if(_(e.getContains()))return;let s=await eC.countContains(t,e,r,n,_(e.getMinContains())&&_(e.getMaxContains()));if(0===s)throw new ey(e9.path(t),"None of the items are of type contains schema");if(!_(e.getMinContains())&&e.getMinContains()>s)throw new ey(e9.path(t),"The minimum number of the items of type contains schema should be "+e.getMinContains()+" but found "+s);if(!_(e.getMaxContains())&&e.getMaxContains()<s)throw new ey(e9.path(t),"The maximum number of the items of type contains schema should be "+e.getMaxContains()+" but found "+s)}static async countContains(e,t,r,n,s){let a=0;for(let i=0;i<n.length;i++){let o=e?[...e]:[];try{if(await e9.validate(o,t.getContains(),r,n[i]),a++,s)break}catch(e){}}return a}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()&&new Set(r).size!==r.length)throw new ey(e9.path(e),"Items on the array are not unique")}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new ey(e9.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new ey(e9.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static async checkItems(e,t,r,n,s,a){if(!t.getItems())return;let i=t.getItems();if(i.getSingleSchema())for(let t=0;t<n.length;t++){let o=e?[...e]:[];n[t]=await e9.validate(o,i.getSingleSchema(),r,n[t],s,a)}if(i.getTupleSchema()){if(i.getTupleSchema().length!==n.length&&_(t?.getAdditionalItems()))throw new ey(e9.path(e),"Expected an array with only "+i.getTupleSchema().length+" but found "+n.length);await this.checkItemsInTupleSchema(e,r,n,i),await this.checkAdditionalItems(e,t,r,n,i)}}static async checkItemsInTupleSchema(e,t,r,n,s,a){for(let i=0;i<n.getTupleSchema()?.length;i++){let o=e?[...e]:[];r[i]=await e9.validate(o,n.getTupleSchema()[i],t,r[i],s,a)}}static async checkAdditionalItems(e,t,r,n,s){if(!_(t.getAdditionalItems())){let a=t.getAdditionalItems();if(a?.getBooleanValue()){let i=Y.ofAny("item");if(a?.getBooleanValue()===!1&&n.length>s.getTupleSchema()?.length)throw new ey(e9.path(e),"No Additional Items are defined");await this.checkEachItemInAdditionalItems(e,t,r,n,s,i)}else if(a?.getSchemaValue()){let i=a.getSchemaValue();await this.checkEachItemInAdditionalItems(e,t,r,n,s,i)}}}static async checkEachItemInAdditionalItems(e,t,r,n,s,a){for(let t=s.getTupleSchema()?.length;t<n.length;t++){let s=e?[...e]:[];n[t]=await e9.validate(s,a,r,n[t])}}constructor(){}}var eD={};m(eD,"BooleanValidator",()=>eG);class eG{static validate(e,t,r){if(_(r))throw new ey(e9.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new ey(e9.path(e),r.toString()+" is not a boolean");return r}constructor(){}}var eb={};m(eb,"NullValidator",()=>eF);class eF{static validate(e,t,r){if(_(r))return r;throw new ey(e9.path(e),"Expected a null but found "+r)}constructor(){}}var eB={};m(eB,"NumberValidator",()=>eY);class eY{static validate(e,t,r,n){if(_(n))throw new ey(e9.path(t),"Expected a number but found null");if("number"!=typeof n)throw new ey(e9.path(t),n.toString()+" is not a "+e);let s=eY.extractNumber(e,t,r,n);return eY.checkRange(t,r,n,s),eY.checkMultipleOf(t,r,n,s),n}static extractNumber(e,t,r,n){let s=n;try{(e==i.LONG||e==i.INTEGER)&&(s=Math.round(s))}catch(r){throw new ey(e9.path(t),n+" is not a number of type "+e,r)}if(_(s)||(e==i.LONG||e==i.INTEGER)&&s!=n)throw new ey(e9.path(t),n.toString()+" is not a number of type "+e);return s}static checkMultipleOf(e,t,r,n){if(t.getMultipleOf()&&n%t.getMultipleOf()!=0)throw new ey(e9.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}static checkRange(e,t,r,n){if(!_(t.getMinimum())&&0>eY.numberCompare(n,t.getMinimum()))throw new ey(e9.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(!_(t.getMaximum())&&eY.numberCompare(n,t.getMaximum())>0)throw new ey(e9.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(!_(t.getExclusiveMinimum())&&0>=eY.numberCompare(n,t.getExclusiveMinimum()))throw new ey(e9.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(!_(t.getExclusiveMaximum())&&eY.numberCompare(n,t.getExclusiveMaximum())>0)throw new ey(e9.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}var eH={};m(eH,"ObjectValidator",()=>ek);class ek{static async validate(e,t,r,n,s,a){if(_(n))throw new ey(e9.path(e),"Expected an object but found null");if("object"!=typeof n||Array.isArray(n))throw new ey(e9.path(e),n.toString()+" is not an Object");let i=new Set(Object.keys(n));return ek.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&await ek.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&ek.checkRequired(e,t,n),t.getProperties()&&await ek.checkProperties(e,t,r,n,i,s,a),t.getPatternProperties()&&await ek.checkPatternProperties(e,t,r,n,i),t.getAdditionalProperties()&&await ek.checkAdditionalProperties(e,t,r,n,i),n}static async checkPropertyNameSchema(e,t,r,n){for(let s of Array.from(n.values()))try{await e9.validate(e,t.getPropertyNames(),r,s)}catch(t){throw new ey(e9.path(e),"Property name '"+s+"' does not fit the property schema")}}static checkRequired(e,t,r){for(let n of t.getRequired()??[])if(_(r[n]))throw new ey(e9.path(e),n+" is mandatory")}static async checkAdditionalProperties(e,t,r,n,s){let a=t.getAdditionalProperties();if(a.getSchemaValue())for(let t of Array.from(s.values())){let s=e?[...e]:[];n[t]=await e9.validate(s,a.getSchemaValue(),r,n[t])}else if(!1===a.getBooleanValue()&&s.size)throw new ey(e9.path(e),Array.from(s)+" is/are additional properties which are not allowed.")}static async checkPatternProperties(e,t,r,n,s){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(s.values())){let o=e?[...e]:[];for(let e of Array.from(a.entries()))if(e[1].test(i)){n[i]=await e9.validate(o,t.getPatternProperties().get(e[0]),r,n[i]),s.delete(i);break}}}static async checkProperties(e,t,r,n,s,a,i){for(let o of Array.from(t.getProperties())){let t=n[o[0]];if(!n.hasOwnProperty(o[0])&&_(t)&&_(await ex.getDefaultValue(o[1],r)))continue;let E=e?[...e]:[];n[o[0]]=await e9.validate(E,o[1],r,t,a,i),s.delete(o[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new ey(e9.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new ey(e9.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}var e$={};m(e$,"StringValidator",()=>eW);var ej={};m(ej,"StringFormat",()=>E),(r=E||(E={})).DATETIME="DATETIME",r.TIME="TIME",r.DATE="DATE",r.EMAIL="EMAIL",r.REGEX="REGEX";class eW{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))throw new ey(e9.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new ey(e9.path(e),r.toString()+" is not String");t.getFormat()==E.TIME?eW.patternMatcher(e,t,r,eW.TIME,"time pattern"):t.getFormat()==E.DATE?eW.patternMatcher(e,t,r,eW.DATE,"date pattern"):t.getFormat()==E.DATETIME?eW.patternMatcher(e,t,r,eW.DATETIME,"date time pattern"):t.getFormat()==E.EMAIL?eW.patternMatcher(e,t,r,eW.EMAIL,"email pattern"):t.getPattern()&&eW.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let n=r.length;if(t.getMinLength()&&n<t.getMinLength())throw new ey(e9.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&n>t.getMaxLength())throw new ey(e9.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,n,s){if(!n.test(r))throw new ey(e9.path(e),r.toString()+" is not matched with the "+s)}constructor(){}}(n=u||(u={})).STRICT="STRICT",n.LENIENT="LENIENT",n.USE_DEFAULT="USE_DEFAULT",n.SKIP="SKIP";const eX=e=>u[e.toUpperCase()],eJ=()=>Object.values(u);class eq extends Error{constructor(e,t,r,n,s=[],a){super(r+(s?s.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.source=t??null,this.mode=n??null,this.cause=a}getSchemaPath(){return this.schemaPath}getSource(){return this.source??null}getMode(){return this.mode??null}getCause(){return this.cause}}class ez{static handleUnConvertibleValue(e,t,r,n){return this.handleUnConvertibleValueWithDefault(e,t,r,null,n)}static handleUnConvertibleValueWithDefault(e,t,r,n,s){switch(null===t&&(t=u.STRICT),t){case u.STRICT:throw new eq(e9.path(e),r,s,t);case u.LENIENT:return null;case u.USE_DEFAULT:return n;case u.SKIP:return r;default:throw new eq(e9.path(e),r,"Invalid conversion mode")}}constructor(){}}class eK{static convert(e,t,r,n){if(_(n))return ez.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Expected a string but found null");let s=n??("object"==typeof n?JSON.stringify(n):String(n));return this.getConvertedString(s,r)}static getConvertedString(e,t){return t===u.STRICT?e.toString():e.trim()}static getDefault(e){return e.getDefaultValue()??null}constructor(){}}class eQ{static convert(e,t,r,n,s){if(_(s))return ez.handleUnConvertibleValueWithDefault(e,n,s,this.getDefault(r),"Expected a number but found null");if("object"==typeof s||"boolean"==typeof s||Array.isArray(s)||"string"==typeof s&&isNaN(s=Number(s)))return ez.handleUnConvertibleValueWithDefault(e,n,s,this.getDefault(r),s+" is not a "+t);let a=this.extractNumber(t,s,n);return null===a?ez.handleUnConvertibleValueWithDefault(e,n,s,this.getDefault(r),s+" is not a "+t):a}static extractNumber(e,t,r){if("number"!=typeof t)return null;switch(e){case i.INTEGER:return this.isInteger(t,r)?Math.floor(t):null;case i.LONG:return this.isLong(t,r)?Math.floor(t):null;case i.DOUBLE:return t;case i.FLOAT:return this.isFloat(t,r)?t:null;default:return null}}static isInteger(e,t){return t!==u.STRICT?"number"==typeof e:Number.isInteger(e)}static isLong(e,t){return t!==u.STRICT?"number"==typeof e:Number.isInteger(e)&&e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER}static isFloat(e,t){return t!==u.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 eZ{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,n){return null==n?ez.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Expected a boolean but found null"):this.getBooleanPrimitive(n)??ez.handleUnConvertibleValueWithDefault(e,r,n,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 eZ.BOOLEAN_MAP[t]??null}static handleNumberValue(e){return 0===e||1===e?1===e:null}static getDefault(e){return e.getDefaultValue()??!1}constructor(){}}class e0{static convert(e,t,r,n){return _(n)?n:"string"==typeof n&&"null"===n.toLowerCase()?null:ez.handleUnConvertibleValueWithDefault(e,r,n,null,"Unable to convert to null")}constructor(){}}class e1{static handleValidationError(e,t,r,n,s){switch(t=t??u.STRICT){case u.STRICT:throw new ey(e9.path(e),s);case u.LENIENT:return null;case u.USE_DEFAULT:return n;case u.SKIP:return r}}constructor(){}}class e2{static async validate(e,t,r,n,s,a,o){return t==i.OBJECT?await ek.validate(e,r,n,s,a,o):t==i.ARRAY?await eC.validate(e,r,n,s,a,o):this.handleTypeValidationAndConversion(e,t,r,s,a,o)}static async handleTypeValidationAndConversion(e,t,r,n,s,a){let i=s?this.convertElement(e,t,r,n,a??u.STRICT):n;return await this.validateElement(e,t,r,i,a??u.STRICT)}static convertElement(e,t,r,n,s){if(_(t))return ez.handleUnConvertibleValueWithDefault(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type for conversion.",t));switch(t){case i.STRING:return eK.convert(e,r,s,n);case i.INTEGER:case i.LONG:case i.DOUBLE:case i.FLOAT:return eQ.convert(e,t,r,s,n);case i.BOOLEAN:return eZ.convert(e,r,s,n);case i.NULL:return e0.convert(e,r,s,n);default:return ez.handleUnConvertibleValueWithDefault(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type for conversion.",t))}}static validateElement(e,t,r,n,s){if(_(t))return e1.handleValidationError(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type.",t));switch(t){case i.STRING:return eW.validate(e,r,n);case i.INTEGER:case i.LONG:case i.DOUBLE:case i.FLOAT:return eY.validate(t,e,r,n);case i.BOOLEAN:return eG.validate(e,r,n);case i.NULL:return eF.validate(e,r,n);default:return e1.handleValidationError(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type.",t))}}constructor(){}}class e9{static{this.ORDER={[i.OBJECT]:0,[i.ARRAY]:1,[i.DOUBLE]:2,[i.FLOAT]:3,[i.LONG]:4,[i.INTEGER]:5,[i.STRING]:6,[i.BOOLEAN]:7,[i.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,n,s,a){if(!t)throw new ey(e9.path(e),"No schema found to validate");if(e||(e=[]),e.push(t),_(n)&&!_(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(!_(t.getConstant()))return e9.constantValidation(e,t,n);if(t.getEnums()&&!t.getEnums()?.length)return e9.enumCheck(e,t,n);if(t.getFormat()&&_(t.getType()))throw new ey(this.path(e),"Type is missing in schema for declared "+t.getFormat()?.toString()+" format.");if(!0===s&&_(t.getType()))throw new ey(this.path(e),"Type is missing in schema for declared "+a);if(t.getType()&&(n=await e9.typeValidation(e,t,r,n,s,a)),!eM.isNullOrBlank(t.getRef()))return await e9.validate(e,await ex.getSchemaFromRef(e[0],r,t.getRef()),r,n,s,a);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&(n=await ev.validate(e,t,r,n,s,a)),t.getNot()){let i;try{await e9.validate(e,t.getNot(),r,n,s,a),i=!0}catch(e){i=!1}if(i)throw new ey(e9.path(e),"Schema validated value in not condition.")}return n}static constantValidation(e,t,r){if(!ef(t.getConstant(),r))throw new ey(e9.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let n=!1;for(let e of t.getEnums()??[])if(e===r){n=!0;break}if(n)return r;throw new ey(e9.path(e),"Value is not one of "+t.getEnums())}static async typeValidation(e,t,r,n,s,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 e2.validate(e,E,t,r,n,s,a)}catch(e){o.push(e)}throw new ey(e9.path(e),"Value "+JSON.stringify(n)+" is not of valid type(s)",o)}constructor(){}}class e3{async validateArguments(e,t,r){let n=new Map;for(let s of Array.from(this.getSignature().getParameters().entries())){let a=s[1];try{let r=await this.validateArgument(e,t,s,a);n.set(r.getT1(),r.getT2())}catch(t){let e=this.getSignature();throw new eE(`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 n}async validateArgument(e,t,r,n){let s,a=r[0],i=e.get(r[0]);if(_(i)&&!n.isVariableArgument())return new ew(a,await e9.validate(void 0,n.getSchema(),t,void 0));if(!n?.isVariableArgument())return new ew(a,await e9.validate(void 0,n.getSchema(),t,i));Array.isArray(i)?s=i:(s=[],_(i)?_(n.getSchema().getDefaultValue())||s.push(n.getSchema().getDefaultValue()):s.push(i));for(let e=0;e<s.length;e++)s[e]=await e9.validate(void 0,n.getSchema(),t,s[e]);return new ew(a,s)}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 eE(`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 e4 extends e3{static{this.EVENT_INDEX_NAME="index"}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_INDEX=new es(es.OUTPUT,q.of(e4.EVENT_INDEX_NAME,Y.ofInteger(e4.EVENT_INDEX_NAME)))}static{this.EVENT_RESULT_INTEGER=new es(es.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofInteger(e4.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_BOOLEAN=new es(es.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofBoolean(e4.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_ARRAY=new es(es.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofArray(e4.EVENT_RESULT_NAME,Y.ofAny(e4.EVENT_RESULT_NAME))))}static{this.EVENT_RESULT_EMPTY=new es(es.OUTPUT,q.of())}static{this.EVENT_RESULT_ANY=new es(es.OUTPUT,q.of(this.EVENT_RESULT_NAME,Y.ofAny(this.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_OBJECT=new es(es.OUTPUT,q.of(this.EVENT_RESULT_NAME,Y.ofObject(this.EVENT_RESULT_NAME)))}static{this.PARAMETER_INT_LENGTH=X.of("length",Y.ofInteger("length").setDefaultValue(-1))}static{this.PARAMETER_ARRAY_FIND=X.of("find",Y.ofArray("eachFind",Y.ofAny("eachFind")))}static{this.PARAMETER_INT_SOURCE_FROM=X.of("srcFrom",Y.ofInteger("srcFrom").setDefaultValue(0).setMinimum(0))}static{this.PARAMETER_INT_SECOND_SOURCE_FROM=X.of("secondSrcFrom",Y.ofInteger("secondSrcFrom").setDefaultValue(0))}static{this.PARAMETER_INT_FIND_FROM=X.of("findFrom",Y.ofInteger("findFrom").setDefaultValue(0))}static{this.PARAMETER_INT_OFFSET=X.of("offset",Y.ofInteger("offset").setDefaultValue(0))}static{this.PARAMETER_ROTATE_LENGTH=X.of("rotateLength",Y.ofInteger("rotateLength").setDefaultValue(1).setMinimum(1))}static{this.PARAMETER_BOOLEAN_ASCENDING=X.of("ascending",Y.ofBoolean("ascending").setDefaultValue(!0))}static{this.PARAMETER_KEY_PATH=X.of("keyPath",Y.ofString("keyPath").setDefaultValue(""))}static{this.PARAMETER_FIND_PRIMITIVE=X.of("findPrimitive",Y.of("findPrimitive",i.STRING,i.DOUBLE,i.FLOAT,i.INTEGER,i.LONG))}static{this.PARAMETER_ARRAY_SOURCE=X.of("source",Y.ofArray("eachSource",Y.ofAny("eachSource")))}static{this.PARAMETER_ARRAY_SECOND_SOURCE=X.of("secondSource",Y.ofArray("eachSecondSource",Y.ofAny("eachSecondSource")))}static{this.PARAMETER_ARRAY_SOURCE_PRIMITIVE=X.of("source",Y.ofArray("eachSource",new Y().setName("eachSource").setType(L.of(i.STRING,i.NULL,i.INTEGER,i.FLOAT,i.DOUBLE,i.LONG))))}static{this.PARAMETER_BOOLEAN_DEEP_COPY=X.of("deepCopy",Y.ofBoolean("deepCopy").setDefaultValue(!0))}static{this.PARAMETER_ANY=X.of("element",Y.ofAny("element"))}static{this.PARAMETER_ANY_ELEMENT_OBJECT=X.of("elementObject",Y.ofAny("elementObject"))}static{this.PARAMETER_ANY_VAR_ARGS=X.of("element",Y.ofAny("element")).setVariableArgument(!0)}static{this.PARAMETER_ARRAY_RESULT=X.of(e4.EVENT_RESULT_NAME,Y.ofArray("eachResult",Y.ofAny("eachResult")))}constructor(e,t,r){super();let n=new Map;for(let e of t)n.set(e.getParameterName(),e);this.signature=new eT(e).setNamespace(p.SYSTEM_ARRAY).setParameters(n).setEvents(q.of(r.getName(),r))}getSignature(){return this.signature}}class e5 extends e4{constructor(){super("Concatenate",[e4.PARAMETER_ARRAY_SOURCE,e4.PARAMETER_ARRAY_SECOND_SOURCE],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName());return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,[...t,...r]]]))])}}class e6 extends e4{constructor(){super("AddFirst",[e4.PARAMETER_ARRAY_SOURCE,e4.PARAMETER_ANY],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e4.PARAMETER_ANY.getParameterName());if(0==(t=[...t]).length)return t.push(r),new eu([ea.outputOf(new Map([]))]);t.push(r);let n=t.length-1;for(;n>0;){let e=t[n-1];t[n-1]=t[n],t[n--]=e}return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}const e7="keyName";class e8 extends e4{constructor(){super("ArrayToArrayOfObjects",[e4.PARAMETER_ARRAY_SOURCE,X.of(e7,Y.ofString(e7),!0)],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e8.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e7);if(!t?.length)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,[]]]))]);let n=t.map(e=>{let t={};if(Array.isArray(e)){if(r.length)r.forEach((r,n)=>{t[r]=e[n]});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 eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,n]]))])}}var te={};m(te,"PrimitiveUtil",()=>tn);var tt={};m(tt,"ExecutionException",()=>tr);class tr extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class tn{static findPrimitiveNullAsBoolean(e){if(_(e))return new ew(i.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new tr(ec.format("$ is not a primitive type",e));return"boolean"===t?new ew(i.BOOLEAN,e):"string"===t?new ew(i.STRING,e):tn.findPrimitiveNumberType(e)}static findPrimitive(e){if(_(e))return new ew(i.NULL,void 0);let t=typeof e;if("object"===t)throw new tr(ec.format("$ is not a primitive type",e));return"boolean"===t?new ew(i.BOOLEAN,e):"string"===t?new ew(i.STRING,e):tn.findPrimitiveNumberType(e)}static findPrimitiveNumberType(e){if(_(e)||Array.isArray(e)||"object"==typeof e)throw new tr(ec.format("Unable to convert $ to a number.",e));try{if(Number.isInteger(e))return new ew(i.LONG,e);return new ew(i.DOUBLE,e)}catch(t){throw new tr(ec.format("Unable to convert $ to a number.",e),t)}}static compare(e,t){if(e==t)return 0;if(_(e)||_(t))return _(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 n=this.compare(e[r],t[r]);if(0!=n)return n}return 0}return Array.isArray(e)?-1:1}let r=typeof e,n=typeof t;return"object"===r||"object"===n?("object"===r&&"object"===n&&Object.keys(e).forEach(r=>{let n=this.compare(e[r],t[r]);if(0!=n)return n}),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return _(e)||_(t)?_(e)&&_(t)?0:_(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)?i.LONG:i.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class ts extends e4{constructor(){super("BinarySearch",[ts.PARAMETER_ARRAY_SOURCE_PRIMITIVE,ts.PARAMETER_INT_SOURCE_FROM,ts.PARAMETER_FIND_PRIMITIVE,ts.PARAMETER_INT_LENGTH],ts.EVENT_INDEX)}async internalExecute(e){let t=e?.getArguments()?.get(ts.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ts.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(ts.PARAMETER_FIND_PRIMITIVE.getParameterName()),s=e?.getArguments()?.get(ts.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length||r<0||r>t.length)throw new eE("Search source array cannot be empty");if(-1==s&&(s=t.length-r),(s=r+s)>t.length)throw new eE("End point for array cannot be more than the size of the source array");let a=-1;for(;r<=s;){let e=Math.floor((r+s)/2);if(0==tn.compare(t[e],n)){a=e;break}tn.compare(t[e],n)>0?s=e-1:r=e+1}return new eu([ea.outputOf(new Map([[ts.EVENT_INDEX_NAME,a]]))])}}var ta={};m(ta,"ArrayUtil",()=>ti);class ti{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 to extends e4{constructor(){super("Compare",ti.of(to.PARAMETER_ARRAY_SOURCE,to.PARAMETER_INT_SOURCE_FROM,to.PARAMETER_ARRAY_FIND,to.PARAMETER_INT_FIND_FROM,to.PARAMETER_INT_LENGTH),to.EVENT_RESULT_INTEGER)}async internalExecute(e){var t=e?.getArguments()?.get(to.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(to.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(to.PARAMETER_ARRAY_FIND.getParameterName()),s=e?.getArguments()?.get(to.PARAMETER_INT_FIND_FROM.getParameterName()),a=e?.getArguments()?.get(to.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new eE("Compare source array cannot be empty");if(0==n.length)throw new eE("Compare find array cannot be empty");if(-1==a&&(a=t.length-r),r+a>t.length)throw new eE(ec.format("Source array size $ is less than comparing size $",t.length,r+a));if(s+a>n.length)throw new eE(ec.format("Find array size $ is less than comparing size $",n.length,s+a));return new eu(ti.of(ea.outputOf(q.of(to.EVENT_RESULT_NAME,this.compare(t,r,r+a,n,s,s+a)))))}compare(e,t,r,n,s,a){if(r<t){let e=t;t=r,r=e}if(a<s){let e=s;s=a,a=e}if(r-t!=a-s)throw new eE(ec.format("Cannot compare uneven arrays from $ to $ in source array with $ to $ in find array",r,t,a,s));for(let a=t,i=s;a<r;a++,i++){let t=1;if(_(e[a])||_(n[i])){let r=_(e[a]);r==_(n[i])?t=0:r&&(t=-1)}else{let r=typeof e[a],s=typeof n[i];if("object"===r||"object"===s)t=1;else if("string"===r||"string"===s){let r=""+e[a],s=""+n[i];r===s?t=0:r<s&&(t=-1)}else"boolean"===r||"boolean"===s?t=r==s?0:1:"number"===r&&"number"===s&&(t=e[a]-n[i])}if(0!=t)return t}return 0}}var tE={};function tu(e){return e?globalThis.structuredClone?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e)):e}m(tE,"duplicate",()=>tu);class tA extends e4{constructor(){super("Copy",[tA.PARAMETER_ARRAY_SOURCE,tA.PARAMETER_INT_SOURCE_FROM,tA.PARAMETER_INT_LENGTH,tA.PARAMETER_BOOLEAN_DEEP_COPY],tA.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tA.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tA.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tA.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new eE(ec.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));var s=e?.getArguments()?.get(tA.PARAMETER_BOOLEAN_DEEP_COPY.getParameterName());let a=Array(n);for(let e=r;e<r+n;e++)_(t[e])||(a[e-r]=s?tu(t[e]):t[e]);return new eu([ea.outputOf(q.of(tA.EVENT_RESULT_NAME,a))])}}class tT extends e4{constructor(){super("Delete",[e4.PARAMETER_ARRAY_SOURCE,e4.PARAMETER_ANY_VAR_ARGS],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tT.PARAMETER_ANY_VAR_ARGS.getParameterName());if(null==r)throw new eE("The deletable var args are empty. So cannot be proceeded further.");if(0==t.length||0==r.length)throw new eE("Expected a source or deletable for an array but not found any");let n=new Set;for(let e=t.length-1;e>=0;e--)for(let s=0;s<r.length;s++)n.has(e)||0!=tn.compare(t[e],r[s])||n.add(t[e]);return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t.filter(e=>!n.has(e))]]))])}}class tl extends e4{constructor(){super("DeleteFirst",[tl.PARAMETER_ARRAY_SOURCE],tl.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tl.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new eE("Given source array is empty");return(t=[...t]).shift(),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tR extends e4{constructor(){super("DeleteFrom",[tR.PARAMETER_ARRAY_SOURCE,tR.PARAMETER_INT_SOURCE_FROM,tR.PARAMETER_INT_LENGTH],tR.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tR.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tR.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tR.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new eE("There are no elements to be deleted");if(r>=(t=[...t]).length||r<0)throw new eE("The int source for the array should be in between 0 and length of the array ");if(-1==n&&(n=t.length-r),r+n>t.length)throw new eE("Requested length to be deleted is more than the size of array ");return t.splice(r,n),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tm extends e4{constructor(){super("DeleteLast",[tm.PARAMETER_ARRAY_SOURCE],tm.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tm.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new eE("Given source array is empty");return(t=[...t]).pop(),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tg extends e4{constructor(){super("Disjoint",[tg.PARAMETER_ARRAY_SOURCE,tg.PARAMETER_INT_SOURCE_FROM,tg.PARAMETER_ARRAY_SECOND_SOURCE,tg.PARAMETER_INT_SECOND_SOURCE_FROM,tg.PARAMETER_INT_LENGTH],tg.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tg.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tg.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tg.PARAMETER_INT_LENGTH.getParameterName());if(-1==a&&(a=t.length<=n.length?t.length-r:n.length-s),a>t.length||a>n.length||r+a>t.length||s+a>n.length)throw new eE("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(n[e+s]);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 eu([ea.outputOf(new Map([[tg.EVENT_RESULT_NAME,[...E]]]))])}}class th extends e4{constructor(){super("Equals",[th.PARAMETER_ARRAY_SOURCE,th.PARAMETER_INT_SOURCE_FROM,th.PARAMETER_ARRAY_FIND,th.PARAMETER_INT_FIND_FROM,th.PARAMETER_INT_LENGTH],th.EVENT_RESULT_BOOLEAN)}async internalExecute(e){let t=new to,r=(await t.execute(e)).allResults()[0].getResult().get(th.EVENT_RESULT_NAME);return new eu([ea.outputOf(q.of(th.EVENT_RESULT_NAME,0==r))])}}class tc extends e4{constructor(){super("Fill",[tc.PARAMETER_ARRAY_SOURCE,tc.PARAMETER_INT_SOURCE_FROM,tc.PARAMETER_INT_LENGTH,tc.PARAMETER_ANY],tc.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tc.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tc.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tc.PARAMETER_INT_LENGTH.getParameterName()),s=e?.getArguments()?.get(tc.PARAMETER_ANY.getParameterName());if(r<0)throw new eE(ec.format("Arrays out of bound trying to access $ index",r));-1==n&&(n=t.length-r);let a=r+n-t.length;if(t=[...t],a>0)for(let e=0;e<a;e++)t.push();for(let e=r;e<r+n;e++)t[e]=_(s)?s:tu(s);return new eu([ea.outputOf(q.of(e4.EVENT_RESULT_NAME,t))])}}class tp extends e4{constructor(){super("Frequency",[tp.PARAMETER_ARRAY_SOURCE,tp.PARAMETER_ANY,tp.PARAMETER_INT_SOURCE_FROM,tp.PARAMETER_INT_LENGTH],tp.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tp.PARAMETER_ANY.getParameterName()),n=e?.getArguments()?.get(tp.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tp.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[tp.EVENT_RESULT_NAME,0]]))]);if(n>t.length)throw new eE("Given start point is more than the size of source");let a=n+s;if(-1==s&&(a=t.length-n),a>t.length)throw new eE("Given length is more than the size of source");let i=0;for(let e=n;e<a&&e<t.length;e++)0==tn.compare(t[e],r)&&i++;return new eu([ea.outputOf(new Map([[tp.EVENT_RESULT_NAME,i]]))])}}class tN extends e4{constructor(){super("IndexOf",[tN.PARAMETER_ARRAY_SOURCE,tN.PARAMETER_ANY_ELEMENT_OBJECT,tN.PARAMETER_INT_FIND_FROM],tN.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tN.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tN.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),n=e?.getArguments()?.get(tN.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[tN.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new eE("The size of the search index of the array is greater than the size of the array");let s=-1;for(let e=n;e<t.length;e++)if(0==tn.compare(t[e],r)){s=e;break}return new eu([ea.outputOf(new Map([[tN.EVENT_RESULT_NAME,s]]))])}}class tf extends e4{constructor(){super("IndexOfArray",[tf.PARAMETER_ARRAY_SOURCE,tf.PARAMETER_ARRAY_SECOND_SOURCE,tf.PARAMETER_INT_FIND_FROM],tf.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tf.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length||0==r.length)return new eu([ea.outputOf(new Map([[tf.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||t.length<r.length)throw new eE("Given from second source is more than the size of the source array");let s=r.length,a=-1;for(let e=n;e<t.length;e++){let n=0;if(0==tn.compare(t[e],r[n])){for(;n<s&&0==tn.compare(t[e+n],r[n]);)n++;if(n==s){a=e;break}}}return new eu([ea.outputOf(new Map([[tf.EVENT_RESULT_NAME,a]]))])}}class t_ extends e4{constructor(){super("LastIndexOf",[t_.PARAMETER_ARRAY_SOURCE,t_.PARAMETER_ANY_ELEMENT_OBJECT,t_.PARAMETER_INT_FIND_FROM],t_.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t_.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),n=e?.getArguments()?.get(t_.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[t_.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new eE("The value of length shouldn't the exceed the size of the array or shouldn't be in terms");let s=-1;for(let e=t.length-1;e>=n;e--)if(0==tn.compare(t[e],r)){s=e;break}return new eu([ea.outputOf(new Map([[t_.EVENT_RESULT_NAME,s]]))])}}class tM extends e4{constructor(){super("LastIndexOfArray",[tM.PARAMETER_ARRAY_SOURCE,tM.PARAMETER_ARRAY_SECOND_SOURCE,tM.PARAMETER_INT_FIND_FROM],tM.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tM.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tM.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tM.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[tM.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||r.length>t.length)throw new eE("Given from index is more than the size of the source array");let s=r.length,a=-1;for(let e=n;e<t.length;e++){let n=0;if(0==tn.compare(t[e],r[n])){for(;n<s&&0==tn.compare(t[e+n],r[n]);)n++;n==s&&(a=e)}}return new eu([ea.outputOf(new Map([[tM.EVENT_RESULT_NAME,a]]))])}}class tS extends e4{constructor(){super("Max",[tS.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tS.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tS.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==t.length)throw new eE("Search source array cannot be empty");let r=t[0];for(let e=1;e<t.length;e++){let n=t[e];tn.comparePrimitive(r,n)>=0||(r=n)}return new eu([ea.outputOf(new Map([[tS.EVENT_RESULT_NAME,r]]))])}}class tO extends e4{constructor(){super("Min",[tO.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tO.EVENT_RESULT_ANY)}async internalExecute(e){let t,r=e?.getArguments()?.get(tO.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==r.length)throw new eE("Search source array cannot be empty");for(let e=0;e<r.length;e++)!_(r[e])&&(void 0===t||0>tn.comparePrimitive(r[e],t))&&(t=r[e]);return new eu([ea.outputOf(new Map([[tO.EVENT_RESULT_NAME,t]]))])}}class tw extends e4{constructor(){super("MisMatch",[tw.PARAMETER_ARRAY_SOURCE,tw.PARAMETER_INT_FIND_FROM,tw.PARAMETER_ARRAY_SECOND_SOURCE,tw.PARAMETER_INT_SECOND_SOURCE_FROM,tw.PARAMETER_INT_LENGTH],tw.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tw.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tw.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tw.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tw.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tw.PARAMETER_INT_LENGTH.getParameterName()),i=r<t.length&&r>0?r:0,o=s<n.length&&s>0?s:0;if(i+a>=t.length||o+a>n.length)throw new eE("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]!=n[o+e]){E=e;break}return new eu([ea.outputOf(new Map([[tw.EVENT_RESULT_NAME,E]]))])}}class tI extends e4{constructor(){super("Reverse",[tI.PARAMETER_ARRAY_SOURCE,tI.PARAMETER_INT_SOURCE_FROM,tI.PARAMETER_INT_LENGTH],tI.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tI.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tI.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tI.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n>=t.length||n<0||r<0)throw new eE("Please provide start point between the start and end indexes or provide the length which was less than the source size ");t=[...t];let s=r+n-1;for(;r<=s;){let e=t[r],n=t[s];t[r++]=n,t[s--]=e}return new eu([ea.outputOf(new Map([[tI.EVENT_RESULT_NAME,t]]))])}}class tP extends e4{constructor(){super("Rotate",[tP.PARAMETER_ARRAY_SOURCE,tP.PARAMETER_ROTATE_LENGTH],tP.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tP.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tP.PARAMETER_ROTATE_LENGTH.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);let n=(t=[...t]).length;return r%=n,this.rotate(t,0,r-1),this.rotate(t,r,n-1),this.rotate(t,0,n-1),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}rotate(e,t,r){for(;t<r;){let n=e[t];e[t++]=e[r],e[r--]=n}}}class td extends e4{constructor(){super("Shuffle",[td.PARAMETER_ARRAY_SOURCE],td.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(td.PARAMETER_ARRAY_SOURCE.getParameterName());if(t.length<=1)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);let r=0,n=(t=[...t]).length;for(let e=0;e<n;e++){let e=Math.floor(Math.random()*n)%n,s=t[r];t[r]=t[e],t[e]=s,r=e}return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}var ty={};m(ty,"ObjectValueSetterExtractor",()=>t$);var tx={};m(tx,"Expression",()=>tY);var tL={};m(tL,"StringBuilder",()=>tv);class tv{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 eE(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var tU={};m(tU,"ExpressionEvaluationException",()=>tV);class tV extends Error{constructor(e,t,r){super(ec.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var tC={};m(tC,"ExpressionToken",()=>tD);class tD{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var tG={};m(tG,"ExpressionTokenValue",()=>tb);class tb extends tD{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return ec.format("$: $",this.expression,this.element)}}var tF={};m(tF,"Operation",()=>tB);class tB{static{this.MULTIPLICATION=new tB("*")}static{this.DIVISION=new tB("/")}static{this.INTEGER_DIVISION=new tB("//")}static{this.MOD=new tB("%")}static{this.ADDITION=new tB("+")}static{this.SUBTRACTION=new tB("-")}static{this.NOT=new tB("not",void 0,!0)}static{this.AND=new tB("and",void 0,!0)}static{this.OR=new tB("or",void 0,!0)}static{this.LESS_THAN=new tB("<")}static{this.LESS_THAN_EQUAL=new tB("<=")}static{this.GREATER_THAN=new tB(">")}static{this.GREATER_THAN_EQUAL=new tB(">=")}static{this.EQUAL=new tB("=")}static{this.NOT_EQUAL=new tB("!=")}static{this.BITWISE_AND=new tB("&")}static{this.BITWISE_OR=new tB("|")}static{this.BITWISE_XOR=new tB("^")}static{this.BITWISE_COMPLEMENT=new tB("~")}static{this.BITWISE_LEFT_SHIFT=new tB("<<")}static{this.BITWISE_RIGHT_SHIFT=new tB(">>")}static{this.BITWISE_UNSIGNED_RIGHT_SHIFT=new tB(">>>")}static{this.UNARY_PLUS=new tB("UN: +","+")}static{this.UNARY_MINUS=new tB("UN: -","-")}static{this.UNARY_LOGICAL_NOT=new tB("UN: not","not")}static{this.UNARY_BITWISE_COMPLEMENT=new tB("UN: ~","~")}static{this.ARRAY_OPERATOR=new tB("[")}static{this.OBJECT_OPERATOR=new tB(".")}static{this.NULLISH_COALESCING_OPERATOR=new tB("??")}static{this.CONDITIONAL_TERNARY_OPERATOR=new tB("?")}static{this.VALUE_OF=new Map([["MULTIPLICATION",tB.MULTIPLICATION],["DIVISION",tB.DIVISION],["INTEGER_DIVISON",tB.INTEGER_DIVISION],["MOD",tB.MOD],["ADDITION",tB.ADDITION],["SUBTRACTION",tB.SUBTRACTION],["NOT",tB.NOT],["AND",tB.AND],["OR",tB.OR],["LESS_THAN",tB.LESS_THAN],["LESS_THAN_EQUAL",tB.LESS_THAN_EQUAL],["GREATER_THAN",tB.GREATER_THAN],["GREATER_THAN_EQUAL",tB.GREATER_THAN_EQUAL],["EQUAL",tB.EQUAL],["NOT_EQUAL",tB.NOT_EQUAL],["BITWISE_AND",tB.BITWISE_AND],["BITWISE_OR",tB.BITWISE_OR],["BITWISE_XOR",tB.BITWISE_XOR],["BITWISE_COMPLEMENT",tB.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",tB.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",tB.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",tB.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",tB.UNARY_PLUS],["UNARY_MINUS",tB.UNARY_MINUS],["UNARY_LOGICAL_NOT",tB.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",tB.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",tB.ARRAY_OPERATOR],["OBJECT_OPERATOR",tB.OBJECT_OPERATOR],["NULLISH_COALESCING_OPERATOR",tB.NULLISH_COALESCING_OPERATOR],["CONDITIONAL_TERNARY_OPERATOR",tB.CONDITIONAL_TERNARY_OPERATOR]])}static{this.UNARY_OPERATORS=new Set([tB.ADDITION,tB.SUBTRACTION,tB.NOT,tB.BITWISE_COMPLEMENT,tB.UNARY_PLUS,tB.UNARY_MINUS,tB.UNARY_LOGICAL_NOT,tB.UNARY_BITWISE_COMPLEMENT])}static{this.ARITHMETIC_OPERATORS=new Set([tB.MULTIPLICATION,tB.DIVISION,tB.INTEGER_DIVISION,tB.MOD,tB.ADDITION,tB.SUBTRACTION])}static{this.LOGICAL_OPERATORS=new Set([tB.NOT,tB.AND,tB.OR,tB.LESS_THAN,tB.LESS_THAN_EQUAL,tB.GREATER_THAN,tB.GREATER_THAN_EQUAL,tB.EQUAL,tB.NOT_EQUAL,tB.NULLISH_COALESCING_OPERATOR])}static{this.BITWISE_OPERATORS=new Set([tB.BITWISE_AND,tB.BITWISE_COMPLEMENT,tB.BITWISE_LEFT_SHIFT,tB.BITWISE_OR,tB.BITWISE_RIGHT_SHIFT,tB.BITWISE_UNSIGNED_RIGHT_SHIFT,tB.BITWISE_XOR])}static{this.CONDITIONAL_OPERATORS=new Set([tB.CONDITIONAL_TERNARY_OPERATOR])}static{this.OPERATOR_PRIORITY=new Map([[tB.UNARY_PLUS,1],[tB.UNARY_MINUS,1],[tB.UNARY_LOGICAL_NOT,1],[tB.UNARY_BITWISE_COMPLEMENT,1],[tB.ARRAY_OPERATOR,1],[tB.OBJECT_OPERATOR,1],[tB.MULTIPLICATION,2],[tB.DIVISION,2],[tB.INTEGER_DIVISION,2],[tB.MOD,2],[tB.ADDITION,3],[tB.SUBTRACTION,3],[tB.BITWISE_LEFT_SHIFT,4],[tB.BITWISE_RIGHT_SHIFT,4],[tB.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[tB.LESS_THAN,5],[tB.LESS_THAN_EQUAL,5],[tB.GREATER_THAN,5],[tB.GREATER_THAN_EQUAL,5],[tB.EQUAL,6],[tB.NOT_EQUAL,6],[tB.BITWISE_AND,7],[tB.BITWISE_XOR,8],[tB.BITWISE_OR,9],[tB.AND,10],[tB.OR,11],[tB.NULLISH_COALESCING_OPERATOR,11],[tB.CONDITIONAL_TERNARY_OPERATOR,12]])}static{this.OPERATORS=new Set([...Array.from(tB.ARITHMETIC_OPERATORS),...Array.from(tB.LOGICAL_OPERATORS),...Array.from(tB.BITWISE_OPERATORS),tB.ARRAY_OPERATOR,tB.OBJECT_OPERATOR,...Array.from(tB.CONDITIONAL_OPERATORS)].map(e=>e.getOperator()))}static{this.OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(tB.ARITHMETIC_OPERATORS),...Array.from(tB.LOGICAL_OPERATORS),...Array.from(tB.BITWISE_OPERATORS),tB.ARRAY_OPERATOR,tB.OBJECT_OPERATOR,...Array.from(tB.CONDITIONAL_OPERATORS)].filter(e=>!e.shouldBeWrappedInSpace()).map(e=>e.getOperator()))}static{this.OPERATION_VALUE_OF=new Map(Array.from(tB.VALUE_OF.entries()).map(([e,t])=>[t.getOperator(),t]))}static{this.UNARY_MAP=new Map([[tB.ADDITION,tB.UNARY_PLUS],[tB.SUBTRACTION,tB.UNARY_MINUS],[tB.NOT,tB.UNARY_LOGICAL_NOT],[tB.BITWISE_COMPLEMENT,tB.UNARY_BITWISE_COMPLEMENT],[tB.UNARY_PLUS,tB.UNARY_PLUS],[tB.UNARY_MINUS,tB.UNARY_MINUS],[tB.UNARY_LOGICAL_NOT,tB.UNARY_LOGICAL_NOT],[tB.UNARY_BITWISE_COMPLEMENT,tB.UNARY_BITWISE_COMPLEMENT]])}static{this.BIGGEST_OPERATOR_SIZE=Array.from(tB.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 tB.VALUE_OF.get(e)}toString(){return this.operator}}class tY extends tD{constructor(e,t,r,n){super(e||""),this.tokens=new ep,this.ops=new ep,t&&this.tokens.push(t),r&&this.tokens.push(r),n&&this.ops.push(n),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){let e;let t=this.expression.length,r="",n=new tv(""),s=0,a=!1;for(;s<t;){switch(r=this.expression[s],e=n.toString(),r){case" ":a=this.processTokenSepearator(n,e,a);break;case"(":s=this.processSubExpression(t,n,e,s,a),a=!1;break;case")":throw new tV(this.expression,"Extra closing parenthesis found");case"]":throw new tV(this.expression,"Extra closing square bracket found");case"'":case'"':{let e=this.processStringLiteral(t,r,s);s=e.getT1(),a=e.getT2();break}case"?":if(s+1<t&&"?"!=this.expression.charAt(s+1)&&0!=s&&"?"!=this.expression.charAt(s-1))s=this.processTernaryOperator(t,n,e,s,a);else{let i=this.processOthers(r,t,n,e,s,a);s=i.getT1(),(a=i.getT2())&&this.ops.peek()==tB.ARRAY_OPERATOR&&(s=(i=this.process(t,n,s)).getT1(),a=i.getT2())}break;default:let i=this.processOthers(r,t,n,e,s,a);s=i.getT1(),(a=i.getT2())&&this.ops.peek()==tB.ARRAY_OPERATOR&&(s=(i=this.process(t,n,s)).getT1(),a=i.getT2())}++s}if(e=n.toString(),!eM.isNullOrBlank(e)){if(tB.OPERATORS.has(e))throw new tV(this.expression,"Expression is ending with an operator");this.tokens.push(new tD(e))}}processStringLiteral(e,t,r){let n="",s=r+1;for(;s<e;s++){let e=this.expression.charAt(s);if(e==t&&"\\"!=this.expression.charAt(s-1))break;n+=e}if(s==e&&this.expression.charAt(s-1)!=t)throw new tV(this.expression,"Missing string ending marker "+t);let a=new ew(s,!1);return this.tokens.push(new tb(n,n)),a}process(e,t,r){let n=1;for(++r;r<e&&0!=n;){let e=this.expression.charAt(r);"]"==e?--n:"["==e&&++n,0!=n&&(t.append(e),r++)}return this.tokens.push(new tY(t.toString())),t.setLength(0),new ew(r,!1)}processOthers(e,t,r,n,s,a){let i=t-s;i=i<tB.BIGGEST_OPERATOR_SIZE?i:tB.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(s,s+e);if(tB.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return eM.isNullOrBlank(n)||(this.tokens.push(new tD(n)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(t),a),a=!0,r.setLength(0),new ew(s+e-1,a)}return r.append(e),new ew(s,!1)}processTernaryOperator(e,t,r,n,s){if(s)throw new tV(this.expression,"Ternary operator is followed by an operator");""!=r.trim()&&(this.tokens.push(new tY(r)),t.setLength(0));let a=1,i="",o=++n;for(;n<e&&a>0;)"?"==(i=this.expression.charAt(n))?++a:":"==i&&--a,++n;if(":"!=i)throw new tV(this.expression,"':' operater is missing");if(n>=e)throw new tV(this.expression,"Third part of the ternary expression is missing");for(;!this.ops.isEmpty()&&this.hasPrecedence(tB.CONDITIONAL_TERNARY_OPERATOR,this.ops.peek());){let e=this.ops.pop();if(tB.UNARY_OPERATORS.has(e)){let t=this.tokens.pop();this.tokens.push(new tY("",t,void 0,e))}else{let t=this.tokens.pop(),r=this.tokens.pop();this.tokens.push(new tY("",r,t,e))}}this.ops.push(tB.CONDITIONAL_TERNARY_OPERATOR),this.tokens.push(new tY(this.expression.substring(o,n-1)));let E=this.expression.substring(n);if(""===E.trim())throw new tV(this.expression,"Third part of the ternary expression is missing");return this.tokens.push(new tY(E)),e-1}processSubExpression(e,t,r,n,s){if(tB.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(r),s),t.setLength(0);else if(!eM.isNullOrBlank(r))throw new tV(this.expression,ec.format("Unkown token : $ found.",r));let a=1,i=new tv,o=this.expression.charAt(n);for(n++;n<e&&a>0;)"("==(o=this.expression.charAt(n))?a++:")"==o&&a--,0!=a&&(i.append(o),n++);if(")"!=o)throw new tV(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 tY(i.toString().trim())),n}processTokenSepearator(e,t,r){return eM.isNullOrBlank(t)||(tB.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new tD(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,n){if(r){if(n||e.isEmpty()){if(tB.UNARY_OPERATORS.has(r)){let e=tB.UNARY_MAP.get(r);e&&t.push(e)}else throw new tV(this.expression,ec.format("Extra operator $ found.",r))}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(tB.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new tY("",t,void 0,r))}else{let t=e.pop(),n=e.pop();e.push(new tY("",n,t,r))}}t.push(r)}}}hasPrecedence(e,t){let r=tB.OPERATOR_PRIORITY.get(e),n=tB.OPERATOR_PRIORITY.get(t);if(!r||!n)throw Error("Unknown operators provided");return n<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new tv,t=0,r=this.ops.toArray(),n=this.tokens.toArray();for(let s=0;s<r.length;s++)if(r[s].getOperator().startsWith("UN: "))e.append("(").append(r[s].getOperator().substring(4)).append(n[t]instanceof tY?n[t].toString():n[t]).append(")"),t++;else if(r[s]==tB.CONDITIONAL_TERNARY_OPERATOR){let r=n[t++];e.insert(0,r.toString()),e.insert(0,":"),r=n[t++],e.insert(0,r.toString()),e.insert(0,"?"),r=n[t++],e.insert(0,r.toString()).append(")"),e.insert(0,"(")}else{if(0==t){let r=n[t++];e.insert(0,r.toString())}let a=n[t++];e.insert(0,r[s].getOperator()).insert(0,a.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var tH={};m(tH,"TokenValueExtractor",()=>tk);class tk{static{this.REGEX_SQUARE_BRACKETS=/[\[\]]/}static{this.REGEX_DOT=/\./}getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new eE(ec.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?.__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,n){if(_(n))return;if(t.length==r)return n;let s=t[r].split(tk.REGEX_SQUARE_BRACKETS).map(e=>e.trim()).filter(e=>!eM.isNullOrBlank(e)).reduce((n,s)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,s,n),n);return this.retrieveElementFrom(e,t,r+1,s)}resolveForEachPartOfTokenWithBrackets(e,t,r,n,s){if(!_(s))return"length"===n?this.getLength(e,s):Array.isArray(s)?this.handleArrayAccess(e,n,s):this.handleObjectAccess(e,t,r,n,s)}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 tV(e,ec.format("Length can't be found in token $",e))}handleArrayAccess(e,t,r){let n=parseInt(t);if(isNaN(n))throw new tV(e,ec.format("$ is not a number",t));if(!(n<0)&&!(n>=r.length))return r[n]}handleObjectAccess(e,t,r,n,s){if(n.startsWith('"')){if(!n.endsWith('"')||1==n.length||2==n.length)throw new tV(e,ec.format("$ is missing a double quote or empty key found",e));n=n.substring(1,t.length-2)}return this.checkIfObject(e,t,r,s),s[n]}checkIfObject(e,t,r,n){if("object"!=typeof n||Array.isArray(n))throw new tV(e,ec.format("Unable to retrieve $ from $ in the path $",t[r],n.toString(),e))}}class t$ extends tk{constructor(e,t){super(),this.store=e,this.prefix=t}getValueInternal(e){let t=e.split(tk.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,n=!1){this.store=tu(this.store),this.modifyStore(e,t,r,n)}modifyStore(e,t,r,n){let s=new tY(e),a=s.getTokens();a.removeLast();let i=s.getOperations(),o=i.removeLast(),E=a.removeLast(),u=E instanceof tb?E.getElement():E.getExpression(),A=this.store;for(;!i.isEmpty();)A=o==tB.OBJECT_OPERATOR?this.getDataFromObject(A,u,i.peekLast()):this.getDataFromArray(A,u,i.peekLast()),o=i.removeLast(),u=(E=a.removeLast())instanceof tb?E.getElement():E.getExpression();o==tB.OBJECT_OPERATOR?this.putDataInObject(A,u,t,r,n):this.putDataInArray(A,u,t,r,n)}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eE(ec.format("Expected an array index but found $",t));if(n<0)throw new eE(ec.format("Array index is out of bound - $",t));let s=e[n];return _(s)&&(s=r==tB.OBJECT_OPERATOR?{}:[],e[n]=s),s}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));let n=e[t];return _(n)&&(n=r==tB.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r,n,s){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let a=parseInt(t);if(isNaN(a))throw new eE(ec.format("Expected an array index but found $",t));if(a<0)throw new eE(ec.format("Array index is out of bound - $",t));(n||_(e[a]))&&(s&&_(r)?e.splice(a,1):e[a]=r)}putDataInObject(e,t,r,n,s){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));(n||_(e[t]))&&(s&&_(r)?delete e[t]:e[t]=r)}getPrefix(){return this.prefix}}class tj extends e4{constructor(){super("Sort",[tj.PARAMETER_ARRAY_SOURCE,tj.PARAMETER_INT_FIND_FROM,tj.PARAMETER_INT_LENGTH,tj.PARAMETER_BOOLEAN_ASCENDING,tj.PARAMETER_KEY_PATH],tj.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tj.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tj.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tj.PARAMETER_INT_LENGTH.getParameterName()),s=e?.getArguments()?.get(tj.PARAMETER_BOOLEAN_ASCENDING.getParameterName()),a=e?.getArguments()?.get(tj.PARAMETER_KEY_PATH.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);if(t=[...t],-1==n&&(n=t.length-r),r<0||r>=t.length||r+n>t.length)throw new eE("Given start point is more than the size of the array or not available at that point");let i=t.slice(r,r+n+1),o=new t$({},"Data.");return i.sort((e,t)=>"object"==typeof e&&"object"==typeof t&&a.length?(o.setStore({a:e,b:t}),tW(o.getValue("Data.a."+a),o.getValue("Data.b."+a),s)):tW(e,t,s)),t.splice(r,n,...i),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}function tW(e,t,r){return e===t?0:null===e?1:null===t?-1:r?e<t?-1:1:e<t?1:-1}class tX extends e4{constructor(){super("SubArray",[tX.PARAMETER_ARRAY_SOURCE,tX.PARAMETER_INT_FIND_FROM,tX.PARAMETER_INT_LENGTH],tX.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tX.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tX.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tX.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n<=0)return new eu([ea.outputOf(new Map([]))]);if(!(r>=0&&r<t.length)||r+n>t.length)throw new eE("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 s=t.slice(r,r+n);return new eu([ea.outputOf(new Map([[tX.EVENT_RESULT_NAME,s]]))])}}class tJ extends e4{constructor(){super("Insert",[tJ.PARAMETER_ARRAY_SOURCE,tJ.PARAMETER_INT_OFFSET,tJ.PARAMETER_ANY],tJ.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tJ.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tJ.PARAMETER_INT_OFFSET.getParameterName());var n=e?.getArguments()?.get(tJ.PARAMETER_ANY.getParameterName());if(_(n)||_(r)||r>t.length)throw new eE("Please valid resouces to insert at the correct location");if(0==(t=[...t]).length)return 0==r&&t.push(n),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);t.push(n);let s=t.length-1;for(r++;s>=r;){let e=t[s-1];t[s-1]=t[s],t[s--]=e}return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tq extends e4{constructor(){super("InsertLast",[tq.PARAMETER_ARRAY_SOURCE,tq.PARAMETER_ANY],tq.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tq.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tq.PARAMETER_ANY.getParameterName());return(t=[...t]).push(r),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tz extends e4{constructor(){super("RemoveDuplicates",[tz.PARAMETER_ARRAY_SOURCE,tz.PARAMETER_INT_SOURCE_FROM,tz.PARAMETER_INT_LENGTH],tz.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tz.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tz.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tz.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new eE(ec.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));let s=[...t],a=r+n;for(let e=a-1;e>=r;e--)for(let t=e-1;t>=r;t--)if(ef(s[e],s[t])){s.splice(e,1);break}return new eu([ea.outputOf(q.of(tz.EVENT_RESULT_NAME,s))])}}const tK="keyPath",tQ="valuePath",tZ="ignoreNullValues",t0="ignoreNullKeys",t1="ignoreDuplicateKeys";class t2 extends e4{constructor(){super("ArrayToObjects",[e4.PARAMETER_ARRAY_SOURCE,X.of(tK,Y.ofString(tK)),X.of(tQ,Y.of(tQ,i.STRING,i.NULL)),X.of(tZ,Y.ofBoolean(tZ).setDefaultValue(!1)),X.of(t0,Y.ofBoolean(t0).setDefaultValue(!0)),X.of(t1,Y.ofBoolean(t1).setDefaultValue(!1))],e4.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tK),n=e?.getArguments()?.get(tQ)??"",s=e?.getArguments()?.get(tZ),a=e?.getArguments()?.get(t0),i=e?.getArguments()?.get(t1),o=new t$({},"Data."),E=t.filter(e=>!_(e)).reduce((e,t)=>{o.setStore(t);let E=o.getValue("Data."+r);if(a&&_(E))return e;let u=n?o.getValue("Data."+n):t;return s&&_(u)||i&&e.hasOwnProperty(E)||(e[E]=u),e},{});return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,E]]))])}}const t9="source",t3="delimiter",t4="result",t5=new eT("Join").setNamespace(p.SYSTEM_ARRAY).setParameters(new Map([[t9,new X(t9,Y.ofArray(t9,Y.of("each",i.STRING,i.INTEGER,i.LONG,i.DOUBLE,i.FLOAT,i.NULL)))],[t3,new X(t3,Y.ofString(t3).setDefaultValue(""))]])).setEvents(new Map([es.outputEventMapEntry(new Map([[t4,Y.ofString(t4)]]))]));class t6 extends e3{getSignature(){return t5}async internalExecute(e){let t=e?.getArguments()?.get(t9),r=e?.getArguments()?.get(t3);return new eu([ea.outputOf(new Map([[t4,t.join(r)]]))])}}class t7{static{this.repoMap=q.ofArrayEntries(et(new e5),et(new e6),et(new ts),et(new to),et(new tA),et(new tT),et(new tl),et(new tR),et(new tm),et(new tg),et(new th),et(new tc),et(new tp),et(new tN),et(new tf),et(new t_),et(new tM),et(new tS),et(new tO),et(new tw),et(new tI),et(new tP),et(new td),et(new tj),et(new tX),et(new e8),et(new tJ),et(new tq),et(new tz),et(new t2),et(new t6))}static{this.filterableNames=Array.from(t7.repoMap.values()).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=p.SYSTEM_ARRAY?Promise.resolve(void 0):Promise.resolve(t7.repoMap.get(t))}async filter(e){return Promise.resolve(t7.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var t8={};m(t8,"ContextElement",()=>re);class re{static{this.NULL=new re(Y.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 rt="name",rr="schema",rn=new eT("Create").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(rt,new Y().setName(rt).setType(L.of(i.STRING)).setMinLength(1).setFormat(E.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,o.CONSTANT),X.ofEntry(rr,Y.SCHEMA,!1,o.CONSTANT)])).setEvents(new Map([es.outputEventMapEntry(new Map)])),rs="name",ra="value",ri=new eT("Get").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(rs,new Y().setName(rs).setType(L.of(i.STRING)).setMinLength(1).setFormat(E.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,o.CONSTANT)])).setEvents(new Map([es.outputEventMapEntry(new Map([[ra,Y.ofAny(ra)]]))]));var ro={};m(ro,"ExpressionEvaluator",()=>nA);var rE={};m(rE,"LogicalNullishCoalescingOperator",()=>rT);var ru={};m(ru,"BinaryOperator",()=>rA);class rA{nullCheck(e,t,r){if(_(e)||_(t))throw new tr(ec.format("$ cannot be applied to a null value",r.getOperatorName()))}}class rT extends rA{apply(e,t){return _(e)?t:e}}var rl={};m(rl,"ArithmeticAdditionOperator",()=>rR);class rR extends rA{apply(e,t){return _(e)?t:_(t)?e:e+t}}var rm={};m(rm,"ArithmeticDivisionOperator",()=>rg);class rg extends rA{apply(e,t){return this.nullCheck(e,t,tB.DIVISION),e/t}}var rh={};m(rh,"ArithmeticIntegerDivisionOperator",()=>rc);class rc extends rA{apply(e,t){return this.nullCheck(e,t,tB.DIVISION),Math.floor(e/t)}}var rp={};m(rp,"ArithmeticModulusOperator",()=>rN);class rN extends rA{apply(e,t){return this.nullCheck(e,t,tB.MOD),e%t}}var rf={};m(rf,"ArithmeticMultiplicationOperator",()=>r_);class r_ extends rA{apply(e,t){this.nullCheck(e,t,tB.MULTIPLICATION);let r="string"==typeof e,n=typeof t;if(r||"string"===n){let n=r?e:t,s=r?t:e,a="",i=s<0,o=Math.floor(s=Math.abs(s));for(;o-- >0;)a+=n;let E=Math.floor(n.length*(s-Math.floor(s)));if(E<0&&(E=-E),0!=E&&(a+=n.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 rM={};m(rM,"ArithmeticSubtractionOperator",()=>rS);class rS extends rA{apply(e,t){return this.nullCheck(e,t,tB.SUBTRACTION),e-t}}var rO={};m(rO,"ArrayOperator",()=>rw);class rw extends rA{apply(e,t){if(!e)throw new tr("Cannot apply array operator on a null value");if(!t)throw new tr("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new tr(ec.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new tr(ec.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var rI={};m(rI,"BitwiseAndOperator",()=>rP);class rP extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_AND),e&t}}var rd={};m(rd,"BitwiseLeftShiftOperator",()=>ry);class ry extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_LEFT_SHIFT),e<<t}}var rx={};m(rx,"BitwiseOrOperator",()=>rL);class rL extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_OR),e|t}}var rv={};m(rv,"BitwiseRightShiftOperator",()=>rU);class rU extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_RIGHT_SHIFT),e>>t}}var rV={};m(rV,"BitwiseUnsignedRightShiftOperator",()=>rC);class rC extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var rD={};m(rD,"BitwiseXorOperator",()=>rG);class rG extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_XOR),e^t}}var rb={};m(rb,"LogicalAndOperator",()=>rF);class rF extends rA{apply(e,t){return!!e&&""!==e&&!!t&&""!==t}}var rB={};m(rB,"LogicalEqualOperator",()=>rY);class rY extends rA{apply(e,t){return ef(e,t)}}var rH={};m(rH,"LogicalGreaterThanEqualOperator",()=>rk);class rk extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare >= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>=n.getT2()}}var r$={};m(r$,"LogicalGreaterThanOperator",()=>rj);class rj extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare > with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>n.getT2()}}var rW={};m(rW,"LogicalLessThanEqualOperator",()=>rX);class rX extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare <= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<=n.getT2()}}var rJ={};m(rJ,"LogicalLessThanOperator",()=>rq);class rq extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare < with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<n.getT2()}}var rz={};m(rz,"LogicalNotEqualOperator",()=>rK);class rK extends rA{apply(e,t){return!ef(e,t)}}var rQ={};m(rQ,"LogicalOrOperator",()=>rZ);class rZ extends rA{apply(e,t){return!!e&&""!==e||!!t&&""!==t}}var r0={};m(r0,"ObjectOperator",()=>r1);class r1 extends rA{apply(e,t){if(!e)throw new tr("Cannot apply array operator on a null value");if(!t)throw new tr("Cannot retrive null property value");let r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new tr(ec.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var r2={};m(r2,"ArithmeticUnaryMinusOperator",()=>r4);var r9={};m(r9,"UnaryOperator",()=>r3);class r3{nullCheck(e,t){if(_(e))throw new tr(ec.format("$ cannot be applied to a null value",t.getOperatorName()))}}class r4 extends r3{apply(e){return this.nullCheck(e,tB.UNARY_MINUS),tn.findPrimitiveNumberType(e),-e}}var r5={};m(r5,"ArithmeticUnaryPlusOperator",()=>r6);class r6 extends r3{apply(e){return this.nullCheck(e,tB.UNARY_PLUS),tn.findPrimitiveNumberType(e),e}}var r7={};m(r7,"BitwiseComplementOperator",()=>r8);class r8 extends r3{apply(e){this.nullCheck(e,tB.UNARY_BITWISE_COMPLEMENT);let t=tn.findPrimitiveNumberType(e);if(t.getT1()!=i.INTEGER&&t.getT1()!=i.LONG)throw new tr(ec.format("Unable to apply bitwise operator on $",e));return~e}}var ne={};m(ne,"LogicalNotOperator",()=>nt);class nt extends r3{apply(e){return!e&&""!==e}}var nr={};m(nr,"LiteralTokenValueExtractor",()=>ns);const nn=new Map([["true",!0],["false",!1],["null",void 0],["undefined",void 0]]);class ns extends tk{static{this.INSTANCE=new ns}getValueInternal(e){if(!eM.isNullOrBlank(e))return(e=e.trim(),nn.has(e))?nn.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 tV(e,ec.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new tV(e,ec.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 na={},ni={};m(ni,"ConditionalTernaryOperator",()=>nE);class no{nullCheck(e,t,r,n){if(_(e)||_(t)||_(r))throw new tr(ec.format("$ cannot be applied to a null value",n.getOperatorName()))}}class nE extends no{apply(e,t,r){return e?t:r}}R(na,ni);class nu extends tk{static{this.PREFIX="_internal."}addValue(e,t){this.values.set(e,t)}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.values.get(r))}getPrefix(){return nu.PREFIX}getStore(){}constructor(...e){super(...e),this.values=new Map}}class nA{static{this.UNARY_OPERATORS_MAP=new Map([[tB.UNARY_BITWISE_COMPLEMENT,new r8],[tB.UNARY_LOGICAL_NOT,new nt],[tB.UNARY_MINUS,new r4],[tB.UNARY_PLUS,new r6]])}static{this.TERNARY_OPERATORS_MAP=new Map([[tB.CONDITIONAL_TERNARY_OPERATOR,new nE]])}static{this.BINARY_OPERATORS_MAP=new Map([[tB.ADDITION,new rR],[tB.DIVISION,new rg],[tB.INTEGER_DIVISION,new rc],[tB.MOD,new rN],[tB.MULTIPLICATION,new r_],[tB.SUBTRACTION,new rS],[tB.BITWISE_AND,new rP],[tB.BITWISE_LEFT_SHIFT,new ry],[tB.BITWISE_OR,new rL],[tB.BITWISE_RIGHT_SHIFT,new rU],[tB.BITWISE_UNSIGNED_RIGHT_SHIFT,new rC],[tB.BITWISE_XOR,new rG],[tB.AND,new rF],[tB.EQUAL,new rY],[tB.GREATER_THAN,new rj],[tB.GREATER_THAN_EQUAL,new rk],[tB.LESS_THAN,new rq],[tB.LESS_THAN_EQUAL,new rX],[tB.OR,new rZ],[tB.NOT_EQUAL,new rK],[tB.NULLISH_COALESCING_OPERATOR,new rT],[tB.ARRAY_OPERATOR,new rw],[tB.OBJECT_OPERATOR,new r1]])}static{this.UNARY_OPERATORS_MAP_KEY_SET=new Set(nA.UNARY_OPERATORS_MAP.keys())}constructor(e){this.internalTokenValueExtractor=new nu,e instanceof tY?(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,n=0,s=new ep;for(;n<e.length-1;){if("{"==e.charAt(n)&&"{"==e.charAt(n+1))0==r&&s.push(new ew(n+2,-1)),r++,n++;else if("}"==e.charAt(n)&&"}"==e.charAt(n+1)){if(--r<0)throw new tV(e,"Expecting {{ nesting path operator to be started before closing");0==r&&s.push(s.pop().setT2(n)),n++}n++}let a=this.replaceNestingExpression(e,t,s);return new ew(a,new tY(a))}replaceNestingExpression(e,t,r){let n=e;for(let s of r.toArray()){if(-1==s.getT2())throw new tV(e,"Expecting }} nesting path operator to be closed");let r=new nA(n.substring(s.getT1(),s.getT2())).evaluate(t);n=n.substring(0,s.getT1()-2)+r+n.substring(s.getT2()+2)}return n}getExpression(){return this.exp||(this.exp=new tY(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),n=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),s=n.pop();if(nA.UNARY_OPERATORS_MAP_KEY_SET.has(e))n.push(this.applyUnaryOperation(e,this.getValueFromToken(t,s)));else if(e==tB.OBJECT_OPERATOR||e==tB.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,n,e,s);else if(e==tB.CONDITIONAL_TERNARY_OPERATOR){let r=n.pop(),a=n.pop(),i=this.getValueFromToken(t,a),o=this.getValueFromToken(t,r),E=this.getValueFromToken(t,s);n.push(this.applyTernaryOperation(e,i,o,E))}else{let r=n.pop(),a=this.getValueFromToken(t,r),i=this.getValueFromToken(t,s);n.push(this.applyBinaryOperation(e,a,i))}}if(n.isEmpty())throw new tr(ec.format("Expression : $ evaluated to null",e));if(1!=n.size())throw new tr(ec.format("Expression : $ evaluated multiple values $",e,n));let s=n.get(0);if(s instanceof tb)return s.getElement();if(!(s instanceof tY))return this.getValueFromToken(t,s);throw new tr(ec.format("Expression : $ evaluated to $",e,n.get(0)))}processObjectOrArrayOperator(e,t,r,n,s){let a=new ep,i=new ep;if(!n||!s)return;do i.push(n),s instanceof tY?a.push(new tb(s.toString(),this.evaluateExpression(s,e))):s&&a.push(s),s=r.isEmpty()?void 0:r.pop(),n=t.isEmpty()?void 0:t.pop();while(n==tB.OBJECT_OPERATOR||n==tB.ARRAY_OPERATOR)s&&(s instanceof tY?a.push(new tb(s.toString(),this.evaluateExpression(s,e))):a.push(s)),n&&t.push(n);let o=a.pop();if(o instanceof tb&&"object"==typeof o.getTokenValue()){let e=new Date().getTime()+""+Math.round(1e3*Math.random());this.internalTokenValueExtractor.addValue(e,o.getTokenValue()),o=new tD(nu.PREFIX+e)}let E=new tv(o instanceof tb?o.getTokenValue():o.toString());for(;!a.isEmpty();)o=a.pop(),n=i.pop(),E.append(n.getOperator()).append(o instanceof tb?o.getTokenValue():o.toString()),n==tB.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 tb(u,this.getValue(u,e)));else{let e;try{e=ns.INSTANCE.getValue(u)}catch(t){e=u}r.push(new tb(u,e))}}applyTernaryOperation(e,t,r,n){let s=nA.TERNARY_OPERATORS_MAP.get(e);if(!s)throw new tV(this.expression,ec.format("No operator found to evaluate $",this.getExpression()));return new tb(e.toString(),s.apply(t,r,n))}applyBinaryOperation(e,t,r){let n=typeof t,s=typeof r,a=nA.BINARY_OPERATORS_MAP.get(e);if(("object"===n||"object"===s)&&e!==tB.EQUAL&&e!==tB.NOT_EQUAL&&e!==tB.NULLISH_COALESCING_OPERATOR&&e!==tB.AND&&e!==tB.OR)throw new tV(this.expression,ec.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));if(!a)throw new tV(this.expression,ec.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new tb(e.toString(),a.apply(t,r))}applyUnaryOperation(e,t){let r=typeof t;if(e.getOperator()!=tB.NOT.getOperator()&&e.getOperator()!=tB.UNARY_LOGICAL_NOT.getOperator()&&("object"===r||Array.isArray(t)))throw new tV(this.expression,ec.format("The operator $ cannot be applied to $",e.getOperator(),t));let n=nA.UNARY_OPERATORS_MAP.get(e);if(!n)throw new tV(this.expression,ec.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new tb(e.toString(),n.apply(t))}getValueFromToken(e,t){return t instanceof tY?this.evaluateExpression(t,e):t instanceof tb?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):ns.INSTANCE.getValueFromExtractors(e,t)}}const nT="name",nl="value",nR=new eT("Set").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(nT,new Y().setName(nT).setType(L.of(i.STRING)).setMinLength(1),!1),X.ofEntry(nl,Y.ofAny(nl))])).setEvents(new Map([es.outputEventMapEntry(new Map)])),nm="value",ng="eventName",nh="results",nc=new eT("GenerateEvent").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(ng,Y.ofString(ng).setDefaultValue("output")),X.ofEntry(nh,Y.ofObject(nh).setProperties(new Map([["name",Y.ofString("name")],[nm,X.EXPRESSION]])),!0)])).setEvents(new Map([es.outputEventMapEntry(new Map)]));class np extends e3{static{this.CONDITION="condition"}static{this.SIGNATURE=new eT("If").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(np.CONDITION,Y.ofAny(np.CONDITION))])).setEvents(new Map([es.eventMapEntry(es.TRUE,new Map),es.eventMapEntry(es.FALSE,new Map),es.outputEventMapEntry(new Map)]))}getSignature(){return np.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(np.CONDITION);return new eu([ea.of(t||""===t?es.TRUE:es.FALSE,new Map),ea.outputOf(new Map)])}}const nN="stepName",nf=new eT("Break").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(nN,Y.of(nN,i.STRING))])).setEvents(new Map([es.outputEventMapEntry(new Map([]))])),n_="count",nM="value",nS="index",nO=new eT("CountLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(n_,Y.of(n_,i.INTEGER))])).setEvents(new Map([es.eventMapEntry(es.ITERATION,new Map([[nS,Y.of(nS,i.INTEGER)]])),es.outputEventMapEntry(new Map([[nM,Y.of(nM,i.INTEGER)]]))])),nw="source",nI="each",nP="index",nd="value",ny=new eT("ForEachLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(nw,Y.ofArray(nw,Y.ofAny(nw)))])).setEvents(new Map([es.eventMapEntry(es.ITERATION,new Map([[nP,Y.of(nP,i.INTEGER)],[nI,Y.ofAny(nI)]])),es.outputEventMapEntry(new Map([[nd,Y.of(nd,i.INTEGER)]]))])),nx="from",nL="step",nv="value",nU="index",nV=new eT("RangeLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(nx,Y.of(nx,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(0)),X.ofEntry("to",Y.of("to",i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(1)),X.ofEntry(nL,Y.of(nL,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(1).setNot(new Y().setConstant(0)))])).setEvents(new Map([es.eventMapEntry(es.ITERATION,new Map([[nU,Y.of(nU,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)]])),es.outputEventMapEntry(new Map([[nv,Y.of(nv,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)]]))])),nC="value",nD=new eT("Add").setNamespace(p.MATH).setParameters(new Map([[nC,new X(nC,Y.ofNumber(nC)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[nC,Y.ofNumber(nC)]]))])),nG="value",nb="value1",nF="value2",nB=[()=>new Map([[nG,new X(nG,Y.ofNumber(nG))]]),()=>new Map([[nb,new X(nb,Y.ofNumber(nb))],[nF,new X(nF,Y.ofNumber(nF))]])];class nY extends e3{constructor(e,t,r=1,...n){super(),n&&n.length||(n=[i.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new eT(e).setNamespace(p.MATH).setParameters(nB[r-1]()).setEvents(new Map([es.outputEventMapEntry(new Map([[nG,new Y().setType(L.of(...n)).setName(nG)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=tn.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?nG:nb)).getT2();return 2==this.parametersNumber&&(t=tn.findPrimitiveNumberType(e.getArguments()?.get(nF)).getT2()),new eu([ea.outputOf(new Map([[nG,this.mathFunction.call(this,r,t)]]))])}}const nH="value";class nk extends e3{static{this.SIGNATURE=new eT("Hypotenuse").setNamespace(p.MATH).setParameters(new Map([[nH,new X(nH,Y.ofNumber(nH)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[nH,new Y().setType(L.of(i.DOUBLE)).setName(nH)]]))]))}constructor(){super()}getSignature(){return nk.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nH);return new eu([ea.outputOf(new Map([[nH,Math.sqrt(t.reduce((e,t)=>e+=t*t,0))]]))])}}const n$="value",nj=new eT("Maximum").setNamespace(p.MATH).setParameters(new Map([[n$,new X(n$,Y.ofNumber(n$)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[n$,Y.ofNumber(n$)]]))])),nW="value",nX=new eT("Minimum").setNamespace(p.MATH).setParameters(new Map([[nW,new X(nW,Y.ofNumber(nW)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[nW,Y.ofNumber(nW)]]))])),nJ="value";class nq extends e3{static{this.SIGNATURE=new eT("Random").setNamespace(p.MATH).setEvents(new Map([es.outputEventMapEntry(q.of(nJ,Y.ofDouble(nJ)))]))}getSignature(){return nq.SIGNATURE}async internalExecute(e){return new eu([ea.outputOf(new Map([[nJ,Math.random()]]))])}}class nz extends e3{static{this.MIN_VALUE="minValue"}static{this.MAX_VALUE="maxValue"}static{this.VALUE="value"}constructor(e,t,r,n,s){super(),this.signature=new eT(e).setParameters(q.of(nz.MIN_VALUE,t,nz.MAX_VALUE,r)).setNamespace(p.MATH).setEvents(new Map([es.outputEventMapEntry(q.of(nz.VALUE,n))])),this.randomFunction=s}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nz.MIN_VALUE),r=e.getArguments()?.get(nz.MAX_VALUE),n=this.randomFunction(t,r);return new eu([ea.outputOf(new Map([[nz.VALUE,n]]))])}}const nK={Absolute:new nY("Absolute",e=>Math.abs(e),1,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE),ArcCosine:new nY("ArcCosine",e=>Math.acos(e)),ArcSine:new nY("ArcSine",e=>Math.asin(e)),ArcTangent:new nY("ArcTangent",e=>Math.atan(e)),Ceiling:new nY("Ceiling",e=>Math.ceil(e)),Cosine:new nY("Cosine",e=>Math.cos(e)),HyperbolicCosine:new nY("HyperbolicCosine",e=>Math.cosh(e)),CubeRoot:new nY("CubeRoot",e=>Math.cbrt(e)),Exponential:new nY("Exponential",e=>Math.exp(e)),ExponentialMinus1:new nY("ExponentialMinus1",e=>Math.expm1(e)),Floor:new nY("Floor",e=>Math.floor(e)),LogNatural:new nY("LogNatural",e=>Math.log(e)),Log10:new nY("Log10",e=>Math.log10(e)),Round:new nY("Round",e=>Math.round(e),1,i.INTEGER,i.LONG),Sine:new nY("Sine",e=>Math.sin(e)),HyperbolicSine:new nY("HyperbolicSine",e=>Math.sinh(e)),Tangent:new nY("Tangent",e=>Math.tan(e)),HyperbolicTangent:new nY("HyperbolicTangent",e=>Math.tanh(e)),ToDegrees:new nY("ToDegrees",e=>Math.PI/180*e),ToRadians:new nY("ToRadians",e=>180/Math.PI*e),SquareRoot:new nY("SquareRoot",e=>Math.sqrt(e)),ArcTangent2:new nY("ArcTangent2",(e,t)=>Math.atan2(e,t),2),Power:new nY("Power",(e,t)=>Math.pow(e,t),2),Add:new class extends e3{getSignature(){return nD}async internalExecute(e){let t=e.getArguments()?.get(nC);return new eu([ea.outputOf(new Map([[nC,t.reduce((e,t)=>e+=t,0)]]))])}},Hypotenuse:new nk,Maximum:new class extends e3{getSignature(){return nj}async internalExecute(e){let t=e.getArguments()?.get(n$);return new eu([ea.outputOf(new Map([[n$,t.reduce((e,t)=>!e&&0!==e||t>e?t:e)]]))])}},Minimum:new class extends e3{getSignature(){return nX}async internalExecute(e){let t=e.getArguments()?.get(nW);return new eu([ea.outputOf(new Map([[nW,t.reduce((e,t)=>!e&&0!==e||t<e?t:e)]]))])}},Random:new nq,RandomFloat:new nz("RandomFloat",X.of(nz.MIN_VALUE,Y.ofFloat(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofFloat(nz.MAX_VALUE).setDefaultValue(0x7fffffff)),Y.ofFloat(nz.VALUE),(e,t)=>Math.random()*(t-e)+e),RandomInt:new nz("RandomInt",X.of(nz.MIN_VALUE,Y.ofInteger(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofInteger(nz.MAX_VALUE).setDefaultValue(0x7fffffff)),Y.ofInteger(nz.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomLong:new nz("RandomLong",X.of(nz.MIN_VALUE,Y.ofLong(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofLong(nz.MAX_VALUE).setDefaultValue(Number.MAX_SAFE_INTEGER)),Y.ofLong(nz.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomDouble:new nz("RandomDouble",X.of(nz.MIN_VALUE,Y.ofDouble(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofDouble(nz.MAX_VALUE).setDefaultValue(Number.MAX_VALUE)),Y.ofDouble(nz.VALUE),(e,t)=>Math.random()*(t-e)+e)},nQ=Object.values(nK).map(e=>e.getSignature().getFullName());class nZ{async find(e,t){return e!=p.MATH?Promise.resolve(void 0):Promise.resolve(nK[t])}async filter(e){return Promise.resolve(nQ.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class n0 extends e3{static{this.SOURCE="source"}static{this.SCHEMA="schema"}static{this.VALUE="value"}static{this.CONVERSION_MODE="conversionMode"}getSignature(){return new eT("ObjectConvert").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n0.SOURCE,Y.ofAny(n0.SCHEMA)),X.ofEntry(n0.SCHEMA,Y.SCHEMA,!1,o.CONSTANT),X.ofEntry(n0.CONVERSION_MODE,Y.ofString(n0.CONVERSION_MODE).setEnums(eJ()))])).setEvents(new Map([es.outputEventMapEntry(q.of(n0.VALUE,Y.ofAny(n0.VALUE)))]))}internalExecute(e){let t=e.getArguments()?.get(n0.SOURCE),r=Y.from(e?.getArguments()?.get(n0.SCHEMA));if(!r)throw new eE("Schema is not supplied.");let n=eX(e.getArguments()?.get(n0.CONVERSION_MODE))||u.STRICT;return this.convertToSchema(r,e.getSchemaRepository(),t,n)}async convertToSchema(e,t,r,n){try{return new eu([ea.outputOf(q.of(n0.VALUE,e9.validate([],e,t,r,!0,n)))])}catch(e){throw new eE(e?.message)}}}const n1="value",n2="source",n9="source";class n3 extends e3{constructor(e,t){super(),this.signature=new eT(e).setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n9,Y.ofAny(n9))])).setEvents(new Map([es.outputEventMapEntry(new Map([["value",t]]))]))}getSignature(){return this.signature}}const n4="value",n5="value",n6="value",n7="source",n8="overwrite",se="deleteKeyOnNull",st="value",sr={ObjectValues:new class extends n3{constructor(){super("ObjectValues",Y.ofArray(st,Y.ofAny(st)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[st,[]]]))]);let r=Object.entries(tu(t)).sort((e,t)=>e[0].localeCompare(t[0])).map(e=>e[1]);return new eu([ea.outputOf(new Map([[st,r]]))])}},ObjectKeys:new class extends n3{constructor(){super("ObjectKeys",Y.ofArray(n5,Y.ofString(n5)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[n5,[]]]))]);let r=Object.keys(tu(t)).sort((e,t)=>e.localeCompare(t));return new eu([ea.outputOf(new Map([[n5,r]]))])}},ObjectEntries:new class extends n3{constructor(){super("ObjectEntries",Y.ofArray(n4,Y.ofArray("tuple",Y.ofString("key"),Y.ofAny("value"))))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[n4,[]]]))]);let r=Object.entries(tu(t)).sort((e,t)=>e[0].localeCompare(t[0]));return new eu([ea.outputOf(new Map([[n4,r]]))])}},ObjectDeleteKey:new class extends e3{constructor(){super(),this.signature=new eT("ObjectDeleteKey").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n2,Y.ofAny(n2)),X.ofEntry("key",Y.ofString("key"))])).setEvents(new Map([es.outputEventMapEntry(new Map([[n1,Y.ofAny(n1)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(n2),r=e.getArguments()?.get("key");return _(t)?new eu([ea.outputOf(new Map([[n1,void 0]]))]):(t=tu(t),delete t[r],new eu([ea.outputOf(new Map([[n1,t]]))]))}},ObjectPutValue:new class extends e3{constructor(){super(),this.signature=new eT("ObjectPutValue").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n7,Y.ofObject(n7)),X.ofEntry("key",Y.ofString("key")),X.ofEntry(n6,Y.ofAny(n6)),X.ofEntry(n8,Y.ofBoolean(n8).setDefaultValue(!0)),X.ofEntry(se,Y.ofBoolean(se).setDefaultValue(!1))])).setEvents(new Map([es.outputEventMapEntry(new Map([[n6,Y.ofObject(n6)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(n7),r=e.getArguments()?.get("key"),n=e.getArguments()?.get(n6),s=e.getArguments()?.get(n8),a=e.getArguments()?.get(se),i=new t$(t,"Data.");return i.setValue(r,n,s,a),new eu([ea.outputOf(new Map([[n6,i.getStore()]]))])}},ObjectConvert:new n0},sn=Object.values(sr).map(e=>e.getSignature().getFullName());class ss{async find(e,t){return e!=p.SYSTEM_OBJECT?Promise.resolve(void 0):Promise.resolve(sr[t])}async filter(e){return Promise.resolve(sn.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sa extends e3{static{this.VALUES="values"}static{this.STREAM="stream"}static{this.LOG="LOG"}static{this.ERROR="ERROR"}static{this.SIGNATURE=new eT("Print").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(sa.VALUES,Y.ofAny(sa.VALUES),!0),X.ofEntry(sa.STREAM,Y.ofString(sa.STREAM).setEnums([sa.LOG,sa.ERROR]).setDefaultValue(sa.LOG))])).setEvents(new Map([es.outputEventMapEntry(new Map)]))}getSignature(){return sa.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(sa.VALUES),r=e.getArguments()?.get(sa.STREAM);return(r===sa.LOG?console?.log:console?.error)?.(...t),new eu([ea.outputOf(new Map)])}}class si extends e3{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 X(si.PARAMETER_STRING_NAME,Y.ofString(si.PARAMETER_STRING_NAME))}static{this.PARAMETER_SECOND_STRING=new X(si.PARAMETER_SECOND_STRING_NAME,Y.ofString(si.PARAMETER_SECOND_STRING_NAME))}static{this.PARAMETER_THIRD_STRING=new X(si.PARAMETER_THIRD_STRING_NAME,Y.ofString(si.PARAMETER_THIRD_STRING_NAME))}static{this.PARAMETER_INDEX=new X(si.PARAMETER_INDEX_NAME,Y.ofInteger(si.PARAMETER_INDEX_NAME))}static{this.PARAMETER_SECOND_INDEX=new X(si.PARAMETER_SECOND_INDEX_NAME,Y.ofInteger(si.PARAMETER_SECOND_INDEX_NAME))}static{this.PARAMETER_SEARCH_STRING=new X(si.PARAMETER_SEARCH_STRING_NAME,Y.ofString(si.PARAMETER_STRING_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofString(si.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofBoolean(si.EVENT_RESULT_NAME)))}static{this.EVENT_INT=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofInteger(si.EVENT_RESULT_NAME)))}static{this.EVENT_ARRAY=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofArray(si.EVENT_RESULT_NAME)))}constructor(e,t,r,...n){super();let s=new Map;n.forEach(e=>s.set(e.getParameterName(),e)),this.signature=new eT(t).setNamespace(e).setParameters(s).setEvents(q.of(r.getName(),r))}getSignature(){return this.signature}static ofEntryStringStringAndBooleanOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SEARCH_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n)))])}}(p.STRING,e,si.EVENT_BOOLEAN,si.PARAMETER_STRING,si.PARAMETER_SEARCH_STRING)]}static ofEntryStringIntegerAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_INDEX_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING,si.PARAMETER_INDEX)]}static ofEntryStringStringAndIntegerOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SEARCH_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n)))])}}(p.STRING,e,si.EVENT_INT,si.PARAMETER_STRING,si.PARAMETER_SEARCH_STRING)]}static ofEntryStringAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING)]}static ofEntryStringAndBooleanOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,si.EVENT_BOOLEAN,si.PARAMETER_STRING)]}static ofEntryStringStringIntegerAndIntegerOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SEARCH_STRING_NAME),s=e?.getArguments()?.get(si.PARAMETER_INDEX_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n,s)))])}}(p.STRING,e,si.EVENT_INT,si.PARAMETER_STRING,si.PARAMETER_SEARCH_STRING,si.PARAMETER_INDEX)]}static ofEntryStringIntegerIntegerAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_INDEX_NAME),s=e?.getArguments()?.get(si.PARAMETER_SECOND_INDEX_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n,s)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING,si.PARAMETER_INDEX,si.PARAMETER_SECOND_INDEX)]}static ofEntryStringStringStringAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SECOND_STRING_NAME),s=e?.getArguments()?.get(si.PARAMETER_THIRD_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n,s)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING,si.PARAMETER_SECOND_STRING,si.PARAMETER_THIRD_STRING)]}static ofEntryStringAndIntegerOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,si.EVENT_INT,si.PARAMETER_STRING)]}}class so extends e3{static{this.VALUE="value"}static{this.SCHEMA=new Y().setName(so.VALUE).setType(new x(i.STRING))}static{this.SIGNATURE=new eT("Concatenate").setNamespace(p.STRING).setParameters(new Map([[so.VALUE,new X(so.VALUE,so.SCHEMA).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[so.VALUE,Y.ofString(so.VALUE)]]))]))}constructor(){super()}getSignature(){return so.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(so.VALUE),r="";return t.reduce((e,t)=>r=e+t,r),new eu([ea.outputOf(new Map([[so.VALUE,r]]))])}}class sE extends e3{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 X(sE.PARAMETER_STRING_NAME,Y.ofString(sE.PARAMETER_STRING_NAME)),this.PARAMETER_AT_START=new X(sE.PARAMETER_AT_START_NAME,Y.ofInteger(sE.PARAMETER_AT_START_NAME)),this.PARAMETER_AT_END=new X(sE.PARAMETER_AT_END_NAME,Y.ofInteger(sE.PARAMETER_AT_END_NAME)),this.EVENT_STRING=new es(es.OUTPUT,new Map([[sE.EVENT_RESULT_NAME,Y.ofString(sE.EVENT_RESULT_NAME)]])),this.signature=new eT("DeleteForGivenLength").setNamespace(p.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(sE.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(sE.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(sE.PARAMETER_AT_END_NAME);if(n>=r){let e="";return e+=t.substring(0,r)+t.substring(n),new eu([ea.outputOf(new Map([[sE.EVENT_RESULT_NAME,e.toString()]]))])}return new eu([ea.outputOf(new Map([[sE.EVENT_RESULT_NAME,t]]))])}}class su extends e3{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(su.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(su.PARAMETER_AT_POSITION_NAME),n=e?.getArguments()?.get(su.PARAMETER_INSERT_STRING_NAME),s="";return s+=t.substring(0,r)+n+t.substring(r),new eu([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,s]]))])}constructor(...e){super(...e),this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new X(su.PARAMETER_STRING_NAME,Y.ofString(su.PARAMETER_STRING_NAME)),this.PARAMETER_AT_POSITION=new X(su.PARAMETER_AT_POSITION_NAME,Y.ofInteger(su.PARAMETER_AT_POSITION_NAME)),this.PARAMETER_INSERT_STRING=new X(su.PARAMETER_INSERT_STRING_NAME,Y.ofString(su.PARAMETER_INSERT_STRING_NAME)),this.EVENT_STRING=new es(es.OUTPUT,new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]])),this.signature=new eT("InsertAtGivenPosition").setNamespace(p.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([es.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]))]))}}class sA extends e3{static{this.PARAMETER_REGEX_NAME="regex"}static{this.PARAMETER_STRING_NAME="string"}static{this.EVENT_RESULT_NAME="result"}static{this.signature=new eT("Matches").setNamespace(p.STRING).setParameters(q.ofEntries(q.entry(...X.ofEntry(sA.PARAMETER_REGEX_NAME,Y.ofString(sA.PARAMETER_REGEX_NAME))),q.entry(...X.ofEntry(sA.PARAMETER_STRING_NAME,Y.ofString(sA.PARAMETER_STRING_NAME))))).setEvents(q.ofEntries(q.entry(...es.outputEventMapEntry(new Map([[sA.EVENT_RESULT_NAME,Y.ofBoolean(sA.EVENT_RESULT_NAME)]])))))}getSignature(){return sA.signature}async internalExecute(e){let t=e.getArguments()?.get(sA.PARAMETER_REGEX_NAME),r=e.getArguments()?.get(sA.PARAMETER_STRING_NAME);return new eu([ea.outputOf(new Map([[sA.EVENT_RESULT_NAME,!!r.match(t)?.length]]))])}}class sT extends e3{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 X(sT.PARAMETER_STRING_NAME,Y.ofString(sT.PARAMETER_STRING_NAME))}static{this.PARAMETER_POSTPAD_STRING=new X(sT.PARAMETER_POSTPAD_STRING_NAME,Y.ofString(sT.PARAMETER_POSTPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(sT.PARAMETER_LENGTH_NAME,Y.ofInteger(sT.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sT.EVENT_RESULT_NAME,Y.ofString(sT.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new eT("PostPad").setNamespace(p.STRING).setParameters(new Map([[sT.PARAMETER_STRING.getParameterName(),sT.PARAMETER_STRING],[sT.PARAMETER_POSTPAD_STRING.getParameterName(),sT.PARAMETER_POSTPAD_STRING],[sT.PARAMETER_LENGTH.getParameterName(),sT.PARAMETER_LENGTH]])).setEvents(new Map([[sT.EVENT_STRING.getName(),sT.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sT.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(sT.PARAMETER_POSTPAD_STRING_NAME),n=e.getArguments()?.get(sT.PARAMETER_LENGTH_NAME),s="",a=r.length;for(s+=t;a<=n;)s+=r,a+=r.length;return s.length-t.length<n&&(s+=r.substring(0,n-(s.length-t.length))),new eu([ea.outputOf(new Map([[sT.EVENT_RESULT_NAME,s.toString()]]))])}}class sl extends e3{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 X(sl.PARAMETER_STRING_NAME,Y.ofString(sl.PARAMETER_STRING_NAME))}static{this.PARAMETER_PREPAD_STRING=new X(sl.PARAMETER_PREPAD_STRING_NAME,Y.ofString(sl.PARAMETER_PREPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(sl.PARAMETER_LENGTH_NAME,Y.ofInteger(sl.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sl.EVENT_RESULT_NAME,Y.ofString(sl.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("PrePad").setNamespace(p.STRING).setParameters(new Map([[sl.PARAMETER_STRING.getParameterName(),sl.PARAMETER_STRING],[sl.PARAMETER_PREPAD_STRING.getParameterName(),sl.PARAMETER_PREPAD_STRING],[sl.PARAMETER_LENGTH.getParameterName(),sl.PARAMETER_LENGTH]])).setEvents(new Map([[sl.EVENT_STRING.getName(),sl.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(sl.PARAMETER_STRING_NAME),r=e.getArguments()?.get(sl.PARAMETER_PREPAD_STRING_NAME),n=e.getArguments()?.get(sl.PARAMETER_LENGTH_NAME),s="",a=r.length;for(;a<=n;)s+=r,a+=r.length;return s.length<n&&(s+=r.substring(0,n-s.length)),s+=t,new eu([ea.outputOf(new Map([[sl.EVENT_RESULT_NAME,s]]))])}}class sR extends e3{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 X(sR.PARAMETER_STRING_NAME,Y.ofString(sR.PARAMETER_STRING_NAME))}static{this.PARAMETER_OTHER_STRING=new X(sR.PARAMETER_OTHER_STRING_NAME,Y.ofString(sR.PARAMETER_OTHER_STRING_NAME))}static{this.PARAMETER_FIRST_OFFSET=new X(sR.PARAMETER_FIRST_OFFSET_NAME,Y.ofInteger(sR.PARAMETER_FIRST_OFFSET_NAME))}static{this.PARAMETER_SECOND_OFFSET=new X(sR.PARAMETER_SECOND_OFFSET_NAME,Y.ofInteger(sR.PARAMETER_SECOND_OFFSET_NAME))}static{this.PARAMETER_INTEGER=new X(sR.PARAMETER_INTEGER_NAME,Y.ofInteger(sR.PARAMETER_INTEGER_NAME))}static{this.PARAMETER_BOOLEAN=new X(sR.PARAMETER_BOOLEAN_NAME,Y.ofBoolean(sR.PARAMETER_BOOLEAN_NAME))}static{this.EVENT_BOOLEAN=new es(es.OUTPUT,new Map([[sR.EVENT_RESULT_NAME,Y.ofBoolean(sR.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("RegionMatches").setNamespace(p.STRING).setParameters(new Map([[sR.PARAMETER_STRING.getParameterName(),sR.PARAMETER_STRING],[sR.PARAMETER_BOOLEAN.getParameterName(),sR.PARAMETER_BOOLEAN],[sR.PARAMETER_FIRST_OFFSET.getParameterName(),sR.PARAMETER_FIRST_OFFSET],[sR.PARAMETER_OTHER_STRING.getParameterName(),sR.PARAMETER_OTHER_STRING],[sR.PARAMETER_SECOND_OFFSET.getParameterName(),sR.PARAMETER_SECOND_OFFSET],[sR.PARAMETER_INTEGER.getParameterName(),sR.PARAMETER_INTEGER]])).setEvents(new Map([[sR.EVENT_BOOLEAN.getName(),sR.EVENT_BOOLEAN]]))}async internalExecute(e){let t=e.getArguments()?.get(sR.PARAMETER_STRING_NAME),r=e.getArguments()?.get(sR.PARAMETER_BOOLEAN_NAME),n=e.getArguments()?.get(sR.PARAMETER_FIRST_OFFSET_NAME),s=e?.getArguments()?.get(sR.PARAMETER_OTHER_STRING_NAME),a=e?.getArguments()?.get(sR.PARAMETER_SECOND_OFFSET_NAME),i=e.getArguments()?.get(sR.PARAMETER_INTEGER_NAME),o=!1;return o=!(n<0)&&!(a<0)&&!(n+i>t.length)&&!(a+i>s.length)&&(r?(t=t.substring(n,n+i).toUpperCase())==s.substring(a,a+i).toUpperCase():(t=t.substring(n,n+i))==s.substring(a,i)),new eu([ea.outputOf(new Map([[sR.EVENT_RESULT_NAME,o]]))])}}class sm extends e3{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 X(sm.PARAMETER_STRING_NAME,Y.ofString(sm.PARAMETER_STRING_NAME))}static{this.PARAMETER_AT_START=new X(sm.PARAMETER_AT_START_NAME,Y.ofInteger(sm.PARAMETER_AT_START_NAME))}static{this.PARAMETER_AT_LENGTH=new X(sm.PARAMETER_AT_LENGTH_NAME,Y.ofInteger(sm.PARAMETER_AT_LENGTH_NAME))}static{this.PARAMETER_REPLACE_STRING=new X(sm.PARAMETER_REPLACE_STRING_NAME,Y.ofString(sm.PARAMETER_REPLACE_STRING_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sm.EVENT_RESULT_NAME,Y.ofString(sm.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new eT("ReplaceAtGivenPosition").setNamespace(p.STRING).setParameters(new Map([[sm.PARAMETER_STRING.getParameterName(),sm.PARAMETER_STRING],[sm.PARAMETER_AT_START.getParameterName(),sm.PARAMETER_AT_START],[sm.PARAMETER_AT_LENGTH.getParameterName(),sm.PARAMETER_AT_LENGTH],[sm.PARAMETER_REPLACE_STRING.getParameterName(),sm.PARAMETER_REPLACE_STRING]])).setEvents(new Map([[sm.EVENT_STRING.getName(),sm.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(sm.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(sm.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(sm.PARAMETER_AT_LENGTH_NAME);return e?.getArguments()?.get(sm.PARAMETER_REPLACE_STRING_NAME),t.length,r<n&&(t.substring(0,r),t.substring(r+n)),new eu([ea.outputOf(new Map([[sm.EVENT_RESULT_NAME,t]]))])}}class sg extends e3{constructor(){super(),this.VALUE="value",this.SIGNATURE=new eT("Reverse").setNamespace(p.STRING).setParameters(new Map([[this.VALUE,new X(this.VALUE,Y.ofString(this.VALUE)).setVariableArgument(!1)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[this.VALUE,new Y().setType(L.of(i.STRING)).setName(this.VALUE)]]))]))}getSignature(){return this.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(this.VALUE),r=t.length-1,n="";for(;r>=0;)n+=t.charAt(r--);return new eu([ea.outputOf(q.of(this.VALUE,n))])}}class sh extends e3{getSignature(){return new eT("Split").setNamespace(p.STRING).setParameters(new Map([[this.PARAMETER_STRING_NAME,this.PARAMETER_STRING],[this.PARAMETER_SPLIT_STRING_NAME,this.PARAMETER_SPLIT_STRING]])).setEvents(new Map([es.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,Y.ofArray(this.EVENT_RESULT_NAME)]]))]))}constructor(){super(),this.PARAMETER_STRING_NAME="string",this.PARAMETER_SPLIT_STRING_NAME="searchString",this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new X(this.PARAMETER_STRING_NAME,Y.ofString(this.PARAMETER_STRING_NAME)),this.PARAMETER_SPLIT_STRING=new X(this.PARAMETER_SPLIT_STRING_NAME,Y.ofString(this.PARAMETER_SPLIT_STRING_NAME)),this.EVENT_ARRAY=new es(es.OUTPUT,q.of(this.EVENT_RESULT_NAME,Y.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 eu([ea.outputOf(q.of(this.EVENT_RESULT_NAME,t.split(r)))])}}class sc extends e3{getSignature(){return new eT("ToString").setNamespace(p.STRING).setParameters(new Map([[this.PARAMETER_INPUT_ANYTYPE.getParameterName(),this.PARAMETER_INPUT_ANYTYPE]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}constructor(){super(),this.PARAMETER_INPUT_ANYTYPE_NAME="anytype",this.EVENT_RESULT_NAME="result",this.PARAMETER_INPUT_ANYTYPE=new X(this.PARAMETER_INPUT_ANYTYPE_NAME,Y.ofAny(this.PARAMETER_INPUT_ANYTYPE_NAME)),this.EVENT_STRING=new es(es.OUTPUT,new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]))}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 eu([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,r]]))])}}class sp extends e3{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new X(sp.PARAMETER_STRING_NAME,Y.ofString(sp.PARAMETER_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(sp.PARAMETER_LENGTH_NAME,Y.ofInteger(sp.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sp.EVENT_RESULT_NAME,Y.ofString(sp.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("TrimTo").setNamespace(p.STRING).setParameters(new Map([[sp.PARAMETER_STRING.getParameterName(),sp.PARAMETER_STRING],[sp.PARAMETER_LENGTH.getParameterName(),sp.PARAMETER_LENGTH]])).setEvents(new Map([[sp.EVENT_STRING.getName(),sp.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(sp.PARAMETER_STRING_NAME),r=e.getArguments()?.get(sp.PARAMETER_LENGTH_NAME);return new eu([ea.outputOf(new Map([[sp.EVENT_RESULT_NAME,t.substring(0,r)]]))])}}class sN{static{this.repoMap=q.ofArrayEntries(si.ofEntryStringAndStringOutput("Trim",e=>e.trim()),si.ofEntryStringAndStringOutput("TrimStart",e=>e.trimStart()),si.ofEntryStringAndStringOutput("TrimEnd",e=>e.trimEnd()),si.ofEntryStringAndIntegerOutput("Length",e=>e.length),si.ofEntryStringStringAndIntegerOutput("Frequency",(e,t)=>{let r=0,n=e.indexOf(t);for(;-1!=n;)r++,n=e.indexOf(t,n+1);return r}),si.ofEntryStringAndStringOutput("LowerCase",e=>e.toLocaleLowerCase()),si.ofEntryStringAndStringOutput("UpperCase",e=>e.toUpperCase()),si.ofEntryStringAndBooleanOutput("IsBlank",e=>""===e.trim()),si.ofEntryStringAndBooleanOutput("IsEmpty",e=>""===e),si.ofEntryStringStringAndBooleanOutput("Contains",(e,t)=>-1!=e.indexOf(t)),si.ofEntryStringStringAndBooleanOutput("EndsWith",(e,t)=>e.endsWith(t)),si.ofEntryStringStringAndBooleanOutput("StartsWith",(e,t)=>e.startsWith(t)),si.ofEntryStringStringAndBooleanOutput("EqualsIgnoreCase",(e,t)=>e.toUpperCase()==t.toUpperCase()),si.ofEntryStringStringAndBooleanOutput("Matches",(e,t)=>new RegExp(t).test(e)),si.ofEntryStringStringAndIntegerOutput("IndexOf",(e,t)=>e.indexOf(t)),si.ofEntryStringStringAndIntegerOutput("LastIndexOf",(e,t)=>e.lastIndexOf(t)),si.ofEntryStringIntegerAndStringOutput("Repeat",(e,t)=>e.repeat(t)),si.ofEntryStringStringIntegerAndIntegerOutput("IndexOfWithStartPoint",(e,t,r)=>e.indexOf(t,r)),si.ofEntryStringStringIntegerAndIntegerOutput("LastIndexOfWithStartPoint",(e,t,r)=>e.lastIndexOf(t,r)),si.ofEntryStringStringStringAndStringOutput("Replace",(e,t,r)=>e.replaceAll(t,r)),si.ofEntryStringStringStringAndStringOutput("ReplaceFirst",(e,t,r)=>e.replace(t,r)),si.ofEntryStringIntegerIntegerAndStringOutput("SubString",(e,t,r)=>e.substring(t,r)),et(new so),et(new sE),et(new su),et(new sT),et(new sl),et(new sR),et(new sm),et(new sg),et(new sh),et(new sc),et(new sp),et(new sA))}static{this.filterableNames=Array.from(sN.repoMap.values()).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=p.STRING?Promise.resolve(void 0):Promise.resolve(sN.repoMap.get(t))}async filter(e){return Promise.resolve(sN.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sf extends e3{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 X(sf.PARAMETER_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_ONE=new X(sf.PARAMETER_TIMESTAMP_NAME_ONE,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_TWO=new X(sf.PARAMETER_TIMESTAMP_NAME_TWO,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_VARIABLE_UNIT=new X(sf.PARAMETER_UNIT_NAME,Y.ofRef(p.DATE+".Timeunit")).setVariableArgument(!0)}static{this.PARAMETER_UNIT=new X(sf.PARAMETER_UNIT_NAME,Y.ofRef(p.DATE+".Timeunit"))}static{this.PARAMETER_NUMBER=new X(sf.PARAMETER_NUMBER_NAME,Y.ofInteger(sf.PARAMETER_NUMBER_NAME))}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_TIMESTAMP_NAME="isoTimeStamp"}static{this.EVENT_INT=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofInteger(sf.EVENT_RESULT_NAME)))}static{this.EVENT_STRING=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofString(sf.EVENT_RESULT_NAME)))}static{this.EVENT_LONG=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofLong(sf.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME)))}static{this.EVENT_TIMESTAMP=new es(es.OUTPUT,q.of(sf.EVENT_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")))}getSignature(){return this.signature}constructor(e,t,...r){if(super(),this.signature=new eT(e).setNamespace(p.DATE).setEvents(q.of(t.getName(),t)),!r?.length)return;let n=new Map;r.forEach(e=>n.set(e.getParameterName(),e)),this.signature.setParameters(n)}static ofEntryTimestampAndIntegerOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME))))])}}(e,sf.EVENT_INT,sf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndBooleanOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME))))])}}(e,sf.EVENT_BOOLEAN,sf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndStringOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME))))])}}(e,sf.EVENT_STRING,sf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampIntegerAndTimestampOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),e.getArguments()?.get(sf.PARAMETER_NUMBER_NAME))))])}}(e,sf.EVENT_INT,sf.PARAMETER_TIMESTAMP,sf.PARAMETER_NUMBER)]}static ofEntryTimestampTimestampAndTOutput(e,t,r,...n){return[e,new class extends sf{async internalExecute(e){let t=[];return n?.length&&t.push(...n.map(t=>e.getArguments()?.get(t.getParameterName()))),new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,r(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME_ONE),e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME_TWO),t)))])}}(e,t,sf.PARAMETER_TIMESTAMP_ONE,sf.PARAMETER_TIMESTAMP_TWO,...n)]}}function s_(e){let t=(0,l.DateTime).fromISO(e);if(!t?.isValid)throw Error("Invalid ISO timestamp");return t}class sM extends sf{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",sf.EVENT_TIMESTAMP,sf.PARAMETER_TIMESTAMP,X.of(sM.PARAMETER_YEARS_NAME,Y.ofNumber(sM.PARAMETER_YEARS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_MONTHS_NAME,Y.ofNumber(sM.PARAMETER_MONTHS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_DAYS_NAME,Y.ofNumber(sM.PARAMETER_DAYS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_HOURS_NAME,Y.ofNumber(sM.PARAMETER_HOURS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_MINUTES_NAME,Y.ofNumber(sM.PARAMETER_MINUTES_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_SECONDS_NAME,Y.ofNumber(sM.PARAMETER_SECONDS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_MILLISECONDS_NAME,Y.ofNumber(sM.PARAMETER_MILLISECONDS_NAME).setDefaultValue(0))),this.isAdd=e}async internalExecute(e){let t;let r=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),n=e.getArguments()?.get(sM.PARAMETER_YEARS_NAME),s=e.getArguments()?.get(sM.PARAMETER_MONTHS_NAME),a=e.getArguments()?.get(sM.PARAMETER_DAYS_NAME),i=e.getArguments()?.get(sM.PARAMETER_HOURS_NAME),o={years:n,months:s,days:a,hours:i,minutes:e.getArguments()?.get(sM.PARAMETER_MINUTES_NAME),seconds:e.getArguments()?.get(sM.PARAMETER_SECONDS_NAME),milliseconds:e.getArguments()?.get(sM.PARAMETER_MILLISECONDS_NAME)};return t=this.isAdd?r.plus(o):r.minus(o),new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,t.toISO()))])}}class sS extends e3{constructor(e,t){super(),this.paramName=`epoch${t?"Seconds":"Milliseconds"}`,this.isSeconds=t,this.signature=new eT(e).setNamespace(p.DATE).setParameters(new Map([[this.paramName,X.of(this.paramName,new Y().setName(this.paramName).setType(L.of(i.LONG,i.INTEGER,i.STRING)))]])).setEvents(new Map([[sf.EVENT_TIMESTAMP_NAME,sf.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 eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,new Date(r).toISOString()))]))}}class sO extends e3{constructor(e,t){super(),this.isSeconds=t,this.signature=new eT(e).setNamespace(p.DATE).setParameters(new Map([[sf.PARAMETER_TIMESTAMP_NAME,sf.PARAMETER_TIMESTAMP]])).setEvents(new Map([[sf.EVENT_RESULT_NAME,sf.EVENT_LONG]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),r=this.isSeconds?(0,l.DateTime).fromISO(t).toSeconds():(0,l.DateTime).fromISO(t).toMillis();return Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,r))]))}}class sw extends sf{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("ToDateString",sf.EVENT_STRING,sf.PARAMETER_TIMESTAMP,X.of(sw.PARAMETER_FORMAT_NAME,Y.ofString(sw.PARAMETER_FORMAT_NAME)),X.of(sw.PARAMETER_LOCALE_NAME,Y.ofString(sw.PARAMETER_LOCALE_NAME).setDefaultValue("")))}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(sw.PARAMETER_FORMAT_NAME),n=e.getArguments()?.get(sw.PARAMETER_LOCALE_NAME);return""===n&&(n="system"),new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t.toFormat(r,{locale:n})))])}}class sI extends sf{static{this.PARAMETER_TIMEZONE_NAME="timezone"}constructor(){super("SetTimeZone",sf.EVENT_TIMESTAMP,sf.PARAMETER_TIMESTAMP,X.of(sI.PARAMETER_TIMEZONE_NAME,Y.ofString(sI.PARAMETER_TIMEZONE_NAME)))}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(sI.PARAMETER_TIMEZONE_NAME);return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t.setZone(r).toISO()))])}}class sP extends sf{static{this.PARAMETER_START_TIMESTAMP_NAME="startTimestamp"}static{this.PARAMETER_END_TIMESTAMP_NAME="endTimestamp"}static{this.PARAMETER_CHECK_TIMESTAMP_NAME="checkTimestamp"}constructor(){super("IsBetween",sP.EVENT_BOOLEAN,X.of(sP.PARAMETER_START_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")),X.of(sP.PARAMETER_END_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")),X.of(sP.PARAMETER_CHECK_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")))}async internalExecute(e){let t=e.getArguments()?.get(sP.PARAMETER_START_TIMESTAMP_NAME),r=e.getArguments()?.get(sP.PARAMETER_END_TIMESTAMP_NAME),n=e.getArguments()?.get(sP.PARAMETER_CHECK_TIMESTAMP_NAME),s=s_(t),a=s_(r),i=s_(n);return s>a&&([s,a]=[a,s]),new eu([ea.outputOf(q.of(sP.EVENT_RESULT_NAME,s<=i&&i<=a))])}}class sd extends e3{constructor(e){super(),this.isLast=e,this.signature=new eT(e?"LastOf":"FirstOf").setNamespace(p.DATE).setParameters(new Map([[sf.PARAMETER_TIMESTAMP_NAME,new X(sf.PARAMETER_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")).setVariableArgument(!0)]])).setEvents(new Map([[sf.EVENT_TIMESTAMP_NAME,sf.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME);if(!t?.length)throw Error("No timestamps provided");let r=t.map(e=>s_(e));return r.sort((e,t)=>e.toMillis()-t.toMillis()),Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,r[this.isLast?r.length-1:0].toISO()))]))}}class sy extends sf{static{this.EVENT_TIME_OBJECT_NAME="object"}static{this.EVENT_TIME_ARRAY_NAME="array"}constructor(e){super(e?"TimeAsArray":"TimeAsObject",new es(es.OUTPUT,q.of(e?sy.EVENT_TIME_ARRAY_NAME:sy.EVENT_TIME_OBJECT_NAME,e?Y.ofArray(sy.EVENT_TIME_ARRAY_NAME,Y.ofInteger("timeParts")):Y.ofRef(p.DATE+".TimeObject"))),sf.PARAMETER_TIMESTAMP),this.isArray=e}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)).toObject();return new eu([ea.outputOf(q.of(this.isArray?sy.EVENT_TIME_ARRAY_NAME:sy.EVENT_TIME_OBJECT_NAME,this.isArray?[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond]:t))])}}class sx extends sf{constructor(e){super(e?"StartOf":"EndOf",sf.EVENT_TIMESTAMP,sf.PARAMETER_TIMESTAMP,sf.PARAMETER_UNIT),this.isStart=e}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(sf.PARAMETER_UNIT_NAME)?.toLowerCase(),n=this.isStart?t.startOf(r):t.endOf(r);return new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,n.toISO()))])}}class sL extends sf{static{this.EVENT_NAMES_NAME="names"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("GetNames",new es(sL.EVENT_NAMES_NAME,q.of(sL.EVENT_NAMES_NAME,Y.ofArray(sL.EVENT_NAMES_NAME,Y.ofString(sL.EVENT_NAMES_NAME)))),new X(sL.PARAMETER_UNIT_NAME,Y.ofString(sL.PARAMETER_UNIT_NAME).setEnums(["TIMEZONES","MONTHS","WEEKDAYS"])),new X(sL.PARAMETER_LOCALE_NAME,Y.ofString(sL.PARAMETER_LOCALE_NAME).setDefaultValue("system")))}async internalExecute(e){let t=e.getArguments()?.get(sL.PARAMETER_UNIT_NAME),r=e.getArguments()?.get(sL.PARAMETER_LOCALE_NAME);return new eu([ea.outputOf(q.of(sL.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,l.DateTime).now().setLocale(t).set({month:e}).toFormat("MMMM")):"WEEKDAYS"===e?[1,2,3,4,5,6,7].map(e=>(0,l.DateTime).now().setLocale(t).set({month:7,day:e}).toFormat("EEEE")):[]}}class sv extends e3{static{this.SIGNATURE=new eT("IsValidISODate").setNamespace(p.DATE).setParameters(new Map([X.ofEntry(sf.PARAMETER_TIMESTAMP_NAME,Y.ofString(sf.PARAMETER_TIMESTAMP_NAME))])).setEvents(new Map([es.outputEventMapEntry(q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME)))]))}internalExecute(e){let t=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),r=(0,l.DateTime).fromISO(t);return Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,r.isValid))]))}getSignature(){return sv.SIGNATURE}}class sU extends sf{static{this.PARAMETER_FROM_NAME="from"}static{this.PARAMETER_FROM=new X(sU.PARAMETER_FROM_NAME,Y.ofRef(p.DATE+".Timestamp").setDefaultValue(""))}static{this.PARAMETER_LOCALE_NAME="locale"}static{this.PARAMETER_LOCALE=new X(sU.PARAMETER_LOCALE_NAME,Y.ofString(sU.PARAMETER_LOCALE_NAME).setDefaultValue("system"))}static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_FORMAT=new X(sU.PARAMETER_FORMAT_NAME,Y.ofString(sU.PARAMETER_FORMAT_NAME).setEnums(["LONG","SHORT","NARROW"]).setDefaultValue("LONG"))}static{this.PARAMETER_ROUND_NAME="round"}static{this.PARAMETER_ROUND=new X(sU.PARAMETER_ROUND_NAME,Y.ofBoolean(sU.PARAMETER_ROUND_NAME).setDefaultValue(!0))}constructor(){super("FromNow",sf.EVENT_STRING,sf.PARAMETER_TIMESTAMP,sU.PARAMETER_FORMAT,sU.PARAMETER_FROM,sf.PARAMETER_VARIABLE_UNIT,sU.PARAMETER_ROUND,sU.PARAMETER_LOCALE)}internalExecute(e){let t=e.getArguments()?.get(sU.PARAMETER_FROM_NAME),r=""===t?(0,l.DateTime).now():(0,l.DateTime).fromISO(t),n=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),s=(0,l.DateTime).fromISO(n),a=e.getArguments()?.get(sU.PARAMETER_UNIT_NAME),i=e.getArguments()?.get(sU.PARAMETER_FORMAT_NAME),o=e.getArguments()?.get(sU.PARAMETER_ROUND_NAME),E=e.getArguments()?.get(sU.PARAMETER_LOCALE_NAME),u={base:r,style:i?.toLowerCase(),round:o,locale:E};return a?.length>0&&(u.unit=a.map(e=>e.toLowerCase())),Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,s.toRelative(u)??"Unknown"))]))}}class sV extends sf{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_TIMESTAMP_STRING_NAME="timestampString"}constructor(){super("FromDateString",sf.EVENT_TIMESTAMP,X.of(sV.PARAMETER_TIMESTAMP_STRING_NAME,Y.ofString(sV.PARAMETER_TIMESTAMP_STRING_NAME)),X.of(sV.PARAMETER_FORMAT_NAME,Y.ofString(sV.PARAMETER_FORMAT_NAME)))}async internalExecute(e){let t=e.getArguments()?.get(sV.PARAMETER_TIMESTAMP_STRING_NAME),r=e.getArguments()?.get(sV.PARAMETER_FORMAT_NAME),n=(0,l.DateTime).fromFormat(t,r);return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,n.toISO()))])}}class sC extends sf{constructor(){super("GetCurrentTimestamp",sf.EVENT_TIMESTAMP)}async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,(0,l.DateTime).now().toISO()))])}}class sD{static{this.repoMap=q.ofArrayEntries(["EpochSecondsToTimestamp",new sS("EpochSecondsToTimestamp",!0)],["EpochMillisecondsToTimestamp",new sS("EpochMillisecondsToTimestamp",!1)],sf.ofEntryTimestampAndIntegerOutput("GetDay",e=>s_(e).day),sf.ofEntryTimestampAndIntegerOutput("GetDayOfWeek",e=>s_(e).weekday),sf.ofEntryTimestampAndIntegerOutput("GetMonth",e=>s_(e).month),sf.ofEntryTimestampAndIntegerOutput("GetYear",e=>s_(e).year),sf.ofEntryTimestampAndIntegerOutput("GetHours",e=>s_(e).hour),sf.ofEntryTimestampAndIntegerOutput("GetMinutes",e=>s_(e).minute),sf.ofEntryTimestampAndIntegerOutput("GetSeconds",e=>s_(e).second),sf.ofEntryTimestampAndIntegerOutput("GetMilliseconds",e=>s_(e).millisecond),sf.ofEntryTimestampAndIntegerOutput("GetDaysInMonth",e=>s_(e).daysInMonth),sf.ofEntryTimestampAndIntegerOutput("GetDaysInYear",e=>s_(e).daysInYear),["TimestampToEpochSeconds",new sO("TimestampToEpochSeconds",!0)],["TimestampToEpochMilliseconds",new sO("TimestampToEpochMilliseconds",!1)],sf.ofEntryTimestampAndStringOutput("GetTimeZoneName",e=>s_(e).zoneName),sf.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetLong",e=>s_(e).offsetNameLong),sf.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetShort",e=>s_(e).offsetNameShort),sf.ofEntryTimestampAndIntegerOutput("GetTimeZoneOffset",e=>s_(e).offset),["ToDateString",new sw],["AddTime",new sM(!0)],["SubtractTime",new sM(!1)],["GetCurrentTimestamp",new sC],sf.ofEntryTimestampTimestampAndTOutput("Difference",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofRef(`${p.DATE}.Duration`))),(e,t,r)=>{let n;let s=s_(e),a=s_(t);return r?.[0]?.length&&(n=r[0]?.filter(e=>!!e).map(e=>e.toLowerCase())),s.diff(a,n).toObject()},sf.PARAMETER_VARIABLE_UNIT),sf.ofEntryTimestampIntegerAndTimestampOutput("SetDay",(e,t)=>s_(e).set({day:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetMonth",(e,t)=>s_(e).set({month:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetYear",(e,t)=>s_(e).set({year:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetHours",(e,t)=>s_(e).set({hour:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetMinutes",(e,t)=>s_(e).set({minute:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetSeconds",(e,t)=>s_(e).set({second:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetMilliseconds",(e,t)=>s_(e).set({millisecond:t}).toISO()),["SetTimeZone",new sI],sf.ofEntryTimestampTimestampAndTOutput("IsBefore",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)<s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsAfter",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)>s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsSame",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)===s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsSameOrBefore",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)<=s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsSameOrAfter",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)>=s_(t)),sf.ofEntryTimestampAndBooleanOutput("IsInLeapYear",e=>s_(e).isInLeapYear),sf.ofEntryTimestampAndBooleanOutput("IsInDST",e=>s_(e).isInDST),["IsBetween",new sP],["LastOf",new sd(!0)],["FirstOf",new sd(!1)],["StartOf",new sx(!0)],["EndOf",new sx(!1)],["TimeAsObject",new sy(!1)],["TimeAsArray",new sy(!0)],["GetNames",new sL],["IsValidISODate",new sv],["FromNow",new sU],["FromDateString",new sV])}static{this.filterableNames=Array.from(sD.repoMap.values()).map(e=>e.getSignature().getFullName())}find(e,t){return e!=p.DATE?Promise.resolve(void 0):Promise.resolve(sD.repoMap.get(t))}filter(e){return Promise.resolve(sD.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sG extends e3{static{this.MILLIS="millis"}static{this.SIGNATURE=new eT("Wait").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(sG.MILLIS,Y.ofNumber(sG.MILLIS).setMinimum(0).setDefaultValue(0))])).setEvents(new Map([es.outputEventMapEntry(new Map)]))}getSignature(){return sG.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(sG.MILLIS);return await new Promise(e=>setTimeout(e,t)),new eu([ea.outputOf(new Map)])}}var sb={};m(sb,"HybridRepository",()=>sF);class sF{constructor(...e){this.repos=e}async find(e,t){for(let r of this.repos){let n=await r.find(e,t);if(n)return n}}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)}}const sB=new Map([[p.SYSTEM_CTX,new Map([et(new class extends e3{getSignature(){return rn}async internalExecute(e){let t=e?.getArguments()?.get(rt);if(e?.getContext()?.has(t))throw new eE(ec.format("Context already has an element for '$' ",t));let r=Y.from(e?.getArguments()?.get(rr));if(!r)throw new eE("Schema is not supplied.");return e.getContext().set(t,new re(r,_(r.getDefaultValue())?void 0:r.getDefaultValue())),new eu([ea.outputOf(new Map)])}}),et(new class extends e3{getSignature(){return ri}async internalExecute(e){let t=e?.getArguments()?.get(rs);if(!e.getContext()?.has(t))throw new eE(ec.format("Context don't have an element for '$' ",t));return new eu([ea.outputOf(new Map([ra,e.getContext()?.get(t)?.getElement()]))])}}),et(new class extends e3{getSignature(){return nR}async internalExecute(e){let t=e?.getArguments()?.get(nT);if(eM.isNullOrBlank(t))throw new eE("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get(nl),n=new tY(t),s=n.getTokens().peekLast();if(!s.getExpression().startsWith("Context")||s instanceof tY||s instanceof tb&&!s.getElement().toString().startsWith("Context"))throw new tr(ec.format("The context path $ is not a valid path in context",t));for(let e of n.getOperations().toArray())if(e!=tB.ARRAY_OPERATOR&&e!=tB.OBJECT_OPERATOR)throw new tr(ec.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<n.getTokens().size();r++){let s=n.getTokens().get(r);s instanceof tY&&n.getTokens().set(r,new tb(t,new nA(s).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,n)}modifyContext(e,t,r,n){let s=n.getTokens();s.removeLast();let a=n.getOperations();a.removeLast();let i=e.getContext()?.get(s.removeLast().getExpression());if(_(i))throw new eE(ec.format("Context doesn't have any element with name '$' ",t));if(a.isEmpty())return i.setElement(r),new eu([ea.outputOf(new Map)]);let o=i.getElement(),E=a.removeLast(),u=s.removeLast(),A=u instanceof tb?u.getElement():u.getExpression();for(_(o)&&(o=E==tB.OBJECT_OPERATOR?{}:[],i.setElement(o));!a.isEmpty();)o=E==tB.OBJECT_OPERATOR?this.getDataFromObject(o,A,a.peekLast()):this.getDataFromArray(o,A,a.peekLast()),E=a.removeLast(),A=(u=s.removeLast())instanceof tb?u.getElement():u.getExpression();return E==tB.OBJECT_OPERATOR?this.putDataInObject(o,A,r):this.putDataInArray(o,A,r),new eu([ea.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eE(ec.format("Expected an array index but found $",t));if(n<0)throw new eE(ec.format("Array index is out of bound - $",t));let s=e[n];return _(s)&&(s=r==tB.OBJECT_OPERATOR?{}:[],e[n]=s),s}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));let n=e[t];return _(n)&&(n=r==tB.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eE(ec.format("Expected an array index but found $",t));if(n<0)throw new eE(ec.format("Array index is out of bound - $",t));e[n]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));e[t]=r}})])],[p.SYSTEM_LOOP,new Map([et(new class extends e3{getSignature(){return nV}async internalExecute(e){let t=e.getArguments()?.get(nx),r=e.getArguments()?.get("to"),n=e.getArguments()?.get(nL),s=n>0,a=t,i=!1,o=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(i)return;if(s&&a>=r||!s&&a<=r||o&&e.getExecutionContext()?.get(o))return i=!0,o&&e.getExecutionContext()?.delete(o),ea.outputOf(new Map([[nv,a]]));let t=ea.of(es.ITERATION,new Map([[nU,a]]));return a+=n,t}})}}),et(new class extends e3{getSignature(){return nO}async internalExecute(e){let t=e.getArguments()?.get(n_),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(r>=t||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),ea.outputOf(new Map([[nM,r]]));let s=ea.of(es.ITERATION,new Map([[nS,r]]));return++r,s}})}}),et(new class extends e3{getSignature(){return nf}async internalExecute(e){let t=e.getArguments()?.get(nN);return e.getExecutionContext().set(t,!0),new eu([ea.outputOf(new Map)])}}),et(new class extends e3{getSignature(){return ny}async internalExecute(e){let t=e.getArguments()?.get(nw),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(r>=t.length||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),ea.outputOf(new Map([[nd,r]]));let s=ea.of(es.ITERATION,new Map([[nP,r],[nI,t[r]]]));return++r,s}})}})])],[p.SYSTEM,new Map([et(new np),et(new class extends e3{getSignature(){return nc}async internalExecute(e){let t=e.getEvents(),r=e.getArguments(),n=r?.get(ng),s=e?.getArguments()?.get(nh).map(t=>{let r=t[nm];if(_(r))throw new eE("Expect a value object");let n=r.value;return r.isExpression&&(n=new nA(n).evaluate(e.getValuesMap())),[t.name,n]}).reduce((e,t)=>(e.set(t[0],t[1]),e),new Map);return t?.has(n)||t?.set(n,[]),t?.get(n)?.push(s),new eu([ea.outputOf(new Map)])}}),et(new sa),et(new sG),et(new t6)])]]),sY=Array.from(sB.values()).flatMap(e=>Array.from(e.values())).map(e=>e.getSignature().getFullName());class sH extends sF{constructor(){super({find:async(e,t)=>sB.get(e)?.get(t),filter:async e=>Array.from(sY).filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase()))},new nZ,new sN,new t7,new ss,new sD)}}var sk={};m(sk,"StatementExecution",()=>sW);var s$={};m(s$,"StatementMessage",()=>sj);class sj{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 sW{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 sj(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){return e instanceof sW&&e.statement.equals(this.statement)}}var sX={};m(sX,"ContextTokenValueExtractor",()=>sJ);class sJ extends tk{static{this.PREFIX="Context."}constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.context.get(r)?.getElement())}getPrefix(){return sJ.PREFIX}getStore(){return _(this.context)?this.context:Array.from(this.context.entries()).reduce((e,[t,r])=>(_(r)||(e[t]=r.getElement()),e),{})}}var sq={};m(sq,"OutputMapTokenValueExtractor",()=>sz);class sz extends tk{static{this.PREFIX="Steps."}constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=1,n=this.output.get(t[r++]);if(!n||r>=t.length)return;let s=n.get(t[r++]);if(!s||r>t.length)return;if(r===t.length)return s;let a=t[r].indexOf("[");if(-1===a){let n=s.get(t[r++]);return this.retrieveElementFrom(e,t,r,n)}let i=t[r].substring(0,a),o=s.get(i);return this.retrieveElementFrom(e,t,r,{[i]:o})}getPrefix(){return sz.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 sK={};m(sK,"ArgumentsTokenValueExtractor",()=>sQ);class sQ extends tk{static{this.PREFIX="Arguments."}constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.args.get(r))}getPrefix(){return sQ.PREFIX}getStore(){return _(this.args)?this.args:Array.from(this.args.entries()).reduce((e,[t,r])=>(e[t]=r,e),{})}}var sZ={};m(sZ,"GraphVertex",()=>s2);var s0={};m(s0,"ExecutionGraph",()=>s1);class s1{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 s2(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 ep(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 s2{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 ew(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new ew(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 s1(!0);var r=new ep(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 s9={};m(s9,"KIRuntime",()=>at);var s3={};m(s3,"JsonExpression",()=>s4);class s4{constructor(e){this.expression=e}getExpression(){return this.expression}}var s5={};m(s5,"ParameterReferenceType",()=>A),(s=A||(A={})).VALUE="VALUE",s.EXPRESSION="EXPRESSION";var s6={};function s7(){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)})}m(s6,"FunctionExecutionParameters",()=>s8);class s8{constructor(e,t,r){this.count=0,this.executionContext=new Map,this.valueExtractors=new Map,this.functionRepository=e,this.schemaRepository=t,this.executionId=r??s7()}getExecutionId(){return this.executionId}getContext(){return this.context}setContext(e){this.context=e;let t=new sJ(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 sz(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={};m(ae,"StatementMessageType",()=>T),(a=T||(T={})).ERROR="ERROR",a.WARNING="WARNING",a.MESSAGE="MESSAGE";class at extends e3{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()>at.VERSION)throw new eE("Runtime is at a lower version "+at.VERSION+" and trying to run code from version "+this.fd.getVersion()+".")}getSignature(){return this.fd}async getExecutionPlan(e,t){let r=new s1;for(let n of Array.from(this.fd.getSteps().values()))r.addVertex(await this.prepareStatementExecution(n,e,t));return Array.from(this.makeEdges(r).getT2().entries()).forEach(e=>{let t=r.getNodeMap().get(e[0])?.getData();t&&t.addMessage(T.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 sQ(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 eE("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 ep;r.addAll(e.getVerticesWithNoIncomingEdges());let n=new ep;for(;(!r.isEmpty()||!n.isEmpty())&&!t.getEvents()?.has(es.OUTPUT);)if(await this.processBranchQue(t,r,n),await this.processExecutionQue(t,r,n),t.setCount(t.getCount()+1),t.getCount()==at.MAX_EXECUTION_ITERATIONS)throw new eE("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size){let e=this.getSignature().getEvents();if(e.size&&e.get(es.OUTPUT)?.getParameters()?.size)throw new eE("No events raised")}let s=Array.from(t.getEvents()?.entries()??[]).flatMap(e=>e[1].map(t=>ea.of(e[0],t)));return new eu(s.length||e.isSubGraph()?s:[ea.of(es.OUTPUT,new Map)])}async processExecutionQue(e,t,r){if(!t.isEmpty()){let n=t.pop();await this.allDependenciesResolvedVertex(n,e.getSteps())?await this.executeVertex(n,e,r,t,e.getFunctionRepository()):t.add(n)}}async processBranchQue(e,t,r){if(r.length){let n=r.pop();await this.allDependenciesResolvedTuples(n.getT2(),e.getSteps())?await this.executeBranch(e,t,n):r.add(n)}}async executeBranch(e,t,r){let n,s=r.getT4();do if(r.getT1().getVerticesData().map(e=>e.getStatement().getStatementName()).forEach(t=>e.getSteps()?.delete(t)),await this.executeGraph(r.getT1(),e),(n=r.getT3().next())&&(e.getSteps()?.has(s.getData().getStatement().getStatementName())||e.getSteps()?.set(s.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(s.getData().getStatement().getStatementName())?.set(n.getName(),this.resolveInternalExpressions(n.getResult(),e)),this.debugMode)){let t=s.getData().getStatement();console.log(`EID: ${e.getExecutionId()} Step : ${t.getStatementName()} => ${t.getNamespace()}.${t.getName()}`),console.log(`EID: ${e.getExecutionId()} Event : ${n.getName()} : `,e.getSteps().get(t.getStatementName()).get(n.getName()))}while(n&&n.getName()!=es.OUTPUT)n?.getName()==es.OUTPUT&&s.getOutVertices().has(es.OUTPUT)&&(s?.getOutVertices()?.get(es.OUTPUT)??[]).forEach(async r=>{await this.allDependenciesResolvedVertex(r,e.getSteps())&&t.add(r)})}async executeVertex(e,t,r,n,s){let a,i=e.getData().getStatement();if(i.getExecuteIftrue().size&&!(Array.from(i.getExecuteIftrue().entries())??[]).filter(e=>e[1]).map(([e])=>new nA(e).evaluate(t.getValuesMap())).every(e=>!_(e)&&!1!==e))return;let o=await s.find(i.getNamespace(),i.getName());if(!o)throw new eE(ec.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 at?new s8(t.getFunctionRepository(),t.getSchemaRepository(),`${t.getExecutionId()}_${i.getStatementName()}`).setArguments(u).setValuesMap(new Map(Array.from(t.getValuesMap().values()).filter(e=>e.getPrefix()!==sQ.PREFIX&&e.getPrefix()!==sz.PREFIX&&e.getPrefix()!==sJ.PREFIX).map(e=>[e.getPrefix(),e]))):new s8(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 eE(ec.format("Executing $ returned no events",i.getStatementName()));let R=l.getName()==es.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()))),R){let r=e.getOutVertices().get(es.OUTPUT);r&&r.forEach(async e=>{await this.allDependenciesResolvedVertex(e,t.getSteps())&&n.add(e)})}else{let t=e.getSubGraphOfType(l.getName()),n=this.makeEdges(t).getT1();r.push(new eP(t,n,T,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map(e=>new ew(e[0],this.resolveInternalExpression(e[1],t))).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map):e}resolveInternalExpression(e,t){if(_(e)||"object"!=typeof e)return e;if(e instanceof s4)return new nA(e.getExpression()).evaluate(t.getValuesMap());if(Array.isArray(e)){let r=[];for(let n of e)r.push(this.resolveInternalExpression(n,t));return r}if("object"==typeof e){let r={};for(let n of Object.entries(e))r[n[0]]=this.resolveInternalExpression(n[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(),n=e.getT2();return!(t.has(r)&&t.get(r)?.has(n))}).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map(t=>{let n,s=Array.from(t[1]?.values()??[]);if(!s?.length)return new ew(t[0],n);let a=r.get(t[0]);return a?(n=a.isVariableArgument()?s.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)).filter(e=>!_(e)).map(t=>this.parameterReferenceEvaluation(e,t)).flatMap(e=>Array.isArray(e)?e:[e]):this.parameterReferenceEvaluation(e,s[0]),new ew(t[0],n)):new ew(t[0],void 0)}).filter(e=>!_(e.getT2())).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map)}parameterReferenceEvaluation(e,t){let r;return t.getType()==A.VALUE?r=this.resolveInternalExpression(t.getValue(),e):t.getType()!=A.EXPRESSION||eM.isNullOrBlank(t.getExpression())||(r=new nA(t.getExpression()??"").evaluate(e.getValuesMap())),r}async prepareStatementExecution(e,t,r){let n=new sW(e),s=await t.find(e.getNamespace(),e.getName());if(!s)return n.addMessage(T.ERROR,ec.format("$.$ is not available",e.getNamespace(),e.getName())),Promise.resolve(n);let a=new Map(s.getSignature().getParameters());if(!e.getParameterMap())return Promise.resolve(n);for(let t of Array.from(e.getParameterMap().entries())){let e=a.get(t[0]);if(!e)continue;let s=Array.from(t[1]?.values()??[]);if(!s.length&&!e.isVariableArgument()){await ex.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,e.getParameterName())),a.delete(e.getParameterName());continue}if(e.isVariableArgument())for(let t of(s.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)),s))this.parameterReferenceValidation(n,e,t,r);else if(s.length){let t=s[0];this.parameterReferenceValidation(n,e,t,r)}a.delete(e.getParameterName())}if(!_(n.getStatement().getDependentStatements()))for(let e of Array.from(n.getStatement().getDependentStatements().entries()))e[1]&&n.addDependency(e[0]);if(!_(n.getStatement().getExecuteIftrue()))for(let e of Array.from(n.getStatement().getExecuteIftrue().entries()))e[1]&&this.addDependencies(n,e[0]);if(a.size)for(let e of Array.from(a.values()))e.isVariableArgument()||await ex.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return Promise.resolve(n)}async parameterReferenceValidation(e,t,r,n){if(r){if(r.getType()==A.VALUE){if(_(r.getValue())&&!await ex.hasDefaultValueOrNullSchemaType(t.getSchema(),n)&&e.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,t.getParameterName())),_(r.getValue()))return;let s=new ep;for(s.push(new ew(t.getSchema(),r.getValue()));!s.isEmpty();){let t=s.pop();if(t.getT2() instanceof s4)this.addDependencies(e,t.getT2().getExpression());else{if(_(t.getT1())||_(t.getT1().getType()))continue;if(t.getT1().getType()?.contains(i.ARRAY)&&Array.isArray(t.getT2())){let e=t.getT1().getItems();if(!e)continue;if(e.isSingleType())for(let r of t.getT2())s.push(new ew(e.getSingleSchema(),r));else{let r=t.getT2();for(let t=0;t<r.length;t++)s.push(new ew(e.getTupleSchema()[t],r[t]))}}else if(t.getT1().getType()?.contains(i.OBJECT)&&"object"==typeof t.getT2()){let r=t.getT1();if(r.getName()===X.EXPRESSION.getName()&&r.getNamespace()===X.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])&&s.push(new ew(r.getProperties().get(e[0]),e[1]))}}}}else if(r.getType()==A.EXPRESSION){if(eM.isNullOrBlank(r.getExpression()))_(ex.getDefaultValue(t.getSchema(),n))&&e.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,t.getParameterName()));else try{this.addDependencies(e,r.getExpression())}catch(t){e.addMessage(T.ERROR,ec.format("Error evaluating $ : $",r.getExpression(),t))}}}else _(await ex.getDefaultValue(t.getSchema(),n))&&e.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(at.STEP_REGEX_PATTERN)??[]).forEach(t=>e.addDependency(t))}makeEdges(e){let t=e.getNodeMap().values(),r=[],n=new Map;for(let s of Array.from(t))for(let t of Array.from(s.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)?s.addInEdgeTo(e.getNodeMap().get(i),E):(r.push(new ew(i,E)),n.set(s.getData().getStatement().getStatementName(),ec.format("Unable to find the step with name $",i)))}return new ew(r,n)}}var ar={};m(ar,"KIRunConstants",()=>an);class an{static{this.NAMESPACE="namespace"}static{this.NAME="name"}static{this.ID="id"}constructor(){}}var as={};m(as,"Position",()=>aa);class aa{static{this.SCHEMA_NAME="Position"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(aa.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["left",Y.ofFloat("left")],["top",Y.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 aa(e.left,e.top)}}var ai={};m(ai,"FunctionDefinition",()=>ah);var ao={};m(ao,"Statement",()=>al);var aE={};m(aE,"AbstractStatement",()=>au);class au{constructor(e){if(this.override=!1,!e)return;this.comment=e.comment,this.description=e.description,this.position=e.position?new aa(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 aA={};m(aA,"ParameterReference",()=>aT);class aT{static{this.SCHEMA_NAME="ParameterReference"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(aT.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["key",Y.ofString("key")],["value",Y.ofAny("value")],["expression",Y.ofString("expression")],["type",Y.ofString("type").setEnums(["EXPRESSION","VALUE"])],["order",Y.ofInteger("order")]]))}constructor(e){e instanceof aT?(this.key=e.key,this.type=e.type,this.value=_(e.value)?void 0:JSON.parse(JSON.stringify(e.value)),this.expression=e.expression,this.order=e.order):(this.type=e,this.key=s7())}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 aT(A.EXPRESSION).setExpression(e);return[t.getKey(),t]}static ofValue(e){let t=new aT(A.VALUE).setValue(e);return[t.getKey(),t]}static from(e){return new aT(e.type).setValue(e.value).setExpression(e.expression).setKey(e.key).setOrder(e.order)}}class al extends au{static{this.SCHEMA_NAME="Statement"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(al.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["statementName",Y.ofString("statementName")],["comment",Y.ofString("comment")],["description",Y.ofString("description")],["namespace",Y.ofString("namespace")],["name",Y.ofString("name")],["dependentStatements",Y.ofObject("dependentstatement").setAdditionalProperties(new B().setSchemaValue(Y.ofBoolean("exists"))).setDefaultValue({})],["executeIftrue",Y.ofObject("executeIftrue").setAdditionalProperties(new B().setSchemaValue(Y.ofBoolean("exists"))).setDefaultValue({})],["parameterMap",new Y().setName("parameterMap").setAdditionalProperties(new B().setSchemaValue(Y.ofObject("parameterReference").setAdditionalProperties(new B().setSchemaValue(aT.SCHEMA))))],["position",aa.SCHEMA]]))}constructor(e,t,r){if(super(e instanceof al?e:void 0),e instanceof al)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 aT(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 al&&e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}static from(e){return new al(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])=>aT.from(t)).map(e=>[e.getKey(),e]))]))).setDependentStatements(new Map(Object.entries(e.dependentStatements??{}))).setExecuteIftrue(new Map(Object.entries(e.executeIftrue??{}))).setPosition(aa.from(e.position)).setComment(e.comment).setDescription(e.description)}}var aR={};m(aR,"StatementGroup",()=>am);class am extends au{static{this.SCHEMA_NAME="StatementGroup"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(am.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["statementGroupName",Y.ofString("statementGroupName")],["comment",Y.ofString("comment")],["description",Y.ofString("description")],["position",aa.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 am(e.statementGroupName,new Map(Object.entries(e.statements||{}).map(([e,t])=>[e,(""+t)?.toLowerCase()=="true"]))).setPosition(aa.from(e.position)).setComment(e.comment).setDescription(e.description)}}const ag=new Y().setNamespace(p.SYSTEM).setName("FunctionDefinition").setProperties(new Map([["name",Y.ofString("name")],["namespace",Y.ofString("namespace")],["parameters",Y.ofArray("parameters",X.SCHEMA)],["events",Y.ofObject("events").setAdditionalProperties(new B().setSchemaValue(es.SCHEMA))],["steps",Y.ofObject("steps").setAdditionalProperties(new B().setSchemaValue(al.SCHEMA))]]));ag.getProperties()?.set("parts",Y.ofArray("parts",ag));class ah extends eT{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 ah(e.name).setSteps(new Map(Object.values(e.steps??{}).filter(e=>!!e).map(e=>[e.statementName,al.from(e)]))).setStepGroups(new Map(Object.values(e.stepGroups??{}).filter(e=>!!e).map(e=>[e.statementGroupName,am.from(e)]))).setParts(Array.from(e.parts??[]).filter(e=>!!e).map(e=>ah.from(e))).setVersion(e.version??1).setEvents(new Map(Object.values(e.events??{}).filter(e=>!!e).map(e=>[e.name,es.from(e)]))).setParameters(new Map(Object.values(e.parameters??{}).filter(e=>!!e).map(e=>[e.parameterName,X.from(e)]))).setNamespace(e.namespace):new ah("unknown")}}var ac={};m(ac,"Argument",()=>ap);class ap{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 ap(0,e,t)}}var aN={};R(aN,r2),R(aN,r5),R(aN,r7),R(aN,ne),R(aN,r9);var af={};R(af,rl),R(af,rm),R(af,rh),R(af,rp),R(af,rf),R(af,rM),R(af,rO),R(af,ru),R(af,rI),R(af,rd),R(af,rx),R(af,rv),R(af,rV),R(af,rD),R(af,rb),R(af,rB),R(af,rH),R(af,r$),R(af,rW),R(af,rz),R(af,rJ),R(af,rQ),R(af,r0),R(af,rE),R(module.exports,g),R(module.exports,ee),R(module.exports,{}),R(module.exports,te),R(module.exports,J),R(module.exports,f),R(module.exports,eg),R(module.exports,tL),R(module.exports,eh),R(module.exports,e_),R(module.exports,eO),R(module.exports,ta),R(module.exports,em),R(module.exports,tE),R(module.exports,sk),R(module.exports,s$),R(module.exports,t8),R(module.exports,sX),R(module.exports,sq),R(module.exports,sK),R(module.exports,sZ),R(module.exports,{}),R(module.exports,s0),R(module.exports,s9),R(module.exports,ae),R(module.exports,s6),R(module.exports,tx),R(module.exports,tH),R(module.exports,nr),R(module.exports,ty),R(module.exports,ro),R(module.exports,tF),R(module.exports,tC),R(module.exports,tU),R(module.exports,tG),R(module.exports,{}),R(module.exports,el),R(module.exports,c),R(module.exports,s3),R(module.exports,h),R(module.exports,eB),R(module.exports,eD),R(module.exports,eb),R(module.exports,eV),R(module.exports,eL),R(module.exports,e$),R(module.exports,eH),R(module.exports,eR),R(module.exports,ed),R(module.exports,k),R(module.exports,eU),R(module.exports,N),R(module.exports,y),R(module.exports,O),R(module.exports,w),R(module.exports,I),R(module.exports,S),R(module.exports,eS),R(module.exports,ej),R(module.exports,sb),R(module.exports,ar),R(module.exports,H),R(module.exports,ei),R(module.exports,as),R(module.exports,ai),R(module.exports,s5),R(module.exports,er),R(module.exports,aE),R(module.exports,ao),R(module.exports,{}),R(module.exports,aR),R(module.exports,eA),R(module.exports,en),R(module.exports,j),R(module.exports,ac),R(module.exports,aA),R(module.exports,tt),R(module.exports,eo),R(module.exports,aN),R(module.exports,af),R(module.exports,na);
2
2
  //# sourceMappingURL=index.js.map