@fincity/kirun-js 2.8.6 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/engine/function/system/GenerateEvent.ts +23 -21
- package/src/engine/function/system/If.ts +2 -3
- package/src/engine/function/system/Print.ts +2 -3
- package/src/engine/function/system/Wait.ts +2 -3
- package/src/engine/function/system/array/ArrayFunctionRepository.ts +7 -9
- package/src/engine/function/system/array/Join.ts +29 -28
- package/src/engine/function/system/context/Create.ts +20 -22
- package/src/engine/function/system/context/Get.ts +19 -19
- package/src/engine/function/system/context/SetFunction.ts +17 -14
- package/src/engine/function/system/date/DateFunctionRepository.ts +6 -8
- package/src/engine/function/system/date/EpochToTimestamp.ts +1 -1
- package/src/engine/function/system/date/IsValidISODate.ts +4 -6
- package/src/engine/function/system/loop/Break.ts +7 -7
- package/src/engine/function/system/loop/CountLoop.ts +13 -14
- package/src/engine/function/system/loop/ForEachLoop.ts +18 -19
- package/src/engine/function/system/loop/RangeLoop.ts +68 -69
- package/src/engine/function/system/math/Add.ts +11 -9
- package/src/engine/function/system/math/GenericMathFunction.ts +13 -13
- package/src/engine/function/system/math/Hypotenuse.ts +2 -2
- package/src/engine/function/system/math/MathFunctionRepository.ts +107 -90
- package/src/engine/function/system/math/Maximum.ts +12 -11
- package/src/engine/function/system/math/Minimum.ts +12 -11
- package/src/engine/function/system/math/Random.ts +2 -2
- package/src/engine/function/system/object/AbstractObjectFunction.ts +1 -2
- package/src/engine/function/system/object/ObjectConvert.ts +26 -26
- package/src/engine/function/system/object/ObjectDeleteKey.ts +1 -2
- package/src/engine/function/system/object/ObjectFunctionRepository.ts +18 -14
- package/src/engine/function/system/string/Concatenate.ts +8 -7
- package/src/engine/function/system/string/Matches.ts +2 -2
- package/src/engine/function/system/string/Reverse.ts +2 -2
- package/src/engine/function/system/string/Split.ts +16 -15
- package/src/engine/function/system/string/StringFunctionRepository.ts +6 -8
- package/src/engine/function/system/string/ToString.ts +9 -8
- package/src/engine/repository/KIRunFunctionRepository.ts +47 -39
- package/src/engine/repository/KIRunSchemaRepository.ts +75 -70
- package/src/engine/util/duplicate.ts +1 -1
- package/tsconfig.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,t,r,s,n,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,s){Object.defineProperty(e,t,{get:r,set:s,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",()=>P);var d={};m(d,"Type",()=>I);class I{}class P extends I{constructor(e){super(),e instanceof P?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 I{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 P(new Set(e))}static from(e){return"string"==typeof e?new x(i[L.fromJSONType(e)]):Array.isArray(e)?new P(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")],["details",Y.ofObject("details")]])).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 s=Y.from(r);s&&t.set(e,s)}),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.details=e.details?new Map(Object.entries(e.details)):void 0,r}constructor(e){if(this.namespace="_",this.version=1,!e)return;this.namespace=e.namespace,this.name=e.name,this.version=e.version,this.ref=e.ref,_(e.type)||(this.type=e.type instanceof x?new x(e.type):new P(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,this.details=e.details?new Map(JSON.parse(JSON.stringify(Array.from(e.details.values())))):void 0}getTitle(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}getFullName(){return this.namespace+"."+this.name}get$defs(){return this.$defs}set$defs(e){return this.$defs=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getVersion(){return this.version}setVersion(e){return this.version=e,this}getRef(){return this.ref}setRef(e){return this.ref=e,this}getType(){return this.type}setType(e){return this.type=e,this}getAnyOf(){return this.anyOf}setAnyOf(e){return this.anyOf=e,this}getAllOf(){return this.allOf}setAllOf(e){return this.allOf=e,this}getOneOf(){return this.oneOf}setOneOf(e){return this.oneOf=e,this}getNot(){return this.not}setNot(e){return this.not=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getExamples(){return this.examples}setExamples(e){return this.examples=e,this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}getComment(){return this.comment}setComment(e){return this.comment=e,this}getEnums(){return this.enums}setEnums(e){return this.enums=e,this}getConstant(){return this.constant}setConstant(e){return this.constant=e,this}getPattern(){return this.pattern}setPattern(e){return this.pattern=e,this}getFormat(){return this.format}setFormat(e){return this.format=e,this}getMinLength(){return this.minLength}setMinLength(e){return this.minLength=e,this}getMaxLength(){return this.maxLength}setMaxLength(e){return this.maxLength=e,this}getMultipleOf(){return this.multipleOf}setMultipleOf(e){return this.multipleOf=e,this}getMinimum(){return this.minimum}setMinimum(e){return this.minimum=e,this}getMaximum(){return this.maximum}setMaximum(e){return this.maximum=e,this}getExclusiveMinimum(){return this.exclusiveMinimum}setExclusiveMinimum(e){return this.exclusiveMinimum=e,this}getExclusiveMaximum(){return this.exclusiveMaximum}setExclusiveMaximum(e){return this.exclusiveMaximum=e,this}getProperties(){return this.properties}setProperties(e){return this.properties=e,this}getAdditionalProperties(){return this.additionalProperties}setAdditionalProperties(e){return this.additionalProperties=e,this}getAdditionalItems(){return this.additionalItems}setAdditionalItems(e){return this.additionalItems=e,this}getRequired(){return this.required}setRequired(e){return this.required=e,this}getPropertyNames(){return this.propertyNames}setPropertyNames(e){return this.propertyNames=e,this.propertyNames.type=new 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}getDetails(){return this.details}setDetails(e){return this.details=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,s=o.EXPRESSION){return[e,new X(e,t).setType(s).setVariableArgument(r)]}static of(e,t,r=!1,s=o.EXPRESSION){return new X(e,t).setType(s).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,s,n,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)||_(s)||f.set(r,s),_(n)||_(a)||f.set(n,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,s]of e)t.set(r,s);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.ofNumber("years")],["quarters",Y.ofNumber("quarters")],["months",Y.ofNumber("months")],["weeks",Y.ofNumber("weeks")],["days",Y.ofNumber("days")],["hours",Y.ofNumber("hours")],["minutes",Y.ofNumber("minutes")],["seconds",Y.ofNumber("seconds")],["milliseconds",Y.ofNumber("milliseconds")])).setAdditionalItems(B.from(!1))],["TimeObject",Y.ofObject("TimeObject").setNamespace(p.DATE).setProperties(q.ofArrayEntries(["year",Y.ofNumber("year")],["month",Y.ofNumber("month")],["day",Y.ofNumber("day")],["hour",Y.ofNumber("hour")],["minute",Y.ofNumber("minute")],["second",Y.ofNumber("second")],["millisecond",Y.ofNumber("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",()=>nH);var er={};m(er,"EventResult",()=>ea);var es={};m(es,"Event",()=>en);class en{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(en.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 en)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 en.eventMapEntry(en.OUTPUT,e)}static eventMapEntry(e,t){return[e,new en(e,t)]}static from(e){return new en(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(en.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(en.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 en(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="",s=0,n="",a=n,i=e.length;for(let o=0;o<i;o++)"$"==(n=e.charAt(o))&&"\\"==a?r=r.substring(0,o-1)+n:"$"==n&&s<t.length?r+=t[s++]:r+=n,a=n;return r.toString()}constructor(){}}class 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,s=this.head,n=0;for(;s;)r.add(e(s.value,n)),s=s.next,++n;return r}indexOf(e){let t=this.head,r=0;for(;t;){if(ef(t.value,e))return r;t=t.next,++r}return -1}forEach(e,t){let r=this.head,s=0;for(;r;)e(r.value,s),r=r.next,++s}}class 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 s=new ep;for(s.push(t);!r.isEmpty()&&!s.isEmpty();){let e=r.pop(),t=s.pop();if(e===t)continue;let n=typeof e,a=typeof t;if("undefined"===n||"undefined"===a){if(!e&&!t)continue;return!1}if(n!==a)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!=t.length)return!1;for(let n=0;n<e.length;n++)r.push(e[n]),s.push(t[n]);continue}if("object"===n){if("object"!==a||null===e||null===t)return!1;let n=Object.entries(e),i=Object.entries(t);if(n.length!==i.length)return!1;for(let[e,a]of n)r.push(a),s.push(t[e]);continue}return!1}return!0}var e_={};m(e_,"StringUtil",()=>eM);class eM{constructor(){}static nthIndex(e,t,r=0,s){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(s<=0||s>e.length)throw new eE(ec.format("Cannot search for occurance : $",s));for(;r<e.length;){if(e.charAt(r)==t&&0==--s)return r;++r}return -1}static splitAtFirstOccurance(e,t){if(!e)return[void 0,void 0];let r=e.indexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static splitAtLastOccurance(e,t){if(!e)return[void 0,void 0];let r=e.lastIndexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static isNullOrBlank(e){return!e||""==e.trim()}}var eS={};m(eS,"SchemaUtil",()=>ex);var eO={};m(eO,"Tuple2",()=>ew),m(eO,"Tuple3",()=>ed),m(eO,"Tuple4",()=>eI);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 ed 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 eI extends ed{constructor(e,t,r,s){super(e,t,r),this.fr=s}getT4(){return this.fr}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}setT3(e){return this.t=e,this}setT4(e){return this.fr=e,this}}var eP={};m(eP,"SchemaValidationException",()=>ey);class ey extends Error{constructor(e,t,r=[],s){super(t+(r?r.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.cause=s}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class 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,s=0){if(++s==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 n=await ex.resolveExternalSchema(e,t,r);n&&(e=n.getT1(),r=n.getT2())}let a=r.split("/");return 1===a.length?Promise.resolve(e):Promise.resolve(ex.resolveInternalSchema(e,t,r,s,a,1))}static async resolveInternalSchema(e,t,r,s,n,a){let o=e;if(a!==n.length){for(;a<n.length;){if("$defs"===n[a]){if(++a>=n.length||!o.get$defs())throw new $(r,ex.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);o=o.get$defs()?.get(n[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(n[a])}if(a++,!o||!eM.isNullOrBlank(o.getRef())&&!(o=await ex.getSchemaFromRef(o,t,o.getRef(),s)))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 s=eM.splitAtFirstOccurance(r??"","/");if(!s[0])return Promise.resolve(void 0);let n=eM.splitAtLastOccurance(s[0],".");if(!n[0]||!n[1])return Promise.resolve(void 0);let a=await t.find(n[0],n[1]);if(!a)return Promise.resolve(void 0);if(!s[1]||""===s[1])return Promise.resolve(new ew(a,r));if(r="#/"+s[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,s,n,a){let i=[];return t.getOneOf()&&!t.getOneOf()?await ev.oneOf(e,t,r,s,i,n,a):t.getAllOf()&&!t.getAllOf()?await ev.allOf(e,t,r,s,i,n,a):t.getAnyOf()&&!t.getAnyOf()?await ev.anyOf(e,t,r,s,i,n,a):s}static async anyOf(e,t,r,s,n,a,i){let o=!1;for(let E of t.getAnyOf()??[])try{await ev.validate(e,E,r,s,a,i),o=!0;break}catch(e){o=!1,n.push(e)}if(o)return s;throw new ey(e9.path(e),"The value don't satisfy any of the schemas.",n)}static async allOf(e,t,r,s,n,a,i){let o=0;for(let E of t.getAllOf()??[])try{await ev.validate(e,E,r,s,a,i),o++}catch(e){n.push(e)}if(o===t.getAllOf()?.length)return s;throw new ey(e9.path(e),"The value doesn't satisfy some of the schemas.",n)}static async oneOf(e,t,r,s,n,a,i){let o=0;for(let E of t.getOneOf()??[])try{await ev.validate(e,E,r,s,a,i),o++}catch(e){n.push(e)}if(1===o)return s;throw new ey(e9.path(e),0==o?"The value does not satisfy any schema":"The value satisfy more than one schema",n)}constructor(){}}var eU={};m(eU,"TypeValidator",()=>e2);var eV={};m(eV,"ArrayValidator",()=>eC);class eC{static async validate(e,t,r,s,n,a){if(_(s))throw new ey(e9.path(e),"Expected an array but found null");if(!Array.isArray(s))throw new ey(e9.path(e),s.toString()+" is not an Array");return eC.checkMinMaxItems(e,t,s),await eC.checkItems(e,t,r,s,n,a),eC.checkUniqueItems(e,t,s),await eC.checkContains(t,e,r,s),s}static async checkContains(e,t,r,s){if(_(e.getContains()))return;let n=await eC.countContains(t,e,r,s,_(e.getMinContains())&&_(e.getMaxContains()));if(0===n)throw new ey(e9.path(t),"None of the items are of type contains schema");if(!_(e.getMinContains())&&e.getMinContains()>n)throw new ey(e9.path(t),"The minimum number of the items of type contains schema should be "+e.getMinContains()+" but found "+n);if(!_(e.getMaxContains())&&e.getMaxContains()<n)throw new ey(e9.path(t),"The maximum number of the items of type contains schema should be "+e.getMaxContains()+" but found "+n)}static async countContains(e,t,r,s,n){let a=0;for(let i=0;i<s.length;i++){let o=e?[...e]:[];try{if(await e9.validate(o,t.getContains(),r,s[i]),a++,n)break}catch(e){}}return a}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()&&new Set(r).size!==r.length)throw new 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,s,n,a){if(!t.getItems())return;let i=t.getItems();if(i.getSingleSchema())for(let t=0;t<s.length;t++){let o=e?[...e]:[];s[t]=await e9.validate(o,i.getSingleSchema(),r,s[t],n,a)}if(i.getTupleSchema()){if(i.getTupleSchema().length!==s.length&&_(t?.getAdditionalItems()))throw new ey(e9.path(e),"Expected an array with only "+i.getTupleSchema().length+" but found "+s.length);await this.checkItemsInTupleSchema(e,r,s,i),await this.checkAdditionalItems(e,t,r,s,i)}}static async checkItemsInTupleSchema(e,t,r,s,n,a){for(let i=0;i<s.getTupleSchema()?.length;i++){let o=e?[...e]:[];r[i]=await e9.validate(o,s.getTupleSchema()[i],t,r[i],n,a)}}static async checkAdditionalItems(e,t,r,s,n){if(!_(t.getAdditionalItems())){let a=t.getAdditionalItems();if(a?.getBooleanValue()){let i=Y.ofAny("item");if(a?.getBooleanValue()===!1&&s.length>n.getTupleSchema()?.length)throw new ey(e9.path(e),"No Additional Items are defined");await this.checkEachItemInAdditionalItems(e,t,r,s,n,i)}else if(a?.getSchemaValue()){let i=a.getSchemaValue();await this.checkEachItemInAdditionalItems(e,t,r,s,n,i)}}}static async checkEachItemInAdditionalItems(e,t,r,s,n,a){for(let t=n.getTupleSchema()?.length;t<s.length;t++){let n=e?[...e]:[];s[t]=await e9.validate(n,a,r,s[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,s){if(_(s))throw new ey(e9.path(t),"Expected a number but found null");if("number"!=typeof s)throw new ey(e9.path(t),s.toString()+" is not a "+e);let n=eY.extractNumber(e,t,r,s);return eY.checkRange(t,r,s,n),eY.checkMultipleOf(t,r,s,n),s}static extractNumber(e,t,r,s){let n=s;try{(e==i.LONG||e==i.INTEGER)&&(n=Math.round(n))}catch(r){throw new ey(e9.path(t),s+" is not a number of type "+e,r)}if(_(n)||(e==i.LONG||e==i.INTEGER)&&n!=s)throw new ey(e9.path(t),s.toString()+" is not a number of type "+e);return n}static checkMultipleOf(e,t,r,s){if(t.getMultipleOf()&&s%t.getMultipleOf()!=0)throw new ey(e9.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}static checkRange(e,t,r,s){if(!_(t.getMinimum())&&0>eY.numberCompare(s,t.getMinimum()))throw new ey(e9.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(!_(t.getMaximum())&&eY.numberCompare(s,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(s,t.getExclusiveMinimum()))throw new ey(e9.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(!_(t.getExclusiveMaximum())&&eY.numberCompare(s,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,s,n,a){if(_(s))throw new ey(e9.path(e),"Expected an object but found null");if("object"!=typeof s||Array.isArray(s))throw new ey(e9.path(e),s.toString()+" is not an Object");let i=new Set(Object.keys(s));return ek.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&await ek.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&ek.checkRequired(e,t,s),t.getProperties()&&await ek.checkProperties(e,t,r,s,i,n,a),t.getPatternProperties()&&await ek.checkPatternProperties(e,t,r,s,i),t.getAdditionalProperties()&&await ek.checkAdditionalProperties(e,t,r,s,i),s}static async checkPropertyNameSchema(e,t,r,s){for(let n of Array.from(s.values()))try{await e9.validate(e,t.getPropertyNames(),r,n)}catch(t){throw new ey(e9.path(e),"Property name '"+n+"' does not fit the property schema")}}static checkRequired(e,t,r){for(let s of t.getRequired()??[])if(_(r[s]))throw new ey(e9.path(e),s+" is mandatory")}static async checkAdditionalProperties(e,t,r,s,n){let a=t.getAdditionalProperties();if(a.getSchemaValue())for(let t of Array.from(n.values())){let n=e?[...e]:[];s[t]=await e9.validate(n,a.getSchemaValue(),r,s[t])}else if(!1===a.getBooleanValue()&&n.size)throw new ey(e9.path(e),Array.from(n)+" is/are additional properties which are not allowed.")}static async checkPatternProperties(e,t,r,s,n){let a=new Map;for(let e of Array.from(t.getPatternProperties().keys()))a.set(e,new RegExp(e));for(let i of Array.from(n.values())){let o=e?[...e]:[];for(let e of Array.from(a.entries()))if(e[1].test(i)){s[i]=await e9.validate(o,t.getPatternProperties().get(e[0]),r,s[i]),n.delete(i);break}}}static async checkProperties(e,t,r,s,n,a,i){for(let o of Array.from(t.getProperties())){let t=s[o[0]];if(!s.hasOwnProperty(o[0])&&_(t)&&_(await ex.getDefaultValue(o[1],r)))continue;let E=e?[...e]:[];s[o[0]]=await e9.validate(E,o[1],r,t,a,i),n.delete(o[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new 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 s=r.length;if(t.getMinLength()&&s<t.getMinLength())throw new ey(e9.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&s>t.getMaxLength())throw new ey(e9.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,s,n){if(!s.test(r))throw new ey(e9.path(e),r.toString()+" is not matched with the "+n)}constructor(){}}(s=u||(u={})).STRICT="STRICT",s.LENIENT="LENIENT",s.USE_DEFAULT="USE_DEFAULT",s.SKIP="SKIP";const eX=e=>u[e.toUpperCase()],eJ=()=>Object.values(u);class eq extends Error{constructor(e,t,r,s,n=[],a){super(r+(n?n.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.source=t??null,this.mode=s??null,this.cause=a}getSchemaPath(){return this.schemaPath}getSource(){return this.source??null}getMode(){return this.mode??null}getCause(){return this.cause}}class ez{static handleUnConvertibleValue(e,t,r,s){return this.handleUnConvertibleValueWithDefault(e,t,r,null,s)}static handleUnConvertibleValueWithDefault(e,t,r,s,n){switch(null===t&&(t=u.STRICT),t){case u.STRICT:throw new eq(e9.path(e),r,n,t);case u.LENIENT:return null;case u.USE_DEFAULT:return s;case u.SKIP:return r;default:throw new eq(e9.path(e),r,"Invalid conversion mode")}}constructor(){}}class eK{static convert(e,t,r,s){if(_(s))return ez.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Expected a string but found null");let n=s??("object"==typeof s?JSON.stringify(s):String(s));return this.getConvertedString(n,r)}static getConvertedString(e,t){return t===u.STRICT?e.toString():e.trim()}static getDefault(e){return e.getDefaultValue()??null}constructor(){}}class eQ{static convert(e,t,r,s,n){if(_(n))return ez.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),"Expected a number but found null");if("object"==typeof n||"boolean"==typeof n||Array.isArray(n)||"string"==typeof n&&isNaN(n=Number(n)))return ez.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),n+" is not a "+t);let a=this.extractNumber(t,n,s);return null===a?ez.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),n+" is not a "+t):a}static extractNumber(e,t,r){if("number"!=typeof t)return null;switch(e){case 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,s){return null==s?ez.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Expected a boolean but found null"):this.getBooleanPrimitive(s)??ez.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Unable to convert to boolean")}static getBooleanPrimitive(e){return"boolean"==typeof e?e:"string"==typeof e?this.handleStringValue(e):"number"==typeof e?this.handleNumberValue(e):null}static handleStringValue(e){let t=e.toLowerCase().trim();return 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,s){return _(s)?s:"string"==typeof s&&"null"===s.toLowerCase()?null:ez.handleUnConvertibleValueWithDefault(e,r,s,null,"Unable to convert to null")}constructor(){}}class e1{static handleValidationError(e,t,r,s,n){switch(t=t??u.STRICT){case u.STRICT:throw new ey(e9.path(e),n);case u.LENIENT:return null;case u.USE_DEFAULT:return s;case u.SKIP:return r}}constructor(){}}class e2{static async validate(e,t,r,s,n,a,o){return t==i.OBJECT?await ek.validate(e,r,s,n,a,o):t==i.ARRAY?await eC.validate(e,r,s,n,a,o):this.handleTypeValidationAndConversion(e,t,r,n,a,o)}static async handleTypeValidationAndConversion(e,t,r,s,n,a){let i=n?this.convertElement(e,t,r,s,a??u.STRICT):s;return await this.validateElement(e,t,r,i,a??u.STRICT)}static convertElement(e,t,r,s,n){if(_(t))return ez.handleUnConvertibleValueWithDefault(e,n,s,r.getDefaultValue()??null,ec.format("$ is not a valid type for conversion.",t));switch(t){case i.STRING:return eK.convert(e,r,n,s);case i.INTEGER:case i.LONG:case i.DOUBLE:case i.FLOAT:return eQ.convert(e,t,r,n,s);case i.BOOLEAN:return eZ.convert(e,r,n,s);case i.NULL:return e0.convert(e,r,n,s);default:return ez.handleUnConvertibleValueWithDefault(e,n,s,r.getDefaultValue()??null,ec.format("$ is not a valid type for conversion.",t))}}static validateElement(e,t,r,s,n){if(_(t))return e1.handleValidationError(e,n,s,r.getDefaultValue()??null,ec.format("$ is not a valid type.",t));switch(t){case i.STRING:return eW.validate(e,r,s);case i.INTEGER:case i.LONG:case i.DOUBLE:case i.FLOAT:return eY.validate(t,e,r,s);case i.BOOLEAN:return eG.validate(e,r,s);case i.NULL:return eF.validate(e,r,s);default:return e1.handleValidationError(e,n,s,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,s,n,a){if(!t)throw new ey(e9.path(e),"No schema found to validate");if(e||(e=[]),e.push(t),_(s)&&!_(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(!_(t.getConstant()))return e9.constantValidation(e,t,s);if(t.getEnums()?.length)return e9.enumCheck(e,t,s);if(t.getFormat()&&_(t.getType()))throw new ey(this.path(e),"Type is missing in schema for declared "+t.getFormat()?.toString()+" format.");if(!0===n&&_(t.getType()))throw new ey(this.path(e),"Type is missing in schema for declared "+a);if(t.getType()&&(s=await e9.typeValidation(e,t,r,s,n,a)),!eM.isNullOrBlank(t.getRef()))return await e9.validate(e,await ex.getSchemaFromRef(e[0],r,t.getRef()),r,s,n,a);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&(s=await ev.validate(e,t,r,s,n,a)),t.getNot()){let i;try{await e9.validate(e,t.getNot(),r,s,n,a),i=!0}catch(e){i=!1}if(i)throw new ey(e9.path(e),"Schema validated value in not condition.")}return s}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 s=!1;for(let e of t.getEnums()??[])if(e===r){s=!0;break}if(s)return r;throw new ey(e9.path(e),"Value is not one of "+t.getEnums())}static async typeValidation(e,t,r,s,n,a){let i=Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]).sort((e,t)=>(this.ORDER[e]??1/0)-(this.ORDER[t]??1/0)),o=[];for(let E of i)try{return await e2.validate(e,E,t,r,s,n,a)}catch(e){o.push(e)}throw new ey(e9.path(e),"Value "+JSON.stringify(s)+" is not of valid type(s)",o)}constructor(){}}class e3{async validateArguments(e,t,r){let s=new Map;for(let n of Array.from(this.getSignature().getParameters().entries())){let a=n[1];try{let r=await this.validateArgument(e,t,n,a);s.set(r.getT1(),r.getT2())}catch(t){let e=this.getSignature();throw new 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 s}async validateArgument(e,t,r,s){let n,a=r[0],i=e.get(r[0]);if(_(i)&&!s.isVariableArgument())return new ew(a,await e9.validate(void 0,s.getSchema(),t,void 0));if(!s?.isVariableArgument())return new ew(a,await e9.validate(void 0,s.getSchema(),t,i));Array.isArray(i)?n=i:(n=[],_(i)?_(s.getSchema().getDefaultValue())||n.push(s.getSchema().getDefaultValue()):n.push(i));for(let e=0;e<n.length;e++)n[e]=await e9.validate(void 0,s.getSchema(),t,n[e]);return new ew(a,n)}async execute(e){let t=await this.validateArguments(e.getArguments()??new Map,e.getSchemaRepository(),e.getStatementExecution());e.setArguments(t);try{return await this.internalExecute(e)}catch(r){let t=this.getSignature();throw new 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 en(en.OUTPUT,q.of(e4.EVENT_INDEX_NAME,Y.ofInteger(e4.EVENT_INDEX_NAME)))}static{this.EVENT_RESULT_INTEGER=new en(en.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofInteger(e4.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_BOOLEAN=new en(en.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofBoolean(e4.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_ARRAY=new en(en.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 en(en.OUTPUT,q.of())}static{this.EVENT_RESULT_ANY=new en(en.OUTPUT,q.of(this.EVENT_RESULT_NAME,Y.ofAny(this.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_OBJECT=new en(en.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 s=new Map;for(let e of t)s.set(e.getParameterName(),e);this.signature=new eT(e).setNamespace(p.SYSTEM_ARRAY).setParameters(s).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 s=t.length-1;for(;s>0;){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]]))])}}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 s=t.map(e=>{let t={};if(Array.isArray(e)){if(r.length)r.forEach((r,s)=>{t[r]=e[s]});else for(let r=0;r<e.length;r++)t[`value${r+1}`]=e[r]}else t[r.length?r[0]:"value"]=e;return t});return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,s]]))])}}var te={};m(te,"PrimitiveUtil",()=>ts);var tt={};m(tt,"ExecutionException",()=>tr);class tr extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class ts{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):ts.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):ts.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 s=this.compare(e[r],t[r]);if(0!=s)return s}return 0}return Array.isArray(e)?-1:1}let r=typeof e,s=typeof t;return"object"===r||"object"===s?("object"===r&&"object"===s&&Object.keys(e).forEach(r=>{let s=this.compare(e[r],t[r]);if(0!=s)return s}),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return _(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 tn extends e4{constructor(){super("BinarySearch",[tn.PARAMETER_ARRAY_SOURCE_PRIMITIVE,tn.PARAMETER_INT_SOURCE_FROM,tn.PARAMETER_FIND_PRIMITIVE,tn.PARAMETER_INT_LENGTH],tn.EVENT_INDEX)}async internalExecute(e){let t=e?.getArguments()?.get(tn.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tn.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tn.PARAMETER_FIND_PRIMITIVE.getParameterName()),n=e?.getArguments()?.get(tn.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length||r<0||r>t.length)throw new eE("Search source array cannot be empty");if(-1==n&&(n=t.length-r),(n=r+n)>t.length)throw new eE("End point for array cannot be more than the size of the source array");let a=-1;for(;r<=n;){let e=Math.floor((r+n)/2);if(0==ts.compare(t[e],s)){a=e;break}ts.compare(t[e],s)>0?n=e-1:r=e+1}return new eu([ea.outputOf(new Map([[tn.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()),s=e?.getArguments()?.get(to.PARAMETER_ARRAY_FIND.getParameterName()),n=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==s.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(n+a>s.length)throw new eE(ec.format("Find array size $ is less than comparing size $",s.length,n+a));return new eu(ti.of(ea.outputOf(q.of(to.EVENT_RESULT_NAME,this.compare(t,r,r+a,s,n,n+a)))))}compare(e,t,r,s,n,a){if(r<t){let e=t;t=r,r=e}if(a<n){let e=n;n=a,a=e}if(r-t!=a-n)throw new eE(ec.format("Cannot compare uneven arrays from $ to $ in source array with $ to $ in find array",r,t,a,n));for(let a=t,i=n;a<r;a++,i++){let t=1;if(_(e[a])||_(s[i])){let r=_(e[a]);r==_(s[i])?t=0:r&&(t=-1)}else{let r=typeof e[a],n=typeof s[i];if("object"===r||"object"===n)t=1;else if("string"===r||"string"===n){let r=""+e[a],n=""+s[i];r===n?t=0:r<n&&(t=-1)}else"boolean"===r||"boolean"===n?t=r==n?0:1:"number"===r&&"number"===n&&(t=e[a]-s[i])}if(0!=t)return t}return 0}}var 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()),s=e?.getArguments()?.get(tA.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),r+s>t.length)throw new eE(ec.format("Array has no elements from $ to $ as the array size is $",r,r+s,t.length));var n=e?.getArguments()?.get(tA.PARAMETER_BOOLEAN_DEEP_COPY.getParameterName());let a=Array(s);for(let e=r;e<r+s;e++)_(t[e])||(a[e-r]=n?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 s=new Set;for(let e=t.length-1;e>=0;e--)for(let n=0;n<r.length;n++)s.has(e)||0!=ts.compare(t[e],r[n])||s.add(t[e]);return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t.filter(e=>!s.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()),s=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==s&&(s=t.length-r),r+s>t.length)throw new eE("Requested length to be deleted is more than the size of array ");return t.splice(r,s),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()),s=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=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<=s.length?t.length-r:s.length-n),a>t.length||a>s.length||r+a>t.length||n+a>s.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(s[e+n]);let E=new Set;return i.forEach(e=>{o.has(e)?o.delete(e):E.add(e)}),o.forEach(e=>{i.has(e)||E.add(e)}),new 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()),s=e?.getArguments()?.get(tc.PARAMETER_INT_LENGTH.getParameterName()),n=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==s&&(s=t.length-r);let a=r+s-t.length;if(t=[...t],a>0)for(let e=0;e<a;e++)t.push();for(let e=r;e<r+s;e++)t[e]=_(n)?n:tu(n);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()),s=e?.getArguments()?.get(tp.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=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(s>t.length)throw new eE("Given start point is more than the size of source");let a=s+n;if(-1==n&&(a=t.length-s),a>t.length)throw new eE("Given length is more than the size of source");let i=0;for(let e=s;e<a&&e<t.length;e++)0==ts.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()),s=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(s<0||s>t.length)throw new eE("The size of the search index of the array is greater than the size of the array");let n=-1;for(let e=s;e<t.length;e++)if(0==ts.compare(t[e],r)){n=e;break}return new eu([ea.outputOf(new Map([[tN.EVENT_RESULT_NAME,n]]))])}}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()),s=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(s<0||s>t.length||t.length<r.length)throw new eE("Given from second source is more than the size of the source array");let n=r.length,a=-1;for(let e=s;e<t.length;e++){let s=0;if(0==ts.compare(t[e],r[s])){for(;s<n&&0==ts.compare(t[e+s],r[s]);)s++;if(s==n){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()),s=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(s<0||s>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 n=-1;for(let e=t.length-1;e>=s;e--)if(0==ts.compare(t[e],r)){n=e;break}return new eu([ea.outputOf(new Map([[t_.EVENT_RESULT_NAME,n]]))])}}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()),s=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(s<0||s>t.length||r.length>t.length)throw new eE("Given from index is more than the size of the source array");let n=r.length,a=-1;for(let e=s;e<t.length;e++){let s=0;if(0==ts.compare(t[e],r[s])){for(;s<n&&0==ts.compare(t[e+s],r[s]);)s++;s==n&&(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 s=t[e];ts.comparePrimitive(r,s)>=0||(r=s)}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>ts.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()),s=e?.getArguments()?.get(tw.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=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=n<s.length&&n>0?n:0;if(i+a>=t.length||o+a>s.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]!=s[o+e]){E=e;break}return new eu([ea.outputOf(new Map([[tw.EVENT_RESULT_NAME,E]]))])}}class td extends e4{constructor(){super("Reverse",[td.PARAMETER_ARRAY_SOURCE,td.PARAMETER_INT_SOURCE_FROM,td.PARAMETER_INT_LENGTH],td.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(td.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(td.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(td.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),s>=t.length||s<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 n=r+s-1;for(;r<=n;){let e=t[r],s=t[n];t[r++]=s,t[n--]=e}return new eu([ea.outputOf(new Map([[td.EVENT_RESULT_NAME,t]]))])}}class tI extends e4{constructor(){super("Rotate",[tI.PARAMETER_ARRAY_SOURCE,tI.PARAMETER_ROTATE_LENGTH],tI.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tI.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tI.PARAMETER_ROTATE_LENGTH.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);let s=(t=[...t]).length;return r%=s,this.rotate(t,0,r-1),this.rotate(t,r,s-1),this.rotate(t,0,s-1),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}rotate(e,t,r){for(;t<r;){let s=e[t];e[t++]=e[r],e[r--]=s}}}class tP extends e4{constructor(){super("Shuffle",[tP.PARAMETER_ARRAY_SOURCE],tP.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tP.PARAMETER_ARRAY_SOURCE.getParameterName());if(t.length<=1)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);let r=0,s=(t=[...t]).length;for(let e=0;e<s;e++){let e=Math.floor(Math.random()*s)%s,n=t[r];t[r]=t[e],t[e]=n,r=e}return new 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,s){super(e||""),this.tokens=new ep,this.ops=new ep,t&&this.tokens.push(t),r&&this.tokens.push(r),s&&this.ops.push(s),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){let e;let t=this.expression.length,r="",s=new tv(""),n=0,a=!1;for(;n<t;){switch(r=this.expression[n],e=s.toString(),r){case" ":a=this.processTokenSepearator(s,e,a);break;case"(":n=this.processSubExpression(t,s,e,n,a),a=!1;break;case")":throw new 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,n);n=e.getT1(),a=e.getT2();break}case"?":if(n+1<t&&"?"!=this.expression.charAt(n+1)&&0!=n&&"?"!=this.expression.charAt(n-1))n=this.processTernaryOperator(t,s,e,n,a);else{let i=this.processOthers(r,t,s,e,n,a);n=i.getT1(),(a=i.getT2())&&this.ops.peek()==tB.ARRAY_OPERATOR&&(n=(i=this.process(t,s,n)).getT1(),a=i.getT2())}break;default:let i=this.processOthers(r,t,s,e,n,a);n=i.getT1(),(a=i.getT2())&&this.ops.peek()==tB.ARRAY_OPERATOR&&(n=(i=this.process(t,s,n)).getT1(),a=i.getT2())}++n}if(e=s.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 s="",n=r+1;for(;n<e;n++){let e=this.expression.charAt(n);if(e==t&&"\\"!=this.expression.charAt(n-1))break;s+=e}if(n==e&&this.expression.charAt(n-1)!=t)throw new tV(this.expression,"Missing string ending marker "+t);let a=new ew(n,!1);return this.tokens.push(new tb(s,s)),a}process(e,t,r){let s=1;for(++r;r<e&&0!=s;){let e=this.expression.charAt(r);"]"==e?--s:"["==e&&++s,0!=s&&(t.append(e),r++)}return this.tokens.push(new tY(t.toString())),t.setLength(0),new ew(r,!1)}processOthers(e,t,r,s,n,a){let i=t-n;i=i<tB.BIGGEST_OPERATOR_SIZE?i:tB.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(n,n+e);if(tB.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return eM.isNullOrBlank(s)||(this.tokens.push(new tD(s)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(t),a),a=!0,r.setLength(0),new ew(n+e-1,a)}return r.append(e),new ew(n,!1)}processTernaryOperator(e,t,r,s,n){if(n)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=++s;for(;s<e&&a>0;)"?"==(i=this.expression.charAt(s))?++a:":"==i&&--a,++s;if(":"!=i)throw new tV(this.expression,"':' operater is missing");if(s>=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,s-1)));let E=this.expression.substring(s);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,s,n){if(tB.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(r),n),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(s);for(s++;s<e&&a>0;)"("==(o=this.expression.charAt(s))?a++:")"==o&&a--,0!=a&&(i.append(o),s++);if(")"!=o)throw new 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())),s}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,s){if(r){if(s||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(),s=e.pop();e.push(new tY("",s,t,r))}}t.push(r)}}}hasPrecedence(e,t){let r=tB.OPERATOR_PRIORITY.get(e),s=tB.OPERATOR_PRIORITY.get(t);if(!r||!s)throw Error("Unknown operators provided");return s<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new tv,t=0,r=this.ops.toArray(),s=this.tokens.toArray();for(let n=0;n<r.length;n++)if(r[n].getOperator().startsWith("UN: "))e.append("(").append(r[n].getOperator().substring(4)).append(s[t]instanceof tY?s[t].toString():s[t]).append(")"),t++;else if(r[n]==tB.CONDITIONAL_TERNARY_OPERATOR){let r=s[t++];e.insert(0,r.toString()),e.insert(0,":"),r=s[t++],e.insert(0,r.toString()),e.insert(0,"?"),r=s[t++],e.insert(0,r.toString()).append(")"),e.insert(0,"(")}else{if(0==t){let r=s[t++];e.insert(0,r.toString())}let a=s[t++];e.insert(0,r[n].getOperator()).insert(0,a.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var 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,s){if(_(s))return;if(t.length==r)return s;let n=t[r].split(tk.REGEX_SQUARE_BRACKETS).map(e=>e.trim()).filter(e=>!eM.isNullOrBlank(e)).reduce((s,n)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,n,s),s);return this.retrieveElementFrom(e,t,r+1,n)}resolveForEachPartOfTokenWithBrackets(e,t,r,s,n){if(!_(n))return"length"===s?this.getLength(e,n):Array.isArray(n)?this.handleArrayAccess(e,s,n):this.handleObjectAccess(e,t,r,s,n)}getLength(e,t){let r=typeof t;if("string"===r||Array.isArray(t))return t.length;if("object"===r)return"length"in t?t.length:Object.keys(t).length;throw new tV(e,ec.format("Length can't be found in token $",e))}handleArrayAccess(e,t,r){let s=parseInt(t);if(isNaN(s))throw new tV(e,ec.format("$ is not a number",t));if(!(s<0)&&!(s>=r.length))return r[s]}handleObjectAccess(e,t,r,s,n){if(s.startsWith('"')){if(!s.endsWith('"')||1==s.length||2==s.length)throw new tV(e,ec.format("$ is missing a double quote or empty key found",e));s=s.substring(1,t.length-2)}return this.checkIfObject(e,t,r,n),n[s]}checkIfObject(e,t,r,s){if("object"!=typeof s||Array.isArray(s))throw new tV(e,ec.format("Unable to retrieve $ from $ in the path $",t[r],s.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,s=!1){this.store=tu(this.store),this.modifyStore(e,t,r,s)}modifyStore(e,t,r,s){let n=new tY(e),a=n.getTokens();a.removeLast();let i=n.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,s):this.putDataInArray(A,u,t,r,s)}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new eE(ec.format("Expected an array index but found $",t));if(s<0)throw new eE(ec.format("Array index is out of bound - $",t));let n=e[s];return _(n)&&(n=r==tB.OBJECT_OPERATOR?{}:[],e[s]=n),n}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));let s=e[t];return _(s)&&(s=r==tB.OBJECT_OPERATOR?{}:[],e[t]=s),s}putDataInArray(e,t,r,s,n){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));(s||_(e[a]))&&(n&&_(r)?e.splice(a,1):e[a]=r)}putDataInObject(e,t,r,s,n){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));(s||_(e[t]))&&(n&&_(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()),s=e?.getArguments()?.get(tj.PARAMETER_INT_LENGTH.getParameterName()),n=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==s&&(s=t.length-r),r<0||r>=t.length||r+s>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+s+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),n)):tW(e,t,n)),t.splice(r,s,...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()),s=e?.getArguments()?.get(tX.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),s<=0)return new eu([ea.outputOf(new Map([]))]);if(!(r>=0&&r<t.length)||r+s>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 n=t.slice(r,r+s);return new eu([ea.outputOf(new Map([[tX.EVENT_RESULT_NAME,n]]))])}}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 s=e?.getArguments()?.get(tJ.PARAMETER_ANY.getParameterName());if(_(s)||_(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(s),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);t.push(s);let n=t.length-1;for(r++;n>=r;){let e=t[n-1];t[n-1]=t[n],t[n--]=e}return new 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()),s=e?.getArguments()?.get(tz.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),r+s>t.length)throw new eE(ec.format("Array has no elements from $ to $ as the array size is $",r,r+s,t.length));let n=[...t],a=r+s;for(let e=a-1;e>=r;e--)for(let t=e-1;t>=r;t--)if(ef(n[e],n[t])){n.splice(e,1);break}return new eu([ea.outputOf(q.of(tz.EVENT_RESULT_NAME,n))])}}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),s=e?.getArguments()?.get(tQ)??"",n=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=s?o.getValue("Data."+s):t;return n&&_(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([en.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 tn),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 td),et(new tI),et(new tP),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",rs=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([en.outputEventMapEntry(new Map)])),rn="name",ra="value",ri=new eT("Get").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(rn,new Y().setName(rn).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([en.outputEventMapEntry(new Map([[ra,Y.ofAny(ra)]]))]));var ro={};m(ro,"ExpressionEvaluator",()=>sA);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,s=typeof t;if(r||"string"===s){let s=r?e:t,n=r?t:e,a="",i=n<0,o=Math.floor(n=Math.abs(n));for(;o-- >0;)a+=s;let E=Math.floor(s.length*(n-Math.floor(n)));if(E<0&&(E=-E),0!=E&&(a+=s.substring(0,E)),i){let e="";for(let t=a.length-1;t>=0;t--)e+=a[t];return e}return a}return e*t}}var 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 rd={};m(rd,"BitwiseAndOperator",()=>rI);class rI extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_AND),e&t}}var rP={};m(rP,"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=ts.findPrimitiveNullAsBoolean(e),s=ts.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||s.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare >= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>=s.getT2()}}var r$={};m(r$,"LogicalGreaterThanOperator",()=>rj);class rj extends rA{apply(e,t){let r=ts.findPrimitiveNullAsBoolean(e),s=ts.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||s.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare > with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>s.getT2()}}var rW={};m(rW,"LogicalLessThanEqualOperator",()=>rX);class rX extends rA{apply(e,t){let r=ts.findPrimitiveNullAsBoolean(e),s=ts.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||s.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare <= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<=s.getT2()}}var rJ={};m(rJ,"LogicalLessThanOperator",()=>rq);class rq extends rA{apply(e,t){let r=ts.findPrimitiveNullAsBoolean(e),s=ts.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||s.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare < with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<s.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),ts.findPrimitiveNumberType(e),-e}}var r5={};m(r5,"ArithmeticUnaryPlusOperator",()=>r6);class r6 extends r3{apply(e){return this.nullCheck(e,tB.UNARY_PLUS),ts.findPrimitiveNumberType(e),e}}var r7={};m(r7,"BitwiseComplementOperator",()=>r8);class r8 extends r3{apply(e){this.nullCheck(e,tB.UNARY_BITWISE_COMPLEMENT);let t=ts.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 se={};m(se,"LogicalNotOperator",()=>st);class st extends r3{apply(e){return!e&&""!==e}}var sr={};m(sr,"LiteralTokenValueExtractor",()=>sn);const ss=new Map([["true",!0],["false",!1],["null",void 0],["undefined",void 0]]);class sn extends tk{static{this.INSTANCE=new sn}getValueInternal(e){if(!eM.isNullOrBlank(e))return(e=e.trim(),ss.has(e))?ss.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 sa={},si={};m(si,"ConditionalTernaryOperator",()=>sE);class so{nullCheck(e,t,r,s){if(_(e)||_(t)||_(r))throw new tr(ec.format("$ cannot be applied to a null value",s.getOperatorName()))}}class sE extends so{apply(e,t,r){return e?t:r}}R(sa,si);class su 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],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.values.get(r))}getPrefix(){return su.PREFIX}getStore(){}constructor(...e){super(...e),this.values=new Map}}class sA{static{this.UNARY_OPERATORS_MAP=new Map([[tB.UNARY_BITWISE_COMPLEMENT,new r8],[tB.UNARY_LOGICAL_NOT,new st],[tB.UNARY_MINUS,new r4],[tB.UNARY_PLUS,new r6]])}static{this.TERNARY_OPERATORS_MAP=new Map([[tB.CONDITIONAL_TERNARY_OPERATOR,new sE]])}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 rI],[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(sA.UNARY_OPERATORS_MAP.keys())}constructor(e){this.internalTokenValueExtractor=new su,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,s=0,n=new ep;for(;s<e.length-1;){if("{"==e.charAt(s)&&"{"==e.charAt(s+1))0==r&&n.push(new ew(s+2,-1)),r++,s++;else if("}"==e.charAt(s)&&"}"==e.charAt(s+1)){if(--r<0)throw new tV(e,"Expecting {{ nesting path operator to be started before closing");0==r&&n.push(n.pop().setT2(s)),s++}s++}let a=this.replaceNestingExpression(e,t,n);return new ew(a,new tY(a))}replaceNestingExpression(e,t,r){let s=e;for(let n of r.toArray()){if(-1==n.getT2())throw new tV(e,"Expecting }} nesting path operator to be closed");let r=new sA(s.substring(n.getT1(),n.getT2())).evaluate(t);s=s.substring(0,n.getT1()-2)+r+s.substring(n.getT2()+2)}return s}getExpression(){return this.exp||(this.exp=new tY(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),s=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),n=s.pop();if(sA.UNARY_OPERATORS_MAP_KEY_SET.has(e))s.push(this.applyUnaryOperation(e,this.getValueFromToken(t,n)));else if(e==tB.OBJECT_OPERATOR||e==tB.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,s,e,n);else if(e==tB.CONDITIONAL_TERNARY_OPERATOR){let r=s.pop(),a=s.pop(),i=this.getValueFromToken(t,a),o=this.getValueFromToken(t,r),E=this.getValueFromToken(t,n);s.push(this.applyTernaryOperation(e,i,o,E))}else{let r=s.pop(),a=this.getValueFromToken(t,r),i=this.getValueFromToken(t,n);s.push(this.applyBinaryOperation(e,a,i))}}if(s.isEmpty())throw new tr(ec.format("Expression : $ evaluated to null",e));if(1!=s.size())throw new tr(ec.format("Expression : $ evaluated multiple values $",e,s));let n=s.get(0);if(n instanceof tb)return n.getElement();if(!(n instanceof tY))return this.getValueFromToken(t,n);throw new tr(ec.format("Expression : $ evaluated to $",e,s.get(0)))}processObjectOrArrayOperator(e,t,r,s,n){let a=new ep,i=new ep;if(!s||!n)return;do i.push(s),n instanceof tY?a.push(new tb(n.toString(),this.evaluateExpression(n,e))):n&&a.push(n),n=r.isEmpty()?void 0:r.pop(),s=t.isEmpty()?void 0:t.pop();while(s==tB.OBJECT_OPERATOR||s==tB.ARRAY_OPERATOR)n&&(n instanceof tY?a.push(new tb(n.toString(),this.evaluateExpression(n,e))):a.push(n)),s&&t.push(s);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(su.PREFIX+e)}let E=new tv(o instanceof tb?o.getTokenValue():o.toString());for(;!a.isEmpty();)o=a.pop(),s=i.pop(),E.append(s.getOperator()).append(o instanceof tb?o.getTokenValue():o.toString()),s==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=sn.INSTANCE.getValue(u)}catch(t){e=u}r.push(new tb(u,e))}}applyTernaryOperation(e,t,r,s){let n=sA.TERNARY_OPERATORS_MAP.get(e);if(!n)throw new tV(this.expression,ec.format("No operator found to evaluate $",this.getExpression()));return new tb(e.toString(),n.apply(t,r,s))}applyBinaryOperation(e,t,r){let s=typeof t,n=typeof r,a=sA.BINARY_OPERATORS_MAP.get(e);if(("object"===s||"object"===n)&&e!==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 s=sA.UNARY_OPERATORS_MAP.get(e);if(!s)throw new tV(this.expression,ec.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new tb(e.toString(),s.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):sn.INSTANCE.getValueFromExtractors(e,t)}}const sT="name",sl="value",sR=new eT("Set").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(sT,new Y().setName(sT).setType(L.of(i.STRING)).setMinLength(1),!1),X.ofEntry(sl,Y.ofAny(sl))])).setEvents(new Map([en.outputEventMapEntry(new Map)])),sm="value",sg="eventName",sh="results",sc=new eT("GenerateEvent").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(sg,Y.ofString(sg).setDefaultValue("output")),X.ofEntry(sh,Y.ofObject(sh).setProperties(new Map([["name",Y.ofString("name")],[sm,X.EXPRESSION]])),!0)])).setEvents(new Map([en.outputEventMapEntry(new Map)]));class sp extends e3{static{this.CONDITION="condition"}static{this.SIGNATURE=new eT("If").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(sp.CONDITION,Y.ofAny(sp.CONDITION))])).setEvents(new Map([en.eventMapEntry(en.TRUE,new Map),en.eventMapEntry(en.FALSE,new Map),en.outputEventMapEntry(new Map)]))}getSignature(){return sp.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(sp.CONDITION);return new eu([ea.of(t||""===t?en.TRUE:en.FALSE,new Map),ea.outputOf(new Map)])}}const sN="stepName",sf=new eT("Break").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(sN,Y.of(sN,i.STRING))])).setEvents(new Map([en.outputEventMapEntry(new Map([]))])),s_="count",sM="value",sS="index",sO=new eT("CountLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(s_,Y.of(s_,i.INTEGER))])).setEvents(new Map([en.eventMapEntry(en.ITERATION,new Map([[sS,Y.of(sS,i.INTEGER)]])),en.outputEventMapEntry(new Map([[sM,Y.of(sM,i.INTEGER)]]))])),sw="source",sd="each",sI="index",sP="value",sy=new eT("ForEachLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(sw,Y.ofArray(sw,Y.ofAny(sw)))])).setEvents(new Map([en.eventMapEntry(en.ITERATION,new Map([[sI,Y.of(sI,i.INTEGER)],[sd,Y.ofAny(sd)]])),en.outputEventMapEntry(new Map([[sP,Y.of(sP,i.INTEGER)]]))])),sx="from",sL="step",sv="value",sU="index",sV=new eT("RangeLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(sx,Y.of(sx,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(sL,Y.of(sL,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(1).setNot(new Y().setConstant(0)))])).setEvents(new Map([en.eventMapEntry(en.ITERATION,new Map([[sU,Y.of(sU,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)]])),en.outputEventMapEntry(new Map([[sv,Y.of(sv,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)]]))])),sC="value",sD=new eT("Add").setNamespace(p.MATH).setParameters(new Map([[sC,new X(sC,Y.ofNumber(sC)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[sC,Y.ofNumber(sC)]]))])),sG="value",sb="value1",sF="value2",sB=[()=>new Map([[sG,new X(sG,Y.ofNumber(sG))]]),()=>new Map([[sb,new X(sb,Y.ofNumber(sb))],[sF,new X(sF,Y.ofNumber(sF))]])];class sY extends e3{constructor(e,t,r=1,...s){super(),s&&s.length||(s=[i.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new eT(e).setNamespace(p.MATH).setParameters(sB[r-1]()).setEvents(new Map([en.outputEventMapEntry(new Map([[sG,new Y().setType(L.of(...s)).setName(sG)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=ts.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?sG:sb)).getT2();return 2==this.parametersNumber&&(t=ts.findPrimitiveNumberType(e.getArguments()?.get(sF)).getT2()),new eu([ea.outputOf(new Map([[sG,this.mathFunction.call(this,r,t)]]))])}}const sH="value";class sk extends e3{static{this.SIGNATURE=new eT("Hypotenuse").setNamespace(p.MATH).setParameters(new Map([[sH,new X(sH,Y.ofNumber(sH)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[sH,new Y().setType(L.of(i.DOUBLE)).setName(sH)]]))]))}constructor(){super()}getSignature(){return sk.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(sH);return new eu([ea.outputOf(new Map([[sH,Math.sqrt(t.reduce((e,t)=>e+=t*t,0))]]))])}}const s$="value",sj=new eT("Maximum").setNamespace(p.MATH).setParameters(new Map([[s$,new X(s$,Y.ofNumber(s$)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[s$,Y.ofNumber(s$)]]))])),sW="value",sX=new eT("Minimum").setNamespace(p.MATH).setParameters(new Map([[sW,new X(sW,Y.ofNumber(sW)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[sW,Y.ofNumber(sW)]]))])),sJ="value";class sq extends e3{static{this.SIGNATURE=new eT("Random").setNamespace(p.MATH).setEvents(new Map([en.outputEventMapEntry(q.of(sJ,Y.ofDouble(sJ)))]))}getSignature(){return sq.SIGNATURE}async internalExecute(e){return new eu([ea.outputOf(new Map([[sJ,Math.random()]]))])}}class sz extends e3{static{this.MIN_VALUE="minValue"}static{this.MAX_VALUE="maxValue"}static{this.VALUE="value"}constructor(e,t,r,s,n){super(),this.signature=new eT(e).setParameters(q.of(sz.MIN_VALUE,t,sz.MAX_VALUE,r)).setNamespace(p.MATH).setEvents(new Map([en.outputEventMapEntry(q.of(sz.VALUE,s))])),this.randomFunction=n}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sz.MIN_VALUE),r=e.getArguments()?.get(sz.MAX_VALUE),s=this.randomFunction(t,r);return new eu([ea.outputOf(new Map([[sz.VALUE,s]]))])}}const sK={Absolute:new sY("Absolute",e=>Math.abs(e),1,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE),ArcCosine:new sY("ArcCosine",e=>Math.acos(e)),ArcSine:new sY("ArcSine",e=>Math.asin(e)),ArcTangent:new sY("ArcTangent",e=>Math.atan(e)),Ceiling:new sY("Ceiling",e=>Math.ceil(e)),Cosine:new sY("Cosine",e=>Math.cos(e)),HyperbolicCosine:new sY("HyperbolicCosine",e=>Math.cosh(e)),CubeRoot:new sY("CubeRoot",e=>Math.cbrt(e)),Exponential:new sY("Exponential",e=>Math.exp(e)),ExponentialMinus1:new sY("ExponentialMinus1",e=>Math.expm1(e)),Floor:new sY("Floor",e=>Math.floor(e)),LogNatural:new sY("LogNatural",e=>Math.log(e)),Log10:new sY("Log10",e=>Math.log10(e)),Round:new sY("Round",e=>Math.round(e),1,i.INTEGER,i.LONG),Sine:new sY("Sine",e=>Math.sin(e)),HyperbolicSine:new sY("HyperbolicSine",e=>Math.sinh(e)),Tangent:new sY("Tangent",e=>Math.tan(e)),HyperbolicTangent:new sY("HyperbolicTangent",e=>Math.tanh(e)),ToDegrees:new sY("ToDegrees",e=>Math.PI/180*e),ToRadians:new sY("ToRadians",e=>180/Math.PI*e),SquareRoot:new sY("SquareRoot",e=>Math.sqrt(e)),ArcTangent2:new sY("ArcTangent2",(e,t)=>Math.atan2(e,t),2),Power:new sY("Power",(e,t)=>Math.pow(e,t),2),Add:new class extends e3{getSignature(){return sD}async internalExecute(e){let t=e.getArguments()?.get(sC);return new eu([ea.outputOf(new Map([[sC,t.reduce((e,t)=>e+=t,0)]]))])}},Hypotenuse:new sk,Maximum:new class extends e3{getSignature(){return sj}async internalExecute(e){let t=e.getArguments()?.get(s$);return new eu([ea.outputOf(new Map([[s$,t.reduce((e,t)=>!e&&0!==e||t>e?t:e)]]))])}},Minimum:new class extends e3{getSignature(){return sX}async internalExecute(e){let t=e.getArguments()?.get(sW);return new eu([ea.outputOf(new Map([[sW,t.reduce((e,t)=>!e&&0!==e||t<e?t:e)]]))])}},Random:new sq,RandomFloat:new sz("RandomFloat",X.of(sz.MIN_VALUE,Y.ofFloat(sz.MIN_VALUE).setDefaultValue(0)),X.of(sz.MAX_VALUE,Y.ofFloat(sz.MAX_VALUE).setDefaultValue(0x7fffffff)),Y.ofFloat(sz.VALUE),(e,t)=>Math.random()*(t-e)+e),RandomInt:new sz("RandomInt",X.of(sz.MIN_VALUE,Y.ofInteger(sz.MIN_VALUE).setDefaultValue(0)),X.of(sz.MAX_VALUE,Y.ofInteger(sz.MAX_VALUE).setDefaultValue(0x7fffffff)),Y.ofInteger(sz.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomLong:new sz("RandomLong",X.of(sz.MIN_VALUE,Y.ofLong(sz.MIN_VALUE).setDefaultValue(0)),X.of(sz.MAX_VALUE,Y.ofLong(sz.MAX_VALUE).setDefaultValue(Number.MAX_SAFE_INTEGER)),Y.ofLong(sz.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomDouble:new sz("RandomDouble",X.of(sz.MIN_VALUE,Y.ofDouble(sz.MIN_VALUE).setDefaultValue(0)),X.of(sz.MAX_VALUE,Y.ofDouble(sz.MAX_VALUE).setDefaultValue(Number.MAX_VALUE)),Y.ofDouble(sz.VALUE),(e,t)=>Math.random()*(t-e)+e)},sQ=Object.values(sK).map(e=>e.getSignature().getFullName());class sZ{async find(e,t){return e!=p.MATH?Promise.resolve(void 0):Promise.resolve(sK[t])}async filter(e){return Promise.resolve(sQ.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class s0 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(s0.SOURCE,Y.ofAny(s0.SCHEMA)),X.ofEntry(s0.SCHEMA,Y.SCHEMA,!1,o.CONSTANT),X.ofEntry(s0.CONVERSION_MODE,Y.ofString(s0.CONVERSION_MODE).setEnums(eJ()))])).setEvents(new Map([en.outputEventMapEntry(q.of(s0.VALUE,Y.ofAny(s0.VALUE)))]))}internalExecute(e){let t=e.getArguments()?.get(s0.SOURCE),r=Y.from(e?.getArguments()?.get(s0.SCHEMA));if(!r)throw new eE("Schema is not supplied.");let s=eX(e.getArguments()?.get(s0.CONVERSION_MODE))||u.STRICT;return this.convertToSchema(r,e.getSchemaRepository(),t,s)}async convertToSchema(e,t,r,s){try{return new eu([ea.outputOf(q.of(s0.VALUE,e9.validate([],e,t,r,!0,s)))])}catch(e){throw new eE(e?.message)}}}const s1="value",s2="source",s9="source";class s3 extends e3{constructor(e,t){super(),this.signature=new eT(e).setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(s9,Y.ofAny(s9))])).setEvents(new Map([en.outputEventMapEntry(new Map([["value",t]]))]))}getSignature(){return this.signature}}const s4="value",s5="value",s6="value",s7="source",s8="overwrite",ne="deleteKeyOnNull",nt="value",nr={ObjectValues:new class extends s3{constructor(){super("ObjectValues",Y.ofArray(nt,Y.ofAny(nt)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[nt,[]]]))]);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([[nt,r]]))])}},ObjectKeys:new class extends s3{constructor(){super("ObjectKeys",Y.ofArray(s5,Y.ofString(s5)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[s5,[]]]))]);let r=Object.keys(tu(t)).sort((e,t)=>e.localeCompare(t));return new eu([ea.outputOf(new Map([[s5,r]]))])}},ObjectEntries:new class extends s3{constructor(){super("ObjectEntries",Y.ofArray(s4,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([[s4,[]]]))]);let r=Object.entries(tu(t)).sort((e,t)=>e[0].localeCompare(t[0]));return new eu([ea.outputOf(new Map([[s4,r]]))])}},ObjectDeleteKey:new class extends e3{constructor(){super(),this.signature=new eT("ObjectDeleteKey").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(s2,Y.ofAny(s2)),X.ofEntry("key",Y.ofString("key"))])).setEvents(new Map([en.outputEventMapEntry(new Map([[s1,Y.ofAny(s1)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(s2),r=e.getArguments()?.get("key");return _(t)?new eu([ea.outputOf(new Map([[s1,void 0]]))]):(t=tu(t),delete t[r],new eu([ea.outputOf(new Map([[s1,t]]))]))}},ObjectPutValue:new class extends e3{constructor(){super(),this.signature=new eT("ObjectPutValue").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(s7,Y.ofObject(s7)),X.ofEntry("key",Y.ofString("key")),X.ofEntry(s6,Y.ofAny(s6)),X.ofEntry(s8,Y.ofBoolean(s8).setDefaultValue(!0)),X.ofEntry(ne,Y.ofBoolean(ne).setDefaultValue(!1))])).setEvents(new Map([en.outputEventMapEntry(new Map([[s6,Y.ofObject(s6)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(s7),r=e.getArguments()?.get("key"),s=e.getArguments()?.get(s6),n=e.getArguments()?.get(s8),a=e.getArguments()?.get(ne),i=new t$(t,"Data.");return i.setValue(r,s,n,a),new eu([ea.outputOf(new Map([[s6,i.getStore()]]))])}},ObjectConvert:new s0},ns=Object.values(nr).map(e=>e.getSignature().getFullName());class nn{async find(e,t){return e!=p.SYSTEM_OBJECT?Promise.resolve(void 0):Promise.resolve(nr[t])}async filter(e){return Promise.resolve(ns.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class na 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(na.VALUES,Y.ofAny(na.VALUES),!0),X.ofEntry(na.STREAM,Y.ofString(na.STREAM).setEnums([na.LOG,na.ERROR]).setDefaultValue(na.LOG))])).setEvents(new Map([en.outputEventMapEntry(new Map)]))}getSignature(){return na.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(na.VALUES),r=e.getArguments()?.get(na.STREAM);return(r===na.LOG?console?.log:console?.error)?.(...t),new eu([ea.outputOf(new Map)])}}class ni 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(ni.PARAMETER_STRING_NAME,Y.ofString(ni.PARAMETER_STRING_NAME))}static{this.PARAMETER_SECOND_STRING=new X(ni.PARAMETER_SECOND_STRING_NAME,Y.ofString(ni.PARAMETER_SECOND_STRING_NAME))}static{this.PARAMETER_THIRD_STRING=new X(ni.PARAMETER_THIRD_STRING_NAME,Y.ofString(ni.PARAMETER_THIRD_STRING_NAME))}static{this.PARAMETER_INDEX=new X(ni.PARAMETER_INDEX_NAME,Y.ofInteger(ni.PARAMETER_INDEX_NAME))}static{this.PARAMETER_SECOND_INDEX=new X(ni.PARAMETER_SECOND_INDEX_NAME,Y.ofInteger(ni.PARAMETER_SECOND_INDEX_NAME))}static{this.PARAMETER_SEARCH_STRING=new X(ni.PARAMETER_SEARCH_STRING_NAME,Y.ofString(ni.PARAMETER_STRING_NAME))}static{this.EVENT_STRING=new en(en.OUTPUT,q.of(ni.EVENT_RESULT_NAME,Y.ofString(ni.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new en(en.OUTPUT,q.of(ni.EVENT_RESULT_NAME,Y.ofBoolean(ni.EVENT_RESULT_NAME)))}static{this.EVENT_INT=new en(en.OUTPUT,q.of(ni.EVENT_RESULT_NAME,Y.ofInteger(ni.EVENT_RESULT_NAME)))}static{this.EVENT_ARRAY=new en(en.OUTPUT,q.of(ni.EVENT_RESULT_NAME,Y.ofArray(ni.EVENT_RESULT_NAME)))}constructor(e,t,r,...s){super();let n=new Map;s.forEach(e=>n.set(e.getParameterName(),e)),this.signature=new eT(t).setNamespace(e).setParameters(n).setEvents(q.of(r.getName(),r))}getSignature(){return this.signature}static ofEntryStringStringAndBooleanOutput(e,t){return[e,new class extends ni{async internalExecute(e){let r=e?.getArguments()?.get(ni.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(ni.PARAMETER_SEARCH_STRING_NAME);return new eu([ea.outputOf(q.of(ni.EVENT_RESULT_NAME,t(r,s)))])}}(p.STRING,e,ni.EVENT_BOOLEAN,ni.PARAMETER_STRING,ni.PARAMETER_SEARCH_STRING)]}static ofEntryStringIntegerAndStringOutput(e,t){return[e,new class extends ni{async internalExecute(e){let r=e?.getArguments()?.get(ni.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(ni.PARAMETER_INDEX_NAME);return new eu([ea.outputOf(q.of(ni.EVENT_RESULT_NAME,t(r,s)))])}}(p.STRING,e,ni.EVENT_STRING,ni.PARAMETER_STRING,ni.PARAMETER_INDEX)]}static ofEntryStringStringAndIntegerOutput(e,t){return[e,new class extends ni{async internalExecute(e){let r=e?.getArguments()?.get(ni.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(ni.PARAMETER_SEARCH_STRING_NAME);return new eu([ea.outputOf(q.of(ni.EVENT_RESULT_NAME,t(r,s)))])}}(p.STRING,e,ni.EVENT_INT,ni.PARAMETER_STRING,ni.PARAMETER_SEARCH_STRING)]}static ofEntryStringAndStringOutput(e,t){return[e,new class extends ni{async internalExecute(e){let r=e?.getArguments()?.get(ni.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(ni.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,ni.EVENT_STRING,ni.PARAMETER_STRING)]}static ofEntryStringAndBooleanOutput(e,t){return[e,new class extends ni{async internalExecute(e){let r=e?.getArguments()?.get(ni.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(ni.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,ni.EVENT_BOOLEAN,ni.PARAMETER_STRING)]}static ofEntryStringStringIntegerAndIntegerOutput(e,t){return[e,new class extends ni{async internalExecute(e){let r=e?.getArguments()?.get(ni.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(ni.PARAMETER_SEARCH_STRING_NAME),n=e?.getArguments()?.get(ni.PARAMETER_INDEX_NAME);return new eu([ea.outputOf(q.of(ni.EVENT_RESULT_NAME,t(r,s,n)))])}}(p.STRING,e,ni.EVENT_INT,ni.PARAMETER_STRING,ni.PARAMETER_SEARCH_STRING,ni.PARAMETER_INDEX)]}static ofEntryStringIntegerIntegerAndStringOutput(e,t){return[e,new class extends ni{async internalExecute(e){let r=e?.getArguments()?.get(ni.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(ni.PARAMETER_INDEX_NAME),n=e?.getArguments()?.get(ni.PARAMETER_SECOND_INDEX_NAME);return new eu([ea.outputOf(q.of(ni.EVENT_RESULT_NAME,t(r,s,n)))])}}(p.STRING,e,ni.EVENT_STRING,ni.PARAMETER_STRING,ni.PARAMETER_INDEX,ni.PARAMETER_SECOND_INDEX)]}static ofEntryStringStringStringAndStringOutput(e,t){return[e,new class extends ni{async internalExecute(e){let r=e?.getArguments()?.get(ni.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(ni.PARAMETER_SECOND_STRING_NAME),n=e?.getArguments()?.get(ni.PARAMETER_THIRD_STRING_NAME);return new eu([ea.outputOf(q.of(ni.EVENT_RESULT_NAME,t(r,s,n)))])}}(p.STRING,e,ni.EVENT_STRING,ni.PARAMETER_STRING,ni.PARAMETER_SECOND_STRING,ni.PARAMETER_THIRD_STRING)]}static ofEntryStringAndIntegerOutput(e,t){return[e,new class extends ni{async internalExecute(e){let r=e?.getArguments()?.get(ni.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(ni.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,ni.EVENT_INT,ni.PARAMETER_STRING)]}}class no extends e3{static{this.VALUE="value"}static{this.SCHEMA=new Y().setName(no.VALUE).setType(new x(i.STRING))}static{this.SIGNATURE=new eT("Concatenate").setNamespace(p.STRING).setParameters(new Map([[no.VALUE,new X(no.VALUE,no.SCHEMA).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[no.VALUE,Y.ofString(no.VALUE)]]))]))}constructor(){super()}getSignature(){return no.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(no.VALUE),r="";return t.reduce((e,t)=>r=e+t,r),new eu([ea.outputOf(new Map([[no.VALUE,r]]))])}}class nE 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(nE.PARAMETER_STRING_NAME,Y.ofString(nE.PARAMETER_STRING_NAME)),this.PARAMETER_AT_START=new X(nE.PARAMETER_AT_START_NAME,Y.ofInteger(nE.PARAMETER_AT_START_NAME)),this.PARAMETER_AT_END=new X(nE.PARAMETER_AT_END_NAME,Y.ofInteger(nE.PARAMETER_AT_END_NAME)),this.EVENT_STRING=new en(en.OUTPUT,new Map([[nE.EVENT_RESULT_NAME,Y.ofString(nE.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(nE.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nE.PARAMETER_AT_START_NAME),s=e?.getArguments()?.get(nE.PARAMETER_AT_END_NAME);if(s>=r){let e="";return e+=t.substring(0,r)+t.substring(s),new eu([ea.outputOf(new Map([[nE.EVENT_RESULT_NAME,e.toString()]]))])}return new eu([ea.outputOf(new Map([[nE.EVENT_RESULT_NAME,t]]))])}}class nu 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(nu.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nu.PARAMETER_AT_POSITION_NAME),s=e?.getArguments()?.get(nu.PARAMETER_INSERT_STRING_NAME),n="";return n+=t.substring(0,r)+s+t.substring(r),new eu([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,n]]))])}constructor(...e){super(...e),this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new X(nu.PARAMETER_STRING_NAME,Y.ofString(nu.PARAMETER_STRING_NAME)),this.PARAMETER_AT_POSITION=new X(nu.PARAMETER_AT_POSITION_NAME,Y.ofInteger(nu.PARAMETER_AT_POSITION_NAME)),this.PARAMETER_INSERT_STRING=new X(nu.PARAMETER_INSERT_STRING_NAME,Y.ofString(nu.PARAMETER_INSERT_STRING_NAME)),this.EVENT_STRING=new en(en.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([en.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]))]))}}class nA 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(nA.PARAMETER_REGEX_NAME,Y.ofString(nA.PARAMETER_REGEX_NAME))),q.entry(...X.ofEntry(nA.PARAMETER_STRING_NAME,Y.ofString(nA.PARAMETER_STRING_NAME))))).setEvents(q.ofEntries(q.entry(...en.outputEventMapEntry(new Map([[nA.EVENT_RESULT_NAME,Y.ofBoolean(nA.EVENT_RESULT_NAME)]])))))}getSignature(){return nA.signature}async internalExecute(e){let t=e.getArguments()?.get(nA.PARAMETER_REGEX_NAME),r=e.getArguments()?.get(nA.PARAMETER_STRING_NAME);return new eu([ea.outputOf(new Map([[nA.EVENT_RESULT_NAME,!!r.match(t)?.length]]))])}}class nT 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(nT.PARAMETER_STRING_NAME,Y.ofString(nT.PARAMETER_STRING_NAME))}static{this.PARAMETER_POSTPAD_STRING=new X(nT.PARAMETER_POSTPAD_STRING_NAME,Y.ofString(nT.PARAMETER_POSTPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(nT.PARAMETER_LENGTH_NAME,Y.ofInteger(nT.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new en(en.OUTPUT,new Map([[nT.EVENT_RESULT_NAME,Y.ofString(nT.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new eT("PostPad").setNamespace(p.STRING).setParameters(new Map([[nT.PARAMETER_STRING.getParameterName(),nT.PARAMETER_STRING],[nT.PARAMETER_POSTPAD_STRING.getParameterName(),nT.PARAMETER_POSTPAD_STRING],[nT.PARAMETER_LENGTH.getParameterName(),nT.PARAMETER_LENGTH]])).setEvents(new Map([[nT.EVENT_STRING.getName(),nT.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nT.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nT.PARAMETER_POSTPAD_STRING_NAME),s=e.getArguments()?.get(nT.PARAMETER_LENGTH_NAME),n="",a=r.length;for(n+=t;a<=s;)n+=r,a+=r.length;return n.length-t.length<s&&(n+=r.substring(0,s-(n.length-t.length))),new eu([ea.outputOf(new Map([[nT.EVENT_RESULT_NAME,n.toString()]]))])}}class nl 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(nl.PARAMETER_STRING_NAME,Y.ofString(nl.PARAMETER_STRING_NAME))}static{this.PARAMETER_PREPAD_STRING=new X(nl.PARAMETER_PREPAD_STRING_NAME,Y.ofString(nl.PARAMETER_PREPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(nl.PARAMETER_LENGTH_NAME,Y.ofInteger(nl.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new en(en.OUTPUT,new Map([[nl.EVENT_RESULT_NAME,Y.ofString(nl.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("PrePad").setNamespace(p.STRING).setParameters(new Map([[nl.PARAMETER_STRING.getParameterName(),nl.PARAMETER_STRING],[nl.PARAMETER_PREPAD_STRING.getParameterName(),nl.PARAMETER_PREPAD_STRING],[nl.PARAMETER_LENGTH.getParameterName(),nl.PARAMETER_LENGTH]])).setEvents(new Map([[nl.EVENT_STRING.getName(),nl.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(nl.PARAMETER_STRING_NAME),r=e.getArguments()?.get(nl.PARAMETER_PREPAD_STRING_NAME),s=e.getArguments()?.get(nl.PARAMETER_LENGTH_NAME),n="",a=r.length;for(;a<=s;)n+=r,a+=r.length;return n.length<s&&(n+=r.substring(0,s-n.length)),n+=t,new eu([ea.outputOf(new Map([[nl.EVENT_RESULT_NAME,n]]))])}}class nR 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(nR.PARAMETER_STRING_NAME,Y.ofString(nR.PARAMETER_STRING_NAME))}static{this.PARAMETER_OTHER_STRING=new X(nR.PARAMETER_OTHER_STRING_NAME,Y.ofString(nR.PARAMETER_OTHER_STRING_NAME))}static{this.PARAMETER_FIRST_OFFSET=new X(nR.PARAMETER_FIRST_OFFSET_NAME,Y.ofInteger(nR.PARAMETER_FIRST_OFFSET_NAME))}static{this.PARAMETER_SECOND_OFFSET=new X(nR.PARAMETER_SECOND_OFFSET_NAME,Y.ofInteger(nR.PARAMETER_SECOND_OFFSET_NAME))}static{this.PARAMETER_INTEGER=new X(nR.PARAMETER_INTEGER_NAME,Y.ofInteger(nR.PARAMETER_INTEGER_NAME))}static{this.PARAMETER_BOOLEAN=new X(nR.PARAMETER_BOOLEAN_NAME,Y.ofBoolean(nR.PARAMETER_BOOLEAN_NAME))}static{this.EVENT_BOOLEAN=new en(en.OUTPUT,new Map([[nR.EVENT_RESULT_NAME,Y.ofBoolean(nR.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("RegionMatches").setNamespace(p.STRING).setParameters(new Map([[nR.PARAMETER_STRING.getParameterName(),nR.PARAMETER_STRING],[nR.PARAMETER_BOOLEAN.getParameterName(),nR.PARAMETER_BOOLEAN],[nR.PARAMETER_FIRST_OFFSET.getParameterName(),nR.PARAMETER_FIRST_OFFSET],[nR.PARAMETER_OTHER_STRING.getParameterName(),nR.PARAMETER_OTHER_STRING],[nR.PARAMETER_SECOND_OFFSET.getParameterName(),nR.PARAMETER_SECOND_OFFSET],[nR.PARAMETER_INTEGER.getParameterName(),nR.PARAMETER_INTEGER]])).setEvents(new Map([[nR.EVENT_BOOLEAN.getName(),nR.EVENT_BOOLEAN]]))}async internalExecute(e){let t=e.getArguments()?.get(nR.PARAMETER_STRING_NAME),r=e.getArguments()?.get(nR.PARAMETER_BOOLEAN_NAME),s=e.getArguments()?.get(nR.PARAMETER_FIRST_OFFSET_NAME),n=e?.getArguments()?.get(nR.PARAMETER_OTHER_STRING_NAME),a=e?.getArguments()?.get(nR.PARAMETER_SECOND_OFFSET_NAME),i=e.getArguments()?.get(nR.PARAMETER_INTEGER_NAME),o=!1;return o=!(s<0)&&!(a<0)&&!(s+i>t.length)&&!(a+i>n.length)&&(r?(t=t.substring(s,s+i).toUpperCase())==n.substring(a,a+i).toUpperCase():(t=t.substring(s,s+i))==n.substring(a,i)),new eu([ea.outputOf(new Map([[nR.EVENT_RESULT_NAME,o]]))])}}class nm 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(nm.PARAMETER_STRING_NAME,Y.ofString(nm.PARAMETER_STRING_NAME))}static{this.PARAMETER_AT_START=new X(nm.PARAMETER_AT_START_NAME,Y.ofInteger(nm.PARAMETER_AT_START_NAME))}static{this.PARAMETER_AT_LENGTH=new X(nm.PARAMETER_AT_LENGTH_NAME,Y.ofInteger(nm.PARAMETER_AT_LENGTH_NAME))}static{this.PARAMETER_REPLACE_STRING=new X(nm.PARAMETER_REPLACE_STRING_NAME,Y.ofString(nm.PARAMETER_REPLACE_STRING_NAME))}static{this.EVENT_STRING=new en(en.OUTPUT,new Map([[nm.EVENT_RESULT_NAME,Y.ofString(nm.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new eT("ReplaceAtGivenPosition").setNamespace(p.STRING).setParameters(new Map([[nm.PARAMETER_STRING.getParameterName(),nm.PARAMETER_STRING],[nm.PARAMETER_AT_START.getParameterName(),nm.PARAMETER_AT_START],[nm.PARAMETER_AT_LENGTH.getParameterName(),nm.PARAMETER_AT_LENGTH],[nm.PARAMETER_REPLACE_STRING.getParameterName(),nm.PARAMETER_REPLACE_STRING]])).setEvents(new Map([[nm.EVENT_STRING.getName(),nm.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(nm.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nm.PARAMETER_AT_START_NAME),s=e?.getArguments()?.get(nm.PARAMETER_AT_LENGTH_NAME);return e?.getArguments()?.get(nm.PARAMETER_REPLACE_STRING_NAME),t.length,r<s&&(t.substring(0,r),t.substring(r+s)),new eu([ea.outputOf(new Map([[nm.EVENT_RESULT_NAME,t]]))])}}class ng 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([en.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,s="";for(;r>=0;)s+=t.charAt(r--);return new eu([ea.outputOf(q.of(this.VALUE,s))])}}class nh 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([en.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 en(en.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 nc 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 en(en.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 np 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(np.PARAMETER_STRING_NAME,Y.ofString(np.PARAMETER_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(np.PARAMETER_LENGTH_NAME,Y.ofInteger(np.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new en(en.OUTPUT,new Map([[np.EVENT_RESULT_NAME,Y.ofString(np.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("TrimTo").setNamespace(p.STRING).setParameters(new Map([[np.PARAMETER_STRING.getParameterName(),np.PARAMETER_STRING],[np.PARAMETER_LENGTH.getParameterName(),np.PARAMETER_LENGTH]])).setEvents(new Map([[np.EVENT_STRING.getName(),np.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(np.PARAMETER_STRING_NAME),r=e.getArguments()?.get(np.PARAMETER_LENGTH_NAME);return new eu([ea.outputOf(new Map([[np.EVENT_RESULT_NAME,t.substring(0,r)]]))])}}class nN{static{this.repoMap=q.ofArrayEntries(ni.ofEntryStringAndStringOutput("Trim",e=>e.trim()),ni.ofEntryStringAndStringOutput("TrimStart",e=>e.trimStart()),ni.ofEntryStringAndStringOutput("TrimEnd",e=>e.trimEnd()),ni.ofEntryStringAndIntegerOutput("Length",e=>e.length),ni.ofEntryStringStringAndIntegerOutput("Frequency",(e,t)=>{let r=0,s=e.indexOf(t);for(;-1!=s;)r++,s=e.indexOf(t,s+1);return r}),ni.ofEntryStringAndStringOutput("LowerCase",e=>e.toLocaleLowerCase()),ni.ofEntryStringAndStringOutput("UpperCase",e=>e.toUpperCase()),ni.ofEntryStringAndBooleanOutput("IsBlank",e=>""===e.trim()),ni.ofEntryStringAndBooleanOutput("IsEmpty",e=>""===e),ni.ofEntryStringStringAndBooleanOutput("Contains",(e,t)=>-1!=e.indexOf(t)),ni.ofEntryStringStringAndBooleanOutput("EndsWith",(e,t)=>e.endsWith(t)),ni.ofEntryStringStringAndBooleanOutput("StartsWith",(e,t)=>e.startsWith(t)),ni.ofEntryStringStringAndBooleanOutput("EqualsIgnoreCase",(e,t)=>e.toUpperCase()==t.toUpperCase()),ni.ofEntryStringStringAndBooleanOutput("Matches",(e,t)=>new RegExp(t).test(e)),ni.ofEntryStringStringAndIntegerOutput("IndexOf",(e,t)=>e.indexOf(t)),ni.ofEntryStringStringAndIntegerOutput("LastIndexOf",(e,t)=>e.lastIndexOf(t)),ni.ofEntryStringIntegerAndStringOutput("Repeat",(e,t)=>e.repeat(t)),ni.ofEntryStringStringIntegerAndIntegerOutput("IndexOfWithStartPoint",(e,t,r)=>e.indexOf(t,r)),ni.ofEntryStringStringIntegerAndIntegerOutput("LastIndexOfWithStartPoint",(e,t,r)=>e.lastIndexOf(t,r)),ni.ofEntryStringStringStringAndStringOutput("Replace",(e,t,r)=>e.replaceAll(t,r)),ni.ofEntryStringStringStringAndStringOutput("ReplaceFirst",(e,t,r)=>e.replace(t,r)),ni.ofEntryStringIntegerIntegerAndStringOutput("SubString",(e,t,r)=>e.substring(t,r)),et(new no),et(new nE),et(new nu),et(new nT),et(new nl),et(new nR),et(new nm),et(new ng),et(new nh),et(new nc),et(new np),et(new nA))}static{this.filterableNames=Array.from(nN.repoMap.values()).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=p.STRING?Promise.resolve(void 0):Promise.resolve(nN.repoMap.get(t))}async filter(e){return Promise.resolve(nN.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class nf 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(nf.PARAMETER_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_ONE=new X(nf.PARAMETER_TIMESTAMP_NAME_ONE,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_TWO=new X(nf.PARAMETER_TIMESTAMP_NAME_TWO,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_VARIABLE_UNIT=new X(nf.PARAMETER_UNIT_NAME,Y.ofRef(p.DATE+".Timeunit")).setVariableArgument(!0)}static{this.PARAMETER_UNIT=new X(nf.PARAMETER_UNIT_NAME,Y.ofRef(p.DATE+".Timeunit"))}static{this.PARAMETER_NUMBER=new X(nf.PARAMETER_NUMBER_NAME,Y.ofInteger(nf.PARAMETER_NUMBER_NAME))}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_TIMESTAMP_NAME="isoTimeStamp"}static{this.EVENT_INT=new en(en.OUTPUT,q.of(nf.EVENT_RESULT_NAME,Y.ofInteger(nf.EVENT_RESULT_NAME)))}static{this.EVENT_STRING=new en(en.OUTPUT,q.of(nf.EVENT_RESULT_NAME,Y.ofString(nf.EVENT_RESULT_NAME)))}static{this.EVENT_LONG=new en(en.OUTPUT,q.of(nf.EVENT_RESULT_NAME,Y.ofLong(nf.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new en(en.OUTPUT,q.of(nf.EVENT_RESULT_NAME,Y.ofBoolean(nf.EVENT_RESULT_NAME)))}static{this.EVENT_TIMESTAMP=new en(en.OUTPUT,q.of(nf.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 s=new Map;r.forEach(e=>s.set(e.getParameterName(),e)),this.signature.setParameters(s)}static ofEntryTimestampAndIntegerOutput(e,t){return[e,new class extends nf{async internalExecute(e){return new eu([ea.outputOf(q.of(nf.EVENT_RESULT_NAME,t(e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME))))])}}(e,nf.EVENT_INT,nf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndBooleanOutput(e,t){return[e,new class extends nf{async internalExecute(e){return new eu([ea.outputOf(q.of(nf.EVENT_RESULT_NAME,t(e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME))))])}}(e,nf.EVENT_BOOLEAN,nf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndStringOutput(e,t){return[e,new class extends nf{async internalExecute(e){return new eu([ea.outputOf(q.of(nf.EVENT_RESULT_NAME,t(e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME))))])}}(e,nf.EVENT_STRING,nf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampIntegerAndTimestampOutput(e,t){return[e,new class extends nf{async internalExecute(e){return new eu([ea.outputOf(q.of(nf.EVENT_RESULT_NAME,t(e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME),e.getArguments()?.get(nf.PARAMETER_NUMBER_NAME))))])}}(e,nf.EVENT_TIMESTAMP,nf.PARAMETER_TIMESTAMP,nf.PARAMETER_NUMBER)]}static ofEntryTimestampTimestampAndTOutput(e,t,r,...s){return[e,new class extends nf{async internalExecute(e){let t=[];return s?.length&&t.push(...s.map(t=>e.getArguments()?.get(t.getParameterName()))),new eu([ea.outputOf(q.of(nf.EVENT_RESULT_NAME,r(e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME_ONE),e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME_TWO),t)))])}}(e,t,nf.PARAMETER_TIMESTAMP_ONE,nf.PARAMETER_TIMESTAMP_TWO,...s)]}}function n_(e){let t=(0,l.DateTime).fromISO(e,{setZone:!0});if(!t?.isValid)throw Error("Invalid ISO timestamp");return t}class nM extends nf{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",nf.EVENT_TIMESTAMP,nf.PARAMETER_TIMESTAMP,X.of(nM.PARAMETER_YEARS_NAME,Y.ofNumber(nM.PARAMETER_YEARS_NAME).setDefaultValue(0)),X.of(nM.PARAMETER_MONTHS_NAME,Y.ofNumber(nM.PARAMETER_MONTHS_NAME).setDefaultValue(0)),X.of(nM.PARAMETER_DAYS_NAME,Y.ofNumber(nM.PARAMETER_DAYS_NAME).setDefaultValue(0)),X.of(nM.PARAMETER_HOURS_NAME,Y.ofNumber(nM.PARAMETER_HOURS_NAME).setDefaultValue(0)),X.of(nM.PARAMETER_MINUTES_NAME,Y.ofNumber(nM.PARAMETER_MINUTES_NAME).setDefaultValue(0)),X.of(nM.PARAMETER_SECONDS_NAME,Y.ofNumber(nM.PARAMETER_SECONDS_NAME).setDefaultValue(0)),X.of(nM.PARAMETER_MILLISECONDS_NAME,Y.ofNumber(nM.PARAMETER_MILLISECONDS_NAME).setDefaultValue(0))),this.isAdd=e}async internalExecute(e){let t;let r=n_(e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME)),s=e.getArguments()?.get(nM.PARAMETER_YEARS_NAME),n=e.getArguments()?.get(nM.PARAMETER_MONTHS_NAME),a=e.getArguments()?.get(nM.PARAMETER_DAYS_NAME),i=e.getArguments()?.get(nM.PARAMETER_HOURS_NAME),o={years:s,months:n,days:a,hours:i,minutes:e.getArguments()?.get(nM.PARAMETER_MINUTES_NAME),seconds:e.getArguments()?.get(nM.PARAMETER_SECONDS_NAME),milliseconds:e.getArguments()?.get(nM.PARAMETER_MILLISECONDS_NAME)};return t=this.isAdd?r.plus(o):r.minus(o),new eu([ea.outputOf(q.of(nf.EVENT_TIMESTAMP_NAME,t.toISO()))])}}class nS 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([[nf.EVENT_TIMESTAMP.getName(),nf.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(nf.EVENT_TIMESTAMP_NAME,new Date(r).toISOString()))]))}}class nO extends e3{constructor(e,t){super(),this.isSeconds=t,this.signature=new eT(e).setNamespace(p.DATE).setParameters(new Map([[nf.PARAMETER_TIMESTAMP_NAME,nf.PARAMETER_TIMESTAMP]])).setEvents(new Map([[nf.EVENT_TIMESTAMP.getName(),nf.EVENT_LONG]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(nf.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(nf.EVENT_RESULT_NAME,r))]))}}class nw extends nf{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("ToDateString",nf.EVENT_STRING,nf.PARAMETER_TIMESTAMP,X.of(nw.PARAMETER_FORMAT_NAME,Y.ofString(nw.PARAMETER_FORMAT_NAME)),X.of(nw.PARAMETER_LOCALE_NAME,Y.ofString(nw.PARAMETER_LOCALE_NAME).setDefaultValue("")))}async internalExecute(e){let t=n_(e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(nw.PARAMETER_FORMAT_NAME),s=e.getArguments()?.get(nw.PARAMETER_LOCALE_NAME);return""===s&&(s="system"),new eu([ea.outputOf(q.of(nf.EVENT_RESULT_NAME,t.toFormat(r,{locale:s})))])}}class nd extends nf{static{this.PARAMETER_TIMEZONE_NAME="timezone"}constructor(){super("SetTimeZone",nf.EVENT_TIMESTAMP,nf.PARAMETER_TIMESTAMP,X.of(nd.PARAMETER_TIMEZONE_NAME,Y.ofString(nd.PARAMETER_TIMEZONE_NAME)))}async internalExecute(e){let t=n_(e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(nd.PARAMETER_TIMEZONE_NAME);return new eu([ea.outputOf(q.of(nf.EVENT_TIMESTAMP_NAME,t.setZone(r).toISO()))])}}class nI extends nf{static{this.PARAMETER_START_TIMESTAMP_NAME="startTimestamp"}static{this.PARAMETER_END_TIMESTAMP_NAME="endTimestamp"}static{this.PARAMETER_CHECK_TIMESTAMP_NAME="checkTimestamp"}constructor(){super("IsBetween",nI.EVENT_BOOLEAN,X.of(nI.PARAMETER_START_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")),X.of(nI.PARAMETER_END_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")),X.of(nI.PARAMETER_CHECK_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")))}async internalExecute(e){let t=e.getArguments()?.get(nI.PARAMETER_START_TIMESTAMP_NAME),r=e.getArguments()?.get(nI.PARAMETER_END_TIMESTAMP_NAME),s=e.getArguments()?.get(nI.PARAMETER_CHECK_TIMESTAMP_NAME),n=n_(t),a=n_(r),i=n_(s);return n>a&&([n,a]=[a,n]),new eu([ea.outputOf(q.of(nI.EVENT_RESULT_NAME,n<=i&&i<=a))])}}class nP extends e3{constructor(e){super(),this.isLast=e,this.signature=new eT(e?"LastOf":"FirstOf").setNamespace(p.DATE).setParameters(new Map([[nf.PARAMETER_TIMESTAMP_NAME,new X(nf.PARAMETER_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")).setVariableArgument(!0)]])).setEvents(new Map([[nf.EVENT_TIMESTAMP.getName(),nf.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME);if(!t?.length)throw Error("No timestamps provided");let r=t.map(e=>n_(e));return r.sort((e,t)=>e.toMillis()-t.toMillis()),Promise.resolve(new eu([ea.outputOf(q.of(nf.EVENT_TIMESTAMP_NAME,r[this.isLast?r.length-1:0].toISO()))]))}}class ny extends nf{static{this.EVENT_TIME_OBJECT_NAME="object"}static{this.EVENT_TIME_ARRAY_NAME="array"}constructor(e){super(e?"TimeAsArray":"TimeAsObject",new en(en.OUTPUT,q.of(e?ny.EVENT_TIME_ARRAY_NAME:ny.EVENT_TIME_OBJECT_NAME,e?Y.ofArray(ny.EVENT_TIME_ARRAY_NAME,Y.ofInteger("timeParts")):Y.ofRef(p.DATE+".TimeObject"))),nf.PARAMETER_TIMESTAMP),this.isArray=e}async internalExecute(e){let t=n_(e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME)).toObject();return new eu([ea.outputOf(q.of(this.isArray?ny.EVENT_TIME_ARRAY_NAME:ny.EVENT_TIME_OBJECT_NAME,this.isArray?[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond]:t))])}}class nx extends nf{constructor(e){super(e?"StartOf":"EndOf",nf.EVENT_TIMESTAMP,nf.PARAMETER_TIMESTAMP,nf.PARAMETER_UNIT),this.isStart=e}async internalExecute(e){let t=n_(e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(nf.PARAMETER_UNIT_NAME)?.toLowerCase();r=r.substring(0,r.length-1);let s=this.isStart?t.startOf(r):t.endOf(r);return new eu([ea.outputOf(q.of(nf.EVENT_TIMESTAMP_NAME,s.toISO({includeOffset:!0})))])}}class nL extends nf{static{this.EVENT_NAMES_NAME="names"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("GetNames",new en(nL.EVENT_NAMES_NAME,q.of(nL.EVENT_NAMES_NAME,Y.ofArray(nL.EVENT_NAMES_NAME,Y.ofString(nL.EVENT_NAMES_NAME)))),new X(nL.PARAMETER_UNIT_NAME,Y.ofString(nL.PARAMETER_UNIT_NAME).setEnums(["TIMEZONES","MONTHS","WEEKDAYS"])),new X(nL.PARAMETER_LOCALE_NAME,Y.ofString(nL.PARAMETER_LOCALE_NAME).setDefaultValue("system")))}async internalExecute(e){let t=e.getArguments()?.get(nL.PARAMETER_UNIT_NAME),r=e.getArguments()?.get(nL.PARAMETER_LOCALE_NAME);return new eu([ea.outputOf(q.of(nL.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 nv extends e3{static{this.SIGNATURE=new eT("IsValidISODate").setNamespace(p.DATE).setParameters(new Map([X.ofEntry(nf.PARAMETER_TIMESTAMP_NAME,Y.ofString(nf.PARAMETER_TIMESTAMP_NAME))])).setEvents(new Map([en.outputEventMapEntry(q.of(nf.EVENT_RESULT_NAME,Y.ofBoolean(nf.EVENT_RESULT_NAME)))]))}internalExecute(e){let t=e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME),r=(0,l.DateTime).fromISO(t);return Promise.resolve(new eu([ea.outputOf(q.of(nf.EVENT_RESULT_NAME,r.isValid))]))}getSignature(){return nv.SIGNATURE}}class nU extends nf{static{this.PARAMETER_BASE_NAME="base"}static{this.PARAMETER_BASE=new X(nU.PARAMETER_BASE_NAME,Y.ofRef(p.DATE+".Timestamp").setDefaultValue(""))}static{this.PARAMETER_LOCALE_NAME="locale"}static{this.PARAMETER_LOCALE=new X(nU.PARAMETER_LOCALE_NAME,Y.ofString(nU.PARAMETER_LOCALE_NAME).setDefaultValue("system"))}static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_FORMAT=new X(nU.PARAMETER_FORMAT_NAME,Y.ofString(nU.PARAMETER_FORMAT_NAME).setEnums(["LONG","SHORT","NARROW"]).setDefaultValue("LONG"))}static{this.PARAMETER_ROUND_NAME="round"}static{this.PARAMETER_ROUND=new X(nU.PARAMETER_ROUND_NAME,Y.ofBoolean(nU.PARAMETER_ROUND_NAME).setDefaultValue(!0))}constructor(){super("FromNow",nf.EVENT_STRING,nf.PARAMETER_TIMESTAMP,nU.PARAMETER_FORMAT,nU.PARAMETER_BASE,nf.PARAMETER_VARIABLE_UNIT,nU.PARAMETER_ROUND,nU.PARAMETER_LOCALE)}internalExecute(e){let t=e.getArguments()?.get(nU.PARAMETER_BASE_NAME),r=""===t?(0,l.DateTime).now():(0,l.DateTime).fromISO(t),s=e.getArguments()?.get(nf.PARAMETER_TIMESTAMP_NAME),n=(0,l.DateTime).fromISO(s),a=e.getArguments()?.get(nU.PARAMETER_UNIT_NAME),i=e.getArguments()?.get(nU.PARAMETER_FORMAT_NAME),o=e.getArguments()?.get(nU.PARAMETER_ROUND_NAME),E=e.getArguments()?.get(nU.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(nf.EVENT_RESULT_NAME,n.toRelative(u)??"Unknown"))]))}}class nV extends nf{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_TIMESTAMP_STRING_NAME="timestampString"}constructor(){super("FromDateString",nf.EVENT_TIMESTAMP,X.of(nV.PARAMETER_TIMESTAMP_STRING_NAME,Y.ofString(nV.PARAMETER_TIMESTAMP_STRING_NAME)),X.of(nV.PARAMETER_FORMAT_NAME,Y.ofString(nV.PARAMETER_FORMAT_NAME)))}async internalExecute(e){let t=e.getArguments()?.get(nV.PARAMETER_TIMESTAMP_STRING_NAME),r=e.getArguments()?.get(nV.PARAMETER_FORMAT_NAME),s=(0,l.DateTime).fromFormat(t,r);return new eu([ea.outputOf(q.of(nf.EVENT_RESULT_NAME,s.toISO()))])}}class nC extends nf{constructor(){super("GetCurrentTimestamp",nf.EVENT_TIMESTAMP)}async internalExecute(e){return new eu([ea.outputOf(q.of(nf.EVENT_TIMESTAMP_NAME,(0,l.DateTime).now().toISO()))])}}class nD{static{this.repoMap=q.ofArrayEntries(["EpochSecondsToTimestamp",new nS("EpochSecondsToTimestamp",!0)],["EpochMillisecondsToTimestamp",new nS("EpochMillisecondsToTimestamp",!1)],nf.ofEntryTimestampAndIntegerOutput("GetDay",e=>n_(e).day),nf.ofEntryTimestampAndIntegerOutput("GetDayOfWeek",e=>n_(e).weekday),nf.ofEntryTimestampAndIntegerOutput("GetMonth",e=>n_(e).month),nf.ofEntryTimestampAndIntegerOutput("GetYear",e=>n_(e).year),nf.ofEntryTimestampAndIntegerOutput("GetHours",e=>n_(e).hour),nf.ofEntryTimestampAndIntegerOutput("GetMinutes",e=>n_(e).minute),nf.ofEntryTimestampAndIntegerOutput("GetSeconds",e=>n_(e).second),nf.ofEntryTimestampAndIntegerOutput("GetMilliseconds",e=>n_(e).millisecond),nf.ofEntryTimestampAndIntegerOutput("GetDaysInMonth",e=>n_(e).daysInMonth),nf.ofEntryTimestampAndIntegerOutput("GetDaysInYear",e=>n_(e).daysInYear),["TimestampToEpochSeconds",new nO("TimestampToEpochSeconds",!0)],["TimestampToEpochMilliseconds",new nO("TimestampToEpochMilliseconds",!1)],nf.ofEntryTimestampAndStringOutput("GetTimeZoneName",e=>n_(e).zoneName),nf.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetLong",e=>n_(e).offsetNameLong),nf.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetShort",e=>n_(e).offsetNameShort),nf.ofEntryTimestampAndIntegerOutput("GetTimeZoneOffset",e=>n_(e).offset),["ToDateString",new nw],["AddTime",new nM(!0)],["SubtractTime",new nM(!1)],["GetCurrentTimestamp",new nC],nf.ofEntryTimestampTimestampAndTOutput("Difference",new en(en.OUTPUT,q.of(nf.EVENT_RESULT_NAME,Y.ofRef(`${p.DATE}.Duration`))),(e,t,r)=>{let s;let n=n_(e),a=n_(t);r?.[0]?.length&&(s=r[0]?.filter(e=>!!e).map(e=>e.toLowerCase()));let i=n.diff(a);return s?.length?i.shiftTo(...s).toObject():i.toObject()},nf.PARAMETER_VARIABLE_UNIT),nf.ofEntryTimestampIntegerAndTimestampOutput("SetDay",(e,t)=>n_(e).set({day:t}).toISO()),nf.ofEntryTimestampIntegerAndTimestampOutput("SetMonth",(e,t)=>n_(e).set({month:t}).toISO()),nf.ofEntryTimestampIntegerAndTimestampOutput("SetYear",(e,t)=>n_(e).set({year:t}).toISO()),nf.ofEntryTimestampIntegerAndTimestampOutput("SetHours",(e,t)=>n_(e).set({hour:t}).toISO()),nf.ofEntryTimestampIntegerAndTimestampOutput("SetMinutes",(e,t)=>n_(e).set({minute:t}).toISO()),nf.ofEntryTimestampIntegerAndTimestampOutput("SetSeconds",(e,t)=>n_(e).set({second:t}).toISO()),nf.ofEntryTimestampIntegerAndTimestampOutput("SetMilliseconds",(e,t)=>n_(e).set({millisecond:t}).toISO()),["SetTimeZone",new nd],nf.ofEntryTimestampTimestampAndTOutput("IsBefore",new en(en.OUTPUT,q.of(nf.EVENT_RESULT_NAME,Y.ofBoolean(nf.EVENT_RESULT_NAME))),(e,t)=>n_(e)<n_(t)),nf.ofEntryTimestampTimestampAndTOutput("IsAfter",new en(en.OUTPUT,q.of(nf.EVENT_RESULT_NAME,Y.ofBoolean(nf.EVENT_RESULT_NAME))),(e,t)=>n_(e)>n_(t)),nf.ofEntryTimestampTimestampAndTOutput("IsSame",new en(en.OUTPUT,q.of(nf.EVENT_RESULT_NAME,Y.ofBoolean(nf.EVENT_RESULT_NAME))),(e,t)=>n_(e)===n_(t)),nf.ofEntryTimestampTimestampAndTOutput("IsSameOrBefore",new en(en.OUTPUT,q.of(nf.EVENT_RESULT_NAME,Y.ofBoolean(nf.EVENT_RESULT_NAME))),(e,t)=>n_(e)<=n_(t)),nf.ofEntryTimestampTimestampAndTOutput("IsSameOrAfter",new en(en.OUTPUT,q.of(nf.EVENT_RESULT_NAME,Y.ofBoolean(nf.EVENT_RESULT_NAME))),(e,t)=>n_(e)>=n_(t)),nf.ofEntryTimestampAndBooleanOutput("IsInLeapYear",e=>n_(e).isInLeapYear),nf.ofEntryTimestampAndBooleanOutput("IsInDST",e=>n_(e).isInDST),["IsBetween",new nI],["LastOf",new nP(!0)],["FirstOf",new nP(!1)],["StartOf",new nx(!0)],["EndOf",new nx(!1)],["TimeAsObject",new ny(!1)],["TimeAsArray",new ny(!0)],["GetNames",new nL],["IsValidISODate",new nv],["FromNow",new nU],["FromDateString",new nV])}static{this.filterableNames=Array.from(nD.repoMap.values()).map(e=>e.getSignature().getFullName())}find(e,t){return e!=p.DATE?Promise.resolve(void 0):Promise.resolve(nD.repoMap.get(t))}filter(e){return Promise.resolve(nD.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class nG extends e3{static{this.MILLIS="millis"}static{this.SIGNATURE=new eT("Wait").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(nG.MILLIS,Y.ofNumber(nG.MILLIS).setMinimum(0).setDefaultValue(0))])).setEvents(new Map([en.outputEventMapEntry(new Map)]))}getSignature(){return nG.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nG.MILLIS);return await new Promise(e=>setTimeout(e,t)),new eu([ea.outputOf(new Map)])}}var nb={};m(nb,"HybridRepository",()=>nF);class nF{constructor(...e){this.repos=e}async find(e,t){for(let r of this.repos){let s=await r.find(e,t);if(s)return s}}async filter(e){let t=new Set;for(let r of this.repos)(await r.filter(e)).forEach(e=>t.add(e));return Array.from(t)}}const nB=new Map([[p.SYSTEM_CTX,new Map([et(new class extends e3{getSignature(){return rs}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(rn);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 sR}async internalExecute(e){let t=e?.getArguments()?.get(sT);if(eM.isNullOrBlank(t))throw new eE("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get(sl),s=new tY(t),n=s.getTokens().peekLast();if(!n.getExpression().startsWith("Context")||n instanceof tY||n instanceof tb&&!n.getElement().toString().startsWith("Context"))throw new tr(ec.format("The context path $ is not a valid path in context",t));for(let e of s.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<s.getTokens().size();r++){let n=s.getTokens().get(r);n instanceof tY&&s.getTokens().set(r,new tb(t,new sA(n).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,s)}modifyContext(e,t,r,s){let n=s.getTokens();n.removeLast();let a=s.getOperations();a.removeLast();let i=e.getContext()?.get(n.removeLast().getExpression());if(_(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=n.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=n.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 s=parseInt(t);if(isNaN(s))throw new eE(ec.format("Expected an array index but found $",t));if(s<0)throw new eE(ec.format("Array index is out of bound - $",t));let n=e[s];return _(n)&&(n=r==tB.OBJECT_OPERATOR?{}:[],e[s]=n),n}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));let s=e[t];return _(s)&&(s=r==tB.OBJECT_OPERATOR?{}:[],e[t]=s),s}putDataInArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new eE(ec.format("Expected an array index but found $",t));if(s<0)throw new eE(ec.format("Array index is out of bound - $",t));e[s]=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 sV}async internalExecute(e){let t=e.getArguments()?.get(sx),r=e.getArguments()?.get("to"),s=e.getArguments()?.get(sL),n=s>0,a=t,i=!1,o=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(i)return;if(n&&a>=r||!n&&a<=r||o&&e.getExecutionContext()?.get(o))return i=!0,o&&e.getExecutionContext()?.delete(o),ea.outputOf(new Map([[sv,a]]));let t=ea.of(en.ITERATION,new Map([[sU,a]]));return a+=s,t}})}}),et(new class extends e3{getSignature(){return sO}async internalExecute(e){let t=e.getArguments()?.get(s_),r=0,s=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(r>=t||s&&e.getExecutionContext()?.get(s))return s&&e.getExecutionContext()?.delete(s),ea.outputOf(new Map([[sM,r]]));let n=ea.of(en.ITERATION,new Map([[sS,r]]));return++r,n}})}}),et(new class extends e3{getSignature(){return sf}async internalExecute(e){let t=e.getArguments()?.get(sN);return e.getExecutionContext().set(t,!0),new eu([ea.outputOf(new Map)])}}),et(new class extends e3{getSignature(){return sy}async internalExecute(e){let t=e.getArguments()?.get(sw),r=0,s=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(r>=t.length||s&&e.getExecutionContext()?.get(s))return s&&e.getExecutionContext()?.delete(s),ea.outputOf(new Map([[sP,r]]));let n=ea.of(en.ITERATION,new Map([[sI,r],[sd,t[r]]]));return++r,n}})}})])],[p.SYSTEM,new Map([et(new sp),et(new class extends e3{getSignature(){return sc}async internalExecute(e){let t=e.getEvents(),r=e.getArguments(),s=r?.get(sg),n=e?.getArguments()?.get(sh).map(t=>{let r=t[sm];if(_(r))throw new eE("Expect a value object");let s=r.value;return r.isExpression&&(s=new sA(s).evaluate(e.getValuesMap())),[t.name,s]}).reduce((e,t)=>(e.set(t[0],t[1]),e),new Map);return t?.has(s)||t?.set(s,[]),t?.get(s)?.push(n),new eu([ea.outputOf(new Map)])}}),et(new na),et(new nG),et(new t6)])]]),nY=Array.from(nB.values()).flatMap(e=>Array.from(e.values())).map(e=>e.getSignature().getFullName());class nH extends nF{constructor(){super({find:async(e,t)=>nB.get(e)?.get(t),filter:async e=>Array.from(nY).filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase()))},new sZ,new nN,new t7,new nn,new nD)}}var nk={};m(nk,"StatementExecution",()=>nW);var n$={};m(n$,"StatementMessage",()=>nj);class nj{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 nW{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 nj(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){return e instanceof nW&&e.statement.equals(this.statement)}}var nX={};m(nX,"ContextTokenValueExtractor",()=>nJ);class nJ extends tk{static{this.PREFIX="Context."}constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.context.get(r)?.getElement())}getPrefix(){return nJ.PREFIX}getStore(){return _(this.context)?this.context:Array.from(this.context.entries()).reduce((e,[t,r])=>(_(r)||(e[t]=r.getElement()),e),{})}}var nq={};m(nq,"OutputMapTokenValueExtractor",()=>nz);class nz extends tk{static{this.PREFIX="Steps."}constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=1,s=this.output.get(t[r++]);if(!s||r>=t.length)return;let n=s.get(t[r++]);if(!n||r>t.length)return;if(r===t.length)return n;let a=t[r].indexOf("[");if(-1===a){let s=n.get(t[r++]);return this.retrieveElementFrom(e,t,r,s)}let i=t[r].substring(0,a),o=n.get(i);return this.retrieveElementFrom(e,t,r,{[i]:o})}getPrefix(){return nz.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 nK={};m(nK,"ArgumentsTokenValueExtractor",()=>nQ);class nQ extends tk{static{this.PREFIX="Arguments."}constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.args.get(r))}getPrefix(){return nQ.PREFIX}getStore(){return _(this.args)?this.args:Array.from(this.args.entries()).reduce((e,[t,r])=>(e[t]=r,e),{})}}var nZ={};m(nZ,"GraphVertex",()=>n2);var n0={};m(n0,"ExecutionGraph",()=>n1);class n1{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 n2(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 n2{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 n1(!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 n9={};m(n9,"KIRuntime",()=>at);var n3={};m(n3,"JsonExpression",()=>n4);class n4{constructor(e){this.expression=e}getExpression(){return this.expression}}var n5={};m(n5,"ParameterReferenceType",()=>A),(n=A||(A={})).VALUE="VALUE",n.EXPRESSION="EXPRESSION";var n6={};function n7(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|8).toString(16)})}m(n6,"FunctionExecutionParameters",()=>n8);class n8{constructor(e,t,r){this.count=0,this.executionContext=new Map,this.valueExtractors=new Map,this.functionRepository=e,this.schemaRepository=t,this.executionId=r??n7()}getExecutionId(){return this.executionId}getContext(){return this.context}setContext(e){this.context=e;let t=new nJ(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 nz(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 n1;for(let s of Array.from(this.fd.getSteps().values()))r.addVertex(await this.prepareStatementExecution(s,e,t));return Array.from(this.makeEdges(r).getT2().entries()).forEach(e=>{let t=r.getNodeMap().get(e[0])?.getData();t&&t.addMessage(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 nQ(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 s=new ep;for(;(!r.isEmpty()||!s.isEmpty())&&!t.getEvents()?.has(en.OUTPUT);)if(await this.processBranchQue(t,r,s),await this.processExecutionQue(t,r,s),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(en.OUTPUT)?.getParameters()?.size)throw new eE("No events raised")}let n=Array.from(t.getEvents()?.entries()??[]).flatMap(e=>e[1].map(t=>ea.of(e[0],t)));return new eu(n.length||e.isSubGraph()?n:[ea.of(en.OUTPUT,new Map)])}async processExecutionQue(e,t,r){if(!t.isEmpty()){let s=t.pop();await this.allDependenciesResolvedVertex(s,e.getSteps())?await this.executeVertex(s,e,r,t,e.getFunctionRepository()):t.add(s)}}async processBranchQue(e,t,r){if(r.length){let s=r.pop();await this.allDependenciesResolvedTuples(s.getT2(),e.getSteps())?await this.executeBranch(e,t,s):r.add(s)}}async executeBranch(e,t,r){let s,n=r.getT4();do if(r.getT1().getVerticesData().map(e=>e.getStatement().getStatementName()).forEach(t=>e.getSteps()?.delete(t)),await this.executeGraph(r.getT1(),e),(s=r.getT3().next())&&(e.getSteps()?.has(n.getData().getStatement().getStatementName())||e.getSteps()?.set(n.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(n.getData().getStatement().getStatementName())?.set(s.getName(),this.resolveInternalExpressions(s.getResult(),e)),this.debugMode)){let t=n.getData().getStatement();console.log(`EID: ${e.getExecutionId()} Step : ${t.getStatementName()} => ${t.getNamespace()}.${t.getName()}`),console.log(`EID: ${e.getExecutionId()} Event : ${s.getName()} : `,e.getSteps().get(t.getStatementName()).get(s.getName()))}while(s&&s.getName()!=en.OUTPUT)s?.getName()==en.OUTPUT&&n.getOutVertices().has(en.OUTPUT)&&(n?.getOutVertices()?.get(en.OUTPUT)??[]).forEach(async r=>{await this.allDependenciesResolvedVertex(r,e.getSteps())&&t.add(r)})}async executeVertex(e,t,r,s,n){let a,i=e.getData().getStatement();if(i.getExecuteIftrue().size&&!(Array.from(i.getExecuteIftrue().entries())??[]).filter(e=>e[1]).map(([e])=>new sA(e).evaluate(t.getValuesMap())).every(e=>!_(e)&&!1!==e))return;let o=await n.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 n8(t.getFunctionRepository(),t.getSchemaRepository(),`${t.getExecutionId()}_${i.getStatementName()}`).setArguments(u).setValuesMap(new Map(Array.from(t.getValuesMap().values()).filter(e=>e.getPrefix()!==nQ.PREFIX&&e.getPrefix()!==nz.PREFIX&&e.getPrefix()!==nJ.PREFIX).map(e=>[e.getPrefix(),e]))):new n8(t.getFunctionRepository(),t.getSchemaRepository(),t.getExecutionId()).setValuesMap(t.getValuesMap()).setContext(A).setArguments(u).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount()).setExecutionContext(t.getExecutionContext());let T=await o.execute(a),l=T.next();if(!l)throw new eE(ec.format("Executing $ returned no events",i.getStatementName()));let R=l.getName()==en.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(en.OUTPUT);r&&r.forEach(async e=>{await this.allDependenciesResolvedVertex(e,t.getSteps())&&s.add(e)})}else{let t=e.getSubGraphOfType(l.getName()),s=this.makeEdges(t).getT1();r.push(new eI(t,s,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 n4)return new sA(e.getExpression()).evaluate(t.getValuesMap());if(Array.isArray(e)){let r=[];for(let s of e)r.push(this.resolveInternalExpression(s,t));return r}if("object"==typeof e){let r={};for(let s of Object.entries(e))r[s[0]]=this.resolveInternalExpression(s[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e)if(!t.has(r.getT1())||!t.get(r.getT1())?.get(r.getT2()))return!1;return!0}allDependenciesResolvedVertex(e,t){return!e.getInVertices().size||0==Array.from(e.getInVertices()).filter(e=>{let r=e.getT1().getData().getStatement().getStatementName(),s=e.getT2();return!(t.has(r)&&t.get(r)?.has(s))}).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map(t=>{let s,n=Array.from(t[1]?.values()??[]);if(!n?.length)return new ew(t[0],s);let a=r.get(t[0]);return a?(s=a.isVariableArgument()?n.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)).filter(e=>!_(e)).map(t=>this.parameterReferenceEvaluation(e,t)).flatMap(e=>Array.isArray(e)?e:[e]):this.parameterReferenceEvaluation(e,n[0]),new ew(t[0],s)):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 sA(t.getExpression()??"").evaluate(e.getValuesMap())),r}async prepareStatementExecution(e,t,r){let s=new nW(e),n=await t.find(e.getNamespace(),e.getName());if(!n)return s.addMessage(T.ERROR,ec.format("$.$ is not available",e.getNamespace(),e.getName())),Promise.resolve(s);let a=new Map(n.getSignature().getParameters());if(!e.getParameterMap())return Promise.resolve(s);for(let t of Array.from(e.getParameterMap().entries())){let e=a.get(t[0]);if(!e)continue;let n=Array.from(t[1]?.values()??[]);if(!n.length&&!e.isVariableArgument()){await ex.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||s.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,e.getParameterName())),a.delete(e.getParameterName());continue}if(e.isVariableArgument())for(let t of(n.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)),n))this.parameterReferenceValidation(s,e,t,r);else if(n.length){let t=n[0];this.parameterReferenceValidation(s,e,t,r)}a.delete(e.getParameterName())}if(!_(s.getStatement().getDependentStatements()))for(let e of Array.from(s.getStatement().getDependentStatements().entries()))e[1]&&s.addDependency(e[0]);if(!_(s.getStatement().getExecuteIftrue()))for(let e of Array.from(s.getStatement().getExecuteIftrue().entries()))e[1]&&this.addDependencies(s,e[0]);if(a.size)for(let e of Array.from(a.values()))e.isVariableArgument()||await ex.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||s.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return Promise.resolve(s)}async parameterReferenceValidation(e,t,r,s){if(r){if(r.getType()==A.VALUE){if(_(r.getValue())&&!await ex.hasDefaultValueOrNullSchemaType(t.getSchema(),s)&&e.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,t.getParameterName())),_(r.getValue()))return;let n=new ep;for(n.push(new ew(t.getSchema(),r.getValue()));!n.isEmpty();){let t=n.pop();if(t.getT2() instanceof n4)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())n.push(new ew(e.getSingleSchema(),r));else{let r=t.getT2();for(let t=0;t<r.length;t++)n.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])&&n.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(),s))&&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(),s))&&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=[],s=new Map;for(let n of Array.from(t))for(let t of Array.from(n.getData().getDependencies())){let a=t.indexOf(".",6),i=t.substring(6,a),o=t.indexOf(".",a+1),E=-1==o?t.substring(a+1):t.substring(a+1,o);e.getNodeMap().has(i)?n.addInEdgeTo(e.getNodeMap().get(i),E):(r.push(new ew(i,E)),s.set(n.getData().getStatement().getStatementName(),ec.format("Unable to find the step with name $",i)))}return new ew(r,s)}}var ar={};m(ar,"KIRunConstants",()=>as);class as{static{this.NAMESPACE="namespace"}static{this.NAME="name"}static{this.ID="id"}constructor(){}}var an={};m(an,"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=n7())}getType(){return this.type}setType(e){return this.type=e,this}getKey(){return this.key}setKey(e){return this.key=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}getExpression(){return this.expression}setExpression(e){return this.expression=e,this}setOrder(e){return this.order=e,this}getOrder(){return this.order}static ofExpression(e){let t=new 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(en.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,en.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,se),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,rd),R(af,rP),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,nk),R(module.exports,n$),R(module.exports,t8),R(module.exports,nX),R(module.exports,nq),R(module.exports,nK),R(module.exports,nZ),R(module.exports,{}),R(module.exports,n0),R(module.exports,n9),R(module.exports,ae),R(module.exports,n6),R(module.exports,tx),R(module.exports,tH),R(module.exports,sr),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,n3),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,eP),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,d),R(module.exports,S),R(module.exports,eS),R(module.exports,ej),R(module.exports,nb),R(module.exports,ar),R(module.exports,H),R(module.exports,ei),R(module.exports,an),R(module.exports,ai),R(module.exports,n5),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,es),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,sa);
|
|
1
|
+
var e,t,r,s,n,a,i=require("luxon");function o(e,t){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e}function E(e,t,r,s){Object.defineProperty(e,t,{get:r,set:s,enumerable:!0,configurable:!0})}var u={};E(u,"KIRunSchemaRepository",()=>X);var A={};E(A,"AdditionalType",()=>C),E(A,"Schema",()=>D);var T={};E(T,"Namespaces",()=>l);class l{static{this.SYSTEM="System"}static{this.SYSTEM_CTX="System.Context"}static{this.SYSTEM_LOOP="System.Loop"}static{this.SYSTEM_ARRAY="System.Array"}static{this.SYSTEM_OBJECT="System.Object"}static{this.MATH="System.Math"}static{this.STRING="System.String"}static{this.DATE="System.Date"}constructor(){}}var m={};E(m,"ArraySchemaType",()=>g);var h={};function R(e){return null==e}E(h,"isNullValue",()=>R);class g{constructor(e){if(!e)return;this.singleSchema=e.singleSchema?new D(e.singleSchema):void 0,this.tupleSchema=e.tupleSchema?e.tupleSchema.map(e=>new D(e)):void 0}setSingleSchema(e){return this.singleSchema=e,this}setTupleSchema(e){return this.tupleSchema=e,this}getSingleSchema(){return this.singleSchema}getTupleSchema(){return this.tupleSchema}isSingleType(){return!R(this.singleSchema)}static of(...e){return 1==e.length?new g().setSingleSchema(e[0]):new g().setTupleSchema(e)}static from(e){if(!e)return;if(Array.isArray(e))return new g().setTupleSchema(D.fromListOfSchemas(e));let t=Object.keys(e);if(-1!=t.indexOf("singleSchema"))return new g().setSingleSchema(D.from(e.singleSchema));if(-1!=t.indexOf("tupleSchema"))return new g().setTupleSchema(D.fromListOfSchemas(e.tupleSchema));let r=D.from(e);if(r)return new g().setSingleSchema(r)}}var c={};E(c,"SchemaType",()=>p);var p=((e={}).INTEGER="Integer",e.LONG="Long",e.FLOAT="Float",e.DOUBLE="Double",e.STRING="String",e.OBJECT="Object",e.ARRAY="Array",e.BOOLEAN="Boolean",e.NULL="Null",e),N={};E(N,"TypeUtil",()=>d);var f={};E(f,"MultipleType",()=>S);var _={};E(_,"Type",()=>M);class M{}class S extends M{constructor(e){super(),e instanceof S?this.type=new Set(Array.from(e.type)):this.type=new Set(Array.from(e))}getType(){return this.type}setType(e){return this.type=e,this}getAllowedSchemaTypes(){return this.type}contains(e){return this.type?.has(e)}}var O={};E(O,"SingleType",()=>w);class w extends M{constructor(e){super(),e instanceof w?this.type=e.type:this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class d{static of(...e){return 1==e.length?new w(e[0]):new S(new Set(e))}static from(e){return"string"==typeof e?new w(p[d.fromJSONType(e)]):Array.isArray(e)?new S(new Set(e.map(d.fromJSONType).map(e=>e).map(e=>p[e]))):void 0}static fromJSONType(e){let t=e.toUpperCase();return"NUMBER"===t?"DOUBLE":t}}const P="additionalProperty",I="additionalItems",y="enums",x="items",L="System.Schema",v="required",U="version",V="namespace";class C{constructor(e){if(!e||(this.booleanValue=e.booleanValue,!e.schemaValue))return;this.schemaValue=new D(e.schemaValue)}getBooleanValue(){return this.booleanValue}getSchemaValue(){return this.schemaValue}setBooleanValue(e){return this.booleanValue=e,this}setSchemaValue(e){return this.schemaValue=e,this}static from(e){if(R(e))return;let t=new C;if("boolean"==typeof e)t.booleanValue=e;else{let r=Object.keys(e);-1!=r.indexOf("booleanValue")?t.booleanValue=e.booleanValue:-1!=r.indexOf("schemaValue")?t.schemaValue=D.from(e.schemaValue):t.schemaValue=D.from(e)}return t}}class D{static{this.NULL=new D().setNamespace(l.SYSTEM).setName("Null").setType(d.of(p.NULL)).setConstant(void 0)}static{this.TYPE_SCHEMA=new D().setType(d.of(p.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"])}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName("Schema").setType(d.of(p.OBJECT)).setProperties(new Map([[V,D.of(V,p.STRING).setDefaultValue("_")],["name",D.ofString("name")],[U,D.of(U,p.INTEGER).setDefaultValue(1)],["ref",D.ofString("ref")],["type",new D().setAnyOf([D.TYPE_SCHEMA,D.ofArray("type",D.TYPE_SCHEMA)])],["anyOf",D.ofArray("anyOf",D.ofRef(L))],["allOf",D.ofArray("allOf",D.ofRef(L))],["oneOf",D.ofArray("oneOf",D.ofRef(L))],["not",D.ofRef(L)],["title",D.ofString("title")],["description",D.ofString("description")],["id",D.ofString("id")],["examples",D.ofAny("examples")],["defaultValue",D.ofAny("defaultValue")],["comment",D.ofString("comment")],[y,D.ofArray(y,D.ofString(y))],["constant",D.ofAny("constant")],["pattern",D.ofString("pattern")],["format",D.of("format",p.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",D.ofInteger("minLength")],["maxLength",D.ofInteger("maxLength")],["multipleOf",D.ofLong("multipleOf")],["minimum",D.ofNumber("minimum")],["maximum",D.ofNumber("maximum")],["exclusiveMinimum",D.ofNumber("exclusiveMinimum")],["exclusiveMaximum",D.ofNumber("exclusiveMaximum")],["properties",D.of("properties",p.OBJECT).setAdditionalProperties(new C().setSchemaValue(D.ofRef(L)))],["additionalProperties",new D().setName(P).setNamespace(l.SYSTEM).setAnyOf([D.ofBoolean(P),D.ofObject(P).setRef(L)]).setDefaultValue(!0)],[v,D.ofArray(v,D.ofString(v)).setDefaultValue([])],["propertyNames",D.ofRef(L)],["minProperties",D.ofInteger("minProperties")],["maxProperties",D.ofInteger("maxProperties")],["patternProperties",D.of("patternProperties",p.OBJECT).setAdditionalProperties(new C().setSchemaValue(D.ofRef(L)))],[x,new D().setName(x).setAnyOf([D.ofRef(L).setName("item"),D.ofArray("tuple",D.ofRef(L))])],["contains",D.ofRef(L)],["minContains",D.ofInteger("minContains")],["maxContains",D.ofInteger("maxContains")],["minItems",D.ofInteger("minItems")],["maxItems",D.ofInteger("maxItems")],["uniqueItems",D.ofBoolean("uniqueItems")],["additionalItems",new D().setName(I).setNamespace(l.SYSTEM).setAnyOf([D.ofBoolean(I),D.ofObject(I).setRef(L)])],["$defs",D.of("$defs",p.OBJECT).setAdditionalProperties(new C().setSchemaValue(D.ofRef(L)))],["permission",D.ofString("permission")],["details",D.ofObject("details")]])).setRequired([])}static ofString(e){return new D().setType(d.of(p.STRING)).setName(e)}static ofInteger(e){return new D().setType(d.of(p.INTEGER)).setName(e)}static ofFloat(e){return new D().setType(d.of(p.FLOAT)).setName(e)}static ofLong(e){return new D().setType(d.of(p.LONG)).setName(e)}static ofDouble(e){return new D().setType(d.of(p.DOUBLE)).setName(e)}static ofAny(e){return new D().setType(d.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE,p.STRING,p.BOOLEAN,p.ARRAY,p.NULL,p.OBJECT)).setName(e)}static ofAnyNotNull(e){return new D().setType(d.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE,p.STRING,p.BOOLEAN,p.ARRAY,p.OBJECT)).setName(e)}static ofNumber(e){return new D().setType(d.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE)).setName(e)}static ofBoolean(e){return new D().setType(d.of(p.BOOLEAN)).setName(e)}static of(e,...t){return new D().setType(d.of(...t)).setName(e)}static ofObject(e){return new D().setType(d.of(p.OBJECT)).setName(e)}static ofRef(e){return new D().setRef(e)}static ofArray(e,...t){return new D().setType(d.of(p.ARRAY)).setName(e).setItems(g.of(...t))}static fromListOfSchemas(e){if(R(e)&&!Array.isArray(e))return;let t=[];for(let r of Array.from(e)){let e=D.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(R(e))return;let t=new Map;return Object.entries(e).forEach(([e,r])=>{let s=D.from(r);s&&t.set(e,s)}),t}static from(e,t=!1){if(R(e))return;let r=new D;return r.namespace=e.namespace??"_",r.name=e.name,r.version=e.version??1,r.ref=e.ref,t?r.type=new w(p.STRING):r.type=d.from(e.type),r.anyOf=D.fromListOfSchemas(e.anyOf),r.allOf=D.fromListOfSchemas(e.allOf),r.oneOf=D.fromListOfSchemas(e.oneOf),r.not=D.from(e.not),r.description=e.description,r.examples=e.examples?[...e.examples]:void 0,r.defaultValue=e.defaultValue,r.comment=e.comment,r.enums=e.enums?[...e.enums]:void 0,r.constant=e.constant,r.pattern=e.pattern,r.format=e.format,r.minLength=e.minLength,r.maxLength=e.maxLength,r.multipleOf=e.multipleOf,r.minimum=e.minimum,r.maximum=e.maximum,r.exclusiveMinimum=e.exclusiveMinimum,r.exclusiveMaximum=e.exclusiveMaximum,r.properties=D.fromMapOfSchemas(e.properties),r.additionalProperties=C.from(e.additionalProperties),r.required=e.required,r.propertyNames=D.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=D.fromMapOfSchemas(e.patternProperties),r.items=g.from(e.items),r.additionalItems=C.from(e.additionalItems),r.contains=D.from(e.contains),r.minContains=e.minContains,r.maxContains=e.maxContains,r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=D.fromMapOfSchemas(e.$defs),r.permission=e.permission,r.details=e.details?new Map(Object.entries(e.details)):void 0,r}constructor(e){if(this.namespace="_",this.version=1,!e)return;this.namespace=e.namespace,this.name=e.name,this.version=e.version,this.ref=e.ref,R(e.type)||(this.type=e.type instanceof w?new w(e.type):new S(e.type)),this.anyOf=e.anyOf?.map(e=>new D(e)),this.allOf=e.allOf?.map(e=>new D(e)),this.oneOf=e.oneOf?.map(e=>new D(e)),this.not=this.not?new D(this.not):void 0,this.description=e.description,this.examples=e.examples?JSON.parse(JSON.stringify(e.examples)):void 0,this.defaultValue=e.defaultValue?JSON.parse(JSON.stringify(e.defaultValue)):void 0,this.comment=e.comment,this.enums=e.enums?[...e.enums]:void 0,this.constant=e.constant?JSON.parse(JSON.stringify(e.constant)):void 0,this.pattern=e.pattern,this.format=e.format,this.minLength=e.minLength,this.maxLength=e.maxLength,this.multipleOf=e.multipleOf,this.minimum=e.minimum,this.maximum=e.maximum,this.exclusiveMinimum=e.exclusiveMinimum,this.exclusiveMaximum=e.exclusiveMaximum,this.properties=e.properties?new Map(Array.from(e.properties.entries()).map(e=>[e[0],new D(e[1])])):void 0,this.additionalProperties=e.additionalProperties?new C(e.additionalProperties):void 0,this.required=e.required?[...e.required]:void 0,this.propertyNames=e.propertyNames?new D(e.propertyNames):void 0,this.minProperties=e.minProperties,this.maxProperties=e.maxProperties,this.patternProperties=e.patternProperties?new Map(Array.from(e.patternProperties.entries()).map(e=>[e[0],new D(e[1])])):void 0,this.items=e.items?new g(e.items):void 0,this.contains=e.contains?new D(this.contains):void 0,this.minContains=e.minContains,this.maxContains=e.maxContains,this.minItems=e.minItems,this.maxItems=e.maxItems,this.uniqueItems=e.uniqueItems,this.additionalItems=e.additionalItems?new C(e.additionalItems):void 0,this.$defs=e.$defs?new Map(Array.from(e.$defs.entries()).map(e=>[e[0],new D(e[1])])):void 0,this.permission=e.permission,this.details=e.details?new Map(JSON.parse(JSON.stringify(Array.from(e.details.values())))):void 0}getTitle(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}getFullName(){return this.namespace+"."+this.name}get$defs(){return this.$defs}set$defs(e){return this.$defs=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getVersion(){return this.version}setVersion(e){return this.version=e,this}getRef(){return this.ref}setRef(e){return this.ref=e,this}getType(){return this.type}setType(e){return this.type=e,this}getAnyOf(){return this.anyOf}setAnyOf(e){return this.anyOf=e,this}getAllOf(){return this.allOf}setAllOf(e){return this.allOf=e,this}getOneOf(){return this.oneOf}setOneOf(e){return this.oneOf=e,this}getNot(){return this.not}setNot(e){return this.not=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getExamples(){return this.examples}setExamples(e){return this.examples=e,this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}getComment(){return this.comment}setComment(e){return this.comment=e,this}getEnums(){return this.enums}setEnums(e){return this.enums=e,this}getConstant(){return this.constant}setConstant(e){return this.constant=e,this}getPattern(){return this.pattern}setPattern(e){return this.pattern=e,this}getFormat(){return this.format}setFormat(e){return this.format=e,this}getMinLength(){return this.minLength}setMinLength(e){return this.minLength=e,this}getMaxLength(){return this.maxLength}setMaxLength(e){return this.maxLength=e,this}getMultipleOf(){return this.multipleOf}setMultipleOf(e){return this.multipleOf=e,this}getMinimum(){return this.minimum}setMinimum(e){return this.minimum=e,this}getMaximum(){return this.maximum}setMaximum(e){return this.maximum=e,this}getExclusiveMinimum(){return this.exclusiveMinimum}setExclusiveMinimum(e){return this.exclusiveMinimum=e,this}getExclusiveMaximum(){return this.exclusiveMaximum}setExclusiveMaximum(e){return this.exclusiveMaximum=e,this}getProperties(){return this.properties}setProperties(e){return this.properties=e,this}getAdditionalProperties(){return this.additionalProperties}setAdditionalProperties(e){return this.additionalProperties=e,this}getAdditionalItems(){return this.additionalItems}setAdditionalItems(e){return this.additionalItems=e,this}getRequired(){return this.required}setRequired(e){return this.required=e,this}getPropertyNames(){return this.propertyNames}setPropertyNames(e){return this.propertyNames=e,this.propertyNames.type=new w(p.STRING),this}getMinProperties(){return this.minProperties}setMinProperties(e){return this.minProperties=e,this}getMaxProperties(){return this.maxProperties}setMaxProperties(e){return this.maxProperties=e,this}getPatternProperties(){return this.patternProperties}setPatternProperties(e){return this.patternProperties=e,this}getItems(){return this.items}setItems(e){return this.items=e,this}getContains(){return this.contains}setContains(e){return this.contains=e,this}getMinContains(){return this.minContains}setMinContains(e){return this.minContains=e,this}getMaxContains(){return this.maxContains}setMaxContains(e){return this.maxContains=e,this}getMinItems(){return this.minItems}setMinItems(e){return this.minItems=e,this}getMaxItems(){return this.maxItems}setMaxItems(e){return this.maxItems=e,this}getUniqueItems(){return this.uniqueItems}setUniqueItems(e){return this.uniqueItems=e,this}getPermission(){return this.permission}setPermission(e){return this.permission=e,this}getDetails(){return this.details}setDetails(e){return this.details=e,this}}var b={};E(b,"Parameter",()=>k);var G={};E(G,"SchemaReferenceException",()=>F);class F extends Error{constructor(e,t,r){super(e.trim()?e+"-"+t:t),this.schemaPath=e,this.cause=r}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}var B={};E(B,"ParameterType",()=>Y);var Y=((t={}).CONSTANT="CONSTANT",t.EXPRESSION="EXPRESSION",t);const H="value";class k{static{this.SCHEMA_NAME="Parameter"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(k.SCHEMA_NAME).setProperties(new Map([["schema",D.SCHEMA],["parameterName",D.ofString("parameterName")],["variableArgument",D.of("variableArgument",p.BOOLEAN).setDefaultValue(!1)],["type",D.ofString("type").setEnums(["EXPRESSION","CONSTANT"])]]))}static{this.EXPRESSION=new D().setNamespace(l.SYSTEM).setName("ParameterExpression").setType(d.of(p.OBJECT)).setProperties(new Map([["isExpression",D.ofBoolean("isExpression").setDefaultValue(!0)],[H,D.ofAny(H)]]))}constructor(e,t){if(this.variableArgument=!1,this.type=Y.EXPRESSION,e instanceof k)this.schema=new D(e.schema),this.parameterName=e.parameterName,this.variableArgument=e.variableArgument,this.type=e.type;else{if(!t)throw Error("Unknown constructor signature");this.schema=t,this.parameterName=e}}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getParameterName(){return this.parameterName}setParameterName(e){return this.parameterName=e,this}isVariableArgument(){return this.variableArgument}setVariableArgument(e){return this.variableArgument=e,this}getType(){return this.type}setType(e){return this.type=e,this}static ofEntry(e,t,r=!1,s=Y.EXPRESSION){return[e,new k(e,t).setType(s).setVariableArgument(r)]}static of(e,t,r=!1,s=Y.EXPRESSION){return new k(e,t).setType(s).setVariableArgument(r)}static from(e){let t=D.from(e.schema);if(!t)throw new F("","Parameter requires Schema");return new k(e.parameterName,t).setVariableArgument(!!e.variableArgument).setType(e.type??Y.EXPRESSION)}}var $={};E($,"MapUtil",()=>j),E($,"MapEntry",()=>W);class j{static of(e,t,r,s,n,a,i,o,E,u,A,T,l,m,h,g,c,p,N,f){let _=new Map;return R(e)||R(t)||_.set(e,t),R(r)||R(s)||_.set(r,s),R(n)||R(a)||_.set(n,a),R(i)||R(o)||_.set(i,o),R(E)||R(u)||_.set(E,u),R(A)||R(T)||_.set(A,T),R(l)||R(m)||_.set(l,m),R(h)||R(g)||_.set(h,g),R(c)||R(p)||_.set(c,p),R(N)||R(f)||_.set(N,f),_}static ofArrayEntries(...e){let t=new Map;for(let[r,s]of e)t.set(r,s);return t}static entry(e,t){return new W(e,t)}static ofEntries(...e){let t=new Map;for(let r of e)t.set(r.k,r.v);return t}static ofEntriesArray(...e){let t=new Map;for(let r=0;r<e.length;r++)t.set(e[r][0],e[r][1]);return t}constructor(){}}class W{constructor(e,t){this.k=e,this.v=t}}class X{constructor(){this.map=new Map([["any",D.ofAny("any").setNamespace(l.SYSTEM)],["boolean",D.ofBoolean("boolean").setNamespace(l.SYSTEM)],["double",D.ofDouble("double").setNamespace(l.SYSTEM)],["float",D.ofFloat("float").setNamespace(l.SYSTEM)],["integer",D.ofInteger("integer").setNamespace(l.SYSTEM)],["long",D.ofLong("long").setNamespace(l.SYSTEM)],["number",D.ofNumber("number").setNamespace(l.SYSTEM)],["string",D.ofString("string").setNamespace(l.SYSTEM)],["Timestamp",D.ofString("Timestamp").setNamespace(l.DATE)],["Timeunit",D.ofString("Timeunit").setNamespace(l.DATE).setEnums(["YEARS","QUARTERS","MONTHS","WEEKS","DAYS","HOURS","MINUTES","SECONDS","MILLISECONDS"])],["Duration",D.ofObject("Duration").setNamespace(l.DATE).setProperties(j.ofArrayEntries(["years",D.ofNumber("years")],["quarters",D.ofNumber("quarters")],["months",D.ofNumber("months")],["weeks",D.ofNumber("weeks")],["days",D.ofNumber("days")],["hours",D.ofNumber("hours")],["minutes",D.ofNumber("minutes")],["seconds",D.ofNumber("seconds")],["milliseconds",D.ofNumber("milliseconds")])).setAdditionalItems(C.from(!1))],["TimeObject",D.ofObject("TimeObject").setNamespace(l.DATE).setProperties(j.ofArrayEntries(["year",D.ofNumber("year")],["month",D.ofNumber("month")],["day",D.ofNumber("day")],["hour",D.ofNumber("hour")],["minute",D.ofNumber("minute")],["second",D.ofNumber("second")],["millisecond",D.ofNumber("millisecond")])).setAdditionalItems(C.from(!1))],[k.EXPRESSION.getName(),k.EXPRESSION],[D.NULL.getName(),D.NULL],[D.SCHEMA.getName(),D.SCHEMA]]),this.filterableNames=Array.from(this.map.values()).map(e=>e.getFullName())}async find(e,t){return l.SYSTEM!=e&&l.DATE!=e?Promise.resolve(void 0):Promise.resolve(this.map.get(t))}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var J={};function q(e){return[e.getSignature().getName(),e]}E(J,"KIRunFunctionRepository",()=>nD);var z={};E(z,"EventResult",()=>Z);var K={};E(K,"Event",()=>Q);class Q{static{this.OUTPUT="output"}static{this.ERROR="error"}static{this.ITERATION="iteration"}static{this.TRUE="true"}static{this.FALSE="false"}static{this.SCHEMA_NAME="Event"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(Q.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["name",D.ofString("name")],["parameters",D.ofObject("parameter").setAdditionalProperties(new C().setSchemaValue(D.SCHEMA))]]))}constructor(e,t){if(e instanceof Q)this.name=e.name,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new D(e[1])]));else{if(this.name=e,!t)throw Error("Unknown constructor format");this.parameters=t}}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}static outputEventMapEntry(e){return Q.eventMapEntry(Q.OUTPUT,e)}static eventMapEntry(e,t){return[e,new Q(e,t)]}static from(e){return new Q(e.name,new Map(Object.entries(e.parameters??{}).map(e=>{let t=D.from(e[1]);if(!t)throw new F("","Event expects a schema");return[e[0],t]})))}}class Z{constructor(e,t){this.name=e,this.result=t}getName(){return this.name}setName(e){return this.name=e,this}getResult(){return this.result}setResult(e){return this.result=e,this}static outputOf(e){return Z.of(Q.OUTPUT,e)}static of(e,t){return new Z(e,t)}}var ee={};E(ee,"FunctionOutput",()=>es);var et={};E(et,"KIRuntimeException",()=>er);class er extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class es{constructor(e){if(this.index=0,R(e))throw new er("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof Z?this.fo=e:(this.fo=[],Array.isArray(e)||(this.generator=e))}next(){if(!this.generator)return this.index<this.fo.length?this.fo[this.index++]:void 0;let e=this.generator.next();return e&&this.fo.push(e),e}allResults(){return this.fo}}var en={};E(en,"FunctionSignature",()=>ea);class ea{static{this.SCHEMA_NAME="FunctionSignature"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(ea.SCHEMA_NAME).setProperties(new Map([["name",D.ofString("name")],["namespace",D.ofString("namespace")],["parameters",D.ofObject("parameters").setAdditionalProperties(new C().setSchemaValue(k.SCHEMA))],["events",D.ofObject("events").setAdditionalProperties(new C().setSchemaValue(Q.SCHEMA))]]))}constructor(e){this.namespace="_",this.parameters=new Map,this.events=new Map,e instanceof ea?(this.name=e.name,this.namespace=e.namespace,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new k(e[1])])),this.events=new Map(Array.from(e.events.entries()).map(e=>[e[0],new Q(e[1])]))):this.name=e}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getFullName(){return this.namespace+"."+this.name}}var ei={};E(ei,"AbstractFunction",()=>e0);var eo={};E(eo,"SchemaValidator",()=>eZ);var eE={};E(eE,"deepEqual",()=>eh);var eu={};E(eu,"LinkedList",()=>el);var eA={};E(eA,"StringFormatter",()=>eT);class eT{static format(e,...t){if(!t||0==t.length)return e;let r="",s=0,n="",a=n,i=e.length;for(let o=0;o<i;o++)"$"==(n=e.charAt(o))&&"\\"==a?r=r.substring(0,o-1)+n:"$"==n&&s<t.length?r+=t[s++]:r+=n,a=n;return r.toString()}constructor(){}}class el{constructor(e){if(this.head=void 0,this.tail=void 0,this.length=0,e?.length){for(let t of e)if(this.head){let e=new em(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new em(t);this.length=e.length}}push(e){let t=new em(e,void 0,this.head);this.head?(this.head.previous=t,this.head=t):this.tail=this.head=t,this.length++}pop(){if(!this.head)throw Error("List is empty and cannot pop further.");let e=this.head.value;if(this.length--,this.head==this.tail)return this.head=this.tail=void 0,e;let t=this.head;return this.head=t.next,t.next=void 0,t.previous=void 0,this.head.previous=void 0,e}isEmpty(){return!this.length}size(){return this.length}get(e){if(e<0||e>=this.length)throw Error(`${e} is out of bounds [0,${this.length}]`);let t=this.head;for(;e>0;)t=this.head.next,--e;return t.value}set(e,t){if(e<0||e>=this.length)throw new er(eT.format("Index $ out of bound to set the value in linked list.",e));let r=this.head;for(;e>0;)r=this.head.next,--e;return r.value=t,this}toString(){let e=this.head,t="";for(;e;)t+=e.value,(e=e.next)&&(t+=", ");return`[${t}]`}toArray(){let e=[],t=this.head;for(;t;)e.push(t.value),t=t.next;return e}peek(){if(!this.head)throw Error("List is empty so cannot peak");return this.head.value}peekLast(){if(!this.tail)throw Error("List is empty so cannot peak");return this.tail.value}getFirst(){if(!this.head)throw Error("List is empty so cannot get first");return this.head.value}removeFirst(){return this.pop()}removeLast(){if(!this.tail)throw Error("List is empty so cannot remove");--this.length;let e=this.tail.value;if(0==this.length)this.head=this.tail=void 0;else{let e=this.tail.previous;e.next=void 0,this.tail.previous=void 0,this.tail=e}return e}addAll(e){return e&&e.length&&e.forEach(this.add.bind(this)),this}add(e){return++this.length,this.tail||this.head?this.head===this.tail?(this.tail=new em(e,this.head),this.head.next=this.tail):(this.tail=new em(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new em(e),this}map(e,t){let r=new el,s=this.head,n=0;for(;s;)r.add(e(s.value,n)),s=s.next,++n;return r}indexOf(e){let t=this.head,r=0;for(;t;){if(eh(t.value,e))return r;t=t.next,++r}return -1}forEach(e,t){let r=this.head,s=0;for(;r;)e(r.value,s),r=r.next,++s}}class em{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}function eh(e,t){let r=new el;r.push(e);let s=new el;for(s.push(t);!r.isEmpty()&&!s.isEmpty();){let e=r.pop(),t=s.pop();if(e===t)continue;let n=typeof e,a=typeof t;if("undefined"===n||"undefined"===a){if(!e&&!t)continue;return!1}if(n!==a)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!=t.length)return!1;for(let n=0;n<e.length;n++)r.push(e[n]),s.push(t[n]);continue}if("object"===n){if("object"!==a||null===e||null===t)return!1;let n=Object.entries(e),i=Object.entries(t);if(n.length!==i.length)return!1;for(let[e,a]of n)r.push(a),s.push(t[e]);continue}return!1}return!0}var eR={};E(eR,"StringUtil",()=>eg);class eg{constructor(){}static nthIndex(e,t,r=0,s){if(!e)throw new er("String cannot be null");if(r<0||r>=e.length)throw new er(eT.format("Cannot search from index : $",r));if(s<=0||s>e.length)throw new er(eT.format("Cannot search for occurance : $",s));for(;r<e.length;){if(e.charAt(r)==t&&0==--s)return r;++r}return -1}static splitAtFirstOccurance(e,t){if(!e)return[void 0,void 0];let r=e.indexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static splitAtLastOccurance(e,t){if(!e)return[void 0,void 0];let r=e.lastIndexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static isNullOrBlank(e){return!e||""==e.trim()}}var ec={};E(ec,"SchemaUtil",()=>eO);var ep={};E(ep,"Tuple2",()=>eN),E(ep,"Tuple3",()=>ef),E(ep,"Tuple4",()=>e_);class eN{constructor(e,t){this.f=e,this.s=t}getT1(){return this.f}getT2(){return this.s}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}}class ef extends eN{constructor(e,t,r){super(e,t),this.t=r}getT3(){return this.t}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}setT3(e){return this.t=e,this}}class e_ extends ef{constructor(e,t,r,s){super(e,t,r),this.fr=s}getT4(){return this.fr}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}setT3(e){return this.t=e,this}setT4(e){return this.fr=e,this}}var eM={};E(eM,"SchemaValidationException",()=>eS);class eS extends Error{constructor(e,t,r=[],s){super(t+(r?r.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.cause=s}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class eO{static{this.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH="Unable to retrive schema from referenced path"}static{this.CYCLIC_REFERENCE_LIMIT_COUNTER=20}static async getDefaultValue(e,t){if(e)return e.getConstant()?e.getConstant():R(e.getDefaultValue())?eO.getDefaultValue(await eO.getSchemaFromRef(e,t,e.getRef()),t):e.getDefaultValue()}static async hasDefaultValueOrNullSchemaType(e,t){return e?e.getConstant()||!R(e.getDefaultValue())?Promise.resolve(!0):R(e.getRef())?e.getType()?.getAllowedSchemaTypes().has(p.NULL)?Promise.resolve(!0):Promise.resolve(!1):this.hasDefaultValueOrNullSchemaType(await eO.getSchemaFromRef(e,t,e.getRef()),t):Promise.resolve(!1)}static async getSchemaFromRef(e,t,r,s=0){if(++s==eO.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new eS(r??"","Schema has a cyclic reference");if(!e||!r||eg.isNullOrBlank(r))return Promise.resolve(void 0);if(!r.startsWith("#")){var n=await eO.resolveExternalSchema(e,t,r);n&&(e=n.getT1(),r=n.getT2())}let a=r.split("/");return 1===a.length?Promise.resolve(e):Promise.resolve(eO.resolveInternalSchema(e,t,r,s,a,1))}static async resolveInternalSchema(e,t,r,s,n,a){let i=e;if(a!==n.length){for(;a<n.length;){if("$defs"===n[a]){if(++a>=n.length||!i.get$defs())throw new F(r,eO.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);i=i.get$defs()?.get(n[a])}else{if(i&&(!i.getType()?.contains(p.OBJECT)||!i.getProperties()))throw new F(r,"Cannot retrievie schema from non Object type schemas");i=i.getProperties()?.get(n[a])}if(a++,!i||!eg.isNullOrBlank(i.getRef())&&!(i=await eO.getSchemaFromRef(i,t,i.getRef(),s)))throw new F(r,eO.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return Promise.resolve(i)}}static async resolveExternalSchema(e,t,r){if(!t)return Promise.resolve(void 0);let s=eg.splitAtFirstOccurance(r??"","/");if(!s[0])return Promise.resolve(void 0);let n=eg.splitAtLastOccurance(s[0],".");if(!n[0]||!n[1])return Promise.resolve(void 0);let a=await t.find(n[0],n[1]);if(!a)return Promise.resolve(void 0);if(!s[1]||""===s[1])return Promise.resolve(new eN(a,r));if(r="#/"+s[1],!a)throw new F(r,eO.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return Promise.resolve(new eN(a,r))}constructor(){}}var ew={};E(ew,"AnyOfAllOfOneOfValidator",()=>ed);class ed{static async validate(e,t,r,s,n,a){let i=[];return t.getOneOf()&&!t.getOneOf()?await ed.oneOf(e,t,r,s,i,n,a):t.getAllOf()&&!t.getAllOf()?await ed.allOf(e,t,r,s,i,n,a):t.getAnyOf()&&!t.getAnyOf()?await ed.anyOf(e,t,r,s,i,n,a):s}static async anyOf(e,t,r,s,n,a,i){let o=!1;for(let E of t.getAnyOf()??[])try{await ed.validate(e,E,r,s,a,i),o=!0;break}catch(e){o=!1,n.push(e)}if(o)return s;throw new eS(eZ.path(e),"The value don't satisfy any of the schemas.",n)}static async allOf(e,t,r,s,n,a,i){let o=0;for(let E of t.getAllOf()??[])try{await ed.validate(e,E,r,s,a,i),o++}catch(e){n.push(e)}if(o===t.getAllOf()?.length)return s;throw new eS(eZ.path(e),"The value doesn't satisfy some of the schemas.",n)}static async oneOf(e,t,r,s,n,a,i){let o=0;for(let E of t.getOneOf()??[])try{await ed.validate(e,E,r,s,a,i),o++}catch(e){n.push(e)}if(1===o)return s;throw new eS(eZ.path(e),0==o?"The value does not satisfy any schema":"The value satisfy more than one schema",n)}constructor(){}}var eP={};E(eP,"TypeValidator",()=>eQ);var eI={};E(eI,"ArrayValidator",()=>ey);class ey{static async validate(e,t,r,s,n,a){if(R(s))throw new eS(eZ.path(e),"Expected an array but found null");if(!Array.isArray(s))throw new eS(eZ.path(e),s.toString()+" is not an Array");return ey.checkMinMaxItems(e,t,s),await ey.checkItems(e,t,r,s,n,a),ey.checkUniqueItems(e,t,s),await ey.checkContains(t,e,r,s),s}static async checkContains(e,t,r,s){if(R(e.getContains()))return;let n=await ey.countContains(t,e,r,s,R(e.getMinContains())&&R(e.getMaxContains()));if(0===n)throw new eS(eZ.path(t),"None of the items are of type contains schema");if(!R(e.getMinContains())&&e.getMinContains()>n)throw new eS(eZ.path(t),"The minimum number of the items of type contains schema should be "+e.getMinContains()+" but found "+n);if(!R(e.getMaxContains())&&e.getMaxContains()<n)throw new eS(eZ.path(t),"The maximum number of the items of type contains schema should be "+e.getMaxContains()+" but found "+n)}static async countContains(e,t,r,s,n){let a=0;for(let i=0;i<s.length;i++){let o=e?[...e]:[];try{if(await eZ.validate(o,t.getContains(),r,s[i]),a++,n)break}catch(e){}}return a}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()&&new Set(r).size!==r.length)throw new eS(eZ.path(e),"Items on the array are not unique")}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new eS(eZ.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new eS(eZ.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static async checkItems(e,t,r,s,n,a){if(!t.getItems())return;let i=t.getItems();if(i.getSingleSchema())for(let t=0;t<s.length;t++){let o=e?[...e]:[];s[t]=await eZ.validate(o,i.getSingleSchema(),r,s[t],n,a)}if(i.getTupleSchema()){if(i.getTupleSchema().length!==s.length&&R(t?.getAdditionalItems()))throw new eS(eZ.path(e),"Expected an array with only "+i.getTupleSchema().length+" but found "+s.length);await this.checkItemsInTupleSchema(e,r,s,i),await this.checkAdditionalItems(e,t,r,s,i)}}static async checkItemsInTupleSchema(e,t,r,s,n,a){for(let i=0;i<s.getTupleSchema()?.length;i++){let o=e?[...e]:[];r[i]=await eZ.validate(o,s.getTupleSchema()[i],t,r[i],n,a)}}static async checkAdditionalItems(e,t,r,s,n){if(!R(t.getAdditionalItems())){let a=t.getAdditionalItems();if(a?.getBooleanValue()){let i=D.ofAny("item");if(a?.getBooleanValue()===!1&&s.length>n.getTupleSchema()?.length)throw new eS(eZ.path(e),"No Additional Items are defined");await this.checkEachItemInAdditionalItems(e,t,r,s,n,i)}else if(a?.getSchemaValue()){let i=a.getSchemaValue();await this.checkEachItemInAdditionalItems(e,t,r,s,n,i)}}}static async checkEachItemInAdditionalItems(e,t,r,s,n,a){for(let t=n.getTupleSchema()?.length;t<s.length;t++){let n=e?[...e]:[];s[t]=await eZ.validate(n,a,r,s[t])}}constructor(){}}var ex={};E(ex,"BooleanValidator",()=>eL);class eL{static validate(e,t,r){if(R(r))throw new eS(eZ.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new eS(eZ.path(e),r.toString()+" is not a boolean");return r}constructor(){}}var ev={};E(ev,"NullValidator",()=>eU);class eU{static validate(e,t,r){if(R(r))return r;throw new eS(eZ.path(e),"Expected a null but found "+r)}constructor(){}}var eV={};E(eV,"NumberValidator",()=>eC);class eC{static validate(e,t,r,s){if(R(s))throw new eS(eZ.path(t),"Expected a number but found null");if("number"!=typeof s)throw new eS(eZ.path(t),s.toString()+" is not a "+e);let n=eC.extractNumber(e,t,r,s);return eC.checkRange(t,r,s,n),eC.checkMultipleOf(t,r,s,n),s}static extractNumber(e,t,r,s){let n=s;try{(e==p.LONG||e==p.INTEGER)&&(n=Math.round(n))}catch(r){throw new eS(eZ.path(t),s+" is not a number of type "+e,r)}if(R(n)||(e==p.LONG||e==p.INTEGER)&&n!=s)throw new eS(eZ.path(t),s.toString()+" is not a number of type "+e);return n}static checkMultipleOf(e,t,r,s){if(t.getMultipleOf()&&s%t.getMultipleOf()!=0)throw new eS(eZ.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}static checkRange(e,t,r,s){if(!R(t.getMinimum())&&0>eC.numberCompare(s,t.getMinimum()))throw new eS(eZ.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(!R(t.getMaximum())&&eC.numberCompare(s,t.getMaximum())>0)throw new eS(eZ.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(!R(t.getExclusiveMinimum())&&0>=eC.numberCompare(s,t.getExclusiveMinimum()))throw new eS(eZ.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(!R(t.getExclusiveMaximum())&&eC.numberCompare(s,t.getExclusiveMaximum())>0)throw new eS(eZ.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}var eD={};E(eD,"ObjectValidator",()=>eb);class eb{static async validate(e,t,r,s,n,a){if(R(s))throw new eS(eZ.path(e),"Expected an object but found null");if("object"!=typeof s||Array.isArray(s))throw new eS(eZ.path(e),s.toString()+" is not an Object");let i=new Set(Object.keys(s));return eb.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&await eb.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&eb.checkRequired(e,t,s),t.getProperties()&&await eb.checkProperties(e,t,r,s,i,n,a),t.getPatternProperties()&&await eb.checkPatternProperties(e,t,r,s,i),t.getAdditionalProperties()&&await eb.checkAdditionalProperties(e,t,r,s,i),s}static async checkPropertyNameSchema(e,t,r,s){for(let n of Array.from(s.values()))try{await eZ.validate(e,t.getPropertyNames(),r,n)}catch(t){throw new eS(eZ.path(e),"Property name '"+n+"' does not fit the property schema")}}static checkRequired(e,t,r){for(let s of t.getRequired()??[])if(R(r[s]))throw new eS(eZ.path(e),s+" is mandatory")}static async checkAdditionalProperties(e,t,r,s,n){let a=t.getAdditionalProperties();if(a.getSchemaValue())for(let t of Array.from(n.values())){let n=e?[...e]:[];s[t]=await eZ.validate(n,a.getSchemaValue(),r,s[t])}else if(!1===a.getBooleanValue()&&n.size)throw new eS(eZ.path(e),Array.from(n)+" is/are additional properties which are not allowed.")}static async checkPatternProperties(e,t,r,s,n){let a=new Map;for(let e of Array.from(t.getPatternProperties().keys()))a.set(e,new RegExp(e));for(let i of Array.from(n.values())){let o=e?[...e]:[];for(let e of Array.from(a.entries()))if(e[1].test(i)){s[i]=await eZ.validate(o,t.getPatternProperties().get(e[0]),r,s[i]),n.delete(i);break}}}static async checkProperties(e,t,r,s,n,a,i){for(let o of Array.from(t.getProperties())){let t=s[o[0]];if(!s.hasOwnProperty(o[0])&&R(t)&&R(await eO.getDefaultValue(o[1],r)))continue;let E=e?[...e]:[];s[o[0]]=await eZ.validate(E,o[1],r,t,a,i),n.delete(o[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new eS(eZ.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new eS(eZ.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}var eG={};E(eG,"StringValidator",()=>eY);var eF={};E(eF,"StringFormat",()=>eB);var eB=((r={}).DATETIME="DATETIME",r.TIME="TIME",r.DATE="DATE",r.EMAIL="EMAIL",r.REGEX="REGEX",r);class eY{static{this.TIME=/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/}static{this.DATE=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])$/}static{this.DATETIME=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])T([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/}static{this.EMAIL=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/}static validate(e,t,r){if(R(r))throw new eS(eZ.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new eS(eZ.path(e),r.toString()+" is not String");t.getFormat()==eB.TIME?eY.patternMatcher(e,t,r,eY.TIME,"time pattern"):t.getFormat()==eB.DATE?eY.patternMatcher(e,t,r,eY.DATE,"date pattern"):t.getFormat()==eB.DATETIME?eY.patternMatcher(e,t,r,eY.DATETIME,"date time pattern"):t.getFormat()==eB.EMAIL?eY.patternMatcher(e,t,r,eY.EMAIL,"email pattern"):t.getPattern()&&eY.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let s=r.length;if(t.getMinLength()&&s<t.getMinLength())throw new eS(eZ.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&s>t.getMaxLength())throw new eS(eZ.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,s,n){if(!s.test(r))throw new eS(eZ.path(e),r.toString()+" is not matched with the "+n)}constructor(){}}var eH=((s={}).STRICT="STRICT",s.LENIENT="LENIENT",s.USE_DEFAULT="USE_DEFAULT",s.SKIP="SKIP",s);const ek=e=>eH[e.toUpperCase()],e$=()=>Object.values(eH);class ej extends Error{constructor(e,t,r,s,n=[],a){super(r+(n?n.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.source=t??null,this.mode=s??null,this.cause=a}getSchemaPath(){return this.schemaPath}getSource(){return this.source??null}getMode(){return this.mode??null}getCause(){return this.cause}}class eW{static handleUnConvertibleValue(e,t,r,s){return this.handleUnConvertibleValueWithDefault(e,t,r,null,s)}static handleUnConvertibleValueWithDefault(e,t,r,s,n){switch(null===t&&(t=eH.STRICT),t){case eH.STRICT:throw new ej(eZ.path(e),r,n,t);case eH.LENIENT:return null;case eH.USE_DEFAULT:return s;case eH.SKIP:return r;default:throw new ej(eZ.path(e),r,"Invalid conversion mode")}}constructor(){}}class eX{static convert(e,t,r,s){if(R(s))return eW.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Expected a string but found null");let n=s??("object"==typeof s?JSON.stringify(s):String(s));return this.getConvertedString(n,r)}static getConvertedString(e,t){return t===eH.STRICT?e.toString():e.trim()}static getDefault(e){return e.getDefaultValue()??null}constructor(){}}class eJ{static convert(e,t,r,s,n){if(R(n))return eW.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),"Expected a number but found null");if("object"==typeof n||"boolean"==typeof n||Array.isArray(n)||"string"==typeof n&&isNaN(n=Number(n)))return eW.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),n+" is not a "+t);let a=this.extractNumber(t,n,s);return null===a?eW.handleUnConvertibleValueWithDefault(e,s,n,this.getDefault(r),n+" is not a "+t):a}static extractNumber(e,t,r){if("number"!=typeof t)return null;switch(e){case p.INTEGER:return this.isInteger(t,r)?Math.floor(t):null;case p.LONG:return this.isLong(t,r)?Math.floor(t):null;case p.DOUBLE:return t;case p.FLOAT:return this.isFloat(t,r)?t:null;default:return null}}static isInteger(e,t){return t!==eH.STRICT?"number"==typeof e:Number.isInteger(e)}static isLong(e,t){return t!==eH.STRICT?"number"==typeof e:Number.isInteger(e)&&e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER}static isFloat(e,t){return t!==eH.STRICT?"number"==typeof e:e>=-Number.MAX_VALUE&&e<=Number.MAX_VALUE}static getDefault(e){return"number"==typeof e.getDefaultValue()?Number(e.getDefaultValue):null}}class eq{static{this.BOOLEAN_MAP={true:!0,t:!0,yes:!0,y:!0,1:!0,false:!1,f:!1,no:!1,n:!1,0:!1}}static convert(e,t,r,s){return null==s?eW.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Expected a boolean but found null"):this.getBooleanPrimitive(s)??eW.handleUnConvertibleValueWithDefault(e,r,s,this.getDefault(t),"Unable to convert to boolean")}static getBooleanPrimitive(e){return"boolean"==typeof e?e:"string"==typeof e?this.handleStringValue(e):"number"==typeof e?this.handleNumberValue(e):null}static handleStringValue(e){let t=e.toLowerCase().trim();return eq.BOOLEAN_MAP[t]??null}static handleNumberValue(e){return 0===e||1===e?1===e:null}static getDefault(e){return e.getDefaultValue()??!1}constructor(){}}class ez{static convert(e,t,r,s){return R(s)?s:"string"==typeof s&&"null"===s.toLowerCase()?null:eW.handleUnConvertibleValueWithDefault(e,r,s,null,"Unable to convert to null")}constructor(){}}class eK{static handleValidationError(e,t,r,s,n){switch(t=t??eH.STRICT){case eH.STRICT:throw new eS(eZ.path(e),n);case eH.LENIENT:return null;case eH.USE_DEFAULT:return s;case eH.SKIP:return r}}constructor(){}}class eQ{static async validate(e,t,r,s,n,a,i){return t==p.OBJECT?await eb.validate(e,r,s,n,a,i):t==p.ARRAY?await ey.validate(e,r,s,n,a,i):this.handleTypeValidationAndConversion(e,t,r,n,a,i)}static async handleTypeValidationAndConversion(e,t,r,s,n,a){let i=n?this.convertElement(e,t,r,s,a??eH.STRICT):s;return await this.validateElement(e,t,r,i,a??eH.STRICT)}static convertElement(e,t,r,s,n){if(R(t))return eW.handleUnConvertibleValueWithDefault(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type for conversion.",t));switch(t){case p.STRING:return eX.convert(e,r,n,s);case p.INTEGER:case p.LONG:case p.DOUBLE:case p.FLOAT:return eJ.convert(e,t,r,n,s);case p.BOOLEAN:return eq.convert(e,r,n,s);case p.NULL:return ez.convert(e,r,n,s);default:return eW.handleUnConvertibleValueWithDefault(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type for conversion.",t))}}static validateElement(e,t,r,s,n){if(R(t))return eK.handleValidationError(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type.",t));switch(t){case p.STRING:return eY.validate(e,r,s);case p.INTEGER:case p.LONG:case p.DOUBLE:case p.FLOAT:return eC.validate(t,e,r,s);case p.BOOLEAN:return eL.validate(e,r,s);case p.NULL:return eU.validate(e,r,s);default:return eK.handleValidationError(e,n,s,r.getDefaultValue()??null,eT.format("$ is not a valid type.",t))}}constructor(){}}class eZ{static{this.ORDER={[p.OBJECT]:0,[p.ARRAY]:1,[p.DOUBLE]:2,[p.FLOAT]:3,[p.LONG]:4,[p.INTEGER]:5,[p.STRING]:6,[p.BOOLEAN]:7,[p.NULL]:8}}static path(e){return e?e.map(e=>e.getTitle()??"").filter(e=>!!e).reduce((e,t,r)=>e+(0===r?"":".")+t,""):""}static async validate(e,t,r,s,n,a){if(!t)throw new eS(eZ.path(e),"No schema found to validate");if(e||(e=[]),e.push(t),R(s)&&!R(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(!R(t.getConstant()))return eZ.constantValidation(e,t,s);if(t.getEnums()?.length)return eZ.enumCheck(e,t,s);if(t.getFormat()&&R(t.getType()))throw new eS(this.path(e),"Type is missing in schema for declared "+t.getFormat()?.toString()+" format.");if(!0===n&&R(t.getType()))throw new eS(this.path(e),"Type is missing in schema for declared "+a);if(t.getType()&&(s=await eZ.typeValidation(e,t,r,s,n,a)),!eg.isNullOrBlank(t.getRef()))return await eZ.validate(e,await eO.getSchemaFromRef(e[0],r,t.getRef()),r,s,n,a);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&(s=await ed.validate(e,t,r,s,n,a)),t.getNot()){let i;try{await eZ.validate(e,t.getNot(),r,s,n,a),i=!0}catch(e){i=!1}if(i)throw new eS(eZ.path(e),"Schema validated value in not condition.")}return s}static constantValidation(e,t,r){if(!eh(t.getConstant(),r))throw new eS(eZ.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let s=!1;for(let e of t.getEnums()??[])if(e===r){s=!0;break}if(s)return r;throw new eS(eZ.path(e),"Value is not one of "+t.getEnums())}static async typeValidation(e,t,r,s,n,a){let i=Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]).sort((e,t)=>(this.ORDER[e]??1/0)-(this.ORDER[t]??1/0)),o=[];for(let E of i)try{return await eQ.validate(e,E,t,r,s,n,a)}catch(e){o.push(e)}throw new eS(eZ.path(e),"Value "+JSON.stringify(s)+" is not of valid type(s)",o)}constructor(){}}class e0{async validateArguments(e,t,r){let s=new Map;for(let n of Array.from(this.getSignature().getParameters().entries())){let a=n[1];try{let r=await this.validateArgument(e,t,n,a);s.set(r.getT1(),r.getT2())}catch(t){let e=this.getSignature();throw new er(`Error while executing the function ${e.getNamespace()}.${e.getName()}'s parameter ${a.getParameterName()} with step name '${r?.getStatement().getStatementName()??"Unknown Step"}' with error : ${t?.message}`)}}return s}async validateArgument(e,t,r,s){let n,a=r[0],i=e.get(r[0]);if(R(i)&&!s.isVariableArgument())return new eN(a,await eZ.validate(void 0,s.getSchema(),t,void 0));if(!s?.isVariableArgument())return new eN(a,await eZ.validate(void 0,s.getSchema(),t,i));Array.isArray(i)?n=i:(n=[],R(i)?R(s.getSchema().getDefaultValue())||n.push(s.getSchema().getDefaultValue()):n.push(i));for(let e=0;e<n.length;e++)n[e]=await eZ.validate(void 0,s.getSchema(),t,n[e]);return new eN(a,n)}async execute(e){let t=await this.validateArguments(e.getArguments()??new Map,e.getSchemaRepository(),e.getStatementExecution());e.setArguments(t);try{return await this.internalExecute(e)}catch(r){let t=this.getSignature();throw new er(`Error while executing the function ${t.getNamespace()}.${t.getName()} with step name '${e.getStatementExecution()?.getStatement().getStatementName()??"Unknown Step"}' with error : ${r?.message}`)}}getProbableEventSignature(e){return this.getSignature().getEvents()}}class e1 extends e0{static{this.EVENT_INDEX_NAME="index"}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_INDEX=new Q(Q.OUTPUT,j.of(e1.EVENT_INDEX_NAME,D.ofInteger(e1.EVENT_INDEX_NAME)))}static{this.EVENT_RESULT_INTEGER=new Q(Q.OUTPUT,j.of(e1.EVENT_RESULT_NAME,D.ofInteger(e1.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_BOOLEAN=new Q(Q.OUTPUT,j.of(e1.EVENT_RESULT_NAME,D.ofBoolean(e1.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_ARRAY=new Q(Q.OUTPUT,j.of(e1.EVENT_RESULT_NAME,D.ofArray(e1.EVENT_RESULT_NAME,D.ofAny(e1.EVENT_RESULT_NAME))))}static{this.EVENT_RESULT_EMPTY=new Q(Q.OUTPUT,j.of())}static{this.EVENT_RESULT_ANY=new Q(Q.OUTPUT,j.of(this.EVENT_RESULT_NAME,D.ofAny(this.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_OBJECT=new Q(Q.OUTPUT,j.of(this.EVENT_RESULT_NAME,D.ofObject(this.EVENT_RESULT_NAME)))}static{this.PARAMETER_INT_LENGTH=k.of("length",D.ofInteger("length").setDefaultValue(-1))}static{this.PARAMETER_ARRAY_FIND=k.of("find",D.ofArray("eachFind",D.ofAny("eachFind")))}static{this.PARAMETER_INT_SOURCE_FROM=k.of("srcFrom",D.ofInteger("srcFrom").setDefaultValue(0).setMinimum(0))}static{this.PARAMETER_INT_SECOND_SOURCE_FROM=k.of("secondSrcFrom",D.ofInteger("secondSrcFrom").setDefaultValue(0))}static{this.PARAMETER_INT_FIND_FROM=k.of("findFrom",D.ofInteger("findFrom").setDefaultValue(0))}static{this.PARAMETER_INT_OFFSET=k.of("offset",D.ofInteger("offset").setDefaultValue(0))}static{this.PARAMETER_ROTATE_LENGTH=k.of("rotateLength",D.ofInteger("rotateLength").setDefaultValue(1).setMinimum(1))}static{this.PARAMETER_BOOLEAN_ASCENDING=k.of("ascending",D.ofBoolean("ascending").setDefaultValue(!0))}static{this.PARAMETER_KEY_PATH=k.of("keyPath",D.ofString("keyPath").setDefaultValue(""))}static{this.PARAMETER_FIND_PRIMITIVE=k.of("findPrimitive",D.of("findPrimitive",p.STRING,p.DOUBLE,p.FLOAT,p.INTEGER,p.LONG))}static{this.PARAMETER_ARRAY_SOURCE=k.of("source",D.ofArray("eachSource",D.ofAny("eachSource")))}static{this.PARAMETER_ARRAY_SECOND_SOURCE=k.of("secondSource",D.ofArray("eachSecondSource",D.ofAny("eachSecondSource")))}static{this.PARAMETER_ARRAY_SOURCE_PRIMITIVE=k.of("source",D.ofArray("eachSource",new D().setName("eachSource").setType(d.of(p.STRING,p.NULL,p.INTEGER,p.FLOAT,p.DOUBLE,p.LONG))))}static{this.PARAMETER_BOOLEAN_DEEP_COPY=k.of("deepCopy",D.ofBoolean("deepCopy").setDefaultValue(!0))}static{this.PARAMETER_ANY=k.of("element",D.ofAny("element"))}static{this.PARAMETER_ANY_ELEMENT_OBJECT=k.of("elementObject",D.ofAny("elementObject"))}static{this.PARAMETER_ANY_VAR_ARGS=k.of("element",D.ofAny("element")).setVariableArgument(!0)}static{this.PARAMETER_ARRAY_RESULT=k.of(e1.EVENT_RESULT_NAME,D.ofArray("eachResult",D.ofAny("eachResult")))}constructor(e,t,r){super();let s=new Map;for(let e of t)s.set(e.getParameterName(),e);this.signature=new ea(e).setNamespace(l.SYSTEM_ARRAY).setParameters(s).setEvents(j.of(r.getName(),r))}getSignature(){return this.signature}}class e2 extends e1{constructor(){super("Concatenate",[e1.PARAMETER_ARRAY_SOURCE,e1.PARAMETER_ARRAY_SECOND_SOURCE],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName());return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,[...t,...r]]]))])}}class e9 extends e1{constructor(){super("AddFirst",[e1.PARAMETER_ARRAY_SOURCE,e1.PARAMETER_ANY],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e1.PARAMETER_ANY.getParameterName());if(0==(t=[...t]).length)return t.push(r),new es([Z.outputOf(new Map([]))]);t.push(r);let s=t.length-1;for(;s>0;){let e=t[s-1];t[s-1]=t[s],t[s--]=e}return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}const e3="keyName";class e4 extends e1{constructor(){super("ArrayToArrayOfObjects",[e1.PARAMETER_ARRAY_SOURCE,k.of(e3,D.ofString(e3),!0)],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e3);if(!t?.length)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,[]]]))]);let s=t.map(e=>{let t={};if(Array.isArray(e)){if(r.length)r.forEach((r,s)=>{t[r]=e[s]});else for(let r=0;r<e.length;r++)t[`value${r+1}`]=e[r]}else t[r.length?r[0]:"value"]=e;return t});return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,s]]))])}}var e5={};E(e5,"PrimitiveUtil",()=>e8);var e6={};E(e6,"ExecutionException",()=>e7);class e7 extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class e8{static findPrimitiveNullAsBoolean(e){if(R(e))return new eN(p.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new e7(eT.format("$ is not a primitive type",e));return"boolean"===t?new eN(p.BOOLEAN,e):"string"===t?new eN(p.STRING,e):e8.findPrimitiveNumberType(e)}static findPrimitive(e){if(R(e))return new eN(p.NULL,void 0);let t=typeof e;if("object"===t)throw new e7(eT.format("$ is not a primitive type",e));return"boolean"===t?new eN(p.BOOLEAN,e):"string"===t?new eN(p.STRING,e):e8.findPrimitiveNumberType(e)}static findPrimitiveNumberType(e){if(R(e)||Array.isArray(e)||"object"==typeof e)throw new e7(eT.format("Unable to convert $ to a number.",e));try{if(Number.isInteger(e))return new eN(p.LONG,e);return new eN(p.DOUBLE,e)}catch(t){throw new e7(eT.format("Unable to convert $ to a number.",e),t)}}static compare(e,t){if(e==t)return 0;if(R(e)||R(t))return R(e)?-1:1;if(Array.isArray(e)||Array.isArray(t)){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!=t.length)return e.length-t.length;for(let r=0;r<e.length;r++){let s=this.compare(e[r],t[r]);if(0!=s)return s}return 0}return Array.isArray(e)?-1:1}let r=typeof e,s=typeof t;return"object"===r||"object"===s?("object"===r&&"object"===s&&Object.keys(e).forEach(r=>{let s=this.compare(e[r],t[r]);if(0!=s)return s}),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return R(e)||R(t)?R(e)&&R(t)?0:R(e)?-1:1:e==t?0:"boolean"==typeof e||"boolean"==typeof t?e?-1:1:"string"==typeof e||"string"==typeof t?e+""<t+""?-1:1:"number"==typeof e||"number"==typeof t?e-t:0}static baseNumberType(e){return Number.isInteger(e)?p.LONG:p.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class te extends e1{constructor(){super("BinarySearch",[te.PARAMETER_ARRAY_SOURCE_PRIMITIVE,te.PARAMETER_INT_SOURCE_FROM,te.PARAMETER_FIND_PRIMITIVE,te.PARAMETER_INT_LENGTH],te.EVENT_INDEX)}async internalExecute(e){let t=e?.getArguments()?.get(te.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(te.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(te.PARAMETER_FIND_PRIMITIVE.getParameterName()),n=e?.getArguments()?.get(te.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length||r<0||r>t.length)throw new er("Search source array cannot be empty");if(-1==n&&(n=t.length-r),(n=r+n)>t.length)throw new er("End point for array cannot be more than the size of the source array");let a=-1;for(;r<=n;){let e=Math.floor((r+n)/2);if(0==e8.compare(t[e],s)){a=e;break}e8.compare(t[e],s)>0?n=e-1:r=e+1}return new es([Z.outputOf(new Map([[te.EVENT_INDEX_NAME,a]]))])}}var tt={};E(tt,"ArrayUtil",()=>tr);class tr{static removeAListFrom(e,t){if(!t||!e||!e.length||!t.length)return;let r=new Set(t);for(let t=0;t<e.length;t++)r.has(e[t])&&(e.splice(t,1),t--)}static of(...e){let t=Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r];return t}constructor(){}}class ts extends e1{constructor(){super("Compare",tr.of(ts.PARAMETER_ARRAY_SOURCE,ts.PARAMETER_INT_SOURCE_FROM,ts.PARAMETER_ARRAY_FIND,ts.PARAMETER_INT_FIND_FROM,ts.PARAMETER_INT_LENGTH),ts.EVENT_RESULT_INTEGER)}async internalExecute(e){var t=e?.getArguments()?.get(ts.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ts.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(ts.PARAMETER_ARRAY_FIND.getParameterName()),n=e?.getArguments()?.get(ts.PARAMETER_INT_FIND_FROM.getParameterName()),a=e?.getArguments()?.get(ts.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new er("Compare source array cannot be empty");if(0==s.length)throw new er("Compare find array cannot be empty");if(-1==a&&(a=t.length-r),r+a>t.length)throw new er(eT.format("Source array size $ is less than comparing size $",t.length,r+a));if(n+a>s.length)throw new er(eT.format("Find array size $ is less than comparing size $",s.length,n+a));return new es(tr.of(Z.outputOf(j.of(ts.EVENT_RESULT_NAME,this.compare(t,r,r+a,s,n,n+a)))))}compare(e,t,r,s,n,a){if(r<t){let e=t;t=r,r=e}if(a<n){let e=n;n=a,a=e}if(r-t!=a-n)throw new er(eT.format("Cannot compare uneven arrays from $ to $ in source array with $ to $ in find array",r,t,a,n));for(let a=t,i=n;a<r;a++,i++){let t=1;if(R(e[a])||R(s[i])){let r=R(e[a]);r==R(s[i])?t=0:r&&(t=-1)}else{let r=typeof e[a],n=typeof s[i];if("object"===r||"object"===n)t=1;else if("string"===r||"string"===n){let r=""+e[a],n=""+s[i];r===n?t=0:r<n&&(t=-1)}else"boolean"===r||"boolean"===n?t=r==n?0:1:"number"===r&&"number"===n&&(t=e[a]-s[i])}if(0!=t)return t}return 0}}var tn={};function ta(e){return e?"function"==typeof globalThis.structuredClone?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e)):e}E(tn,"duplicate",()=>ta);class ti extends e1{constructor(){super("Copy",[ti.PARAMETER_ARRAY_SOURCE,ti.PARAMETER_INT_SOURCE_FROM,ti.PARAMETER_INT_LENGTH,ti.PARAMETER_BOOLEAN_DEEP_COPY],ti.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(ti.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ti.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(ti.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),r+s>t.length)throw new er(eT.format("Array has no elements from $ to $ as the array size is $",r,r+s,t.length));var n=e?.getArguments()?.get(ti.PARAMETER_BOOLEAN_DEEP_COPY.getParameterName());let a=Array(s);for(let e=r;e<r+s;e++)R(t[e])||(a[e-r]=n?ta(t[e]):t[e]);return new es([Z.outputOf(j.of(ti.EVENT_RESULT_NAME,a))])}}class to extends e1{constructor(){super("Delete",[e1.PARAMETER_ARRAY_SOURCE,e1.PARAMETER_ANY_VAR_ARGS],e1.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(to.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(to.PARAMETER_ANY_VAR_ARGS.getParameterName());if(null==r)throw new er("The deletable var args are empty. So cannot be proceeded further.");if(0==t.length||0==r.length)throw new er("Expected a source or deletable for an array but not found any");let s=new Set;for(let e=t.length-1;e>=0;e--)for(let n=0;n<r.length;n++)s.has(e)||0!=e8.compare(t[e],r[n])||s.add(t[e]);return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t.filter(e=>!s.has(e))]]))])}}class tE extends e1{constructor(){super("DeleteFirst",[tE.PARAMETER_ARRAY_SOURCE],tE.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tE.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new er("Given source array is empty");return(t=[...t]).shift(),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tu extends e1{constructor(){super("DeleteFrom",[tu.PARAMETER_ARRAY_SOURCE,tu.PARAMETER_INT_SOURCE_FROM,tu.PARAMETER_INT_LENGTH],tu.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tu.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tu.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tu.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new er("There are no elements to be deleted");if(r>=(t=[...t]).length||r<0)throw new er("The int source for the array should be in between 0 and length of the array ");if(-1==s&&(s=t.length-r),r+s>t.length)throw new er("Requested length to be deleted is more than the size of array ");return t.splice(r,s),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tA extends e1{constructor(){super("DeleteLast",[tA.PARAMETER_ARRAY_SOURCE],tA.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tA.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new er("Given source array is empty");return(t=[...t]).pop(),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tT extends e1{constructor(){super("Disjoint",[tT.PARAMETER_ARRAY_SOURCE,tT.PARAMETER_INT_SOURCE_FROM,tT.PARAMETER_ARRAY_SECOND_SOURCE,tT.PARAMETER_INT_SECOND_SOURCE_FROM,tT.PARAMETER_INT_LENGTH],tT.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tT.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tT.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tT.PARAMETER_INT_LENGTH.getParameterName());if(-1==a&&(a=t.length<=s.length?t.length-r:s.length-n),a>t.length||a>s.length||r+a>t.length||n+a>s.length)throw new er("The length which was being requested is more than than the size either source array or second source array");let i=new Set,o=new Set;for(let e=0;e<a;e++)i.add(t[e+r]);for(let e=0;e<a;e++)o.add(s[e+n]);let E=new Set;return i.forEach(e=>{o.has(e)?o.delete(e):E.add(e)}),o.forEach(e=>{i.has(e)||E.add(e)}),new es([Z.outputOf(new Map([[tT.EVENT_RESULT_NAME,[...E]]]))])}}class tl extends e1{constructor(){super("Equals",[tl.PARAMETER_ARRAY_SOURCE,tl.PARAMETER_INT_SOURCE_FROM,tl.PARAMETER_ARRAY_FIND,tl.PARAMETER_INT_FIND_FROM,tl.PARAMETER_INT_LENGTH],tl.EVENT_RESULT_BOOLEAN)}async internalExecute(e){let t=new ts,r=(await t.execute(e)).allResults()[0].getResult().get(tl.EVENT_RESULT_NAME);return new es([Z.outputOf(j.of(tl.EVENT_RESULT_NAME,0==r))])}}class tm extends e1{constructor(){super("Fill",[tm.PARAMETER_ARRAY_SOURCE,tm.PARAMETER_INT_SOURCE_FROM,tm.PARAMETER_INT_LENGTH,tm.PARAMETER_ANY],tm.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tm.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tm.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tm.PARAMETER_INT_LENGTH.getParameterName()),n=e?.getArguments()?.get(tm.PARAMETER_ANY.getParameterName());if(r<0)throw new er(eT.format("Arrays out of bound trying to access $ index",r));-1==s&&(s=t.length-r);let a=r+s-t.length;if(t=[...t],a>0)for(let e=0;e<a;e++)t.push();for(let e=r;e<r+s;e++)t[e]=R(n)?n:ta(n);return new es([Z.outputOf(j.of(e1.EVENT_RESULT_NAME,t))])}}class th extends e1{constructor(){super("Frequency",[th.PARAMETER_ARRAY_SOURCE,th.PARAMETER_ANY,th.PARAMETER_INT_SOURCE_FROM,th.PARAMETER_INT_LENGTH],th.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(th.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(th.PARAMETER_ANY.getParameterName()),s=e?.getArguments()?.get(th.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(th.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[th.EVENT_RESULT_NAME,0]]))]);if(s>t.length)throw new er("Given start point is more than the size of source");let a=s+n;if(-1==n&&(a=t.length-s),a>t.length)throw new er("Given length is more than the size of source");let i=0;for(let e=s;e<a&&e<t.length;e++)0==e8.compare(t[e],r)&&i++;return new es([Z.outputOf(new Map([[th.EVENT_RESULT_NAME,i]]))])}}class tR extends e1{constructor(){super("IndexOf",[tR.PARAMETER_ARRAY_SOURCE,tR.PARAMETER_ANY_ELEMENT_OBJECT,tR.PARAMETER_INT_FIND_FROM],tR.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tR.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tR.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),s=e?.getArguments()?.get(tR.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[tR.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length)throw new er("The size of the search index of the array is greater than the size of the array");let n=-1;for(let e=s;e<t.length;e++)if(0==e8.compare(t[e],r)){n=e;break}return new es([Z.outputOf(new Map([[tR.EVENT_RESULT_NAME,n]]))])}}class tg extends e1{constructor(){super("IndexOfArray",[tg.PARAMETER_ARRAY_SOURCE,tg.PARAMETER_ARRAY_SECOND_SOURCE,tg.PARAMETER_INT_FIND_FROM],tg.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tg.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length||0==r.length)return new es([Z.outputOf(new Map([[tg.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length||t.length<r.length)throw new er("Given from second source is more than the size of the source array");let n=r.length,a=-1;for(let e=s;e<t.length;e++){let s=0;if(0==e8.compare(t[e],r[s])){for(;s<n&&0==e8.compare(t[e+s],r[s]);)s++;if(s==n){a=e;break}}}return new es([Z.outputOf(new Map([[tg.EVENT_RESULT_NAME,a]]))])}}class tc extends e1{constructor(){super("LastIndexOf",[tc.PARAMETER_ARRAY_SOURCE,tc.PARAMETER_ANY_ELEMENT_OBJECT,tc.PARAMETER_INT_FIND_FROM],tc.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tc.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tc.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),s=e?.getArguments()?.get(tc.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[tc.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length)throw new er("The value of length shouldn't the exceed the size of the array or shouldn't be in terms");let n=-1;for(let e=t.length-1;e>=s;e--)if(0==e8.compare(t[e],r)){n=e;break}return new es([Z.outputOf(new Map([[tc.EVENT_RESULT_NAME,n]]))])}}class tp extends e1{constructor(){super("LastIndexOfArray",[tp.PARAMETER_ARRAY_SOURCE,tp.PARAMETER_ARRAY_SECOND_SOURCE,tp.PARAMETER_INT_FIND_FROM],tp.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tp.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[tp.EVENT_RESULT_NAME,-1]]))]);if(s<0||s>t.length||r.length>t.length)throw new er("Given from index is more than the size of the source array");let n=r.length,a=-1;for(let e=s;e<t.length;e++){let s=0;if(0==e8.compare(t[e],r[s])){for(;s<n&&0==e8.compare(t[e+s],r[s]);)s++;s==n&&(a=e)}}return new es([Z.outputOf(new Map([[tp.EVENT_RESULT_NAME,a]]))])}}class tN extends e1{constructor(){super("Max",[tN.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tN.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tN.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==t.length)throw new er("Search source array cannot be empty");let r=t[0];for(let e=1;e<t.length;e++){let s=t[e];e8.comparePrimitive(r,s)>=0||(r=s)}return new es([Z.outputOf(new Map([[tN.EVENT_RESULT_NAME,r]]))])}}class tf extends e1{constructor(){super("Min",[tf.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tf.EVENT_RESULT_ANY)}async internalExecute(e){let t,r=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==r.length)throw new er("Search source array cannot be empty");for(let e=0;e<r.length;e++)!R(r[e])&&(void 0===t||0>e8.comparePrimitive(r[e],t))&&(t=r[e]);return new es([Z.outputOf(new Map([[tf.EVENT_RESULT_NAME,t]]))])}}class t_ extends e1{constructor(){super("MisMatch",[t_.PARAMETER_ARRAY_SOURCE,t_.PARAMETER_INT_FIND_FROM,t_.PARAMETER_ARRAY_SECOND_SOURCE,t_.PARAMETER_INT_SECOND_SOURCE_FROM,t_.PARAMETER_INT_LENGTH],t_.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t_.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(t_.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(t_.PARAMETER_INT_LENGTH.getParameterName()),i=r<t.length&&r>0?r:0,o=n<s.length&&n>0?n:0;if(i+a>=t.length||o+a>s.length)throw new er("The size of the array for first and second which was being requested is more than size of the given array");let E=-1;for(let e=0;e<a;e++)if(t[i+e]!=s[o+e]){E=e;break}return new es([Z.outputOf(new Map([[t_.EVENT_RESULT_NAME,E]]))])}}class tM extends e1{constructor(){super("Reverse",[tM.PARAMETER_ARRAY_SOURCE,tM.PARAMETER_INT_SOURCE_FROM,tM.PARAMETER_INT_LENGTH],tM.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tM.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tM.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tM.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),s>=t.length||s<0||r<0)throw new er("Please provide start point between the start and end indexes or provide the length which was less than the source size ");t=[...t];let n=r+s-1;for(;r<=n;){let e=t[r],s=t[n];t[r++]=s,t[n--]=e}return new es([Z.outputOf(new Map([[tM.EVENT_RESULT_NAME,t]]))])}}class tS extends e1{constructor(){super("Rotate",[tS.PARAMETER_ARRAY_SOURCE,tS.PARAMETER_ROTATE_LENGTH],tS.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tS.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tS.PARAMETER_ROTATE_LENGTH.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);let s=(t=[...t]).length;return r%=s,this.rotate(t,0,r-1),this.rotate(t,r,s-1),this.rotate(t,0,s-1),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}rotate(e,t,r){for(;t<r;){let s=e[t];e[t++]=e[r],e[r--]=s}}}class tO extends e1{constructor(){super("Shuffle",[tO.PARAMETER_ARRAY_SOURCE],tO.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tO.PARAMETER_ARRAY_SOURCE.getParameterName());if(t.length<=1)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);let r=0,s=(t=[...t]).length;for(let e=0;e<s;e++){let e=Math.floor(Math.random()*s)%s,n=t[r];t[r]=t[e],t[e]=n,r=e}return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}var tw={};E(tw,"ObjectValueSetterExtractor",()=>tB);var td={};E(td,"Expression",()=>tb);var tP={};E(tP,"StringBuilder",()=>tI);class tI{constructor(e){this.str=e??""}append(e){return this.str+=e,this}toString(){return""+this.str}trim(){return this.str=this.str.trim(),this}setLength(e){return this.str=this.str.substring(0,e),this}length(){return this.str.length}charAt(e){return this.str.charAt(e)}deleteCharAt(e){return this.checkIndex(e),this.str=this.str.substring(0,e)+this.str.substring(e+1),this}insert(e,t){return this.str=this.str.substring(0,e)+t+this.str.substring(e),this}checkIndex(e){if(e>=this.str.length)throw new er(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var ty={};E(ty,"ExpressionEvaluationException",()=>tx);class tx extends Error{constructor(e,t,r){super(eT.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var tL={};E(tL,"ExpressionToken",()=>tv);class tv{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var tU={};E(tU,"ExpressionTokenValue",()=>tV);class tV extends tv{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return eT.format("$: $",this.expression,this.element)}}var tC={};E(tC,"Operation",()=>tD);class tD{static{this.MULTIPLICATION=new tD("*")}static{this.DIVISION=new tD("/")}static{this.INTEGER_DIVISION=new tD("//")}static{this.MOD=new tD("%")}static{this.ADDITION=new tD("+")}static{this.SUBTRACTION=new tD("-")}static{this.NOT=new tD("not",void 0,!0)}static{this.AND=new tD("and",void 0,!0)}static{this.OR=new tD("or",void 0,!0)}static{this.LESS_THAN=new tD("<")}static{this.LESS_THAN_EQUAL=new tD("<=")}static{this.GREATER_THAN=new tD(">")}static{this.GREATER_THAN_EQUAL=new tD(">=")}static{this.EQUAL=new tD("=")}static{this.NOT_EQUAL=new tD("!=")}static{this.BITWISE_AND=new tD("&")}static{this.BITWISE_OR=new tD("|")}static{this.BITWISE_XOR=new tD("^")}static{this.BITWISE_COMPLEMENT=new tD("~")}static{this.BITWISE_LEFT_SHIFT=new tD("<<")}static{this.BITWISE_RIGHT_SHIFT=new tD(">>")}static{this.BITWISE_UNSIGNED_RIGHT_SHIFT=new tD(">>>")}static{this.UNARY_PLUS=new tD("UN: +","+")}static{this.UNARY_MINUS=new tD("UN: -","-")}static{this.UNARY_LOGICAL_NOT=new tD("UN: not","not")}static{this.UNARY_BITWISE_COMPLEMENT=new tD("UN: ~","~")}static{this.ARRAY_OPERATOR=new tD("[")}static{this.OBJECT_OPERATOR=new tD(".")}static{this.NULLISH_COALESCING_OPERATOR=new tD("??")}static{this.CONDITIONAL_TERNARY_OPERATOR=new tD("?")}static{this.VALUE_OF=new Map([["MULTIPLICATION",tD.MULTIPLICATION],["DIVISION",tD.DIVISION],["INTEGER_DIVISON",tD.INTEGER_DIVISION],["MOD",tD.MOD],["ADDITION",tD.ADDITION],["SUBTRACTION",tD.SUBTRACTION],["NOT",tD.NOT],["AND",tD.AND],["OR",tD.OR],["LESS_THAN",tD.LESS_THAN],["LESS_THAN_EQUAL",tD.LESS_THAN_EQUAL],["GREATER_THAN",tD.GREATER_THAN],["GREATER_THAN_EQUAL",tD.GREATER_THAN_EQUAL],["EQUAL",tD.EQUAL],["NOT_EQUAL",tD.NOT_EQUAL],["BITWISE_AND",tD.BITWISE_AND],["BITWISE_OR",tD.BITWISE_OR],["BITWISE_XOR",tD.BITWISE_XOR],["BITWISE_COMPLEMENT",tD.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",tD.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",tD.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",tD.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",tD.UNARY_PLUS],["UNARY_MINUS",tD.UNARY_MINUS],["UNARY_LOGICAL_NOT",tD.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",tD.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",tD.ARRAY_OPERATOR],["OBJECT_OPERATOR",tD.OBJECT_OPERATOR],["NULLISH_COALESCING_OPERATOR",tD.NULLISH_COALESCING_OPERATOR],["CONDITIONAL_TERNARY_OPERATOR",tD.CONDITIONAL_TERNARY_OPERATOR]])}static{this.UNARY_OPERATORS=new Set([tD.ADDITION,tD.SUBTRACTION,tD.NOT,tD.BITWISE_COMPLEMENT,tD.UNARY_PLUS,tD.UNARY_MINUS,tD.UNARY_LOGICAL_NOT,tD.UNARY_BITWISE_COMPLEMENT])}static{this.ARITHMETIC_OPERATORS=new Set([tD.MULTIPLICATION,tD.DIVISION,tD.INTEGER_DIVISION,tD.MOD,tD.ADDITION,tD.SUBTRACTION])}static{this.LOGICAL_OPERATORS=new Set([tD.NOT,tD.AND,tD.OR,tD.LESS_THAN,tD.LESS_THAN_EQUAL,tD.GREATER_THAN,tD.GREATER_THAN_EQUAL,tD.EQUAL,tD.NOT_EQUAL,tD.NULLISH_COALESCING_OPERATOR])}static{this.BITWISE_OPERATORS=new Set([tD.BITWISE_AND,tD.BITWISE_COMPLEMENT,tD.BITWISE_LEFT_SHIFT,tD.BITWISE_OR,tD.BITWISE_RIGHT_SHIFT,tD.BITWISE_UNSIGNED_RIGHT_SHIFT,tD.BITWISE_XOR])}static{this.CONDITIONAL_OPERATORS=new Set([tD.CONDITIONAL_TERNARY_OPERATOR])}static{this.OPERATOR_PRIORITY=new Map([[tD.UNARY_PLUS,1],[tD.UNARY_MINUS,1],[tD.UNARY_LOGICAL_NOT,1],[tD.UNARY_BITWISE_COMPLEMENT,1],[tD.ARRAY_OPERATOR,1],[tD.OBJECT_OPERATOR,1],[tD.MULTIPLICATION,2],[tD.DIVISION,2],[tD.INTEGER_DIVISION,2],[tD.MOD,2],[tD.ADDITION,3],[tD.SUBTRACTION,3],[tD.BITWISE_LEFT_SHIFT,4],[tD.BITWISE_RIGHT_SHIFT,4],[tD.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[tD.LESS_THAN,5],[tD.LESS_THAN_EQUAL,5],[tD.GREATER_THAN,5],[tD.GREATER_THAN_EQUAL,5],[tD.EQUAL,6],[tD.NOT_EQUAL,6],[tD.BITWISE_AND,7],[tD.BITWISE_XOR,8],[tD.BITWISE_OR,9],[tD.AND,10],[tD.OR,11],[tD.NULLISH_COALESCING_OPERATOR,11],[tD.CONDITIONAL_TERNARY_OPERATOR,12]])}static{this.OPERATORS=new Set([...Array.from(tD.ARITHMETIC_OPERATORS),...Array.from(tD.LOGICAL_OPERATORS),...Array.from(tD.BITWISE_OPERATORS),tD.ARRAY_OPERATOR,tD.OBJECT_OPERATOR,...Array.from(tD.CONDITIONAL_OPERATORS)].map(e=>e.getOperator()))}static{this.OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(tD.ARITHMETIC_OPERATORS),...Array.from(tD.LOGICAL_OPERATORS),...Array.from(tD.BITWISE_OPERATORS),tD.ARRAY_OPERATOR,tD.OBJECT_OPERATOR,...Array.from(tD.CONDITIONAL_OPERATORS)].filter(e=>!e.shouldBeWrappedInSpace()).map(e=>e.getOperator()))}static{this.OPERATION_VALUE_OF=new Map(Array.from(tD.VALUE_OF.entries()).map(([e,t])=>[t.getOperator(),t]))}static{this.UNARY_MAP=new Map([[tD.ADDITION,tD.UNARY_PLUS],[tD.SUBTRACTION,tD.UNARY_MINUS],[tD.NOT,tD.UNARY_LOGICAL_NOT],[tD.BITWISE_COMPLEMENT,tD.UNARY_BITWISE_COMPLEMENT],[tD.UNARY_PLUS,tD.UNARY_PLUS],[tD.UNARY_MINUS,tD.UNARY_MINUS],[tD.UNARY_LOGICAL_NOT,tD.UNARY_LOGICAL_NOT],[tD.UNARY_BITWISE_COMPLEMENT,tD.UNARY_BITWISE_COMPLEMENT]])}static{this.BIGGEST_OPERATOR_SIZE=Array.from(tD.VALUE_OF.values()).map(e=>e.getOperator()).filter(e=>!e.startsWith("UN: ")).map(e=>e.length).reduce((e,t)=>e>t?e:t,0)}constructor(e,t,r=!1){this.operator=e,this.operatorName=t??e,this._shouldBeWrappedInSpace=r}getOperator(){return this.operator}getOperatorName(){return this.operatorName}shouldBeWrappedInSpace(){return this._shouldBeWrappedInSpace}valueOf(e){return tD.VALUE_OF.get(e)}toString(){return this.operator}}class tb extends tv{constructor(e,t,r,s){super(e||""),this.tokens=new el,this.ops=new el,t&&this.tokens.push(t),r&&this.tokens.push(r),s&&this.ops.push(s),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){let e;let t=this.expression.length,r="",s=new tI(""),n=0,a=!1;for(;n<t;){switch(r=this.expression[n],e=s.toString(),r){case" ":a=this.processTokenSepearator(s,e,a);break;case"(":n=this.processSubExpression(t,s,e,n,a),a=!1;break;case")":throw new tx(this.expression,"Extra closing parenthesis found");case"]":throw new tx(this.expression,"Extra closing square bracket found");case"'":case'"':{let e=this.processStringLiteral(t,r,n);n=e.getT1(),a=e.getT2();break}case"?":if(n+1<t&&"?"!=this.expression.charAt(n+1)&&0!=n&&"?"!=this.expression.charAt(n-1))n=this.processTernaryOperator(t,s,e,n,a);else{let i=this.processOthers(r,t,s,e,n,a);n=i.getT1(),(a=i.getT2())&&this.ops.peek()==tD.ARRAY_OPERATOR&&(n=(i=this.process(t,s,n)).getT1(),a=i.getT2())}break;default:let i=this.processOthers(r,t,s,e,n,a);n=i.getT1(),(a=i.getT2())&&this.ops.peek()==tD.ARRAY_OPERATOR&&(n=(i=this.process(t,s,n)).getT1(),a=i.getT2())}++n}if(e=s.toString(),!eg.isNullOrBlank(e)){if(tD.OPERATORS.has(e))throw new tx(this.expression,"Expression is ending with an operator");this.tokens.push(new tv(e))}}processStringLiteral(e,t,r){let s="",n=r+1;for(;n<e;n++){let e=this.expression.charAt(n);if(e==t&&"\\"!=this.expression.charAt(n-1))break;s+=e}if(n==e&&this.expression.charAt(n-1)!=t)throw new tx(this.expression,"Missing string ending marker "+t);let a=new eN(n,!1);return this.tokens.push(new tV(s,s)),a}process(e,t,r){let s=1;for(++r;r<e&&0!=s;){let e=this.expression.charAt(r);"]"==e?--s:"["==e&&++s,0!=s&&(t.append(e),r++)}return this.tokens.push(new tb(t.toString())),t.setLength(0),new eN(r,!1)}processOthers(e,t,r,s,n,a){let i=t-n;i=i<tD.BIGGEST_OPERATOR_SIZE?i:tD.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(n,n+e);if(tD.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return eg.isNullOrBlank(s)||(this.tokens.push(new tv(s)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,tD.OPERATION_VALUE_OF.get(t),a),a=!0,r.setLength(0),new eN(n+e-1,a)}return r.append(e),new eN(n,!1)}processTernaryOperator(e,t,r,s,n){if(n)throw new tx(this.expression,"Ternary operator is followed by an operator");""!=r.trim()&&(this.tokens.push(new tb(r)),t.setLength(0));let a=1,i="",o=++s;for(;s<e&&a>0;)"?"==(i=this.expression.charAt(s))?++a:":"==i&&--a,++s;if(":"!=i)throw new tx(this.expression,"':' operater is missing");if(s>=e)throw new tx(this.expression,"Third part of the ternary expression is missing");for(;!this.ops.isEmpty()&&this.hasPrecedence(tD.CONDITIONAL_TERNARY_OPERATOR,this.ops.peek());){let e=this.ops.pop();if(tD.UNARY_OPERATORS.has(e)){let t=this.tokens.pop();this.tokens.push(new tb("",t,void 0,e))}else{let t=this.tokens.pop(),r=this.tokens.pop();this.tokens.push(new tb("",r,t,e))}}this.ops.push(tD.CONDITIONAL_TERNARY_OPERATOR),this.tokens.push(new tb(this.expression.substring(o,s-1)));let E=this.expression.substring(s);if(""===E.trim())throw new tx(this.expression,"Third part of the ternary expression is missing");return this.tokens.push(new tb(E)),e-1}processSubExpression(e,t,r,s,n){if(tD.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,tD.OPERATION_VALUE_OF.get(r),n),t.setLength(0);else if(!eg.isNullOrBlank(r))throw new tx(this.expression,eT.format("Unkown token : $ found.",r));let a=1,i=new tI,o=this.expression.charAt(s);for(s++;s<e&&a>0;)"("==(o=this.expression.charAt(s))?a++:")"==o&&a--,0!=a&&(i.append(o),s++);if(")"!=o)throw new tx(this.expression,"Missing a closed parenthesis");for(;i.length()>2&&"("==i.charAt(0)&&")"==i.charAt(i.length()-1);)i.deleteCharAt(0),i.setLength(i.length()-1);return this.tokens.push(new tb(i.toString().trim())),s}processTokenSepearator(e,t,r){return eg.isNullOrBlank(t)||(tD.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,tD.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new tv(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,s){if(r){if(s||e.isEmpty()){if(tD.UNARY_OPERATORS.has(r)){let e=tD.UNARY_MAP.get(r);e&&t.push(e)}else throw new tx(this.expression,eT.format("Extra operator $ found.",r))}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(tD.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new tb("",t,void 0,r))}else{let t=e.pop(),s=e.pop();e.push(new tb("",s,t,r))}}t.push(r)}}}hasPrecedence(e,t){let r=tD.OPERATOR_PRIORITY.get(e),s=tD.OPERATOR_PRIORITY.get(t);if(!r||!s)throw Error("Unknown operators provided");return s<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new tI,t=0,r=this.ops.toArray(),s=this.tokens.toArray();for(let n=0;n<r.length;n++)if(r[n].getOperator().startsWith("UN: "))e.append("(").append(r[n].getOperator().substring(4)).append(s[t]instanceof tb?s[t].toString():s[t]).append(")"),t++;else if(r[n]==tD.CONDITIONAL_TERNARY_OPERATOR){let r=s[t++];e.insert(0,r.toString()),e.insert(0,":"),r=s[t++],e.insert(0,r.toString()),e.insert(0,"?"),r=s[t++],e.insert(0,r.toString()).append(")"),e.insert(0,"(")}else{if(0==t){let r=s[t++];e.insert(0,r.toString())}let a=s[t++];e.insert(0,r[n].getOperator()).insert(0,a.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var tG={};E(tG,"TokenValueExtractor",()=>tF);class tF{static{this.REGEX_SQUARE_BRACKETS=/[\[\]]/}static{this.REGEX_DOT=/\./}getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new er(eT.format("Token $ doesn't start with $",e,t));if(e.endsWith(".__index")){let t=e.substring(0,e.length-8),r=this.getValueInternal(t);if(!R(r?.__index))return r.__index;if(!t.endsWith("]"))return t.substring(t.lastIndexOf(".")+1);{let e=t.substring(t.lastIndexOf("[")+1,t.length-1),r=parseInt(e);return isNaN(r)?e:r}}return this.getValueInternal(e)}retrieveElementFrom(e,t,r,s){if(R(s))return;if(t.length==r)return s;let n=t[r].split(tF.REGEX_SQUARE_BRACKETS).map(e=>e.trim()).filter(e=>!eg.isNullOrBlank(e)).reduce((s,n)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,n,s),s);return this.retrieveElementFrom(e,t,r+1,n)}resolveForEachPartOfTokenWithBrackets(e,t,r,s,n){if(!R(n))return"length"===s?this.getLength(e,n):Array.isArray(n)?this.handleArrayAccess(e,s,n):this.handleObjectAccess(e,t,r,s,n)}getLength(e,t){let r=typeof t;if("string"===r||Array.isArray(t))return t.length;if("object"===r)return"length"in t?t.length:Object.keys(t).length;throw new tx(e,eT.format("Length can't be found in token $",e))}handleArrayAccess(e,t,r){let s=parseInt(t);if(isNaN(s))throw new tx(e,eT.format("$ is not a number",t));if(!(s<0)&&!(s>=r.length))return r[s]}handleObjectAccess(e,t,r,s,n){if(s.startsWith('"')){if(!s.endsWith('"')||1==s.length||2==s.length)throw new tx(e,eT.format("$ is missing a double quote or empty key found",e));s=s.substring(1,t.length-2)}return this.checkIfObject(e,t,r,n),n[s]}checkIfObject(e,t,r,s){if("object"!=typeof s||Array.isArray(s))throw new tx(e,eT.format("Unable to retrieve $ from $ in the path $",t[r],s.toString(),e))}}class tB extends tF{constructor(e,t){super(),this.store=e,this.prefix=t}getValueInternal(e){let t=e.split(tF.REGEX_DOT);return this.retrieveElementFrom(e,t,1,this.store)}getStore(){return this.store}setStore(e){return this.store=e,this}setValue(e,t,r=!0,s=!1){this.store=ta(this.store),this.modifyStore(e,t,r,s)}modifyStore(e,t,r,s){let n=new tb(e),a=n.getTokens();a.removeLast();let i=n.getOperations(),o=i.removeLast(),E=a.removeLast(),u=E instanceof tV?E.getElement():E.getExpression(),A=this.store;for(;!i.isEmpty();)A=o==tD.OBJECT_OPERATOR?this.getDataFromObject(A,u,i.peekLast()):this.getDataFromArray(A,u,i.peekLast()),o=i.removeLast(),u=(E=a.removeLast())instanceof tV?E.getElement():E.getExpression();o==tD.OBJECT_OPERATOR?this.putDataInObject(A,u,t,r,s):this.putDataInArray(A,u,t,r,s)}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new er(eT.format("Expected an array index but found $",t));if(s<0)throw new er(eT.format("Array index is out of bound - $",t));let n=e[s];return R(n)&&(n=r==tD.OBJECT_OPERATOR?{}:[],e[s]=n),n}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));let s=e[t];return R(s)&&(s=r==tD.OBJECT_OPERATOR?{}:[],e[t]=s),s}putDataInArray(e,t,r,s,n){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let a=parseInt(t);if(isNaN(a))throw new er(eT.format("Expected an array index but found $",t));if(a<0)throw new er(eT.format("Array index is out of bound - $",t));(s||R(e[a]))&&(n&&R(r)?e.splice(a,1):e[a]=r)}putDataInObject(e,t,r,s,n){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));(s||R(e[t]))&&(n&&R(r)?delete e[t]:e[t]=r)}getPrefix(){return this.prefix}}class tY extends e1{constructor(){super("Sort",[tY.PARAMETER_ARRAY_SOURCE,tY.PARAMETER_INT_FIND_FROM,tY.PARAMETER_INT_LENGTH,tY.PARAMETER_BOOLEAN_ASCENDING,tY.PARAMETER_KEY_PATH],tY.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tY.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tY.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(tY.PARAMETER_INT_LENGTH.getParameterName()),n=e?.getArguments()?.get(tY.PARAMETER_BOOLEAN_ASCENDING.getParameterName()),a=e?.getArguments()?.get(tY.PARAMETER_KEY_PATH.getParameterName());if(0==t.length)return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);if(t=[...t],-1==s&&(s=t.length-r),r<0||r>=t.length||r+s>t.length)throw new er("Given start point is more than the size of the array or not available at that point");let i=t.slice(r,r+s+1),o=new tB({},"Data.");return i.sort((e,t)=>"object"==typeof e&&"object"==typeof t&&a.length?(o.setStore({a:e,b:t}),tH(o.getValue("Data.a."+a),o.getValue("Data.b."+a),n)):tH(e,t,n)),t.splice(r,s,...i),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}function tH(e,t,r){return e===t?0:null===e?1:null===t?-1:r?e<t?-1:1:e<t?1:-1}class tk extends e1{constructor(){super("SubArray",[tk.PARAMETER_ARRAY_SOURCE,tk.PARAMETER_INT_FIND_FROM,tk.PARAMETER_INT_LENGTH],tk.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tk.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tk.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(tk.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),s<=0)return new es([Z.outputOf(new Map([]))]);if(!(r>=0&&r<t.length)||r+s>t.length)throw new er("Given find from point is more than the source size array or the Requested length for the subarray was more than the source size");let n=t.slice(r,r+s);return new es([Z.outputOf(new Map([[tk.EVENT_RESULT_NAME,n]]))])}}class t$ extends e1{constructor(){super("Insert",[t$.PARAMETER_ARRAY_SOURCE,t$.PARAMETER_INT_OFFSET,t$.PARAMETER_ANY],t$.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(t$.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t$.PARAMETER_INT_OFFSET.getParameterName());var s=e?.getArguments()?.get(t$.PARAMETER_ANY.getParameterName());if(R(s)||R(r)||r>t.length)throw new er("Please valid resouces to insert at the correct location");if(0==(t=[...t]).length)return 0==r&&t.push(s),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))]);t.push(s);let n=t.length-1;for(r++;n>=r;){let e=t[n-1];t[n-1]=t[n],t[n--]=e}return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tj extends e1{constructor(){super("InsertLast",[tj.PARAMETER_ARRAY_SOURCE,tj.PARAMETER_ANY],tj.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tj.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tj.PARAMETER_ANY.getParameterName());return(t=[...t]).push(r),new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,t]]))])}}class tW extends e1{constructor(){super("RemoveDuplicates",[tW.PARAMETER_ARRAY_SOURCE,tW.PARAMETER_INT_SOURCE_FROM,tW.PARAMETER_INT_LENGTH],tW.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tW.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tW.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tW.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length-r),r+s>t.length)throw new er(eT.format("Array has no elements from $ to $ as the array size is $",r,r+s,t.length));let n=[...t],a=r+s;for(let e=a-1;e>=r;e--)for(let t=e-1;t>=r;t--)if(eh(n[e],n[t])){n.splice(e,1);break}return new es([Z.outputOf(j.of(tW.EVENT_RESULT_NAME,n))])}}const tX="keyPath",tJ="valuePath",tq="ignoreNullValues",tz="ignoreNullKeys",tK="ignoreDuplicateKeys";class tQ extends e1{constructor(){super("ArrayToObjects",[e1.PARAMETER_ARRAY_SOURCE,k.of(tX,D.ofString(tX)),k.of(tJ,D.of(tJ,p.STRING,p.NULL)),k.of(tq,D.ofBoolean(tq).setDefaultValue(!1)),k.of(tz,D.ofBoolean(tz).setDefaultValue(!0)),k.of(tK,D.ofBoolean(tK).setDefaultValue(!1))],e1.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(e1.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tX),s=e?.getArguments()?.get(tJ)??"",n=e?.getArguments()?.get(tq),a=e?.getArguments()?.get(tz),i=e?.getArguments()?.get(tK),o=new tB({},"Data."),E=t.filter(e=>!R(e)).reduce((e,t)=>{o.setStore(t);let E=o.getValue("Data."+r);if(a&&R(E))return e;let u=s?o.getValue("Data."+s):t;return n&&R(u)||i&&e.hasOwnProperty(E)||(e[E]=u),e},{});return new es([Z.outputOf(new Map([[e1.EVENT_RESULT_NAME,E]]))])}}const tZ="source",t0="delimiter",t1="result";class t2 extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(tZ),r=e?.getArguments()?.get(t0);return new es([Z.outputOf(new Map([[t1,t.join(r)]]))])}constructor(...e){super(...e),this.signature=new ea("Join").setNamespace(l.SYSTEM_ARRAY).setParameters(new Map([[tZ,new k(tZ,D.ofArray(tZ,D.of("each",p.STRING,p.INTEGER,p.LONG,p.DOUBLE,p.FLOAT,p.NULL)))],[t0,new k(t0,D.ofString(t0).setDefaultValue(""))]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[t1,D.ofString(t1)]]))]))}}class t9{async find(e,t){return e!=l.SYSTEM_ARRAY?Promise.resolve(void 0):Promise.resolve(this.repoMap.get(t))}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}constructor(){this.repoMap=j.ofArrayEntries(q(new e2),q(new e9),q(new te),q(new ts),q(new ti),q(new to),q(new tE),q(new tu),q(new tA),q(new tT),q(new tl),q(new tm),q(new th),q(new tR),q(new tg),q(new tc),q(new tp),q(new tN),q(new tf),q(new t_),q(new tM),q(new tS),q(new tO),q(new tY),q(new tk),q(new e4),q(new t$),q(new tj),q(new tW),q(new tQ),q(new t2)),this.filterableNames=Array.from(this.repoMap.values()).map(e=>e.getSignature().getFullName())}}var t3={};E(t3,"ContextElement",()=>t4);class t4{static{this.NULL=new t4(D.NULL,void 0)}constructor(e,t){this.schema=e,this.element=t}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getElement(){return this.element}setElement(e){return this.element=e,this}}const t5="name",t6="schema";class t7 extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(t5);if(e?.getContext()?.has(t))throw new er(eT.format("Context already has an element for '$' ",t));let r=D.from(e?.getArguments()?.get(t6));if(!r)throw new er("Schema is not supplied.");return e.getContext().set(t,new t4(r,R(r.getDefaultValue())?void 0:r.getDefaultValue())),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Create").setNamespace(l.SYSTEM_CTX).setParameters(new Map([k.ofEntry(t5,new D().setName(t5).setType(d.of(p.STRING)).setMinLength(1).setFormat(eB.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,Y.CONSTANT),k.ofEntry(t6,D.SCHEMA,!1,Y.CONSTANT)])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}const t8="name",re="value";class rt extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(t8);if(!e.getContext()?.has(t))throw new er(eT.format("Context don't have an element for '$' ",t));return new es([Z.outputOf(new Map([re,e.getContext()?.get(t)?.getElement()]))])}constructor(...e){super(...e),this.signature=new ea("Get").setNamespace(l.SYSTEM_CTX).setParameters(new Map([k.ofEntry(t8,new D().setName(t8).setType(d.of(p.STRING)).setMinLength(1).setFormat(eB.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,Y.CONSTANT)])).setEvents(new Map([Q.outputEventMapEntry(new Map([[re,D.ofAny(re)]]))]))}}var rr={};E(rr,"ExpressionEvaluator",()=>sa);var rs={};E(rs,"LogicalNullishCoalescingOperator",()=>ri);var rn={};E(rn,"BinaryOperator",()=>ra);class ra{nullCheck(e,t,r){if(R(e)||R(t))throw new e7(eT.format("$ cannot be applied to a null value",r.getOperatorName()))}}class ri extends ra{apply(e,t){return R(e)?t:e}}var ro={};E(ro,"ArithmeticAdditionOperator",()=>rE);class rE extends ra{apply(e,t){return R(e)?t:R(t)?e:e+t}}var ru={};E(ru,"ArithmeticDivisionOperator",()=>rA);class rA extends ra{apply(e,t){return this.nullCheck(e,t,tD.DIVISION),e/t}}var rT={};E(rT,"ArithmeticIntegerDivisionOperator",()=>rl);class rl extends ra{apply(e,t){return this.nullCheck(e,t,tD.DIVISION),Math.floor(e/t)}}var rm={};E(rm,"ArithmeticModulusOperator",()=>rh);class rh extends ra{apply(e,t){return this.nullCheck(e,t,tD.MOD),e%t}}var rR={};E(rR,"ArithmeticMultiplicationOperator",()=>rg);class rg extends ra{apply(e,t){this.nullCheck(e,t,tD.MULTIPLICATION);let r="string"==typeof e,s=typeof t;if(r||"string"===s){let s=r?e:t,n=r?t:e,a="",i=n<0,o=Math.floor(n=Math.abs(n));for(;o-- >0;)a+=s;let E=Math.floor(s.length*(n-Math.floor(n)));if(E<0&&(E=-E),0!=E&&(a+=s.substring(0,E)),i){let e="";for(let t=a.length-1;t>=0;t--)e+=a[t];return e}return a}return e*t}}var rc={};E(rc,"ArithmeticSubtractionOperator",()=>rp);class rp extends ra{apply(e,t){return this.nullCheck(e,t,tD.SUBTRACTION),e-t}}var rN={};E(rN,"ArrayOperator",()=>rf);class rf extends ra{apply(e,t){if(!e)throw new e7("Cannot apply array operator on a null value");if(!t)throw new e7("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new e7(eT.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new e7(eT.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var r_={};E(r_,"BitwiseAndOperator",()=>rM);class rM extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_AND),e&t}}var rS={};E(rS,"BitwiseLeftShiftOperator",()=>rO);class rO extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_LEFT_SHIFT),e<<t}}var rw={};E(rw,"BitwiseOrOperator",()=>rd);class rd extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_OR),e|t}}var rP={};E(rP,"BitwiseRightShiftOperator",()=>rI);class rI extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_RIGHT_SHIFT),e>>t}}var ry={};E(ry,"BitwiseUnsignedRightShiftOperator",()=>rx);class rx extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var rL={};E(rL,"BitwiseXorOperator",()=>rv);class rv extends ra{apply(e,t){return this.nullCheck(e,t,tD.BITWISE_XOR),e^t}}var rU={};E(rU,"LogicalAndOperator",()=>rV);class rV extends ra{apply(e,t){return!!e&&""!==e&&!!t&&""!==t}}var rC={};E(rC,"LogicalEqualOperator",()=>rD);class rD extends ra{apply(e,t){return eh(e,t)}}var rb={};E(rb,"LogicalGreaterThanEqualOperator",()=>rG);class rG extends ra{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare >= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>=s.getT2()}}var rF={};E(rF,"LogicalGreaterThanOperator",()=>rB);class rB extends ra{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare > with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>s.getT2()}}var rY={};E(rY,"LogicalLessThanEqualOperator",()=>rH);class rH extends ra{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare <= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<=s.getT2()}}var rk={};E(rk,"LogicalLessThanOperator",()=>r$);class r$ extends ra{apply(e,t){let r=e8.findPrimitiveNullAsBoolean(e),s=e8.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new e7(eT.format("Cannot compare < with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<s.getT2()}}var rj={};E(rj,"LogicalNotEqualOperator",()=>rW);class rW extends ra{apply(e,t){return!eh(e,t)}}var rX={};E(rX,"LogicalOrOperator",()=>rJ);class rJ extends ra{apply(e,t){return!!e&&""!==e||!!t&&""!==t}}var rq={};E(rq,"ObjectOperator",()=>rz);class rz extends ra{apply(e,t){if(!e)throw new e7("Cannot apply array operator on a null value");if(!t)throw new e7("Cannot retrive null property value");let r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new e7(eT.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var rK={};E(rK,"ArithmeticUnaryMinusOperator",()=>r0);var rQ={};E(rQ,"UnaryOperator",()=>rZ);class rZ{nullCheck(e,t){if(R(e))throw new e7(eT.format("$ cannot be applied to a null value",t.getOperatorName()))}}class r0 extends rZ{apply(e){return this.nullCheck(e,tD.UNARY_MINUS),e8.findPrimitiveNumberType(e),-e}}var r1={};E(r1,"ArithmeticUnaryPlusOperator",()=>r2);class r2 extends rZ{apply(e){return this.nullCheck(e,tD.UNARY_PLUS),e8.findPrimitiveNumberType(e),e}}var r9={};E(r9,"BitwiseComplementOperator",()=>r3);class r3 extends rZ{apply(e){this.nullCheck(e,tD.UNARY_BITWISE_COMPLEMENT);let t=e8.findPrimitiveNumberType(e);if(t.getT1()!=p.INTEGER&&t.getT1()!=p.LONG)throw new e7(eT.format("Unable to apply bitwise operator on $",e));return~e}}var r4={};E(r4,"LogicalNotOperator",()=>r5);class r5 extends rZ{apply(e){return!e&&""!==e}}var r6={};E(r6,"LiteralTokenValueExtractor",()=>r8);const r7=new Map([["true",!0],["false",!1],["null",void 0],["undefined",void 0]]);class r8 extends tF{static{this.INSTANCE=new r8}getValueInternal(e){if(!eg.isNullOrBlank(e))return(e=e.trim(),r7.has(e))?r7.get(e):e.startsWith('"')?this.processString(e):this.processNumbers(e)}processNumbers(e){try{let t=Number(e);if(isNaN(t))throw Error("Parse number error");return t}catch(t){throw new tx(e,eT.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new tx(e,eT.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}getStore(){}getValueFromExtractors(e,t){return t.has(e+".")?t.get(e+".")?.getStore():this.getValue(e)}}var se={},st={};E(st,"ConditionalTernaryOperator",()=>ss);class sr{nullCheck(e,t,r,s){if(R(e)||R(t)||R(r))throw new e7(eT.format("$ cannot be applied to a null value",s.getOperatorName()))}}class ss extends sr{apply(e,t,r){return e?t:r}}o(se,st);class sn extends tF{static{this.PREFIX="_internal."}addValue(e,t){this.values.set(e,t)}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.values.get(r))}getPrefix(){return sn.PREFIX}getStore(){}constructor(...e){super(...e),this.values=new Map}}class sa{static{this.UNARY_OPERATORS_MAP=new Map([[tD.UNARY_BITWISE_COMPLEMENT,new r3],[tD.UNARY_LOGICAL_NOT,new r5],[tD.UNARY_MINUS,new r0],[tD.UNARY_PLUS,new r2]])}static{this.TERNARY_OPERATORS_MAP=new Map([[tD.CONDITIONAL_TERNARY_OPERATOR,new ss]])}static{this.BINARY_OPERATORS_MAP=new Map([[tD.ADDITION,new rE],[tD.DIVISION,new rA],[tD.INTEGER_DIVISION,new rl],[tD.MOD,new rh],[tD.MULTIPLICATION,new rg],[tD.SUBTRACTION,new rp],[tD.BITWISE_AND,new rM],[tD.BITWISE_LEFT_SHIFT,new rO],[tD.BITWISE_OR,new rd],[tD.BITWISE_RIGHT_SHIFT,new rI],[tD.BITWISE_UNSIGNED_RIGHT_SHIFT,new rx],[tD.BITWISE_XOR,new rv],[tD.AND,new rV],[tD.EQUAL,new rD],[tD.GREATER_THAN,new rB],[tD.GREATER_THAN_EQUAL,new rG],[tD.LESS_THAN,new r$],[tD.LESS_THAN_EQUAL,new rH],[tD.OR,new rJ],[tD.NOT_EQUAL,new rW],[tD.NULLISH_COALESCING_OPERATOR,new ri],[tD.ARRAY_OPERATOR,new rf],[tD.OBJECT_OPERATOR,new rz]])}static{this.UNARY_OPERATORS_MAP_KEY_SET=new Set(sa.UNARY_OPERATORS_MAP.keys())}constructor(e){this.internalTokenValueExtractor=new sn,e instanceof tb?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){let t=this.processNestingExpression(this.expression,e);return this.expression=t.getT1(),this.exp=t.getT2(),(e=new Map(e.entries())).set(this.internalTokenValueExtractor.getPrefix(),this.internalTokenValueExtractor),this.evaluateExpression(this.exp,e)}processNestingExpression(e,t){let r=0,s=0,n=new el;for(;s<e.length-1;){if("{"==e.charAt(s)&&"{"==e.charAt(s+1))0==r&&n.push(new eN(s+2,-1)),r++,s++;else if("}"==e.charAt(s)&&"}"==e.charAt(s+1)){if(--r<0)throw new tx(e,"Expecting {{ nesting path operator to be started before closing");0==r&&n.push(n.pop().setT2(s)),s++}s++}let a=this.replaceNestingExpression(e,t,n);return new eN(a,new tb(a))}replaceNestingExpression(e,t,r){let s=e;for(let n of r.toArray()){if(-1==n.getT2())throw new tx(e,"Expecting }} nesting path operator to be closed");let r=new sa(s.substring(n.getT1(),n.getT2())).evaluate(t);s=s.substring(0,n.getT1()-2)+r+s.substring(n.getT2()+2)}return s}getExpression(){return this.exp||(this.exp=new tb(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),s=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),n=s.pop();if(sa.UNARY_OPERATORS_MAP_KEY_SET.has(e))s.push(this.applyUnaryOperation(e,this.getValueFromToken(t,n)));else if(e==tD.OBJECT_OPERATOR||e==tD.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,s,e,n);else if(e==tD.CONDITIONAL_TERNARY_OPERATOR){let r=s.pop(),a=s.pop(),i=this.getValueFromToken(t,a),o=this.getValueFromToken(t,r),E=this.getValueFromToken(t,n);s.push(this.applyTernaryOperation(e,i,o,E))}else{let r=s.pop(),a=this.getValueFromToken(t,r),i=this.getValueFromToken(t,n);s.push(this.applyBinaryOperation(e,a,i))}}if(s.isEmpty())throw new e7(eT.format("Expression : $ evaluated to null",e));if(1!=s.size())throw new e7(eT.format("Expression : $ evaluated multiple values $",e,s));let n=s.get(0);if(n instanceof tV)return n.getElement();if(!(n instanceof tb))return this.getValueFromToken(t,n);throw new e7(eT.format("Expression : $ evaluated to $",e,s.get(0)))}processObjectOrArrayOperator(e,t,r,s,n){let a=new el,i=new el;if(!s||!n)return;do i.push(s),n instanceof tb?a.push(new tV(n.toString(),this.evaluateExpression(n,e))):n&&a.push(n),n=r.isEmpty()?void 0:r.pop(),s=t.isEmpty()?void 0:t.pop();while(s==tD.OBJECT_OPERATOR||s==tD.ARRAY_OPERATOR)n&&(n instanceof tb?a.push(new tV(n.toString(),this.evaluateExpression(n,e))):a.push(n)),s&&t.push(s);let o=a.pop();if(o instanceof tV&&"object"==typeof o.getTokenValue()){let e=new Date().getTime()+""+Math.round(1e3*Math.random());this.internalTokenValueExtractor.addValue(e,o.getTokenValue()),o=new tv(sn.PREFIX+e)}let E=new tI(o instanceof tV?o.getTokenValue():o.toString());for(;!a.isEmpty();)o=a.pop(),s=i.pop(),E.append(s.getOperator()).append(o instanceof tV?o.getTokenValue():o.toString()),s==tD.ARRAY_OPERATOR&&E.append("]");let u=E.toString(),A=u.substring(0,u.indexOf(".")+1);if(A.length>2&&e.has(A))r.push(new tV(u,this.getValue(u,e)));else{let e;try{e=r8.INSTANCE.getValue(u)}catch(t){e=u}r.push(new tV(u,e))}}applyTernaryOperation(e,t,r,s){let n=sa.TERNARY_OPERATORS_MAP.get(e);if(!n)throw new tx(this.expression,eT.format("No operator found to evaluate $",this.getExpression()));return new tV(e.toString(),n.apply(t,r,s))}applyBinaryOperation(e,t,r){let s=typeof t,n=typeof r,a=sa.BINARY_OPERATORS_MAP.get(e);if(("object"===s||"object"===n)&&e!==tD.EQUAL&&e!==tD.NOT_EQUAL&&e!==tD.NULLISH_COALESCING_OPERATOR&&e!==tD.AND&&e!==tD.OR)throw new tx(this.expression,eT.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));if(!a)throw new tx(this.expression,eT.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new tV(e.toString(),a.apply(t,r))}applyUnaryOperation(e,t){let r=typeof t;if(e.getOperator()!=tD.NOT.getOperator()&&e.getOperator()!=tD.UNARY_LOGICAL_NOT.getOperator()&&("object"===r||Array.isArray(t)))throw new tx(this.expression,eT.format("The operator $ cannot be applied to $",e.getOperator(),t));let s=sa.UNARY_OPERATORS_MAP.get(e);if(!s)throw new tx(this.expression,eT.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new tV(e.toString(),s.apply(t))}getValueFromToken(e,t){return t instanceof tb?this.evaluateExpression(t,e):t instanceof tV?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){let r=e.substring(0,e.indexOf(".")+1);return t.has(r)?t.get(r).getValue(e):r8.INSTANCE.getValueFromExtractors(e,t)}}const si="name",so="value";class sE extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(si);if(eg.isNullOrBlank(t))throw new er("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get(so),s=new tb(t),n=s.getTokens().peekLast();if(!n.getExpression().startsWith("Context")||n instanceof tb||n instanceof tV&&!n.getElement().toString().startsWith("Context"))throw new e7(eT.format("The context path $ is not a valid path in context",t));for(let e of s.getOperations().toArray())if(e!=tD.ARRAY_OPERATOR&&e!=tD.OBJECT_OPERATOR)throw new e7(eT.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<s.getTokens().size();r++){let n=s.getTokens().get(r);n instanceof tb&&s.getTokens().set(r,new tV(t,new sa(n).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,s)}modifyContext(e,t,r,s){let n=s.getTokens();n.removeLast();let a=s.getOperations();a.removeLast();let i=e.getContext()?.get(n.removeLast().getExpression());if(R(i))throw new er(eT.format("Context doesn't have any element with name '$' ",t));if(a.isEmpty())return i.setElement(r),new es([Z.outputOf(new Map)]);let o=i.getElement(),E=a.removeLast(),u=n.removeLast(),A=u instanceof tV?u.getElement():u.getExpression();for(R(o)&&(o=E==tD.OBJECT_OPERATOR?{}:[],i.setElement(o));!a.isEmpty();)o=E==tD.OBJECT_OPERATOR?this.getDataFromObject(o,A,a.peekLast()):this.getDataFromArray(o,A,a.peekLast()),E=a.removeLast(),A=(u=n.removeLast())instanceof tV?u.getElement():u.getExpression();return E==tD.OBJECT_OPERATOR?this.putDataInObject(o,A,r):this.putDataInArray(o,A,r),new es([Z.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new er(eT.format("Expected an array index but found $",t));if(s<0)throw new er(eT.format("Array index is out of bound - $",t));let n=e[s];return R(n)&&(n=r==tD.OBJECT_OPERATOR?{}:[],e[s]=n),n}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));let s=e[t];return R(s)&&(s=r==tD.OBJECT_OPERATOR?{}:[],e[t]=s),s}putDataInArray(e,t,r){if(!Array.isArray(e))throw new er(eT.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new er(eT.format("Expected an array index but found $",t));if(s<0)throw new er(eT.format("Array index is out of bound - $",t));e[s]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new er(eT.format("Expected an object but found $",e));e[t]=r}constructor(...e){super(...e),this.signature=new ea("Set").setNamespace(l.SYSTEM_CTX).setParameters(new Map([k.ofEntry(si,new D().setName(si).setType(d.of(p.STRING)).setMinLength(1),!1),k.ofEntry(so,D.ofAny(so))])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}const su="value",sA="eventName",sT="results";class sl extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getEvents(),r=e.getArguments(),s=r?.get(sA),n=e?.getArguments()?.get(sT).map(t=>{let r=t[su];if(R(r))throw new er("Expect a value object");let s=r.value;return r.isExpression&&(s=new sa(s).evaluate(e.getValuesMap())),[t.name,s]}).reduce((e,t)=>(e.set(t[0],t[1]),e),new Map);return t?.has(s)||t?.set(s,[]),t?.get(s)?.push(n),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("GenerateEvent").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(sA,D.ofString(sA).setDefaultValue("output")),k.ofEntry(sT,D.ofObject(sT).setProperties(new Map([["name",D.ofString("name")],[su,k.EXPRESSION]])),!0)])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}class sm extends e0{static{this.CONDITION="condition"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sm.CONDITION);return new es([Z.of(t||""===t?Q.TRUE:Q.FALSE,new Map),Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("If").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(sm.CONDITION,D.ofAny(sm.CONDITION))])).setEvents(new Map([Q.eventMapEntry(Q.TRUE,new Map),Q.eventMapEntry(Q.FALSE,new Map),Q.outputEventMapEntry(new Map)]))}}const sh="stepName";class sR extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sh);return e.getExecutionContext().set(t,!0),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Break").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sh,D.of(sh,p.STRING))])).setEvents(new Map([Q.outputEventMapEntry(new Map([]))]))}}const sg="count",sc="value",sp="index";class sN extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sg),r=0,s=e.getStatementExecution()?.getStatement()?.getStatementName();return new es({next(){if(r>=t||s&&e.getExecutionContext()?.get(s))return s&&e.getExecutionContext()?.delete(s),Z.outputOf(new Map([[sc,r]]));let n=Z.of(Q.ITERATION,new Map([[sp,r]]));return++r,n}})}constructor(...e){super(...e),this.signature=new ea("CountLoop").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sg,D.of(sg,p.INTEGER))])).setEvents(new Map([Q.eventMapEntry(Q.ITERATION,new Map([[sp,D.of(sp,p.INTEGER)]])),Q.outputEventMapEntry(new Map([[sc,D.of(sc,p.INTEGER)]]))]))}}const sf="source",s_="each",sM="index",sS="value";class sO extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sf),r=0,s=e.getStatementExecution()?.getStatement()?.getStatementName();return new es({next(){if(r>=t.length||s&&e.getExecutionContext()?.get(s))return s&&e.getExecutionContext()?.delete(s),Z.outputOf(new Map([[sS,r]]));let n=Z.of(Q.ITERATION,new Map([[sM,r],[s_,t[r]]]));return++r,n}})}constructor(...e){super(...e),this.signature=new ea("ForEachLoop").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sf,D.ofArray(sf,D.ofAny(sf)))])).setEvents(new Map([Q.eventMapEntry(Q.ITERATION,new Map([[sM,D.of(sM,p.INTEGER)],[s_,D.ofAny(s_)]])),Q.outputEventMapEntry(new Map([[sS,D.of(sS,p.INTEGER)]]))]))}}const sw="from",sd="step",sP="value",sI="index";class sy extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sw),r=e.getArguments()?.get("to"),s=e.getArguments()?.get(sd),n=s>0,a=t,i=!1,o=e.getStatementExecution()?.getStatement()?.getStatementName();return new es({next(){if(i)return;if(n&&a>=r||!n&&a<=r||o&&e.getExecutionContext()?.get(o))return i=!0,o&&e.getExecutionContext()?.delete(o),Z.outputOf(new Map([[sP,a]]));let t=Z.of(Q.ITERATION,new Map([[sI,a]]));return a+=s,t}})}constructor(...e){super(...e),this.signature=new ea("RangeLoop").setNamespace(l.SYSTEM_LOOP).setParameters(new Map([k.ofEntry(sw,D.of(sw,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE).setDefaultValue(0)),k.ofEntry("to",D.of("to",p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE).setDefaultValue(1)),k.ofEntry(sd,D.of(sd,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE).setDefaultValue(1).setNot(new D().setConstant(0)))])).setEvents(new Map([Q.eventMapEntry(Q.ITERATION,new Map([[sI,D.of(sI,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE)]])),Q.outputEventMapEntry(new Map([[sP,D.of(sP,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE)]]))]))}}const sx="value";class sL extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sx);return new es([Z.outputOf(new Map([[sx,t.reduce((e,t)=>e+=t,0)]]))])}constructor(...e){super(...e),this.signature=new ea("Add").setNamespace(l.MATH).setParameters(new Map([[sx,new k(sx,D.ofNumber(sx)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sx,D.ofNumber(sx)]]))]))}}const sv="value",sU="value1",sV="value2";class sC extends e0{constructor(e,t,r=1,...s){super(),this.paramFunctions=[()=>new Map([[sv,new k(sv,D.ofNumber(sv))]]),()=>new Map([[sU,new k(sU,D.ofNumber(sU))],[sV,new k(sV,D.ofNumber(sV))]])],s&&s.length||(s=[p.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new ea(e).setNamespace(l.MATH).setParameters(this.paramFunctions[r-1]()).setEvents(new Map([Q.outputEventMapEntry(new Map([[sv,new D().setType(d.of(...s)).setName(sv)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=e8.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?sv:sU)).getT2();return 2==this.parametersNumber&&(t=e8.findPrimitiveNumberType(e.getArguments()?.get(sV)).getT2()),new es([Z.outputOf(new Map([[sv,this.mathFunction.call(this,r,t)]]))])}}const sD="value";class sb extends e0{constructor(){super(),this.signature=new ea("Hypotenuse").setNamespace(l.MATH).setParameters(new Map([[sD,new k(sD,D.ofNumber(sD)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sD,new D().setType(d.of(p.DOUBLE)).setName(sD)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sD);return new es([Z.outputOf(new Map([[sD,Math.sqrt(t.reduce((e,t)=>e+=t*t,0))]]))])}}const sG="value";class sF extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sG);return new es([Z.outputOf(new Map([[sG,t.reduce((e,t)=>!e&&0!==e||t>e?t:e)]]))])}constructor(...e){super(...e),this.signature=new ea("Maximum").setNamespace(l.MATH).setParameters(new Map([[sG,new k(sG,D.ofNumber(sG)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sG,D.ofNumber(sG)]]))]))}}const sB="value";class sY extends e0{getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sB);return new es([Z.outputOf(new Map([[sB,t.reduce((e,t)=>!e&&0!==e||t<e?t:e)]]))])}constructor(...e){super(...e),this.signature=new ea("Minimum").setNamespace(l.MATH).setParameters(new Map([[sB,new k(sB,D.ofNumber(sB)).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sB,D.ofNumber(sB)]]))]))}}const sH="value";class sk extends e0{getSignature(){return this.signature}async internalExecute(e){return new es([Z.outputOf(new Map([[sH,Math.random()]]))])}constructor(...e){super(...e),this.signature=new ea("Random").setNamespace(l.MATH).setEvents(new Map([Q.outputEventMapEntry(j.of(sH,D.ofDouble(sH)))]))}}class s$ extends e0{static{this.MIN_VALUE="minValue"}static{this.MAX_VALUE="maxValue"}static{this.VALUE="value"}constructor(e,t,r,s,n){super(),this.signature=new ea(e).setParameters(j.of(s$.MIN_VALUE,t,s$.MAX_VALUE,r)).setNamespace(l.MATH).setEvents(new Map([Q.outputEventMapEntry(j.of(s$.VALUE,s))])),this.randomFunction=n}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(s$.MIN_VALUE),r=e.getArguments()?.get(s$.MAX_VALUE),s=this.randomFunction(t,r);return new es([Z.outputOf(new Map([[s$.VALUE,s]]))])}}class sj{constructor(){this.functionObjectsIndex={Absolute:new sC("Absolute",e=>Math.abs(e),1,p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE),ArcCosine:new sC("ArcCosine",e=>Math.acos(e)),ArcSine:new sC("ArcSine",e=>Math.asin(e)),ArcTangent:new sC("ArcTangent",e=>Math.atan(e)),Ceiling:new sC("Ceiling",e=>Math.ceil(e)),Cosine:new sC("Cosine",e=>Math.cos(e)),HyperbolicCosine:new sC("HyperbolicCosine",e=>Math.cosh(e)),CubeRoot:new sC("CubeRoot",e=>Math.cbrt(e)),Exponential:new sC("Exponential",e=>Math.exp(e)),ExponentialMinus1:new sC("ExponentialMinus1",e=>Math.expm1(e)),Floor:new sC("Floor",e=>Math.floor(e)),LogNatural:new sC("LogNatural",e=>Math.log(e)),Log10:new sC("Log10",e=>Math.log10(e)),Round:new sC("Round",e=>Math.round(e),1,p.INTEGER,p.LONG),Sine:new sC("Sine",e=>Math.sin(e)),HyperbolicSine:new sC("HyperbolicSine",e=>Math.sinh(e)),Tangent:new sC("Tangent",e=>Math.tan(e)),HyperbolicTangent:new sC("HyperbolicTangent",e=>Math.tanh(e)),ToDegrees:new sC("ToDegrees",e=>Math.PI/180*e),ToRadians:new sC("ToRadians",e=>180/Math.PI*e),SquareRoot:new sC("SquareRoot",e=>Math.sqrt(e)),ArcTangent2:new sC("ArcTangent2",(e,t)=>Math.atan2(e,t),2),Power:new sC("Power",(e,t)=>Math.pow(e,t),2),Add:new sL,Hypotenuse:new sb,Maximum:new sF,Minimum:new sY,Random:new sk,RandomFloat:new s$("RandomFloat",k.of(s$.MIN_VALUE,D.ofFloat(s$.MIN_VALUE).setDefaultValue(0)),k.of(s$.MAX_VALUE,D.ofFloat(s$.MAX_VALUE).setDefaultValue(0x7fffffff)),D.ofFloat(s$.VALUE),(e,t)=>Math.random()*(t-e)+e),RandomInt:new s$("RandomInt",k.of(s$.MIN_VALUE,D.ofInteger(s$.MIN_VALUE).setDefaultValue(0)),k.of(s$.MAX_VALUE,D.ofInteger(s$.MAX_VALUE).setDefaultValue(0x7fffffff)),D.ofInteger(s$.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomLong:new s$("RandomLong",k.of(s$.MIN_VALUE,D.ofLong(s$.MIN_VALUE).setDefaultValue(0)),k.of(s$.MAX_VALUE,D.ofLong(s$.MAX_VALUE).setDefaultValue(Number.MAX_SAFE_INTEGER)),D.ofLong(s$.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomDouble:new s$("RandomDouble",k.of(s$.MIN_VALUE,D.ofDouble(s$.MIN_VALUE).setDefaultValue(0)),k.of(s$.MAX_VALUE,D.ofDouble(s$.MAX_VALUE).setDefaultValue(Number.MAX_VALUE)),D.ofDouble(s$.VALUE),(e,t)=>Math.random()*(t-e)+e)},this.filterableNames=Object.values(this.functionObjectsIndex).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=l.MATH?Promise.resolve(void 0):Promise.resolve(this.functionObjectsIndex[t])}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sW extends e0{static{this.SOURCE="source"}static{this.SCHEMA="schema"}static{this.VALUE="value"}static{this.CONVERSION_MODE="conversionMode"}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(sW.SOURCE),r=D.from(e?.getArguments()?.get(sW.SCHEMA));if(!r)throw new er("Schema is not supplied.");let s=ek(e.getArguments()?.get(sW.CONVERSION_MODE))||eH.STRICT;return this.convertToSchema(r,e.getSchemaRepository(),t,s)}async convertToSchema(e,t,r,s){try{return new es([Z.outputOf(j.of(sW.VALUE,eZ.validate([],e,t,r,!0,s)))])}catch(e){throw new er(e?.message)}}constructor(...e){super(...e),this.signature=new ea("ObjectConvert").setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(sW.SOURCE,D.ofAny(sW.SCHEMA)),k.ofEntry(sW.SCHEMA,D.SCHEMA,!1,Y.CONSTANT),k.ofEntry(sW.CONVERSION_MODE,D.ofString(sW.CONVERSION_MODE).setEnums(e$()))])).setEvents(new Map([Q.outputEventMapEntry(j.of(sW.VALUE,D.ofAny(sW.VALUE)))]))}}const sX="value",sJ="source";class sq extends e0{constructor(){super(),this.signature=new ea("ObjectDeleteKey").setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(sJ,D.ofAny(sJ)),k.ofEntry("key",D.ofString("key"))])).setEvents(new Map([Q.outputEventMapEntry(new Map([[sX,D.ofAny(sX)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sJ),r=e.getArguments()?.get("key");return R(t)?new es([Z.outputOf(new Map([[sX,void 0]]))]):(t=ta(t),delete t[r],new es([Z.outputOf(new Map([[sX,t]]))]))}}const sz="source";class sK extends e0{constructor(e,t){super(),this.signature=new ea(e).setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(sz,D.ofAny(sz))])).setEvents(new Map([Q.outputEventMapEntry(new Map([["value",t]]))]))}getSignature(){return this.signature}}const sQ="value";class sZ extends sK{constructor(){super("ObjectEntries",D.ofArray(sQ,D.ofArray("tuple",D.ofString("key"),D.ofAny("value"))))}async internalExecute(e){var t=e.getArguments()?.get("source");if(R(t))return new es([Z.outputOf(new Map([[sQ,[]]]))]);let r=Object.entries(ta(t)).sort((e,t)=>e[0].localeCompare(t[0]));return new es([Z.outputOf(new Map([[sQ,r]]))])}}const s0="value";class s1 extends sK{constructor(){super("ObjectKeys",D.ofArray(s0,D.ofString(s0)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(R(t))return new es([Z.outputOf(new Map([[s0,[]]]))]);let r=Object.keys(ta(t)).sort((e,t)=>e.localeCompare(t));return new es([Z.outputOf(new Map([[s0,r]]))])}}const s2="value",s9="source",s3="overwrite",s4="deleteKeyOnNull";class s5 extends e0{constructor(){super(),this.signature=new ea("ObjectPutValue").setNamespace(l.SYSTEM_OBJECT).setParameters(new Map([k.ofEntry(s9,D.ofObject(s9)),k.ofEntry("key",D.ofString("key")),k.ofEntry(s2,D.ofAny(s2)),k.ofEntry(s3,D.ofBoolean(s3).setDefaultValue(!0)),k.ofEntry(s4,D.ofBoolean(s4).setDefaultValue(!1))])).setEvents(new Map([Q.outputEventMapEntry(new Map([[s2,D.ofObject(s2)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(s9),r=e.getArguments()?.get("key"),s=e.getArguments()?.get(s2),n=e.getArguments()?.get(s3),a=e.getArguments()?.get(s4),i=new tB(t,"Data.");return i.setValue(r,s,n,a),new es([Z.outputOf(new Map([[s2,i.getStore()]]))])}}const s6="value";class s7 extends sK{constructor(){super("ObjectValues",D.ofArray(s6,D.ofAny(s6)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(R(t))return new es([Z.outputOf(new Map([[s6,[]]]))]);let r=Object.entries(ta(t)).sort((e,t)=>e[0].localeCompare(t[0])).map(e=>e[1]);return new es([Z.outputOf(new Map([[s6,r]]))])}}class s8{constructor(){this.functionObjectsIndex={ObjectValues:new s7,ObjectKeys:new s1,ObjectEntries:new sZ,ObjectDeleteKey:new sq,ObjectPutValue:new s5,ObjectConvert:new sW},this.filterableNames=Object.values(this.functionObjectsIndex).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=l.SYSTEM_OBJECT?Promise.resolve(void 0):Promise.resolve(this.functionObjectsIndex[t])}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class ne extends e0{static{this.VALUES="values"}static{this.STREAM="stream"}static{this.LOG="LOG"}static{this.ERROR="ERROR"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(ne.VALUES),r=e.getArguments()?.get(ne.STREAM);return(r===ne.LOG?console?.log:console?.error)?.(...t),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Print").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(ne.VALUES,D.ofAny(ne.VALUES),!0),k.ofEntry(ne.STREAM,D.ofString(ne.STREAM).setEnums([ne.LOG,ne.ERROR]).setDefaultValue(ne.LOG))])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}class nt extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_SEARCH_STRING_NAME="searchString"}static{this.PARAMETER_SECOND_STRING_NAME="secondString"}static{this.PARAMETER_THIRD_STRING_NAME="thirdString"}static{this.PARAMETER_INDEX_NAME="index"}static{this.PARAMETER_SECOND_INDEX_NAME="secondIndex"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nt.PARAMETER_STRING_NAME,D.ofString(nt.PARAMETER_STRING_NAME))}static{this.PARAMETER_SECOND_STRING=new k(nt.PARAMETER_SECOND_STRING_NAME,D.ofString(nt.PARAMETER_SECOND_STRING_NAME))}static{this.PARAMETER_THIRD_STRING=new k(nt.PARAMETER_THIRD_STRING_NAME,D.ofString(nt.PARAMETER_THIRD_STRING_NAME))}static{this.PARAMETER_INDEX=new k(nt.PARAMETER_INDEX_NAME,D.ofInteger(nt.PARAMETER_INDEX_NAME))}static{this.PARAMETER_SECOND_INDEX=new k(nt.PARAMETER_SECOND_INDEX_NAME,D.ofInteger(nt.PARAMETER_SECOND_INDEX_NAME))}static{this.PARAMETER_SEARCH_STRING=new k(nt.PARAMETER_SEARCH_STRING_NAME,D.ofString(nt.PARAMETER_STRING_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,j.of(nt.EVENT_RESULT_NAME,D.ofString(nt.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new Q(Q.OUTPUT,j.of(nt.EVENT_RESULT_NAME,D.ofBoolean(nt.EVENT_RESULT_NAME)))}static{this.EVENT_INT=new Q(Q.OUTPUT,j.of(nt.EVENT_RESULT_NAME,D.ofInteger(nt.EVENT_RESULT_NAME)))}static{this.EVENT_ARRAY=new Q(Q.OUTPUT,j.of(nt.EVENT_RESULT_NAME,D.ofArray(nt.EVENT_RESULT_NAME)))}constructor(e,t,r,...s){super();let n=new Map;s.forEach(e=>n.set(e.getParameterName(),e)),this.signature=new ea(t).setNamespace(e).setParameters(n).setEvents(j.of(r.getName(),r))}getSignature(){return this.signature}static ofEntryStringStringAndBooleanOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_SEARCH_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s)))])}}(l.STRING,e,nt.EVENT_BOOLEAN,nt.PARAMETER_STRING,nt.PARAMETER_SEARCH_STRING)]}static ofEntryStringIntegerAndStringOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_INDEX_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s)))])}}(l.STRING,e,nt.EVENT_STRING,nt.PARAMETER_STRING,nt.PARAMETER_INDEX)]}static ofEntryStringStringAndIntegerOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_SEARCH_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s)))])}}(l.STRING,e,nt.EVENT_INT,nt.PARAMETER_STRING,nt.PARAMETER_SEARCH_STRING)]}static ofEntryStringAndStringOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r)))])}}(l.STRING,e,nt.EVENT_STRING,nt.PARAMETER_STRING)]}static ofEntryStringAndBooleanOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r)))])}}(l.STRING,e,nt.EVENT_BOOLEAN,nt.PARAMETER_STRING)]}static ofEntryStringStringIntegerAndIntegerOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_SEARCH_STRING_NAME),n=e?.getArguments()?.get(nt.PARAMETER_INDEX_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s,n)))])}}(l.STRING,e,nt.EVENT_INT,nt.PARAMETER_STRING,nt.PARAMETER_SEARCH_STRING,nt.PARAMETER_INDEX)]}static ofEntryStringIntegerIntegerAndStringOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_INDEX_NAME),n=e?.getArguments()?.get(nt.PARAMETER_SECOND_INDEX_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s,n)))])}}(l.STRING,e,nt.EVENT_STRING,nt.PARAMETER_STRING,nt.PARAMETER_INDEX,nt.PARAMETER_SECOND_INDEX)]}static ofEntryStringStringStringAndStringOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME),s=e?.getArguments()?.get(nt.PARAMETER_SECOND_STRING_NAME),n=e?.getArguments()?.get(nt.PARAMETER_THIRD_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r,s,n)))])}}(l.STRING,e,nt.EVENT_STRING,nt.PARAMETER_STRING,nt.PARAMETER_SECOND_STRING,nt.PARAMETER_THIRD_STRING)]}static ofEntryStringAndIntegerOutput(e,t){return[e,new class extends nt{async internalExecute(e){let r=e?.getArguments()?.get(nt.PARAMETER_STRING_NAME);return new es([Z.outputOf(j.of(nt.EVENT_RESULT_NAME,t(r)))])}}(l.STRING,e,nt.EVENT_INT,nt.PARAMETER_STRING)]}}class nr extends e0{static{this.VALUE="value"}constructor(){super(),this.signature=new ea("Concatenate").setNamespace(l.STRING).setParameters(new Map([[nr.VALUE,new k(nr.VALUE,new D().setName(nr.VALUE).setType(new w(p.STRING))).setVariableArgument(!0)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[nr.VALUE,D.ofString(nr.VALUE)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nr.VALUE),r="";return t.reduce((e,t)=>r=e+t,r),new es([Z.outputOf(new Map([[nr.VALUE,r]]))])}}class ns extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_START_NAME="startPosition"}static{this.PARAMETER_AT_END_NAME="endPosition"}static{this.EVENT_RESULT_NAME="result"}constructor(){super(),this.PARAMETER_STRING=new k(ns.PARAMETER_STRING_NAME,D.ofString(ns.PARAMETER_STRING_NAME)),this.PARAMETER_AT_START=new k(ns.PARAMETER_AT_START_NAME,D.ofInteger(ns.PARAMETER_AT_START_NAME)),this.PARAMETER_AT_END=new k(ns.PARAMETER_AT_END_NAME,D.ofInteger(ns.PARAMETER_AT_END_NAME)),this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[ns.EVENT_RESULT_NAME,D.ofString(ns.EVENT_RESULT_NAME)]])),this.signature=new ea("DeleteForGivenLength").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_START.getParameterName(),this.PARAMETER_AT_START],[this.PARAMETER_AT_END.getParameterName(),this.PARAMETER_AT_END]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(ns.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(ns.PARAMETER_AT_START_NAME),s=e?.getArguments()?.get(ns.PARAMETER_AT_END_NAME);if(s>=r){let e="";return e+=t.substring(0,r),e+=t.substring(s),new es([Z.outputOf(new Map([[ns.EVENT_RESULT_NAME,e.toString()]]))])}return new es([Z.outputOf(new Map([[ns.EVENT_RESULT_NAME,t]]))])}}class nn extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_POSITION_NAME="position"}static{this.PARAMETER_INSERT_STRING_NAME="insertString"}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(nn.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nn.PARAMETER_AT_POSITION_NAME),s=e?.getArguments()?.get(nn.PARAMETER_INSERT_STRING_NAME),n="";return n+=t.substring(0,r),n+=s,n+=t.substring(r),new es([Z.outputOf(new Map([[this.EVENT_RESULT_NAME,n]]))])}constructor(...e){super(...e),this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new k(nn.PARAMETER_STRING_NAME,D.ofString(nn.PARAMETER_STRING_NAME)),this.PARAMETER_AT_POSITION=new k(nn.PARAMETER_AT_POSITION_NAME,D.ofInteger(nn.PARAMETER_AT_POSITION_NAME)),this.PARAMETER_INSERT_STRING=new k(nn.PARAMETER_INSERT_STRING_NAME,D.ofString(nn.PARAMETER_INSERT_STRING_NAME)),this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[this.EVENT_RESULT_NAME,D.ofString(this.EVENT_RESULT_NAME)]])),this.signature=new ea("InsertAtGivenPosition").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_POSITION.getParameterName(),this.PARAMETER_AT_POSITION],[this.PARAMETER_INSERT_STRING.getParameterName(),this.PARAMETER_INSERT_STRING]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,D.ofString(this.EVENT_RESULT_NAME)]]))]))}}class na extends e0{static{this.PARAMETER_REGEX_NAME="regex"}static{this.PARAMETER_STRING_NAME="string"}static{this.EVENT_RESULT_NAME="result"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(na.PARAMETER_REGEX_NAME),r=e.getArguments()?.get(na.PARAMETER_STRING_NAME);return new es([Z.outputOf(new Map([[na.EVENT_RESULT_NAME,!!r.match(t)?.length]]))])}constructor(...e){super(...e),this.signature=new ea("Matches").setNamespace(l.STRING).setParameters(j.ofEntries(j.entry(...k.ofEntry(na.PARAMETER_REGEX_NAME,D.ofString(na.PARAMETER_REGEX_NAME))),j.entry(...k.ofEntry(na.PARAMETER_STRING_NAME,D.ofString(na.PARAMETER_STRING_NAME))))).setEvents(j.ofEntries(j.entry(...Q.outputEventMapEntry(new Map([[na.EVENT_RESULT_NAME,D.ofBoolean(na.EVENT_RESULT_NAME)]])))))}}class ni extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_POSTPAD_STRING_NAME="postpadString"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(ni.PARAMETER_STRING_NAME,D.ofString(ni.PARAMETER_STRING_NAME))}static{this.PARAMETER_POSTPAD_STRING=new k(ni.PARAMETER_POSTPAD_STRING_NAME,D.ofString(ni.PARAMETER_POSTPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new k(ni.PARAMETER_LENGTH_NAME,D.ofInteger(ni.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[ni.EVENT_RESULT_NAME,D.ofString(ni.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new ea("PostPad").setNamespace(l.STRING).setParameters(new Map([[ni.PARAMETER_STRING.getParameterName(),ni.PARAMETER_STRING],[ni.PARAMETER_POSTPAD_STRING.getParameterName(),ni.PARAMETER_POSTPAD_STRING],[ni.PARAMETER_LENGTH.getParameterName(),ni.PARAMETER_LENGTH]])).setEvents(new Map([[ni.EVENT_STRING.getName(),ni.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(ni.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(ni.PARAMETER_POSTPAD_STRING_NAME),s=e.getArguments()?.get(ni.PARAMETER_LENGTH_NAME),n="",a=r.length;for(n+=t;a<=s;)n+=r,a+=r.length;return n.length-t.length<s&&(n+=r.substring(0,s-(n.length-t.length))),new es([Z.outputOf(new Map([[ni.EVENT_RESULT_NAME,n.toString()]]))])}}class no extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_PREPAD_STRING_NAME="prepadString"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(no.PARAMETER_STRING_NAME,D.ofString(no.PARAMETER_STRING_NAME))}static{this.PARAMETER_PREPAD_STRING=new k(no.PARAMETER_PREPAD_STRING_NAME,D.ofString(no.PARAMETER_PREPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new k(no.PARAMETER_LENGTH_NAME,D.ofInteger(no.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[no.EVENT_RESULT_NAME,D.ofString(no.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new ea("PrePad").setNamespace(l.STRING).setParameters(new Map([[no.PARAMETER_STRING.getParameterName(),no.PARAMETER_STRING],[no.PARAMETER_PREPAD_STRING.getParameterName(),no.PARAMETER_PREPAD_STRING],[no.PARAMETER_LENGTH.getParameterName(),no.PARAMETER_LENGTH]])).setEvents(new Map([[no.EVENT_STRING.getName(),no.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(no.PARAMETER_STRING_NAME),r=e.getArguments()?.get(no.PARAMETER_PREPAD_STRING_NAME),s=e.getArguments()?.get(no.PARAMETER_LENGTH_NAME),n="",a=r.length;for(;a<=s;)n+=r,a+=r.length;return n.length<s&&(n+=r.substring(0,s-n.length)),n+=t,new es([Z.outputOf(new Map([[no.EVENT_RESULT_NAME,n]]))])}}class nE extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_BOOLEAN_NAME="boolean"}static{this.PARAMETER_FIRST_OFFSET_NAME="firstOffset"}static{this.PARAMETER_OTHER_STRING_NAME="otherString"}static{this.PARAMETER_SECOND_OFFSET_NAME="secondOffset"}static{this.PARAMETER_INTEGER_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nE.PARAMETER_STRING_NAME,D.ofString(nE.PARAMETER_STRING_NAME))}static{this.PARAMETER_OTHER_STRING=new k(nE.PARAMETER_OTHER_STRING_NAME,D.ofString(nE.PARAMETER_OTHER_STRING_NAME))}static{this.PARAMETER_FIRST_OFFSET=new k(nE.PARAMETER_FIRST_OFFSET_NAME,D.ofInteger(nE.PARAMETER_FIRST_OFFSET_NAME))}static{this.PARAMETER_SECOND_OFFSET=new k(nE.PARAMETER_SECOND_OFFSET_NAME,D.ofInteger(nE.PARAMETER_SECOND_OFFSET_NAME))}static{this.PARAMETER_INTEGER=new k(nE.PARAMETER_INTEGER_NAME,D.ofInteger(nE.PARAMETER_INTEGER_NAME))}static{this.PARAMETER_BOOLEAN=new k(nE.PARAMETER_BOOLEAN_NAME,D.ofBoolean(nE.PARAMETER_BOOLEAN_NAME))}static{this.EVENT_BOOLEAN=new Q(Q.OUTPUT,new Map([[nE.EVENT_RESULT_NAME,D.ofBoolean(nE.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new ea("RegionMatches").setNamespace(l.STRING).setParameters(new Map([[nE.PARAMETER_STRING.getParameterName(),nE.PARAMETER_STRING],[nE.PARAMETER_BOOLEAN.getParameterName(),nE.PARAMETER_BOOLEAN],[nE.PARAMETER_FIRST_OFFSET.getParameterName(),nE.PARAMETER_FIRST_OFFSET],[nE.PARAMETER_OTHER_STRING.getParameterName(),nE.PARAMETER_OTHER_STRING],[nE.PARAMETER_SECOND_OFFSET.getParameterName(),nE.PARAMETER_SECOND_OFFSET],[nE.PARAMETER_INTEGER.getParameterName(),nE.PARAMETER_INTEGER]])).setEvents(new Map([[nE.EVENT_BOOLEAN.getName(),nE.EVENT_BOOLEAN]]))}async internalExecute(e){let t=e.getArguments()?.get(nE.PARAMETER_STRING_NAME),r=e.getArguments()?.get(nE.PARAMETER_BOOLEAN_NAME),s=e.getArguments()?.get(nE.PARAMETER_FIRST_OFFSET_NAME),n=e?.getArguments()?.get(nE.PARAMETER_OTHER_STRING_NAME),a=e?.getArguments()?.get(nE.PARAMETER_SECOND_OFFSET_NAME),i=e.getArguments()?.get(nE.PARAMETER_INTEGER_NAME),o=!1;return o=!(s<0)&&!(a<0)&&!(s+i>t.length)&&!(a+i>n.length)&&(r?(t=t.substring(s,s+i).toUpperCase())==n.substring(a,a+i).toUpperCase():(t=t.substring(s,s+i))==n.substring(a,i)),new es([Z.outputOf(new Map([[nE.EVENT_RESULT_NAME,o]]))])}}class nu extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_START_NAME="startPosition"}static{this.PARAMETER_AT_LENGTH_NAME="lengthPosition"}static{this.PARAMETER_REPLACE_STRING_NAME="replaceString"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nu.PARAMETER_STRING_NAME,D.ofString(nu.PARAMETER_STRING_NAME))}static{this.PARAMETER_AT_START=new k(nu.PARAMETER_AT_START_NAME,D.ofInteger(nu.PARAMETER_AT_START_NAME))}static{this.PARAMETER_AT_LENGTH=new k(nu.PARAMETER_AT_LENGTH_NAME,D.ofInteger(nu.PARAMETER_AT_LENGTH_NAME))}static{this.PARAMETER_REPLACE_STRING=new k(nu.PARAMETER_REPLACE_STRING_NAME,D.ofString(nu.PARAMETER_REPLACE_STRING_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[nu.EVENT_RESULT_NAME,D.ofString(nu.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new ea("ReplaceAtGivenPosition").setNamespace(l.STRING).setParameters(new Map([[nu.PARAMETER_STRING.getParameterName(),nu.PARAMETER_STRING],[nu.PARAMETER_AT_START.getParameterName(),nu.PARAMETER_AT_START],[nu.PARAMETER_AT_LENGTH.getParameterName(),nu.PARAMETER_AT_LENGTH],[nu.PARAMETER_REPLACE_STRING.getParameterName(),nu.PARAMETER_REPLACE_STRING]])).setEvents(new Map([[nu.EVENT_STRING.getName(),nu.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(nu.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(nu.PARAMETER_AT_START_NAME),s=e?.getArguments()?.get(nu.PARAMETER_AT_LENGTH_NAME),n=e?.getArguments()?.get(nu.PARAMETER_REPLACE_STRING_NAME);if(t.length,r<s){let e="";e+=t.substring(0,r),e+=n,e+=t.substring(r+s)}return new es([Z.outputOf(new Map([[nu.EVENT_RESULT_NAME,t]]))])}}class nA extends e0{constructor(){super(),this.VALUE="value",this.signature=new ea("Reverse").setNamespace(l.STRING).setParameters(new Map([[this.VALUE,new k(this.VALUE,D.ofString(this.VALUE)).setVariableArgument(!1)]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[this.VALUE,new D().setType(d.of(p.STRING)).setName(this.VALUE)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(this.VALUE),r=t.length-1,s="";for(;r>=0;)s+=t.charAt(r--);return new es([Z.outputOf(j.of(this.VALUE,s))])}}class nT extends e0{getSignature(){return this.signature}constructor(){super(),this.PARAMETER_STRING_NAME="string",this.PARAMETER_SPLIT_STRING_NAME="searchString",this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new k(this.PARAMETER_STRING_NAME,D.ofString(this.PARAMETER_STRING_NAME)),this.PARAMETER_SPLIT_STRING=new k(this.PARAMETER_SPLIT_STRING_NAME,D.ofString(this.PARAMETER_SPLIT_STRING_NAME)),this.EVENT_ARRAY=new Q(Q.OUTPUT,j.of(this.EVENT_RESULT_NAME,D.ofArray(this.EVENT_RESULT_NAME))),this.signature=new ea("Split").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_STRING_NAME,this.PARAMETER_STRING],[this.PARAMETER_SPLIT_STRING_NAME,this.PARAMETER_SPLIT_STRING]])).setEvents(new Map([Q.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,D.ofArray(this.EVENT_RESULT_NAME)]]))]))}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_STRING_NAME),r=e.getArguments()?.get(this.PARAMETER_SPLIT_STRING_NAME);return new es([Z.outputOf(j.of(this.EVENT_RESULT_NAME,t.split(r)))])}}class nl extends e0{getSignature(){return this.signature}constructor(){super(),this.PARAMETER_INPUT_ANYTYPE_NAME="anytype",this.EVENT_RESULT_NAME="result",this.PARAMETER_INPUT_ANYTYPE=new k(this.PARAMETER_INPUT_ANYTYPE_NAME,D.ofAny(this.PARAMETER_INPUT_ANYTYPE_NAME)),this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[this.EVENT_RESULT_NAME,D.ofString(this.EVENT_RESULT_NAME)]])),this.signature=new ea("ToString").setNamespace(l.STRING).setParameters(new Map([[this.PARAMETER_INPUT_ANYTYPE.getParameterName(),this.PARAMETER_INPUT_ANYTYPE]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_INPUT_ANYTYPE_NAME),r="";return r="object"==typeof t?JSON.stringify(t,void 0,2):""+t,new es([Z.outputOf(new Map([[this.EVENT_RESULT_NAME,r]]))])}}class nm extends e0{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new k(nm.PARAMETER_STRING_NAME,D.ofString(nm.PARAMETER_STRING_NAME))}static{this.PARAMETER_LENGTH=new k(nm.PARAMETER_LENGTH_NAME,D.ofInteger(nm.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new Q(Q.OUTPUT,new Map([[nm.EVENT_RESULT_NAME,D.ofString(nm.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new ea("TrimTo").setNamespace(l.STRING).setParameters(new Map([[nm.PARAMETER_STRING.getParameterName(),nm.PARAMETER_STRING],[nm.PARAMETER_LENGTH.getParameterName(),nm.PARAMETER_LENGTH]])).setEvents(new Map([[nm.EVENT_STRING.getName(),nm.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(nm.PARAMETER_STRING_NAME),r=e.getArguments()?.get(nm.PARAMETER_LENGTH_NAME);return new es([Z.outputOf(new Map([[nm.EVENT_RESULT_NAME,t.substring(0,r)]]))])}}class nh{async find(e,t){return e!=l.STRING?Promise.resolve(void 0):Promise.resolve(this.repoMap.get(t))}async filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}constructor(){this.repoMap=j.ofArrayEntries(nt.ofEntryStringAndStringOutput("Trim",e=>e.trim()),nt.ofEntryStringAndStringOutput("TrimStart",e=>e.trimStart()),nt.ofEntryStringAndStringOutput("TrimEnd",e=>e.trimEnd()),nt.ofEntryStringAndIntegerOutput("Length",e=>e.length),nt.ofEntryStringStringAndIntegerOutput("Frequency",(e,t)=>{let r=0,s=e.indexOf(t);for(;-1!=s;)r++,s=e.indexOf(t,s+1);return r}),nt.ofEntryStringAndStringOutput("LowerCase",e=>e.toLocaleLowerCase()),nt.ofEntryStringAndStringOutput("UpperCase",e=>e.toUpperCase()),nt.ofEntryStringAndBooleanOutput("IsBlank",e=>""===e.trim()),nt.ofEntryStringAndBooleanOutput("IsEmpty",e=>""===e),nt.ofEntryStringStringAndBooleanOutput("Contains",(e,t)=>-1!=e.indexOf(t)),nt.ofEntryStringStringAndBooleanOutput("EndsWith",(e,t)=>e.endsWith(t)),nt.ofEntryStringStringAndBooleanOutput("StartsWith",(e,t)=>e.startsWith(t)),nt.ofEntryStringStringAndBooleanOutput("EqualsIgnoreCase",(e,t)=>e.toUpperCase()==t.toUpperCase()),nt.ofEntryStringStringAndBooleanOutput("Matches",(e,t)=>new RegExp(t).test(e)),nt.ofEntryStringStringAndIntegerOutput("IndexOf",(e,t)=>e.indexOf(t)),nt.ofEntryStringStringAndIntegerOutput("LastIndexOf",(e,t)=>e.lastIndexOf(t)),nt.ofEntryStringIntegerAndStringOutput("Repeat",(e,t)=>e.repeat(t)),nt.ofEntryStringStringIntegerAndIntegerOutput("IndexOfWithStartPoint",(e,t,r)=>e.indexOf(t,r)),nt.ofEntryStringStringIntegerAndIntegerOutput("LastIndexOfWithStartPoint",(e,t,r)=>e.lastIndexOf(t,r)),nt.ofEntryStringStringStringAndStringOutput("Replace",(e,t,r)=>e.replaceAll(t,r)),nt.ofEntryStringStringStringAndStringOutput("ReplaceFirst",(e,t,r)=>e.replace(t,r)),nt.ofEntryStringIntegerIntegerAndStringOutput("SubString",(e,t,r)=>e.substring(t,r)),q(new nr),q(new ns),q(new nn),q(new ni),q(new no),q(new nE),q(new nu),q(new nA),q(new nT),q(new nl),q(new nm),q(new na)),this.filterableNames=Array.from(this.repoMap.values()).map(e=>e.getSignature().getFullName())}}class nR extends e0{static{this.PARAMETER_TIMESTAMP_NAME="isoTimeStamp"}static{this.PARAMETER_TIMESTAMP_NAME_ONE="isoTimeStamp1"}static{this.PARAMETER_TIMESTAMP_NAME_TWO="isoTimeStamp2"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_NUMBER_NAME="number"}static{this.PARAMETER_TIMESTAMP=new k(nR.PARAMETER_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_ONE=new k(nR.PARAMETER_TIMESTAMP_NAME_ONE,D.ofRef(l.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_TWO=new k(nR.PARAMETER_TIMESTAMP_NAME_TWO,D.ofRef(l.DATE+".Timestamp"))}static{this.PARAMETER_VARIABLE_UNIT=new k(nR.PARAMETER_UNIT_NAME,D.ofRef(l.DATE+".Timeunit")).setVariableArgument(!0)}static{this.PARAMETER_UNIT=new k(nR.PARAMETER_UNIT_NAME,D.ofRef(l.DATE+".Timeunit"))}static{this.PARAMETER_NUMBER=new k(nR.PARAMETER_NUMBER_NAME,D.ofInteger(nR.PARAMETER_NUMBER_NAME))}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_TIMESTAMP_NAME="isoTimeStamp"}static{this.EVENT_INT=new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofInteger(nR.EVENT_RESULT_NAME)))}static{this.EVENT_STRING=new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofString(nR.EVENT_RESULT_NAME)))}static{this.EVENT_LONG=new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofLong(nR.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME)))}static{this.EVENT_TIMESTAMP=new Q(Q.OUTPUT,j.of(nR.EVENT_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")))}getSignature(){return this.signature}constructor(e,t,...r){if(super(),this.signature=new ea(e).setNamespace(l.DATE).setEvents(j.of(t.getName(),t)),!r?.length)return;let s=new Map;r.forEach(e=>s.set(e.getParameterName(),e)),this.signature.setParameters(s)}static ofEntryTimestampAndIntegerOutput(e,t){return[e,new class extends nR{async internalExecute(e){return new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,t(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME))))])}}(e,nR.EVENT_INT,nR.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndBooleanOutput(e,t){return[e,new class extends nR{async internalExecute(e){return new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,t(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME))))])}}(e,nR.EVENT_BOOLEAN,nR.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndStringOutput(e,t){return[e,new class extends nR{async internalExecute(e){return new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,t(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME))))])}}(e,nR.EVENT_STRING,nR.PARAMETER_TIMESTAMP)]}static ofEntryTimestampIntegerAndTimestampOutput(e,t){return[e,new class extends nR{async internalExecute(e){return new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,t(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME),e.getArguments()?.get(nR.PARAMETER_NUMBER_NAME))))])}}(e,nR.EVENT_TIMESTAMP,nR.PARAMETER_TIMESTAMP,nR.PARAMETER_NUMBER)]}static ofEntryTimestampTimestampAndTOutput(e,t,r,...s){return[e,new class extends nR{async internalExecute(e){let t=[];return s?.length&&t.push(...s.map(t=>e.getArguments()?.get(t.getParameterName()))),new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,r(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME_ONE),e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME_TWO),t)))])}}(e,t,nR.PARAMETER_TIMESTAMP_ONE,nR.PARAMETER_TIMESTAMP_TWO,...s)]}}function ng(e){let t=(0,i.DateTime).fromISO(e,{setZone:!0});if(!t?.isValid)throw Error("Invalid ISO timestamp");return t}class nc extends nR{static{this.PARAMETER_YEARS_NAME="years"}static{this.PARAMETER_MONTHS_NAME="months"}static{this.PARAMETER_DAYS_NAME="days"}static{this.PARAMETER_HOURS_NAME="hours"}static{this.PARAMETER_MINUTES_NAME="minutes"}static{this.PARAMETER_SECONDS_NAME="seconds"}static{this.PARAMETER_MILLISECONDS_NAME="milliseconds"}constructor(e){super(e?"AddTime":"SubtractTime",nR.EVENT_TIMESTAMP,nR.PARAMETER_TIMESTAMP,k.of(nc.PARAMETER_YEARS_NAME,D.ofNumber(nc.PARAMETER_YEARS_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_MONTHS_NAME,D.ofNumber(nc.PARAMETER_MONTHS_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_DAYS_NAME,D.ofNumber(nc.PARAMETER_DAYS_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_HOURS_NAME,D.ofNumber(nc.PARAMETER_HOURS_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_MINUTES_NAME,D.ofNumber(nc.PARAMETER_MINUTES_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_SECONDS_NAME,D.ofNumber(nc.PARAMETER_SECONDS_NAME).setDefaultValue(0)),k.of(nc.PARAMETER_MILLISECONDS_NAME,D.ofNumber(nc.PARAMETER_MILLISECONDS_NAME).setDefaultValue(0))),this.isAdd=e}async internalExecute(e){let t;let r=ng(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME)),s=e.getArguments()?.get(nc.PARAMETER_YEARS_NAME),n=e.getArguments()?.get(nc.PARAMETER_MONTHS_NAME),a=e.getArguments()?.get(nc.PARAMETER_DAYS_NAME),i=e.getArguments()?.get(nc.PARAMETER_HOURS_NAME),o={years:s,months:n,days:a,hours:i,minutes:e.getArguments()?.get(nc.PARAMETER_MINUTES_NAME),seconds:e.getArguments()?.get(nc.PARAMETER_SECONDS_NAME),milliseconds:e.getArguments()?.get(nc.PARAMETER_MILLISECONDS_NAME)};return t=this.isAdd?r.plus(o):r.minus(o),new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,t.toISO()))])}}class np extends e0{constructor(e,t){super(),this.paramName=`epoch${t?"Seconds":"Milliseconds"}`,this.isSeconds=t,this.signature=new ea(e).setNamespace(l.DATE).setParameters(new Map([[this.paramName,k.of(this.paramName,new D().setName(this.paramName).setType(d.of(p.LONG,p.INTEGER,p.STRING)))]])).setEvents(new Map([[nR.EVENT_TIMESTAMP.getName(),nR.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=parseInt(e.getArguments()?.get(this.paramName)),r=this.isSeconds?1e3*t:t;if(isNaN(r))throw Error(`Please provide a valid value for ${this.paramName}.`);return Promise.resolve(new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,new Date(r).toISOString()))]))}}class nN extends e0{constructor(e,t){super(),this.isSeconds=t,this.signature=new ea(e).setNamespace(l.DATE).setParameters(new Map([[nR.PARAMETER_TIMESTAMP_NAME,nR.PARAMETER_TIMESTAMP]])).setEvents(new Map([[nR.EVENT_TIMESTAMP.getName(),nR.EVENT_LONG]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME),r=this.isSeconds?(0,i.DateTime).fromISO(t).toSeconds():(0,i.DateTime).fromISO(t).toMillis();return Promise.resolve(new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,r))]))}}class nf extends nR{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("ToDateString",nR.EVENT_STRING,nR.PARAMETER_TIMESTAMP,k.of(nf.PARAMETER_FORMAT_NAME,D.ofString(nf.PARAMETER_FORMAT_NAME)),k.of(nf.PARAMETER_LOCALE_NAME,D.ofString(nf.PARAMETER_LOCALE_NAME).setDefaultValue("")))}async internalExecute(e){let t=ng(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(nf.PARAMETER_FORMAT_NAME),s=e.getArguments()?.get(nf.PARAMETER_LOCALE_NAME);return""===s&&(s="system"),new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,t.toFormat(r,{locale:s})))])}}class n_ extends nR{static{this.PARAMETER_TIMEZONE_NAME="timezone"}constructor(){super("SetTimeZone",nR.EVENT_TIMESTAMP,nR.PARAMETER_TIMESTAMP,k.of(n_.PARAMETER_TIMEZONE_NAME,D.ofString(n_.PARAMETER_TIMEZONE_NAME)))}async internalExecute(e){let t=ng(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(n_.PARAMETER_TIMEZONE_NAME);return new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,t.setZone(r).toISO()))])}}class nM extends nR{static{this.PARAMETER_START_TIMESTAMP_NAME="startTimestamp"}static{this.PARAMETER_END_TIMESTAMP_NAME="endTimestamp"}static{this.PARAMETER_CHECK_TIMESTAMP_NAME="checkTimestamp"}constructor(){super("IsBetween",nM.EVENT_BOOLEAN,k.of(nM.PARAMETER_START_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")),k.of(nM.PARAMETER_END_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")),k.of(nM.PARAMETER_CHECK_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")))}async internalExecute(e){let t=e.getArguments()?.get(nM.PARAMETER_START_TIMESTAMP_NAME),r=e.getArguments()?.get(nM.PARAMETER_END_TIMESTAMP_NAME),s=e.getArguments()?.get(nM.PARAMETER_CHECK_TIMESTAMP_NAME),n=ng(t),a=ng(r),i=ng(s);return n>a&&([n,a]=[a,n]),new es([Z.outputOf(j.of(nM.EVENT_RESULT_NAME,n<=i&&i<=a))])}}class nS extends e0{constructor(e){super(),this.isLast=e,this.signature=new ea(e?"LastOf":"FirstOf").setNamespace(l.DATE).setParameters(new Map([[nR.PARAMETER_TIMESTAMP_NAME,new k(nR.PARAMETER_TIMESTAMP_NAME,D.ofRef(l.DATE+".Timestamp")).setVariableArgument(!0)]])).setEvents(new Map([[nR.EVENT_TIMESTAMP.getName(),nR.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME);if(!t?.length)throw Error("No timestamps provided");let r=t.map(e=>ng(e));return r.sort((e,t)=>e.toMillis()-t.toMillis()),Promise.resolve(new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,r[this.isLast?r.length-1:0].toISO()))]))}}class nO extends nR{static{this.EVENT_TIME_OBJECT_NAME="object"}static{this.EVENT_TIME_ARRAY_NAME="array"}constructor(e){super(e?"TimeAsArray":"TimeAsObject",new Q(Q.OUTPUT,j.of(e?nO.EVENT_TIME_ARRAY_NAME:nO.EVENT_TIME_OBJECT_NAME,e?D.ofArray(nO.EVENT_TIME_ARRAY_NAME,D.ofInteger("timeParts")):D.ofRef(l.DATE+".TimeObject"))),nR.PARAMETER_TIMESTAMP),this.isArray=e}async internalExecute(e){let t=ng(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME)).toObject();return new es([Z.outputOf(j.of(this.isArray?nO.EVENT_TIME_ARRAY_NAME:nO.EVENT_TIME_OBJECT_NAME,this.isArray?[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond]:t))])}}class nw extends nR{constructor(e){super(e?"StartOf":"EndOf",nR.EVENT_TIMESTAMP,nR.PARAMETER_TIMESTAMP,nR.PARAMETER_UNIT),this.isStart=e}async internalExecute(e){let t=ng(e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(nR.PARAMETER_UNIT_NAME)?.toLowerCase();r=r.substring(0,r.length-1);let s=this.isStart?t.startOf(r):t.endOf(r);return new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,s.toISO({includeOffset:!0})))])}}class nd extends nR{static{this.EVENT_NAMES_NAME="names"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("GetNames",new Q(nd.EVENT_NAMES_NAME,j.of(nd.EVENT_NAMES_NAME,D.ofArray(nd.EVENT_NAMES_NAME,D.ofString(nd.EVENT_NAMES_NAME)))),new k(nd.PARAMETER_UNIT_NAME,D.ofString(nd.PARAMETER_UNIT_NAME).setEnums(["TIMEZONES","MONTHS","WEEKDAYS"])),new k(nd.PARAMETER_LOCALE_NAME,D.ofString(nd.PARAMETER_LOCALE_NAME).setDefaultValue("system")))}async internalExecute(e){let t=e.getArguments()?.get(nd.PARAMETER_UNIT_NAME),r=e.getArguments()?.get(nd.PARAMETER_LOCALE_NAME);return new es([Z.outputOf(j.of(nd.EVENT_NAMES_NAME,this.getNames(t,r)))])}getNames(e,t){return"TIMEZONES"===e?Intl.supportedValuesOf("timeZone"):"MONTHS"===e?[1,2,3,4,5,6,7,8,9,10,11,12].map(e=>(0,i.DateTime).now().setLocale(t).set({month:e}).toFormat("MMMM")):"WEEKDAYS"===e?[1,2,3,4,5,6,7].map(e=>(0,i.DateTime).now().setLocale(t).set({month:7,day:e}).toFormat("EEEE")):[]}}class nP extends e0{internalExecute(e){let t=e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME),r=(0,i.DateTime).fromISO(t);return Promise.resolve(new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,r.isValid))]))}getSignature(){return this.signature}constructor(...e){super(...e),this.signature=new ea("IsValidISODate").setNamespace(l.DATE).setParameters(new Map([k.ofEntry(nR.PARAMETER_TIMESTAMP_NAME,D.ofString(nR.PARAMETER_TIMESTAMP_NAME))])).setEvents(new Map([Q.outputEventMapEntry(j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME)))]))}}class nI extends nR{static{this.PARAMETER_BASE_NAME="base"}static{this.PARAMETER_BASE=new k(nI.PARAMETER_BASE_NAME,D.ofRef(l.DATE+".Timestamp").setDefaultValue(""))}static{this.PARAMETER_LOCALE_NAME="locale"}static{this.PARAMETER_LOCALE=new k(nI.PARAMETER_LOCALE_NAME,D.ofString(nI.PARAMETER_LOCALE_NAME).setDefaultValue("system"))}static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_FORMAT=new k(nI.PARAMETER_FORMAT_NAME,D.ofString(nI.PARAMETER_FORMAT_NAME).setEnums(["LONG","SHORT","NARROW"]).setDefaultValue("LONG"))}static{this.PARAMETER_ROUND_NAME="round"}static{this.PARAMETER_ROUND=new k(nI.PARAMETER_ROUND_NAME,D.ofBoolean(nI.PARAMETER_ROUND_NAME).setDefaultValue(!0))}constructor(){super("FromNow",nR.EVENT_STRING,nR.PARAMETER_TIMESTAMP,nI.PARAMETER_FORMAT,nI.PARAMETER_BASE,nR.PARAMETER_VARIABLE_UNIT,nI.PARAMETER_ROUND,nI.PARAMETER_LOCALE)}internalExecute(e){let t=e.getArguments()?.get(nI.PARAMETER_BASE_NAME),r=""===t?(0,i.DateTime).now():(0,i.DateTime).fromISO(t),s=e.getArguments()?.get(nR.PARAMETER_TIMESTAMP_NAME),n=(0,i.DateTime).fromISO(s),a=e.getArguments()?.get(nI.PARAMETER_UNIT_NAME),o=e.getArguments()?.get(nI.PARAMETER_FORMAT_NAME),E=e.getArguments()?.get(nI.PARAMETER_ROUND_NAME),u=e.getArguments()?.get(nI.PARAMETER_LOCALE_NAME),A={base:r,style:o?.toLowerCase(),round:E,locale:u};return a?.length>0&&(A.unit=a.map(e=>e.toLowerCase())),Promise.resolve(new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,n.toRelative(A)??"Unknown"))]))}}class ny extends nR{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_TIMESTAMP_STRING_NAME="timestampString"}constructor(){super("FromDateString",nR.EVENT_TIMESTAMP,k.of(ny.PARAMETER_TIMESTAMP_STRING_NAME,D.ofString(ny.PARAMETER_TIMESTAMP_STRING_NAME)),k.of(ny.PARAMETER_FORMAT_NAME,D.ofString(ny.PARAMETER_FORMAT_NAME)))}async internalExecute(e){let t=e.getArguments()?.get(ny.PARAMETER_TIMESTAMP_STRING_NAME),r=e.getArguments()?.get(ny.PARAMETER_FORMAT_NAME),s=(0,i.DateTime).fromFormat(t,r);return new es([Z.outputOf(j.of(nR.EVENT_RESULT_NAME,s.toISO()))])}}class nx extends nR{constructor(){super("GetCurrentTimestamp",nR.EVENT_TIMESTAMP)}async internalExecute(e){return new es([Z.outputOf(j.of(nR.EVENT_TIMESTAMP_NAME,(0,i.DateTime).now().toISO()))])}}class nL{find(e,t){return e!=l.DATE?Promise.resolve(void 0):Promise.resolve(this.repoMap.get(t))}filter(e){return Promise.resolve(this.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}constructor(){this.repoMap=j.ofArrayEntries(["EpochSecondsToTimestamp",new np("EpochSecondsToTimestamp",!0)],["EpochMillisecondsToTimestamp",new np("EpochMillisecondsToTimestamp",!1)],nR.ofEntryTimestampAndIntegerOutput("GetDay",e=>ng(e).day),nR.ofEntryTimestampAndIntegerOutput("GetDayOfWeek",e=>ng(e).weekday),nR.ofEntryTimestampAndIntegerOutput("GetMonth",e=>ng(e).month),nR.ofEntryTimestampAndIntegerOutput("GetYear",e=>ng(e).year),nR.ofEntryTimestampAndIntegerOutput("GetHours",e=>ng(e).hour),nR.ofEntryTimestampAndIntegerOutput("GetMinutes",e=>ng(e).minute),nR.ofEntryTimestampAndIntegerOutput("GetSeconds",e=>ng(e).second),nR.ofEntryTimestampAndIntegerOutput("GetMilliseconds",e=>ng(e).millisecond),nR.ofEntryTimestampAndIntegerOutput("GetDaysInMonth",e=>ng(e).daysInMonth),nR.ofEntryTimestampAndIntegerOutput("GetDaysInYear",e=>ng(e).daysInYear),["TimestampToEpochSeconds",new nN("TimestampToEpochSeconds",!0)],["TimestampToEpochMilliseconds",new nN("TimestampToEpochMilliseconds",!1)],nR.ofEntryTimestampAndStringOutput("GetTimeZoneName",e=>ng(e).zoneName),nR.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetLong",e=>ng(e).offsetNameLong),nR.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetShort",e=>ng(e).offsetNameShort),nR.ofEntryTimestampAndIntegerOutput("GetTimeZoneOffset",e=>ng(e).offset),["ToDateString",new nf],["AddTime",new nc(!0)],["SubtractTime",new nc(!1)],["GetCurrentTimestamp",new nx],nR.ofEntryTimestampTimestampAndTOutput("Difference",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofRef(`${l.DATE}.Duration`))),(e,t,r)=>{let s;let n=ng(e),a=ng(t);r?.[0]?.length&&(s=r[0]?.filter(e=>!!e).map(e=>e.toLowerCase()));let i=n.diff(a);return s?.length?i.shiftTo(...s).toObject():i.toObject()},nR.PARAMETER_VARIABLE_UNIT),nR.ofEntryTimestampIntegerAndTimestampOutput("SetDay",(e,t)=>ng(e).set({day:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetMonth",(e,t)=>ng(e).set({month:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetYear",(e,t)=>ng(e).set({year:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetHours",(e,t)=>ng(e).set({hour:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetMinutes",(e,t)=>ng(e).set({minute:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetSeconds",(e,t)=>ng(e).set({second:t}).toISO()),nR.ofEntryTimestampIntegerAndTimestampOutput("SetMilliseconds",(e,t)=>ng(e).set({millisecond:t}).toISO()),["SetTimeZone",new n_],nR.ofEntryTimestampTimestampAndTOutput("IsBefore",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME))),(e,t)=>ng(e)<ng(t)),nR.ofEntryTimestampTimestampAndTOutput("IsAfter",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME))),(e,t)=>ng(e)>ng(t)),nR.ofEntryTimestampTimestampAndTOutput("IsSame",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME))),(e,t)=>ng(e)===ng(t)),nR.ofEntryTimestampTimestampAndTOutput("IsSameOrBefore",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME))),(e,t)=>ng(e)<=ng(t)),nR.ofEntryTimestampTimestampAndTOutput("IsSameOrAfter",new Q(Q.OUTPUT,j.of(nR.EVENT_RESULT_NAME,D.ofBoolean(nR.EVENT_RESULT_NAME))),(e,t)=>ng(e)>=ng(t)),nR.ofEntryTimestampAndBooleanOutput("IsInLeapYear",e=>ng(e).isInLeapYear),nR.ofEntryTimestampAndBooleanOutput("IsInDST",e=>ng(e).isInDST),["IsBetween",new nM],["LastOf",new nS(!0)],["FirstOf",new nS(!1)],["StartOf",new nw(!0)],["EndOf",new nw(!1)],["TimeAsObject",new nO(!1)],["TimeAsArray",new nO(!0)],["GetNames",new nd],["IsValidISODate",new nP],["FromNow",new nI],["FromDateString",new ny]),this.filterableNames=Array.from(this.repoMap.values()).map(e=>e.getSignature().getFullName())}}class nv extends e0{static{this.MILLIS="millis"}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nv.MILLIS);return await new Promise(e=>setTimeout(e,t)),new es([Z.outputOf(new Map)])}constructor(...e){super(...e),this.signature=new ea("Wait").setNamespace(l.SYSTEM).setParameters(new Map([k.ofEntry(nv.MILLIS,D.ofNumber(nv.MILLIS).setMinimum(0).setDefaultValue(0))])).setEvents(new Map([Q.outputEventMapEntry(new Map)]))}}var nU={};E(nU,"HybridRepository",()=>nV);class nV{constructor(...e){this.repos=e}async find(e,t){for(let r of this.repos){let s=await r.find(e,t);if(s)return s}}async filter(e){let t=new Set;for(let r of this.repos)(await r.filter(e)).forEach(e=>t.add(e));return Array.from(t)}}class nC{constructor(){this.map=new Map([[l.SYSTEM_CTX,new Map([q(new t7),q(new rt),q(new sE)])],[l.SYSTEM_LOOP,new Map([q(new sy),q(new sN),q(new sR),q(new sO)])],[l.SYSTEM,new Map([q(new sm),q(new sl),q(new ne),q(new nv),q(new t2)])]]),this.filterableNames=Array.from(this.map.values()).flatMap(e=>Array.from(e.values())).map(e=>e.getSignature().getFullName())}async find(e,t){return this.map.get(e)?.get(t)}async filter(e){return Array.from(this.filterableNames).filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase()))}}class nD extends nV{constructor(){super(new nC,new sj,new nh,new t9,new s8,new nL)}}var nb={};E(nb,"StatementExecution",()=>nB);var nG={};E(nG,"StatementMessage",()=>nF);class nF{constructor(e,t){this.message=t,this.messageType=e}getMessageType(){return this.messageType}setMessageType(e){return this.messageType=e,this}getMessage(){return this.message}setMessage(e){return this.message=e,this}toString(){return`${this.messageType} : ${this.message}`}}class nB{constructor(e){this.messages=[],this.dependencies=new Set,this.statement=e}getStatement(){return this.statement}setStatement(e){return this.statement=e,this}getMessages(){return this.messages}setMessages(e){return this.messages=e,this}getDependencies(){return this.dependencies}setDependencies(e){return this.dependencies=e,this}getUniqueKey(){return this.statement.getStatementName()}addMessage(e,t){this.messages.push(new nF(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){return e instanceof nB&&e.statement.equals(this.statement)}}var nY={};E(nY,"ContextTokenValueExtractor",()=>nH);class nH extends tF{static{this.PREFIX="Context."}constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.context.get(r)?.getElement())}getPrefix(){return nH.PREFIX}getStore(){return R(this.context)?this.context:Array.from(this.context.entries()).reduce((e,[t,r])=>(R(r)||(e[t]=r.getElement()),e),{})}}var nk={};E(nk,"OutputMapTokenValueExtractor",()=>n$);class n$ extends tF{static{this.PREFIX="Steps."}constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=1,s=this.output.get(t[r++]);if(!s||r>=t.length)return;let n=s.get(t[r++]);if(!n||r>t.length)return;if(r===t.length)return n;let a=t[r].indexOf("[");if(-1===a){let s=n.get(t[r++]);return this.retrieveElementFrom(e,t,r,s)}let i=t[r].substring(0,a),o=n.get(i);return this.retrieveElementFrom(e,t,r,{[i]:o})}getPrefix(){return n$.PREFIX}getStore(){return this.convertMapToObj(this.output)}convertMapToObj(e){return 0===e.size?{}:Array.from(e.entries()).reduce((e,[t,r])=>(e[t]=r instanceof Map?this.convertMapToObj(r):r,e),{})}}var nj={};E(nj,"ArgumentsTokenValueExtractor",()=>nW);class nW extends tF{static{this.PREFIX="Arguments."}constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(tF.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return -1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.args.get(r))}getPrefix(){return nW.PREFIX}getStore(){return R(this.args)?this.args:Array.from(this.args.entries()).reduce((e,[t,r])=>(e[t]=r,e),{})}}var nX={};E(nX,"GraphVertex",()=>nz);var nJ={};E(nJ,"ExecutionGraph",()=>nq);class nq{constructor(e=!1){this.nodeMap=new Map,this.isSubGrph=e}getVerticesData(){return Array.from(this.nodeMap.values()).map(e=>e.getData())}addVertex(e){if(!this.nodeMap.has(e.getUniqueKey())){let t=new nz(this,e);this.nodeMap.set(e.getUniqueKey(),t)}return this.nodeMap.get(e.getUniqueKey())}getVertex(e){return this.nodeMap.get(e)}getVertexData(e){if(this.nodeMap.has(e))return this.nodeMap.get(e).getData()}getVerticesWithNoIncomingEdges(){return Array.from(this.nodeMap.values()).filter(e=>!e.hasIncomingEdges())}isCyclic(){let e,t=new el(this.getVerticesWithNoIncomingEdges()),r=new Set;for(;!t.isEmpty();){if(r.has(t.getFirst().getKey()))return!0;e=t.removeFirst(),r.add(e.getKey()),e.hasOutgoingEdges()&&t.addAll(Array.from(e.getOutVertices().values()).flatMap(e=>Array.from(e)))}return!1}addVertices(e){for(let t of e)this.addVertex(t)}getNodeMap(){return this.nodeMap}isSubGraph(){return this.isSubGrph}toString(){return"Execution Graph : \n"+Array.from(this.nodeMap.values()).map(e=>e.toString()).join("\n")}}class nz{constructor(e,t){this.outVertices=new Map,this.inVertices=new Set,this.data=t,this.graph=e}getData(){return this.data}setData(e){return this.data=e,this}getOutVertices(){return this.outVertices}setOutVertices(e){return this.outVertices=e,this}getInVertices(){return this.inVertices}setInVertices(e){return this.inVertices=e,this}getGraph(){return this.graph}setGraph(e){return this.graph=e,this}getKey(){return this.data.getUniqueKey()}addOutEdgeTo(e,t){return this.outVertices.has(e)||this.outVertices.set(e,new Set),this.outVertices.get(e).add(t),t.inVertices.add(new eN(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new eN(e,t)),e.outVertices.has(t)||e.outVertices.set(t,new Set),e.outVertices.get(t).add(this),e}hasIncomingEdges(){return!!this.inVertices.size}hasOutgoingEdges(){return!!this.outVertices.size}getSubGraphOfType(e){let t=new nq(!0);var r=new el(Array.from(this.outVertices.get(e)??[]));for(r.map(e=>e.getData()).forEach(e=>t.addVertex(e));!r.isEmpty();)Array.from(r.pop().outVertices.values()).flatMap(e=>Array.from(e)).forEach(e=>{t.addVertex(e.getData()),r.add(e)});return t}toString(){var e=Array.from(this.getInVertices()).map(e=>e.getT1().getKey()+"("+e.getT2()+")").join(", "),t=Array.from(this.outVertices.entries()).map(([e,t])=>e+": "+Array.from(t).map(e=>e.getKey()).join(",")).join("\n ");return this.getKey()+":\n In: "+e+"\n Out: \n "+t}}var nK={};E(nK,"KIRuntime",()=>n6);var nQ={};E(nQ,"JsonExpression",()=>nZ);class nZ{constructor(e){this.expression=e}getExpression(){return this.expression}}var n0={};E(n0,"ParameterReferenceType",()=>n1);var n1=((n={}).VALUE="VALUE",n.EXPRESSION="EXPRESSION",n),n2={};function n9(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|8).toString(16)})}E(n2,"FunctionExecutionParameters",()=>n3);class n3{constructor(e,t,r){this.count=0,this.executionContext=new Map,this.valueExtractors=new Map,this.functionRepository=e,this.schemaRepository=t,this.executionId=r??n9()}getExecutionId(){return this.executionId}getContext(){return this.context}setContext(e){this.context=e;let t=new nH(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){return this.args=e,this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getStatementExecution(){return this.statementExecution}setStatementExecution(e){return this.statementExecution=e,this}getSteps(){return this.steps}setSteps(e){this.steps=e;let t=new n$(e);return this.valueExtractors.set(t.getPrefix(),t),this}getCount(){return this.count}setCount(e){return this.count=e,this}getValuesMap(){return this.valueExtractors}getFunctionRepository(){return this.functionRepository}setFunctionRepository(e){return this.functionRepository=e,this}getSchemaRepository(){return this.schemaRepository}setSchemaRepository(e){return this.schemaRepository=e,this}addTokenValueExtractor(...e){for(let t of e)this.valueExtractors.set(t.getPrefix(),t);return this}setValuesMap(e){for(let[t,r]of e.entries())this.valueExtractors.set(t,r);return this}setExecutionContext(e){return this.executionContext=e,this}getExecutionContext(){return this.executionContext}}var n4={};E(n4,"StatementMessageType",()=>n5);var n5=((a={}).ERROR="ERROR",a.WARNING="WARNING",a.MESSAGE="MESSAGE",a);class n6 extends e0{static{this.PARAMETER_NEEDS_A_VALUE='Parameter "$" needs a value'}static{this.STEP_REGEX_PATTERN=RegExp("Steps\\.([a-zA-Z0-9\\\\-]{1,})\\.([a-zA-Z0-9\\\\-]{1,})","g")}static{this.VERSION=1}static{this.MAX_EXECUTION_ITERATIONS=1e7}constructor(e,t=!1){if(super(),this.debugMode=!1,this.debugMode=t,this.fd=e,this.fd.getVersion()>n6.VERSION)throw new er("Runtime is at a lower version "+n6.VERSION+" and trying to run code from version "+this.fd.getVersion()+".")}getSignature(){return this.fd}async getExecutionPlan(e,t){let r=new nq;for(let s of Array.from(this.fd.getSteps().values()))r.addVertex(await this.prepareStatementExecution(s,e,t));return Array.from(this.makeEdges(r).getT2().entries()).forEach(e=>{let t=r.getNodeMap().get(e[0])?.getData();t&&t.addMessage(n5.ERROR,e[1])}),r}async internalExecute(e){e.getContext()||e.setContext(new Map),e.getEvents()||e.setEvents(new Map),e.getSteps()||e.setSteps(new Map),e.getArguments()&&e.addTokenValueExtractor(new nW(e.getArguments())),this.debugMode&&(console.log(`EID: ${e.getExecutionId()} Executing: ${this.fd.getNamespace()}.${this.fd.getName()}`),console.log(`EID: ${e.getExecutionId()} Parameters: `,e));let t=await this.getExecutionPlan(e.getFunctionRepository(),e.getSchemaRepository());this.debugMode&&console.log(`EID: ${e.getExecutionId()} ${t?.toString()}`);let r=t.getVerticesData().filter(e=>e.getMessages().length).map(e=>e.getStatement().getStatementName()+": \n"+e.getMessages().join(","));if(r?.length)throw new er("Please fix the errors in the function definition before execution : \n"+r.join(",\n"));return await this.executeGraph(t,e)}async executeGraph(e,t){let r=new el;r.addAll(e.getVerticesWithNoIncomingEdges());let s=new el;for(;(!r.isEmpty()||!s.isEmpty())&&!t.getEvents()?.has(Q.OUTPUT);)if(await this.processBranchQue(t,r,s),await this.processExecutionQue(t,r,s),t.setCount(t.getCount()+1),t.getCount()==n6.MAX_EXECUTION_ITERATIONS)throw new er("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size){let e=this.getSignature().getEvents();if(e.size&&e.get(Q.OUTPUT)?.getParameters()?.size)throw new er("No events raised")}let n=Array.from(t.getEvents()?.entries()??[]).flatMap(e=>e[1].map(t=>Z.of(e[0],t)));return new es(n.length||e.isSubGraph()?n:[Z.of(Q.OUTPUT,new Map)])}async processExecutionQue(e,t,r){if(!t.isEmpty()){let s=t.pop();await this.allDependenciesResolvedVertex(s,e.getSteps())?await this.executeVertex(s,e,r,t,e.getFunctionRepository()):t.add(s)}}async processBranchQue(e,t,r){if(r.length){let s=r.pop();await this.allDependenciesResolvedTuples(s.getT2(),e.getSteps())?await this.executeBranch(e,t,s):r.add(s)}}async executeBranch(e,t,r){let s,n=r.getT4();do if(r.getT1().getVerticesData().map(e=>e.getStatement().getStatementName()).forEach(t=>e.getSteps()?.delete(t)),await this.executeGraph(r.getT1(),e),(s=r.getT3().next())&&(e.getSteps()?.has(n.getData().getStatement().getStatementName())||e.getSteps()?.set(n.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(n.getData().getStatement().getStatementName())?.set(s.getName(),this.resolveInternalExpressions(s.getResult(),e)),this.debugMode)){let t=n.getData().getStatement();console.log(`EID: ${e.getExecutionId()} Step : ${t.getStatementName()} => ${t.getNamespace()}.${t.getName()}`),console.log(`EID: ${e.getExecutionId()} Event : ${s.getName()} : `,e.getSteps().get(t.getStatementName()).get(s.getName()))}while(s&&s.getName()!=Q.OUTPUT)s?.getName()==Q.OUTPUT&&n.getOutVertices().has(Q.OUTPUT)&&(n?.getOutVertices()?.get(Q.OUTPUT)??[]).forEach(async r=>{await this.allDependenciesResolvedVertex(r,e.getSteps())&&t.add(r)})}async executeVertex(e,t,r,s,n){let a,i=e.getData().getStatement();if(i.getExecuteIftrue().size&&!(Array.from(i.getExecuteIftrue().entries())??[]).filter(e=>e[1]).map(([e])=>new sa(e).evaluate(t.getValuesMap())).every(e=>!R(e)&&!1!==e))return;let o=await n.find(i.getNamespace(),i.getName());if(!o)throw new er(eT.format("$.$ function is not found.",i.getNamespace(),i.getName()));let E=o?.getSignature().getParameters(),u=this.getArgumentsFromParametersMap(t,i,E??new Map);this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Arguments : `,u));let A=t.getContext();a=o instanceof n6?new n3(t.getFunctionRepository(),t.getSchemaRepository(),`${t.getExecutionId()}_${i.getStatementName()}`).setArguments(u).setValuesMap(new Map(Array.from(t.getValuesMap().values()).filter(e=>e.getPrefix()!==nW.PREFIX&&e.getPrefix()!==n$.PREFIX&&e.getPrefix()!==nH.PREFIX).map(e=>[e.getPrefix(),e]))):new n3(t.getFunctionRepository(),t.getSchemaRepository(),t.getExecutionId()).setValuesMap(t.getValuesMap()).setContext(A).setArguments(u).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount()).setExecutionContext(t.getExecutionContext());let T=await o.execute(a),l=T.next();if(!l)throw new er(eT.format("Executing $ returned no events",i.getStatementName()));let m=l.getName()==Q.OUTPUT;if(t.getSteps()?.has(i.getStatementName())||t.getSteps().set(i.getStatementName(),new Map),t.getSteps().get(i.getStatementName()).set(l.getName(),this.resolveInternalExpressions(l.getResult(),t)),this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Event : ${l.getName()} : `,t.getSteps().get(i.getStatementName()).get(l.getName()))),m){let r=e.getOutVertices().get(Q.OUTPUT);r&&r.forEach(async e=>{await this.allDependenciesResolvedVertex(e,t.getSteps())&&s.add(e)})}else{let t=e.getSubGraphOfType(l.getName()),s=this.makeEdges(t).getT1();r.push(new e_(t,s,T,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map(e=>new eN(e[0],this.resolveInternalExpression(e[1],t))).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map):e}resolveInternalExpression(e,t){if(R(e)||"object"!=typeof e)return e;if(e instanceof nZ)return new sa(e.getExpression()).evaluate(t.getValuesMap());if(Array.isArray(e)){let r=[];for(let s of e)r.push(this.resolveInternalExpression(s,t));return r}if("object"==typeof e){let r={};for(let s of Object.entries(e))r[s[0]]=this.resolveInternalExpression(s[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e)if(!t.has(r.getT1())||!t.get(r.getT1())?.get(r.getT2()))return!1;return!0}allDependenciesResolvedVertex(e,t){return!e.getInVertices().size||0==Array.from(e.getInVertices()).filter(e=>{let r=e.getT1().getData().getStatement().getStatementName(),s=e.getT2();return!(t.has(r)&&t.get(r)?.has(s))}).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map(t=>{let s,n=Array.from(t[1]?.values()??[]);if(!n?.length)return new eN(t[0],s);let a=r.get(t[0]);return a?(s=a.isVariableArgument()?n.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)).filter(e=>!R(e)).map(t=>this.parameterReferenceEvaluation(e,t)).flatMap(e=>Array.isArray(e)?e:[e]):this.parameterReferenceEvaluation(e,n[0]),new eN(t[0],s)):new eN(t[0],void 0)}).filter(e=>!R(e.getT2())).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map)}parameterReferenceEvaluation(e,t){let r;return t.getType()==n1.VALUE?r=this.resolveInternalExpression(t.getValue(),e):t.getType()!=n1.EXPRESSION||eg.isNullOrBlank(t.getExpression())||(r=new sa(t.getExpression()??"").evaluate(e.getValuesMap())),r}async prepareStatementExecution(e,t,r){let s=new nB(e),n=await t.find(e.getNamespace(),e.getName());if(!n)return s.addMessage(n5.ERROR,eT.format("$.$ is not available",e.getNamespace(),e.getName())),Promise.resolve(s);let a=new Map(n.getSignature().getParameters());if(!e.getParameterMap())return Promise.resolve(s);for(let t of Array.from(e.getParameterMap().entries())){let e=a.get(t[0]);if(!e)continue;let n=Array.from(t[1]?.values()??[]);if(!n.length&&!e.isVariableArgument()){await eO.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||s.addMessage(n5.ERROR,eT.format(n6.PARAMETER_NEEDS_A_VALUE,e.getParameterName())),a.delete(e.getParameterName());continue}if(e.isVariableArgument())for(let t of(n.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)),n))this.parameterReferenceValidation(s,e,t,r);else if(n.length){let t=n[0];this.parameterReferenceValidation(s,e,t,r)}a.delete(e.getParameterName())}if(!R(s.getStatement().getDependentStatements()))for(let e of Array.from(s.getStatement().getDependentStatements().entries()))e[1]&&s.addDependency(e[0]);if(!R(s.getStatement().getExecuteIftrue()))for(let e of Array.from(s.getStatement().getExecuteIftrue().entries()))e[1]&&this.addDependencies(s,e[0]);if(a.size)for(let e of Array.from(a.values()))e.isVariableArgument()||await eO.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||s.addMessage(n5.ERROR,eT.format(n6.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return Promise.resolve(s)}async parameterReferenceValidation(e,t,r,s){if(r){if(r.getType()==n1.VALUE){if(R(r.getValue())&&!await eO.hasDefaultValueOrNullSchemaType(t.getSchema(),s)&&e.addMessage(n5.ERROR,eT.format(n6.PARAMETER_NEEDS_A_VALUE,t.getParameterName())),R(r.getValue()))return;let n=new el;for(n.push(new eN(t.getSchema(),r.getValue()));!n.isEmpty();){let t=n.pop();if(t.getT2()instanceof nZ)this.addDependencies(e,t.getT2().getExpression());else{if(R(t.getT1())||R(t.getT1().getType()))continue;if(t.getT1().getType()?.contains(p.ARRAY)&&Array.isArray(t.getT2())){let e=t.getT1().getItems();if(!e)continue;if(e.isSingleType())for(let r of t.getT2())n.push(new eN(e.getSingleSchema(),r));else{let r=t.getT2();for(let t=0;t<r.length;t++)n.push(new eN(e.getTupleSchema()[t],r[t]))}}else if(t.getT1().getType()?.contains(p.OBJECT)&&"object"==typeof t.getT2()){let r=t.getT1();if(r.getName()===k.EXPRESSION.getName()&&r.getNamespace()===k.EXPRESSION.getNamespace()){let r=t.getT2();r.isExpression&&this.addDependencies(e,r.value)}else if(r.getProperties())for(let e of Object.entries(t.getT2()))r.getProperties().has(e[0])&&n.push(new eN(r.getProperties().get(e[0]),e[1]))}}}}else if(r.getType()==n1.EXPRESSION){if(eg.isNullOrBlank(r.getExpression()))R(eO.getDefaultValue(t.getSchema(),s))&&e.addMessage(n5.ERROR,eT.format(n6.PARAMETER_NEEDS_A_VALUE,t.getParameterName()));else try{this.addDependencies(e,r.getExpression())}catch(t){e.addMessage(n5.ERROR,eT.format("Error evaluating $ : $",r.getExpression(),t))}}}else R(await eO.getDefaultValue(t.getSchema(),s))&&e.addMessage(n5.ERROR,eT.format(n6.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(n6.STEP_REGEX_PATTERN)??[]).forEach(t=>e.addDependency(t))}makeEdges(e){let t=e.getNodeMap().values(),r=[],s=new Map;for(let n of Array.from(t))for(let t of Array.from(n.getData().getDependencies())){let a=t.indexOf(".",6),i=t.substring(6,a),o=t.indexOf(".",a+1),E=-1==o?t.substring(a+1):t.substring(a+1,o);e.getNodeMap().has(i)?n.addInEdgeTo(e.getNodeMap().get(i),E):(r.push(new eN(i,E)),s.set(n.getData().getStatement().getStatementName(),eT.format("Unable to find the step with name $",i)))}return new eN(r,s)}}var n7={};E(n7,"KIRunConstants",()=>n8);class n8{static{this.NAMESPACE="namespace"}static{this.NAME="name"}static{this.ID="id"}constructor(){}}var ae={};E(ae,"Position",()=>at);class at{static{this.SCHEMA_NAME="Position"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(at.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["left",D.ofFloat("left")],["top",D.ofFloat("top")]]))}constructor(e,t){this.left=e,this.top=t}getLeft(){return this.left}setLeft(e){return this.left=e,this}getTop(){return this.top}setTop(e){return this.top=e,this}static from(e){if(e)return new at(e.left,e.top)}}var ar={};E(ar,"FunctionDefinition",()=>al);var as={};E(as,"Statement",()=>aE);var an={};E(an,"AbstractStatement",()=>aa);class aa{constructor(e){if(this.override=!1,!e)return;this.comment=e.comment,this.description=e.description,this.position=e.position?new at(e.position.getLeft(),e.position.getTop()):void 0,this.override=e.override}getComment(){return this.comment}setComment(e){return this.comment=e,this}isOverride(){return this.override}setOverride(e){return this.override=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getPosition(){return this.position}setPosition(e){return this.position=e,this}}var ai={};E(ai,"ParameterReference",()=>ao);class ao{static{this.SCHEMA_NAME="ParameterReference"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(ao.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["key",D.ofString("key")],["value",D.ofAny("value")],["expression",D.ofString("expression")],["type",D.ofString("type").setEnums(["EXPRESSION","VALUE"])],["order",D.ofInteger("order")]]))}constructor(e){e instanceof ao?(this.key=e.key,this.type=e.type,this.value=R(e.value)?void 0:JSON.parse(JSON.stringify(e.value)),this.expression=e.expression,this.order=e.order):(this.type=e,this.key=n9())}getType(){return this.type}setType(e){return this.type=e,this}getKey(){return this.key}setKey(e){return this.key=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}getExpression(){return this.expression}setExpression(e){return this.expression=e,this}setOrder(e){return this.order=e,this}getOrder(){return this.order}static ofExpression(e){let t=new ao(n1.EXPRESSION).setExpression(e);return[t.getKey(),t]}static ofValue(e){let t=new ao(n1.VALUE).setValue(e);return[t.getKey(),t]}static from(e){return new ao(e.type).setValue(e.value).setExpression(e.expression).setKey(e.key).setOrder(e.order)}}class aE extends aa{static{this.SCHEMA_NAME="Statement"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(aE.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["statementName",D.ofString("statementName")],["comment",D.ofString("comment")],["description",D.ofString("description")],["namespace",D.ofString("namespace")],["name",D.ofString("name")],["dependentStatements",D.ofObject("dependentstatement").setAdditionalProperties(new C().setSchemaValue(D.ofBoolean("exists"))).setDefaultValue({})],["executeIftrue",D.ofObject("executeIftrue").setAdditionalProperties(new C().setSchemaValue(D.ofBoolean("exists"))).setDefaultValue({})],["parameterMap",new D().setName("parameterMap").setAdditionalProperties(new C().setSchemaValue(D.ofObject("parameterReference").setAdditionalProperties(new C().setSchemaValue(ao.SCHEMA))))],["position",at.SCHEMA]]))}constructor(e,t,r){if(super(e instanceof aE?e:void 0),e instanceof aE)this.statementName=e.statementName,this.name=e.name,this.namespace=e.namespace,e.parameterMap&&(this.parameterMap=new Map(Array.from(e.parameterMap.entries()).map(e=>[e[0],new Map(Array.from(e[1].entries()).map(e=>[e[0],new ao(e[1])]))]))),e.dependentStatements&&(this.dependentStatements=new Map(Array.from(e.dependentStatements.entries())));else{if(this.statementName=e,!r||!t)throw Error("Unknown constructor");this.namespace=t,this.name=r}}getStatementName(){return this.statementName}setStatementName(e){return this.statementName=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getParameterMap(){return this.parameterMap||(this.parameterMap=new Map),this.parameterMap}setParameterMap(e){return this.parameterMap=e,this}getDependentStatements(){return this.dependentStatements??new Map}setDependentStatements(e){return this.dependentStatements=e,this}getExecuteIftrue(){return this.executeIftrue??new Map}setExecuteIftrue(e){return this.executeIftrue=e,this}equals(e){return e instanceof aE&&e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}static from(e){return new aE(e.statementName,e.namespace,e.name).setParameterMap(new Map(Object.entries(e.parameterMap??{}).map(([e,t])=>[e,new Map(Object.entries(t??{}).map(([e,t])=>ao.from(t)).map(e=>[e.getKey(),e]))]))).setDependentStatements(new Map(Object.entries(e.dependentStatements??{}))).setExecuteIftrue(new Map(Object.entries(e.executeIftrue??{}))).setPosition(at.from(e.position)).setComment(e.comment).setDescription(e.description)}}var au={};E(au,"StatementGroup",()=>aA);class aA extends aa{static{this.SCHEMA_NAME="StatementGroup"}static{this.SCHEMA=new D().setNamespace(l.SYSTEM).setName(aA.SCHEMA_NAME).setType(d.of(p.OBJECT)).setProperties(new Map([["statementGroupName",D.ofString("statementGroupName")],["comment",D.ofString("comment")],["description",D.ofString("description")],["position",at.SCHEMA]]))}constructor(e,t=new Map){super(),this.statementGroupName=e,this.statements=t}getStatementGroupName(){return this.statementGroupName}setStatementGroupName(e){return this.statementGroupName=e,this}getStatements(){return this.statements}setStatements(e){return this.statements=e,this}static from(e){return new aA(e.statementGroupName,new Map(Object.entries(e.statements||{}).map(([e,t])=>[e,(""+t)?.toLowerCase()=="true"]))).setPosition(at.from(e.position)).setComment(e.comment).setDescription(e.description)}}const aT=new D().setNamespace(l.SYSTEM).setName("FunctionDefinition").setProperties(new Map([["name",D.ofString("name")],["namespace",D.ofString("namespace")],["parameters",D.ofArray("parameters",k.SCHEMA)],["events",D.ofObject("events").setAdditionalProperties(new C().setSchemaValue(Q.SCHEMA))],["steps",D.ofObject("steps").setAdditionalProperties(new C().setSchemaValue(aE.SCHEMA))]]));aT.getProperties()?.set("parts",D.ofArray("parts",aT));class al extends ea{static{this.SCHEMA=aT}constructor(e){super(e),this.version=1}getVersion(){return this.version}setVersion(e){return this.version=e,this}getSteps(){return this.steps??new Map}setSteps(e){return this.steps=e,this}getStepGroups(){return this.stepGroups}setStepGroups(e){return this.stepGroups=e,this}getParts(){return this.parts}setParts(e){return this.parts=e,this}static from(e){return e?new al(e.name).setSteps(new Map(Object.values(e.steps??{}).filter(e=>!!e).map(e=>[e.statementName,aE.from(e)]))).setStepGroups(new Map(Object.values(e.stepGroups??{}).filter(e=>!!e).map(e=>[e.statementGroupName,aA.from(e)]))).setParts(Array.from(e.parts??[]).filter(e=>!!e).map(e=>al.from(e))).setVersion(e.version??1).setEvents(new Map(Object.values(e.events??{}).filter(e=>!!e).map(e=>[e.name,Q.from(e)]))).setParameters(new Map(Object.values(e.parameters??{}).filter(e=>!!e).map(e=>[e.parameterName,k.from(e)]))).setNamespace(e.namespace):new al("unknown")}}var am={};E(am,"Argument",()=>ah);class ah{constructor(e,t,r){this.argumentIndex=0,this.argumentIndex=e,this.name=t,this.value=r}getArgumentIndex(){return this.argumentIndex}setArgumentIndex(e){return this.argumentIndex=e,this}getName(){return this.name}setName(e){return this.name=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}static of(e,t){return new ah(0,e,t)}}var aR={};o(aR,rK),o(aR,r1),o(aR,r9),o(aR,r4),o(aR,rQ);var ag={};o(ag,ro),o(ag,ru),o(ag,rT),o(ag,rm),o(ag,rR),o(ag,rc),o(ag,rN),o(ag,rn),o(ag,r_),o(ag,rS),o(ag,rw),o(ag,rP),o(ag,ry),o(ag,rL),o(ag,rU),o(ag,rC),o(ag,rb),o(ag,rF),o(ag,rY),o(ag,rj),o(ag,rk),o(ag,rX),o(ag,rq),o(ag,rs),o(module.exports,u),o(module.exports,J),o(module.exports,{}),o(module.exports,e5),o(module.exports,$),o(module.exports,h),o(module.exports,eu),o(module.exports,tP),o(module.exports,eA),o(module.exports,eR),o(module.exports,ep),o(module.exports,tt),o(module.exports,eE),o(module.exports,tn),o(module.exports,nb),o(module.exports,nG),o(module.exports,t3),o(module.exports,nY),o(module.exports,nk),o(module.exports,nj),o(module.exports,nX),o(module.exports,{}),o(module.exports,nJ),o(module.exports,nK),o(module.exports,n4),o(module.exports,n2),o(module.exports,td),o(module.exports,tG),o(module.exports,r6),o(module.exports,tw),o(module.exports,rr),o(module.exports,tC),o(module.exports,tL),o(module.exports,ty),o(module.exports,tU),o(module.exports,{}),o(module.exports,ei),o(module.exports,T),o(module.exports,nQ),o(module.exports,A),o(module.exports,eV),o(module.exports,ex),o(module.exports,ev),o(module.exports,eI),o(module.exports,ew),o(module.exports,eG),o(module.exports,eD),o(module.exports,eo),o(module.exports,eM),o(module.exports,G),o(module.exports,eP),o(module.exports,m),o(module.exports,O),o(module.exports,N),o(module.exports,f),o(module.exports,_),o(module.exports,c),o(module.exports,ec),o(module.exports,eF),o(module.exports,nU),o(module.exports,n7),o(module.exports,b),o(module.exports,ee),o(module.exports,ae),o(module.exports,ar),o(module.exports,n0),o(module.exports,z),o(module.exports,an),o(module.exports,as),o(module.exports,{}),o(module.exports,au),o(module.exports,en),o(module.exports,K),o(module.exports,B),o(module.exports,am),o(module.exports,ai),o(module.exports,e6),o(module.exports,et),o(module.exports,aR),o(module.exports,ag),o(module.exports,se);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|