@fincity/kirun-js 2.7.0 → 2.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/__tests__/engine/function/system/WaitTest.ts +1 -1
  2. package/__tests__/engine/function/system/array/AddFirstTest.ts +2 -6
  3. package/__tests__/engine/function/system/array/IndexOfTest.ts +8 -13
  4. package/__tests__/engine/function/system/array/LastIndexOfTest.ts +9 -28
  5. package/__tests__/engine/function/system/date/AddSubtractTimeTest.ts +93 -0
  6. package/__tests__/engine/function/system/date/DateFunctionRepositoryTest.ts +96 -0
  7. package/__tests__/engine/function/system/date/DifferenceTest.ts +93 -0
  8. package/__tests__/engine/function/system/date/EpochToTimestampTest.ts +133 -0
  9. package/__tests__/engine/function/system/date/FromDateStringTest.ts +51 -0
  10. package/__tests__/engine/function/system/date/FromNowTest.ts +71 -0
  11. package/__tests__/engine/function/system/date/GetCurrentTimeStampTest.ts +19 -27
  12. package/__tests__/engine/function/system/date/GetNamesTest.ts +105 -0
  13. package/__tests__/engine/function/system/date/IsBetweenTest.ts +53 -0
  14. package/__tests__/engine/function/system/date/IsValidISODateTest.ts +42 -54
  15. package/__tests__/engine/function/system/date/LastFirstOfTest.ts +64 -0
  16. package/__tests__/engine/function/system/date/SetTimeZoneTest.ts +48 -0
  17. package/__tests__/engine/function/system/date/StartEndOfTest.ts +53 -0
  18. package/__tests__/engine/function/system/date/TimeAsTest.ts +24 -0
  19. package/__tests__/engine/function/system/date/TimestampToEpochTest.ts +45 -0
  20. package/__tests__/engine/function/system/date/ToDateStringTest.ts +48 -0
  21. package/__tests__/engine/function/system/math/RandomFloatTest.ts +21 -22
  22. package/__tests__/engine/function/system/math/RandomIntTest.ts +5 -4
  23. package/__tests__/engine/repository/RepositoryFilterTest.ts +4 -1
  24. package/__tests__/engine/runtime/expression/ExpressionEqualityTest.ts +76 -0
  25. package/dist/index.js +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/module.js +1 -1
  28. package/dist/module.js.map +1 -1
  29. package/dist/types.d.ts +14 -13
  30. package/dist/types.d.ts.map +1 -1
  31. package/generator/generateValidationCSV.ts +51 -42
  32. package/generator/validation-js.csv +0 -0
  33. package/package.json +9 -7
  34. package/src/engine/function/AbstractFunction.ts +1 -1
  35. package/src/engine/function/system/Print.ts +19 -5
  36. package/src/engine/function/system/Wait.ts +1 -1
  37. package/src/engine/function/system/array/AbstractArrayFunction.ts +3 -3
  38. package/src/engine/function/system/array/Fill.ts +1 -1
  39. package/src/engine/function/system/array/Frequency.ts +0 -1
  40. package/src/engine/function/system/array/IndexOf.ts +4 -4
  41. package/src/engine/function/system/array/LastIndexOf.ts +3 -3
  42. package/src/engine/function/system/array/Rotate.ts +1 -1
  43. package/src/engine/function/system/array/Shuffle.ts +1 -1
  44. package/src/engine/function/system/array/Sort.ts +1 -1
  45. package/src/engine/function/system/date/AbstractDateFunction.ts +229 -111
  46. package/src/engine/function/system/date/AddSubtractTime.ts +99 -0
  47. package/src/engine/function/system/date/DateFunctionRepository.ts +228 -122
  48. package/src/engine/function/system/date/EpochToTimestamp.ts +75 -0
  49. package/src/engine/function/system/date/FromDateString.ts +44 -0
  50. package/src/engine/function/system/date/FromNow.ts +77 -0
  51. package/src/engine/function/system/date/GetCurrent.ts +20 -0
  52. package/src/engine/function/system/date/GetNames.ts +74 -0
  53. package/src/engine/function/system/date/IsBetween.ts +62 -0
  54. package/src/engine/function/system/date/IsValidISODate.ts +54 -40
  55. package/src/engine/function/system/date/LastFirstOf.ts +72 -0
  56. package/src/engine/function/system/date/SetTimeZone.ts +43 -0
  57. package/src/engine/function/system/date/StartEndOf.ts +44 -0
  58. package/src/engine/function/system/date/TimeAs.ts +64 -0
  59. package/src/engine/function/system/date/TimestampToEpoch.ts +54 -0
  60. package/src/engine/function/system/date/ToDateString.ts +49 -0
  61. package/src/engine/function/system/date/common.ts +9 -0
  62. package/src/engine/function/system/math/MathFunctionRepository.ts +43 -4
  63. package/src/engine/function/system/math/RandomAny.ts +57 -0
  64. package/src/engine/function/system/object/ObjectConvert.ts +45 -19
  65. package/src/engine/function/system/object/ObjectFunctionRepository.ts +2 -1
  66. package/src/engine/function/system/string/AbstractStringFunction.ts +42 -82
  67. package/src/engine/function/system/string/StringFunctionRepository.ts +39 -20
  68. package/src/engine/json/schema/SchemaUtil.ts +1 -1
  69. package/src/engine/repository/KIRunSchemaRepository.ts +57 -3
  70. package/src/engine/util/string/StringUtil.ts +12 -0
  71. package/tsconfig.json +1 -2
  72. package/__tests__/engine/function/system/date/AddTimeTest.ts +0 -115
  73. package/__tests__/engine/function/system/date/DateToEpochTest.ts +0 -74
  74. package/__tests__/engine/function/system/date/DifferenceOfTimestampsTest.ts +0 -53
  75. package/__tests__/engine/function/system/date/EpochToDateTest.ts +0 -105
  76. package/__tests__/engine/function/system/date/GetDateTest.ts +0 -85
  77. package/__tests__/engine/function/system/date/GetDayTest.ts +0 -85
  78. package/__tests__/engine/function/system/date/GetFullYearTest.ts +0 -85
  79. package/__tests__/engine/function/system/date/GetHoursTest.ts +0 -85
  80. package/__tests__/engine/function/system/date/GetMilliSecondsTest.ts +0 -85
  81. package/__tests__/engine/function/system/date/GetMinutesTest.ts +0 -85
  82. package/__tests__/engine/function/system/date/GetMonthTest.ts +0 -85
  83. package/__tests__/engine/function/system/date/GetSecondsTest.ts +0 -85
  84. package/__tests__/engine/function/system/date/GetTimeAsArrayTest.ts +0 -59
  85. package/__tests__/engine/function/system/date/GetTimeAsObjectTest.ts +0 -83
  86. package/__tests__/engine/function/system/date/GetTimeTest.ts +0 -86
  87. package/__tests__/engine/function/system/date/IsLeapYearTest.ts +0 -85
  88. package/__tests__/engine/function/system/date/MaximumTimestampTest.ts +0 -55
  89. package/__tests__/engine/function/system/date/MinimumTimestampTest.ts +0 -54
  90. package/__tests__/engine/function/system/date/SubtractTimeTest.ts +0 -95
  91. package/src/engine/function/system/date/DateToEpoch.ts +0 -39
  92. package/src/engine/function/system/date/DifferenceOfTimestamps.ts +0 -45
  93. package/src/engine/function/system/date/EpochToDate.ts +0 -76
  94. package/src/engine/function/system/date/GetCurrentTimeStamp.ts +0 -36
  95. package/src/engine/function/system/date/GetTimeAsArray.ts +0 -48
  96. package/src/engine/function/system/date/GetTimeAsObject.ts +0 -66
  97. package/src/engine/function/system/date/MaximumTimestamp.ts +0 -73
  98. package/src/engine/function/system/date/MinimumTimestamp.ts +0 -74
  99. package/src/engine/function/system/math/RandomFloat.ts +0 -56
  100. package/src/engine/function/system/math/RandomInt.ts +0 -56
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- function e(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 t(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var r,n,a,s,i,o,E,u,l,A,g,c,m={};t(m,"KIRunSchemaRepository",()=>q);var T={};t(T,"AdditionalType",()=>F),t(T,"Schema",()=>Y);var p={};t(p,"Namespaces",()=>R);class R{static SYSTEM="System";static SYSTEM_CTX="System.Context";static SYSTEM_LOOP="System.Loop";static SYSTEM_ARRAY="System.Array";static SYSTEM_OBJECT="System.Object";static MATH="System.Math";static STRING="System.String";static DATE="System.Date";constructor(){}}var h={};t(h,"ArraySchemaType",()=>_);var f={};function N(e){return null==e}t(f,"isNullValue",()=>N);class _{singleSchema;tupleSchema;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!N(this.singleSchema)}static of(...e){return 1==e.length?new _().setSingleSchema(e[0]):new _().setTupleSchema(e)}static from(e){if(!e)return;if(Array.isArray(e))return new _().setTupleSchema(Y.fromListOfSchemas(e));let t=Object.keys(e);if(-1!=t.indexOf("singleSchema"))return new _().setSingleSchema(Y.from(e.singleSchema));if(-1!=t.indexOf("tupleSchema"))return new _().setTupleSchema(Y.fromListOfSchemas(e.tupleSchema));let r=Y.from(e);if(r)return new _().setSingleSchema(r)}}var S={};t(S,"SchemaType",()=>E),(r=E||(E={})).INTEGER="Integer",r.LONG="Long",r.FLOAT="Float",r.DOUBLE="Double",r.STRING="String",r.OBJECT="Object",r.ARRAY="Array",r.BOOLEAN="Boolean",r.NULL="Null";var M={};t(M,"TypeUtil",()=>x);var w={};t(w,"MultipleType",()=>I);var O={};t(O,"Type",()=>d);class d{}class I extends d{type;constructor(e){super(),e instanceof I?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 P={};t(P,"SingleType",()=>y);class y extends d{type;constructor(e){super(),e instanceof y?this.type=e.type:this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class x{static of(...e){return 1==e.length?new y(e[0]):new I(new Set(e))}static from(e){return"string"==typeof e?new y(E[x.fromJSONType(e)]):Array.isArray(e)?new I(new Set(e.map(x.fromJSONType).map(e=>e).map(e=>E[e]))):void 0}static fromJSONType(e){let t=e.toUpperCase();return"NUMBER"===t?"DOUBLE":t}}const v="additionalProperty",L="additionalItems",U="enums",C="items",V="System.Schema",D="required",b="version",G="namespace";class F{booleanValue;schemaValue;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(N(e))return;let t=new F;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 NULL=new Y().setNamespace(R.SYSTEM).setName("Null").setType(x.of(E.NULL)).setConstant(void 0);static TYPE_SCHEMA=new Y().setType(x.of(E.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"]);static SCHEMA=new Y().setNamespace(R.SYSTEM).setName("Schema").setType(x.of(E.OBJECT)).setProperties(new Map([[G,Y.of(G,E.STRING).setDefaultValue("_")],["name",Y.ofString("name")],[b,Y.of(b,E.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(V))],["allOf",Y.ofArray("allOf",Y.ofRef(V))],["oneOf",Y.ofArray("oneOf",Y.ofRef(V))],["not",Y.ofRef(V)],["title",Y.ofString("title")],["description",Y.ofString("description")],["id",Y.ofString("id")],["examples",Y.ofAny("examples")],["defaultValue",Y.ofAny("defaultValue")],["comment",Y.ofString("comment")],[U,Y.ofArray(U,Y.ofString(U))],["constant",Y.ofAny("constant")],["pattern",Y.ofString("pattern")],["format",Y.of("format",E.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",E.OBJECT).setAdditionalProperties(new F().setSchemaValue(Y.ofRef(V)))],["additionalProperties",new Y().setName(v).setNamespace(R.SYSTEM).setAnyOf([Y.ofBoolean(v),Y.ofObject(v).setRef(V)]).setDefaultValue(!0)],[D,Y.ofArray(D,Y.ofString(D)).setDefaultValue([])],["propertyNames",Y.ofRef(V)],["minProperties",Y.ofInteger("minProperties")],["maxProperties",Y.ofInteger("maxProperties")],["patternProperties",Y.of("patternProperties",E.OBJECT).setAdditionalProperties(new F().setSchemaValue(Y.ofRef(V)))],[C,new Y().setName(C).setAnyOf([Y.ofRef(V).setName("item"),Y.ofArray("tuple",Y.ofRef(V))])],["contains",Y.ofRef(V)],["minContains",Y.ofInteger("minContains")],["maxContains",Y.ofInteger("maxContains")],["minItems",Y.ofInteger("minItems")],["maxItems",Y.ofInteger("maxItems")],["uniqueItems",Y.ofBoolean("uniqueItems")],["additionalItems",new Y().setName(L).setNamespace(R.SYSTEM).setAnyOf([Y.ofBoolean(L),Y.ofObject(L).setRef(V)])],["$defs",Y.of("$defs",E.OBJECT).setAdditionalProperties(new F().setSchemaValue(Y.ofRef(V)))],["permission",Y.ofString("permission")]])).setRequired([]);static ofString(e){return new Y().setType(x.of(E.STRING)).setName(e)}static ofInteger(e){return new Y().setType(x.of(E.INTEGER)).setName(e)}static ofFloat(e){return new Y().setType(x.of(E.FLOAT)).setName(e)}static ofLong(e){return new Y().setType(x.of(E.LONG)).setName(e)}static ofDouble(e){return new Y().setType(x.of(E.DOUBLE)).setName(e)}static ofAny(e){return new Y().setType(x.of(E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE,E.STRING,E.BOOLEAN,E.ARRAY,E.NULL,E.OBJECT)).setName(e)}static ofAnyNotNull(e){return new Y().setType(x.of(E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE,E.STRING,E.BOOLEAN,E.ARRAY,E.OBJECT)).setName(e)}static ofNumber(e){return new Y().setType(x.of(E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE)).setName(e)}static ofBoolean(e){return new Y().setType(x.of(E.BOOLEAN)).setName(e)}static of(e,...t){return new Y().setType(x.of(...t)).setName(e)}static ofObject(e){return new Y().setType(x.of(E.OBJECT)).setName(e)}static ofRef(e){return new Y().setRef(e)}static ofArray(e,...t){return new Y().setType(x.of(E.ARRAY)).setName(e).setItems(_.of(...t))}static fromListOfSchemas(e){if(N(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(N(e))return;let t=new Map;return Object.entries(e).forEach(([e,r])=>{let n=Y.from(r);n&&t.set(e,n)}),t}static from(e,t=!1){if(N(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 y(E.STRING):r.type=x.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=F.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=_.from(e.items),r.additionalItems=F.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}namespace="_";name;version=1;ref;type;anyOf;allOf;oneOf;not;description;examples;defaultValue;comment;enums;constant;pattern;format;minLength;maxLength;multipleOf;minimum;maximum;exclusiveMinimum;exclusiveMaximum;properties;additionalProperties;required;propertyNames;minProperties;maxProperties;patternProperties;items;additionalItems;contains;minContains;maxContains;minItems;maxItems;uniqueItems;$defs;permission;constructor(e){if(!e)return;this.namespace=e.namespace,this.name=e.name,this.version=e.version,this.ref=e.ref,N(e.type)||(this.type=e.type instanceof y?new y(e.type):new I(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 F(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 _(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 F(e.additionalItems):void 0,this.$defs=e.$defs?new Map(Array.from(e.$defs.entries()).map(e=>[e[0],new Y(e[1])])):void 0,this.permission=e.permission}getTitle(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}getFullName(){return this.namespace+"."+this.name}get$defs(){return this.$defs}set$defs(e){return this.$defs=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getVersion(){return this.version}setVersion(e){return this.version=e,this}getRef(){return this.ref}setRef(e){return this.ref=e,this}getType(){return this.type}setType(e){return this.type=e,this}getAnyOf(){return this.anyOf}setAnyOf(e){return this.anyOf=e,this}getAllOf(){return this.allOf}setAllOf(e){return this.allOf=e,this}getOneOf(){return this.oneOf}setOneOf(e){return this.oneOf=e,this}getNot(){return this.not}setNot(e){return this.not=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getExamples(){return this.examples}setExamples(e){return this.examples=e,this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}getComment(){return this.comment}setComment(e){return this.comment=e,this}getEnums(){return this.enums}setEnums(e){return this.enums=e,this}getConstant(){return this.constant}setConstant(e){return this.constant=e,this}getPattern(){return this.pattern}setPattern(e){return this.pattern=e,this}getFormat(){return this.format}setFormat(e){return this.format=e,this}getMinLength(){return this.minLength}setMinLength(e){return this.minLength=e,this}getMaxLength(){return this.maxLength}setMaxLength(e){return this.maxLength=e,this}getMultipleOf(){return this.multipleOf}setMultipleOf(e){return this.multipleOf=e,this}getMinimum(){return this.minimum}setMinimum(e){return this.minimum=e,this}getMaximum(){return this.maximum}setMaximum(e){return this.maximum=e,this}getExclusiveMinimum(){return this.exclusiveMinimum}setExclusiveMinimum(e){return this.exclusiveMinimum=e,this}getExclusiveMaximum(){return this.exclusiveMaximum}setExclusiveMaximum(e){return this.exclusiveMaximum=e,this}getProperties(){return this.properties}setProperties(e){return this.properties=e,this}getAdditionalProperties(){return this.additionalProperties}setAdditionalProperties(e){return this.additionalProperties=e,this}getAdditionalItems(){return this.additionalItems}setAdditionalItems(e){return this.additionalItems=e,this}getRequired(){return this.required}setRequired(e){return this.required=e,this}getPropertyNames(){return this.propertyNames}setPropertyNames(e){return this.propertyNames=e,this.propertyNames.type=new y(E.STRING),this}getMinProperties(){return this.minProperties}setMinProperties(e){return this.minProperties=e,this}getMaxProperties(){return this.maxProperties}setMaxProperties(e){return this.maxProperties=e,this}getPatternProperties(){return this.patternProperties}setPatternProperties(e){return this.patternProperties=e,this}getItems(){return this.items}setItems(e){return this.items=e,this}getContains(){return this.contains}setContains(e){return this.contains=e,this}getMinContains(){return this.minContains}setMinContains(e){return this.minContains=e,this}getMaxContains(){return this.maxContains}setMaxContains(e){return this.maxContains=e,this}getMinItems(){return this.minItems}setMinItems(e){return this.minItems=e,this}getMaxItems(){return this.maxItems}setMaxItems(e){return this.maxItems=e,this}getUniqueItems(){return this.uniqueItems}setUniqueItems(e){return this.uniqueItems=e,this}getPermission(){return this.permission}setPermission(e){return this.permission=e,this}}var B={};t(B,"Parameter",()=>W);var H={};t(H,"SchemaReferenceException",()=>k);class k extends Error{schemaPath;cause;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 $={};t($,"ParameterType",()=>u),(n=u||(u={})).CONSTANT="CONSTANT",n.EXPRESSION="EXPRESSION";const j="value";class W{static SCHEMA_NAME="Parameter";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(W.SCHEMA_NAME).setProperties(new Map([["schema",Y.SCHEMA],["parameterName",Y.ofString("parameterName")],["variableArgument",Y.of("variableArgument",E.BOOLEAN).setDefaultValue(!1)],["type",Y.ofString("type").setEnums(["EXPRESSION","CONSTANT"])]]));static EXPRESSION=new Y().setNamespace(R.SYSTEM).setName("ParameterExpression").setType(x.of(E.OBJECT)).setProperties(new Map([["isExpression",Y.ofBoolean("isExpression").setDefaultValue(!0)],[j,Y.ofAny(j)]]));schema;parameterName;variableArgument=!1;type=u.EXPRESSION;constructor(e,t){if(e instanceof W)this.schema=new Y(e.schema),this.parameterName=e.parameterName,this.variableArgument=e.variableArgument,this.type=e.type;else{if(!t)throw Error("Unknown constructor signature");this.schema=t,this.parameterName=e}}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getParameterName(){return this.parameterName}setParameterName(e){return this.parameterName=e,this}isVariableArgument(){return this.variableArgument}setVariableArgument(e){return this.variableArgument=e,this}getType(){return this.type}setType(e){return this.type=e,this}static ofEntry(e,t,r=!1,n=u.EXPRESSION){return[e,new W(e,t).setType(n).setVariableArgument(r)]}static of(e,t,r=!1,n=u.EXPRESSION){return new W(e,t).setType(n).setVariableArgument(r)}static from(e){let t=Y.from(e.schema);if(!t)throw new k("","Parameter requires Schema");return new W(e.parameterName,t).setVariableArgument(!!e.variableArgument).setType(e.type??u.EXPRESSION)}}const X=new Map([["any",Y.ofAny("any").setNamespace(R.SYSTEM)],["boolean",Y.ofBoolean("boolean").setNamespace(R.SYSTEM)],["double",Y.ofDouble("double").setNamespace(R.SYSTEM)],["float",Y.ofFloat("float").setNamespace(R.SYSTEM)],["integer",Y.ofInteger("integer").setNamespace(R.SYSTEM)],["long",Y.ofLong("long").setNamespace(R.SYSTEM)],["number",Y.ofNumber("number").setNamespace(R.SYSTEM)],["string",Y.ofString("string").setNamespace(R.SYSTEM)],["Date.timeStamp",Y.ofString("timeStamp").setNamespace(R.DATE)],[W.EXPRESSION.getName(),W.EXPRESSION],[Y.NULL.getName(),Y.NULL],[Y.SCHEMA.getName(),Y.SCHEMA]]),J=Array.from(X.values()).map(e=>e.getFullName());class q{async find(e,t){return R.SYSTEM!=e?Promise.resolve(void 0):Promise.resolve(X.get(t))}async filter(e){return Promise.resolve(J.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var z={};function K(e){return[e.getSignature().getName(),e]}t(z,"KIRunFunctionRepository",()=>a5);var Q={};t(Q,"MapUtil",()=>Z),t(Q,"MapEntry",()=>ee);class Z{static of(e,t,r,n,a,s,i,o,E,u,l,A,g,c,m,T,p,R,h,f){let _=new Map;return N(e)||N(t)||_.set(e,t),N(r)||N(n)||_.set(r,n),N(a)||N(s)||_.set(a,s),N(i)||N(o)||_.set(i,o),N(E)||N(u)||_.set(E,u),N(l)||N(A)||_.set(l,A),N(g)||N(c)||_.set(g,c),N(m)||N(T)||_.set(m,T),N(p)||N(R)||_.set(p,R),N(h)||N(f)||_.set(h,f),_}static ofArrayEntries(...e){let t=new Map;for(let[r,n]of e)t.set(r,n);return t}static entry(e,t){return new ee(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 ee{k;v;constructor(e,t){this.k=e,this.v=t}}var et={};t(et,"EventResult",()=>ea);var er={};t(er,"Event",()=>en);class en{static OUTPUT="output";static ERROR="error";static ITERATION="iteration";static TRUE="true";static FALSE="false";static SCHEMA_NAME="Event";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(en.SCHEMA_NAME).setType(x.of(E.OBJECT)).setProperties(new Map([["name",Y.ofString("name")],["parameters",Y.ofObject("parameter").setAdditionalProperties(new F().setSchemaValue(Y.SCHEMA))]]));name;parameters;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 k("","Event expects a schema");return[e[0],t]})))}}class ea{name;result;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 es={};t(es,"FunctionOutput",()=>eE);var ei={};t(ei,"KIRuntimeException",()=>eo);class eo extends Error{cause;constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class eE{fo;index=0;generator;constructor(e){if(N(e))throw new eo("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 eu={};t(eu,"FunctionSignature",()=>el);class el{static SCHEMA_NAME="FunctionSignature";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(el.SCHEMA_NAME).setProperties(new Map([["name",Y.ofString("name")],["namespace",Y.ofString("namespace")],["parameters",Y.ofObject("parameters").setAdditionalProperties(new F().setSchemaValue(W.SCHEMA))],["events",Y.ofObject("events").setAdditionalProperties(new F().setSchemaValue(en.SCHEMA))]]));namespace="_";name;parameters=new Map;events=new Map;constructor(e){e instanceof el?(this.name=e.name,this.namespace=e.namespace,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new W(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 eA={};t(eA,"AbstractFunction",()=>e1);var eg={};t(eg,"SchemaValidator",()=>e0);var ec={};t(ec,"deepEqual",()=>ef);var em={};t(em,"LinkedList",()=>eR);var eT={};t(eT,"StringFormatter",()=>ep);class ep{static format(e,...t){if(!t||0==t.length)return e;let r="",n=0,a="",s=a,i=e.length;for(let o=0;o<i;o++)"$"==(a=e.charAt(o))&&"\\"==s?r=r.substring(0,o-1)+a:"$"==a&&n<t.length?r+=t[n++]:r+=a,s=a;return r.toString()}constructor(){}}class eR{head=void 0;tail=void 0;length=0;constructor(e){if(e?.length){for(let t of e)if(this.head){let e=new eh(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new eh(t);this.length=e.length}}push(e){let t=new eh(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 eo(ep.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 eh(e,this.head),this.head.next=this.tail):(this.tail=new eh(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new eh(e),this}map(e,t){let r=new eR,n=this.head,a=0;for(;n;)r.add(e(n.value,a)),n=n.next,++a;return r}indexOf(e){let t=this.head,r=0;for(;t;){if(ef(t.value,e))return r;t=t.next,++r}return -1}forEach(e,t){let r=this.head,n=0;for(;r;)e(r.value,n),r=r.next,++n}}class eh{value;next;previous;constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}function ef(e,t){let r=new eR;r.push(e);let n=new eR;for(n.push(t);!r.isEmpty()&&!n.isEmpty();){let e=r.pop(),t=n.pop();if(e===t)continue;let a=typeof e,s=typeof t;if("undefined"===a||"undefined"===s){if(!e&&!t)continue;return!1}if(a!==s)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!=t.length)return!1;for(let a=0;a<e.length;a++)r.push(e[a]),n.push(t[a]);continue}if("object"===a){if("object"!==s||null===e||null===t)return!1;let a=Object.entries(e),i=Object.entries(t);if(a.length!==i.length)return!1;for(let[e,s]of a)r.push(s),n.push(t[e]);continue}return!1}return!0}var eN={};t(eN,"StringUtil",()=>e_);class e_{constructor(){}static nthIndex(e,t,r=0,n){if(!e)throw new eo("String cannot be null");if(r<0||r>=e.length)throw new eo(ep.format("Cannot search from index : $",r));if(n<=0||n>e.length)throw new eo(ep.format("Cannot search for occurance : $",n));for(;r<e.length;){if(e.charAt(r)==t&&0==--n)return r;++r}return -1}static splitAtFirstOccurance(e,t){if(!e)return[void 0,void 0];let r=e.indexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static isNullOrBlank(e){return!e||""==e.trim()}}var eS={};t(eS,"SchemaUtil",()=>ey);var eM={};t(eM,"Tuple2",()=>ew),t(eM,"Tuple3",()=>eO),t(eM,"Tuple4",()=>ed);class ew{f;s;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 eO extends ew{t;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 ed extends eO{fr;constructor(e,t,r,n){super(e,t,r),this.fr=n}getT4(){return this.fr}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}setT3(e){return this.t=e,this}setT4(e){return this.fr=e,this}}var eI={};t(eI,"SchemaValidationException",()=>eP);class eP extends Error{schemaPath;cause;constructor(e,t,r=[],n){super(t+(r?r.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.cause=n}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class ey{static UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH="Unable to retrive schema from referenced path";static CYCLIC_REFERENCE_LIMIT_COUNTER=20;static async getDefaultValue(e,t){if(e)return e.getConstant()?e.getConstant():N(e.getDefaultValue())?ey.getDefaultValue(await ey.getSchemaFromRef(e,t,e.getRef()),t):e.getDefaultValue()}static async hasDefaultValueOrNullSchemaType(e,t){return e?e.getConstant()||!N(e.getDefaultValue())?Promise.resolve(!0):N(e.getRef())?e.getType()?.getAllowedSchemaTypes().has(E.NULL)?Promise.resolve(!0):Promise.resolve(!1):this.hasDefaultValueOrNullSchemaType(await ey.getSchemaFromRef(e,t,e.getRef()),t):Promise.resolve(!1)}static async getSchemaFromRef(e,t,r,n=0){if(++n==ey.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new eP(r??"","Schema has a cyclic reference");if(!e||!r||e_.isNullOrBlank(r))return Promise.resolve(void 0);if(!r.startsWith("#")){var a=await ey.resolveExternalSchema(e,t,r);a&&(e=a.getT1(),r=a.getT2())}let s=r.split("/");return 1===s.length?Promise.resolve(e):Promise.resolve(ey.resolveInternalSchema(e,t,r,n,s,1))}static async resolveInternalSchema(e,t,r,n,a,s){let i=e;if(s!==a.length){for(;s<a.length;){if("$defs"===a[s]){if(++s>=a.length||!i.get$defs())throw new k(r,ey.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);i=i.get$defs()?.get(a[s])}else{if(i&&(!i.getType()?.contains(E.OBJECT)||!i.getProperties()))throw new k(r,"Cannot retrievie schema from non Object type schemas");i=i.getProperties()?.get(a[s])}if(s++,!i||!e_.isNullOrBlank(i.getRef())&&!(i=await ey.getSchemaFromRef(i,t,i.getRef(),n)))throw new k(r,ey.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 n=e_.splitAtFirstOccurance(r??"","/");if(!n[0])return Promise.resolve(void 0);let a=e_.splitAtFirstOccurance(n[0],".");if(!a[0]||!a[1])return Promise.resolve(void 0);let s=await t.find(a[0],a[1]);if(!s)return Promise.resolve(void 0);if(!n[1]||""===n[1])return Promise.resolve(new ew(s,r));if(r="#/"+n[1],!s)throw new k(r,ey.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return Promise.resolve(new ew(s,r))}constructor(){}}var ex={};t(ex,"AnyOfAllOfOneOfValidator",()=>ev);class ev{static async validate(e,t,r,n,a,s){let i=[];return t.getOneOf()&&!t.getOneOf()?await ev.oneOf(e,t,r,n,i,a,s):t.getAllOf()&&!t.getAllOf()?await ev.allOf(e,t,r,n,i,a,s):t.getAnyOf()&&!t.getAnyOf()?await ev.anyOf(e,t,r,n,i,a,s):n}static async anyOf(e,t,r,n,a,s,i){let o=!1;for(let E of t.getAnyOf()??[])try{await ev.validate(e,E,r,n,s,i),o=!0;break}catch(e){o=!1,a.push(e)}if(o)return n;throw new eP(e0.path(e),"The value don't satisfy any of the schemas.",a)}static async allOf(e,t,r,n,a,s,i){let o=0;for(let E of t.getAllOf()??[])try{await ev.validate(e,E,r,n,s,i),o++}catch(e){a.push(e)}if(o===t.getAllOf()?.length)return n;throw new eP(e0.path(e),"The value doesn't satisfy some of the schemas.",a)}static async oneOf(e,t,r,n,a,s,i){let o=0;for(let E of t.getOneOf()??[])try{await ev.validate(e,E,r,n,s,i),o++}catch(e){a.push(e)}if(1===o)return n;throw new eP(e0.path(e),0==o?"The value does not satisfy any schema":"The value satisfy more than one schema",a)}constructor(){}}var eL={};t(eL,"TypeValidator",()=>eZ);var eU={};t(eU,"ArrayValidator",()=>eC);class eC{static async validate(e,t,r,n,a,s){if(N(n))throw new eP(e0.path(e),"Expected an array but found null");if(!Array.isArray(n))throw new eP(e0.path(e),n.toString()+" is not an Array");return eC.checkMinMaxItems(e,t,n),await eC.checkItems(e,t,r,n,a,s),eC.checkUniqueItems(e,t,n),await eC.checkContains(t,e,r,n),n}static async checkContains(e,t,r,n){if(N(e.getContains()))return;let a=await eC.countContains(t,e,r,n,N(e.getMinContains())&&N(e.getMaxContains()));if(0===a)throw new eP(e0.path(t),"None of the items are of type contains schema");if(!N(e.getMinContains())&&e.getMinContains()>a)throw new eP(e0.path(t),"The minimum number of the items of type contains schema should be "+e.getMinContains()+" but found "+a);if(!N(e.getMaxContains())&&e.getMaxContains()<a)throw new eP(e0.path(t),"The maximum number of the items of type contains schema should be "+e.getMaxContains()+" but found "+a)}static async countContains(e,t,r,n,a){let s=0;for(let i=0;i<n.length;i++){let o=e?[...e]:[];try{if(await e0.validate(o,t.getContains(),r,n[i]),s++,a)break}catch(e){}}return s}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()&&new Set(r).size!==r.length)throw new eP(e0.path(e),"Items on the array are not unique")}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new eP(e0.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new eP(e0.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static async checkItems(e,t,r,n,a,s){if(!t.getItems())return;let i=t.getItems();if(i.getSingleSchema())for(let t=0;t<n.length;t++){let o=e?[...e]:[];n[t]=await e0.validate(o,i.getSingleSchema(),r,n[t],a,s)}if(i.getTupleSchema()){if(i.getTupleSchema().length!==n.length&&N(t?.getAdditionalItems()))throw new eP(e0.path(e),"Expected an array with only "+i.getTupleSchema().length+" but found "+n.length);await this.checkItemsInTupleSchema(e,r,n,i),await this.checkAdditionalItems(e,t,r,n,i)}}static async checkItemsInTupleSchema(e,t,r,n,a,s){for(let i=0;i<n.getTupleSchema()?.length;i++){let o=e?[...e]:[];r[i]=await e0.validate(o,n.getTupleSchema()[i],t,r[i],a,s)}}static async checkAdditionalItems(e,t,r,n,a){if(!N(t.getAdditionalItems())){let s=t.getAdditionalItems();if(s?.getBooleanValue()){let i=Y.ofAny("item");if(s?.getBooleanValue()===!1&&n.length>a.getTupleSchema()?.length)throw new eP(e0.path(e),"No Additional Items are defined");await this.checkEachItemInAdditionalItems(e,t,r,n,a,i)}else if(s?.getSchemaValue()){let i=s.getSchemaValue();await this.checkEachItemInAdditionalItems(e,t,r,n,a,i)}}}static async checkEachItemInAdditionalItems(e,t,r,n,a,s){for(let t=a.getTupleSchema()?.length;t<n.length;t++){let a=e?[...e]:[];n[t]=await e0.validate(a,s,r,n[t])}}constructor(){}}var eV={};t(eV,"BooleanValidator",()=>eD);class eD{static validate(e,t,r){if(N(r))throw new eP(e0.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new eP(e0.path(e),r.toString()+" is not a boolean");return r}constructor(){}}var eb={};t(eb,"NullValidator",()=>eG);class eG{static validate(e,t,r){if(N(r))return r;throw new eP(e0.path(e),"Expected a null but found "+r)}constructor(){}}var eF={};t(eF,"NumberValidator",()=>eY);class eY{static validate(e,t,r,n){if(N(n))throw new eP(e0.path(t),"Expected a number but found null");if("number"!=typeof n)throw new eP(e0.path(t),n.toString()+" is not a "+e);let a=eY.extractNumber(e,t,r,n);return eY.checkRange(t,r,n,a),eY.checkMultipleOf(t,r,n,a),n}static extractNumber(e,t,r,n){let a=n;try{(e==E.LONG||e==E.INTEGER)&&(a=Math.round(a))}catch(r){throw new eP(e0.path(t),n+" is not a number of type "+e,r)}if(N(a)||(e==E.LONG||e==E.INTEGER)&&a!=n)throw new eP(e0.path(t),n.toString()+" is not a number of type "+e);return a}static checkMultipleOf(e,t,r,n){if(t.getMultipleOf()&&n%t.getMultipleOf()!=0)throw new eP(e0.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}static checkRange(e,t,r,n){if(!N(t.getMinimum())&&0>eY.numberCompare(n,t.getMinimum()))throw new eP(e0.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(!N(t.getMaximum())&&eY.numberCompare(n,t.getMaximum())>0)throw new eP(e0.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(!N(t.getExclusiveMinimum())&&0>=eY.numberCompare(n,t.getExclusiveMinimum()))throw new eP(e0.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(!N(t.getExclusiveMaximum())&&eY.numberCompare(n,t.getExclusiveMaximum())>0)throw new eP(e0.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}var eB={};t(eB,"ObjectValidator",()=>eH);class eH{static async validate(e,t,r,n,a,s){if(N(n))throw new eP(e0.path(e),"Expected an object but found null");if("object"!=typeof n||Array.isArray(n))throw new eP(e0.path(e),n.toString()+" is not an Object");let i=new Set(Object.keys(n));return eH.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&await eH.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&eH.checkRequired(e,t,n),t.getProperties()&&await eH.checkProperties(e,t,r,n,i,a,s),t.getPatternProperties()&&await eH.checkPatternProperties(e,t,r,n,i),t.getAdditionalProperties()&&await eH.checkAdditionalProperties(e,t,r,n,i),n}static async checkPropertyNameSchema(e,t,r,n){for(let a of Array.from(n.values()))try{await e0.validate(e,t.getPropertyNames(),r,a)}catch(t){throw new eP(e0.path(e),"Property name '"+a+"' does not fit the property schema")}}static checkRequired(e,t,r){for(let n of t.getRequired()??[])if(N(r[n]))throw new eP(e0.path(e),n+" is mandatory")}static async checkAdditionalProperties(e,t,r,n,a){let s=t.getAdditionalProperties();if(s.getSchemaValue())for(let t of Array.from(a.values())){let a=e?[...e]:[];n[t]=await e0.validate(a,s.getSchemaValue(),r,n[t])}else if(!1===s.getBooleanValue()&&a.size)throw new eP(e0.path(e),Array.from(a)+" is/are additional properties which are not allowed.")}static async checkPatternProperties(e,t,r,n,a){let s=new Map;for(let e of Array.from(t.getPatternProperties().keys()))s.set(e,new RegExp(e));for(let i of Array.from(a.values())){let o=e?[...e]:[];for(let e of Array.from(s.entries()))if(e[1].test(i)){n[i]=await e0.validate(o,t.getPatternProperties().get(e[0]),r,n[i]),a.delete(i);break}}}static async checkProperties(e,t,r,n,a,s,i){for(let o of Array.from(t.getProperties())){let t=n[o[0]];if(!n.hasOwnProperty(o[0])&&N(t)&&N(await ey.getDefaultValue(o[1],r)))continue;let E=e?[...e]:[];n[o[0]]=await e0.validate(E,o[1],r,t,s,i),a.delete(o[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new eP(e0.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new eP(e0.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}var ek={};t(ek,"StringValidator",()=>ej);var e$={};t(e$,"StringFormat",()=>l),(a=l||(l={})).DATETIME="DATETIME",a.TIME="TIME",a.DATE="DATE",a.EMAIL="EMAIL",a.REGEX="REGEX";class ej{static TIME=/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/;static DATE=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])$/;static 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 EMAIL=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;static validate(e,t,r){if(N(r))throw new eP(e0.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new eP(e0.path(e),r.toString()+" is not String");t.getFormat()==l.TIME?ej.patternMatcher(e,t,r,ej.TIME,"time pattern"):t.getFormat()==l.DATE?ej.patternMatcher(e,t,r,ej.DATE,"date pattern"):t.getFormat()==l.DATETIME?ej.patternMatcher(e,t,r,ej.DATETIME,"date time pattern"):t.getFormat()==l.EMAIL?ej.patternMatcher(e,t,r,ej.EMAIL,"email pattern"):t.getPattern()&&ej.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let n=r.length;if(t.getMinLength()&&n<t.getMinLength())throw new eP(e0.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&n>t.getMaxLength())throw new eP(e0.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,n,a){if(!n.test(r))throw new eP(e0.path(e),r.toString()+" is not matched with the "+a)}constructor(){}}(s=A||(A={})).STRICT="STRICT",s.LENIENT="LENIENT",s.USE_DEFAULT="USE_DEFAULT",s.SKIP="SKIP";class eW extends Error{schemaPath;source;mode;cause;constructor(e,t,r,n,a=[],s){super(r+(a?a.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.source=t??null,this.mode=n??null,this.cause=s}getSchemaPath(){return this.schemaPath}getSource(){return this.source??null}getMode(){return this.mode??null}getCause(){return this.cause}}class eX{static handleUnConvertibleValue(e,t,r,n){return this.handleUnConvertibleValueWithDefault(e,t,r,null,n)}static handleUnConvertibleValueWithDefault(e,t,r,n,a){switch(null===t&&(t=A.STRICT),t){case A.STRICT:throw new eW(e0.path(e),r,a,t);case A.LENIENT:return null;case A.USE_DEFAULT:return n;case A.SKIP:return r;default:throw new eW(e0.path(e),r,"Invalid conversion mode")}}constructor(){}}class eJ{static convert(e,t,r,n){if(N(n))return eX.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Expected a string but found null");let a=n??("object"==typeof n?JSON.stringify(n):String(n));return this.getConvertedString(a,r)}static getConvertedString(e,t){return t===A.STRICT?e.toString():e.trim()}static getDefault(e){return e.getDefaultValue()??null}constructor(){}}class eq{static convert(e,t,r,n,a){if(N(a))return eX.handleUnConvertibleValueWithDefault(e,n,a,this.getDefault(r),"Expected a number but found null");if("object"==typeof a||"boolean"==typeof a||Array.isArray(a)||"string"==typeof a&&isNaN(a=Number(a)))return eX.handleUnConvertibleValueWithDefault(e,n,a,this.getDefault(r),a+" is not a "+t);let s=this.extractNumber(t,a,n);return null===s?eX.handleUnConvertibleValueWithDefault(e,n,a,this.getDefault(r),a+" is not a "+t):s}static extractNumber(e,t,r){if("number"!=typeof t)return null;switch(e){case E.INTEGER:return this.isInteger(t,r)?Math.floor(t):null;case E.LONG:return this.isLong(t,r)?Math.floor(t):null;case E.DOUBLE:return t;case E.FLOAT:return this.isFloat(t,r)?t:null;default:return null}}static isInteger(e,t){return t!==A.STRICT?"number"==typeof e:Number.isInteger(e)}static isLong(e,t){return t!==A.STRICT?"number"==typeof e:Number.isInteger(e)&&e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER}static isFloat(e,t){return t!==A.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 BOOLEAN_MAP={true:!0,t:!0,yes:!0,y:!0,1:!0,false:!1,f:!1,no:!1,n:!1,0:!1};static convert(e,t,r,n){return null==n?eX.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Expected a boolean but found null"):this.getBooleanPrimitive(n)??eX.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Unable to convert to boolean")}static getBooleanPrimitive(e){return"boolean"==typeof e?e:"string"==typeof e?this.handleStringValue(e):"number"==typeof e?this.handleNumberValue(e):null}static handleStringValue(e){let t=e.toLowerCase().trim();return ez.BOOLEAN_MAP[t]??null}static handleNumberValue(e){return 0===e||1===e?1===e:null}static getDefault(e){return e.getDefaultValue()??!1}constructor(){}}class eK{static convert(e,t,r,n){return N(n)?n:"string"==typeof n&&"null"===n.toLowerCase()?null:eX.handleUnConvertibleValueWithDefault(e,r,n,null,"Unable to convert to null")}constructor(){}}class eQ{static handleValidationError(e,t,r,n,a){switch(t=t??A.STRICT){case A.STRICT:throw new eP(e0.path(e),a);case A.LENIENT:return null;case A.USE_DEFAULT:return n;case A.SKIP:return r}}constructor(){}}class eZ{static async validate(e,t,r,n,a,s,i){return t==E.OBJECT?await eH.validate(e,r,n,a,s,i):t==E.ARRAY?await eC.validate(e,r,n,a,s,i):this.handleTypeValidationAndConversion(e,t,r,a,s,i)}static async handleTypeValidationAndConversion(e,t,r,n,a,s){let i=a?this.convertElement(e,t,r,n,s??A.STRICT):n;return await this.validateElement(e,t,r,i,s??A.STRICT)}static convertElement(e,t,r,n,a){if(N(t))return eX.handleUnConvertibleValueWithDefault(e,a,n,r.getDefaultValue()??null,ep.format("$ is not a valid type for conversion.",t));switch(t){case E.STRING:return eJ.convert(e,r,a,n);case E.INTEGER:case E.LONG:case E.DOUBLE:case E.FLOAT:return eq.convert(e,t,r,a,n);case E.BOOLEAN:return ez.convert(e,r,a,n);case E.NULL:return eK.convert(e,r,a,n);default:return eX.handleUnConvertibleValueWithDefault(e,a,n,r.getDefaultValue()??null,ep.format("$ is not a valid type for conversion.",t))}}static validateElement(e,t,r,n,a){if(N(t))return eQ.handleValidationError(e,a,n,r.getDefaultValue()??null,ep.format("$ is not a valid type.",t));switch(t){case E.STRING:return ej.validate(e,r,n);case E.INTEGER:case E.LONG:case E.DOUBLE:case E.FLOAT:return eY.validate(t,e,r,n);case E.BOOLEAN:return eD.validate(e,r,n);case E.NULL:return eG.validate(e,r,n);default:return eQ.handleValidationError(e,a,n,r.getDefaultValue()??null,ep.format("$ is not a valid type.",t))}}constructor(){}}class e0{static ORDER={[E.OBJECT]:0,[E.ARRAY]:1,[E.DOUBLE]:2,[E.FLOAT]:3,[E.LONG]:4,[E.INTEGER]:5,[E.STRING]:6,[E.BOOLEAN]:7,[E.NULL]:8};static path(e){return e?e.map(e=>e.getTitle()??"").filter(e=>!!e).reduce((e,t,r)=>e+(0===r?"":".")+t,""):""}static async validate(e,t,r,n,a,s){if(!t)throw new eP(e0.path(e),"No schema found to validate");if(e||(e=[]),e.push(t),N(n)&&!N(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(!N(t.getConstant()))return e0.constantValidation(e,t,n);if(t.getEnums()&&!t.getEnums()?.length)return e0.enumCheck(e,t,n);if(t.getFormat()&&N(t.getType()))throw new eP(this.path(e),"Type is missing in schema for declared "+t.getFormat()?.toString()+" format.");if(!0===a&&N(t.getType()))throw new eP(this.path(e),"Type is missing in schema for declared "+s);if(t.getType()&&(n=await e0.typeValidation(e,t,r,n,a,s)),!e_.isNullOrBlank(t.getRef()))return await e0.validate(e,await ey.getSchemaFromRef(e[0],r,t.getRef()),r,n,a,s);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&(n=await ev.validate(e,t,r,n,a,s)),t.getNot()){let i;try{await e0.validate(e,t.getNot(),r,n,a,s),i=!0}catch(e){i=!1}if(i)throw new eP(e0.path(e),"Schema validated value in not condition.")}return n}static constantValidation(e,t,r){if(!ef(t.getConstant(),r))throw new eP(e0.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let n=!1;for(let e of t.getEnums()??[])if(e===r){n=!0;break}if(n)return r;throw new eP(e0.path(e),"Value is not one of "+t.getEnums())}static async typeValidation(e,t,r,n,a,s){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 eZ.validate(e,E,t,r,n,a,s)}catch(e){o.push(e)}throw new eP(e0.path(e),"Value "+JSON.stringify(n)+" is not of valid type(s)",o)}constructor(){}}class e1{async validateArguments(e,t,r){let n=new Map;for(let a of Array.from(this.getSignature().getParameters().entries())){let s=a[1];try{let r=await this.validateArgument(e,t,a,s);n.set(r.getT1(),r.getT2())}catch(t){let e=this.getSignature();throw new eo(`Error while executing the function ${e.getNamespace()}.${e.getName()}'s parameter ${s.getParameterName()} with step name '${r?.getStatement().getStatementName()??"Unknown Step"}' with error : ${t?.message}`)}}return n}async validateArgument(e,t,r,n){let a,s=r[0],i=e.get(r[0]);if(N(i)&&!n.isVariableArgument())return new ew(s,await e0.validate(void 0,n.getSchema(),t,void 0));if(!n?.isVariableArgument())return new ew(s,await e0.validate(void 0,n.getSchema(),t,i));Array.isArray(i)?a=i:(a=[],N(i)?N(n.getSchema().getDefaultValue())||a.push(n.getSchema().getDefaultValue()):a.push(i));for(let e=0;e<a.length;e++)a[e]=await e0.validate(void 0,n.getSchema(),t,a[e]);return new ew(s,a)}async execute(e){let t=await this.validateArguments(e.getArguments()??new Map,e.getSchemaRepository(),e.getStatementExecution());e.setArguments(t);try{return this.internalExecute(e)}catch(r){let t=this.getSignature();throw new eo(`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 e2 extends e1{static EVENT_INDEX_NAME="index";static EVENT_RESULT_NAME="result";static EVENT_INDEX=new en(en.OUTPUT,Z.of(e2.EVENT_INDEX_NAME,Y.ofInteger(e2.EVENT_INDEX_NAME)));static EVENT_RESULT_INTEGER=new en(en.OUTPUT,Z.of(e2.EVENT_RESULT_NAME,Y.ofInteger(e2.EVENT_RESULT_NAME)));static EVENT_RESULT_BOOLEAN=new en(en.OUTPUT,Z.of(e2.EVENT_RESULT_NAME,Y.ofBoolean(e2.EVENT_RESULT_NAME)));static EVENT_RESULT_ARRAY=new en(en.OUTPUT,Z.of(e2.EVENT_RESULT_NAME,Y.ofArray(e2.EVENT_RESULT_NAME,Y.ofAny(e2.EVENT_RESULT_NAME))));static EVENT_RESULT_EMPTY=new en(en.OUTPUT,Z.of());static EVENT_RESULT_ANY=new en(en.OUTPUT,Z.of(this.EVENT_RESULT_NAME,Y.ofAny(this.EVENT_RESULT_NAME)));static EVENT_RESULT_OBJECT=new en(en.OUTPUT,Z.of(this.EVENT_RESULT_NAME,Y.ofObject(this.EVENT_RESULT_NAME)));static PARAMETER_INT_LENGTH=W.of("length",Y.ofInteger("length").setDefaultValue(-1));static PARAMETER_ARRAY_FIND=W.of("find",Y.ofArray("eachFind",Y.ofAny("eachFind")));static PARAMETER_INT_SOURCE_FROM=W.of("srcFrom",Y.ofInteger("srcFrom").setDefaultValue(0).setMinimum(0));static PARAMETER_INT_SECOND_SOURCE_FROM=W.of("secondSrcFrom",Y.ofInteger("secondSrcFrom").setDefaultValue(0));static PARAMETER_INT_FIND_FROM=W.of("findFrom",Y.ofInteger("findFrom").setDefaultValue(0));static PARAMETER_INT_OFFSET=W.of("offset",Y.ofInteger("offset").setDefaultValue(0));static PARAMETER_ROTATE_LENGTH=W.of("rotateLength",Y.ofInteger("rotateLength").setDefaultValue(1).setMinimum(1));static PARAMETER_BOOLEAN_ASCENDING=W.of("ascending",Y.ofBoolean("ascending").setDefaultValue(!0));static PARAMETER_KEY_PATH=W.of("keyPath",Y.ofString("keyPath").setDefaultValue(""));static PARAMETER_FIND_PRIMITIVE=W.of("findPrimitive",Y.of("findPrimitive",E.STRING,E.DOUBLE,E.FLOAT,E.INTEGER,E.LONG));static PARAMETER_ARRAY_SOURCE=W.of("source",Y.ofArray("eachSource",Y.ofAny("eachSource")));static PARAMETER_ARRAY_SECOND_SOURCE=W.of("secondSource",Y.ofArray("eachSecondSource",Y.ofAny("eachSecondSource")));static PARAMETER_ARRAY_SOURCE_PRIMITIVE=W.of("source",Y.ofArray("eachSource",new Y().setName("eachSource").setType(x.of(E.STRING,E.NULL,E.INTEGER,E.FLOAT,E.DOUBLE,E.LONG))));static PARAMETER_BOOLEAN_DEEP_COPY=W.of("deepCopy",Y.ofBoolean("deepCopy").setDefaultValue(!0));static PARAMETER_ANY=W.of("element",Y.ofAny("element"));static PARAMETER_ANY_NOT_NULL=W.of("elementObject",Y.ofAnyNotNull("elementObject"));static PARAMETER_ANY_VAR_ARGS=W.of("element",Y.ofAny("element")).setVariableArgument(!0);static PARAMETER_ARRAY_RESULT=W.of(e2.EVENT_RESULT_NAME,Y.ofArray("eachResult",Y.ofAny("eachResult")));signature;constructor(e,t,r){super();let n=new Map;for(let e of t)n.set(e.getParameterName(),e);this.signature=new el(e).setNamespace(R.SYSTEM_ARRAY).setParameters(n).setEvents(Z.of(r.getName(),r))}getSignature(){return this.signature}}class e9 extends e2{constructor(){super("Concatenate",[e2.PARAMETER_ARRAY_SOURCE,e2.PARAMETER_ARRAY_SECOND_SOURCE],e2.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e2.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e2.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName());return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,[...t,...r]]]))])}}class e4 extends e2{constructor(){super("AddFirst",[e2.PARAMETER_ARRAY_SOURCE,e2.PARAMETER_ANY],e2.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e2.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e2.PARAMETER_ANY.getParameterName());if(0==(t=[...t]).length)return t.push(r),new eE([ea.outputOf(new Map([]))]);t.push(r);let n=t.length-1;for(;n>0;){let e=t[n-1];t[n-1]=t[n],t[n--]=e}return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}const e3="keyName";class e6 extends e2{constructor(){super("ArrayToArrayOfObjects",[e2.PARAMETER_ARRAY_SOURCE,W.of(e3,Y.ofString(e3),!0)],e2.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e6.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e3);if(!t?.length)return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,[]]]))]);let n=t.map(e=>{let t={};if(Array.isArray(e)){if(r.length)r.forEach((r,n)=>{t[r]=e[n]});else for(let r=0;r<e.length;r++)t[`value${r+1}`]=e[r]}else t[r.length?r[0]:"value"]=e;return t});return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,n]]))])}}var e5={};t(e5,"PrimitiveUtil",()=>te);var e7={};t(e7,"ExecutionException",()=>e8);class e8 extends Error{cause;constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class te{static findPrimitiveNullAsBoolean(e){if(N(e))return new ew(E.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new e8(ep.format("$ is not a primitive type",e));return"boolean"===t?new ew(E.BOOLEAN,e):"string"===t?new ew(E.STRING,e):te.findPrimitiveNumberType(e)}static findPrimitive(e){if(N(e))return new ew(E.NULL,void 0);let t=typeof e;if("object"===t)throw new e8(ep.format("$ is not a primitive type",e));return"boolean"===t?new ew(E.BOOLEAN,e):"string"===t?new ew(E.STRING,e):te.findPrimitiveNumberType(e)}static findPrimitiveNumberType(e){if(N(e)||Array.isArray(e)||"object"==typeof e)throw new e8(ep.format("Unable to convert $ to a number.",e));try{if(Number.isInteger(e))return new ew(E.LONG,e);return new ew(E.DOUBLE,e)}catch(t){throw new e8(ep.format("Unable to convert $ to a number.",e),t)}}static compare(e,t){if(e==t)return 0;if(N(e)||N(t))return N(e)?-1:1;if(Array.isArray(e)||Array.isArray(t)){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!=t.length)return e.length-t.length;for(let r=0;r<e.length;r++){let n=this.compare(e[r],t[r]);if(0!=n)return n}return 0}return Array.isArray(e)?-1:1}let r=typeof e,n=typeof t;return"object"===r||"object"===n?("object"===r&&"object"===n&&Object.keys(e).forEach(r=>{let n=this.compare(e[r],t[r]);if(0!=n)return n}),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return N(e)||N(t)?N(e)&&N(t)?0:N(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)?E.LONG:E.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class tt extends e2{constructor(){super("BinarySearch",[tt.PARAMETER_ARRAY_SOURCE_PRIMITIVE,tt.PARAMETER_INT_SOURCE_FROM,tt.PARAMETER_FIND_PRIMITIVE,tt.PARAMETER_INT_LENGTH],tt.EVENT_INDEX)}async internalExecute(e){let t=e?.getArguments()?.get(tt.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tt.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tt.PARAMETER_FIND_PRIMITIVE.getParameterName()),a=e?.getArguments()?.get(tt.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length||r<0||r>t.length)throw new eo("Search source array cannot be empty");if(-1==a&&(a=t.length-r),(a=r+a)>t.length)throw new eo("End point for array cannot be more than the size of the source array");let s=-1;for(;r<=a;){let e=Math.floor((r+a)/2);if(0==te.compare(t[e],n)){s=e;break}te.compare(t[e],n)>0?a=e-1:r=e+1}return new eE([ea.outputOf(new Map([[tt.EVENT_INDEX_NAME,s]]))])}}var tr={};t(tr,"ArrayUtil",()=>tn);class tn{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 ta extends e2{constructor(){super("Compare",tn.of(ta.PARAMETER_ARRAY_SOURCE,ta.PARAMETER_INT_SOURCE_FROM,ta.PARAMETER_ARRAY_FIND,ta.PARAMETER_INT_FIND_FROM,ta.PARAMETER_INT_LENGTH),ta.EVENT_RESULT_INTEGER)}async internalExecute(e){var t=e?.getArguments()?.get(ta.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ta.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(ta.PARAMETER_ARRAY_FIND.getParameterName()),a=e?.getArguments()?.get(ta.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(ta.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new eo("Compare source array cannot be empty");if(0==n.length)throw new eo("Compare find array cannot be empty");if(-1==s&&(s=t.length-r),r+s>t.length)throw new eo(ep.format("Source array size $ is less than comparing size $",t.length,r+s));if(a+s>n.length)throw new eo(ep.format("Find array size $ is less than comparing size $",n.length,a+s));return new eE(tn.of(ea.outputOf(Z.of(ta.EVENT_RESULT_NAME,this.compare(t,r,r+s,n,a,a+s)))))}compare(e,t,r,n,a,s){if(r<t){let e=t;t=r,r=e}if(s<a){let e=a;a=s,s=e}if(r-t!=s-a)throw new eo(ep.format("Cannot compare uneven arrays from $ to $ in source array with $ to $ in find array",r,t,s,a));for(let s=t,i=a;s<r;s++,i++){let t=1;if(N(e[s])||N(n[i])){let r=N(e[s]);r==N(n[i])?t=0:r&&(t=-1)}else{let r=typeof e[s],a=typeof n[i];if("object"===r||"object"===a)t=1;else if("string"===r||"string"===a){let r=""+e[s],a=""+n[i];r===a?t=0:r<a&&(t=-1)}else"boolean"===r||"boolean"===a?t=r==a?0:1:"number"===r&&"number"===a&&(t=e[s]-n[i])}if(0!=t)return t}return 0}}var ts={};function ti(e){return e?globalThis.structuredClone?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e)):e}t(ts,"duplicate",()=>ti);class to extends e2{constructor(){super("Copy",[to.PARAMETER_ARRAY_SOURCE,to.PARAMETER_INT_SOURCE_FROM,to.PARAMETER_INT_LENGTH,to.PARAMETER_BOOLEAN_DEEP_COPY],to.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(to.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(to.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(to.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new eo(ep.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));var a=e?.getArguments()?.get(to.PARAMETER_BOOLEAN_DEEP_COPY.getParameterName());let s=Array(n);for(let e=r;e<r+n;e++)N(t[e])||(s[e-r]=a?ti(t[e]):t[e]);return new eE([ea.outputOf(Z.of(to.EVENT_RESULT_NAME,s))])}}class tE extends e2{constructor(){super("Delete",[e2.PARAMETER_ARRAY_SOURCE,e2.PARAMETER_ANY_VAR_ARGS],e2.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tE.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tE.PARAMETER_ANY_VAR_ARGS.getParameterName());if(null==r)throw new eo("The deletable var args are empty. So cannot be proceeded further.");if(0==t.length||0==r.length)throw new eo("Expected a source or deletable for an array but not found any");let n=new Set;for(let e=t.length-1;e>=0;e--)for(let a=0;a<r.length;a++)n.has(e)||0!=te.compare(t[e],r[a])||n.add(t[e]);return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t.filter(e=>!n.has(e))]]))])}}class tu extends e2{constructor(){super("DeleteFirst",[tu.PARAMETER_ARRAY_SOURCE],tu.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tu.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new eo("Given source array is empty");return(t=[...t]).shift(),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}class tl extends e2{constructor(){super("DeleteFrom",[tl.PARAMETER_ARRAY_SOURCE,tl.PARAMETER_INT_SOURCE_FROM,tl.PARAMETER_INT_LENGTH],tl.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tl.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tl.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tl.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new eo("There are no elements to be deleted");if(r>=(t=[...t]).length||r<0)throw new eo("The int source for the array should be in between 0 and length of the array ");if(-1==n&&(n=t.length-r),r+n>t.length)throw new eo("Requested length to be deleted is more than the size of array ");return t.splice(r,n),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}class tA extends e2{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 eo("Given source array is empty");return(t=[...t]).pop(),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}class tg extends e2{constructor(){super("Disjoint",[tg.PARAMETER_ARRAY_SOURCE,tg.PARAMETER_INT_SOURCE_FROM,tg.PARAMETER_ARRAY_SECOND_SOURCE,tg.PARAMETER_INT_SECOND_SOURCE_FROM,tg.PARAMETER_INT_LENGTH],tg.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tg.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),a=e?.getArguments()?.get(tg.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tg.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length<=n.length?t.length-r:n.length-a),s>t.length||s>n.length||r+s>t.length||a+s>n.length)throw new eo("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<s;e++)i.add(t[e+r]);for(let e=0;e<s;e++)o.add(n[e+a]);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 eE([ea.outputOf(new Map([[tg.EVENT_RESULT_NAME,[...E]]]))])}}class tc extends e2{constructor(){super("Equals",[tc.PARAMETER_ARRAY_SOURCE,tc.PARAMETER_INT_SOURCE_FROM,tc.PARAMETER_ARRAY_FIND,tc.PARAMETER_INT_FIND_FROM,tc.PARAMETER_INT_LENGTH],tc.EVENT_RESULT_BOOLEAN)}async internalExecute(e){let t=new ta,r=(await t.execute(e)).allResults()[0].getResult().get(tc.EVENT_RESULT_NAME);return new eE([ea.outputOf(Z.of(tc.EVENT_RESULT_NAME,0==r))])}}class tm extends e2{constructor(){super("Fill",[tm.PARAMETER_ARRAY_SOURCE,tm.PARAMETER_INT_SOURCE_FROM,tm.PARAMETER_INT_LENGTH,tm.PARAMETER_ANY],tm.EVENT_RESULT_EMPTY)}async internalExecute(e){var t=e?.getArguments()?.get(tm.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tm.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tm.PARAMETER_INT_LENGTH.getParameterName()),a=e?.getArguments()?.get(tm.PARAMETER_ANY.getParameterName());if(r<0)throw new eo(ep.format("Arrays out of bound trying to access $ index",r));-1==n&&(n=t.length-r);let s=r+n-t.length;if(t=[...t],s>0)for(let e=0;e<s;e++)t.push();for(let e=r;e<r+n;e++)t[e]=N(a)?a:ti(a);return new eE([ea.outputOf(Z.of(e2.EVENT_RESULT_NAME,t))])}}class tT extends e2{FunctionOutput;constructor(){super("Frequency",[tT.PARAMETER_ARRAY_SOURCE,tT.PARAMETER_ANY,tT.PARAMETER_INT_SOURCE_FROM,tT.PARAMETER_INT_LENGTH],tT.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tT.PARAMETER_ANY.getParameterName()),n=e?.getArguments()?.get(tT.PARAMETER_INT_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tT.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[tT.EVENT_RESULT_NAME,0]]))]);if(n>t.length)throw new eo("Given start point is more than the size of source");let s=n+a;if(-1==a&&(s=t.length-n),s>t.length)throw new eo("Given length is more than the size of source");let i=0;for(let e=n;e<s&&e<t.length;e++)0==te.compare(t[e],r)&&i++;return new eE([ea.outputOf(new Map([[tT.EVENT_RESULT_NAME,i]]))])}}class tp extends e2{constructor(){super("IndexOf",[tp.PARAMETER_ARRAY_SOURCE,tp.PARAMETER_ANY_NOT_NULL,tp.PARAMETER_INT_FIND_FROM],tp.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tp.PARAMETER_ANY_NOT_NULL.getParameterName());let n=e?.getArguments()?.get(tp.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[tp.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new eo("The size of the search index of the array is greater than the size of the array");let a=-1;for(let e=n;e<t.length;e++)if(0==te.compare(t[e],r)){a=e;break}return new eE([ea.outputOf(new Map([[tp.EVENT_RESULT_NAME,a]]))])}}class tR extends e2{constructor(){super("IndexOfArray",[tR.PARAMETER_ARRAY_SOURCE,tR.PARAMETER_ARRAY_SECOND_SOURCE,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_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tR.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length||0==r.length)return new eE([ea.outputOf(new Map([[tR.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||t.length<r.length)throw new eo("Given from second source is more than the size of the source array");let a=r.length,s=-1;for(let e=n;e<t.length;e++){let n=0;if(0==te.compare(t[e],r[n])){for(;n<a&&0==te.compare(t[e+n],r[n]);)n++;if(n==a){s=e;break}}}return new eE([ea.outputOf(new Map([[tR.EVENT_RESULT_NAME,s]]))])}}class th extends e2{constructor(){super("LastIndexOf",[th.PARAMETER_ARRAY_SOURCE,th.PARAMETER_ANY_NOT_NULL,th.PARAMETER_INT_FIND_FROM],th.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(th.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(th.PARAMETER_ANY_NOT_NULL.getParameterName());let n=e?.getArguments()?.get(th.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[th.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new eo("The value of length shouldn't the exceed the size of the array or shouldn't be in terms");let a=-1;for(let e=t.length-1;e>=n;e--)if(0==te.compare(t[e],r)){a=e;break}return new eE([ea.outputOf(new Map([[th.EVENT_RESULT_NAME,a]]))])}}class tf extends e2{constructor(){super("LastIndexOfArray",[tf.PARAMETER_ARRAY_SOURCE,tf.PARAMETER_ARRAY_SECOND_SOURCE,tf.PARAMETER_INT_FIND_FROM],tf.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tf.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[tf.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||r.length>t.length)throw new eo("Given from index is more than the size of the source array");let a=r.length,s=-1;for(let e=n;e<t.length;e++){let n=0;if(0==te.compare(t[e],r[n])){for(;n<a&&0==te.compare(t[e+n],r[n]);)n++;n==a&&(s=e)}}return new eE([ea.outputOf(new Map([[tf.EVENT_RESULT_NAME,s]]))])}}class tN extends e2{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 eo("Search source array cannot be empty");let r=t[0];for(let e=1;e<t.length;e++){let n=t[e];te.comparePrimitive(r,n)>=0||(r=n)}return new eE([ea.outputOf(new Map([[tN.EVENT_RESULT_NAME,r]]))])}}class t_ extends e2{constructor(){super("Min",[t_.PARAMETER_ARRAY_SOURCE_PRIMITIVE],t_.EVENT_RESULT_ANY)}async internalExecute(e){let t,r=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==r.length)throw new eo("Search source array cannot be empty");for(let e=0;e<r.length;e++)!N(r[e])&&(void 0===t||0>te.comparePrimitive(r[e],t))&&(t=r[e]);return new eE([ea.outputOf(new Map([[t_.EVENT_RESULT_NAME,t]]))])}}class tS extends e2{constructor(){super("MisMatch",[tS.PARAMETER_ARRAY_SOURCE,tS.PARAMETER_INT_FIND_FROM,tS.PARAMETER_ARRAY_SECOND_SOURCE,tS.PARAMETER_INT_SECOND_SOURCE_FROM,tS.PARAMETER_INT_LENGTH],tS.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tS.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tS.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tS.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),a=e?.getArguments()?.get(tS.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tS.PARAMETER_INT_LENGTH.getParameterName()),i=r<t.length&&r>0?r:0,o=a<n.length&&a>0?a:0;if(i+s>=t.length||o+s>n.length)throw new eo("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<s;e++)if(t[i+e]!=n[o+e]){E=e;break}return new eE([ea.outputOf(new Map([[tS.EVENT_RESULT_NAME,E]]))])}}class tM extends e2{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()),n=e?.getArguments()?.get(tM.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n>=t.length||n<0||r<0)throw new eo("Please provide start point between the start and end indexes or provide the length which was less than the source size ");t=[...t];let a=r+n-1;for(;r<=a;){let e=t[r],n=t[a];t[r++]=n,t[a--]=e}return new eE([ea.outputOf(new Map([[tM.EVENT_RESULT_NAME,t]]))])}}class tw extends e2{constructor(){super("Rotate",[tw.PARAMETER_ARRAY_SOURCE,tw.PARAMETER_ROTATE_LENGTH],tw.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tw.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tw.PARAMETER_ROTATE_LENGTH.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))]);let n=(t=[...t]).length;return r%=n,this.rotate(t,0,r-1),this.rotate(t,r,n-1),this.rotate(t,0,n-1),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}rotate(e,t,r){for(;t<r;){let n=e[t];e[t++]=e[r],e[r--]=n}}}class tO extends e2{constructor(){super("Shuffle",[tO.PARAMETER_ARRAY_SOURCE],tO.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tO.PARAMETER_ARRAY_SOURCE.getParameterName());if(t.length<=1)return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))]);let r=0,n=(t=[...t]).length;for(let e=0;e<n;e++){let e=Math.floor(Math.random()*n)%n,a=t[r];t[r]=t[e],t[e]=a,r=e}return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}var td={};t(td,"ObjectValueSetterExtractor",()=>tB);var tI={};t(tI,"Expression",()=>tG);var tP={};t(tP,"StringBuilder",()=>ty);class ty{str;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 eo(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var tx={};t(tx,"ExpressionEvaluationException",()=>tv);class tv extends Error{cause;constructor(e,t,r){super(ep.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var tL={};t(tL,"ExpressionToken",()=>tU);class tU{expression;constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var tC={};t(tC,"ExpressionTokenValue",()=>tV);class tV extends tU{element;constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return ep.format("$: $",this.expression,this.element)}}var tD={};t(tD,"Operation",()=>tb);class tb{static MULTIPLICATION=new tb("*");static DIVISION=new tb("/");static INTEGER_DIVISION=new tb("//");static MOD=new tb("%");static ADDITION=new tb("+");static SUBTRACTION=new tb("-");static NOT=new tb("not",void 0,!0);static AND=new tb("and",void 0,!0);static OR=new tb("or",void 0,!0);static LESS_THAN=new tb("<");static LESS_THAN_EQUAL=new tb("<=");static GREATER_THAN=new tb(">");static GREATER_THAN_EQUAL=new tb(">=");static EQUAL=new tb("=");static NOT_EQUAL=new tb("!=");static BITWISE_AND=new tb("&");static BITWISE_OR=new tb("|");static BITWISE_XOR=new tb("^");static BITWISE_COMPLEMENT=new tb("~");static BITWISE_LEFT_SHIFT=new tb("<<");static BITWISE_RIGHT_SHIFT=new tb(">>");static BITWISE_UNSIGNED_RIGHT_SHIFT=new tb(">>>");static UNARY_PLUS=new tb("UN: +","+");static UNARY_MINUS=new tb("UN: -","-");static UNARY_LOGICAL_NOT=new tb("UN: not","not");static UNARY_BITWISE_COMPLEMENT=new tb("UN: ~","~");static ARRAY_OPERATOR=new tb("[");static OBJECT_OPERATOR=new tb(".");static NULLISH_COALESCING_OPERATOR=new tb("??");static CONDITIONAL_TERNARY_OPERATOR=new tb("?");static 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 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 ARITHMETIC_OPERATORS=new Set([tb.MULTIPLICATION,tb.DIVISION,tb.INTEGER_DIVISION,tb.MOD,tb.ADDITION,tb.SUBTRACTION]);static 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 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 CONDITIONAL_OPERATORS=new Set([tb.CONDITIONAL_TERNARY_OPERATOR]);static 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 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 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 OPERATION_VALUE_OF=new Map(Array.from(tb.VALUE_OF.entries()).map(([e,t])=>[t.getOperator(),t]));static 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 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);operator;operatorName;_shouldBeWrappedInSpace;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 tG extends tU{tokens=new eR;ops=new eR;constructor(e,t,r,n){super(e||""),t&&this.tokens.push(t),r&&this.tokens.push(r),n&&this.ops.push(n),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){let e;let t=this.expression.length,r="",n=new ty(""),a=0,s=!1;for(;a<t;){switch(r=this.expression[a],e=n.toString(),r){case" ":s=this.processTokenSepearator(n,e,s);break;case"(":a=this.processSubExpression(t,n,e,a,s),s=!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,a);a=e.getT1(),s=e.getT2();break}case"?":if(a+1<t&&"?"!=this.expression.charAt(a+1)&&0!=a&&"?"!=this.expression.charAt(a-1))a=this.processTernaryOperator(t,n,e,a,s);else{let i=this.processOthers(r,t,n,e,a,s);a=i.getT1(),(s=i.getT2())&&this.ops.peek()==tb.ARRAY_OPERATOR&&(a=(i=this.process(t,n,a)).getT1(),s=i.getT2())}break;default:let i=this.processOthers(r,t,n,e,a,s);a=i.getT1(),(s=i.getT2())&&this.ops.peek()==tb.ARRAY_OPERATOR&&(a=(i=this.process(t,n,a)).getT1(),s=i.getT2())}++a}if(e=n.toString(),!e_.isNullOrBlank(e)){if(tb.OPERATORS.has(e))throw new tv(this.expression,"Expression is ending with an operator");this.tokens.push(new tU(e))}}processStringLiteral(e,t,r){let n="",a=r+1;for(;a<e;a++){let e=this.expression.charAt(a);if(e==t&&"\\"!=this.expression.charAt(a-1))break;n+=e}if(a==e&&this.expression.charAt(a-1)!=t)throw new tv(this.expression,"Missing string ending marker "+t);let s=new ew(a,!1);return this.tokens.push(new tV(n,n)),s}process(e,t,r){let n=1;for(++r;r<e&&0!=n;){let e=this.expression.charAt(r);"]"==e?--n:"["==e&&++n,0!=n&&(t.append(e),r++)}return this.tokens.push(new tG(t.toString())),t.setLength(0),new ew(r,!1)}processOthers(e,t,r,n,a,s){let i=t-a;i=i<tb.BIGGEST_OPERATOR_SIZE?i:tb.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(a,a+e);if(tb.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return e_.isNullOrBlank(n)||(this.tokens.push(new tU(n)),s=!1),this.checkUnaryOperator(this.tokens,this.ops,tb.OPERATION_VALUE_OF.get(t),s),s=!0,r.setLength(0),new ew(a+e-1,s)}return r.append(e),new ew(a,!1)}processTernaryOperator(e,t,r,n,a){if(a)throw new tv(this.expression,"Ternary operator is followed by an operator");""!=r.trim()&&(this.tokens.push(new tG(r)),t.setLength(0));let s=1,i="",o=++n;for(;n<e&&s>0;)"?"==(i=this.expression.charAt(n))?++s:":"==i&&--s,++n;if(":"!=i)throw new tv(this.expression,"':' operater is missing");if(n>=e)throw new tv(this.expression,"Third part of the ternary expression is missing");for(;!this.ops.isEmpty()&&this.hasPrecedence(tb.CONDITIONAL_TERNARY_OPERATOR,this.ops.peek());){let e=this.ops.pop();if(tb.UNARY_OPERATORS.has(e)){let t=this.tokens.pop();this.tokens.push(new tG("",t,void 0,e))}else{let t=this.tokens.pop(),r=this.tokens.pop();this.tokens.push(new tG("",r,t,e))}}this.ops.push(tb.CONDITIONAL_TERNARY_OPERATOR),this.tokens.push(new tG(this.expression.substring(o,n-1)));let E=this.expression.substring(n);if(""===E.trim())throw new tv(this.expression,"Third part of the ternary expression is missing");return this.tokens.push(new tG(E)),e-1}processSubExpression(e,t,r,n,a){if(tb.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,tb.OPERATION_VALUE_OF.get(r),a),t.setLength(0);else if(!e_.isNullOrBlank(r))throw new tv(this.expression,ep.format("Unkown token : $ found.",r));let s=1,i=new ty,o=this.expression.charAt(n);for(n++;n<e&&s>0;)"("==(o=this.expression.charAt(n))?s++:")"==o&&s--,0!=s&&(i.append(o),n++);if(")"!=o)throw new tv(this.expression,"Missing a closed parenthesis");for(;i.length()>2&&"("==i.charAt(0)&&")"==i.charAt(i.length()-1);)i.deleteCharAt(0),i.setLength(i.length()-1);return this.tokens.push(new tG(i.toString().trim())),n}processTokenSepearator(e,t,r){return e_.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 tU(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,n){if(r){if(n||e.isEmpty()){if(tb.UNARY_OPERATORS.has(r)){let e=tb.UNARY_MAP.get(r);e&&t.push(e)}else throw new tv(this.expression,ep.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 tG("",t,void 0,r))}else{let t=e.pop(),n=e.pop();e.push(new tG("",n,t,r))}}t.push(r)}}}hasPrecedence(e,t){let r=tb.OPERATOR_PRIORITY.get(e),n=tb.OPERATOR_PRIORITY.get(t);if(!r||!n)throw Error("Unknown operators provided");return n<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new ty,t=0,r=this.ops.toArray(),n=this.tokens.toArray();for(let a=0;a<r.length;a++)if(r[a].getOperator().startsWith("UN: "))e.append("(").append(r[a].getOperator().substring(4)).append(n[t]instanceof tG?n[t].toString():n[t]).append(")"),t++;else if(r[a]==tb.CONDITIONAL_TERNARY_OPERATOR){let r=n[t++];e.insert(0,r.toString()),e.insert(0,":"),r=n[t++],e.insert(0,r.toString()),e.insert(0,"?"),r=n[t++],e.insert(0,r.toString()).append(")"),e.insert(0,"(")}else{if(0==t){let r=n[t++];e.insert(0,r.toString())}let s=n[t++];e.insert(0,r[a].getOperator()).insert(0,s.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var tF={};t(tF,"TokenValueExtractor",()=>tY);class tY{static REGEX_SQUARE_BRACKETS=/[\[\]]/;static REGEX_DOT=/\./;getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new eo(ep.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(!N(r?.__index))return r.__index;if(!t.endsWith("]"))return t.substring(t.lastIndexOf(".")+1);{let e=t.substring(t.lastIndexOf("[")+1,t.length-1),r=parseInt(e);return isNaN(r)?e:r}}return this.getValueInternal(e)}retrieveElementFrom(e,t,r,n){if(N(n))return;if(t.length==r)return n;let a=t[r].split(tY.REGEX_SQUARE_BRACKETS).map(e=>e.trim()).filter(e=>!e_.isNullOrBlank(e)).reduce((n,a)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,a,n),n);return this.retrieveElementFrom(e,t,r+1,a)}resolveForEachPartOfTokenWithBrackets(e,t,r,n,a){if(!N(a))return"length"===n?this.getLength(e,a):Array.isArray(a)?this.handleArrayAccess(e,n,a):this.handleObjectAccess(e,t,r,n,a)}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,ep.format("Length can't be found in token $",e))}handleArrayAccess(e,t,r){let n=parseInt(t);if(isNaN(n))throw new tv(e,ep.format("$ is not a number",t));if(n<0||n>=r.length)throw new tv(e,ep.format("Index $ is out of bounds for array of length $",n,r.length));return r[n]}handleObjectAccess(e,t,r,n,a){if(n.startsWith('"')){if(!n.endsWith('"')||1==n.length||2==n.length)throw new tv(e,ep.format("$ is missing a double quote or empty key found",e));n=n.substring(1,t.length-2)}return this.checkIfObject(e,t,r,a),a[n]}checkIfObject(e,t,r,n){if("object"!=typeof n||Array.isArray(n))throw new tv(e,ep.format("Unable to retrieve $ from $ in the path $",t[r],n.toString(),e))}}class tB extends tY{store;prefix;constructor(e,t){super(),this.store=e,this.prefix=t}getValueInternal(e){let t=e.split(tY.REGEX_DOT);return this.retrieveElementFrom(e,t,1,this.store)}getStore(){return this.store}setStore(e){return this.store=e,this}setValue(e,t,r=!0,n=!1){this.store=ti(this.store),this.modifyStore(e,t,r,n)}modifyStore(e,t,r,n){let a=new tG(e),s=a.getTokens();s.removeLast();let i=a.getOperations(),o=i.removeLast(),E=s.removeLast(),u=E instanceof tV?E.getElement():E.getExpression(),l=this.store;for(;!i.isEmpty();)l=o==tb.OBJECT_OPERATOR?this.getDataFromObject(l,u,i.peekLast()):this.getDataFromArray(l,u,i.peekLast()),o=i.removeLast(),u=(E=s.removeLast())instanceof tV?E.getElement():E.getExpression();o==tb.OBJECT_OPERATOR?this.putDataInObject(l,u,t,r,n):this.putDataInArray(l,u,t,r,n)}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eo(ep.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eo(ep.format("Expected an array index but found $",t));if(n<0)throw new eo(ep.format("Array index is out of bound - $",t));let a=e[n];return N(a)&&(a=r==tb.OBJECT_OPERATOR?{}:[],e[n]=a),a}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eo(ep.format("Expected an object but found $",e));let n=e[t];return N(n)&&(n=r==tb.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r,n,a){if(!Array.isArray(e))throw new eo(ep.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new eo(ep.format("Expected an array index but found $",t));if(s<0)throw new eo(ep.format("Array index is out of bound - $",t));(n||N(e[s]))&&(a&&N(r)?e.splice(s,1):e[s]=r)}putDataInObject(e,t,r,n,a){if(Array.isArray(e)||"object"!=typeof e)throw new eo(ep.format("Expected an object but found $",e));(n||N(e[t]))&&(a&&N(r)?delete e[t]:e[t]=r)}getPrefix(){return this.prefix}}class tH extends e2{constructor(){super("Sort",[tH.PARAMETER_ARRAY_SOURCE,tH.PARAMETER_INT_FIND_FROM,tH.PARAMETER_INT_LENGTH,tH.PARAMETER_BOOLEAN_ASCENDING,tH.PARAMETER_KEY_PATH],tH.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tH.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tH.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tH.PARAMETER_INT_LENGTH.getParameterName()),a=e?.getArguments()?.get(tH.PARAMETER_BOOLEAN_ASCENDING.getParameterName()),s=e?.getArguments()?.get(tH.PARAMETER_KEY_PATH.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))]);if(t=[...t],-1==n&&(n=t.length-r),r<0||r>=t.length||r+n>t.length)throw new eo("Given start point is more than the size of the array or not available at that point");let i=t.slice(r,r+n+1),o=new tB({},"Data.");return i.sort((e,t)=>"object"==typeof e&&"object"==typeof t&&s.length?(o.setStore({a:e,b:t}),tk(o.getValue("Data.a."+s),o.getValue("Data.b."+s),a)):tk(e,t,a)),t.splice(r,n,...i),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}function tk(e,t,r){return e===t?0:null===e?1:null===t?-1:r?e<t?-1:1:e<t?1:-1}class t$ extends e2{constructor(){super("SubArray",[t$.PARAMETER_ARRAY_SOURCE,t$.PARAMETER_INT_FIND_FROM,t$.PARAMETER_INT_LENGTH],t$.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(t$.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t$.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(t$.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n<=0)return new eE([ea.outputOf(new Map([]))]);if(!(r>=0&&r<t.length)||r+n>t.length)throw new eo("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 a=t.slice(r,r+n);return new eE([ea.outputOf(new Map([[t$.EVENT_RESULT_NAME,a]]))])}}class tj extends e2{constructor(){super("Insert",[tj.PARAMETER_ARRAY_SOURCE,tj.PARAMETER_INT_OFFSET,tj.PARAMETER_ANY],tj.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tj.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tj.PARAMETER_INT_OFFSET.getParameterName());var n=e?.getArguments()?.get(tj.PARAMETER_ANY.getParameterName());if(N(n)||N(r)||r>t.length)throw new eo("Please valid resouces to insert at the correct location");if(0==(t=[...t]).length)return 0==r&&t.push(n),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))]);t.push(n);let a=t.length-1;for(r++;a>=r;){let e=t[a-1];t[a-1]=t[a],t[a--]=e}return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}class tW extends e2{constructor(){super("InsertLast",[tW.PARAMETER_ARRAY_SOURCE,tW.PARAMETER_ANY],tW.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tW.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tW.PARAMETER_ANY.getParameterName());return(t=[...t]).push(r),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}class tX extends e2{constructor(){super("RemoveDuplicates",[tX.PARAMETER_ARRAY_SOURCE,tX.PARAMETER_INT_SOURCE_FROM,tX.PARAMETER_INT_LENGTH],tX.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tX.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tX.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tX.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new eo(ep.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));let a=[...t],s=r+n;for(let e=s-1;e>=r;e--)for(let t=e-1;t>=r;t--)if(ef(a[e],a[t])){a.splice(e,1);break}return new eE([ea.outputOf(Z.of(tX.EVENT_RESULT_NAME,a))])}}const tJ="keyPath",tq="valuePath",tz="ignoreNullValues",tK="ignoreNullKeys",tQ="ignoreDuplicateKeys";class tZ extends e2{constructor(){super("ArrayToObjects",[e2.PARAMETER_ARRAY_SOURCE,W.of(tJ,Y.ofString(tJ)),W.of(tq,Y.of(tq,E.STRING,E.NULL)),W.of(tz,Y.ofBoolean(tz).setDefaultValue(!1)),W.of(tK,Y.ofBoolean(tK).setDefaultValue(!0)),W.of(tQ,Y.ofBoolean(tQ).setDefaultValue(!1))],e2.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(e2.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tJ),n=e?.getArguments()?.get(tq)??"",a=e?.getArguments()?.get(tz),s=e?.getArguments()?.get(tK),i=e?.getArguments()?.get(tQ),o=new tB({},"Data."),E=t.filter(e=>!N(e)).reduce((e,t)=>{o.setStore(t);let E=o.getValue("Data."+r);if(s&&N(E))return e;let u=n?o.getValue("Data."+n):t;return a&&N(u)||i&&e.hasOwnProperty(E)||(e[E]=u),e},{});return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,E]]))])}}const t0="source",t1="delimiter",t2="result",t9=new el("Join").setNamespace(R.SYSTEM_ARRAY).setParameters(new Map([[t0,new W(t0,Y.ofArray(t0,Y.of("each",E.STRING,E.INTEGER,E.LONG,E.DOUBLE,E.FLOAT,E.NULL)))],[t1,new W(t1,Y.ofString(t1).setDefaultValue(""))]])).setEvents(new Map([en.outputEventMapEntry(new Map([[t2,Y.ofString(t2)]]))]));class t4 extends e1{getSignature(){return t9}async internalExecute(e){let t=e?.getArguments()?.get(t0),r=e?.getArguments()?.get(t1);return new eE([ea.outputOf(new Map([[t2,t.join(r)]]))])}}class t3{static repoMap=Z.ofArrayEntries(K(new e9),K(new e4),K(new tt),K(new ta),K(new to),K(new tE),K(new tu),K(new tl),K(new tA),K(new tg),K(new tc),K(new tm),K(new tT),K(new tp),K(new tR),K(new th),K(new tf),K(new tN),K(new t_),K(new tS),K(new tM),K(new tw),K(new tO),K(new tH),K(new t$),K(new e6),K(new tj),K(new tW),K(new tX),K(new tZ),K(new t4));static filterableNames=Array.from(t3.repoMap.values()).map(e=>e.getSignature().getFullName());async find(e,t){return e!=R.SYSTEM_ARRAY?Promise.resolve(void 0):Promise.resolve(t3.repoMap.get(t))}async filter(e){return Promise.resolve(t3.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var t6={};t(t6,"ContextElement",()=>t5);class t5{static NULL=new t5(Y.NULL,void 0);schema;element;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 t7="name",t8="schema",re=new el("Create").setNamespace(R.SYSTEM_CTX).setParameters(new Map([W.ofEntry(t7,new Y().setName(t7).setType(x.of(E.STRING)).setMinLength(1).setFormat(l.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,u.CONSTANT),W.ofEntry(t8,Y.SCHEMA,!1,u.CONSTANT)])).setEvents(new Map([en.outputEventMapEntry(new Map)])),rt="name",rr="value",rn=new el("Get").setNamespace(R.SYSTEM_CTX).setParameters(new Map([W.ofEntry(rt,new Y().setName(rt).setType(x.of(E.STRING)).setMinLength(1).setFormat(l.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,u.CONSTANT)])).setEvents(new Map([en.outputEventMapEntry(new Map([[rr,Y.ofAny(rr)]]))]));var ra={};t(ra,"ExpressionEvaluator",()=>no);var rs={};t(rs,"LogicalNullishCoalescingOperator",()=>rE);var ri={};t(ri,"BinaryOperator",()=>ro);class ro{nullCheck(e,t,r){if(N(e)||N(t))throw new e8(ep.format("$ cannot be applied to a null value",r.getOperatorName()))}}class rE extends ro{apply(e,t){return N(e)?t:e}}var ru={};t(ru,"ArithmeticAdditionOperator",()=>rl);class rl extends ro{apply(e,t){return N(e)?t:N(t)?e:e+t}}var rA={};t(rA,"ArithmeticDivisionOperator",()=>rg);class rg extends ro{apply(e,t){return this.nullCheck(e,t,tb.DIVISION),e/t}}var rc={};t(rc,"ArithmeticIntegerDivisionOperator",()=>rm);class rm extends ro{apply(e,t){return this.nullCheck(e,t,tb.DIVISION),Math.floor(e/t)}}var rT={};t(rT,"ArithmeticModulusOperator",()=>rp);class rp extends ro{apply(e,t){return this.nullCheck(e,t,tb.MOD),e%t}}var rR={};t(rR,"ArithmeticMultiplicationOperator",()=>rh);class rh extends ro{apply(e,t){this.nullCheck(e,t,tb.MULTIPLICATION);let r="string"==typeof e,n=typeof t;if(r||"string"===n){let n=r?e:t,a=r?t:e,s="",i=a<0,o=Math.floor(a=Math.abs(a));for(;o-- >0;)s+=n;let E=Math.floor(n.length*(a-Math.floor(a)));if(E<0&&(E=-E),0!=E&&(s+=n.substring(0,E)),i){let e="";for(let t=s.length-1;t>=0;t--)e+=s[t];return e}return s}return e*t}}var rf={};t(rf,"ArithmeticSubtractionOperator",()=>rN);class rN extends ro{apply(e,t){return this.nullCheck(e,t,tb.SUBTRACTION),e-t}}var r_={};t(r_,"ArrayOperator",()=>rS);class rS extends ro{apply(e,t){if(!e)throw new e8("Cannot apply array operator on a null value");if(!t)throw new e8("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new e8(ep.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new e8(ep.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var rM={};t(rM,"BitwiseAndOperator",()=>rw);class rw extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_AND),e&t}}var rO={};t(rO,"BitwiseLeftShiftOperator",()=>rd);class rd extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_LEFT_SHIFT),e<<t}}var rI={};t(rI,"BitwiseOrOperator",()=>rP);class rP extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_OR),e|t}}var ry={};t(ry,"BitwiseRightShiftOperator",()=>rx);class rx extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_RIGHT_SHIFT),e>>t}}var rv={};t(rv,"BitwiseUnsignedRightShiftOperator",()=>rL);class rL extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var rU={};t(rU,"BitwiseXorOperator",()=>rC);class rC extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_XOR),e^t}}var rV={};t(rV,"LogicalAndOperator",()=>rD);class rD extends ro{apply(e,t){return!!e&&""!==e&&!!t&&""!==t}}var rb={};t(rb,"LogicalEqualOperator",()=>rG);class rG extends ro{apply(e,t){return ef(e,t)}}var rF={};t(rF,"LogicalGreaterThanEqualOperator",()=>rY);class rY extends ro{apply(e,t){let r=te.findPrimitiveNullAsBoolean(e),n=te.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||n.getT1()==E.BOOLEAN)throw new e8(ep.format("Cannot compare >= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>=n.getT2()}}var rB={};t(rB,"LogicalGreaterThanOperator",()=>rH);class rH extends ro{apply(e,t){let r=te.findPrimitiveNullAsBoolean(e),n=te.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||n.getT1()==E.BOOLEAN)throw new e8(ep.format("Cannot compare > with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>n.getT2()}}var rk={};t(rk,"LogicalLessThanEqualOperator",()=>r$);class r$ extends ro{apply(e,t){let r=te.findPrimitiveNullAsBoolean(e),n=te.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||n.getT1()==E.BOOLEAN)throw new e8(ep.format("Cannot compare <= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<=n.getT2()}}var rj={};t(rj,"LogicalLessThanOperator",()=>rW);class rW extends ro{apply(e,t){let r=te.findPrimitiveNullAsBoolean(e),n=te.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||n.getT1()==E.BOOLEAN)throw new e8(ep.format("Cannot compare < with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<n.getT2()}}var rX={};t(rX,"LogicalNotEqualOperator",()=>rJ);class rJ extends ro{apply(e,t){return!ef(e,t)}}var rq={};t(rq,"LogicalOrOperator",()=>rz);class rz extends ro{apply(e,t){return!!e&&""!==e||!!t&&""!==t}}var rK={};t(rK,"ObjectOperator",()=>rQ);class rQ extends ro{apply(e,t){if(!e)throw new e8("Cannot apply array operator on a null value");if(!t)throw new e8("Cannot retrive null property value");let r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new e8(ep.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var rZ={};t(rZ,"ArithmeticUnaryMinusOperator",()=>r2);var r0={};t(r0,"UnaryOperator",()=>r1);class r1{nullCheck(e,t){if(N(e))throw new e8(ep.format("$ cannot be applied to a null value",t.getOperatorName()))}}class r2 extends r1{apply(e){return this.nullCheck(e,tb.UNARY_MINUS),te.findPrimitiveNumberType(e),-e}}var r9={};t(r9,"ArithmeticUnaryPlusOperator",()=>r4);class r4 extends r1{apply(e){return this.nullCheck(e,tb.UNARY_PLUS),te.findPrimitiveNumberType(e),e}}var r3={};t(r3,"BitwiseComplementOperator",()=>r6);class r6 extends r1{apply(e){this.nullCheck(e,tb.UNARY_BITWISE_COMPLEMENT);let t=te.findPrimitiveNumberType(e);if(t.getT1()!=E.INTEGER&&t.getT1()!=E.LONG)throw new e8(ep.format("Unable to apply bitwise operator on $",e));return~e}}var r5={};t(r5,"LogicalNotOperator",()=>r7);class r7 extends r1{apply(e){return!e&&""!==e}}var r8={};t(r8,"LiteralTokenValueExtractor",()=>nt);const ne=new Map([["true",!0],["false",!1],["null",void 0],["undefined",void 0]]);class nt extends tY{static INSTANCE=new nt;getValueInternal(e){if(!e_.isNullOrBlank(e))return(e=e.trim(),ne.has(e))?ne.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,ep.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new tv(e,ep.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 nr={},nn={};t(nn,"ConditionalTernaryOperator",()=>ns);class na{nullCheck(e,t,r,n){if(N(e)||N(t)||N(r))throw new e8(ep.format("$ cannot be applied to a null value",n.getOperatorName()))}}class ns extends na{apply(e,t,r){return e?t:r}}e(nr,nn);class ni extends tY{static PREFIX="_internal.";values=new Map;addValue(e,t){this.values.set(e,t)}getValueInternal(e){let t=e.split(tY.REGEX_DOT),r=t[1],n=r.indexOf("["),a=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),a=1),this.retrieveElementFrom(e,t,a,this.values.get(r))}getPrefix(){return ni.PREFIX}getStore(){}}class no{static UNARY_OPERATORS_MAP=new Map([[tb.UNARY_BITWISE_COMPLEMENT,new r6],[tb.UNARY_LOGICAL_NOT,new r7],[tb.UNARY_MINUS,new r2],[tb.UNARY_PLUS,new r4]]);static TERNARY_OPERATORS_MAP=new Map([[tb.CONDITIONAL_TERNARY_OPERATOR,new ns]]);static BINARY_OPERATORS_MAP=new Map([[tb.ADDITION,new rl],[tb.DIVISION,new rg],[tb.INTEGER_DIVISION,new rm],[tb.MOD,new rp],[tb.MULTIPLICATION,new rh],[tb.SUBTRACTION,new rN],[tb.BITWISE_AND,new rw],[tb.BITWISE_LEFT_SHIFT,new rd],[tb.BITWISE_OR,new rP],[tb.BITWISE_RIGHT_SHIFT,new rx],[tb.BITWISE_UNSIGNED_RIGHT_SHIFT,new rL],[tb.BITWISE_XOR,new rC],[tb.AND,new rD],[tb.EQUAL,new rG],[tb.GREATER_THAN,new rH],[tb.GREATER_THAN_EQUAL,new rY],[tb.LESS_THAN,new rW],[tb.LESS_THAN_EQUAL,new r$],[tb.OR,new rz],[tb.NOT_EQUAL,new rJ],[tb.NULLISH_COALESCING_OPERATOR,new rE],[tb.ARRAY_OPERATOR,new rS],[tb.OBJECT_OPERATOR,new rQ]]);static UNARY_OPERATORS_MAP_KEY_SET=new Set(no.UNARY_OPERATORS_MAP.keys());expression;exp;internalTokenValueExtractor=new ni;constructor(e){e instanceof tG?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){let t=this.processNestingExpression(this.expression,e);return this.expression=t.getT1(),this.exp=t.getT2(),(e=new Map(e.entries())).set(this.internalTokenValueExtractor.getPrefix(),this.internalTokenValueExtractor),this.evaluateExpression(this.exp,e)}processNestingExpression(e,t){let r=0,n=0,a=new eR;for(;n<e.length-1;){if("{"==e.charAt(n)&&"{"==e.charAt(n+1))0==r&&a.push(new ew(n+2,-1)),r++,n++;else if("}"==e.charAt(n)&&"}"==e.charAt(n+1)){if(--r<0)throw new tv(e,"Expecting {{ nesting path operator to be started before closing");0==r&&a.push(a.pop().setT2(n)),n++}n++}let s=this.replaceNestingExpression(e,t,a);return new ew(s,new tG(s))}replaceNestingExpression(e,t,r){let n=e;for(let a of r.toArray()){if(-1==a.getT2())throw new tv(e,"Expecting }} nesting path operator to be closed");let r=new no(n.substring(a.getT1(),a.getT2())).evaluate(t);n=n.substring(0,a.getT1()-2)+r+n.substring(a.getT2()+2)}return n}getExpression(){return this.exp||(this.exp=new tG(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),n=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),a=n.pop();if(no.UNARY_OPERATORS_MAP_KEY_SET.has(e))n.push(this.applyUnaryOperation(e,this.getValueFromToken(t,a)));else if(e==tb.OBJECT_OPERATOR||e==tb.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,n,e,a);else if(e==tb.CONDITIONAL_TERNARY_OPERATOR){let r=n.pop(),s=n.pop(),i=this.getValueFromToken(t,s),o=this.getValueFromToken(t,r),E=this.getValueFromToken(t,a);n.push(this.applyTernaryOperation(e,i,o,E))}else{let r=n.pop(),s=this.getValueFromToken(t,r),i=this.getValueFromToken(t,a);n.push(this.applyBinaryOperation(e,s,i))}}if(n.isEmpty())throw new e8(ep.format("Expression : $ evaluated to null",e));if(1!=n.size())throw new e8(ep.format("Expression : $ evaluated multiple values $",e,n));let a=n.get(0);if(a instanceof tV)return a.getElement();if(!(a instanceof tG))return this.getValueFromToken(t,a);throw new e8(ep.format("Expression : $ evaluated to $",e,n.get(0)))}processObjectOrArrayOperator(e,t,r,n,a){let s=new eR,i=new eR;if(!n||!a)return;do i.push(n),a instanceof tG?s.push(new tV(a.toString(),this.evaluateExpression(a,e))):a&&s.push(a),a=r.isEmpty()?void 0:r.pop(),n=t.isEmpty()?void 0:t.pop();while(n==tb.OBJECT_OPERATOR||n==tb.ARRAY_OPERATOR)a&&(a instanceof tG?s.push(new tV(a.toString(),this.evaluateExpression(a,e))):s.push(a)),n&&t.push(n);let o=s.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 tU(ni.PREFIX+e)}let E=new ty(o instanceof tV?o.getTokenValue():o.toString());for(;!s.isEmpty();)o=s.pop(),n=i.pop(),E.append(n.getOperator()).append(o instanceof tV?o.getTokenValue():o.toString()),n==tb.ARRAY_OPERATOR&&E.append("]");let u=E.toString(),l=u.substring(0,u.indexOf(".")+1);if(l.length>2&&e.has(l))r.push(new tV(u,this.getValue(u,e)));else{let e;try{e=nt.INSTANCE.getValue(u)}catch(t){e=u}r.push(new tV(u,e))}}applyTernaryOperation(e,t,r,n){let a=no.TERNARY_OPERATORS_MAP.get(e);if(!a)throw new tv(this.expression,ep.format("No operator found to evaluate $",this.getExpression()));return new tV(e.toString(),a.apply(t,r,n))}applyBinaryOperation(e,t,r){let n=typeof t,a=typeof r,s=no.BINARY_OPERATORS_MAP.get(e);if(("object"===n||"object"===a)&&e!==tb.EQUAL&&e!==tb.NOT_EQUAL&&e!==tb.NULLISH_COALESCING_OPERATOR&&e!==tb.AND&&e!==tb.OR)throw new tv(this.expression,ep.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));if(!s)throw new tv(this.expression,ep.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new tV(e.toString(),s.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,ep.format("The operator $ cannot be applied to $",e.getOperator(),t));let n=no.UNARY_OPERATORS_MAP.get(e);if(!n)throw new tv(this.expression,ep.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new tV(e.toString(),n.apply(t))}getValueFromToken(e,t){return t instanceof tG?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):nt.INSTANCE.getValueFromExtractors(e,t)}}const nE="name",nu="value",nl=new el("Set").setNamespace(R.SYSTEM_CTX).setParameters(new Map([W.ofEntry(nE,new Y().setName(nE).setType(x.of(E.STRING)).setMinLength(1),!1),W.ofEntry(nu,Y.ofAny(nu))])).setEvents(new Map([en.outputEventMapEntry(new Map)])),nA="value",ng="eventName",nc="results",nm=new el("GenerateEvent").setNamespace(R.SYSTEM).setParameters(new Map([W.ofEntry(ng,Y.ofString(ng).setDefaultValue("output")),W.ofEntry(nc,Y.ofObject(nc).setProperties(new Map([["name",Y.ofString("name")],[nA,W.EXPRESSION]])),!0)])).setEvents(new Map([en.outputEventMapEntry(new Map)]));class nT extends e1{static CONDITION="condition";static SIGNATURE=new el("If").setNamespace(R.SYSTEM).setParameters(new Map([W.ofEntry(nT.CONDITION,Y.ofAny(nT.CONDITION))])).setEvents(new Map([en.eventMapEntry(en.TRUE,new Map),en.eventMapEntry(en.FALSE,new Map),en.outputEventMapEntry(new Map)]));getSignature(){return nT.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nT.CONDITION);return new eE([ea.of(t||""===t?en.TRUE:en.FALSE,new Map),ea.outputOf(new Map)])}}const np="stepName",nR=new el("Break").setNamespace(R.SYSTEM_LOOP).setParameters(new Map([W.ofEntry(np,Y.of(np,E.STRING))])).setEvents(new Map([en.outputEventMapEntry(new Map([]))])),nh="count",nf="value",nN="index",n_=new el("CountLoop").setNamespace(R.SYSTEM_LOOP).setParameters(new Map([W.ofEntry(nh,Y.of(nh,E.INTEGER))])).setEvents(new Map([en.eventMapEntry(en.ITERATION,new Map([[nN,Y.of(nN,E.INTEGER)]])),en.outputEventMapEntry(new Map([[nf,Y.of(nf,E.INTEGER)]]))])),nS="source",nM="each",nw="index",nO="value",nd=new el("ForEachLoop").setNamespace(R.SYSTEM_LOOP).setParameters(new Map([W.ofEntry(nS,Y.ofArray(nS,Y.ofAny(nS)))])).setEvents(new Map([en.eventMapEntry(en.ITERATION,new Map([[nw,Y.of(nw,E.INTEGER)],[nM,Y.ofAny(nM)]])),en.outputEventMapEntry(new Map([[nO,Y.of(nO,E.INTEGER)]]))])),nI="from",nP="step",ny="value",nx="index",nv=new el("RangeLoop").setNamespace(R.SYSTEM_LOOP).setParameters(new Map([W.ofEntry(nI,Y.of(nI,E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE).setDefaultValue(0)),W.ofEntry("to",Y.of("to",E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE).setDefaultValue(1)),W.ofEntry(nP,Y.of(nP,E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE).setDefaultValue(1).setNot(new Y().setConstant(0)))])).setEvents(new Map([en.eventMapEntry(en.ITERATION,new Map([[nx,Y.of(nx,E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE)]])),en.outputEventMapEntry(new Map([[ny,Y.of(ny,E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE)]]))])),nL="value",nU=new el("Add").setNamespace(R.MATH).setParameters(new Map([[nL,new W(nL,Y.ofNumber(nL)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[nL,Y.ofNumber(nL)]]))])),nC="value",nV="value1",nD="value2",nb=[()=>new Map([[nC,new W(nC,Y.ofNumber(nC))]]),()=>new Map([[nV,new W(nV,Y.ofNumber(nV))],[nD,new W(nD,Y.ofNumber(nD))]])];class nG extends e1{signature;parametersNumber;mathFunction;constructor(e,t,r=1,...n){super(),n&&n.length||(n=[E.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new el(e).setNamespace(R.MATH).setParameters(nb[r-1]()).setEvents(new Map([en.outputEventMapEntry(new Map([[nC,new Y().setType(x.of(...n)).setName(nC)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=te.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?nC:nV)).getT2();return 2==this.parametersNumber&&(t=te.findPrimitiveNumberType(e.getArguments()?.get(nD)).getT2()),new eE([ea.outputOf(new Map([[nC,this.mathFunction.call(this,r,t)]]))])}}const nF="value";class nY extends e1{static SIGNATURE=new el("Hypotenuse").setNamespace(R.MATH).setParameters(new Map([[nF,new W(nF,Y.ofNumber(nF)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[nF,new Y().setType(x.of(E.DOUBLE)).setName(nF)]]))]));constructor(){super()}getSignature(){return nY.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nF);return new eE([ea.outputOf(new Map([[nF,Math.sqrt(t.reduce((e,t)=>e+=t*t,0))]]))])}}const nB="value",nH=new el("Maximum").setNamespace(R.MATH).setParameters(new Map([[nB,new W(nB,Y.ofNumber(nB)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[nB,Y.ofNumber(nB)]]))])),nk="value",n$=new el("Minimum").setNamespace(R.MATH).setParameters(new Map([[nk,new W(nk,Y.ofNumber(nk)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[nk,Y.ofNumber(nk)]]))])),nj="value";class nW extends e1{static SIGNATURE=new el("Random").setNamespace(R.MATH).setEvents(new Map([en.outputEventMapEntry(Z.of(nj,Y.ofDouble(nj)))]));getSignature(){return nW.SIGNATURE}async internalExecute(e){return new eE([ea.outputOf(new Map([[nj,Math.random()]]))])}}class nX extends e1{static MIN_VALUE="minValue";static MAX_VALUE="maxValue";static VALUE="value";static SIGNATURE=new el("RandomFloat").setParameters(Z.of(nX.MIN_VALUE,W.of(nX.MIN_VALUE,Y.ofFloat(nX.MIN_VALUE).setDefaultValue(0)),nX.MAX_VALUE,W.of(nX.MAX_VALUE,Y.ofFloat(nX.MAX_VALUE).setDefaultValue(0x7fffffff)))).setNamespace(R.MATH).setEvents(new Map([en.outputEventMapEntry(Z.of(nX.VALUE,Y.ofFloat(nX.VALUE)))]));getSignature(){return nX.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nX.MIN_VALUE),r=Math.random()*(e.getArguments()?.get(nX.MAX_VALUE)-t)+t;return new eE([ea.outputOf(new Map([[nX.VALUE,r]]))])}}class nJ extends e1{static MIN_VALUE="minValue";static MAX_VALUE="maxValue";static VALUE="value";static SIGNATURE=new el("RandomInt").setParameters(Z.of(nJ.MIN_VALUE,W.of(nJ.MIN_VALUE,Y.ofInteger(nJ.MIN_VALUE).setDefaultValue(0)),nJ.MAX_VALUE,W.of(nJ.MAX_VALUE,Y.ofInteger(nJ.MAX_VALUE).setDefaultValue(0x7fffffff)))).setNamespace(R.MATH).setEvents(new Map([en.outputEventMapEntry(Z.of(nJ.VALUE,Y.ofInteger(nJ.VALUE)))]));getSignature(){return nJ.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nJ.MIN_VALUE),r=Math.floor(Math.random()*(e.getArguments()?.get(nJ.MAX_VALUE)-t)+t);return new eE([ea.outputOf(new Map([[nJ.VALUE,r]]))])}}const nq={Absolute:new nG("Absolute",e=>Math.abs(e),1,E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE),ArcCosine:new nG("ArcCosine",e=>Math.acos(e)),ArcSine:new nG("ArcSine",e=>Math.asin(e)),ArcTangent:new nG("ArcTangent",e=>Math.atan(e)),Ceiling:new nG("Ceiling",e=>Math.ceil(e)),Cosine:new nG("Cosine",e=>Math.cos(e)),HyperbolicCosine:new nG("HyperbolicCosine",e=>Math.cosh(e)),CubeRoot:new nG("CubeRoot",e=>Math.cbrt(e)),Exponential:new nG("Exponential",e=>Math.exp(e)),ExponentialMinus1:new nG("ExponentialMinus1",e=>Math.expm1(e)),Floor:new nG("Floor",e=>Math.floor(e)),LogNatural:new nG("LogNatural",e=>Math.log(e)),Log10:new nG("Log10",e=>Math.log10(e)),Round:new nG("Round",e=>Math.round(e),1,E.INTEGER,E.LONG),Sine:new nG("Sine",e=>Math.sin(e)),HyperbolicSine:new nG("HyperbolicSine",e=>Math.sinh(e)),Tangent:new nG("Tangent",e=>Math.tan(e)),HyperbolicTangent:new nG("HyperbolicTangent",e=>Math.tanh(e)),ToDegrees:new nG("ToDegrees",e=>Math.PI/180*e),ToRadians:new nG("ToRadians",e=>180/Math.PI*e),SquareRoot:new nG("SquareRoot",e=>Math.sqrt(e)),ArcTangent2:new nG("ArcTangent2",(e,t)=>Math.atan2(e,t),2),Power:new nG("Power",(e,t)=>Math.pow(e,t),2),Add:new class extends e1{getSignature(){return nU}async internalExecute(e){let t=e.getArguments()?.get(nL);return new eE([ea.outputOf(new Map([[nL,t.reduce((e,t)=>e+=t,0)]]))])}},Hypotenuse:new nY,Maximum:new class extends e1{getSignature(){return nH}async internalExecute(e){let t=e.getArguments()?.get(nB);return new eE([ea.outputOf(new Map([[nB,t.reduce((e,t)=>!e&&0!==e||t>e?t:e)]]))])}},Minimum:new class extends e1{getSignature(){return n$}async internalExecute(e){let t=e.getArguments()?.get(nk);return new eE([ea.outputOf(new Map([[nk,t.reduce((e,t)=>!e&&0!==e||t<e?t:e)]]))])}},Random:new nW,RandomFloat:new nX,RandomInt:new nJ},nz=Object.values(nq).map(e=>e.getSignature().getFullName());class nK{async find(e,t){return e!=R.MATH?Promise.resolve(void 0):Promise.resolve(nq[t])}async filter(e){return Promise.resolve(nz.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}const nQ="value",nZ="source",n0="source";class n1 extends e1{signature;constructor(e,t){super(),this.signature=new el(e).setNamespace(R.SYSTEM_OBJECT).setParameters(new Map([W.ofEntry(n0,Y.ofAny(n0))])).setEvents(new Map([en.outputEventMapEntry(new Map([["value",t]]))]))}getSignature(){return this.signature}}const n2="value",n9="value",n4="value",n3="source",n6="overwrite",n5="deleteKeyOnNull",n7="value",n8={ObjectValues:new class extends n1{constructor(){super("ObjectValues",Y.ofArray(n7,Y.ofAny(n7)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(N(t))return new eE([ea.outputOf(new Map([[n7,[]]]))]);let r=Object.entries(ti(t)).sort((e,t)=>e[0].localeCompare(t[0])).map(e=>e[1]);return new eE([ea.outputOf(new Map([[n7,r]]))])}},ObjectKeys:new class extends n1{constructor(){super("ObjectKeys",Y.ofArray(n9,Y.ofString(n9)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(N(t))return new eE([ea.outputOf(new Map([[n9,[]]]))]);let r=Object.keys(ti(t)).sort((e,t)=>e.localeCompare(t));return new eE([ea.outputOf(new Map([[n9,r]]))])}},ObjectEntries:new class extends n1{constructor(){super("ObjectEntries",Y.ofArray(n2,Y.ofArray("tuple",Y.ofString("key"),Y.ofAny("value"))))}async internalExecute(e){var t=e.getArguments()?.get("source");if(N(t))return new eE([ea.outputOf(new Map([[n2,[]]]))]);let r=Object.entries(ti(t)).sort((e,t)=>e[0].localeCompare(t[0]));return new eE([ea.outputOf(new Map([[n2,r]]))])}},ObjectDeleteKey:new class extends e1{signature;constructor(){super(),this.signature=new el("ObjectDeleteKey").setNamespace(R.SYSTEM_OBJECT).setParameters(new Map([W.ofEntry(nZ,Y.ofAny(nZ)),W.ofEntry("key",Y.ofString("key"))])).setEvents(new Map([en.outputEventMapEntry(new Map([[nQ,Y.ofAny(nQ)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nZ),r=e.getArguments()?.get("key");return N(t)?new eE([ea.outputOf(new Map([[nQ,void 0]]))]):(t=ti(t),delete t[r],new eE([ea.outputOf(new Map([[nQ,t]]))]))}},ObjectPutValue:new class extends e1{signature;constructor(){super(),this.signature=new el("ObjectPutValue").setNamespace(R.SYSTEM_OBJECT).setParameters(new Map([W.ofEntry(n3,Y.ofObject(n3)),W.ofEntry("key",Y.ofString("key")),W.ofEntry(n4,Y.ofAny(n4)),W.ofEntry(n6,Y.ofBoolean(n6).setDefaultValue(!0)),W.ofEntry(n5,Y.ofBoolean(n5).setDefaultValue(!1))])).setEvents(new Map([en.outputEventMapEntry(new Map([[n4,Y.ofObject(n4)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(n3),r=e.getArguments()?.get("key"),n=e.getArguments()?.get(n4),a=e.getArguments()?.get(n6),s=e.getArguments()?.get(n5),i=new tB(t,"Data.");return i.setValue(r,n,a,s),new eE([ea.outputOf(new Map([[n4,i.getStore()]]))])}}},ae=Object.values(n8).map(e=>e.getSignature().getFullName());class at{async find(e,t){return e!=R.SYSTEM_OBJECT?Promise.resolve(void 0):Promise.resolve(n8[t])}async filter(e){return Promise.resolve(ae.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class ar extends e1{static VALUES="values";static SIGNATURE=new el("Print").setNamespace(R.SYSTEM).setParameters(new Map([W.ofEntry(ar.VALUES,Y.ofAny(ar.VALUES),!0)]));getSignature(){return ar.SIGNATURE}async internalExecute(e){var t=e.getArguments()?.get(ar.VALUES);return console?.log(...t),new eE([ea.outputOf(new Map)])}}class an extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_SEARCH_STRING_NAME="searchString";static PARAMETER_SECOND_STRING_NAME="secondString";static PARAMETER_THIRD_STRING_NAME="thirdString";static PARAMETER_INDEX_NAME="index";static PARAMETER_SECOND_INDEX_NAME="secondIndex";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(an.PARAMETER_STRING_NAME,Y.ofString(an.PARAMETER_STRING_NAME));static PARAMETER_SECOND_STRING=new W(an.PARAMETER_SECOND_STRING_NAME,Y.ofString(an.PARAMETER_SECOND_STRING_NAME));static PARAMETER_THIRD_STRING=new W(an.PARAMETER_THIRD_STRING_NAME,Y.ofString(an.PARAMETER_THIRD_STRING_NAME));static PARAMETER_INDEX=new W(an.PARAMETER_INDEX_NAME,Y.ofInteger(an.PARAMETER_INDEX_NAME));static PARAMETER_SECOND_INDEX=new W(an.PARAMETER_SECOND_INDEX_NAME,Y.ofInteger(an.PARAMETER_SECOND_INDEX_NAME));static PARAMETER_SEARCH_STRING=new W(an.PARAMETER_SEARCH_STRING_NAME,Y.ofString(an.PARAMETER_STRING_NAME));static EVENT_STRING=new en(en.OUTPUT,Z.of(an.EVENT_RESULT_NAME,Y.ofString(an.EVENT_RESULT_NAME)));static EVENT_BOOLEAN=new en(en.OUTPUT,Z.of(an.EVENT_RESULT_NAME,Y.ofBoolean(an.EVENT_RESULT_NAME)));static EVENT_INT=new en(en.OUTPUT,Z.of(an.EVENT_RESULT_NAME,Y.ofInteger(an.EVENT_RESULT_NAME)));static EVENT_ARRAY=new en(en.OUTPUT,Z.of(an.EVENT_RESULT_NAME,Y.ofArray(an.EVENT_RESULT_NAME)));signature;constructor(e,t,r,...n){super();let a=new Map;n.forEach(e=>a.set(e.getParameterName(),e)),this.signature=new el(t).setNamespace(e).setParameters(a).setEvents(Z.of(r.getName(),r))}getSignature(){return this.signature}static ofEntryAsStringBooleanOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_SEARCH_STRING_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n)))])}}(R.STRING,e,an.EVENT_BOOLEAN,an.PARAMETER_STRING,an.PARAMETER_SEARCH_STRING)]}static ofEntryAsStringAndIntegerStringOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_INDEX_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n)))])}}(R.STRING,e,an.EVENT_STRING,an.PARAMETER_STRING,an.PARAMETER_INDEX)]}static ofEntryAsStringIntegerOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_SEARCH_STRING_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n)))])}}(R.STRING,e,an.EVENT_INT,an.PARAMETER_STRING,an.PARAMETER_SEARCH_STRING)]}static ofEntryString(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r)))])}}(R.STRING,e,an.EVENT_STRING,an.PARAMETER_STRING)]}static ofEntryStringBooleanOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r)))])}}(R.STRING,e,an.EVENT_BOOLEAN,an.PARAMETER_STRING)]}static ofEntryAsStringStringIntegerIntegerOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_SEARCH_STRING_NAME),a=e?.getArguments()?.get(an.PARAMETER_INDEX_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n,a)))])}}(R.STRING,e,an.EVENT_INT,an.PARAMETER_STRING,an.PARAMETER_SEARCH_STRING,an.PARAMETER_INDEX)]}static ofEntryAsStringIntegerIntegerStringOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_INDEX_NAME),a=e?.getArguments()?.get(an.PARAMETER_SECOND_INDEX_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n,a)))])}}(R.STRING,e,an.EVENT_INT,an.PARAMETER_STRING,an.PARAMETER_INDEX,an.PARAMETER_SECOND_INDEX)]}static ofEntryAsStringStringStringStringOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_SECOND_STRING_NAME),a=e?.getArguments()?.get(an.PARAMETER_THIRD_STRING_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n,a)))])}}(R.STRING,e,an.EVENT_STRING,an.PARAMETER_STRING,an.PARAMETER_SECOND_STRING,an.PARAMETER_THIRD_STRING)]}}class aa extends e1{static VALUE="value";static SCHEMA=new Y().setName(aa.VALUE).setType(new y(E.STRING));static SIGNATURE=new el("Concatenate").setNamespace(R.STRING).setParameters(new Map([[aa.VALUE,new W(aa.VALUE,aa.SCHEMA).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[aa.VALUE,Y.ofString(aa.VALUE)]]))]));constructor(){super()}getSignature(){return aa.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(aa.VALUE),r="";return t.reduce((e,t)=>r=e+t,r),new eE([ea.outputOf(new Map([[aa.VALUE,r]]))])}}class as extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_AT_START_NAME="startPosition";static PARAMETER_AT_END_NAME="endPosition";static EVENT_RESULT_NAME="result";PARAMETER_STRING=new W(as.PARAMETER_STRING_NAME,Y.ofString(as.PARAMETER_STRING_NAME));PARAMETER_AT_START=new W(as.PARAMETER_AT_START_NAME,Y.ofInteger(as.PARAMETER_AT_START_NAME));PARAMETER_AT_END=new W(as.PARAMETER_AT_END_NAME,Y.ofInteger(as.PARAMETER_AT_END_NAME));EVENT_STRING=new en(en.OUTPUT,new Map([[as.EVENT_RESULT_NAME,Y.ofString(as.EVENT_RESULT_NAME)]]));signature=new el("DeleteForGivenLength").setNamespace(R.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]]));constructor(){super()}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(as.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(as.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(as.PARAMETER_AT_END_NAME);if(n>=r){let e="";return e+=t.substring(0,r)+t.substring(n),new eE([ea.outputOf(new Map([[as.EVENT_RESULT_NAME,e.toString()]]))])}return new eE([ea.outputOf(new Map([[as.EVENT_RESULT_NAME,t]]))])}}class ai extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_AT_POSITION_NAME="position";static PARAMETER_INSERT_STRING_NAME="insertString";EVENT_RESULT_NAME="result";PARAMETER_STRING=new W(ai.PARAMETER_STRING_NAME,Y.ofString(ai.PARAMETER_STRING_NAME));PARAMETER_AT_POSITION=new W(ai.PARAMETER_AT_POSITION_NAME,Y.ofInteger(ai.PARAMETER_AT_POSITION_NAME));PARAMETER_INSERT_STRING=new W(ai.PARAMETER_INSERT_STRING_NAME,Y.ofString(ai.PARAMETER_INSERT_STRING_NAME));EVENT_STRING=new en(en.OUTPUT,new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]));signature=new el("InsertAtGivenPosition").setNamespace(R.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)]]))]));getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(ai.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(ai.PARAMETER_AT_POSITION_NAME),n=e?.getArguments()?.get(ai.PARAMETER_INSERT_STRING_NAME),a="";return a+=t.substring(0,r)+n+t.substring(r),new eE([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,a]]))])}}class ao extends e1{static PARAMETER_REGEX_NAME="regex";static PARAMETER_STRING_NAME="string";static EVENT_RESULT_NAME="result";static signature=new el("Matches").setNamespace(R.STRING).setParameters(Z.ofEntries(Z.entry(...W.ofEntry(ao.PARAMETER_REGEX_NAME,Y.ofString(ao.PARAMETER_REGEX_NAME))),Z.entry(...W.ofEntry(ao.PARAMETER_STRING_NAME,Y.ofString(ao.PARAMETER_STRING_NAME))))).setEvents(Z.ofEntries(Z.entry(...en.outputEventMapEntry(new Map([[ao.EVENT_RESULT_NAME,Y.ofBoolean(ao.EVENT_RESULT_NAME)]])))));getSignature(){return ao.signature}async internalExecute(e){let t=e.getArguments()?.get(ao.PARAMETER_REGEX_NAME),r=e.getArguments()?.get(ao.PARAMETER_STRING_NAME);return new eE([ea.outputOf(new Map([[ao.EVENT_RESULT_NAME,!!r.match(t)?.length]]))])}}class aE extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_POSTPAD_STRING_NAME="postpadString";static PARAMETER_LENGTH_NAME="length";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(aE.PARAMETER_STRING_NAME,Y.ofString(aE.PARAMETER_STRING_NAME));static PARAMETER_POSTPAD_STRING=new W(aE.PARAMETER_POSTPAD_STRING_NAME,Y.ofString(aE.PARAMETER_POSTPAD_STRING_NAME));static PARAMETER_LENGTH=new W(aE.PARAMETER_LENGTH_NAME,Y.ofInteger(aE.PARAMETER_LENGTH_NAME));static EVENT_STRING=new en(en.OUTPUT,new Map([[aE.EVENT_RESULT_NAME,Y.ofString(aE.EVENT_RESULT_NAME)]]));signature=new el("PostPad").setNamespace(R.STRING).setParameters(new Map([[aE.PARAMETER_STRING.getParameterName(),aE.PARAMETER_STRING],[aE.PARAMETER_POSTPAD_STRING.getParameterName(),aE.PARAMETER_POSTPAD_STRING],[aE.PARAMETER_LENGTH.getParameterName(),aE.PARAMETER_LENGTH]])).setEvents(new Map([[aE.EVENT_STRING.getName(),aE.EVENT_STRING]]));constructor(){super()}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(aE.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(aE.PARAMETER_POSTPAD_STRING_NAME),n=e.getArguments()?.get(aE.PARAMETER_LENGTH_NAME),a="",s=r.length;for(a+=t;s<=n;)a+=r,s+=r.length;return a.length-t.length<n&&(a+=r.substring(0,n-(a.length-t.length))),new eE([ea.outputOf(new Map([[aE.EVENT_RESULT_NAME,a.toString()]]))])}}class au extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_PREPAD_STRING_NAME="prepadString";static PARAMETER_LENGTH_NAME="length";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(au.PARAMETER_STRING_NAME,Y.ofString(au.PARAMETER_STRING_NAME));static PARAMETER_PREPAD_STRING=new W(au.PARAMETER_PREPAD_STRING_NAME,Y.ofString(au.PARAMETER_PREPAD_STRING_NAME));static PARAMETER_LENGTH=new W(au.PARAMETER_LENGTH_NAME,Y.ofInteger(au.PARAMETER_LENGTH_NAME));static EVENT_STRING=new en(en.OUTPUT,new Map([[au.EVENT_RESULT_NAME,Y.ofString(au.EVENT_RESULT_NAME)]]));signature=new el("PrePad").setNamespace(R.STRING).setParameters(new Map([[au.PARAMETER_STRING.getParameterName(),au.PARAMETER_STRING],[au.PARAMETER_PREPAD_STRING.getParameterName(),au.PARAMETER_PREPAD_STRING],[au.PARAMETER_LENGTH.getParameterName(),au.PARAMETER_LENGTH]])).setEvents(new Map([[au.EVENT_STRING.getName(),au.EVENT_STRING]]));getSignature(){return this.signature}constructor(){super()}async internalExecute(e){let t=e.getArguments()?.get(au.PARAMETER_STRING_NAME),r=e.getArguments()?.get(au.PARAMETER_PREPAD_STRING_NAME),n=e.getArguments()?.get(au.PARAMETER_LENGTH_NAME),a="",s=r.length;for(;s<=n;)a+=r,s+=r.length;return a.length<n&&(a+=r.substring(0,n-a.length)),a+=t,new eE([ea.outputOf(new Map([[au.EVENT_RESULT_NAME,a]]))])}}class al extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_BOOLEAN_NAME="boolean";static PARAMETER_FIRST_OFFSET_NAME="firstOffset";static PARAMETER_OTHER_STRING_NAME="otherString";static PARAMETER_SECOND_OFFSET_NAME="secondOffset";static PARAMETER_INTEGER_NAME="length";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(al.PARAMETER_STRING_NAME,Y.ofString(al.PARAMETER_STRING_NAME));static PARAMETER_OTHER_STRING=new W(al.PARAMETER_OTHER_STRING_NAME,Y.ofString(al.PARAMETER_OTHER_STRING_NAME));static PARAMETER_FIRST_OFFSET=new W(al.PARAMETER_FIRST_OFFSET_NAME,Y.ofInteger(al.PARAMETER_FIRST_OFFSET_NAME));static PARAMETER_SECOND_OFFSET=new W(al.PARAMETER_SECOND_OFFSET_NAME,Y.ofInteger(al.PARAMETER_SECOND_OFFSET_NAME));static PARAMETER_INTEGER=new W(al.PARAMETER_INTEGER_NAME,Y.ofInteger(al.PARAMETER_INTEGER_NAME));static PARAMETER_BOOLEAN=new W(al.PARAMETER_BOOLEAN_NAME,Y.ofBoolean(al.PARAMETER_BOOLEAN_NAME));static EVENT_BOOLEAN=new en(en.OUTPUT,new Map([[al.EVENT_RESULT_NAME,Y.ofBoolean(al.EVENT_RESULT_NAME)]]));signature=new el("RegionMatches").setNamespace(R.STRING).setParameters(new Map([[al.PARAMETER_STRING.getParameterName(),al.PARAMETER_STRING],[al.PARAMETER_BOOLEAN.getParameterName(),al.PARAMETER_BOOLEAN],[al.PARAMETER_FIRST_OFFSET.getParameterName(),al.PARAMETER_FIRST_OFFSET],[al.PARAMETER_OTHER_STRING.getParameterName(),al.PARAMETER_OTHER_STRING],[al.PARAMETER_SECOND_OFFSET.getParameterName(),al.PARAMETER_SECOND_OFFSET],[al.PARAMETER_INTEGER.getParameterName(),al.PARAMETER_INTEGER]])).setEvents(new Map([[al.EVENT_BOOLEAN.getName(),al.EVENT_BOOLEAN]]));getSignature(){return this.signature}constructor(){super()}async internalExecute(e){let t=e.getArguments()?.get(al.PARAMETER_STRING_NAME),r=e.getArguments()?.get(al.PARAMETER_BOOLEAN_NAME),n=e.getArguments()?.get(al.PARAMETER_FIRST_OFFSET_NAME),a=e?.getArguments()?.get(al.PARAMETER_OTHER_STRING_NAME),s=e?.getArguments()?.get(al.PARAMETER_SECOND_OFFSET_NAME),i=e.getArguments()?.get(al.PARAMETER_INTEGER_NAME),o=!1;return o=!(n<0)&&!(s<0)&&!(n+i>t.length)&&!(s+i>a.length)&&(r?(t=t.substring(n,n+i).toUpperCase())==a.substring(s,s+i).toUpperCase():(t=t.substring(n,n+i))==a.substring(s,i)),new eE([ea.outputOf(new Map([[al.EVENT_RESULT_NAME,o]]))])}}class aA extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_AT_START_NAME="startPosition";static PARAMETER_AT_LENGTH_NAME="lengthPosition";static PARAMETER_REPLACE_STRING_NAME="replaceString";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(aA.PARAMETER_STRING_NAME,Y.ofString(aA.PARAMETER_STRING_NAME));static PARAMETER_AT_START=new W(aA.PARAMETER_AT_START_NAME,Y.ofInteger(aA.PARAMETER_AT_START_NAME));static PARAMETER_AT_LENGTH=new W(aA.PARAMETER_AT_LENGTH_NAME,Y.ofInteger(aA.PARAMETER_AT_LENGTH_NAME));static PARAMETER_REPLACE_STRING=new W(aA.PARAMETER_REPLACE_STRING_NAME,Y.ofString(aA.PARAMETER_REPLACE_STRING_NAME));static EVENT_STRING=new en(en.OUTPUT,new Map([[aA.EVENT_RESULT_NAME,Y.ofString(aA.EVENT_RESULT_NAME)]]));constructor(){super()}signature=new el("ReplaceAtGivenPosition").setNamespace(R.STRING).setParameters(new Map([[aA.PARAMETER_STRING.getParameterName(),aA.PARAMETER_STRING],[aA.PARAMETER_AT_START.getParameterName(),aA.PARAMETER_AT_START],[aA.PARAMETER_AT_LENGTH.getParameterName(),aA.PARAMETER_AT_LENGTH],[aA.PARAMETER_REPLACE_STRING.getParameterName(),aA.PARAMETER_REPLACE_STRING]])).setEvents(new Map([[aA.EVENT_STRING.getName(),aA.EVENT_STRING]]));getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(aA.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(aA.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(aA.PARAMETER_AT_LENGTH_NAME);return e?.getArguments()?.get(aA.PARAMETER_REPLACE_STRING_NAME),t.length,r<n&&(t.substring(0,r),t.substring(r+n)),new eE([ea.outputOf(new Map([[aA.EVENT_RESULT_NAME,t]]))])}}class ag extends e1{VALUE="value";SIGNATURE=new el("Reverse").setNamespace(R.STRING).setParameters(new Map([[this.VALUE,new W(this.VALUE,Y.ofString(this.VALUE)).setVariableArgument(!1)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[this.VALUE,new Y().setType(x.of(E.STRING)).setName(this.VALUE)]]))]));constructor(){super()}getSignature(){return this.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(this.VALUE),r=t.length-1,n="";for(;r>=0;)n+=t.charAt(r--);return new eE([ea.outputOf(Z.of(this.VALUE,n))])}}class ac extends e1{PARAMETER_STRING_NAME="string";PARAMETER_SPLIT_STRING_NAME="searchString";EVENT_RESULT_NAME="result";PARAMETER_STRING=new W(this.PARAMETER_STRING_NAME,Y.ofString(this.PARAMETER_STRING_NAME));PARAMETER_SPLIT_STRING=new W(this.PARAMETER_SPLIT_STRING_NAME,Y.ofString(this.PARAMETER_SPLIT_STRING_NAME));EVENT_ARRAY=new en(en.OUTPUT,Z.of(this.EVENT_RESULT_NAME,Y.ofArray(this.EVENT_RESULT_NAME)));getSignature(){return new el("Split").setNamespace(R.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()}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_STRING_NAME),r=e.getArguments()?.get(this.PARAMETER_SPLIT_STRING_NAME);return new eE([ea.outputOf(Z.of(this.EVENT_RESULT_NAME,t.split(r)))])}}class am extends e1{PARAMETER_INPUT_ANYTYPE_NAME="anytype";EVENT_RESULT_NAME="result";PARAMETER_INPUT_ANYTYPE=new W(this.PARAMETER_INPUT_ANYTYPE_NAME,Y.ofAny(this.PARAMETER_INPUT_ANYTYPE_NAME));EVENT_STRING=new en(en.OUTPUT,new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]));getSignature(){return new el("ToString").setNamespace(R.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()}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 eE([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,r]]))])}}class aT extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_LENGTH_NAME="length";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(aT.PARAMETER_STRING_NAME,Y.ofString(aT.PARAMETER_STRING_NAME));static PARAMETER_LENGTH=new W(aT.PARAMETER_LENGTH_NAME,Y.ofInteger(aT.PARAMETER_LENGTH_NAME));static EVENT_STRING=new en(en.OUTPUT,new Map([[aT.EVENT_RESULT_NAME,Y.ofString(aT.EVENT_RESULT_NAME)]]));signature=new el("TrimTo").setNamespace(R.STRING).setParameters(new Map([[aT.PARAMETER_STRING.getParameterName(),aT.PARAMETER_STRING],[aT.PARAMETER_LENGTH.getParameterName(),aT.PARAMETER_LENGTH]])).setEvents(new Map([[aT.EVENT_STRING.getName(),aT.EVENT_STRING]]));getSignature(){return this.signature}constructor(){super()}async internalExecute(e){let t=e.getArguments()?.get(aT.PARAMETER_STRING_NAME),r=e.getArguments()?.get(aT.PARAMETER_LENGTH_NAME);return new eE([ea.outputOf(new Map([[aT.EVENT_RESULT_NAME,t.substring(0,r)]]))])}}class ap{static repoMap=Z.ofArrayEntries(an.ofEntryString("Trim",e=>e.trim()),an.ofEntryString("LowerCase",e=>e.toLocaleLowerCase()),an.ofEntryString("UpperCase",e=>e.toUpperCase()),an.ofEntryStringBooleanOutput("IsBlank",e=>""===e.trim()),an.ofEntryStringBooleanOutput("IsEmpty",e=>""===e),an.ofEntryAsStringBooleanOutput("Contains",(e,t)=>-1!=e.indexOf(t)),an.ofEntryAsStringBooleanOutput("EndsWith",(e,t)=>e.endsWith(t)),an.ofEntryAsStringBooleanOutput("StartsWith",(e,t)=>e.startsWith(t)),an.ofEntryAsStringBooleanOutput("EqualsIgnoreCase",(e,t)=>e.toUpperCase()==t.toUpperCase()),an.ofEntryAsStringBooleanOutput("Matches",(e,t)=>new RegExp(t).test(e)),an.ofEntryAsStringIntegerOutput("IndexOf",(e,t)=>e.indexOf(t)),an.ofEntryAsStringIntegerOutput("LastIndexOf",(e,t)=>e.lastIndexOf(t)),an.ofEntryAsStringAndIntegerStringOutput("Repeat",(e,t)=>e.repeat(t)),an.ofEntryAsStringStringIntegerIntegerOutput("IndexOfWithStartPoint",(e,t,r)=>e.indexOf(t,r)),an.ofEntryAsStringStringIntegerIntegerOutput("LastIndexOfWithStartPoint",(e,t,r)=>e.lastIndexOf(t,r)),an.ofEntryAsStringStringStringStringOutput("Replace",(e,t,r)=>e.replaceAll(t,r)),an.ofEntryAsStringStringStringStringOutput("ReplaceFirst",(e,t,r)=>e.replace(t,r)),an.ofEntryAsStringIntegerIntegerStringOutput("SubString",(e,t,r)=>e.substring(t,r)),K(new aa),K(new as),K(new ai),K(new aE),K(new au),K(new al),K(new aA),K(new ag),K(new ac),K(new am),K(new aT),K(new ao));static filterableNames=Array.from(ap.repoMap.values()).map(e=>e.getSignature().getFullName());async find(e,t){return e!=R.STRING?Promise.resolve(void 0):Promise.resolve(ap.repoMap.get(t))}async filter(e){return Promise.resolve(ap.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class aR{constructor(){}static isLeapYear(e){return e%4==0&&e%100!=0||e%400==0}static validYearRange(e){return e<275761&&e>-271821}static validMonthRange(e){return e<=12&&e>0}static validDate(e,t,r){if(r<=0||t<=0)return!1;switch(t){case 2:return aR.validYearRange(e)&&aR.validMonthRange(t)&&aR.isLeapYear(e)&&r<30||!aR.isLeapYear(e)&&r<29;case 4:case 6:case 9:case 11:return aR.validYearRange(e)&&aR.validMonthRange(t)&&r<=30;default:return aR.validYearRange(e)&&aR.validMonthRange(t)&&r<=31}}static validHourRange(e){return e<24&&e>=0}static validMinuteSecondRange(e){return e<60&&e>=0}static validMilliSecondRange(e){return e<1e3&&e>=0}static validateWithOptionalMillis(e){return aR.validMilliSecondRange(aR.convertToInt(e.substring(1,4)))&&aR.validateLocalTime(e.substring(4))}getYear(e){let t=e.charAt(0);if("+"==t||"-"==t){let r=aR.convertToInt(e.substring(1,7));return"-"==t?-1*r:r}return aR.convertToInt(e.substring(0,4))}static validateLocalTime(e){return"Z"==e.charAt(0)||6==e.length&&("+"==e.charAt(0)||"-"==e.charAt(0))&&aR.validHourRange(aR.convertToInt(e.substring(1,3)))&&":"==e.charAt(3)&&aR.validMinuteSecondRange(aR.convertToInt(e.substring(4,e.length-1)))}static validate(e){if(e.length<20||e.length>32)return!1;let t=e.charAt(0);return"+"==t||"-"==t?"-"==e.charAt(7)&&"-"==e.charAt(10)&&"T"==e.charAt(13)&&":"==e.charAt(16)&&":"==e.charAt(19)&&"."==e.charAt(22)&&aR.validDate(aR.convertToInt(e.substring(1,7)),aR.convertToInt(e.substring(8,10)),aR.convertToInt(e.substring(11,13)))&&aR.validHourRange(aR.convertToInt(e.substring(14,16)))&&aR.validMinuteSecondRange(aR.convertToInt(e.substring(17,19)))&&aR.validMinuteSecondRange(aR.convertToInt(e.substring(20,22)))&&aR.validateWithOptionalMillis(e.substring(22)):"-"==e.charAt(4)&&"-"==e.charAt(7)&&"T"==e.charAt(10)&&":"==e.charAt(13)&&":"==e.charAt(16)&&"."==e.charAt(19)&&aR.validDate(aR.convertToInt(e.substring(0,4)),aR.convertToInt(e.substring(5,7)),aR.convertToInt(e.substring(8,10)))&&aR.validHourRange(aR.convertToInt(e.substring(11,13)))&&aR.validMinuteSecondRange(aR.convertToInt(e.substring(14,16)))&&aR.validMinuteSecondRange(aR.convertToInt(e.substring(17,19)))&&aR.validateWithOptionalMillis(e.substring(19))}static convertToInt(e){var t=parseInt(e);return isNaN(t)?Number.MIN_VALUE:t}}class ah extends e1{signature;static EVENT_RESULT_NAME="result";static PARAMETER_DATE_NAME="isoDate";static PARAMETER_FIELD_NAME="value";static PARAMETER_INT_NAME="intValue";static PARAMETER_UNIT_NAME="unit";static PARAMETER_DATE=new W(ah.PARAMETER_DATE_NAME,Y.ofString(this.PARAMETER_DATE_NAME).setRef(R.DATE+".timeStamp"));static PARAMETER_FIELD=new W(ah.PARAMETER_FIELD_NAME,Y.ofInteger(this.PARAMETER_FIELD_NAME));static PARAMETER_INT=new W(ah.PARAMETER_INT_NAME,Y.ofInteger(this.PARAMETER_INT_NAME));static PARAMETER_UNIT=new W(ah.PARAMETER_UNIT_NAME,Y.ofString(this.PARAMETER_UNIT_NAME).setEnums(["YEAR","MONTH","DAY","HOUR","MINUTE","SECOND","MILLISECOND"]));static EVENT_INT=new en(en.OUTPUT,Z.of(ah.EVENT_RESULT_NAME,Y.ofInteger(ah.EVENT_RESULT_NAME)));static EVENT_BOOLEAN=new en(en.OUTPUT,Z.of(ah.EVENT_RESULT_NAME,Y.ofBoolean(ah.EVENT_RESULT_NAME)));static EVENT_DATE=new en(en.OUTPUT,Z.of(ah.EVENT_RESULT_NAME,Y.ofString(ah.EVENT_RESULT_NAME).setRef(R.DATE+".timeStamp")));getSignature(){return this.signature}constructor(e,t,r,...n){super();let a=new Map;n.forEach(e=>a.set(e.getParameterName(),e)),this.signature=new el(t).setNamespace(e).setParameters(a).setEvents(Z.of(r.getName(),r))}static ofEntryDateAndBooleanOutput(e,t){return[e,new class extends ah{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e.getArguments()?.get(ah.PARAMETER_DATE_NAME);if(N(r)||!aR.validate(r))throw new eo("Please provide a valid date.");return new eE([ea.outputOf(Z.of(ah.EVENT_RESULT_NAME,t(r)))])}}(R.DATE,e,ah.EVENT_BOOLEAN,ah.PARAMETER_DATE)]}static ofEntryDateAndIntegerOutput(e,t){return[e,new class extends ah{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e.getArguments()?.get(ah.PARAMETER_DATE_NAME);if(N(r)||!aR.validate(r))throw new eo("Please provide a valid date object");return new eE([ea.outputOf(Z.of(ah.EVENT_RESULT_NAME,t(r)))])}}(R.DATE,e,ah.EVENT_INT,ah.PARAMETER_DATE)]}static ofEntryDateWithIntegerUnitWithOutputName(e,t){return[e,new class extends ah{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e.getArguments()?.get(ah.PARAMETER_DATE_NAME);if(N(r)||!aR.validate(r))throw new eo("Please provide a valid date object");let n=e.getArguments()?.get(ah.PARAMETER_INT_NAME),a=e.getArguments()?.get(ah.PARAMETER_UNIT_NAME);return new eE([ea.outputOf(Z.of(ah.EVENT_RESULT_NAME,t(r,n,a)))])}}(R.DATE,e,ah.EVENT_DATE,ah.PARAMETER_DATE,ah.PARAMETER_INT,ah.PARAMETER_UNIT)]}}const af="result",aN="isoDate";class a_ extends e1{getSignature(){return new el("DateToEpoch").setNamespace(R.DATE).setParameters(Z.of(aN,W.of(aN,Y.ofRef(R.DATE+".timeStamp")))).setEvents(new Map([en.outputEventMapEntry(new Map([[af,Y.ofLong(af)]]))]))}async internalExecute(e){var t=e.getArguments()?.get(aN);if(N(t)||!aR.validate(t))throw new eo("Please provide a valid date object");let r=new Date(t).getTime();return new eE([ea.of(af,Z.of(af,r))])}}const aS="isoDateOne",aM="isoDateTwo",aw=new el("DifferenceOfTimestamps").setNamespace(R.DATE).setParameters(new Map([[aS,new W(aS,Y.ofString(aS).setRef(R.DATE+".timeStamp"))],[aM,new W(aM,Y.ofString(aM).setRef(R.DATE+".timeStamp"))]]));class aO extends e1{getSignature(){return aw}async internalExecute(e){let t=e?.getArguments()?.get(aS),r=e?.getArguments()?.get(aM);if(!aR.validate(t)||!aR.validate(r))throw new eo("Please provide valid ISO date for both the given dates.");let n=new Date(t),a=new Date(r);return new eE([ea.outputOf(new Map([["result",(a.getTime()-n.getTime())/6e4]]))])}}const ad="epoch",aI="date",aP=new el("EpochToDate").setNamespace(R.DATE).setParameters(new Map([[ad,new W(ad,new Y().setAnyOf([Y.ofInteger(ad),Y.ofLong(ad),Y.ofString(ad)]))]])).setEvents(new Map([en.outputEventMapEntry(new Map([[aI,Y.ofRef(`${R.DATE}.timeStamp`)]]))]));class ay extends e1{getSignature(){return aP}async internalExecute(e){var t=e.getArguments()?.get(ad);if(N(t)||"boolean"==typeof t||("string"==typeof t&&(t=parseInt(t)),isNaN(t)))throw new eo("Please provide a valid value for epoch.");return t=t>0xe8d4a50fff?t:1e3*t,new eE([ea.outputOf(new Map([[aI,new Date(t).toISOString()]]))])}}const ax="date",av=new el("GetCurrentTimeStamp").setNamespace(R.DATE).setParameters(new Map([])).setEvents(new Map([en.outputEventMapEntry(new Map([[ax,Y.ofRef(`${R.DATE}.timeStamp`)]]))]));class aL extends e1{getSignature(){return av}async internalExecute(e){let t=new Date(Date.now()).toISOString();return new eE([ea.of(ax,new Map([[ax,t]]))])}}const aU="isoDate",aC="result",aV=new el("GetTimeAsArray").setNamespace(R.DATE).setParameters(Z.of(aU,W.of(aU,Y.ofRef(R.DATE+".timeStamp")))).setEvents(new Map([en.outputEventMapEntry(new Map([[aC,Y.ofArray(aC).setItems(_.of(Y.ofNumber("number")))]]))]));class aD extends e1{getSignature(){return aV}async internalExecute(e){var t=e.getArguments()?.get(aU);if(N(t)||!aR.validate(t))throw new eo("Please provide a valid date object");let r=new Date(t),n=[r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()];return new eE([ea.outputOf(new Map([[aC,n]]))])}}const ab="isoDate",aG="result",aF=new el("GetTimeAsObject").setNamespace(R.DATE).setParameters(Z.of(ab,W.of(ab,Y.ofRef(R.DATE+".timeStamp")))).setEvents(new Map([en.outputEventMapEntry(new Map([[aG,Y.ofObject(aG).setProperties(new Map([["year",Y.ofNumber("year")],["month",Y.ofNumber("month")],["day",Y.ofNumber("day")],["hours",Y.ofNumber("hours")],["minutes",Y.ofNumber("minutes")],["seconds",Y.ofNumber("seconds")],["milliseconds",Y.ofNumber("milliseconds")]]))]]))]));class aY extends e1{getSignature(){return aF}async internalExecute(e){var t=e.getArguments()?.get(ab);if(N(t)||!aR.validate(t))throw new eo("Please provide a valid date object");let r=new Date(t),n={year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hours:r.getUTCHours(),minutes:r.getUTCMinutes(),seconds:r.getUTCSeconds(),milliseconds:r.getUTCMilliseconds()};return new eE([ea.outputOf(new Map([[aG,n]]))])}}const aB="isoDate",aH="output",ak=new el("IsValidISODate").setNamespace(R.DATE).setParameters(Z.of(aB,W.of(aB,Y.ofRef(R.DATE+".timeStamp")))).setEvents(Z.of(aH,new en(aH,Z.of(aH,Y.ofBoolean(aH)))));class a$ extends e1{getSignature(){return ak}async internalExecute(e){var t=e.getArguments()?.get(aB);if(N(t))throw new eo("Please provide a valid date object");return new eE([ea.of(aH,Z.of(aH,aR.validate(t)))])}}const aj="isoDates",aW="result",aX="Please provide a valid date",aJ=new el("MaximumTimestamp").setNamespace(R.DATE).setParameters(new Map([[aj,W.of(aj,Y.ofString(aj).setRef(R.DATE+".timeStamp")).setVariableArgument(!0)]])).setEvents(new Map([[aW,new en(aW,new Map([[aW,Y.ofString(aW).setRef(R.DATE+".timeStamp")]]))]]));class aq extends e1{getSignature(){return aJ}async internalExecute(e){let t=e?.getArguments()?.get(aj),r=t.length;if(0===r)throw new eo(aX);if(1==r){let e=t[0];if(!aR.validate(e))throw new eo(aX);return new eE([ea.outputOf(new Map([[aW,e]]))])}let n=0,a=new Date(t[0]).getTime();for(let e=1;e<r;e++){let r=t[e];if(!aR.validate(r))throw new eo(aX);let s=new Date(r).getTime();s>a&&(a=s,n=e)}return new eE([ea.outputOf(new Map([[aW,t[n]]]))])}}const az="isoDates",aK="result",aQ="Please provide a valid date",aZ=new el("MinimumTimestamp").setNamespace(R.DATE).setParameters(new Map([[az,W.of(az,Y.ofString(az).setRef(R.DATE+".timeStamp")).setVariableArgument(!0)]])).setEvents(new Map([[aK,new en(aK,new Map([[aK,Y.ofString(aK).setRef(R.DATE+".timeStamp")]]))]]));class a0 extends e1{getSignature(){return aZ}async internalExecute(e){let t=e?.getArguments()?.get(az),r=t.length;if(0===r)throw new eo(aQ);if(1==r){let e=t[0];if(!aR.validate(e))throw new eo(aQ);return new eE([ea.outputOf(new Map([[aK,e]]))])}let n=0,a=new Date(t[0]).getTime();for(let e=1;e<r;e++){let r=t[e];if(!aR.validate(r))throw new eo(aQ);let s=new Date(r).getTime();s<a&&(a=s,n=e)}return new eE([ea.outputOf(new Map([[aK,t[n]]]))])}}class a1{static repoMap=Z.ofArrayEntries(K(new a_),K(new ay),K(new aL),K(new aO),K(new a$),K(new aD),K(new aY),K(new aq),K(new a0),ah.ofEntryDateAndBooleanOutput("IsLeapYear",e=>{let t=new Date(e).getUTCFullYear();return t%4==0&&t%100!=0||t%400==0}),ah.ofEntryDateAndIntegerOutput("GetDate",e=>new Date(e).getUTCDate()),ah.ofEntryDateAndIntegerOutput("GetDay",e=>new Date(e).getUTCDay()),ah.ofEntryDateAndIntegerOutput("GetFullYear",e=>new Date(e).getUTCFullYear()),ah.ofEntryDateAndIntegerOutput("GetMonth",e=>new Date(e).getUTCMonth()),ah.ofEntryDateAndIntegerOutput("GetHours",e=>new Date(e).getUTCHours()),ah.ofEntryDateAndIntegerOutput("GetMinutes",e=>new Date(e).getUTCMinutes()),ah.ofEntryDateAndIntegerOutput("GetSeconds",e=>new Date(e).getUTCSeconds()),ah.ofEntryDateAndIntegerOutput("GetMilliSeconds",e=>new Date(e).getUTCMilliseconds()),ah.ofEntryDateAndIntegerOutput("GetTime",e=>new Date(e).getTime()),ah.ofEntryDateWithIntegerUnitWithOutputName("AddTime",(e,t,r)=>this.changeAmountToUnit(e,r,t,!0)),ah.ofEntryDateWithIntegerUnitWithOutputName("SubtractTime",(e,t,r)=>this.changeAmountToUnit(e,r,t,!1)));static filterableNames=Array.from(a1.repoMap.values()).map(e=>e.getSignature().getFullName());static changeAmountToUnit(e,t,r,n){let a=n?r:-1*r,s=this.getFullUTCDate(e),i=this.getTimezoneOffset(e);switch(t){case"MILLISECOND":s.setMilliseconds(s.getMilliseconds()+a);break;case"SECOND":s.setSeconds(s.getSeconds()+a);break;case"MINUTE":s.setMinutes(s.getMinutes()+a);break;case"HOUR":s.setHours(s.getHours()+a);break;case"DAY":s.setDate(s.getDate()+a);break;case"MONTH":s.setMonth(s.getMonth()+a);break;case"YEAR":s.setFullYear(s.getFullYear()+a);break;default:throw new eo("No such unit: "+t)}return this.formatDate(s,i)}static getTimezoneOffset(e){if("Z"===e.charAt(e.length-1))return"+00:00";let t=-1!==e.indexOf("+")?e.lastIndexOf("+"):e.lastIndexOf("-");if(-1===t)return"+00:00";let r=e.substring(t);return 3===r.length?r=r.substring(0,1)+"0"+r.substring(1)+":00":5===r.length&&(r=r.substring(0,3)+":"+r.substring(3)),r}static getFullUTCDate(e){-1!==e.lastIndexOf("+")?e=e.substring(0,e.lastIndexOf("+"))+"Z":-1!==e.lastIndexOf("-")&&(e=e.substring(0,e.lastIndexOf("-"))+"Z");let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()))}static formatDate(e,t){let r=e=>e.toString().padStart(2,"0"),n=0===e.getUTCMonth()?e.getUTCFullYear()-1:e.getUTCFullYear(),a=r(0===e.getUTCMonth()?12:e.getUTCMonth()),s=r(e.getUTCDate()),i=r(e.getUTCHours()),o=r(e.getUTCMinutes()),E=r(e.getUTCSeconds()),u=r(e.getUTCMilliseconds());return`${n}-${a}-${s}T${i}:${o}:${E}.${u}${t}`}find(e,t){return e!=R.DATE?Promise.resolve(void 0):Promise.resolve(a1.repoMap.get(t))}filter(e){return Promise.resolve(a1.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class a2 extends e1{static MILLIS="millis";static SIGNATURE=new el("Wait").setNamespace(R.SYSTEM).setParameters(new Map([W.ofEntry(a2.MILLIS,Y.ofNumber(a2.MILLIS).setMinimum(0).setDefaultValue(0))])).setEvents(new Map([en.outputEventMapEntry(new Map)]));getSignature(){return a2.SIGNATURE}async internalExecute(e){var t=e.getArguments()?.get(a2.MILLIS);return await new Promise(e=>setTimeout(e,t)),new eE([ea.outputOf(new Map)])}}var a9={};t(a9,"HybridRepository",()=>a4);class a4{repos;constructor(...e){this.repos=e}async find(e,t){for(let r of this.repos){let n=await r.find(e,t);if(n)return n}}async filter(e){let t=new Set;for(let r of this.repos)(await r.filter(e)).forEach(e=>t.add(e));return Array.from(t)}}const a3=new Map([[R.SYSTEM_CTX,new Map([K(new class extends e1{getSignature(){return re}async internalExecute(e){let t=e?.getArguments()?.get(t7);if(e?.getContext()?.has(t))throw new eo(ep.format("Context already has an element for '$' ",t));let r=Y.from(e?.getArguments()?.get(t8));if(!r)throw new eo("Schema is not supplied.");return e.getContext().set(t,new t5(r,N(r.getDefaultValue())?void 0:r.getDefaultValue())),new eE([ea.outputOf(new Map)])}}),K(new class extends e1{getSignature(){return rn}async internalExecute(e){let t=e?.getArguments()?.get(rt);if(!e.getContext()?.has(t))throw new eo(ep.format("Context don't have an element for '$' ",t));return new eE([ea.outputOf(new Map([rr,e.getContext()?.get(t)?.getElement()]))])}}),K(new class extends e1{getSignature(){return nl}async internalExecute(e){let t=e?.getArguments()?.get(nE);if(e_.isNullOrBlank(t))throw new eo("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get(nu),n=new tG(t),a=n.getTokens().peekLast();if(!a.getExpression().startsWith("Context")||a instanceof tG||a instanceof tV&&!a.getElement().toString().startsWith("Context"))throw new e8(ep.format("The context path $ is not a valid path in context",t));for(let e of n.getOperations().toArray())if(e!=tb.ARRAY_OPERATOR&&e!=tb.OBJECT_OPERATOR)throw new e8(ep.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<n.getTokens().size();r++){let a=n.getTokens().get(r);a instanceof tG&&n.getTokens().set(r,new tV(t,new no(a).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,n)}modifyContext(e,t,r,n){let a=n.getTokens();a.removeLast();let s=n.getOperations();s.removeLast();let i=e.getContext()?.get(a.removeLast().getExpression());if(N(i))throw new eo(ep.format("Context doesn't have any element with name '$' ",t));if(s.isEmpty())return i.setElement(r),new eE([ea.outputOf(new Map)]);let o=i.getElement(),E=s.removeLast(),u=a.removeLast(),l=u instanceof tV?u.getElement():u.getExpression();for(N(o)&&(o=E==tb.OBJECT_OPERATOR?{}:[],i.setElement(o));!s.isEmpty();)o=E==tb.OBJECT_OPERATOR?this.getDataFromObject(o,l,s.peekLast()):this.getDataFromArray(o,l,s.peekLast()),E=s.removeLast(),l=(u=a.removeLast())instanceof tV?u.getElement():u.getExpression();return E==tb.OBJECT_OPERATOR?this.putDataInObject(o,l,r):this.putDataInArray(o,l,r),new eE([ea.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eo(ep.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eo(ep.format("Expected an array index but found $",t));if(n<0)throw new eo(ep.format("Array index is out of bound - $",t));let a=e[n];return N(a)&&(a=r==tb.OBJECT_OPERATOR?{}:[],e[n]=a),a}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eo(ep.format("Expected an object but found $",e));let n=e[t];return N(n)&&(n=r==tb.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r){if(!Array.isArray(e))throw new eo(ep.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eo(ep.format("Expected an array index but found $",t));if(n<0)throw new eo(ep.format("Array index is out of bound - $",t));e[n]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eo(ep.format("Expected an object but found $",e));e[t]=r}})])],[R.SYSTEM_LOOP,new Map([K(new class extends e1{getSignature(){return nv}async internalExecute(e){let t=e.getArguments()?.get(nI),r=e.getArguments()?.get("to"),n=e.getArguments()?.get(nP),a=n>0,s=t,i=!1,o=e.getStatementExecution()?.getStatement()?.getStatementName();return new eE({next(){if(i)return;if(a&&s>=r||!a&&s<=r||o&&e.getExecutionContext()?.get(o))return i=!0,o&&e.getExecutionContext()?.delete(o),ea.outputOf(new Map([[ny,s]]));let t=ea.of(en.ITERATION,new Map([[nx,s]]));return s+=n,t}})}}),K(new class extends e1{getSignature(){return n_}async internalExecute(e){let t=e.getArguments()?.get(nh),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new eE({next(){if(r>=t||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),ea.outputOf(new Map([[nf,r]]));let a=ea.of(en.ITERATION,new Map([[nN,r]]));return++r,a}})}}),K(new class extends e1{getSignature(){return nR}async internalExecute(e){let t=e.getArguments()?.get(np);return e.getExecutionContext().set(t,!0),new eE([ea.outputOf(new Map)])}}),K(new class extends e1{getSignature(){return nd}async internalExecute(e){let t=e.getArguments()?.get(nS),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new eE({next(){if(r>=t.length||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),ea.outputOf(new Map([[nO,r]]));let a=ea.of(en.ITERATION,new Map([[nw,r],[nM,t[r]]]));return++r,a}})}})])],[R.SYSTEM,new Map([K(new nT),K(new class extends e1{getSignature(){return nm}async internalExecute(e){let t=e.getEvents(),r=e.getArguments(),n=r?.get(ng),a=e?.getArguments()?.get(nc).map(t=>{let r=t[nA];if(N(r))throw new eo("Expect a value object");let n=r.value;return r.isExpression&&(n=new no(n).evaluate(e.getValuesMap())),[t.name,n]}).reduce((e,t)=>(e.set(t[0],t[1]),e),new Map);return t?.has(n)||t?.set(n,[]),t?.get(n)?.push(a),new eE([ea.outputOf(new Map)])}}),K(new ar),K(new a2),K(new t4)])]]),a6=Array.from(a3.values()).flatMap(e=>Array.from(e.values())).map(e=>e.getSignature().getFullName());class a5 extends a4{constructor(){super({find:async(e,t)=>a3.get(e)?.get(t),filter:async e=>Array.from(a6).filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase()))},new nK,new ap,new t3,new at,new a1)}}var a7={};t(a7,"StatementExecution",()=>st);var a8={};t(a8,"StatementMessage",()=>se);class se{messageType;message;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 st{statement;messages=[];dependencies=new Set;constructor(e){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 se(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){return e instanceof st&&e.statement.equals(this.statement)}}var sr={};t(sr,"ContextTokenValueExtractor",()=>sn);class sn extends tY{static PREFIX="Context.";context;constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(tY.REGEX_DOT),r=t[1],n=r.indexOf("["),a=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),a=1),this.retrieveElementFrom(e,t,a,this.context.get(r)?.getElement())}getPrefix(){return sn.PREFIX}getStore(){return N(this.context)?this.context:Array.from(this.context.entries()).reduce((e,[t,r])=>(N(r)||(e[t]=r.getElement()),e),{})}}var sa={};t(sa,"OutputMapTokenValueExtractor",()=>ss);class ss extends tY{static PREFIX="Steps.";output;constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(tY.REGEX_DOT),r=1,n=this.output.get(t[r++]);if(!n||r>=t.length)return;let a=n.get(t[r++]);if(!a||r>t.length)return;if(r===t.length)return a;let s=t[r].indexOf("[");if(-1===s){let n=a.get(t[r++]);return this.retrieveElementFrom(e,t,r,n)}let i=t[r].substring(0,s),o=a.get(i);return this.retrieveElementFrom(e,t,r,{[i]:o})}getPrefix(){return ss.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 si={};t(si,"ArgumentsTokenValueExtractor",()=>so);class so extends tY{static PREFIX="Arguments.";args;constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(tY.REGEX_DOT),r=t[1],n=r.indexOf("["),a=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),a=1),this.retrieveElementFrom(e,t,a,this.args.get(r))}getPrefix(){return so.PREFIX}getStore(){return N(this.args)?this.args:Array.from(this.args.entries()).reduce((e,[t,r])=>(e[t]=r,e),{})}}var sE={};t(sE,"GraphVertex",()=>sA);var su={};t(su,"ExecutionGraph",()=>sl);class sl{nodeMap=new Map;isSubGrph;constructor(e=!1){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 sA(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 eR(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 sA{data;outVertices=new Map;inVertices=new Set;graph;constructor(e,t){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 sl(!0);var r=new eR(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 sg={};t(sg,"KIRuntime",()=>sN);var sc={};t(sc,"JsonExpression",()=>sm);class sm{expression;constructor(e){this.expression=e}getExpression(){return this.expression}}var sT={};t(sT,"ParameterReferenceType",()=>g),(i=g||(g={})).VALUE="VALUE",i.EXPRESSION="EXPRESSION";var sp={};function sR(){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)})}t(sp,"FunctionExecutionParameters",()=>sh);class sh{context;args;events;statementExecution;steps;count=0;functionRepository;schemaRepository;executionId;executionContext=new Map;valueExtractors=new Map;constructor(e,t,r){this.functionRepository=e,this.schemaRepository=t,this.executionId=r??sR()}getExecutionId(){return this.executionId}getContext(){return this.context}setContext(e){this.context=e;let t=new sn(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 ss(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 sf={};t(sf,"StatementMessageType",()=>c),(o=c||(c={})).ERROR="ERROR",o.WARNING="WARNING",o.MESSAGE="MESSAGE";class sN extends e1{static PARAMETER_NEEDS_A_VALUE='Parameter "$" needs a value';static STEP_REGEX_PATTERN=RegExp("Steps\\.([a-zA-Z0-9\\\\-]{1,})\\.([a-zA-Z0-9\\\\-]{1,})","g");static VERSION=1;static MAX_EXECUTION_ITERATIONS=1e7;fd;debugMode=!1;constructor(e,t=!1){if(super(),this.debugMode=t,this.fd=e,this.fd.getVersion()>sN.VERSION)throw new eo("Runtime is at a lower version "+sN.VERSION+" and trying to run code from version "+this.fd.getVersion()+".")}getSignature(){return this.fd}async getExecutionPlan(e,t){let r=new sl;for(let n of Array.from(this.fd.getSteps().values()))r.addVertex(await this.prepareStatementExecution(n,e,t));return Array.from(this.makeEdges(r).getT2().entries()).forEach(e=>{let t=r.getNodeMap().get(e[0])?.getData();t&&t.addMessage(c.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 so(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 eo("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 eR;r.addAll(e.getVerticesWithNoIncomingEdges());let n=new eR;for(;(!r.isEmpty()||!n.isEmpty())&&!t.getEvents()?.has(en.OUTPUT);)if(await this.processBranchQue(t,r,n),await this.processExecutionQue(t,r,n),t.setCount(t.getCount()+1),t.getCount()==sN.MAX_EXECUTION_ITERATIONS)throw new eo("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 eo("No events raised")}let a=Array.from(t.getEvents()?.entries()??[]).flatMap(e=>e[1].map(t=>ea.of(e[0],t)));return new eE(a.length||e.isSubGraph()?a:[ea.of(en.OUTPUT,new Map)])}async processExecutionQue(e,t,r){if(!t.isEmpty()){let n=t.pop();await this.allDependenciesResolvedVertex(n,e.getSteps())?await this.executeVertex(n,e,r,t,e.getFunctionRepository()):t.add(n)}}async processBranchQue(e,t,r){if(r.length){let n=r.pop();await this.allDependenciesResolvedTuples(n.getT2(),e.getSteps())?await this.executeBranch(e,t,n):r.add(n)}}async executeBranch(e,t,r){let n,a=r.getT4();do if(r.getT1().getVerticesData().map(e=>e.getStatement().getStatementName()).forEach(t=>e.getSteps()?.delete(t)),await this.executeGraph(r.getT1(),e),(n=r.getT3().next())&&(e.getSteps()?.has(a.getData().getStatement().getStatementName())||e.getSteps()?.set(a.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(a.getData().getStatement().getStatementName())?.set(n.getName(),this.resolveInternalExpressions(n.getResult(),e)),this.debugMode)){let t=a.getData().getStatement();console.log(`EID: ${e.getExecutionId()} Step : ${t.getStatementName()} => ${t.getNamespace()}.${t.getName()}`),console.log(`EID: ${e.getExecutionId()} Event : ${n.getName()} : `,e.getSteps().get(t.getStatementName()).get(n.getName()))}while(n&&n.getName()!=en.OUTPUT)n?.getName()==en.OUTPUT&&a.getOutVertices().has(en.OUTPUT)&&(a?.getOutVertices()?.get(en.OUTPUT)??[]).forEach(async r=>{await this.allDependenciesResolvedVertex(r,e.getSteps())&&t.add(r)})}async executeVertex(e,t,r,n,a){let s,i=e.getData().getStatement();if(i.getExecuteIftrue().size&&!(Array.from(i.getExecuteIftrue().entries())??[]).filter(e=>e[1]).map(([e])=>new no(e).evaluate(t.getValuesMap())).every(e=>!N(e)&&!1!==e))return;let o=await a.find(i.getNamespace(),i.getName());if(!o)throw new eo(ep.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 l=t.getContext();s=o instanceof sN?new sh(t.getFunctionRepository(),t.getSchemaRepository(),`${t.getExecutionId()}_${i.getStatementName()}`).setArguments(u).setValuesMap(new Map(Array.from(t.getValuesMap().values()).filter(e=>e.getPrefix()!==so.PREFIX&&e.getPrefix()!==ss.PREFIX&&e.getPrefix()!==sn.PREFIX).map(e=>[e.getPrefix(),e]))):new sh(t.getFunctionRepository(),t.getSchemaRepository(),t.getExecutionId()).setValuesMap(t.getValuesMap()).setContext(l).setArguments(u).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount()).setExecutionContext(t.getExecutionContext());let A=await o.execute(s),g=A.next();if(!g)throw new eo(ep.format("Executing $ returned no events",i.getStatementName()));let c=g.getName()==en.OUTPUT;if(t.getSteps()?.has(i.getStatementName())||t.getSteps().set(i.getStatementName(),new Map),t.getSteps().get(i.getStatementName()).set(g.getName(),this.resolveInternalExpressions(g.getResult(),t)),this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Event : ${g.getName()} : `,t.getSteps().get(i.getStatementName()).get(g.getName()))),c){let r=e.getOutVertices().get(en.OUTPUT);r&&r.forEach(async e=>{await this.allDependenciesResolvedVertex(e,t.getSteps())&&n.add(e)})}else{let t=e.getSubGraphOfType(g.getName()),n=this.makeEdges(t).getT1();r.push(new ed(t,n,A,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(N(e)||"object"!=typeof e)return e;if(e instanceof sm)return new no(e.getExpression()).evaluate(t.getValuesMap());if(Array.isArray(e)){let r=[];for(let n of e)r.push(this.resolveInternalExpression(n,t));return r}if("object"==typeof e){let r={};for(let n of Object.entries(e))r[n[0]]=this.resolveInternalExpression(n[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e)if(!t.has(r.getT1())||!t.get(r.getT1())?.get(r.getT2()))return!1;return!0}allDependenciesResolvedVertex(e,t){return!e.getInVertices().size||0==Array.from(e.getInVertices()).filter(e=>{let r=e.getT1().getData().getStatement().getStatementName(),n=e.getT2();return!(t.has(r)&&t.get(r)?.has(n))}).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map(t=>{let n,a=Array.from(t[1]?.values()??[]);if(!a?.length)return new ew(t[0],n);let s=r.get(t[0]);return s?(n=s.isVariableArgument()?a.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)).filter(e=>!N(e)).map(t=>this.parameterReferenceEvaluation(e,t)).flatMap(e=>Array.isArray(e)?e:[e]):this.parameterReferenceEvaluation(e,a[0]),new ew(t[0],n)):new ew(t[0],void 0)}).filter(e=>!N(e.getT2())).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map)}parameterReferenceEvaluation(e,t){let r;return t.getType()==g.VALUE?r=this.resolveInternalExpression(t.getValue(),e):t.getType()!=g.EXPRESSION||e_.isNullOrBlank(t.getExpression())||(r=new no(t.getExpression()??"").evaluate(e.getValuesMap())),r}async prepareStatementExecution(e,t,r){let n=new st(e),a=await t.find(e.getNamespace(),e.getName());if(!a)return n.addMessage(c.ERROR,ep.format("$.$ is not available",e.getNamespace(),e.getName())),Promise.resolve(n);let s=new Map(a.getSignature().getParameters());if(!e.getParameterMap())return Promise.resolve(n);for(let t of Array.from(e.getParameterMap().entries())){let e=s.get(t[0]);if(!e)continue;let a=Array.from(t[1]?.values()??[]);if(!a.length&&!e.isVariableArgument()){await ey.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(c.ERROR,ep.format(sN.PARAMETER_NEEDS_A_VALUE,e.getParameterName())),s.delete(e.getParameterName());continue}if(e.isVariableArgument())for(let t of(a.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)),a))this.parameterReferenceValidation(n,e,t,r);else if(a.length){let t=a[0];this.parameterReferenceValidation(n,e,t,r)}s.delete(e.getParameterName())}if(!N(n.getStatement().getDependentStatements()))for(let e of Array.from(n.getStatement().getDependentStatements().entries()))e[1]&&n.addDependency(e[0]);if(!N(n.getStatement().getExecuteIftrue()))for(let e of Array.from(n.getStatement().getExecuteIftrue().entries()))e[1]&&this.addDependencies(n,e[0]);if(s.size)for(let e of Array.from(s.values()))e.isVariableArgument()||await ey.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(c.ERROR,ep.format(sN.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return Promise.resolve(n)}async parameterReferenceValidation(e,t,r,n){if(r){if(r.getType()==g.VALUE){if(N(r.getValue())&&!await ey.hasDefaultValueOrNullSchemaType(t.getSchema(),n)&&e.addMessage(c.ERROR,ep.format(sN.PARAMETER_NEEDS_A_VALUE,t.getParameterName())),N(r.getValue()))return;let a=new eR;for(a.push(new ew(t.getSchema(),r.getValue()));!a.isEmpty();){let t=a.pop();if(t.getT2() instanceof sm)this.addDependencies(e,t.getT2().getExpression());else{if(N(t.getT1())||N(t.getT1().getType()))continue;if(t.getT1().getType()?.contains(E.ARRAY)&&Array.isArray(t.getT2())){let e=t.getT1().getItems();if(!e)continue;if(e.isSingleType())for(let r of t.getT2())a.push(new ew(e.getSingleSchema(),r));else{let r=t.getT2();for(let t=0;t<r.length;t++)a.push(new ew(e.getTupleSchema()[t],r[t]))}}else if(t.getT1().getType()?.contains(E.OBJECT)&&"object"==typeof t.getT2()){let r=t.getT1();if(r.getName()===W.EXPRESSION.getName()&&r.getNamespace()===W.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])&&a.push(new ew(r.getProperties().get(e[0]),e[1]))}}}}else if(r.getType()==g.EXPRESSION){if(e_.isNullOrBlank(r.getExpression()))N(ey.getDefaultValue(t.getSchema(),n))&&e.addMessage(c.ERROR,ep.format(sN.PARAMETER_NEEDS_A_VALUE,t.getParameterName()));else try{this.addDependencies(e,r.getExpression())}catch(t){e.addMessage(c.ERROR,ep.format("Error evaluating $ : $",r.getExpression(),t))}}}else N(await ey.getDefaultValue(t.getSchema(),n))&&e.addMessage(c.ERROR,ep.format(sN.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(sN.STEP_REGEX_PATTERN)??[]).forEach(t=>e.addDependency(t))}makeEdges(e){let t=e.getNodeMap().values(),r=[],n=new Map;for(let a of Array.from(t))for(let t of Array.from(a.getData().getDependencies())){let s=t.indexOf(".",6),i=t.substring(6,s),o=t.indexOf(".",s+1),E=-1==o?t.substring(s+1):t.substring(s+1,o);e.getNodeMap().has(i)?a.addInEdgeTo(e.getNodeMap().get(i),E):(r.push(new ew(i,E)),n.set(a.getData().getStatement().getStatementName(),ep.format("Unable to find the step with name $",i)))}return new ew(r,n)}}var s_={};t(s_,"KIRunConstants",()=>sS);class sS{static NAMESPACE="namespace";static NAME="name";static ID="id";constructor(){}}var sM={};t(sM,"Position",()=>sw);class sw{static SCHEMA_NAME="Position";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(sw.SCHEMA_NAME).setType(x.of(E.OBJECT)).setProperties(new Map([["left",Y.ofFloat("left")],["top",Y.ofFloat("top")]]));left;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 sw(e.left,e.top)}}var sO={};t(sO,"FunctionDefinition",()=>sV);var sd={};t(sd,"Statement",()=>sv);var sI={};t(sI,"AbstractStatement",()=>sP);class sP{comment;description;position;override=!1;constructor(e){if(!e)return;this.comment=e.comment,this.description=e.description,this.position=e.position?new sw(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 sy={};t(sy,"ParameterReference",()=>sx);class sx{static SCHEMA_NAME="ParameterReference";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(sx.SCHEMA_NAME).setType(x.of(E.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")]]));key;type;value;expression;order;constructor(e){e instanceof sx?(this.key=e.key,this.type=e.type,this.value=N(e.value)?void 0:JSON.parse(JSON.stringify(e.value)),this.expression=e.expression,this.order=e.order):(this.type=e,this.key=sR())}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 sx(g.EXPRESSION).setExpression(e);return[t.getKey(),t]}static ofValue(e){let t=new sx(g.VALUE).setValue(e);return[t.getKey(),t]}static from(e){return new sx(e.type).setValue(e.value).setExpression(e.expression).setKey(e.key).setOrder(e.order)}}class sv extends sP{static SCHEMA_NAME="Statement";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(sv.SCHEMA_NAME).setType(x.of(E.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 F().setSchemaValue(Y.ofBoolean("exists"))).setDefaultValue({})],["executeIftrue",Y.ofObject("executeIftrue").setAdditionalProperties(new F().setSchemaValue(Y.ofBoolean("exists"))).setDefaultValue({})],["parameterMap",new Y().setName("parameterMap").setAdditionalProperties(new F().setSchemaValue(Y.ofObject("parameterReference").setAdditionalProperties(new F().setSchemaValue(sx.SCHEMA))))],["position",sw.SCHEMA]]));statementName;namespace;name;parameterMap;dependentStatements;executeIftrue;constructor(e,t,r){if(super(e instanceof sv?e:void 0),e instanceof sv)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 sx(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 sv&&e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}static from(e){return new sv(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])=>sx.from(t)).map(e=>[e.getKey(),e]))]))).setDependentStatements(new Map(Object.entries(e.dependentStatements??{}))).setExecuteIftrue(new Map(Object.entries(e.executeIftrue??{}))).setPosition(sw.from(e.position)).setComment(e.comment).setDescription(e.description)}}var sL={};t(sL,"StatementGroup",()=>sU);class sU extends sP{static SCHEMA_NAME="StatementGroup";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(sU.SCHEMA_NAME).setType(x.of(E.OBJECT)).setProperties(new Map([["statementGroupName",Y.ofString("statementGroupName")],["comment",Y.ofString("comment")],["description",Y.ofString("description")],["position",sw.SCHEMA]]));statementGroupName;statements;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 sU(e.statementGroupName,new Map(Object.entries(e.statements||{}).map(([e,t])=>[e,(""+t)?.toLowerCase()=="true"]))).setPosition(sw.from(e.position)).setComment(e.comment).setDescription(e.description)}}const sC=new Y().setNamespace(R.SYSTEM).setName("FunctionDefinition").setProperties(new Map([["name",Y.ofString("name")],["namespace",Y.ofString("namespace")],["parameters",Y.ofArray("parameters",W.SCHEMA)],["events",Y.ofObject("events").setAdditionalProperties(new F().setSchemaValue(en.SCHEMA))],["steps",Y.ofObject("steps").setAdditionalProperties(new F().setSchemaValue(sv.SCHEMA))]]));sC.getProperties()?.set("parts",Y.ofArray("parts",sC));class sV extends el{static SCHEMA=sC;version=1;steps;stepGroups;parts;constructor(e){super(e)}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 sV(e.name).setSteps(new Map(Object.values(e.steps??{}).filter(e=>!!e).map(e=>[e.statementName,sv.from(e)]))).setStepGroups(new Map(Object.values(e.stepGroups??{}).filter(e=>!!e).map(e=>[e.statementGroupName,sU.from(e)]))).setParts(Array.from(e.parts??[]).filter(e=>!!e).map(e=>sV.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,W.from(e)]))).setNamespace(e.namespace):new sV("unknown")}}var sD={};t(sD,"Argument",()=>sb);class sb{argumentIndex=0;name;value;constructor(e,t,r){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 sb(0,e,t)}}var sG={};e(sG,rZ),e(sG,r9),e(sG,r3),e(sG,r5),e(sG,r0);var sF={};e(sF,ru),e(sF,rA),e(sF,rc),e(sF,rT),e(sF,rR),e(sF,rf),e(sF,r_),e(sF,ri),e(sF,rM),e(sF,rO),e(sF,rI),e(sF,ry),e(sF,rv),e(sF,rU),e(sF,rV),e(sF,rb),e(sF,rF),e(sF,rB),e(sF,rk),e(sF,rX),e(sF,rj),e(sF,rq),e(sF,rK),e(sF,rs),e(module.exports,m),e(module.exports,z),e(module.exports,{}),e(module.exports,e5),e(module.exports,Q),e(module.exports,f),e(module.exports,em),e(module.exports,tP),e(module.exports,eT),e(module.exports,eN),e(module.exports,eM),e(module.exports,tr),e(module.exports,ec),e(module.exports,ts),e(module.exports,a7),e(module.exports,a8),e(module.exports,t6),e(module.exports,sr),e(module.exports,sa),e(module.exports,si),e(module.exports,sE),e(module.exports,{}),e(module.exports,su),e(module.exports,sg),e(module.exports,sf),e(module.exports,sp),e(module.exports,tI),e(module.exports,tF),e(module.exports,r8),e(module.exports,td),e(module.exports,ra),e(module.exports,tD),e(module.exports,tL),e(module.exports,tx),e(module.exports,tC),e(module.exports,{}),e(module.exports,eA),e(module.exports,p),e(module.exports,sc),e(module.exports,T),e(module.exports,eF),e(module.exports,eV),e(module.exports,eb),e(module.exports,eU),e(module.exports,ex),e(module.exports,ek),e(module.exports,eB),e(module.exports,eg),e(module.exports,eI),e(module.exports,H),e(module.exports,eL),e(module.exports,h),e(module.exports,P),e(module.exports,M),e(module.exports,w),e(module.exports,O),e(module.exports,S),e(module.exports,eS),e(module.exports,e$),e(module.exports,a9),e(module.exports,s_),e(module.exports,B),e(module.exports,es),e(module.exports,sM),e(module.exports,sO),e(module.exports,sT),e(module.exports,et),e(module.exports,sI),e(module.exports,sd),e(module.exports,{}),e(module.exports,sL),e(module.exports,eu),e(module.exports,er),e(module.exports,$),e(module.exports,sD),e(module.exports,sy),e(module.exports,e7),e(module.exports,ei),e(module.exports,sG),e(module.exports,sF),e(module.exports,nr);
1
+ var e,t,r,n,s,a,i,o,E,u,A,T,l=require("luxon");function R(e,t){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e}function m(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var g={};m(g,"KIRunSchemaRepository",()=>Z);var h={};m(h,"AdditionalType",()=>B),m(h,"Schema",()=>Y);var c={};m(c,"Namespaces",()=>p);class p{static{this.SYSTEM="System"}static{this.SYSTEM_CTX="System.Context"}static{this.SYSTEM_LOOP="System.Loop"}static{this.SYSTEM_ARRAY="System.Array"}static{this.SYSTEM_OBJECT="System.Object"}static{this.MATH="System.Math"}static{this.STRING="System.String"}static{this.DATE="System.Date"}constructor(){}}var N={};m(N,"ArraySchemaType",()=>M);var f={};function _(e){return null==e}m(f,"isNullValue",()=>_);class M{constructor(e){if(!e)return;this.singleSchema=e.singleSchema?new Y(e.singleSchema):void 0,this.tupleSchema=e.tupleSchema?e.tupleSchema.map(e=>new Y(e)):void 0}setSingleSchema(e){return this.singleSchema=e,this}setTupleSchema(e){return this.tupleSchema=e,this}getSingleSchema(){return this.singleSchema}getTupleSchema(){return this.tupleSchema}isSingleType(){return!_(this.singleSchema)}static of(...e){return 1==e.length?new M().setSingleSchema(e[0]):new M().setTupleSchema(e)}static from(e){if(!e)return;if(Array.isArray(e))return new M().setTupleSchema(Y.fromListOfSchemas(e));let t=Object.keys(e);if(-1!=t.indexOf("singleSchema"))return new M().setSingleSchema(Y.from(e.singleSchema));if(-1!=t.indexOf("tupleSchema"))return new M().setTupleSchema(Y.fromListOfSchemas(e.tupleSchema));let r=Y.from(e);if(r)return new M().setSingleSchema(r)}}var S={};m(S,"SchemaType",()=>i),(e=i||(i={})).INTEGER="Integer",e.LONG="Long",e.FLOAT="Float",e.DOUBLE="Double",e.STRING="String",e.OBJECT="Object",e.ARRAY="Array",e.BOOLEAN="Boolean",e.NULL="Null";var O={};m(O,"TypeUtil",()=>L);var w={};m(w,"MultipleType",()=>d);var I={};m(I,"Type",()=>P);class P{}class d extends P{constructor(e){super(),e instanceof d?this.type=new Set(Array.from(e.type)):this.type=new Set(Array.from(e))}getType(){return this.type}setType(e){return this.type=e,this}getAllowedSchemaTypes(){return this.type}contains(e){return this.type?.has(e)}}var y={};m(y,"SingleType",()=>x);class x extends P{constructor(e){super(),e instanceof x?this.type=e.type:this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class L{static of(...e){return 1==e.length?new x(e[0]):new d(new Set(e))}static from(e){return"string"==typeof e?new x(i[L.fromJSONType(e)]):Array.isArray(e)?new d(new Set(e.map(L.fromJSONType).map(e=>e).map(e=>i[e]))):void 0}static fromJSONType(e){let t=e.toUpperCase();return"NUMBER"===t?"DOUBLE":t}}const v="additionalProperty",U="additionalItems",V="enums",C="items",D="System.Schema",G="required",b="version",F="namespace";class B{constructor(e){if(!e||(this.booleanValue=e.booleanValue,!e.schemaValue))return;this.schemaValue=new Y(e.schemaValue)}getBooleanValue(){return this.booleanValue}getSchemaValue(){return this.schemaValue}setBooleanValue(e){return this.booleanValue=e,this}setSchemaValue(e){return this.schemaValue=e,this}static from(e){if(_(e))return;let t=new B;if("boolean"==typeof e)t.booleanValue=e;else{let r=Object.keys(e);-1!=r.indexOf("booleanValue")?t.booleanValue=e.booleanValue:-1!=r.indexOf("schemaValue")?t.schemaValue=Y.from(e.schemaValue):t.schemaValue=Y.from(e)}return t}}class Y{static{this.NULL=new Y().setNamespace(p.SYSTEM).setName("Null").setType(L.of(i.NULL)).setConstant(void 0)}static{this.TYPE_SCHEMA=new Y().setType(L.of(i.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"])}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName("Schema").setType(L.of(i.OBJECT)).setProperties(new Map([[F,Y.of(F,i.STRING).setDefaultValue("_")],["name",Y.ofString("name")],[b,Y.of(b,i.INTEGER).setDefaultValue(1)],["ref",Y.ofString("ref")],["type",new Y().setAnyOf([Y.TYPE_SCHEMA,Y.ofArray("type",Y.TYPE_SCHEMA)])],["anyOf",Y.ofArray("anyOf",Y.ofRef(D))],["allOf",Y.ofArray("allOf",Y.ofRef(D))],["oneOf",Y.ofArray("oneOf",Y.ofRef(D))],["not",Y.ofRef(D)],["title",Y.ofString("title")],["description",Y.ofString("description")],["id",Y.ofString("id")],["examples",Y.ofAny("examples")],["defaultValue",Y.ofAny("defaultValue")],["comment",Y.ofString("comment")],[V,Y.ofArray(V,Y.ofString(V))],["constant",Y.ofAny("constant")],["pattern",Y.ofString("pattern")],["format",Y.of("format",i.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",Y.ofInteger("minLength")],["maxLength",Y.ofInteger("maxLength")],["multipleOf",Y.ofLong("multipleOf")],["minimum",Y.ofNumber("minimum")],["maximum",Y.ofNumber("maximum")],["exclusiveMinimum",Y.ofNumber("exclusiveMinimum")],["exclusiveMaximum",Y.ofNumber("exclusiveMaximum")],["properties",Y.of("properties",i.OBJECT).setAdditionalProperties(new B().setSchemaValue(Y.ofRef(D)))],["additionalProperties",new Y().setName(v).setNamespace(p.SYSTEM).setAnyOf([Y.ofBoolean(v),Y.ofObject(v).setRef(D)]).setDefaultValue(!0)],[G,Y.ofArray(G,Y.ofString(G)).setDefaultValue([])],["propertyNames",Y.ofRef(D)],["minProperties",Y.ofInteger("minProperties")],["maxProperties",Y.ofInteger("maxProperties")],["patternProperties",Y.of("patternProperties",i.OBJECT).setAdditionalProperties(new B().setSchemaValue(Y.ofRef(D)))],[C,new Y().setName(C).setAnyOf([Y.ofRef(D).setName("item"),Y.ofArray("tuple",Y.ofRef(D))])],["contains",Y.ofRef(D)],["minContains",Y.ofInteger("minContains")],["maxContains",Y.ofInteger("maxContains")],["minItems",Y.ofInteger("minItems")],["maxItems",Y.ofInteger("maxItems")],["uniqueItems",Y.ofBoolean("uniqueItems")],["additionalItems",new Y().setName(U).setNamespace(p.SYSTEM).setAnyOf([Y.ofBoolean(U),Y.ofObject(U).setRef(D)])],["$defs",Y.of("$defs",i.OBJECT).setAdditionalProperties(new B().setSchemaValue(Y.ofRef(D)))],["permission",Y.ofString("permission")]])).setRequired([])}static ofString(e){return new Y().setType(L.of(i.STRING)).setName(e)}static ofInteger(e){return new Y().setType(L.of(i.INTEGER)).setName(e)}static ofFloat(e){return new Y().setType(L.of(i.FLOAT)).setName(e)}static ofLong(e){return new Y().setType(L.of(i.LONG)).setName(e)}static ofDouble(e){return new Y().setType(L.of(i.DOUBLE)).setName(e)}static ofAny(e){return new Y().setType(L.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE,i.STRING,i.BOOLEAN,i.ARRAY,i.NULL,i.OBJECT)).setName(e)}static ofAnyNotNull(e){return new Y().setType(L.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE,i.STRING,i.BOOLEAN,i.ARRAY,i.OBJECT)).setName(e)}static ofNumber(e){return new Y().setType(L.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)).setName(e)}static ofBoolean(e){return new Y().setType(L.of(i.BOOLEAN)).setName(e)}static of(e,...t){return new Y().setType(L.of(...t)).setName(e)}static ofObject(e){return new Y().setType(L.of(i.OBJECT)).setName(e)}static ofRef(e){return new Y().setRef(e)}static ofArray(e,...t){return new Y().setType(L.of(i.ARRAY)).setName(e).setItems(M.of(...t))}static fromListOfSchemas(e){if(_(e)&&!Array.isArray(e))return;let t=[];for(let r of Array.from(e)){let e=Y.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(_(e))return;let t=new Map;return Object.entries(e).forEach(([e,r])=>{let n=Y.from(r);n&&t.set(e,n)}),t}static from(e,t=!1){if(_(e))return;let r=new Y;return r.namespace=e.namespace??"_",r.name=e.name,r.version=e.version??1,r.ref=e.ref,t?r.type=new x(i.STRING):r.type=L.from(e.type),r.anyOf=Y.fromListOfSchemas(e.anyOf),r.allOf=Y.fromListOfSchemas(e.allOf),r.oneOf=Y.fromListOfSchemas(e.oneOf),r.not=Y.from(e.not),r.description=e.description,r.examples=e.examples?[...e.examples]:void 0,r.defaultValue=e.defaultValue,r.comment=e.comment,r.enums=e.enums?[...e.enums]:void 0,r.constant=e.constant,r.pattern=e.pattern,r.format=e.format,r.minLength=e.minLength,r.maxLength=e.maxLength,r.multipleOf=e.multipleOf,r.minimum=e.minimum,r.maximum=e.maximum,r.exclusiveMinimum=e.exclusiveMinimum,r.exclusiveMaximum=e.exclusiveMaximum,r.properties=Y.fromMapOfSchemas(e.properties),r.additionalProperties=B.from(e.additionalProperties),r.required=e.required,r.propertyNames=Y.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=Y.fromMapOfSchemas(e.patternProperties),r.items=M.from(e.items),r.additionalItems=B.from(e.additionalItems),r.contains=Y.from(e.contains),r.minContains=e.minContains,r.maxContains=e.maxContains,r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=Y.fromMapOfSchemas(e.$defs),r.permission=e.permission,r}constructor(e){if(this.namespace="_",this.version=1,!e)return;this.namespace=e.namespace,this.name=e.name,this.version=e.version,this.ref=e.ref,_(e.type)||(this.type=e.type instanceof x?new x(e.type):new d(e.type)),this.anyOf=e.anyOf?.map(e=>new Y(e)),this.allOf=e.allOf?.map(e=>new Y(e)),this.oneOf=e.oneOf?.map(e=>new Y(e)),this.not=this.not?new Y(this.not):void 0,this.description=e.description,this.examples=e.examples?JSON.parse(JSON.stringify(e.examples)):void 0,this.defaultValue=e.defaultValue?JSON.parse(JSON.stringify(e.defaultValue)):void 0,this.comment=e.comment,this.enums=e.enums?[...e.enums]:void 0,this.constant=e.constant?JSON.parse(JSON.stringify(e.constant)):void 0,this.pattern=e.pattern,this.format=e.format,this.minLength=e.minLength,this.maxLength=e.maxLength,this.multipleOf=e.multipleOf,this.minimum=e.minimum,this.maximum=e.maximum,this.exclusiveMinimum=e.exclusiveMinimum,this.exclusiveMaximum=e.exclusiveMaximum,this.properties=e.properties?new Map(Array.from(e.properties.entries()).map(e=>[e[0],new Y(e[1])])):void 0,this.additionalProperties=e.additionalProperties?new B(e.additionalProperties):void 0,this.required=e.required?[...e.required]:void 0,this.propertyNames=e.propertyNames?new Y(e.propertyNames):void 0,this.minProperties=e.minProperties,this.maxProperties=e.maxProperties,this.patternProperties=e.patternProperties?new Map(Array.from(e.patternProperties.entries()).map(e=>[e[0],new Y(e[1])])):void 0,this.items=e.items?new M(e.items):void 0,this.contains=e.contains?new Y(this.contains):void 0,this.minContains=e.minContains,this.maxContains=e.maxContains,this.minItems=e.minItems,this.maxItems=e.maxItems,this.uniqueItems=e.uniqueItems,this.additionalItems=e.additionalItems?new B(e.additionalItems):void 0,this.$defs=e.$defs?new Map(Array.from(e.$defs.entries()).map(e=>[e[0],new Y(e[1])])):void 0,this.permission=e.permission}getTitle(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}getFullName(){return this.namespace+"."+this.name}get$defs(){return this.$defs}set$defs(e){return this.$defs=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getVersion(){return this.version}setVersion(e){return this.version=e,this}getRef(){return this.ref}setRef(e){return this.ref=e,this}getType(){return this.type}setType(e){return this.type=e,this}getAnyOf(){return this.anyOf}setAnyOf(e){return this.anyOf=e,this}getAllOf(){return this.allOf}setAllOf(e){return this.allOf=e,this}getOneOf(){return this.oneOf}setOneOf(e){return this.oneOf=e,this}getNot(){return this.not}setNot(e){return this.not=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getExamples(){return this.examples}setExamples(e){return this.examples=e,this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}getComment(){return this.comment}setComment(e){return this.comment=e,this}getEnums(){return this.enums}setEnums(e){return this.enums=e,this}getConstant(){return this.constant}setConstant(e){return this.constant=e,this}getPattern(){return this.pattern}setPattern(e){return this.pattern=e,this}getFormat(){return this.format}setFormat(e){return this.format=e,this}getMinLength(){return this.minLength}setMinLength(e){return this.minLength=e,this}getMaxLength(){return this.maxLength}setMaxLength(e){return this.maxLength=e,this}getMultipleOf(){return this.multipleOf}setMultipleOf(e){return this.multipleOf=e,this}getMinimum(){return this.minimum}setMinimum(e){return this.minimum=e,this}getMaximum(){return this.maximum}setMaximum(e){return this.maximum=e,this}getExclusiveMinimum(){return this.exclusiveMinimum}setExclusiveMinimum(e){return this.exclusiveMinimum=e,this}getExclusiveMaximum(){return this.exclusiveMaximum}setExclusiveMaximum(e){return this.exclusiveMaximum=e,this}getProperties(){return this.properties}setProperties(e){return this.properties=e,this}getAdditionalProperties(){return this.additionalProperties}setAdditionalProperties(e){return this.additionalProperties=e,this}getAdditionalItems(){return this.additionalItems}setAdditionalItems(e){return this.additionalItems=e,this}getRequired(){return this.required}setRequired(e){return this.required=e,this}getPropertyNames(){return this.propertyNames}setPropertyNames(e){return this.propertyNames=e,this.propertyNames.type=new x(i.STRING),this}getMinProperties(){return this.minProperties}setMinProperties(e){return this.minProperties=e,this}getMaxProperties(){return this.maxProperties}setMaxProperties(e){return this.maxProperties=e,this}getPatternProperties(){return this.patternProperties}setPatternProperties(e){return this.patternProperties=e,this}getItems(){return this.items}setItems(e){return this.items=e,this}getContains(){return this.contains}setContains(e){return this.contains=e,this}getMinContains(){return this.minContains}setMinContains(e){return this.minContains=e,this}getMaxContains(){return this.maxContains}setMaxContains(e){return this.maxContains=e,this}getMinItems(){return this.minItems}setMinItems(e){return this.minItems=e,this}getMaxItems(){return this.maxItems}setMaxItems(e){return this.maxItems=e,this}getUniqueItems(){return this.uniqueItems}setUniqueItems(e){return this.uniqueItems=e,this}getPermission(){return this.permission}setPermission(e){return this.permission=e,this}}var H={};m(H,"Parameter",()=>X);var k={};m(k,"SchemaReferenceException",()=>$);class $ extends Error{constructor(e,t,r){super(e.trim()?e+"-"+t:t),this.schemaPath=e,this.cause=r}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}var j={};m(j,"ParameterType",()=>o),(t=o||(o={})).CONSTANT="CONSTANT",t.EXPRESSION="EXPRESSION";const W="value";class X{static{this.SCHEMA_NAME="Parameter"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(X.SCHEMA_NAME).setProperties(new Map([["schema",Y.SCHEMA],["parameterName",Y.ofString("parameterName")],["variableArgument",Y.of("variableArgument",i.BOOLEAN).setDefaultValue(!1)],["type",Y.ofString("type").setEnums(["EXPRESSION","CONSTANT"])]]))}static{this.EXPRESSION=new Y().setNamespace(p.SYSTEM).setName("ParameterExpression").setType(L.of(i.OBJECT)).setProperties(new Map([["isExpression",Y.ofBoolean("isExpression").setDefaultValue(!0)],[W,Y.ofAny(W)]]))}constructor(e,t){if(this.variableArgument=!1,this.type=o.EXPRESSION,e instanceof X)this.schema=new Y(e.schema),this.parameterName=e.parameterName,this.variableArgument=e.variableArgument,this.type=e.type;else{if(!t)throw Error("Unknown constructor signature");this.schema=t,this.parameterName=e}}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getParameterName(){return this.parameterName}setParameterName(e){return this.parameterName=e,this}isVariableArgument(){return this.variableArgument}setVariableArgument(e){return this.variableArgument=e,this}getType(){return this.type}setType(e){return this.type=e,this}static ofEntry(e,t,r=!1,n=o.EXPRESSION){return[e,new X(e,t).setType(n).setVariableArgument(r)]}static of(e,t,r=!1,n=o.EXPRESSION){return new X(e,t).setType(n).setVariableArgument(r)}static from(e){let t=Y.from(e.schema);if(!t)throw new $("","Parameter requires Schema");return new X(e.parameterName,t).setVariableArgument(!!e.variableArgument).setType(e.type??o.EXPRESSION)}}var J={};m(J,"MapUtil",()=>q),m(J,"MapEntry",()=>z);class q{static of(e,t,r,n,s,a,i,o,E,u,A,T,l,R,m,g,h,c,p,N){let f=new Map;return _(e)||_(t)||f.set(e,t),_(r)||_(n)||f.set(r,n),_(s)||_(a)||f.set(s,a),_(i)||_(o)||f.set(i,o),_(E)||_(u)||f.set(E,u),_(A)||_(T)||f.set(A,T),_(l)||_(R)||f.set(l,R),_(m)||_(g)||f.set(m,g),_(h)||_(c)||f.set(h,c),_(p)||_(N)||f.set(p,N),f}static ofArrayEntries(...e){let t=new Map;for(let[r,n]of e)t.set(r,n);return t}static entry(e,t){return new z(e,t)}static ofEntries(...e){let t=new Map;for(let r of e)t.set(r.k,r.v);return t}static ofEntriesArray(...e){let t=new Map;for(let r=0;r<e.length;r++)t.set(e[r][0],e[r][1]);return t}constructor(){}}class z{constructor(e,t){this.k=e,this.v=t}}const K=new Map([["any",Y.ofAny("any").setNamespace(p.SYSTEM)],["boolean",Y.ofBoolean("boolean").setNamespace(p.SYSTEM)],["double",Y.ofDouble("double").setNamespace(p.SYSTEM)],["float",Y.ofFloat("float").setNamespace(p.SYSTEM)],["integer",Y.ofInteger("integer").setNamespace(p.SYSTEM)],["long",Y.ofLong("long").setNamespace(p.SYSTEM)],["number",Y.ofNumber("number").setNamespace(p.SYSTEM)],["string",Y.ofString("string").setNamespace(p.SYSTEM)],["Timestamp",Y.ofString("Timestamp").setNamespace(p.DATE)],["Timeunit",Y.ofString("Timeunit").setNamespace(p.DATE).setEnums(["YEARS","QUARTERS","MONTHS","WEEKS","DAYS","HOURS","MINUTES","SECONDS","MILLISECONDS"])],["Duration",Y.ofObject("Duration").setNamespace(p.DATE).setProperties(q.ofArrayEntries(["years",Y.ofInteger("years")],["quarters",Y.ofInteger("quarters")],["months",Y.ofInteger("months")],["weeks",Y.ofInteger("weeks")],["days",Y.ofInteger("days")],["hours",Y.ofInteger("hours")],["minutes",Y.ofInteger("minutes")],["seconds",Y.ofLong("seconds")],["milliseconds",Y.ofLong("milliseconds")])).setAdditionalItems(B.from(!1))],["TimeObject",Y.ofObject("TimeObject").setNamespace(p.DATE).setProperties(q.ofArrayEntries(["year",Y.ofInteger("year")],["month",Y.ofInteger("month")],["day",Y.ofInteger("day")],["hour",Y.ofInteger("hour")],["minute",Y.ofInteger("minute")],["second",Y.ofLong("second")],["millisecond",Y.ofLong("millisecond")])).setAdditionalItems(B.from(!1))],[X.EXPRESSION.getName(),X.EXPRESSION],[Y.NULL.getName(),Y.NULL],[Y.SCHEMA.getName(),Y.SCHEMA]]),Q=Array.from(K.values()).map(e=>e.getFullName());class Z{async find(e,t){return p.SYSTEM!=e&&p.DATE!=e?Promise.resolve(void 0):Promise.resolve(K.get(t))}async filter(e){return Promise.resolve(Q.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var ee={};function et(e){return[e.getSignature().getName(),e]}m(ee,"KIRunFunctionRepository",()=>sH);var er={};m(er,"EventResult",()=>ea);var en={};m(en,"Event",()=>es);class es{static{this.OUTPUT="output"}static{this.ERROR="error"}static{this.ITERATION="iteration"}static{this.TRUE="true"}static{this.FALSE="false"}static{this.SCHEMA_NAME="Event"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(es.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["name",Y.ofString("name")],["parameters",Y.ofObject("parameter").setAdditionalProperties(new B().setSchemaValue(Y.SCHEMA))]]))}constructor(e,t){if(e instanceof es)this.name=e.name,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new Y(e[1])]));else{if(this.name=e,!t)throw Error("Unknown constructor format");this.parameters=t}}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}static outputEventMapEntry(e){return es.eventMapEntry(es.OUTPUT,e)}static eventMapEntry(e,t){return[e,new es(e,t)]}static from(e){return new es(e.name,new Map(Object.entries(e.parameters??{}).map(e=>{let t=Y.from(e[1]);if(!t)throw new $("","Event expects a schema");return[e[0],t]})))}}class ea{constructor(e,t){this.name=e,this.result=t}getName(){return this.name}setName(e){return this.name=e,this}getResult(){return this.result}setResult(e){return this.result=e,this}static outputOf(e){return ea.of(es.OUTPUT,e)}static of(e,t){return new ea(e,t)}}var ei={};m(ei,"FunctionOutput",()=>eu);var eo={};m(eo,"KIRuntimeException",()=>eE);class eE extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class eu{constructor(e){if(this.index=0,_(e))throw new eE("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof ea?this.fo=e:(this.fo=[],Array.isArray(e)||(this.generator=e))}next(){if(!this.generator)return this.index<this.fo.length?this.fo[this.index++]:void 0;let e=this.generator.next();return e&&this.fo.push(e),e}allResults(){return this.fo}}var eA={};m(eA,"FunctionSignature",()=>eT);class eT{static{this.SCHEMA_NAME="FunctionSignature"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(eT.SCHEMA_NAME).setProperties(new Map([["name",Y.ofString("name")],["namespace",Y.ofString("namespace")],["parameters",Y.ofObject("parameters").setAdditionalProperties(new B().setSchemaValue(X.SCHEMA))],["events",Y.ofObject("events").setAdditionalProperties(new B().setSchemaValue(es.SCHEMA))]]))}constructor(e){this.namespace="_",this.parameters=new Map,this.events=new Map,e instanceof eT?(this.name=e.name,this.namespace=e.namespace,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new X(e[1])])),this.events=new Map(Array.from(e.events.entries()).map(e=>[e[0],new es(e[1])]))):this.name=e}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getFullName(){return this.namespace+"."+this.name}}var el={};m(el,"AbstractFunction",()=>e3);var eR={};m(eR,"SchemaValidator",()=>e9);var em={};m(em,"deepEqual",()=>ef);var eg={};m(eg,"LinkedList",()=>ep);var eh={};m(eh,"StringFormatter",()=>ec);class ec{static format(e,...t){if(!t||0==t.length)return e;let r="",n=0,s="",a=s,i=e.length;for(let o=0;o<i;o++)"$"==(s=e.charAt(o))&&"\\"==a?r=r.substring(0,o-1)+s:"$"==s&&n<t.length?r+=t[n++]:r+=s,a=s;return r.toString()}constructor(){}}class ep{constructor(e){if(this.head=void 0,this.tail=void 0,this.length=0,e?.length){for(let t of e)if(this.head){let e=new eN(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new eN(t);this.length=e.length}}push(e){let t=new eN(e,void 0,this.head);this.head?(this.head.previous=t,this.head=t):this.tail=this.head=t,this.length++}pop(){if(!this.head)throw Error("List is empty and cannot pop further.");let e=this.head.value;if(this.length--,this.head==this.tail)return this.head=this.tail=void 0,e;let t=this.head;return this.head=t.next,t.next=void 0,t.previous=void 0,this.head.previous=void 0,e}isEmpty(){return!this.length}size(){return this.length}get(e){if(e<0||e>=this.length)throw Error(`${e} is out of bounds [0,${this.length}]`);let t=this.head;for(;e>0;)t=this.head.next,--e;return t.value}set(e,t){if(e<0||e>=this.length)throw new eE(ec.format("Index $ out of bound to set the value in linked list.",e));let r=this.head;for(;e>0;)r=this.head.next,--e;return r.value=t,this}toString(){let e=this.head,t="";for(;e;)t+=e.value,(e=e.next)&&(t+=", ");return`[${t}]`}toArray(){let e=[],t=this.head;for(;t;)e.push(t.value),t=t.next;return e}peek(){if(!this.head)throw Error("List is empty so cannot peak");return this.head.value}peekLast(){if(!this.tail)throw Error("List is empty so cannot peak");return this.tail.value}getFirst(){if(!this.head)throw Error("List is empty so cannot get first");return this.head.value}removeFirst(){return this.pop()}removeLast(){if(!this.tail)throw Error("List is empty so cannot remove");--this.length;let e=this.tail.value;if(0==this.length)this.head=this.tail=void 0;else{let e=this.tail.previous;e.next=void 0,this.tail.previous=void 0,this.tail=e}return e}addAll(e){return e&&e.length&&e.forEach(this.add.bind(this)),this}add(e){return++this.length,this.tail||this.head?this.head===this.tail?(this.tail=new eN(e,this.head),this.head.next=this.tail):(this.tail=new eN(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new eN(e),this}map(e,t){let r=new ep,n=this.head,s=0;for(;n;)r.add(e(n.value,s)),n=n.next,++s;return r}indexOf(e){let t=this.head,r=0;for(;t;){if(ef(t.value,e))return r;t=t.next,++r}return -1}forEach(e,t){let r=this.head,n=0;for(;r;)e(r.value,n),r=r.next,++n}}class eN{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}function ef(e,t){let r=new ep;r.push(e);let n=new ep;for(n.push(t);!r.isEmpty()&&!n.isEmpty();){let e=r.pop(),t=n.pop();if(e===t)continue;let s=typeof e,a=typeof t;if("undefined"===s||"undefined"===a){if(!e&&!t)continue;return!1}if(s!==a)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!=t.length)return!1;for(let s=0;s<e.length;s++)r.push(e[s]),n.push(t[s]);continue}if("object"===s){if("object"!==a||null===e||null===t)return!1;let s=Object.entries(e),i=Object.entries(t);if(s.length!==i.length)return!1;for(let[e,a]of s)r.push(a),n.push(t[e]);continue}return!1}return!0}var e_={};m(e_,"StringUtil",()=>eM);class eM{constructor(){}static nthIndex(e,t,r=0,n){if(!e)throw new eE("String cannot be null");if(r<0||r>=e.length)throw new eE(ec.format("Cannot search from index : $",r));if(n<=0||n>e.length)throw new eE(ec.format("Cannot search for occurance : $",n));for(;r<e.length;){if(e.charAt(r)==t&&0==--n)return r;++r}return -1}static splitAtFirstOccurance(e,t){if(!e)return[void 0,void 0];let r=e.indexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static splitAtLastOccurance(e,t){if(!e)return[void 0,void 0];let r=e.lastIndexOf(t);return -1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static isNullOrBlank(e){return!e||""==e.trim()}}var eS={};m(eS,"SchemaUtil",()=>ex);var eO={};m(eO,"Tuple2",()=>ew),m(eO,"Tuple3",()=>eI),m(eO,"Tuple4",()=>eP);class ew{constructor(e,t){this.f=e,this.s=t}getT1(){return this.f}getT2(){return this.s}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}}class eI extends ew{constructor(e,t,r){super(e,t),this.t=r}getT3(){return this.t}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}setT3(e){return this.t=e,this}}class eP extends eI{constructor(e,t,r,n){super(e,t,r),this.fr=n}getT4(){return this.fr}setT1(e){return this.f=e,this}setT2(e){return this.s=e,this}setT3(e){return this.t=e,this}setT4(e){return this.fr=e,this}}var ed={};m(ed,"SchemaValidationException",()=>ey);class ey extends Error{constructor(e,t,r=[],n){super(t+(r?r.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.cause=n}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class ex{static{this.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH="Unable to retrive schema from referenced path"}static{this.CYCLIC_REFERENCE_LIMIT_COUNTER=20}static async getDefaultValue(e,t){if(e)return e.getConstant()?e.getConstant():_(e.getDefaultValue())?ex.getDefaultValue(await ex.getSchemaFromRef(e,t,e.getRef()),t):e.getDefaultValue()}static async hasDefaultValueOrNullSchemaType(e,t){return e?e.getConstant()||!_(e.getDefaultValue())?Promise.resolve(!0):_(e.getRef())?e.getType()?.getAllowedSchemaTypes().has(i.NULL)?Promise.resolve(!0):Promise.resolve(!1):this.hasDefaultValueOrNullSchemaType(await ex.getSchemaFromRef(e,t,e.getRef()),t):Promise.resolve(!1)}static async getSchemaFromRef(e,t,r,n=0){if(++n==ex.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new ey(r??"","Schema has a cyclic reference");if(!e||!r||eM.isNullOrBlank(r))return Promise.resolve(void 0);if(!r.startsWith("#")){var s=await ex.resolveExternalSchema(e,t,r);s&&(e=s.getT1(),r=s.getT2())}let a=r.split("/");return 1===a.length?Promise.resolve(e):Promise.resolve(ex.resolveInternalSchema(e,t,r,n,a,1))}static async resolveInternalSchema(e,t,r,n,s,a){let o=e;if(a!==s.length){for(;a<s.length;){if("$defs"===s[a]){if(++a>=s.length||!o.get$defs())throw new $(r,ex.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);o=o.get$defs()?.get(s[a])}else{if(o&&(!o.getType()?.contains(i.OBJECT)||!o.getProperties()))throw new $(r,"Cannot retrievie schema from non Object type schemas");o=o.getProperties()?.get(s[a])}if(a++,!o||!eM.isNullOrBlank(o.getRef())&&!(o=await ex.getSchemaFromRef(o,t,o.getRef(),n)))throw new $(r,ex.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return Promise.resolve(o)}}static async resolveExternalSchema(e,t,r){if(!t)return Promise.resolve(void 0);let n=eM.splitAtFirstOccurance(r??"","/");if(!n[0])return Promise.resolve(void 0);let s=eM.splitAtLastOccurance(n[0],".");if(!s[0]||!s[1])return Promise.resolve(void 0);let a=await t.find(s[0],s[1]);if(!a)return Promise.resolve(void 0);if(!n[1]||""===n[1])return Promise.resolve(new ew(a,r));if(r="#/"+n[1],!a)throw new $(r,ex.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return Promise.resolve(new ew(a,r))}constructor(){}}var eL={};m(eL,"AnyOfAllOfOneOfValidator",()=>ev);class ev{static async validate(e,t,r,n,s,a){let i=[];return t.getOneOf()&&!t.getOneOf()?await ev.oneOf(e,t,r,n,i,s,a):t.getAllOf()&&!t.getAllOf()?await ev.allOf(e,t,r,n,i,s,a):t.getAnyOf()&&!t.getAnyOf()?await ev.anyOf(e,t,r,n,i,s,a):n}static async anyOf(e,t,r,n,s,a,i){let o=!1;for(let E of t.getAnyOf()??[])try{await ev.validate(e,E,r,n,a,i),o=!0;break}catch(e){o=!1,s.push(e)}if(o)return n;throw new ey(e9.path(e),"The value don't satisfy any of the schemas.",s)}static async allOf(e,t,r,n,s,a,i){let o=0;for(let E of t.getAllOf()??[])try{await ev.validate(e,E,r,n,a,i),o++}catch(e){s.push(e)}if(o===t.getAllOf()?.length)return n;throw new ey(e9.path(e),"The value doesn't satisfy some of the schemas.",s)}static async oneOf(e,t,r,n,s,a,i){let o=0;for(let E of t.getOneOf()??[])try{await ev.validate(e,E,r,n,a,i),o++}catch(e){s.push(e)}if(1===o)return n;throw new ey(e9.path(e),0==o?"The value does not satisfy any schema":"The value satisfy more than one schema",s)}constructor(){}}var eU={};m(eU,"TypeValidator",()=>e2);var eV={};m(eV,"ArrayValidator",()=>eC);class eC{static async validate(e,t,r,n,s,a){if(_(n))throw new ey(e9.path(e),"Expected an array but found null");if(!Array.isArray(n))throw new ey(e9.path(e),n.toString()+" is not an Array");return eC.checkMinMaxItems(e,t,n),await eC.checkItems(e,t,r,n,s,a),eC.checkUniqueItems(e,t,n),await eC.checkContains(t,e,r,n),n}static async checkContains(e,t,r,n){if(_(e.getContains()))return;let s=await eC.countContains(t,e,r,n,_(e.getMinContains())&&_(e.getMaxContains()));if(0===s)throw new ey(e9.path(t),"None of the items are of type contains schema");if(!_(e.getMinContains())&&e.getMinContains()>s)throw new ey(e9.path(t),"The minimum number of the items of type contains schema should be "+e.getMinContains()+" but found "+s);if(!_(e.getMaxContains())&&e.getMaxContains()<s)throw new ey(e9.path(t),"The maximum number of the items of type contains schema should be "+e.getMaxContains()+" but found "+s)}static async countContains(e,t,r,n,s){let a=0;for(let i=0;i<n.length;i++){let o=e?[...e]:[];try{if(await e9.validate(o,t.getContains(),r,n[i]),a++,s)break}catch(e){}}return a}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()&&new Set(r).size!==r.length)throw new ey(e9.path(e),"Items on the array are not unique")}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new ey(e9.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new ey(e9.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static async checkItems(e,t,r,n,s,a){if(!t.getItems())return;let i=t.getItems();if(i.getSingleSchema())for(let t=0;t<n.length;t++){let o=e?[...e]:[];n[t]=await e9.validate(o,i.getSingleSchema(),r,n[t],s,a)}if(i.getTupleSchema()){if(i.getTupleSchema().length!==n.length&&_(t?.getAdditionalItems()))throw new ey(e9.path(e),"Expected an array with only "+i.getTupleSchema().length+" but found "+n.length);await this.checkItemsInTupleSchema(e,r,n,i),await this.checkAdditionalItems(e,t,r,n,i)}}static async checkItemsInTupleSchema(e,t,r,n,s,a){for(let i=0;i<n.getTupleSchema()?.length;i++){let o=e?[...e]:[];r[i]=await e9.validate(o,n.getTupleSchema()[i],t,r[i],s,a)}}static async checkAdditionalItems(e,t,r,n,s){if(!_(t.getAdditionalItems())){let a=t.getAdditionalItems();if(a?.getBooleanValue()){let i=Y.ofAny("item");if(a?.getBooleanValue()===!1&&n.length>s.getTupleSchema()?.length)throw new ey(e9.path(e),"No Additional Items are defined");await this.checkEachItemInAdditionalItems(e,t,r,n,s,i)}else if(a?.getSchemaValue()){let i=a.getSchemaValue();await this.checkEachItemInAdditionalItems(e,t,r,n,s,i)}}}static async checkEachItemInAdditionalItems(e,t,r,n,s,a){for(let t=s.getTupleSchema()?.length;t<n.length;t++){let s=e?[...e]:[];n[t]=await e9.validate(s,a,r,n[t])}}constructor(){}}var eD={};m(eD,"BooleanValidator",()=>eG);class eG{static validate(e,t,r){if(_(r))throw new ey(e9.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new ey(e9.path(e),r.toString()+" is not a boolean");return r}constructor(){}}var eb={};m(eb,"NullValidator",()=>eF);class eF{static validate(e,t,r){if(_(r))return r;throw new ey(e9.path(e),"Expected a null but found "+r)}constructor(){}}var eB={};m(eB,"NumberValidator",()=>eY);class eY{static validate(e,t,r,n){if(_(n))throw new ey(e9.path(t),"Expected a number but found null");if("number"!=typeof n)throw new ey(e9.path(t),n.toString()+" is not a "+e);let s=eY.extractNumber(e,t,r,n);return eY.checkRange(t,r,n,s),eY.checkMultipleOf(t,r,n,s),n}static extractNumber(e,t,r,n){let s=n;try{(e==i.LONG||e==i.INTEGER)&&(s=Math.round(s))}catch(r){throw new ey(e9.path(t),n+" is not a number of type "+e,r)}if(_(s)||(e==i.LONG||e==i.INTEGER)&&s!=n)throw new ey(e9.path(t),n.toString()+" is not a number of type "+e);return s}static checkMultipleOf(e,t,r,n){if(t.getMultipleOf()&&n%t.getMultipleOf()!=0)throw new ey(e9.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}static checkRange(e,t,r,n){if(!_(t.getMinimum())&&0>eY.numberCompare(n,t.getMinimum()))throw new ey(e9.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(!_(t.getMaximum())&&eY.numberCompare(n,t.getMaximum())>0)throw new ey(e9.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(!_(t.getExclusiveMinimum())&&0>=eY.numberCompare(n,t.getExclusiveMinimum()))throw new ey(e9.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(!_(t.getExclusiveMaximum())&&eY.numberCompare(n,t.getExclusiveMaximum())>0)throw new ey(e9.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}var eH={};m(eH,"ObjectValidator",()=>ek);class ek{static async validate(e,t,r,n,s,a){if(_(n))throw new ey(e9.path(e),"Expected an object but found null");if("object"!=typeof n||Array.isArray(n))throw new ey(e9.path(e),n.toString()+" is not an Object");let i=new Set(Object.keys(n));return ek.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&await ek.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&ek.checkRequired(e,t,n),t.getProperties()&&await ek.checkProperties(e,t,r,n,i,s,a),t.getPatternProperties()&&await ek.checkPatternProperties(e,t,r,n,i),t.getAdditionalProperties()&&await ek.checkAdditionalProperties(e,t,r,n,i),n}static async checkPropertyNameSchema(e,t,r,n){for(let s of Array.from(n.values()))try{await e9.validate(e,t.getPropertyNames(),r,s)}catch(t){throw new ey(e9.path(e),"Property name '"+s+"' does not fit the property schema")}}static checkRequired(e,t,r){for(let n of t.getRequired()??[])if(_(r[n]))throw new ey(e9.path(e),n+" is mandatory")}static async checkAdditionalProperties(e,t,r,n,s){let a=t.getAdditionalProperties();if(a.getSchemaValue())for(let t of Array.from(s.values())){let s=e?[...e]:[];n[t]=await e9.validate(s,a.getSchemaValue(),r,n[t])}else if(!1===a.getBooleanValue()&&s.size)throw new ey(e9.path(e),Array.from(s)+" is/are additional properties which are not allowed.")}static async checkPatternProperties(e,t,r,n,s){let a=new Map;for(let e of Array.from(t.getPatternProperties().keys()))a.set(e,new RegExp(e));for(let i of Array.from(s.values())){let o=e?[...e]:[];for(let e of Array.from(a.entries()))if(e[1].test(i)){n[i]=await e9.validate(o,t.getPatternProperties().get(e[0]),r,n[i]),s.delete(i);break}}}static async checkProperties(e,t,r,n,s,a,i){for(let o of Array.from(t.getProperties())){let t=n[o[0]];if(!n.hasOwnProperty(o[0])&&_(t)&&_(await ex.getDefaultValue(o[1],r)))continue;let E=e?[...e]:[];n[o[0]]=await e9.validate(E,o[1],r,t,a,i),s.delete(o[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new ey(e9.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new ey(e9.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}var e$={};m(e$,"StringValidator",()=>eW);var ej={};m(ej,"StringFormat",()=>E),(r=E||(E={})).DATETIME="DATETIME",r.TIME="TIME",r.DATE="DATE",r.EMAIL="EMAIL",r.REGEX="REGEX";class eW{static{this.TIME=/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/}static{this.DATE=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])$/}static{this.DATETIME=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])T([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/}static{this.EMAIL=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/}static validate(e,t,r){if(_(r))throw new ey(e9.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new ey(e9.path(e),r.toString()+" is not String");t.getFormat()==E.TIME?eW.patternMatcher(e,t,r,eW.TIME,"time pattern"):t.getFormat()==E.DATE?eW.patternMatcher(e,t,r,eW.DATE,"date pattern"):t.getFormat()==E.DATETIME?eW.patternMatcher(e,t,r,eW.DATETIME,"date time pattern"):t.getFormat()==E.EMAIL?eW.patternMatcher(e,t,r,eW.EMAIL,"email pattern"):t.getPattern()&&eW.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let n=r.length;if(t.getMinLength()&&n<t.getMinLength())throw new ey(e9.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&n>t.getMaxLength())throw new ey(e9.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,n,s){if(!n.test(r))throw new ey(e9.path(e),r.toString()+" is not matched with the "+s)}constructor(){}}(n=u||(u={})).STRICT="STRICT",n.LENIENT="LENIENT",n.USE_DEFAULT="USE_DEFAULT",n.SKIP="SKIP";const eX=e=>u[e.toUpperCase()],eJ=()=>Object.values(u);class eq extends Error{constructor(e,t,r,n,s=[],a){super(r+(s?s.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.source=t??null,this.mode=n??null,this.cause=a}getSchemaPath(){return this.schemaPath}getSource(){return this.source??null}getMode(){return this.mode??null}getCause(){return this.cause}}class ez{static handleUnConvertibleValue(e,t,r,n){return this.handleUnConvertibleValueWithDefault(e,t,r,null,n)}static handleUnConvertibleValueWithDefault(e,t,r,n,s){switch(null===t&&(t=u.STRICT),t){case u.STRICT:throw new eq(e9.path(e),r,s,t);case u.LENIENT:return null;case u.USE_DEFAULT:return n;case u.SKIP:return r;default:throw new eq(e9.path(e),r,"Invalid conversion mode")}}constructor(){}}class eK{static convert(e,t,r,n){if(_(n))return ez.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Expected a string but found null");let s=n??("object"==typeof n?JSON.stringify(n):String(n));return this.getConvertedString(s,r)}static getConvertedString(e,t){return t===u.STRICT?e.toString():e.trim()}static getDefault(e){return e.getDefaultValue()??null}constructor(){}}class eQ{static convert(e,t,r,n,s){if(_(s))return ez.handleUnConvertibleValueWithDefault(e,n,s,this.getDefault(r),"Expected a number but found null");if("object"==typeof s||"boolean"==typeof s||Array.isArray(s)||"string"==typeof s&&isNaN(s=Number(s)))return ez.handleUnConvertibleValueWithDefault(e,n,s,this.getDefault(r),s+" is not a "+t);let a=this.extractNumber(t,s,n);return null===a?ez.handleUnConvertibleValueWithDefault(e,n,s,this.getDefault(r),s+" is not a "+t):a}static extractNumber(e,t,r){if("number"!=typeof t)return null;switch(e){case i.INTEGER:return this.isInteger(t,r)?Math.floor(t):null;case i.LONG:return this.isLong(t,r)?Math.floor(t):null;case i.DOUBLE:return t;case i.FLOAT:return this.isFloat(t,r)?t:null;default:return null}}static isInteger(e,t){return t!==u.STRICT?"number"==typeof e:Number.isInteger(e)}static isLong(e,t){return t!==u.STRICT?"number"==typeof e:Number.isInteger(e)&&e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER}static isFloat(e,t){return t!==u.STRICT?"number"==typeof e:e>=-Number.MAX_VALUE&&e<=Number.MAX_VALUE}static getDefault(e){return"number"==typeof e.getDefaultValue()?Number(e.getDefaultValue):null}}class eZ{static{this.BOOLEAN_MAP={true:!0,t:!0,yes:!0,y:!0,1:!0,false:!1,f:!1,no:!1,n:!1,0:!1}}static convert(e,t,r,n){return null==n?ez.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Expected a boolean but found null"):this.getBooleanPrimitive(n)??ez.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Unable to convert to boolean")}static getBooleanPrimitive(e){return"boolean"==typeof e?e:"string"==typeof e?this.handleStringValue(e):"number"==typeof e?this.handleNumberValue(e):null}static handleStringValue(e){let t=e.toLowerCase().trim();return eZ.BOOLEAN_MAP[t]??null}static handleNumberValue(e){return 0===e||1===e?1===e:null}static getDefault(e){return e.getDefaultValue()??!1}constructor(){}}class e0{static convert(e,t,r,n){return _(n)?n:"string"==typeof n&&"null"===n.toLowerCase()?null:ez.handleUnConvertibleValueWithDefault(e,r,n,null,"Unable to convert to null")}constructor(){}}class e1{static handleValidationError(e,t,r,n,s){switch(t=t??u.STRICT){case u.STRICT:throw new ey(e9.path(e),s);case u.LENIENT:return null;case u.USE_DEFAULT:return n;case u.SKIP:return r}}constructor(){}}class e2{static async validate(e,t,r,n,s,a,o){return t==i.OBJECT?await ek.validate(e,r,n,s,a,o):t==i.ARRAY?await eC.validate(e,r,n,s,a,o):this.handleTypeValidationAndConversion(e,t,r,s,a,o)}static async handleTypeValidationAndConversion(e,t,r,n,s,a){let i=s?this.convertElement(e,t,r,n,a??u.STRICT):n;return await this.validateElement(e,t,r,i,a??u.STRICT)}static convertElement(e,t,r,n,s){if(_(t))return ez.handleUnConvertibleValueWithDefault(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type for conversion.",t));switch(t){case i.STRING:return eK.convert(e,r,s,n);case i.INTEGER:case i.LONG:case i.DOUBLE:case i.FLOAT:return eQ.convert(e,t,r,s,n);case i.BOOLEAN:return eZ.convert(e,r,s,n);case i.NULL:return e0.convert(e,r,s,n);default:return ez.handleUnConvertibleValueWithDefault(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type for conversion.",t))}}static validateElement(e,t,r,n,s){if(_(t))return e1.handleValidationError(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type.",t));switch(t){case i.STRING:return eW.validate(e,r,n);case i.INTEGER:case i.LONG:case i.DOUBLE:case i.FLOAT:return eY.validate(t,e,r,n);case i.BOOLEAN:return eG.validate(e,r,n);case i.NULL:return eF.validate(e,r,n);default:return e1.handleValidationError(e,s,n,r.getDefaultValue()??null,ec.format("$ is not a valid type.",t))}}constructor(){}}class e9{static{this.ORDER={[i.OBJECT]:0,[i.ARRAY]:1,[i.DOUBLE]:2,[i.FLOAT]:3,[i.LONG]:4,[i.INTEGER]:5,[i.STRING]:6,[i.BOOLEAN]:7,[i.NULL]:8}}static path(e){return e?e.map(e=>e.getTitle()??"").filter(e=>!!e).reduce((e,t,r)=>e+(0===r?"":".")+t,""):""}static async validate(e,t,r,n,s,a){if(!t)throw new ey(e9.path(e),"No schema found to validate");if(e||(e=[]),e.push(t),_(n)&&!_(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(!_(t.getConstant()))return e9.constantValidation(e,t,n);if(t.getEnums()&&!t.getEnums()?.length)return e9.enumCheck(e,t,n);if(t.getFormat()&&_(t.getType()))throw new ey(this.path(e),"Type is missing in schema for declared "+t.getFormat()?.toString()+" format.");if(!0===s&&_(t.getType()))throw new ey(this.path(e),"Type is missing in schema for declared "+a);if(t.getType()&&(n=await e9.typeValidation(e,t,r,n,s,a)),!eM.isNullOrBlank(t.getRef()))return await e9.validate(e,await ex.getSchemaFromRef(e[0],r,t.getRef()),r,n,s,a);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&(n=await ev.validate(e,t,r,n,s,a)),t.getNot()){let i;try{await e9.validate(e,t.getNot(),r,n,s,a),i=!0}catch(e){i=!1}if(i)throw new ey(e9.path(e),"Schema validated value in not condition.")}return n}static constantValidation(e,t,r){if(!ef(t.getConstant(),r))throw new ey(e9.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let n=!1;for(let e of t.getEnums()??[])if(e===r){n=!0;break}if(n)return r;throw new ey(e9.path(e),"Value is not one of "+t.getEnums())}static async typeValidation(e,t,r,n,s,a){let i=Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]).sort((e,t)=>(this.ORDER[e]??1/0)-(this.ORDER[t]??1/0)),o=[];for(let E of i)try{return await e2.validate(e,E,t,r,n,s,a)}catch(e){o.push(e)}throw new ey(e9.path(e),"Value "+JSON.stringify(n)+" is not of valid type(s)",o)}constructor(){}}class e3{async validateArguments(e,t,r){let n=new Map;for(let s of Array.from(this.getSignature().getParameters().entries())){let a=s[1];try{let r=await this.validateArgument(e,t,s,a);n.set(r.getT1(),r.getT2())}catch(t){let e=this.getSignature();throw new eE(`Error while executing the function ${e.getNamespace()}.${e.getName()}'s parameter ${a.getParameterName()} with step name '${r?.getStatement().getStatementName()??"Unknown Step"}' with error : ${t?.message}`)}}return n}async validateArgument(e,t,r,n){let s,a=r[0],i=e.get(r[0]);if(_(i)&&!n.isVariableArgument())return new ew(a,await e9.validate(void 0,n.getSchema(),t,void 0));if(!n?.isVariableArgument())return new ew(a,await e9.validate(void 0,n.getSchema(),t,i));Array.isArray(i)?s=i:(s=[],_(i)?_(n.getSchema().getDefaultValue())||s.push(n.getSchema().getDefaultValue()):s.push(i));for(let e=0;e<s.length;e++)s[e]=await e9.validate(void 0,n.getSchema(),t,s[e]);return new ew(a,s)}async execute(e){let t=await this.validateArguments(e.getArguments()??new Map,e.getSchemaRepository(),e.getStatementExecution());e.setArguments(t);try{return await this.internalExecute(e)}catch(r){let t=this.getSignature();throw new eE(`Error while executing the function ${t.getNamespace()}.${t.getName()} with step name '${e.getStatementExecution()?.getStatement().getStatementName()??"Unknown Step"}' with error : ${r?.message}`)}}getProbableEventSignature(e){return this.getSignature().getEvents()}}class e4 extends e3{static{this.EVENT_INDEX_NAME="index"}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_INDEX=new es(es.OUTPUT,q.of(e4.EVENT_INDEX_NAME,Y.ofInteger(e4.EVENT_INDEX_NAME)))}static{this.EVENT_RESULT_INTEGER=new es(es.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofInteger(e4.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_BOOLEAN=new es(es.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofBoolean(e4.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_ARRAY=new es(es.OUTPUT,q.of(e4.EVENT_RESULT_NAME,Y.ofArray(e4.EVENT_RESULT_NAME,Y.ofAny(e4.EVENT_RESULT_NAME))))}static{this.EVENT_RESULT_EMPTY=new es(es.OUTPUT,q.of())}static{this.EVENT_RESULT_ANY=new es(es.OUTPUT,q.of(this.EVENT_RESULT_NAME,Y.ofAny(this.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_OBJECT=new es(es.OUTPUT,q.of(this.EVENT_RESULT_NAME,Y.ofObject(this.EVENT_RESULT_NAME)))}static{this.PARAMETER_INT_LENGTH=X.of("length",Y.ofInteger("length").setDefaultValue(-1))}static{this.PARAMETER_ARRAY_FIND=X.of("find",Y.ofArray("eachFind",Y.ofAny("eachFind")))}static{this.PARAMETER_INT_SOURCE_FROM=X.of("srcFrom",Y.ofInteger("srcFrom").setDefaultValue(0).setMinimum(0))}static{this.PARAMETER_INT_SECOND_SOURCE_FROM=X.of("secondSrcFrom",Y.ofInteger("secondSrcFrom").setDefaultValue(0))}static{this.PARAMETER_INT_FIND_FROM=X.of("findFrom",Y.ofInteger("findFrom").setDefaultValue(0))}static{this.PARAMETER_INT_OFFSET=X.of("offset",Y.ofInteger("offset").setDefaultValue(0))}static{this.PARAMETER_ROTATE_LENGTH=X.of("rotateLength",Y.ofInteger("rotateLength").setDefaultValue(1).setMinimum(1))}static{this.PARAMETER_BOOLEAN_ASCENDING=X.of("ascending",Y.ofBoolean("ascending").setDefaultValue(!0))}static{this.PARAMETER_KEY_PATH=X.of("keyPath",Y.ofString("keyPath").setDefaultValue(""))}static{this.PARAMETER_FIND_PRIMITIVE=X.of("findPrimitive",Y.of("findPrimitive",i.STRING,i.DOUBLE,i.FLOAT,i.INTEGER,i.LONG))}static{this.PARAMETER_ARRAY_SOURCE=X.of("source",Y.ofArray("eachSource",Y.ofAny("eachSource")))}static{this.PARAMETER_ARRAY_SECOND_SOURCE=X.of("secondSource",Y.ofArray("eachSecondSource",Y.ofAny("eachSecondSource")))}static{this.PARAMETER_ARRAY_SOURCE_PRIMITIVE=X.of("source",Y.ofArray("eachSource",new Y().setName("eachSource").setType(L.of(i.STRING,i.NULL,i.INTEGER,i.FLOAT,i.DOUBLE,i.LONG))))}static{this.PARAMETER_BOOLEAN_DEEP_COPY=X.of("deepCopy",Y.ofBoolean("deepCopy").setDefaultValue(!0))}static{this.PARAMETER_ANY=X.of("element",Y.ofAny("element"))}static{this.PARAMETER_ANY_ELEMENT_OBJECT=X.of("elementObject",Y.ofAny("elementObject"))}static{this.PARAMETER_ANY_VAR_ARGS=X.of("element",Y.ofAny("element")).setVariableArgument(!0)}static{this.PARAMETER_ARRAY_RESULT=X.of(e4.EVENT_RESULT_NAME,Y.ofArray("eachResult",Y.ofAny("eachResult")))}constructor(e,t,r){super();let n=new Map;for(let e of t)n.set(e.getParameterName(),e);this.signature=new eT(e).setNamespace(p.SYSTEM_ARRAY).setParameters(n).setEvents(q.of(r.getName(),r))}getSignature(){return this.signature}}class e5 extends e4{constructor(){super("Concatenate",[e4.PARAMETER_ARRAY_SOURCE,e4.PARAMETER_ARRAY_SECOND_SOURCE],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName());return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,[...t,...r]]]))])}}class e6 extends e4{constructor(){super("AddFirst",[e4.PARAMETER_ARRAY_SOURCE,e4.PARAMETER_ANY],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e4.PARAMETER_ANY.getParameterName());if(0==(t=[...t]).length)return t.push(r),new eu([ea.outputOf(new Map([]))]);t.push(r);let n=t.length-1;for(;n>0;){let e=t[n-1];t[n-1]=t[n],t[n--]=e}return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}const e7="keyName";class e8 extends e4{constructor(){super("ArrayToArrayOfObjects",[e4.PARAMETER_ARRAY_SOURCE,X.of(e7,Y.ofString(e7),!0)],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e8.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e7);if(!t?.length)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,[]]]))]);let n=t.map(e=>{let t={};if(Array.isArray(e)){if(r.length)r.forEach((r,n)=>{t[r]=e[n]});else for(let r=0;r<e.length;r++)t[`value${r+1}`]=e[r]}else t[r.length?r[0]:"value"]=e;return t});return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,n]]))])}}var te={};m(te,"PrimitiveUtil",()=>tn);var tt={};m(tt,"ExecutionException",()=>tr);class tr extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class tn{static findPrimitiveNullAsBoolean(e){if(_(e))return new ew(i.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new tr(ec.format("$ is not a primitive type",e));return"boolean"===t?new ew(i.BOOLEAN,e):"string"===t?new ew(i.STRING,e):tn.findPrimitiveNumberType(e)}static findPrimitive(e){if(_(e))return new ew(i.NULL,void 0);let t=typeof e;if("object"===t)throw new tr(ec.format("$ is not a primitive type",e));return"boolean"===t?new ew(i.BOOLEAN,e):"string"===t?new ew(i.STRING,e):tn.findPrimitiveNumberType(e)}static findPrimitiveNumberType(e){if(_(e)||Array.isArray(e)||"object"==typeof e)throw new tr(ec.format("Unable to convert $ to a number.",e));try{if(Number.isInteger(e))return new ew(i.LONG,e);return new ew(i.DOUBLE,e)}catch(t){throw new tr(ec.format("Unable to convert $ to a number.",e),t)}}static compare(e,t){if(e==t)return 0;if(_(e)||_(t))return _(e)?-1:1;if(Array.isArray(e)||Array.isArray(t)){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!=t.length)return e.length-t.length;for(let r=0;r<e.length;r++){let n=this.compare(e[r],t[r]);if(0!=n)return n}return 0}return Array.isArray(e)?-1:1}let r=typeof e,n=typeof t;return"object"===r||"object"===n?("object"===r&&"object"===n&&Object.keys(e).forEach(r=>{let n=this.compare(e[r],t[r]);if(0!=n)return n}),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return _(e)||_(t)?_(e)&&_(t)?0:_(e)?-1:1:e==t?0:"boolean"==typeof e||"boolean"==typeof t?e?-1:1:"string"==typeof e||"string"==typeof t?e+""<t+""?-1:1:"number"==typeof e||"number"==typeof t?e-t:0}static baseNumberType(e){return Number.isInteger(e)?i.LONG:i.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class ts extends e4{constructor(){super("BinarySearch",[ts.PARAMETER_ARRAY_SOURCE_PRIMITIVE,ts.PARAMETER_INT_SOURCE_FROM,ts.PARAMETER_FIND_PRIMITIVE,ts.PARAMETER_INT_LENGTH],ts.EVENT_INDEX)}async internalExecute(e){let t=e?.getArguments()?.get(ts.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ts.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(ts.PARAMETER_FIND_PRIMITIVE.getParameterName()),s=e?.getArguments()?.get(ts.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length||r<0||r>t.length)throw new eE("Search source array cannot be empty");if(-1==s&&(s=t.length-r),(s=r+s)>t.length)throw new eE("End point for array cannot be more than the size of the source array");let a=-1;for(;r<=s;){let e=Math.floor((r+s)/2);if(0==tn.compare(t[e],n)){a=e;break}tn.compare(t[e],n)>0?s=e-1:r=e+1}return new eu([ea.outputOf(new Map([[ts.EVENT_INDEX_NAME,a]]))])}}var ta={};m(ta,"ArrayUtil",()=>ti);class ti{static removeAListFrom(e,t){if(!t||!e||!e.length||!t.length)return;let r=new Set(t);for(let t=0;t<e.length;t++)r.has(e[t])&&(e.splice(t,1),t--)}static of(...e){let t=Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r];return t}constructor(){}}class to extends e4{constructor(){super("Compare",ti.of(to.PARAMETER_ARRAY_SOURCE,to.PARAMETER_INT_SOURCE_FROM,to.PARAMETER_ARRAY_FIND,to.PARAMETER_INT_FIND_FROM,to.PARAMETER_INT_LENGTH),to.EVENT_RESULT_INTEGER)}async internalExecute(e){var t=e?.getArguments()?.get(to.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(to.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(to.PARAMETER_ARRAY_FIND.getParameterName()),s=e?.getArguments()?.get(to.PARAMETER_INT_FIND_FROM.getParameterName()),a=e?.getArguments()?.get(to.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new eE("Compare source array cannot be empty");if(0==n.length)throw new eE("Compare find array cannot be empty");if(-1==a&&(a=t.length-r),r+a>t.length)throw new eE(ec.format("Source array size $ is less than comparing size $",t.length,r+a));if(s+a>n.length)throw new eE(ec.format("Find array size $ is less than comparing size $",n.length,s+a));return new eu(ti.of(ea.outputOf(q.of(to.EVENT_RESULT_NAME,this.compare(t,r,r+a,n,s,s+a)))))}compare(e,t,r,n,s,a){if(r<t){let e=t;t=r,r=e}if(a<s){let e=s;s=a,a=e}if(r-t!=a-s)throw new eE(ec.format("Cannot compare uneven arrays from $ to $ in source array with $ to $ in find array",r,t,a,s));for(let a=t,i=s;a<r;a++,i++){let t=1;if(_(e[a])||_(n[i])){let r=_(e[a]);r==_(n[i])?t=0:r&&(t=-1)}else{let r=typeof e[a],s=typeof n[i];if("object"===r||"object"===s)t=1;else if("string"===r||"string"===s){let r=""+e[a],s=""+n[i];r===s?t=0:r<s&&(t=-1)}else"boolean"===r||"boolean"===s?t=r==s?0:1:"number"===r&&"number"===s&&(t=e[a]-n[i])}if(0!=t)return t}return 0}}var tE={};function tu(e){return e?globalThis.structuredClone?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e)):e}m(tE,"duplicate",()=>tu);class tA extends e4{constructor(){super("Copy",[tA.PARAMETER_ARRAY_SOURCE,tA.PARAMETER_INT_SOURCE_FROM,tA.PARAMETER_INT_LENGTH,tA.PARAMETER_BOOLEAN_DEEP_COPY],tA.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tA.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tA.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tA.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new eE(ec.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));var s=e?.getArguments()?.get(tA.PARAMETER_BOOLEAN_DEEP_COPY.getParameterName());let a=Array(n);for(let e=r;e<r+n;e++)_(t[e])||(a[e-r]=s?tu(t[e]):t[e]);return new eu([ea.outputOf(q.of(tA.EVENT_RESULT_NAME,a))])}}class tT extends e4{constructor(){super("Delete",[e4.PARAMETER_ARRAY_SOURCE,e4.PARAMETER_ANY_VAR_ARGS],e4.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tT.PARAMETER_ANY_VAR_ARGS.getParameterName());if(null==r)throw new eE("The deletable var args are empty. So cannot be proceeded further.");if(0==t.length||0==r.length)throw new eE("Expected a source or deletable for an array but not found any");let n=new Set;for(let e=t.length-1;e>=0;e--)for(let s=0;s<r.length;s++)n.has(e)||0!=tn.compare(t[e],r[s])||n.add(t[e]);return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t.filter(e=>!n.has(e))]]))])}}class tl extends e4{constructor(){super("DeleteFirst",[tl.PARAMETER_ARRAY_SOURCE],tl.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tl.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new eE("Given source array is empty");return(t=[...t]).shift(),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tR extends e4{constructor(){super("DeleteFrom",[tR.PARAMETER_ARRAY_SOURCE,tR.PARAMETER_INT_SOURCE_FROM,tR.PARAMETER_INT_LENGTH],tR.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tR.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tR.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tR.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new eE("There are no elements to be deleted");if(r>=(t=[...t]).length||r<0)throw new eE("The int source for the array should be in between 0 and length of the array ");if(-1==n&&(n=t.length-r),r+n>t.length)throw new eE("Requested length to be deleted is more than the size of array ");return t.splice(r,n),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tm extends e4{constructor(){super("DeleteLast",[tm.PARAMETER_ARRAY_SOURCE],tm.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tm.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new eE("Given source array is empty");return(t=[...t]).pop(),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tg extends e4{constructor(){super("Disjoint",[tg.PARAMETER_ARRAY_SOURCE,tg.PARAMETER_INT_SOURCE_FROM,tg.PARAMETER_ARRAY_SECOND_SOURCE,tg.PARAMETER_INT_SECOND_SOURCE_FROM,tg.PARAMETER_INT_LENGTH],tg.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tg.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tg.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tg.PARAMETER_INT_LENGTH.getParameterName());if(-1==a&&(a=t.length<=n.length?t.length-r:n.length-s),a>t.length||a>n.length||r+a>t.length||s+a>n.length)throw new eE("The length which was being requested is more than than the size either source array or second source array");let i=new Set,o=new Set;for(let e=0;e<a;e++)i.add(t[e+r]);for(let e=0;e<a;e++)o.add(n[e+s]);let E=new Set;return i.forEach(e=>{o.has(e)?o.delete(e):E.add(e)}),o.forEach(e=>{i.has(e)||E.add(e)}),new eu([ea.outputOf(new Map([[tg.EVENT_RESULT_NAME,[...E]]]))])}}class th extends e4{constructor(){super("Equals",[th.PARAMETER_ARRAY_SOURCE,th.PARAMETER_INT_SOURCE_FROM,th.PARAMETER_ARRAY_FIND,th.PARAMETER_INT_FIND_FROM,th.PARAMETER_INT_LENGTH],th.EVENT_RESULT_BOOLEAN)}async internalExecute(e){let t=new to,r=(await t.execute(e)).allResults()[0].getResult().get(th.EVENT_RESULT_NAME);return new eu([ea.outputOf(q.of(th.EVENT_RESULT_NAME,0==r))])}}class tc extends e4{constructor(){super("Fill",[tc.PARAMETER_ARRAY_SOURCE,tc.PARAMETER_INT_SOURCE_FROM,tc.PARAMETER_INT_LENGTH,tc.PARAMETER_ANY],tc.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tc.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tc.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tc.PARAMETER_INT_LENGTH.getParameterName()),s=e?.getArguments()?.get(tc.PARAMETER_ANY.getParameterName());if(r<0)throw new eE(ec.format("Arrays out of bound trying to access $ index",r));-1==n&&(n=t.length-r);let a=r+n-t.length;if(t=[...t],a>0)for(let e=0;e<a;e++)t.push();for(let e=r;e<r+n;e++)t[e]=_(s)?s:tu(s);return new eu([ea.outputOf(q.of(e4.EVENT_RESULT_NAME,t))])}}class tp extends e4{constructor(){super("Frequency",[tp.PARAMETER_ARRAY_SOURCE,tp.PARAMETER_ANY,tp.PARAMETER_INT_SOURCE_FROM,tp.PARAMETER_INT_LENGTH],tp.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tp.PARAMETER_ANY.getParameterName()),n=e?.getArguments()?.get(tp.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tp.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[tp.EVENT_RESULT_NAME,0]]))]);if(n>t.length)throw new eE("Given start point is more than the size of source");let a=n+s;if(-1==s&&(a=t.length-n),a>t.length)throw new eE("Given length is more than the size of source");let i=0;for(let e=n;e<a&&e<t.length;e++)0==tn.compare(t[e],r)&&i++;return new eu([ea.outputOf(new Map([[tp.EVENT_RESULT_NAME,i]]))])}}class tN extends e4{constructor(){super("IndexOf",[tN.PARAMETER_ARRAY_SOURCE,tN.PARAMETER_ANY_ELEMENT_OBJECT,tN.PARAMETER_INT_FIND_FROM],tN.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tN.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tN.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),n=e?.getArguments()?.get(tN.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[tN.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new eE("The size of the search index of the array is greater than the size of the array");let s=-1;for(let e=n;e<t.length;e++)if(0==tn.compare(t[e],r)){s=e;break}return new eu([ea.outputOf(new Map([[tN.EVENT_RESULT_NAME,s]]))])}}class tf extends e4{constructor(){super("IndexOfArray",[tf.PARAMETER_ARRAY_SOURCE,tf.PARAMETER_ARRAY_SECOND_SOURCE,tf.PARAMETER_INT_FIND_FROM],tf.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tf.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length||0==r.length)return new eu([ea.outputOf(new Map([[tf.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||t.length<r.length)throw new eE("Given from second source is more than the size of the source array");let s=r.length,a=-1;for(let e=n;e<t.length;e++){let n=0;if(0==tn.compare(t[e],r[n])){for(;n<s&&0==tn.compare(t[e+n],r[n]);)n++;if(n==s){a=e;break}}}return new eu([ea.outputOf(new Map([[tf.EVENT_RESULT_NAME,a]]))])}}class t_ extends e4{constructor(){super("LastIndexOf",[t_.PARAMETER_ARRAY_SOURCE,t_.PARAMETER_ANY_ELEMENT_OBJECT,t_.PARAMETER_INT_FIND_FROM],t_.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t_.PARAMETER_ANY_ELEMENT_OBJECT.getParameterName()),n=e?.getArguments()?.get(t_.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[t_.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new eE("The value of length shouldn't the exceed the size of the array or shouldn't be in terms");let s=-1;for(let e=t.length-1;e>=n;e--)if(0==tn.compare(t[e],r)){s=e;break}return new eu([ea.outputOf(new Map([[t_.EVENT_RESULT_NAME,s]]))])}}class tM extends e4{constructor(){super("LastIndexOfArray",[tM.PARAMETER_ARRAY_SOURCE,tM.PARAMETER_ARRAY_SECOND_SOURCE,tM.PARAMETER_INT_FIND_FROM],tM.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tM.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tM.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tM.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[tM.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||r.length>t.length)throw new eE("Given from index is more than the size of the source array");let s=r.length,a=-1;for(let e=n;e<t.length;e++){let n=0;if(0==tn.compare(t[e],r[n])){for(;n<s&&0==tn.compare(t[e+n],r[n]);)n++;n==s&&(a=e)}}return new eu([ea.outputOf(new Map([[tM.EVENT_RESULT_NAME,a]]))])}}class tS extends e4{constructor(){super("Max",[tS.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tS.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tS.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==t.length)throw new eE("Search source array cannot be empty");let r=t[0];for(let e=1;e<t.length;e++){let n=t[e];tn.comparePrimitive(r,n)>=0||(r=n)}return new eu([ea.outputOf(new Map([[tS.EVENT_RESULT_NAME,r]]))])}}class tO extends e4{constructor(){super("Min",[tO.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tO.EVENT_RESULT_ANY)}async internalExecute(e){let t,r=e?.getArguments()?.get(tO.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==r.length)throw new eE("Search source array cannot be empty");for(let e=0;e<r.length;e++)!_(r[e])&&(void 0===t||0>tn.comparePrimitive(r[e],t))&&(t=r[e]);return new eu([ea.outputOf(new Map([[tO.EVENT_RESULT_NAME,t]]))])}}class tw extends e4{constructor(){super("MisMatch",[tw.PARAMETER_ARRAY_SOURCE,tw.PARAMETER_INT_FIND_FROM,tw.PARAMETER_ARRAY_SECOND_SOURCE,tw.PARAMETER_INT_SECOND_SOURCE_FROM,tw.PARAMETER_INT_LENGTH],tw.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tw.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tw.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tw.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tw.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tw.PARAMETER_INT_LENGTH.getParameterName()),i=r<t.length&&r>0?r:0,o=s<n.length&&s>0?s:0;if(i+a>=t.length||o+a>n.length)throw new eE("The size of the array for first and second which was being requested is more than size of the given array");let E=-1;for(let e=0;e<a;e++)if(t[i+e]!=n[o+e]){E=e;break}return new eu([ea.outputOf(new Map([[tw.EVENT_RESULT_NAME,E]]))])}}class tI extends e4{constructor(){super("Reverse",[tI.PARAMETER_ARRAY_SOURCE,tI.PARAMETER_INT_SOURCE_FROM,tI.PARAMETER_INT_LENGTH],tI.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tI.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tI.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tI.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n>=t.length||n<0||r<0)throw new eE("Please provide start point between the start and end indexes or provide the length which was less than the source size ");t=[...t];let s=r+n-1;for(;r<=s;){let e=t[r],n=t[s];t[r++]=n,t[s--]=e}return new eu([ea.outputOf(new Map([[tI.EVENT_RESULT_NAME,t]]))])}}class tP extends e4{constructor(){super("Rotate",[tP.PARAMETER_ARRAY_SOURCE,tP.PARAMETER_ROTATE_LENGTH],tP.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tP.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tP.PARAMETER_ROTATE_LENGTH.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);let n=(t=[...t]).length;return r%=n,this.rotate(t,0,r-1),this.rotate(t,r,n-1),this.rotate(t,0,n-1),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}rotate(e,t,r){for(;t<r;){let n=e[t];e[t++]=e[r],e[r--]=n}}}class td extends e4{constructor(){super("Shuffle",[td.PARAMETER_ARRAY_SOURCE],td.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(td.PARAMETER_ARRAY_SOURCE.getParameterName());if(t.length<=1)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);let r=0,n=(t=[...t]).length;for(let e=0;e<n;e++){let e=Math.floor(Math.random()*n)%n,s=t[r];t[r]=t[e],t[e]=s,r=e}return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}var ty={};m(ty,"ObjectValueSetterExtractor",()=>t$);var tx={};m(tx,"Expression",()=>tY);var tL={};m(tL,"StringBuilder",()=>tv);class tv{constructor(e){this.str=e??""}append(e){return this.str+=e,this}toString(){return""+this.str}trim(){return this.str=this.str.trim(),this}setLength(e){return this.str=this.str.substring(0,e),this}length(){return this.str.length}charAt(e){return this.str.charAt(e)}deleteCharAt(e){return this.checkIndex(e),this.str=this.str.substring(0,e)+this.str.substring(e+1),this}insert(e,t){return this.str=this.str.substring(0,e)+t+this.str.substring(e),this}checkIndex(e){if(e>=this.str.length)throw new eE(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var tU={};m(tU,"ExpressionEvaluationException",()=>tV);class tV extends Error{constructor(e,t,r){super(ec.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var tC={};m(tC,"ExpressionToken",()=>tD);class tD{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var tG={};m(tG,"ExpressionTokenValue",()=>tb);class tb extends tD{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return ec.format("$: $",this.expression,this.element)}}var tF={};m(tF,"Operation",()=>tB);class tB{static{this.MULTIPLICATION=new tB("*")}static{this.DIVISION=new tB("/")}static{this.INTEGER_DIVISION=new tB("//")}static{this.MOD=new tB("%")}static{this.ADDITION=new tB("+")}static{this.SUBTRACTION=new tB("-")}static{this.NOT=new tB("not",void 0,!0)}static{this.AND=new tB("and",void 0,!0)}static{this.OR=new tB("or",void 0,!0)}static{this.LESS_THAN=new tB("<")}static{this.LESS_THAN_EQUAL=new tB("<=")}static{this.GREATER_THAN=new tB(">")}static{this.GREATER_THAN_EQUAL=new tB(">=")}static{this.EQUAL=new tB("=")}static{this.NOT_EQUAL=new tB("!=")}static{this.BITWISE_AND=new tB("&")}static{this.BITWISE_OR=new tB("|")}static{this.BITWISE_XOR=new tB("^")}static{this.BITWISE_COMPLEMENT=new tB("~")}static{this.BITWISE_LEFT_SHIFT=new tB("<<")}static{this.BITWISE_RIGHT_SHIFT=new tB(">>")}static{this.BITWISE_UNSIGNED_RIGHT_SHIFT=new tB(">>>")}static{this.UNARY_PLUS=new tB("UN: +","+")}static{this.UNARY_MINUS=new tB("UN: -","-")}static{this.UNARY_LOGICAL_NOT=new tB("UN: not","not")}static{this.UNARY_BITWISE_COMPLEMENT=new tB("UN: ~","~")}static{this.ARRAY_OPERATOR=new tB("[")}static{this.OBJECT_OPERATOR=new tB(".")}static{this.NULLISH_COALESCING_OPERATOR=new tB("??")}static{this.CONDITIONAL_TERNARY_OPERATOR=new tB("?")}static{this.VALUE_OF=new Map([["MULTIPLICATION",tB.MULTIPLICATION],["DIVISION",tB.DIVISION],["INTEGER_DIVISON",tB.INTEGER_DIVISION],["MOD",tB.MOD],["ADDITION",tB.ADDITION],["SUBTRACTION",tB.SUBTRACTION],["NOT",tB.NOT],["AND",tB.AND],["OR",tB.OR],["LESS_THAN",tB.LESS_THAN],["LESS_THAN_EQUAL",tB.LESS_THAN_EQUAL],["GREATER_THAN",tB.GREATER_THAN],["GREATER_THAN_EQUAL",tB.GREATER_THAN_EQUAL],["EQUAL",tB.EQUAL],["NOT_EQUAL",tB.NOT_EQUAL],["BITWISE_AND",tB.BITWISE_AND],["BITWISE_OR",tB.BITWISE_OR],["BITWISE_XOR",tB.BITWISE_XOR],["BITWISE_COMPLEMENT",tB.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",tB.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",tB.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",tB.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",tB.UNARY_PLUS],["UNARY_MINUS",tB.UNARY_MINUS],["UNARY_LOGICAL_NOT",tB.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",tB.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",tB.ARRAY_OPERATOR],["OBJECT_OPERATOR",tB.OBJECT_OPERATOR],["NULLISH_COALESCING_OPERATOR",tB.NULLISH_COALESCING_OPERATOR],["CONDITIONAL_TERNARY_OPERATOR",tB.CONDITIONAL_TERNARY_OPERATOR]])}static{this.UNARY_OPERATORS=new Set([tB.ADDITION,tB.SUBTRACTION,tB.NOT,tB.BITWISE_COMPLEMENT,tB.UNARY_PLUS,tB.UNARY_MINUS,tB.UNARY_LOGICAL_NOT,tB.UNARY_BITWISE_COMPLEMENT])}static{this.ARITHMETIC_OPERATORS=new Set([tB.MULTIPLICATION,tB.DIVISION,tB.INTEGER_DIVISION,tB.MOD,tB.ADDITION,tB.SUBTRACTION])}static{this.LOGICAL_OPERATORS=new Set([tB.NOT,tB.AND,tB.OR,tB.LESS_THAN,tB.LESS_THAN_EQUAL,tB.GREATER_THAN,tB.GREATER_THAN_EQUAL,tB.EQUAL,tB.NOT_EQUAL,tB.NULLISH_COALESCING_OPERATOR])}static{this.BITWISE_OPERATORS=new Set([tB.BITWISE_AND,tB.BITWISE_COMPLEMENT,tB.BITWISE_LEFT_SHIFT,tB.BITWISE_OR,tB.BITWISE_RIGHT_SHIFT,tB.BITWISE_UNSIGNED_RIGHT_SHIFT,tB.BITWISE_XOR])}static{this.CONDITIONAL_OPERATORS=new Set([tB.CONDITIONAL_TERNARY_OPERATOR])}static{this.OPERATOR_PRIORITY=new Map([[tB.UNARY_PLUS,1],[tB.UNARY_MINUS,1],[tB.UNARY_LOGICAL_NOT,1],[tB.UNARY_BITWISE_COMPLEMENT,1],[tB.ARRAY_OPERATOR,1],[tB.OBJECT_OPERATOR,1],[tB.MULTIPLICATION,2],[tB.DIVISION,2],[tB.INTEGER_DIVISION,2],[tB.MOD,2],[tB.ADDITION,3],[tB.SUBTRACTION,3],[tB.BITWISE_LEFT_SHIFT,4],[tB.BITWISE_RIGHT_SHIFT,4],[tB.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[tB.LESS_THAN,5],[tB.LESS_THAN_EQUAL,5],[tB.GREATER_THAN,5],[tB.GREATER_THAN_EQUAL,5],[tB.EQUAL,6],[tB.NOT_EQUAL,6],[tB.BITWISE_AND,7],[tB.BITWISE_XOR,8],[tB.BITWISE_OR,9],[tB.AND,10],[tB.OR,11],[tB.NULLISH_COALESCING_OPERATOR,11],[tB.CONDITIONAL_TERNARY_OPERATOR,12]])}static{this.OPERATORS=new Set([...Array.from(tB.ARITHMETIC_OPERATORS),...Array.from(tB.LOGICAL_OPERATORS),...Array.from(tB.BITWISE_OPERATORS),tB.ARRAY_OPERATOR,tB.OBJECT_OPERATOR,...Array.from(tB.CONDITIONAL_OPERATORS)].map(e=>e.getOperator()))}static{this.OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(tB.ARITHMETIC_OPERATORS),...Array.from(tB.LOGICAL_OPERATORS),...Array.from(tB.BITWISE_OPERATORS),tB.ARRAY_OPERATOR,tB.OBJECT_OPERATOR,...Array.from(tB.CONDITIONAL_OPERATORS)].filter(e=>!e.shouldBeWrappedInSpace()).map(e=>e.getOperator()))}static{this.OPERATION_VALUE_OF=new Map(Array.from(tB.VALUE_OF.entries()).map(([e,t])=>[t.getOperator(),t]))}static{this.UNARY_MAP=new Map([[tB.ADDITION,tB.UNARY_PLUS],[tB.SUBTRACTION,tB.UNARY_MINUS],[tB.NOT,tB.UNARY_LOGICAL_NOT],[tB.BITWISE_COMPLEMENT,tB.UNARY_BITWISE_COMPLEMENT],[tB.UNARY_PLUS,tB.UNARY_PLUS],[tB.UNARY_MINUS,tB.UNARY_MINUS],[tB.UNARY_LOGICAL_NOT,tB.UNARY_LOGICAL_NOT],[tB.UNARY_BITWISE_COMPLEMENT,tB.UNARY_BITWISE_COMPLEMENT]])}static{this.BIGGEST_OPERATOR_SIZE=Array.from(tB.VALUE_OF.values()).map(e=>e.getOperator()).filter(e=>!e.startsWith("UN: ")).map(e=>e.length).reduce((e,t)=>e>t?e:t,0)}constructor(e,t,r=!1){this.operator=e,this.operatorName=t??e,this._shouldBeWrappedInSpace=r}getOperator(){return this.operator}getOperatorName(){return this.operatorName}shouldBeWrappedInSpace(){return this._shouldBeWrappedInSpace}valueOf(e){return tB.VALUE_OF.get(e)}toString(){return this.operator}}class tY extends tD{constructor(e,t,r,n){super(e||""),this.tokens=new ep,this.ops=new ep,t&&this.tokens.push(t),r&&this.tokens.push(r),n&&this.ops.push(n),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){let e;let t=this.expression.length,r="",n=new tv(""),s=0,a=!1;for(;s<t;){switch(r=this.expression[s],e=n.toString(),r){case" ":a=this.processTokenSepearator(n,e,a);break;case"(":s=this.processSubExpression(t,n,e,s,a),a=!1;break;case")":throw new tV(this.expression,"Extra closing parenthesis found");case"]":throw new tV(this.expression,"Extra closing square bracket found");case"'":case'"':{let e=this.processStringLiteral(t,r,s);s=e.getT1(),a=e.getT2();break}case"?":if(s+1<t&&"?"!=this.expression.charAt(s+1)&&0!=s&&"?"!=this.expression.charAt(s-1))s=this.processTernaryOperator(t,n,e,s,a);else{let i=this.processOthers(r,t,n,e,s,a);s=i.getT1(),(a=i.getT2())&&this.ops.peek()==tB.ARRAY_OPERATOR&&(s=(i=this.process(t,n,s)).getT1(),a=i.getT2())}break;default:let i=this.processOthers(r,t,n,e,s,a);s=i.getT1(),(a=i.getT2())&&this.ops.peek()==tB.ARRAY_OPERATOR&&(s=(i=this.process(t,n,s)).getT1(),a=i.getT2())}++s}if(e=n.toString(),!eM.isNullOrBlank(e)){if(tB.OPERATORS.has(e))throw new tV(this.expression,"Expression is ending with an operator");this.tokens.push(new tD(e))}}processStringLiteral(e,t,r){let n="",s=r+1;for(;s<e;s++){let e=this.expression.charAt(s);if(e==t&&"\\"!=this.expression.charAt(s-1))break;n+=e}if(s==e&&this.expression.charAt(s-1)!=t)throw new tV(this.expression,"Missing string ending marker "+t);let a=new ew(s,!1);return this.tokens.push(new tb(n,n)),a}process(e,t,r){let n=1;for(++r;r<e&&0!=n;){let e=this.expression.charAt(r);"]"==e?--n:"["==e&&++n,0!=n&&(t.append(e),r++)}return this.tokens.push(new tY(t.toString())),t.setLength(0),new ew(r,!1)}processOthers(e,t,r,n,s,a){let i=t-s;i=i<tB.BIGGEST_OPERATOR_SIZE?i:tB.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(s,s+e);if(tB.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return eM.isNullOrBlank(n)||(this.tokens.push(new tD(n)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(t),a),a=!0,r.setLength(0),new ew(s+e-1,a)}return r.append(e),new ew(s,!1)}processTernaryOperator(e,t,r,n,s){if(s)throw new tV(this.expression,"Ternary operator is followed by an operator");""!=r.trim()&&(this.tokens.push(new tY(r)),t.setLength(0));let a=1,i="",o=++n;for(;n<e&&a>0;)"?"==(i=this.expression.charAt(n))?++a:":"==i&&--a,++n;if(":"!=i)throw new tV(this.expression,"':' operater is missing");if(n>=e)throw new tV(this.expression,"Third part of the ternary expression is missing");for(;!this.ops.isEmpty()&&this.hasPrecedence(tB.CONDITIONAL_TERNARY_OPERATOR,this.ops.peek());){let e=this.ops.pop();if(tB.UNARY_OPERATORS.has(e)){let t=this.tokens.pop();this.tokens.push(new tY("",t,void 0,e))}else{let t=this.tokens.pop(),r=this.tokens.pop();this.tokens.push(new tY("",r,t,e))}}this.ops.push(tB.CONDITIONAL_TERNARY_OPERATOR),this.tokens.push(new tY(this.expression.substring(o,n-1)));let E=this.expression.substring(n);if(""===E.trim())throw new tV(this.expression,"Third part of the ternary expression is missing");return this.tokens.push(new tY(E)),e-1}processSubExpression(e,t,r,n,s){if(tB.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(r),s),t.setLength(0);else if(!eM.isNullOrBlank(r))throw new tV(this.expression,ec.format("Unkown token : $ found.",r));let a=1,i=new tv,o=this.expression.charAt(n);for(n++;n<e&&a>0;)"("==(o=this.expression.charAt(n))?a++:")"==o&&a--,0!=a&&(i.append(o),n++);if(")"!=o)throw new tV(this.expression,"Missing a closed parenthesis");for(;i.length()>2&&"("==i.charAt(0)&&")"==i.charAt(i.length()-1);)i.deleteCharAt(0),i.setLength(i.length()-1);return this.tokens.push(new tY(i.toString().trim())),n}processTokenSepearator(e,t,r){return eM.isNullOrBlank(t)||(tB.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,tB.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new tD(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,n){if(r){if(n||e.isEmpty()){if(tB.UNARY_OPERATORS.has(r)){let e=tB.UNARY_MAP.get(r);e&&t.push(e)}else throw new tV(this.expression,ec.format("Extra operator $ found.",r))}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(tB.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new tY("",t,void 0,r))}else{let t=e.pop(),n=e.pop();e.push(new tY("",n,t,r))}}t.push(r)}}}hasPrecedence(e,t){let r=tB.OPERATOR_PRIORITY.get(e),n=tB.OPERATOR_PRIORITY.get(t);if(!r||!n)throw Error("Unknown operators provided");return n<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new tv,t=0,r=this.ops.toArray(),n=this.tokens.toArray();for(let s=0;s<r.length;s++)if(r[s].getOperator().startsWith("UN: "))e.append("(").append(r[s].getOperator().substring(4)).append(n[t]instanceof tY?n[t].toString():n[t]).append(")"),t++;else if(r[s]==tB.CONDITIONAL_TERNARY_OPERATOR){let r=n[t++];e.insert(0,r.toString()),e.insert(0,":"),r=n[t++],e.insert(0,r.toString()),e.insert(0,"?"),r=n[t++],e.insert(0,r.toString()).append(")"),e.insert(0,"(")}else{if(0==t){let r=n[t++];e.insert(0,r.toString())}let a=n[t++];e.insert(0,r[s].getOperator()).insert(0,a.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var tH={};m(tH,"TokenValueExtractor",()=>tk);class tk{static{this.REGEX_SQUARE_BRACKETS=/[\[\]]/}static{this.REGEX_DOT=/\./}getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new eE(ec.format("Token $ doesn't start with $",e,t));if(e.endsWith(".__index")){let t=e.substring(0,e.length-8),r=this.getValueInternal(t);if(!_(r?.__index))return r.__index;if(!t.endsWith("]"))return t.substring(t.lastIndexOf(".")+1);{let e=t.substring(t.lastIndexOf("[")+1,t.length-1),r=parseInt(e);return isNaN(r)?e:r}}return this.getValueInternal(e)}retrieveElementFrom(e,t,r,n){if(_(n))return;if(t.length==r)return n;let s=t[r].split(tk.REGEX_SQUARE_BRACKETS).map(e=>e.trim()).filter(e=>!eM.isNullOrBlank(e)).reduce((n,s)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,s,n),n);return this.retrieveElementFrom(e,t,r+1,s)}resolveForEachPartOfTokenWithBrackets(e,t,r,n,s){if(!_(s))return"length"===n?this.getLength(e,s):Array.isArray(s)?this.handleArrayAccess(e,n,s):this.handleObjectAccess(e,t,r,n,s)}getLength(e,t){let r=typeof t;if("string"===r||Array.isArray(t))return t.length;if("object"===r)return"length"in t?t.length:Object.keys(t).length;throw new tV(e,ec.format("Length can't be found in token $",e))}handleArrayAccess(e,t,r){let n=parseInt(t);if(isNaN(n))throw new tV(e,ec.format("$ is not a number",t));if(n<0||n>=r.length)throw new tV(e,ec.format("Index $ is out of bounds for array of length $",n,r.length));return r[n]}handleObjectAccess(e,t,r,n,s){if(n.startsWith('"')){if(!n.endsWith('"')||1==n.length||2==n.length)throw new tV(e,ec.format("$ is missing a double quote or empty key found",e));n=n.substring(1,t.length-2)}return this.checkIfObject(e,t,r,s),s[n]}checkIfObject(e,t,r,n){if("object"!=typeof n||Array.isArray(n))throw new tV(e,ec.format("Unable to retrieve $ from $ in the path $",t[r],n.toString(),e))}}class t$ extends tk{constructor(e,t){super(),this.store=e,this.prefix=t}getValueInternal(e){let t=e.split(tk.REGEX_DOT);return this.retrieveElementFrom(e,t,1,this.store)}getStore(){return this.store}setStore(e){return this.store=e,this}setValue(e,t,r=!0,n=!1){this.store=tu(this.store),this.modifyStore(e,t,r,n)}modifyStore(e,t,r,n){let s=new tY(e),a=s.getTokens();a.removeLast();let i=s.getOperations(),o=i.removeLast(),E=a.removeLast(),u=E instanceof tb?E.getElement():E.getExpression(),A=this.store;for(;!i.isEmpty();)A=o==tB.OBJECT_OPERATOR?this.getDataFromObject(A,u,i.peekLast()):this.getDataFromArray(A,u,i.peekLast()),o=i.removeLast(),u=(E=a.removeLast())instanceof tb?E.getElement():E.getExpression();o==tB.OBJECT_OPERATOR?this.putDataInObject(A,u,t,r,n):this.putDataInArray(A,u,t,r,n)}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eE(ec.format("Expected an array index but found $",t));if(n<0)throw new eE(ec.format("Array index is out of bound - $",t));let s=e[n];return _(s)&&(s=r==tB.OBJECT_OPERATOR?{}:[],e[n]=s),s}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));let n=e[t];return _(n)&&(n=r==tB.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r,n,s){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let a=parseInt(t);if(isNaN(a))throw new eE(ec.format("Expected an array index but found $",t));if(a<0)throw new eE(ec.format("Array index is out of bound - $",t));(n||_(e[a]))&&(s&&_(r)?e.splice(a,1):e[a]=r)}putDataInObject(e,t,r,n,s){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));(n||_(e[t]))&&(s&&_(r)?delete e[t]:e[t]=r)}getPrefix(){return this.prefix}}class tj extends e4{constructor(){super("Sort",[tj.PARAMETER_ARRAY_SOURCE,tj.PARAMETER_INT_FIND_FROM,tj.PARAMETER_INT_LENGTH,tj.PARAMETER_BOOLEAN_ASCENDING,tj.PARAMETER_KEY_PATH],tj.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tj.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tj.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tj.PARAMETER_INT_LENGTH.getParameterName()),s=e?.getArguments()?.get(tj.PARAMETER_BOOLEAN_ASCENDING.getParameterName()),a=e?.getArguments()?.get(tj.PARAMETER_KEY_PATH.getParameterName());if(0==t.length)return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);if(t=[...t],-1==n&&(n=t.length-r),r<0||r>=t.length||r+n>t.length)throw new eE("Given start point is more than the size of the array or not available at that point");let i=t.slice(r,r+n+1),o=new t$({},"Data.");return i.sort((e,t)=>"object"==typeof e&&"object"==typeof t&&a.length?(o.setStore({a:e,b:t}),tW(o.getValue("Data.a."+a),o.getValue("Data.b."+a),s)):tW(e,t,s)),t.splice(r,n,...i),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}function tW(e,t,r){return e===t?0:null===e?1:null===t?-1:r?e<t?-1:1:e<t?1:-1}class tX extends e4{constructor(){super("SubArray",[tX.PARAMETER_ARRAY_SOURCE,tX.PARAMETER_INT_FIND_FROM,tX.PARAMETER_INT_LENGTH],tX.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tX.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tX.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tX.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n<=0)return new eu([ea.outputOf(new Map([]))]);if(!(r>=0&&r<t.length)||r+n>t.length)throw new eE("Given find from point is more than the source size array or the Requested length for the subarray was more than the source size");let s=t.slice(r,r+n);return new eu([ea.outputOf(new Map([[tX.EVENT_RESULT_NAME,s]]))])}}class tJ extends e4{constructor(){super("Insert",[tJ.PARAMETER_ARRAY_SOURCE,tJ.PARAMETER_INT_OFFSET,tJ.PARAMETER_ANY],tJ.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tJ.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tJ.PARAMETER_INT_OFFSET.getParameterName());var n=e?.getArguments()?.get(tJ.PARAMETER_ANY.getParameterName());if(_(n)||_(r)||r>t.length)throw new eE("Please valid resouces to insert at the correct location");if(0==(t=[...t]).length)return 0==r&&t.push(n),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))]);t.push(n);let s=t.length-1;for(r++;s>=r;){let e=t[s-1];t[s-1]=t[s],t[s--]=e}return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tq extends e4{constructor(){super("InsertLast",[tq.PARAMETER_ARRAY_SOURCE,tq.PARAMETER_ANY],tq.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tq.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tq.PARAMETER_ANY.getParameterName());return(t=[...t]).push(r),new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,t]]))])}}class tz extends e4{constructor(){super("RemoveDuplicates",[tz.PARAMETER_ARRAY_SOURCE,tz.PARAMETER_INT_SOURCE_FROM,tz.PARAMETER_INT_LENGTH],tz.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tz.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tz.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tz.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new eE(ec.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));let s=[...t],a=r+n;for(let e=a-1;e>=r;e--)for(let t=e-1;t>=r;t--)if(ef(s[e],s[t])){s.splice(e,1);break}return new eu([ea.outputOf(q.of(tz.EVENT_RESULT_NAME,s))])}}const tK="keyPath",tQ="valuePath",tZ="ignoreNullValues",t0="ignoreNullKeys",t1="ignoreDuplicateKeys";class t2 extends e4{constructor(){super("ArrayToObjects",[e4.PARAMETER_ARRAY_SOURCE,X.of(tK,Y.ofString(tK)),X.of(tQ,Y.of(tQ,i.STRING,i.NULL)),X.of(tZ,Y.ofBoolean(tZ).setDefaultValue(!1)),X.of(t0,Y.ofBoolean(t0).setDefaultValue(!0)),X.of(t1,Y.ofBoolean(t1).setDefaultValue(!1))],e4.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(e4.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tK),n=e?.getArguments()?.get(tQ)??"",s=e?.getArguments()?.get(tZ),a=e?.getArguments()?.get(t0),i=e?.getArguments()?.get(t1),o=new t$({},"Data."),E=t.filter(e=>!_(e)).reduce((e,t)=>{o.setStore(t);let E=o.getValue("Data."+r);if(a&&_(E))return e;let u=n?o.getValue("Data."+n):t;return s&&_(u)||i&&e.hasOwnProperty(E)||(e[E]=u),e},{});return new eu([ea.outputOf(new Map([[e4.EVENT_RESULT_NAME,E]]))])}}const t9="source",t3="delimiter",t4="result",t5=new eT("Join").setNamespace(p.SYSTEM_ARRAY).setParameters(new Map([[t9,new X(t9,Y.ofArray(t9,Y.of("each",i.STRING,i.INTEGER,i.LONG,i.DOUBLE,i.FLOAT,i.NULL)))],[t3,new X(t3,Y.ofString(t3).setDefaultValue(""))]])).setEvents(new Map([es.outputEventMapEntry(new Map([[t4,Y.ofString(t4)]]))]));class t6 extends e3{getSignature(){return t5}async internalExecute(e){let t=e?.getArguments()?.get(t9),r=e?.getArguments()?.get(t3);return new eu([ea.outputOf(new Map([[t4,t.join(r)]]))])}}class t7{static{this.repoMap=q.ofArrayEntries(et(new e5),et(new e6),et(new ts),et(new to),et(new tA),et(new tT),et(new tl),et(new tR),et(new tm),et(new tg),et(new th),et(new tc),et(new tp),et(new tN),et(new tf),et(new t_),et(new tM),et(new tS),et(new tO),et(new tw),et(new tI),et(new tP),et(new td),et(new tj),et(new tX),et(new e8),et(new tJ),et(new tq),et(new tz),et(new t2),et(new t6))}static{this.filterableNames=Array.from(t7.repoMap.values()).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=p.SYSTEM_ARRAY?Promise.resolve(void 0):Promise.resolve(t7.repoMap.get(t))}async filter(e){return Promise.resolve(t7.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var t8={};m(t8,"ContextElement",()=>re);class re{static{this.NULL=new re(Y.NULL,void 0)}constructor(e,t){this.schema=e,this.element=t}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getElement(){return this.element}setElement(e){return this.element=e,this}}const rt="name",rr="schema",rn=new eT("Create").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(rt,new Y().setName(rt).setType(L.of(i.STRING)).setMinLength(1).setFormat(E.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,o.CONSTANT),X.ofEntry(rr,Y.SCHEMA,!1,o.CONSTANT)])).setEvents(new Map([es.outputEventMapEntry(new Map)])),rs="name",ra="value",ri=new eT("Get").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(rs,new Y().setName(rs).setType(L.of(i.STRING)).setMinLength(1).setFormat(E.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,o.CONSTANT)])).setEvents(new Map([es.outputEventMapEntry(new Map([[ra,Y.ofAny(ra)]]))]));var ro={};m(ro,"ExpressionEvaluator",()=>nA);var rE={};m(rE,"LogicalNullishCoalescingOperator",()=>rT);var ru={};m(ru,"BinaryOperator",()=>rA);class rA{nullCheck(e,t,r){if(_(e)||_(t))throw new tr(ec.format("$ cannot be applied to a null value",r.getOperatorName()))}}class rT extends rA{apply(e,t){return _(e)?t:e}}var rl={};m(rl,"ArithmeticAdditionOperator",()=>rR);class rR extends rA{apply(e,t){return _(e)?t:_(t)?e:e+t}}var rm={};m(rm,"ArithmeticDivisionOperator",()=>rg);class rg extends rA{apply(e,t){return this.nullCheck(e,t,tB.DIVISION),e/t}}var rh={};m(rh,"ArithmeticIntegerDivisionOperator",()=>rc);class rc extends rA{apply(e,t){return this.nullCheck(e,t,tB.DIVISION),Math.floor(e/t)}}var rp={};m(rp,"ArithmeticModulusOperator",()=>rN);class rN extends rA{apply(e,t){return this.nullCheck(e,t,tB.MOD),e%t}}var rf={};m(rf,"ArithmeticMultiplicationOperator",()=>r_);class r_ extends rA{apply(e,t){this.nullCheck(e,t,tB.MULTIPLICATION);let r="string"==typeof e,n=typeof t;if(r||"string"===n){let n=r?e:t,s=r?t:e,a="",i=s<0,o=Math.floor(s=Math.abs(s));for(;o-- >0;)a+=n;let E=Math.floor(n.length*(s-Math.floor(s)));if(E<0&&(E=-E),0!=E&&(a+=n.substring(0,E)),i){let e="";for(let t=a.length-1;t>=0;t--)e+=a[t];return e}return a}return e*t}}var rM={};m(rM,"ArithmeticSubtractionOperator",()=>rS);class rS extends rA{apply(e,t){return this.nullCheck(e,t,tB.SUBTRACTION),e-t}}var rO={};m(rO,"ArrayOperator",()=>rw);class rw extends rA{apply(e,t){if(!e)throw new tr("Cannot apply array operator on a null value");if(!t)throw new tr("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new tr(ec.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new tr(ec.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var rI={};m(rI,"BitwiseAndOperator",()=>rP);class rP extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_AND),e&t}}var rd={};m(rd,"BitwiseLeftShiftOperator",()=>ry);class ry extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_LEFT_SHIFT),e<<t}}var rx={};m(rx,"BitwiseOrOperator",()=>rL);class rL extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_OR),e|t}}var rv={};m(rv,"BitwiseRightShiftOperator",()=>rU);class rU extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_RIGHT_SHIFT),e>>t}}var rV={};m(rV,"BitwiseUnsignedRightShiftOperator",()=>rC);class rC extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var rD={};m(rD,"BitwiseXorOperator",()=>rG);class rG extends rA{apply(e,t){return this.nullCheck(e,t,tB.BITWISE_XOR),e^t}}var rb={};m(rb,"LogicalAndOperator",()=>rF);class rF extends rA{apply(e,t){return!!e&&""!==e&&!!t&&""!==t}}var rB={};m(rB,"LogicalEqualOperator",()=>rY);class rY extends rA{apply(e,t){return ef(e,t)}}var rH={};m(rH,"LogicalGreaterThanEqualOperator",()=>rk);class rk extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare >= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>=n.getT2()}}var r$={};m(r$,"LogicalGreaterThanOperator",()=>rj);class rj extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare > with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>n.getT2()}}var rW={};m(rW,"LogicalLessThanEqualOperator",()=>rX);class rX extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare <= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<=n.getT2()}}var rJ={};m(rJ,"LogicalLessThanOperator",()=>rq);class rq extends rA{apply(e,t){let r=tn.findPrimitiveNullAsBoolean(e),n=tn.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||n.getT1()==i.BOOLEAN)throw new tr(ec.format("Cannot compare < with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<n.getT2()}}var rz={};m(rz,"LogicalNotEqualOperator",()=>rK);class rK extends rA{apply(e,t){return!ef(e,t)}}var rQ={};m(rQ,"LogicalOrOperator",()=>rZ);class rZ extends rA{apply(e,t){return!!e&&""!==e||!!t&&""!==t}}var r0={};m(r0,"ObjectOperator",()=>r1);class r1 extends rA{apply(e,t){if(!e)throw new tr("Cannot apply array operator on a null value");if(!t)throw new tr("Cannot retrive null property value");let r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new tr(ec.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var r2={};m(r2,"ArithmeticUnaryMinusOperator",()=>r4);var r9={};m(r9,"UnaryOperator",()=>r3);class r3{nullCheck(e,t){if(_(e))throw new tr(ec.format("$ cannot be applied to a null value",t.getOperatorName()))}}class r4 extends r3{apply(e){return this.nullCheck(e,tB.UNARY_MINUS),tn.findPrimitiveNumberType(e),-e}}var r5={};m(r5,"ArithmeticUnaryPlusOperator",()=>r6);class r6 extends r3{apply(e){return this.nullCheck(e,tB.UNARY_PLUS),tn.findPrimitiveNumberType(e),e}}var r7={};m(r7,"BitwiseComplementOperator",()=>r8);class r8 extends r3{apply(e){this.nullCheck(e,tB.UNARY_BITWISE_COMPLEMENT);let t=tn.findPrimitiveNumberType(e);if(t.getT1()!=i.INTEGER&&t.getT1()!=i.LONG)throw new tr(ec.format("Unable to apply bitwise operator on $",e));return~e}}var ne={};m(ne,"LogicalNotOperator",()=>nt);class nt extends r3{apply(e){return!e&&""!==e}}var nr={};m(nr,"LiteralTokenValueExtractor",()=>ns);const nn=new Map([["true",!0],["false",!1],["null",void 0],["undefined",void 0]]);class ns extends tk{static{this.INSTANCE=new ns}getValueInternal(e){if(!eM.isNullOrBlank(e))return(e=e.trim(),nn.has(e))?nn.get(e):e.startsWith('"')?this.processString(e):this.processNumbers(e)}processNumbers(e){try{let t=Number(e);if(isNaN(t))throw Error("Parse number error");return t}catch(t){throw new tV(e,ec.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new tV(e,ec.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}getStore(){}getValueFromExtractors(e,t){return t.has(e+".")?t.get(e+".")?.getStore():this.getValue(e)}}var na={},ni={};m(ni,"ConditionalTernaryOperator",()=>nE);class no{nullCheck(e,t,r,n){if(_(e)||_(t)||_(r))throw new tr(ec.format("$ cannot be applied to a null value",n.getOperatorName()))}}class nE extends no{apply(e,t,r){return e?t:r}}R(na,ni);class nu extends tk{static{this.PREFIX="_internal."}addValue(e,t){this.values.set(e,t)}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.values.get(r))}getPrefix(){return nu.PREFIX}getStore(){}constructor(...e){super(...e),this.values=new Map}}class nA{static{this.UNARY_OPERATORS_MAP=new Map([[tB.UNARY_BITWISE_COMPLEMENT,new r8],[tB.UNARY_LOGICAL_NOT,new nt],[tB.UNARY_MINUS,new r4],[tB.UNARY_PLUS,new r6]])}static{this.TERNARY_OPERATORS_MAP=new Map([[tB.CONDITIONAL_TERNARY_OPERATOR,new nE]])}static{this.BINARY_OPERATORS_MAP=new Map([[tB.ADDITION,new rR],[tB.DIVISION,new rg],[tB.INTEGER_DIVISION,new rc],[tB.MOD,new rN],[tB.MULTIPLICATION,new r_],[tB.SUBTRACTION,new rS],[tB.BITWISE_AND,new rP],[tB.BITWISE_LEFT_SHIFT,new ry],[tB.BITWISE_OR,new rL],[tB.BITWISE_RIGHT_SHIFT,new rU],[tB.BITWISE_UNSIGNED_RIGHT_SHIFT,new rC],[tB.BITWISE_XOR,new rG],[tB.AND,new rF],[tB.EQUAL,new rY],[tB.GREATER_THAN,new rj],[tB.GREATER_THAN_EQUAL,new rk],[tB.LESS_THAN,new rq],[tB.LESS_THAN_EQUAL,new rX],[tB.OR,new rZ],[tB.NOT_EQUAL,new rK],[tB.NULLISH_COALESCING_OPERATOR,new rT],[tB.ARRAY_OPERATOR,new rw],[tB.OBJECT_OPERATOR,new r1]])}static{this.UNARY_OPERATORS_MAP_KEY_SET=new Set(nA.UNARY_OPERATORS_MAP.keys())}constructor(e){this.internalTokenValueExtractor=new nu,e instanceof tY?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){let t=this.processNestingExpression(this.expression,e);return this.expression=t.getT1(),this.exp=t.getT2(),(e=new Map(e.entries())).set(this.internalTokenValueExtractor.getPrefix(),this.internalTokenValueExtractor),this.evaluateExpression(this.exp,e)}processNestingExpression(e,t){let r=0,n=0,s=new ep;for(;n<e.length-1;){if("{"==e.charAt(n)&&"{"==e.charAt(n+1))0==r&&s.push(new ew(n+2,-1)),r++,n++;else if("}"==e.charAt(n)&&"}"==e.charAt(n+1)){if(--r<0)throw new tV(e,"Expecting {{ nesting path operator to be started before closing");0==r&&s.push(s.pop().setT2(n)),n++}n++}let a=this.replaceNestingExpression(e,t,s);return new ew(a,new tY(a))}replaceNestingExpression(e,t,r){let n=e;for(let s of r.toArray()){if(-1==s.getT2())throw new tV(e,"Expecting }} nesting path operator to be closed");let r=new nA(n.substring(s.getT1(),s.getT2())).evaluate(t);n=n.substring(0,s.getT1()-2)+r+n.substring(s.getT2()+2)}return n}getExpression(){return this.exp||(this.exp=new tY(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),n=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),s=n.pop();if(nA.UNARY_OPERATORS_MAP_KEY_SET.has(e))n.push(this.applyUnaryOperation(e,this.getValueFromToken(t,s)));else if(e==tB.OBJECT_OPERATOR||e==tB.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,n,e,s);else if(e==tB.CONDITIONAL_TERNARY_OPERATOR){let r=n.pop(),a=n.pop(),i=this.getValueFromToken(t,a),o=this.getValueFromToken(t,r),E=this.getValueFromToken(t,s);n.push(this.applyTernaryOperation(e,i,o,E))}else{let r=n.pop(),a=this.getValueFromToken(t,r),i=this.getValueFromToken(t,s);n.push(this.applyBinaryOperation(e,a,i))}}if(n.isEmpty())throw new tr(ec.format("Expression : $ evaluated to null",e));if(1!=n.size())throw new tr(ec.format("Expression : $ evaluated multiple values $",e,n));let s=n.get(0);if(s instanceof tb)return s.getElement();if(!(s instanceof tY))return this.getValueFromToken(t,s);throw new tr(ec.format("Expression : $ evaluated to $",e,n.get(0)))}processObjectOrArrayOperator(e,t,r,n,s){let a=new ep,i=new ep;if(!n||!s)return;do i.push(n),s instanceof tY?a.push(new tb(s.toString(),this.evaluateExpression(s,e))):s&&a.push(s),s=r.isEmpty()?void 0:r.pop(),n=t.isEmpty()?void 0:t.pop();while(n==tB.OBJECT_OPERATOR||n==tB.ARRAY_OPERATOR)s&&(s instanceof tY?a.push(new tb(s.toString(),this.evaluateExpression(s,e))):a.push(s)),n&&t.push(n);let o=a.pop();if(o instanceof tb&&"object"==typeof o.getTokenValue()){let e=new Date().getTime()+""+Math.round(1e3*Math.random());this.internalTokenValueExtractor.addValue(e,o.getTokenValue()),o=new tD(nu.PREFIX+e)}let E=new tv(o instanceof tb?o.getTokenValue():o.toString());for(;!a.isEmpty();)o=a.pop(),n=i.pop(),E.append(n.getOperator()).append(o instanceof tb?o.getTokenValue():o.toString()),n==tB.ARRAY_OPERATOR&&E.append("]");let u=E.toString(),A=u.substring(0,u.indexOf(".")+1);if(A.length>2&&e.has(A))r.push(new tb(u,this.getValue(u,e)));else{let e;try{e=ns.INSTANCE.getValue(u)}catch(t){e=u}r.push(new tb(u,e))}}applyTernaryOperation(e,t,r,n){let s=nA.TERNARY_OPERATORS_MAP.get(e);if(!s)throw new tV(this.expression,ec.format("No operator found to evaluate $",this.getExpression()));return new tb(e.toString(),s.apply(t,r,n))}applyBinaryOperation(e,t,r){let n=typeof t,s=typeof r,a=nA.BINARY_OPERATORS_MAP.get(e);if(("object"===n||"object"===s)&&e!==tB.EQUAL&&e!==tB.NOT_EQUAL&&e!==tB.NULLISH_COALESCING_OPERATOR&&e!==tB.AND&&e!==tB.OR)throw new tV(this.expression,ec.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));if(!a)throw new tV(this.expression,ec.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new tb(e.toString(),a.apply(t,r))}applyUnaryOperation(e,t){let r=typeof t;if(e.getOperator()!=tB.NOT.getOperator()&&e.getOperator()!=tB.UNARY_LOGICAL_NOT.getOperator()&&("object"===r||Array.isArray(t)))throw new tV(this.expression,ec.format("The operator $ cannot be applied to $",e.getOperator(),t));let n=nA.UNARY_OPERATORS_MAP.get(e);if(!n)throw new tV(this.expression,ec.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new tb(e.toString(),n.apply(t))}getValueFromToken(e,t){return t instanceof tY?this.evaluateExpression(t,e):t instanceof tb?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){let r=e.substring(0,e.indexOf(".")+1);return t.has(r)?t.get(r).getValue(e):ns.INSTANCE.getValueFromExtractors(e,t)}}const nT="name",nl="value",nR=new eT("Set").setNamespace(p.SYSTEM_CTX).setParameters(new Map([X.ofEntry(nT,new Y().setName(nT).setType(L.of(i.STRING)).setMinLength(1),!1),X.ofEntry(nl,Y.ofAny(nl))])).setEvents(new Map([es.outputEventMapEntry(new Map)])),nm="value",ng="eventName",nh="results",nc=new eT("GenerateEvent").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(ng,Y.ofString(ng).setDefaultValue("output")),X.ofEntry(nh,Y.ofObject(nh).setProperties(new Map([["name",Y.ofString("name")],[nm,X.EXPRESSION]])),!0)])).setEvents(new Map([es.outputEventMapEntry(new Map)]));class np extends e3{static{this.CONDITION="condition"}static{this.SIGNATURE=new eT("If").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(np.CONDITION,Y.ofAny(np.CONDITION))])).setEvents(new Map([es.eventMapEntry(es.TRUE,new Map),es.eventMapEntry(es.FALSE,new Map),es.outputEventMapEntry(new Map)]))}getSignature(){return np.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(np.CONDITION);return new eu([ea.of(t||""===t?es.TRUE:es.FALSE,new Map),ea.outputOf(new Map)])}}const nN="stepName",nf=new eT("Break").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(nN,Y.of(nN,i.STRING))])).setEvents(new Map([es.outputEventMapEntry(new Map([]))])),n_="count",nM="value",nS="index",nO=new eT("CountLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(n_,Y.of(n_,i.INTEGER))])).setEvents(new Map([es.eventMapEntry(es.ITERATION,new Map([[nS,Y.of(nS,i.INTEGER)]])),es.outputEventMapEntry(new Map([[nM,Y.of(nM,i.INTEGER)]]))])),nw="source",nI="each",nP="index",nd="value",ny=new eT("ForEachLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(nw,Y.ofArray(nw,Y.ofAny(nw)))])).setEvents(new Map([es.eventMapEntry(es.ITERATION,new Map([[nP,Y.of(nP,i.INTEGER)],[nI,Y.ofAny(nI)]])),es.outputEventMapEntry(new Map([[nd,Y.of(nd,i.INTEGER)]]))])),nx="from",nL="step",nv="value",nU="index",nV=new eT("RangeLoop").setNamespace(p.SYSTEM_LOOP).setParameters(new Map([X.ofEntry(nx,Y.of(nx,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(0)),X.ofEntry("to",Y.of("to",i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(1)),X.ofEntry(nL,Y.of(nL,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(1).setNot(new Y().setConstant(0)))])).setEvents(new Map([es.eventMapEntry(es.ITERATION,new Map([[nU,Y.of(nU,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)]])),es.outputEventMapEntry(new Map([[nv,Y.of(nv,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)]]))])),nC="value",nD=new eT("Add").setNamespace(p.MATH).setParameters(new Map([[nC,new X(nC,Y.ofNumber(nC)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[nC,Y.ofNumber(nC)]]))])),nG="value",nb="value1",nF="value2",nB=[()=>new Map([[nG,new X(nG,Y.ofNumber(nG))]]),()=>new Map([[nb,new X(nb,Y.ofNumber(nb))],[nF,new X(nF,Y.ofNumber(nF))]])];class nY extends e3{constructor(e,t,r=1,...n){super(),n&&n.length||(n=[i.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new eT(e).setNamespace(p.MATH).setParameters(nB[r-1]()).setEvents(new Map([es.outputEventMapEntry(new Map([[nG,new Y().setType(L.of(...n)).setName(nG)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=tn.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?nG:nb)).getT2();return 2==this.parametersNumber&&(t=tn.findPrimitiveNumberType(e.getArguments()?.get(nF)).getT2()),new eu([ea.outputOf(new Map([[nG,this.mathFunction.call(this,r,t)]]))])}}const nH="value";class nk extends e3{static{this.SIGNATURE=new eT("Hypotenuse").setNamespace(p.MATH).setParameters(new Map([[nH,new X(nH,Y.ofNumber(nH)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[nH,new Y().setType(L.of(i.DOUBLE)).setName(nH)]]))]))}constructor(){super()}getSignature(){return nk.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nH);return new eu([ea.outputOf(new Map([[nH,Math.sqrt(t.reduce((e,t)=>e+=t*t,0))]]))])}}const n$="value",nj=new eT("Maximum").setNamespace(p.MATH).setParameters(new Map([[n$,new X(n$,Y.ofNumber(n$)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[n$,Y.ofNumber(n$)]]))])),nW="value",nX=new eT("Minimum").setNamespace(p.MATH).setParameters(new Map([[nW,new X(nW,Y.ofNumber(nW)).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[nW,Y.ofNumber(nW)]]))])),nJ="value";class nq extends e3{static{this.SIGNATURE=new eT("Random").setNamespace(p.MATH).setEvents(new Map([es.outputEventMapEntry(q.of(nJ,Y.ofDouble(nJ)))]))}getSignature(){return nq.SIGNATURE}async internalExecute(e){return new eu([ea.outputOf(new Map([[nJ,Math.random()]]))])}}class nz extends e3{static{this.MIN_VALUE="minValue"}static{this.MAX_VALUE="maxValue"}static{this.VALUE="value"}constructor(e,t,r,n,s){super(),this.signature=new eT(e).setParameters(q.of(nz.MIN_VALUE,t,nz.MAX_VALUE,r)).setNamespace(p.MATH).setEvents(new Map([es.outputEventMapEntry(q.of(nz.VALUE,n))])),this.randomFunction=s}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nz.MIN_VALUE),r=e.getArguments()?.get(nz.MAX_VALUE),n=this.randomFunction(t,r);return new eu([ea.outputOf(new Map([[nz.VALUE,n]]))])}}const nK={Absolute:new nY("Absolute",e=>Math.abs(e),1,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE),ArcCosine:new nY("ArcCosine",e=>Math.acos(e)),ArcSine:new nY("ArcSine",e=>Math.asin(e)),ArcTangent:new nY("ArcTangent",e=>Math.atan(e)),Ceiling:new nY("Ceiling",e=>Math.ceil(e)),Cosine:new nY("Cosine",e=>Math.cos(e)),HyperbolicCosine:new nY("HyperbolicCosine",e=>Math.cosh(e)),CubeRoot:new nY("CubeRoot",e=>Math.cbrt(e)),Exponential:new nY("Exponential",e=>Math.exp(e)),ExponentialMinus1:new nY("ExponentialMinus1",e=>Math.expm1(e)),Floor:new nY("Floor",e=>Math.floor(e)),LogNatural:new nY("LogNatural",e=>Math.log(e)),Log10:new nY("Log10",e=>Math.log10(e)),Round:new nY("Round",e=>Math.round(e),1,i.INTEGER,i.LONG),Sine:new nY("Sine",e=>Math.sin(e)),HyperbolicSine:new nY("HyperbolicSine",e=>Math.sinh(e)),Tangent:new nY("Tangent",e=>Math.tan(e)),HyperbolicTangent:new nY("HyperbolicTangent",e=>Math.tanh(e)),ToDegrees:new nY("ToDegrees",e=>Math.PI/180*e),ToRadians:new nY("ToRadians",e=>180/Math.PI*e),SquareRoot:new nY("SquareRoot",e=>Math.sqrt(e)),ArcTangent2:new nY("ArcTangent2",(e,t)=>Math.atan2(e,t),2),Power:new nY("Power",(e,t)=>Math.pow(e,t),2),Add:new class extends e3{getSignature(){return nD}async internalExecute(e){let t=e.getArguments()?.get(nC);return new eu([ea.outputOf(new Map([[nC,t.reduce((e,t)=>e+=t,0)]]))])}},Hypotenuse:new nk,Maximum:new class extends e3{getSignature(){return nj}async internalExecute(e){let t=e.getArguments()?.get(n$);return new eu([ea.outputOf(new Map([[n$,t.reduce((e,t)=>!e&&0!==e||t>e?t:e)]]))])}},Minimum:new class extends e3{getSignature(){return nX}async internalExecute(e){let t=e.getArguments()?.get(nW);return new eu([ea.outputOf(new Map([[nW,t.reduce((e,t)=>!e&&0!==e||t<e?t:e)]]))])}},Random:new nq,RandomFloat:new nz("RandomFloat",X.of(nz.MIN_VALUE,Y.ofFloat(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofFloat(nz.MAX_VALUE).setDefaultValue(0x7fffffff)),Y.ofFloat(nz.VALUE),(e,t)=>Math.random()*(t-e)+e),RandomInt:new nz("RandomInt",X.of(nz.MIN_VALUE,Y.ofInteger(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofInteger(nz.MAX_VALUE).setDefaultValue(0x7fffffff)),Y.ofInteger(nz.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomLong:new nz("RandomLong",X.of(nz.MIN_VALUE,Y.ofLong(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofLong(nz.MAX_VALUE).setDefaultValue(Number.MAX_SAFE_INTEGER)),Y.ofLong(nz.VALUE),(e,t)=>Math.round(Math.random()*(t-e)+e)),RandomDouble:new nz("RandomDouble",X.of(nz.MIN_VALUE,Y.ofDouble(nz.MIN_VALUE).setDefaultValue(0)),X.of(nz.MAX_VALUE,Y.ofDouble(nz.MAX_VALUE).setDefaultValue(Number.MAX_VALUE)),Y.ofDouble(nz.VALUE),(e,t)=>Math.random()*(t-e)+e)},nQ=Object.values(nK).map(e=>e.getSignature().getFullName());class nZ{async find(e,t){return e!=p.MATH?Promise.resolve(void 0):Promise.resolve(nK[t])}async filter(e){return Promise.resolve(nQ.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class n0 extends e3{static{this.SOURCE="source"}static{this.SCHEMA="schema"}static{this.VALUE="value"}static{this.CONVERSION_MODE="conversionMode"}getSignature(){return new eT("ObjectConvert").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n0.SOURCE,Y.ofAny(n0.SCHEMA)),X.ofEntry(n0.SCHEMA,Y.SCHEMA,!1,o.CONSTANT),X.ofEntry(n0.CONVERSION_MODE,Y.ofString(n0.CONVERSION_MODE).setEnums(eJ()))])).setEvents(new Map([es.outputEventMapEntry(q.of(n0.VALUE,Y.ofAny(n0.VALUE)))]))}internalExecute(e){let t=e.getArguments()?.get(n0.SOURCE),r=Y.from(e?.getArguments()?.get(n0.SCHEMA));if(!r)throw new eE("Schema is not supplied.");let n=eX(e.getArguments()?.get(n0.CONVERSION_MODE))||u.STRICT;return this.convertToSchema(r,e.getSchemaRepository(),t,n)}async convertToSchema(e,t,r,n){try{return new eu([ea.outputOf(q.of(n0.VALUE,e9.validate([],e,t,r,!0,n)))])}catch(e){throw new eE(e?.message)}}}const n1="value",n2="source",n9="source";class n3 extends e3{constructor(e,t){super(),this.signature=new eT(e).setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n9,Y.ofAny(n9))])).setEvents(new Map([es.outputEventMapEntry(new Map([["value",t]]))]))}getSignature(){return this.signature}}const n4="value",n5="value",n6="value",n7="source",n8="overwrite",se="deleteKeyOnNull",st="value",sr={ObjectValues:new class extends n3{constructor(){super("ObjectValues",Y.ofArray(st,Y.ofAny(st)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[st,[]]]))]);let r=Object.entries(tu(t)).sort((e,t)=>e[0].localeCompare(t[0])).map(e=>e[1]);return new eu([ea.outputOf(new Map([[st,r]]))])}},ObjectKeys:new class extends n3{constructor(){super("ObjectKeys",Y.ofArray(n5,Y.ofString(n5)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[n5,[]]]))]);let r=Object.keys(tu(t)).sort((e,t)=>e.localeCompare(t));return new eu([ea.outputOf(new Map([[n5,r]]))])}},ObjectEntries:new class extends n3{constructor(){super("ObjectEntries",Y.ofArray(n4,Y.ofArray("tuple",Y.ofString("key"),Y.ofAny("value"))))}async internalExecute(e){var t=e.getArguments()?.get("source");if(_(t))return new eu([ea.outputOf(new Map([[n4,[]]]))]);let r=Object.entries(tu(t)).sort((e,t)=>e[0].localeCompare(t[0]));return new eu([ea.outputOf(new Map([[n4,r]]))])}},ObjectDeleteKey:new class extends e3{constructor(){super(),this.signature=new eT("ObjectDeleteKey").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n2,Y.ofAny(n2)),X.ofEntry("key",Y.ofString("key"))])).setEvents(new Map([es.outputEventMapEntry(new Map([[n1,Y.ofAny(n1)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(n2),r=e.getArguments()?.get("key");return _(t)?new eu([ea.outputOf(new Map([[n1,void 0]]))]):(t=tu(t),delete t[r],new eu([ea.outputOf(new Map([[n1,t]]))]))}},ObjectPutValue:new class extends e3{constructor(){super(),this.signature=new eT("ObjectPutValue").setNamespace(p.SYSTEM_OBJECT).setParameters(new Map([X.ofEntry(n7,Y.ofObject(n7)),X.ofEntry("key",Y.ofString("key")),X.ofEntry(n6,Y.ofAny(n6)),X.ofEntry(n8,Y.ofBoolean(n8).setDefaultValue(!0)),X.ofEntry(se,Y.ofBoolean(se).setDefaultValue(!1))])).setEvents(new Map([es.outputEventMapEntry(new Map([[n6,Y.ofObject(n6)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(n7),r=e.getArguments()?.get("key"),n=e.getArguments()?.get(n6),s=e.getArguments()?.get(n8),a=e.getArguments()?.get(se),i=new t$(t,"Data.");return i.setValue(r,n,s,a),new eu([ea.outputOf(new Map([[n6,i.getStore()]]))])}},ObjectConvert:new n0},sn=Object.values(sr).map(e=>e.getSignature().getFullName());class ss{async find(e,t){return e!=p.SYSTEM_OBJECT?Promise.resolve(void 0):Promise.resolve(sr[t])}async filter(e){return Promise.resolve(sn.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sa extends e3{static{this.VALUES="values"}static{this.STREAM="stream"}static{this.LOG="LOG"}static{this.ERROR="ERROR"}static{this.SIGNATURE=new eT("Print").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(sa.VALUES,Y.ofAny(sa.VALUES),!0),X.ofEntry(sa.STREAM,Y.ofString(sa.STREAM).setEnums([sa.LOG,sa.ERROR]).setDefaultValue(sa.LOG))])).setEvents(new Map([es.outputEventMapEntry(new Map)]))}getSignature(){return sa.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(sa.VALUES),r=e.getArguments()?.get(sa.STREAM);return(r===sa.LOG?console?.log:console?.error)?.(...t),new eu([ea.outputOf(new Map)])}}class si extends e3{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_SEARCH_STRING_NAME="searchString"}static{this.PARAMETER_SECOND_STRING_NAME="secondString"}static{this.PARAMETER_THIRD_STRING_NAME="thirdString"}static{this.PARAMETER_INDEX_NAME="index"}static{this.PARAMETER_SECOND_INDEX_NAME="secondIndex"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new X(si.PARAMETER_STRING_NAME,Y.ofString(si.PARAMETER_STRING_NAME))}static{this.PARAMETER_SECOND_STRING=new X(si.PARAMETER_SECOND_STRING_NAME,Y.ofString(si.PARAMETER_SECOND_STRING_NAME))}static{this.PARAMETER_THIRD_STRING=new X(si.PARAMETER_THIRD_STRING_NAME,Y.ofString(si.PARAMETER_THIRD_STRING_NAME))}static{this.PARAMETER_INDEX=new X(si.PARAMETER_INDEX_NAME,Y.ofInteger(si.PARAMETER_INDEX_NAME))}static{this.PARAMETER_SECOND_INDEX=new X(si.PARAMETER_SECOND_INDEX_NAME,Y.ofInteger(si.PARAMETER_SECOND_INDEX_NAME))}static{this.PARAMETER_SEARCH_STRING=new X(si.PARAMETER_SEARCH_STRING_NAME,Y.ofString(si.PARAMETER_STRING_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofString(si.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofBoolean(si.EVENT_RESULT_NAME)))}static{this.EVENT_INT=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofInteger(si.EVENT_RESULT_NAME)))}static{this.EVENT_ARRAY=new es(es.OUTPUT,q.of(si.EVENT_RESULT_NAME,Y.ofArray(si.EVENT_RESULT_NAME)))}constructor(e,t,r,...n){super();let s=new Map;n.forEach(e=>s.set(e.getParameterName(),e)),this.signature=new eT(t).setNamespace(e).setParameters(s).setEvents(q.of(r.getName(),r))}getSignature(){return this.signature}static ofEntryStringStringAndBooleanOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SEARCH_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n)))])}}(p.STRING,e,si.EVENT_BOOLEAN,si.PARAMETER_STRING,si.PARAMETER_SEARCH_STRING)]}static ofEntryStringIntegerAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_INDEX_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING,si.PARAMETER_INDEX)]}static ofEntryStringStringAndIntegerOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SEARCH_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n)))])}}(p.STRING,e,si.EVENT_INT,si.PARAMETER_STRING,si.PARAMETER_SEARCH_STRING)]}static ofEntryStringAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING)]}static ofEntryStringAndBooleanOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,si.EVENT_BOOLEAN,si.PARAMETER_STRING)]}static ofEntryStringStringIntegerAndIntegerOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SEARCH_STRING_NAME),s=e?.getArguments()?.get(si.PARAMETER_INDEX_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n,s)))])}}(p.STRING,e,si.EVENT_INT,si.PARAMETER_STRING,si.PARAMETER_SEARCH_STRING,si.PARAMETER_INDEX)]}static ofEntryStringIntegerIntegerAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_INDEX_NAME),s=e?.getArguments()?.get(si.PARAMETER_SECOND_INDEX_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n,s)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING,si.PARAMETER_INDEX,si.PARAMETER_SECOND_INDEX)]}static ofEntryStringStringStringAndStringOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(si.PARAMETER_SECOND_STRING_NAME),s=e?.getArguments()?.get(si.PARAMETER_THIRD_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r,n,s)))])}}(p.STRING,e,si.EVENT_STRING,si.PARAMETER_STRING,si.PARAMETER_SECOND_STRING,si.PARAMETER_THIRD_STRING)]}static ofEntryStringAndIntegerOutput(e,t){return[e,new class extends si{async internalExecute(e){let r=e?.getArguments()?.get(si.PARAMETER_STRING_NAME);return new eu([ea.outputOf(q.of(si.EVENT_RESULT_NAME,t(r)))])}}(p.STRING,e,si.EVENT_INT,si.PARAMETER_STRING)]}}class so extends e3{static{this.VALUE="value"}static{this.SCHEMA=new Y().setName(so.VALUE).setType(new x(i.STRING))}static{this.SIGNATURE=new eT("Concatenate").setNamespace(p.STRING).setParameters(new Map([[so.VALUE,new X(so.VALUE,so.SCHEMA).setVariableArgument(!0)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[so.VALUE,Y.ofString(so.VALUE)]]))]))}constructor(){super()}getSignature(){return so.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(so.VALUE),r="";return t.reduce((e,t)=>r=e+t,r),new eu([ea.outputOf(new Map([[so.VALUE,r]]))])}}class sE extends e3{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_START_NAME="startPosition"}static{this.PARAMETER_AT_END_NAME="endPosition"}static{this.EVENT_RESULT_NAME="result"}constructor(){super(),this.PARAMETER_STRING=new X(sE.PARAMETER_STRING_NAME,Y.ofString(sE.PARAMETER_STRING_NAME)),this.PARAMETER_AT_START=new X(sE.PARAMETER_AT_START_NAME,Y.ofInteger(sE.PARAMETER_AT_START_NAME)),this.PARAMETER_AT_END=new X(sE.PARAMETER_AT_END_NAME,Y.ofInteger(sE.PARAMETER_AT_END_NAME)),this.EVENT_STRING=new es(es.OUTPUT,new Map([[sE.EVENT_RESULT_NAME,Y.ofString(sE.EVENT_RESULT_NAME)]])),this.signature=new eT("DeleteForGivenLength").setNamespace(p.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_START.getParameterName(),this.PARAMETER_AT_START],[this.PARAMETER_AT_END.getParameterName(),this.PARAMETER_AT_END]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(sE.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(sE.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(sE.PARAMETER_AT_END_NAME);if(n>=r){let e="";return e+=t.substring(0,r)+t.substring(n),new eu([ea.outputOf(new Map([[sE.EVENT_RESULT_NAME,e.toString()]]))])}return new eu([ea.outputOf(new Map([[sE.EVENT_RESULT_NAME,t]]))])}}class su extends e3{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_POSITION_NAME="position"}static{this.PARAMETER_INSERT_STRING_NAME="insertString"}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(su.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(su.PARAMETER_AT_POSITION_NAME),n=e?.getArguments()?.get(su.PARAMETER_INSERT_STRING_NAME),s="";return s+=t.substring(0,r)+n+t.substring(r),new eu([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,s]]))])}constructor(...e){super(...e),this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new X(su.PARAMETER_STRING_NAME,Y.ofString(su.PARAMETER_STRING_NAME)),this.PARAMETER_AT_POSITION=new X(su.PARAMETER_AT_POSITION_NAME,Y.ofInteger(su.PARAMETER_AT_POSITION_NAME)),this.PARAMETER_INSERT_STRING=new X(su.PARAMETER_INSERT_STRING_NAME,Y.ofString(su.PARAMETER_INSERT_STRING_NAME)),this.EVENT_STRING=new es(es.OUTPUT,new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]])),this.signature=new eT("InsertAtGivenPosition").setNamespace(p.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_POSITION.getParameterName(),this.PARAMETER_AT_POSITION],[this.PARAMETER_INSERT_STRING.getParameterName(),this.PARAMETER_INSERT_STRING]])).setEvents(new Map([es.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]))]))}}class sA extends e3{static{this.PARAMETER_REGEX_NAME="regex"}static{this.PARAMETER_STRING_NAME="string"}static{this.EVENT_RESULT_NAME="result"}static{this.signature=new eT("Matches").setNamespace(p.STRING).setParameters(q.ofEntries(q.entry(...X.ofEntry(sA.PARAMETER_REGEX_NAME,Y.ofString(sA.PARAMETER_REGEX_NAME))),q.entry(...X.ofEntry(sA.PARAMETER_STRING_NAME,Y.ofString(sA.PARAMETER_STRING_NAME))))).setEvents(q.ofEntries(q.entry(...es.outputEventMapEntry(new Map([[sA.EVENT_RESULT_NAME,Y.ofBoolean(sA.EVENT_RESULT_NAME)]])))))}getSignature(){return sA.signature}async internalExecute(e){let t=e.getArguments()?.get(sA.PARAMETER_REGEX_NAME),r=e.getArguments()?.get(sA.PARAMETER_STRING_NAME);return new eu([ea.outputOf(new Map([[sA.EVENT_RESULT_NAME,!!r.match(t)?.length]]))])}}class sT extends e3{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_POSTPAD_STRING_NAME="postpadString"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new X(sT.PARAMETER_STRING_NAME,Y.ofString(sT.PARAMETER_STRING_NAME))}static{this.PARAMETER_POSTPAD_STRING=new X(sT.PARAMETER_POSTPAD_STRING_NAME,Y.ofString(sT.PARAMETER_POSTPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(sT.PARAMETER_LENGTH_NAME,Y.ofInteger(sT.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sT.EVENT_RESULT_NAME,Y.ofString(sT.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new eT("PostPad").setNamespace(p.STRING).setParameters(new Map([[sT.PARAMETER_STRING.getParameterName(),sT.PARAMETER_STRING],[sT.PARAMETER_POSTPAD_STRING.getParameterName(),sT.PARAMETER_POSTPAD_STRING],[sT.PARAMETER_LENGTH.getParameterName(),sT.PARAMETER_LENGTH]])).setEvents(new Map([[sT.EVENT_STRING.getName(),sT.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(sT.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(sT.PARAMETER_POSTPAD_STRING_NAME),n=e.getArguments()?.get(sT.PARAMETER_LENGTH_NAME),s="",a=r.length;for(s+=t;a<=n;)s+=r,a+=r.length;return s.length-t.length<n&&(s+=r.substring(0,n-(s.length-t.length))),new eu([ea.outputOf(new Map([[sT.EVENT_RESULT_NAME,s.toString()]]))])}}class sl extends e3{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_PREPAD_STRING_NAME="prepadString"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new X(sl.PARAMETER_STRING_NAME,Y.ofString(sl.PARAMETER_STRING_NAME))}static{this.PARAMETER_PREPAD_STRING=new X(sl.PARAMETER_PREPAD_STRING_NAME,Y.ofString(sl.PARAMETER_PREPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(sl.PARAMETER_LENGTH_NAME,Y.ofInteger(sl.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sl.EVENT_RESULT_NAME,Y.ofString(sl.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("PrePad").setNamespace(p.STRING).setParameters(new Map([[sl.PARAMETER_STRING.getParameterName(),sl.PARAMETER_STRING],[sl.PARAMETER_PREPAD_STRING.getParameterName(),sl.PARAMETER_PREPAD_STRING],[sl.PARAMETER_LENGTH.getParameterName(),sl.PARAMETER_LENGTH]])).setEvents(new Map([[sl.EVENT_STRING.getName(),sl.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(sl.PARAMETER_STRING_NAME),r=e.getArguments()?.get(sl.PARAMETER_PREPAD_STRING_NAME),n=e.getArguments()?.get(sl.PARAMETER_LENGTH_NAME),s="",a=r.length;for(;a<=n;)s+=r,a+=r.length;return s.length<n&&(s+=r.substring(0,n-s.length)),s+=t,new eu([ea.outputOf(new Map([[sl.EVENT_RESULT_NAME,s]]))])}}class sR extends e3{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_BOOLEAN_NAME="boolean"}static{this.PARAMETER_FIRST_OFFSET_NAME="firstOffset"}static{this.PARAMETER_OTHER_STRING_NAME="otherString"}static{this.PARAMETER_SECOND_OFFSET_NAME="secondOffset"}static{this.PARAMETER_INTEGER_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new X(sR.PARAMETER_STRING_NAME,Y.ofString(sR.PARAMETER_STRING_NAME))}static{this.PARAMETER_OTHER_STRING=new X(sR.PARAMETER_OTHER_STRING_NAME,Y.ofString(sR.PARAMETER_OTHER_STRING_NAME))}static{this.PARAMETER_FIRST_OFFSET=new X(sR.PARAMETER_FIRST_OFFSET_NAME,Y.ofInteger(sR.PARAMETER_FIRST_OFFSET_NAME))}static{this.PARAMETER_SECOND_OFFSET=new X(sR.PARAMETER_SECOND_OFFSET_NAME,Y.ofInteger(sR.PARAMETER_SECOND_OFFSET_NAME))}static{this.PARAMETER_INTEGER=new X(sR.PARAMETER_INTEGER_NAME,Y.ofInteger(sR.PARAMETER_INTEGER_NAME))}static{this.PARAMETER_BOOLEAN=new X(sR.PARAMETER_BOOLEAN_NAME,Y.ofBoolean(sR.PARAMETER_BOOLEAN_NAME))}static{this.EVENT_BOOLEAN=new es(es.OUTPUT,new Map([[sR.EVENT_RESULT_NAME,Y.ofBoolean(sR.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("RegionMatches").setNamespace(p.STRING).setParameters(new Map([[sR.PARAMETER_STRING.getParameterName(),sR.PARAMETER_STRING],[sR.PARAMETER_BOOLEAN.getParameterName(),sR.PARAMETER_BOOLEAN],[sR.PARAMETER_FIRST_OFFSET.getParameterName(),sR.PARAMETER_FIRST_OFFSET],[sR.PARAMETER_OTHER_STRING.getParameterName(),sR.PARAMETER_OTHER_STRING],[sR.PARAMETER_SECOND_OFFSET.getParameterName(),sR.PARAMETER_SECOND_OFFSET],[sR.PARAMETER_INTEGER.getParameterName(),sR.PARAMETER_INTEGER]])).setEvents(new Map([[sR.EVENT_BOOLEAN.getName(),sR.EVENT_BOOLEAN]]))}async internalExecute(e){let t=e.getArguments()?.get(sR.PARAMETER_STRING_NAME),r=e.getArguments()?.get(sR.PARAMETER_BOOLEAN_NAME),n=e.getArguments()?.get(sR.PARAMETER_FIRST_OFFSET_NAME),s=e?.getArguments()?.get(sR.PARAMETER_OTHER_STRING_NAME),a=e?.getArguments()?.get(sR.PARAMETER_SECOND_OFFSET_NAME),i=e.getArguments()?.get(sR.PARAMETER_INTEGER_NAME),o=!1;return o=!(n<0)&&!(a<0)&&!(n+i>t.length)&&!(a+i>s.length)&&(r?(t=t.substring(n,n+i).toUpperCase())==s.substring(a,a+i).toUpperCase():(t=t.substring(n,n+i))==s.substring(a,i)),new eu([ea.outputOf(new Map([[sR.EVENT_RESULT_NAME,o]]))])}}class sm extends e3{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_START_NAME="startPosition"}static{this.PARAMETER_AT_LENGTH_NAME="lengthPosition"}static{this.PARAMETER_REPLACE_STRING_NAME="replaceString"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new X(sm.PARAMETER_STRING_NAME,Y.ofString(sm.PARAMETER_STRING_NAME))}static{this.PARAMETER_AT_START=new X(sm.PARAMETER_AT_START_NAME,Y.ofInteger(sm.PARAMETER_AT_START_NAME))}static{this.PARAMETER_AT_LENGTH=new X(sm.PARAMETER_AT_LENGTH_NAME,Y.ofInteger(sm.PARAMETER_AT_LENGTH_NAME))}static{this.PARAMETER_REPLACE_STRING=new X(sm.PARAMETER_REPLACE_STRING_NAME,Y.ofString(sm.PARAMETER_REPLACE_STRING_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sm.EVENT_RESULT_NAME,Y.ofString(sm.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new eT("ReplaceAtGivenPosition").setNamespace(p.STRING).setParameters(new Map([[sm.PARAMETER_STRING.getParameterName(),sm.PARAMETER_STRING],[sm.PARAMETER_AT_START.getParameterName(),sm.PARAMETER_AT_START],[sm.PARAMETER_AT_LENGTH.getParameterName(),sm.PARAMETER_AT_LENGTH],[sm.PARAMETER_REPLACE_STRING.getParameterName(),sm.PARAMETER_REPLACE_STRING]])).setEvents(new Map([[sm.EVENT_STRING.getName(),sm.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(sm.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(sm.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(sm.PARAMETER_AT_LENGTH_NAME);return e?.getArguments()?.get(sm.PARAMETER_REPLACE_STRING_NAME),t.length,r<n&&(t.substring(0,r),t.substring(r+n)),new eu([ea.outputOf(new Map([[sm.EVENT_RESULT_NAME,t]]))])}}class sg extends e3{constructor(){super(),this.VALUE="value",this.SIGNATURE=new eT("Reverse").setNamespace(p.STRING).setParameters(new Map([[this.VALUE,new X(this.VALUE,Y.ofString(this.VALUE)).setVariableArgument(!1)]])).setEvents(new Map([es.outputEventMapEntry(new Map([[this.VALUE,new Y().setType(L.of(i.STRING)).setName(this.VALUE)]]))]))}getSignature(){return this.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(this.VALUE),r=t.length-1,n="";for(;r>=0;)n+=t.charAt(r--);return new eu([ea.outputOf(q.of(this.VALUE,n))])}}class sh extends e3{getSignature(){return new eT("Split").setNamespace(p.STRING).setParameters(new Map([[this.PARAMETER_STRING_NAME,this.PARAMETER_STRING],[this.PARAMETER_SPLIT_STRING_NAME,this.PARAMETER_SPLIT_STRING]])).setEvents(new Map([es.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,Y.ofArray(this.EVENT_RESULT_NAME)]]))]))}constructor(){super(),this.PARAMETER_STRING_NAME="string",this.PARAMETER_SPLIT_STRING_NAME="searchString",this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new X(this.PARAMETER_STRING_NAME,Y.ofString(this.PARAMETER_STRING_NAME)),this.PARAMETER_SPLIT_STRING=new X(this.PARAMETER_SPLIT_STRING_NAME,Y.ofString(this.PARAMETER_SPLIT_STRING_NAME)),this.EVENT_ARRAY=new es(es.OUTPUT,q.of(this.EVENT_RESULT_NAME,Y.ofArray(this.EVENT_RESULT_NAME)))}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_STRING_NAME),r=e.getArguments()?.get(this.PARAMETER_SPLIT_STRING_NAME);return new eu([ea.outputOf(q.of(this.EVENT_RESULT_NAME,t.split(r)))])}}class sc extends e3{getSignature(){return new eT("ToString").setNamespace(p.STRING).setParameters(new Map([[this.PARAMETER_INPUT_ANYTYPE.getParameterName(),this.PARAMETER_INPUT_ANYTYPE]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}constructor(){super(),this.PARAMETER_INPUT_ANYTYPE_NAME="anytype",this.EVENT_RESULT_NAME="result",this.PARAMETER_INPUT_ANYTYPE=new X(this.PARAMETER_INPUT_ANYTYPE_NAME,Y.ofAny(this.PARAMETER_INPUT_ANYTYPE_NAME)),this.EVENT_STRING=new es(es.OUTPUT,new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]))}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_INPUT_ANYTYPE_NAME),r="";return r="object"==typeof t?JSON.stringify(t,void 0,2):""+t,new eu([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,r]]))])}}class sp extends e3{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new X(sp.PARAMETER_STRING_NAME,Y.ofString(sp.PARAMETER_STRING_NAME))}static{this.PARAMETER_LENGTH=new X(sp.PARAMETER_LENGTH_NAME,Y.ofInteger(sp.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new es(es.OUTPUT,new Map([[sp.EVENT_RESULT_NAME,Y.ofString(sp.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eT("TrimTo").setNamespace(p.STRING).setParameters(new Map([[sp.PARAMETER_STRING.getParameterName(),sp.PARAMETER_STRING],[sp.PARAMETER_LENGTH.getParameterName(),sp.PARAMETER_LENGTH]])).setEvents(new Map([[sp.EVENT_STRING.getName(),sp.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(sp.PARAMETER_STRING_NAME),r=e.getArguments()?.get(sp.PARAMETER_LENGTH_NAME);return new eu([ea.outputOf(new Map([[sp.EVENT_RESULT_NAME,t.substring(0,r)]]))])}}class sN{static{this.repoMap=q.ofArrayEntries(si.ofEntryStringAndStringOutput("Trim",e=>e.trim()),si.ofEntryStringAndStringOutput("TrimStart",e=>e.trimStart()),si.ofEntryStringAndStringOutput("TrimEnd",e=>e.trimEnd()),si.ofEntryStringAndIntegerOutput("Length",e=>e.length),si.ofEntryStringStringAndIntegerOutput("Frequency",(e,t)=>{let r=0,n=e.indexOf(t);for(;-1!=n;)r++,n=e.indexOf(t,n+1);return r}),si.ofEntryStringAndStringOutput("LowerCase",e=>e.toLocaleLowerCase()),si.ofEntryStringAndStringOutput("UpperCase",e=>e.toUpperCase()),si.ofEntryStringAndBooleanOutput("IsBlank",e=>""===e.trim()),si.ofEntryStringAndBooleanOutput("IsEmpty",e=>""===e),si.ofEntryStringStringAndBooleanOutput("Contains",(e,t)=>-1!=e.indexOf(t)),si.ofEntryStringStringAndBooleanOutput("EndsWith",(e,t)=>e.endsWith(t)),si.ofEntryStringStringAndBooleanOutput("StartsWith",(e,t)=>e.startsWith(t)),si.ofEntryStringStringAndBooleanOutput("EqualsIgnoreCase",(e,t)=>e.toUpperCase()==t.toUpperCase()),si.ofEntryStringStringAndBooleanOutput("Matches",(e,t)=>new RegExp(t).test(e)),si.ofEntryStringStringAndIntegerOutput("IndexOf",(e,t)=>e.indexOf(t)),si.ofEntryStringStringAndIntegerOutput("LastIndexOf",(e,t)=>e.lastIndexOf(t)),si.ofEntryStringIntegerAndStringOutput("Repeat",(e,t)=>e.repeat(t)),si.ofEntryStringStringIntegerAndIntegerOutput("IndexOfWithStartPoint",(e,t,r)=>e.indexOf(t,r)),si.ofEntryStringStringIntegerAndIntegerOutput("LastIndexOfWithStartPoint",(e,t,r)=>e.lastIndexOf(t,r)),si.ofEntryStringStringStringAndStringOutput("Replace",(e,t,r)=>e.replaceAll(t,r)),si.ofEntryStringStringStringAndStringOutput("ReplaceFirst",(e,t,r)=>e.replace(t,r)),si.ofEntryStringIntegerIntegerAndStringOutput("SubString",(e,t,r)=>e.substring(t,r)),et(new so),et(new sE),et(new su),et(new sT),et(new sl),et(new sR),et(new sm),et(new sg),et(new sh),et(new sc),et(new sp),et(new sA))}static{this.filterableNames=Array.from(sN.repoMap.values()).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=p.STRING?Promise.resolve(void 0):Promise.resolve(sN.repoMap.get(t))}async filter(e){return Promise.resolve(sN.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sf extends e3{static{this.PARAMETER_TIMESTAMP_NAME="isoTimeStamp"}static{this.PARAMETER_TIMESTAMP_NAME_ONE="isoTimeStamp1"}static{this.PARAMETER_TIMESTAMP_NAME_TWO="isoTimeStamp2"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_NUMBER_NAME="number"}static{this.PARAMETER_TIMESTAMP=new X(sf.PARAMETER_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_ONE=new X(sf.PARAMETER_TIMESTAMP_NAME_ONE,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_TIMESTAMP_TWO=new X(sf.PARAMETER_TIMESTAMP_NAME_TWO,Y.ofRef(p.DATE+".Timestamp"))}static{this.PARAMETER_VARIABLE_UNIT=new X(sf.PARAMETER_UNIT_NAME,Y.ofRef(p.DATE+".Timeunit")).setVariableArgument(!0)}static{this.PARAMETER_UNIT=new X(sf.PARAMETER_UNIT_NAME,Y.ofRef(p.DATE+".Timeunit"))}static{this.PARAMETER_NUMBER=new X(sf.PARAMETER_NUMBER_NAME,Y.ofInteger(sf.PARAMETER_NUMBER_NAME))}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_TIMESTAMP_NAME="isoTimeStamp"}static{this.EVENT_INT=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofInteger(sf.EVENT_RESULT_NAME)))}static{this.EVENT_STRING=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofString(sf.EVENT_RESULT_NAME)))}static{this.EVENT_LONG=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofLong(sf.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME)))}static{this.EVENT_TIMESTAMP=new es(es.OUTPUT,q.of(sf.EVENT_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")))}getSignature(){return this.signature}constructor(e,t,...r){if(super(),this.signature=new eT(e).setNamespace(p.DATE).setEvents(q.of(t.getName(),t)),!r?.length)return;let n=new Map;r.forEach(e=>n.set(e.getParameterName(),e)),this.signature.setParameters(n)}static ofEntryTimestampAndIntegerOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME))))])}}(e,sf.EVENT_INT,sf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndBooleanOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME))))])}}(e,sf.EVENT_BOOLEAN,sf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampAndStringOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME))))])}}(e,sf.EVENT_STRING,sf.PARAMETER_TIMESTAMP)]}static ofEntryTimestampIntegerAndTimestampOutput(e,t){return[e,new class extends sf{async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),e.getArguments()?.get(sf.PARAMETER_NUMBER_NAME))))])}}(e,sf.EVENT_INT,sf.PARAMETER_TIMESTAMP,sf.PARAMETER_NUMBER)]}static ofEntryTimestampTimestampAndTOutput(e,t,r,...n){return[e,new class extends sf{async internalExecute(e){let t=[];return n?.length&&t.push(...n.map(t=>e.getArguments()?.get(t.getParameterName()))),new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,r(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME_ONE),e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME_TWO),t)))])}}(e,t,sf.PARAMETER_TIMESTAMP_ONE,sf.PARAMETER_TIMESTAMP_TWO,...n)]}}function s_(e){let t=(0,l.DateTime).fromISO(e);if(!t?.isValid)throw Error("Invalid ISO timestamp");return t}class sM extends sf{static{this.PARAMETER_YEARS_NAME="years"}static{this.PARAMETER_MONTHS_NAME="months"}static{this.PARAMETER_DAYS_NAME="days"}static{this.PARAMETER_HOURS_NAME="hours"}static{this.PARAMETER_MINUTES_NAME="minutes"}static{this.PARAMETER_SECONDS_NAME="seconds"}static{this.PARAMETER_MILLISECONDS_NAME="milliseconds"}constructor(e){super(e?"AddTime":"SubtractTime",sf.EVENT_TIMESTAMP,sf.PARAMETER_TIMESTAMP,X.of(sM.PARAMETER_YEARS_NAME,Y.ofNumber(sM.PARAMETER_YEARS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_MONTHS_NAME,Y.ofNumber(sM.PARAMETER_MONTHS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_DAYS_NAME,Y.ofNumber(sM.PARAMETER_DAYS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_HOURS_NAME,Y.ofNumber(sM.PARAMETER_HOURS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_MINUTES_NAME,Y.ofNumber(sM.PARAMETER_MINUTES_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_SECONDS_NAME,Y.ofNumber(sM.PARAMETER_SECONDS_NAME).setDefaultValue(0)),X.of(sM.PARAMETER_MILLISECONDS_NAME,Y.ofNumber(sM.PARAMETER_MILLISECONDS_NAME).setDefaultValue(0))),this.isAdd=e}async internalExecute(e){let t;let r=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),n=e.getArguments()?.get(sM.PARAMETER_YEARS_NAME),s=e.getArguments()?.get(sM.PARAMETER_MONTHS_NAME),a=e.getArguments()?.get(sM.PARAMETER_DAYS_NAME),i=e.getArguments()?.get(sM.PARAMETER_HOURS_NAME),o={years:n,months:s,days:a,hours:i,minutes:e.getArguments()?.get(sM.PARAMETER_MINUTES_NAME),seconds:e.getArguments()?.get(sM.PARAMETER_SECONDS_NAME),milliseconds:e.getArguments()?.get(sM.PARAMETER_MILLISECONDS_NAME)};return t=this.isAdd?r.plus(o):r.minus(o),new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,t.toISO()))])}}class sS extends e3{constructor(e,t){super(),this.paramName=`epoch${t?"Seconds":"Milliseconds"}`,this.isSeconds=t,this.signature=new eT(e).setNamespace(p.DATE).setParameters(new Map([[this.paramName,X.of(this.paramName,new Y().setName(this.paramName).setType(L.of(i.LONG,i.INTEGER,i.STRING)))]])).setEvents(new Map([[sf.EVENT_TIMESTAMP_NAME,sf.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=parseInt(e.getArguments()?.get(this.paramName)),r=this.isSeconds?1e3*t:t;if(isNaN(r))throw Error(`Please provide a valid value for ${this.paramName}.`);return Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,new Date(r).toISOString()))]))}}class sO extends e3{constructor(e,t){super(),this.isSeconds=t,this.signature=new eT(e).setNamespace(p.DATE).setParameters(new Map([[sf.PARAMETER_TIMESTAMP_NAME,sf.PARAMETER_TIMESTAMP]])).setEvents(new Map([[sf.EVENT_RESULT_NAME,sf.EVENT_LONG]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),r=this.isSeconds?(0,l.DateTime).fromISO(t).toSeconds():(0,l.DateTime).fromISO(t).toMillis();return Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,r))]))}}class sw extends sf{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("ToDateString",sf.EVENT_STRING,sf.PARAMETER_TIMESTAMP,X.of(sw.PARAMETER_FORMAT_NAME,Y.ofString(sw.PARAMETER_FORMAT_NAME)),X.of(sw.PARAMETER_LOCALE_NAME,Y.ofString(sw.PARAMETER_LOCALE_NAME).setDefaultValue("")))}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(sw.PARAMETER_FORMAT_NAME),n=e.getArguments()?.get(sw.PARAMETER_LOCALE_NAME);return""===n&&(n="system"),new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t.toFormat(r,{locale:n})))])}}class sI extends sf{static{this.PARAMETER_TIMEZONE_NAME="timezone"}constructor(){super("SetTimeZone",sf.EVENT_TIMESTAMP,sf.PARAMETER_TIMESTAMP,X.of(sI.PARAMETER_TIMEZONE_NAME,Y.ofString(sI.PARAMETER_TIMEZONE_NAME)))}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(sI.PARAMETER_TIMEZONE_NAME);return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,t.setZone(r).toISO()))])}}class sP extends sf{static{this.PARAMETER_START_TIMESTAMP_NAME="startTimestamp"}static{this.PARAMETER_END_TIMESTAMP_NAME="endTimestamp"}static{this.PARAMETER_CHECK_TIMESTAMP_NAME="checkTimestamp"}constructor(){super("IsBetween",sP.EVENT_BOOLEAN,X.of(sP.PARAMETER_START_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")),X.of(sP.PARAMETER_END_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")),X.of(sP.PARAMETER_CHECK_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")))}async internalExecute(e){let t=e.getArguments()?.get(sP.PARAMETER_START_TIMESTAMP_NAME),r=e.getArguments()?.get(sP.PARAMETER_END_TIMESTAMP_NAME),n=e.getArguments()?.get(sP.PARAMETER_CHECK_TIMESTAMP_NAME),s=s_(t),a=s_(r),i=s_(n);return s>a&&([s,a]=[a,s]),new eu([ea.outputOf(q.of(sP.EVENT_RESULT_NAME,s<=i&&i<=a))])}}class sd extends e3{constructor(e){super(),this.isLast=e,this.signature=new eT(e?"LastOf":"FirstOf").setNamespace(p.DATE).setParameters(new Map([[sf.PARAMETER_TIMESTAMP_NAME,new X(sf.PARAMETER_TIMESTAMP_NAME,Y.ofRef(p.DATE+".Timestamp")).setVariableArgument(!0)]])).setEvents(new Map([[sf.EVENT_TIMESTAMP_NAME,sf.EVENT_TIMESTAMP]]))}getSignature(){return this.signature}internalExecute(e){let t=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME);if(!t?.length)throw Error("No timestamps provided");let r=t.map(e=>s_(e));return r.sort((e,t)=>e.toMillis()-t.toMillis()),Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,r[this.isLast?r.length-1:0].toISO()))]))}}class sy extends sf{static{this.EVENT_TIME_OBJECT_NAME="object"}static{this.EVENT_TIME_ARRAY_NAME="array"}constructor(e){super(e?"TimeAsArray":"TimeAsObject",new es(es.OUTPUT,q.of(e?sy.EVENT_TIME_ARRAY_NAME:sy.EVENT_TIME_OBJECT_NAME,e?Y.ofArray(sy.EVENT_TIME_ARRAY_NAME,Y.ofInteger("timeParts")):Y.ofRef(p.DATE+".TimeObject"))),sf.PARAMETER_TIMESTAMP),this.isArray=e}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)).toObject();return new eu([ea.outputOf(q.of(this.isArray?sy.EVENT_TIME_ARRAY_NAME:sy.EVENT_TIME_OBJECT_NAME,this.isArray?[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond]:t))])}}class sx extends sf{constructor(e){super(e?"StartOf":"EndOf",sf.EVENT_TIMESTAMP,sf.PARAMETER_TIMESTAMP,sf.PARAMETER_UNIT),this.isStart=e}async internalExecute(e){let t=s_(e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME)),r=e.getArguments()?.get(sf.PARAMETER_UNIT_NAME)?.toLowerCase(),n=this.isStart?t.startOf(r):t.endOf(r);return new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,n.toISO()))])}}class sL extends sf{static{this.EVENT_NAMES_NAME="names"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_LOCALE_NAME="locale"}constructor(){super("GetNames",new es(sL.EVENT_NAMES_NAME,q.of(sL.EVENT_NAMES_NAME,Y.ofArray(sL.EVENT_NAMES_NAME,Y.ofString(sL.EVENT_NAMES_NAME)))),new X(sL.PARAMETER_UNIT_NAME,Y.ofString(sL.PARAMETER_UNIT_NAME).setEnums(["TIMEZONES","MONTHS","WEEKDAYS"])),new X(sL.PARAMETER_LOCALE_NAME,Y.ofString(sL.PARAMETER_LOCALE_NAME).setDefaultValue("system")))}async internalExecute(e){let t=e.getArguments()?.get(sL.PARAMETER_UNIT_NAME),r=e.getArguments()?.get(sL.PARAMETER_LOCALE_NAME);return new eu([ea.outputOf(q.of(sL.EVENT_NAMES_NAME,this.getNames(t,r)))])}getNames(e,t){return"TIMEZONES"===e?Intl.supportedValuesOf("timeZone"):"MONTHS"===e?[1,2,3,4,5,6,7,8,9,10,11,12].map(e=>(0,l.DateTime).now().setLocale(t).set({month:e}).toFormat("MMMM")):"WEEKDAYS"===e?[1,2,3,4,5,6,7].map(e=>(0,l.DateTime).now().setLocale(t).set({month:7,day:e}).toFormat("EEEE")):[]}}class sv extends e3{static{this.SIGNATURE=new eT("IsValidISODate").setNamespace(p.DATE).setParameters(new Map([X.ofEntry(sf.PARAMETER_TIMESTAMP_NAME,Y.ofString(sf.PARAMETER_TIMESTAMP_NAME))])).setEvents(new Map([es.outputEventMapEntry(q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME)))]))}internalExecute(e){let t=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),r=(0,l.DateTime).fromISO(t);return Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,r.isValid))]))}getSignature(){return sv.SIGNATURE}}class sU extends sf{static{this.PARAMETER_FROM_NAME="from"}static{this.PARAMETER_FROM=new X(sU.PARAMETER_FROM_NAME,Y.ofRef(p.DATE+".Timestamp").setDefaultValue(""))}static{this.PARAMETER_LOCALE_NAME="locale"}static{this.PARAMETER_LOCALE=new X(sU.PARAMETER_LOCALE_NAME,Y.ofString(sU.PARAMETER_LOCALE_NAME).setDefaultValue("system"))}static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_FORMAT=new X(sU.PARAMETER_FORMAT_NAME,Y.ofString(sU.PARAMETER_FORMAT_NAME).setEnums(["LONG","SHORT","NARROW"]).setDefaultValue("LONG"))}static{this.PARAMETER_ROUND_NAME="round"}static{this.PARAMETER_ROUND=new X(sU.PARAMETER_ROUND_NAME,Y.ofBoolean(sU.PARAMETER_ROUND_NAME).setDefaultValue(!0))}constructor(){super("FromNow",sf.EVENT_STRING,sf.PARAMETER_TIMESTAMP,sU.PARAMETER_FORMAT,sU.PARAMETER_FROM,sf.PARAMETER_VARIABLE_UNIT,sU.PARAMETER_ROUND,sU.PARAMETER_LOCALE)}internalExecute(e){let t=e.getArguments()?.get(sU.PARAMETER_FROM_NAME),r=""===t?(0,l.DateTime).now():(0,l.DateTime).fromISO(t),n=e.getArguments()?.get(sf.PARAMETER_TIMESTAMP_NAME),s=(0,l.DateTime).fromISO(n),a=e.getArguments()?.get(sU.PARAMETER_UNIT_NAME),i=e.getArguments()?.get(sU.PARAMETER_FORMAT_NAME),o=e.getArguments()?.get(sU.PARAMETER_ROUND_NAME),E=e.getArguments()?.get(sU.PARAMETER_LOCALE_NAME),u={base:r,style:i?.toLowerCase(),round:o,locale:E};return a?.length>0&&(u.unit=a.map(e=>e.toLowerCase())),Promise.resolve(new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,s.toRelative(u)??"Unknown"))]))}}class sV extends sf{static{this.PARAMETER_FORMAT_NAME="format"}static{this.PARAMETER_TIMESTAMP_STRING_NAME="timestampString"}constructor(){super("FromDateString",sf.EVENT_TIMESTAMP,X.of(sV.PARAMETER_TIMESTAMP_STRING_NAME,Y.ofString(sV.PARAMETER_TIMESTAMP_STRING_NAME)),X.of(sV.PARAMETER_FORMAT_NAME,Y.ofString(sV.PARAMETER_FORMAT_NAME)))}async internalExecute(e){let t=e.getArguments()?.get(sV.PARAMETER_TIMESTAMP_STRING_NAME),r=e.getArguments()?.get(sV.PARAMETER_FORMAT_NAME),n=(0,l.DateTime).fromFormat(t,r);return new eu([ea.outputOf(q.of(sf.EVENT_RESULT_NAME,n.toISO()))])}}class sC extends sf{constructor(){super("GetCurrentTimestamp",sf.EVENT_TIMESTAMP)}async internalExecute(e){return new eu([ea.outputOf(q.of(sf.EVENT_TIMESTAMP_NAME,(0,l.DateTime).now().toISO()))])}}class sD{static{this.repoMap=q.ofArrayEntries(["EpochSecondsToTimestamp",new sS("EpochSecondsToTimestamp",!0)],["EpochMillisecondsToTimestamp",new sS("EpochMillisecondsToTimestamp",!1)],sf.ofEntryTimestampAndIntegerOutput("GetDay",e=>s_(e).day),sf.ofEntryTimestampAndIntegerOutput("GetDayOfWeek",e=>s_(e).weekday),sf.ofEntryTimestampAndIntegerOutput("GetMonth",e=>s_(e).month),sf.ofEntryTimestampAndIntegerOutput("GetYear",e=>s_(e).year),sf.ofEntryTimestampAndIntegerOutput("GetHours",e=>s_(e).hour),sf.ofEntryTimestampAndIntegerOutput("GetMinutes",e=>s_(e).minute),sf.ofEntryTimestampAndIntegerOutput("GetSeconds",e=>s_(e).second),sf.ofEntryTimestampAndIntegerOutput("GetMilliseconds",e=>s_(e).millisecond),sf.ofEntryTimestampAndIntegerOutput("GetDaysInMonth",e=>s_(e).daysInMonth),sf.ofEntryTimestampAndIntegerOutput("GetDaysInYear",e=>s_(e).daysInYear),["TimestampToEpochSeconds",new sO("TimestampToEpochSeconds",!0)],["TimestampToEpochMilliseconds",new sO("TimestampToEpochMilliseconds",!1)],sf.ofEntryTimestampAndStringOutput("GetTimeZoneName",e=>s_(e).zoneName),sf.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetLong",e=>s_(e).offsetNameLong),sf.ofEntryTimestampAndStringOutput("GetTimeZoneOffsetShort",e=>s_(e).offsetNameShort),sf.ofEntryTimestampAndIntegerOutput("GetTimeZoneOffset",e=>s_(e).offset),["ToDateString",new sw],["AddTime",new sM(!0)],["SubtractTime",new sM(!1)],["GetCurrentTimestamp",new sC],sf.ofEntryTimestampTimestampAndTOutput("Difference",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofRef(`${p.DATE}.Duration`))),(e,t,r)=>{let n;let s=s_(e),a=s_(t);return r?.[0]?.length&&(n=r[0]?.filter(e=>!!e).map(e=>e.toLowerCase())),s.diff(a,n).toObject()},sf.PARAMETER_VARIABLE_UNIT),sf.ofEntryTimestampIntegerAndTimestampOutput("SetDay",(e,t)=>s_(e).set({day:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetMonth",(e,t)=>s_(e).set({month:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetYear",(e,t)=>s_(e).set({year:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetHours",(e,t)=>s_(e).set({hour:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetMinutes",(e,t)=>s_(e).set({minute:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetSeconds",(e,t)=>s_(e).set({second:t}).toISO()),sf.ofEntryTimestampIntegerAndTimestampOutput("SetMilliseconds",(e,t)=>s_(e).set({millisecond:t}).toISO()),["SetTimeZone",new sI],sf.ofEntryTimestampTimestampAndTOutput("IsBefore",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)<s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsAfter",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)>s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsSame",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)===s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsSameOrBefore",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)<=s_(t)),sf.ofEntryTimestampTimestampAndTOutput("IsSameOrAfter",new es(es.OUTPUT,q.of(sf.EVENT_RESULT_NAME,Y.ofBoolean(sf.EVENT_RESULT_NAME))),(e,t)=>s_(e)>=s_(t)),sf.ofEntryTimestampAndBooleanOutput("IsInLeapYear",e=>s_(e).isInLeapYear),sf.ofEntryTimestampAndBooleanOutput("IsInDST",e=>s_(e).isInDST),["IsBetween",new sP],["LastOf",new sd(!0)],["FirstOf",new sd(!1)],["StartOf",new sx(!0)],["EndOf",new sx(!1)],["TimeAsObject",new sy(!1)],["TimeAsArray",new sy(!0)],["GetNames",new sL],["IsValidISODate",new sv],["FromNow",new sU],["FromDateString",new sV])}static{this.filterableNames=Array.from(sD.repoMap.values()).map(e=>e.getSignature().getFullName())}find(e,t){return e!=p.DATE?Promise.resolve(void 0):Promise.resolve(sD.repoMap.get(t))}filter(e){return Promise.resolve(sD.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sG extends e3{static{this.MILLIS="millis"}static{this.SIGNATURE=new eT("Wait").setNamespace(p.SYSTEM).setParameters(new Map([X.ofEntry(sG.MILLIS,Y.ofNumber(sG.MILLIS).setMinimum(0).setDefaultValue(0))])).setEvents(new Map([es.outputEventMapEntry(new Map)]))}getSignature(){return sG.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(sG.MILLIS);return await new Promise(e=>setTimeout(e,t)),new eu([ea.outputOf(new Map)])}}var sb={};m(sb,"HybridRepository",()=>sF);class sF{constructor(...e){this.repos=e}async find(e,t){for(let r of this.repos){let n=await r.find(e,t);if(n)return n}}async filter(e){let t=new Set;for(let r of this.repos)(await r.filter(e)).forEach(e=>t.add(e));return Array.from(t)}}const sB=new Map([[p.SYSTEM_CTX,new Map([et(new class extends e3{getSignature(){return rn}async internalExecute(e){let t=e?.getArguments()?.get(rt);if(e?.getContext()?.has(t))throw new eE(ec.format("Context already has an element for '$' ",t));let r=Y.from(e?.getArguments()?.get(rr));if(!r)throw new eE("Schema is not supplied.");return e.getContext().set(t,new re(r,_(r.getDefaultValue())?void 0:r.getDefaultValue())),new eu([ea.outputOf(new Map)])}}),et(new class extends e3{getSignature(){return ri}async internalExecute(e){let t=e?.getArguments()?.get(rs);if(!e.getContext()?.has(t))throw new eE(ec.format("Context don't have an element for '$' ",t));return new eu([ea.outputOf(new Map([ra,e.getContext()?.get(t)?.getElement()]))])}}),et(new class extends e3{getSignature(){return nR}async internalExecute(e){let t=e?.getArguments()?.get(nT);if(eM.isNullOrBlank(t))throw new eE("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get(nl),n=new tY(t),s=n.getTokens().peekLast();if(!s.getExpression().startsWith("Context")||s instanceof tY||s instanceof tb&&!s.getElement().toString().startsWith("Context"))throw new tr(ec.format("The context path $ is not a valid path in context",t));for(let e of n.getOperations().toArray())if(e!=tB.ARRAY_OPERATOR&&e!=tB.OBJECT_OPERATOR)throw new tr(ec.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<n.getTokens().size();r++){let s=n.getTokens().get(r);s instanceof tY&&n.getTokens().set(r,new tb(t,new nA(s).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,n)}modifyContext(e,t,r,n){let s=n.getTokens();s.removeLast();let a=n.getOperations();a.removeLast();let i=e.getContext()?.get(s.removeLast().getExpression());if(_(i))throw new eE(ec.format("Context doesn't have any element with name '$' ",t));if(a.isEmpty())return i.setElement(r),new eu([ea.outputOf(new Map)]);let o=i.getElement(),E=a.removeLast(),u=s.removeLast(),A=u instanceof tb?u.getElement():u.getExpression();for(_(o)&&(o=E==tB.OBJECT_OPERATOR?{}:[],i.setElement(o));!a.isEmpty();)o=E==tB.OBJECT_OPERATOR?this.getDataFromObject(o,A,a.peekLast()):this.getDataFromArray(o,A,a.peekLast()),E=a.removeLast(),A=(u=s.removeLast())instanceof tb?u.getElement():u.getExpression();return E==tB.OBJECT_OPERATOR?this.putDataInObject(o,A,r):this.putDataInArray(o,A,r),new eu([ea.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eE(ec.format("Expected an array index but found $",t));if(n<0)throw new eE(ec.format("Array index is out of bound - $",t));let s=e[n];return _(s)&&(s=r==tB.OBJECT_OPERATOR?{}:[],e[n]=s),s}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));let n=e[t];return _(n)&&(n=r==tB.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r){if(!Array.isArray(e))throw new eE(ec.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eE(ec.format("Expected an array index but found $",t));if(n<0)throw new eE(ec.format("Array index is out of bound - $",t));e[n]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eE(ec.format("Expected an object but found $",e));e[t]=r}})])],[p.SYSTEM_LOOP,new Map([et(new class extends e3{getSignature(){return nV}async internalExecute(e){let t=e.getArguments()?.get(nx),r=e.getArguments()?.get("to"),n=e.getArguments()?.get(nL),s=n>0,a=t,i=!1,o=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(i)return;if(s&&a>=r||!s&&a<=r||o&&e.getExecutionContext()?.get(o))return i=!0,o&&e.getExecutionContext()?.delete(o),ea.outputOf(new Map([[nv,a]]));let t=ea.of(es.ITERATION,new Map([[nU,a]]));return a+=n,t}})}}),et(new class extends e3{getSignature(){return nO}async internalExecute(e){let t=e.getArguments()?.get(n_),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(r>=t||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),ea.outputOf(new Map([[nM,r]]));let s=ea.of(es.ITERATION,new Map([[nS,r]]));return++r,s}})}}),et(new class extends e3{getSignature(){return nf}async internalExecute(e){let t=e.getArguments()?.get(nN);return e.getExecutionContext().set(t,!0),new eu([ea.outputOf(new Map)])}}),et(new class extends e3{getSignature(){return ny}async internalExecute(e){let t=e.getArguments()?.get(nw),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new eu({next(){if(r>=t.length||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),ea.outputOf(new Map([[nd,r]]));let s=ea.of(es.ITERATION,new Map([[nP,r],[nI,t[r]]]));return++r,s}})}})])],[p.SYSTEM,new Map([et(new np),et(new class extends e3{getSignature(){return nc}async internalExecute(e){let t=e.getEvents(),r=e.getArguments(),n=r?.get(ng),s=e?.getArguments()?.get(nh).map(t=>{let r=t[nm];if(_(r))throw new eE("Expect a value object");let n=r.value;return r.isExpression&&(n=new nA(n).evaluate(e.getValuesMap())),[t.name,n]}).reduce((e,t)=>(e.set(t[0],t[1]),e),new Map);return t?.has(n)||t?.set(n,[]),t?.get(n)?.push(s),new eu([ea.outputOf(new Map)])}}),et(new sa),et(new sG),et(new t6)])]]),sY=Array.from(sB.values()).flatMap(e=>Array.from(e.values())).map(e=>e.getSignature().getFullName());class sH extends sF{constructor(){super({find:async(e,t)=>sB.get(e)?.get(t),filter:async e=>Array.from(sY).filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase()))},new nZ,new sN,new t7,new ss,new sD)}}var sk={};m(sk,"StatementExecution",()=>sW);var s$={};m(s$,"StatementMessage",()=>sj);class sj{constructor(e,t){this.message=t,this.messageType=e}getMessageType(){return this.messageType}setMessageType(e){return this.messageType=e,this}getMessage(){return this.message}setMessage(e){return this.message=e,this}toString(){return`${this.messageType} : ${this.message}`}}class sW{constructor(e){this.messages=[],this.dependencies=new Set,this.statement=e}getStatement(){return this.statement}setStatement(e){return this.statement=e,this}getMessages(){return this.messages}setMessages(e){return this.messages=e,this}getDependencies(){return this.dependencies}setDependencies(e){return this.dependencies=e,this}getUniqueKey(){return this.statement.getStatementName()}addMessage(e,t){this.messages.push(new sj(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){return e instanceof sW&&e.statement.equals(this.statement)}}var sX={};m(sX,"ContextTokenValueExtractor",()=>sJ);class sJ extends tk{static{this.PREFIX="Context."}constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.context.get(r)?.getElement())}getPrefix(){return sJ.PREFIX}getStore(){return _(this.context)?this.context:Array.from(this.context.entries()).reduce((e,[t,r])=>(_(r)||(e[t]=r.getElement()),e),{})}}var sq={};m(sq,"OutputMapTokenValueExtractor",()=>sz);class sz extends tk{static{this.PREFIX="Steps."}constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=1,n=this.output.get(t[r++]);if(!n||r>=t.length)return;let s=n.get(t[r++]);if(!s||r>t.length)return;if(r===t.length)return s;let a=t[r].indexOf("[");if(-1===a){let n=s.get(t[r++]);return this.retrieveElementFrom(e,t,r,n)}let i=t[r].substring(0,a),o=s.get(i);return this.retrieveElementFrom(e,t,r,{[i]:o})}getPrefix(){return sz.PREFIX}getStore(){return this.convertMapToObj(this.output)}convertMapToObj(e){return 0===e.size?{}:Array.from(e.entries()).reduce((e,[t,r])=>(e[t]=r instanceof Map?this.convertMapToObj(r):r,e),{})}}var sK={};m(sK,"ArgumentsTokenValueExtractor",()=>sQ);class sQ extends tk{static{this.PREFIX="Arguments."}constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(tk.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.args.get(r))}getPrefix(){return sQ.PREFIX}getStore(){return _(this.args)?this.args:Array.from(this.args.entries()).reduce((e,[t,r])=>(e[t]=r,e),{})}}var sZ={};m(sZ,"GraphVertex",()=>s2);var s0={};m(s0,"ExecutionGraph",()=>s1);class s1{constructor(e=!1){this.nodeMap=new Map,this.isSubGrph=e}getVerticesData(){return Array.from(this.nodeMap.values()).map(e=>e.getData())}addVertex(e){if(!this.nodeMap.has(e.getUniqueKey())){let t=new s2(this,e);this.nodeMap.set(e.getUniqueKey(),t)}return this.nodeMap.get(e.getUniqueKey())}getVertex(e){return this.nodeMap.get(e)}getVertexData(e){if(this.nodeMap.has(e))return this.nodeMap.get(e).getData()}getVerticesWithNoIncomingEdges(){return Array.from(this.nodeMap.values()).filter(e=>!e.hasIncomingEdges())}isCyclic(){let e,t=new ep(this.getVerticesWithNoIncomingEdges()),r=new Set;for(;!t.isEmpty();){if(r.has(t.getFirst().getKey()))return!0;e=t.removeFirst(),r.add(e.getKey()),e.hasOutgoingEdges()&&t.addAll(Array.from(e.getOutVertices().values()).flatMap(e=>Array.from(e)))}return!1}addVertices(e){for(let t of e)this.addVertex(t)}getNodeMap(){return this.nodeMap}isSubGraph(){return this.isSubGrph}toString(){return"Execution Graph : \n"+Array.from(this.nodeMap.values()).map(e=>e.toString()).join("\n")}}class s2{constructor(e,t){this.outVertices=new Map,this.inVertices=new Set,this.data=t,this.graph=e}getData(){return this.data}setData(e){return this.data=e,this}getOutVertices(){return this.outVertices}setOutVertices(e){return this.outVertices=e,this}getInVertices(){return this.inVertices}setInVertices(e){return this.inVertices=e,this}getGraph(){return this.graph}setGraph(e){return this.graph=e,this}getKey(){return this.data.getUniqueKey()}addOutEdgeTo(e,t){return this.outVertices.has(e)||this.outVertices.set(e,new Set),this.outVertices.get(e).add(t),t.inVertices.add(new ew(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new ew(e,t)),e.outVertices.has(t)||e.outVertices.set(t,new Set),e.outVertices.get(t).add(this),e}hasIncomingEdges(){return!!this.inVertices.size}hasOutgoingEdges(){return!!this.outVertices.size}getSubGraphOfType(e){let t=new s1(!0);var r=new ep(Array.from(this.outVertices.get(e)??[]));for(r.map(e=>e.getData()).forEach(e=>t.addVertex(e));!r.isEmpty();)Array.from(r.pop().outVertices.values()).flatMap(e=>Array.from(e)).forEach(e=>{t.addVertex(e.getData()),r.add(e)});return t}toString(){var e=Array.from(this.getInVertices()).map(e=>e.getT1().getKey()+"("+e.getT2()+")").join(", "),t=Array.from(this.outVertices.entries()).map(([e,t])=>e+": "+Array.from(t).map(e=>e.getKey()).join(",")).join("\n ");return this.getKey()+":\n In: "+e+"\n Out: \n "+t}}var s9={};m(s9,"KIRuntime",()=>at);var s3={};m(s3,"JsonExpression",()=>s4);class s4{constructor(e){this.expression=e}getExpression(){return this.expression}}var s5={};m(s5,"ParameterReferenceType",()=>A),(s=A||(A={})).VALUE="VALUE",s.EXPRESSION="EXPRESSION";var s6={};function s7(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|8).toString(16)})}m(s6,"FunctionExecutionParameters",()=>s8);class s8{constructor(e,t,r){this.count=0,this.executionContext=new Map,this.valueExtractors=new Map,this.functionRepository=e,this.schemaRepository=t,this.executionId=r??s7()}getExecutionId(){return this.executionId}getContext(){return this.context}setContext(e){this.context=e;let t=new sJ(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){return this.args=e,this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getStatementExecution(){return this.statementExecution}setStatementExecution(e){return this.statementExecution=e,this}getSteps(){return this.steps}setSteps(e){this.steps=e;let t=new sz(e);return this.valueExtractors.set(t.getPrefix(),t),this}getCount(){return this.count}setCount(e){return this.count=e,this}getValuesMap(){return this.valueExtractors}getFunctionRepository(){return this.functionRepository}setFunctionRepository(e){return this.functionRepository=e,this}getSchemaRepository(){return this.schemaRepository}setSchemaRepository(e){return this.schemaRepository=e,this}addTokenValueExtractor(...e){for(let t of e)this.valueExtractors.set(t.getPrefix(),t);return this}setValuesMap(e){for(let[t,r]of e.entries())this.valueExtractors.set(t,r);return this}setExecutionContext(e){return this.executionContext=e,this}getExecutionContext(){return this.executionContext}}var ae={};m(ae,"StatementMessageType",()=>T),(a=T||(T={})).ERROR="ERROR",a.WARNING="WARNING",a.MESSAGE="MESSAGE";class at extends e3{static{this.PARAMETER_NEEDS_A_VALUE='Parameter "$" needs a value'}static{this.STEP_REGEX_PATTERN=RegExp("Steps\\.([a-zA-Z0-9\\\\-]{1,})\\.([a-zA-Z0-9\\\\-]{1,})","g")}static{this.VERSION=1}static{this.MAX_EXECUTION_ITERATIONS=1e7}constructor(e,t=!1){if(super(),this.debugMode=!1,this.debugMode=t,this.fd=e,this.fd.getVersion()>at.VERSION)throw new eE("Runtime is at a lower version "+at.VERSION+" and trying to run code from version "+this.fd.getVersion()+".")}getSignature(){return this.fd}async getExecutionPlan(e,t){let r=new s1;for(let n of Array.from(this.fd.getSteps().values()))r.addVertex(await this.prepareStatementExecution(n,e,t));return Array.from(this.makeEdges(r).getT2().entries()).forEach(e=>{let t=r.getNodeMap().get(e[0])?.getData();t&&t.addMessage(T.ERROR,e[1])}),r}async internalExecute(e){e.getContext()||e.setContext(new Map),e.getEvents()||e.setEvents(new Map),e.getSteps()||e.setSteps(new Map),e.getArguments()&&e.addTokenValueExtractor(new sQ(e.getArguments())),this.debugMode&&(console.log(`EID: ${e.getExecutionId()} Executing: ${this.fd.getNamespace()}.${this.fd.getName()}`),console.log(`EID: ${e.getExecutionId()} Parameters: `,e));let t=await this.getExecutionPlan(e.getFunctionRepository(),e.getSchemaRepository());this.debugMode&&console.log(`EID: ${e.getExecutionId()} ${t?.toString()}`);let r=t.getVerticesData().filter(e=>e.getMessages().length).map(e=>e.getStatement().getStatementName()+": \n"+e.getMessages().join(","));if(r?.length)throw new eE("Please fix the errors in the function definition before execution : \n"+r.join(",\n"));return await this.executeGraph(t,e)}async executeGraph(e,t){let r=new ep;r.addAll(e.getVerticesWithNoIncomingEdges());let n=new ep;for(;(!r.isEmpty()||!n.isEmpty())&&!t.getEvents()?.has(es.OUTPUT);)if(await this.processBranchQue(t,r,n),await this.processExecutionQue(t,r,n),t.setCount(t.getCount()+1),t.getCount()==at.MAX_EXECUTION_ITERATIONS)throw new eE("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size){let e=this.getSignature().getEvents();if(e.size&&e.get(es.OUTPUT)?.getParameters()?.size)throw new eE("No events raised")}let s=Array.from(t.getEvents()?.entries()??[]).flatMap(e=>e[1].map(t=>ea.of(e[0],t)));return new eu(s.length||e.isSubGraph()?s:[ea.of(es.OUTPUT,new Map)])}async processExecutionQue(e,t,r){if(!t.isEmpty()){let n=t.pop();await this.allDependenciesResolvedVertex(n,e.getSteps())?await this.executeVertex(n,e,r,t,e.getFunctionRepository()):t.add(n)}}async processBranchQue(e,t,r){if(r.length){let n=r.pop();await this.allDependenciesResolvedTuples(n.getT2(),e.getSteps())?await this.executeBranch(e,t,n):r.add(n)}}async executeBranch(e,t,r){let n,s=r.getT4();do if(r.getT1().getVerticesData().map(e=>e.getStatement().getStatementName()).forEach(t=>e.getSteps()?.delete(t)),await this.executeGraph(r.getT1(),e),(n=r.getT3().next())&&(e.getSteps()?.has(s.getData().getStatement().getStatementName())||e.getSteps()?.set(s.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(s.getData().getStatement().getStatementName())?.set(n.getName(),this.resolveInternalExpressions(n.getResult(),e)),this.debugMode)){let t=s.getData().getStatement();console.log(`EID: ${e.getExecutionId()} Step : ${t.getStatementName()} => ${t.getNamespace()}.${t.getName()}`),console.log(`EID: ${e.getExecutionId()} Event : ${n.getName()} : `,e.getSteps().get(t.getStatementName()).get(n.getName()))}while(n&&n.getName()!=es.OUTPUT)n?.getName()==es.OUTPUT&&s.getOutVertices().has(es.OUTPUT)&&(s?.getOutVertices()?.get(es.OUTPUT)??[]).forEach(async r=>{await this.allDependenciesResolvedVertex(r,e.getSteps())&&t.add(r)})}async executeVertex(e,t,r,n,s){let a,i=e.getData().getStatement();if(i.getExecuteIftrue().size&&!(Array.from(i.getExecuteIftrue().entries())??[]).filter(e=>e[1]).map(([e])=>new nA(e).evaluate(t.getValuesMap())).every(e=>!_(e)&&!1!==e))return;let o=await s.find(i.getNamespace(),i.getName());if(!o)throw new eE(ec.format("$.$ function is not found.",i.getNamespace(),i.getName()));let E=o?.getSignature().getParameters(),u=this.getArgumentsFromParametersMap(t,i,E??new Map);this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Arguments : `,u));let A=t.getContext();a=o instanceof at?new s8(t.getFunctionRepository(),t.getSchemaRepository(),`${t.getExecutionId()}_${i.getStatementName()}`).setArguments(u).setValuesMap(new Map(Array.from(t.getValuesMap().values()).filter(e=>e.getPrefix()!==sQ.PREFIX&&e.getPrefix()!==sz.PREFIX&&e.getPrefix()!==sJ.PREFIX).map(e=>[e.getPrefix(),e]))):new s8(t.getFunctionRepository(),t.getSchemaRepository(),t.getExecutionId()).setValuesMap(t.getValuesMap()).setContext(A).setArguments(u).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount()).setExecutionContext(t.getExecutionContext());let T=await o.execute(a),l=T.next();if(!l)throw new eE(ec.format("Executing $ returned no events",i.getStatementName()));let R=l.getName()==es.OUTPUT;if(t.getSteps()?.has(i.getStatementName())||t.getSteps().set(i.getStatementName(),new Map),t.getSteps().get(i.getStatementName()).set(l.getName(),this.resolveInternalExpressions(l.getResult(),t)),this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Event : ${l.getName()} : `,t.getSteps().get(i.getStatementName()).get(l.getName()))),R){let r=e.getOutVertices().get(es.OUTPUT);r&&r.forEach(async e=>{await this.allDependenciesResolvedVertex(e,t.getSteps())&&n.add(e)})}else{let t=e.getSubGraphOfType(l.getName()),n=this.makeEdges(t).getT1();r.push(new eP(t,n,T,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map(e=>new ew(e[0],this.resolveInternalExpression(e[1],t))).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map):e}resolveInternalExpression(e,t){if(_(e)||"object"!=typeof e)return e;if(e instanceof s4)return new nA(e.getExpression()).evaluate(t.getValuesMap());if(Array.isArray(e)){let r=[];for(let n of e)r.push(this.resolveInternalExpression(n,t));return r}if("object"==typeof e){let r={};for(let n of Object.entries(e))r[n[0]]=this.resolveInternalExpression(n[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e)if(!t.has(r.getT1())||!t.get(r.getT1())?.get(r.getT2()))return!1;return!0}allDependenciesResolvedVertex(e,t){return!e.getInVertices().size||0==Array.from(e.getInVertices()).filter(e=>{let r=e.getT1().getData().getStatement().getStatementName(),n=e.getT2();return!(t.has(r)&&t.get(r)?.has(n))}).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map(t=>{let n,s=Array.from(t[1]?.values()??[]);if(!s?.length)return new ew(t[0],n);let a=r.get(t[0]);return a?(n=a.isVariableArgument()?s.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)).filter(e=>!_(e)).map(t=>this.parameterReferenceEvaluation(e,t)).flatMap(e=>Array.isArray(e)?e:[e]):this.parameterReferenceEvaluation(e,s[0]),new ew(t[0],n)):new ew(t[0],void 0)}).filter(e=>!_(e.getT2())).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map)}parameterReferenceEvaluation(e,t){let r;return t.getType()==A.VALUE?r=this.resolveInternalExpression(t.getValue(),e):t.getType()!=A.EXPRESSION||eM.isNullOrBlank(t.getExpression())||(r=new nA(t.getExpression()??"").evaluate(e.getValuesMap())),r}async prepareStatementExecution(e,t,r){let n=new sW(e),s=await t.find(e.getNamespace(),e.getName());if(!s)return n.addMessage(T.ERROR,ec.format("$.$ is not available",e.getNamespace(),e.getName())),Promise.resolve(n);let a=new Map(s.getSignature().getParameters());if(!e.getParameterMap())return Promise.resolve(n);for(let t of Array.from(e.getParameterMap().entries())){let e=a.get(t[0]);if(!e)continue;let s=Array.from(t[1]?.values()??[]);if(!s.length&&!e.isVariableArgument()){await ex.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,e.getParameterName())),a.delete(e.getParameterName());continue}if(e.isVariableArgument())for(let t of(s.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)),s))this.parameterReferenceValidation(n,e,t,r);else if(s.length){let t=s[0];this.parameterReferenceValidation(n,e,t,r)}a.delete(e.getParameterName())}if(!_(n.getStatement().getDependentStatements()))for(let e of Array.from(n.getStatement().getDependentStatements().entries()))e[1]&&n.addDependency(e[0]);if(!_(n.getStatement().getExecuteIftrue()))for(let e of Array.from(n.getStatement().getExecuteIftrue().entries()))e[1]&&this.addDependencies(n,e[0]);if(a.size)for(let e of Array.from(a.values()))e.isVariableArgument()||await ex.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return Promise.resolve(n)}async parameterReferenceValidation(e,t,r,n){if(r){if(r.getType()==A.VALUE){if(_(r.getValue())&&!await ex.hasDefaultValueOrNullSchemaType(t.getSchema(),n)&&e.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,t.getParameterName())),_(r.getValue()))return;let s=new ep;for(s.push(new ew(t.getSchema(),r.getValue()));!s.isEmpty();){let t=s.pop();if(t.getT2() instanceof s4)this.addDependencies(e,t.getT2().getExpression());else{if(_(t.getT1())||_(t.getT1().getType()))continue;if(t.getT1().getType()?.contains(i.ARRAY)&&Array.isArray(t.getT2())){let e=t.getT1().getItems();if(!e)continue;if(e.isSingleType())for(let r of t.getT2())s.push(new ew(e.getSingleSchema(),r));else{let r=t.getT2();for(let t=0;t<r.length;t++)s.push(new ew(e.getTupleSchema()[t],r[t]))}}else if(t.getT1().getType()?.contains(i.OBJECT)&&"object"==typeof t.getT2()){let r=t.getT1();if(r.getName()===X.EXPRESSION.getName()&&r.getNamespace()===X.EXPRESSION.getNamespace()){let r=t.getT2();r.isExpression&&this.addDependencies(e,r.value)}else if(r.getProperties())for(let e of Object.entries(t.getT2()))r.getProperties().has(e[0])&&s.push(new ew(r.getProperties().get(e[0]),e[1]))}}}}else if(r.getType()==A.EXPRESSION){if(eM.isNullOrBlank(r.getExpression()))_(ex.getDefaultValue(t.getSchema(),n))&&e.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,t.getParameterName()));else try{this.addDependencies(e,r.getExpression())}catch(t){e.addMessage(T.ERROR,ec.format("Error evaluating $ : $",r.getExpression(),t))}}}else _(await ex.getDefaultValue(t.getSchema(),n))&&e.addMessage(T.ERROR,ec.format(at.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(at.STEP_REGEX_PATTERN)??[]).forEach(t=>e.addDependency(t))}makeEdges(e){let t=e.getNodeMap().values(),r=[],n=new Map;for(let s of Array.from(t))for(let t of Array.from(s.getData().getDependencies())){let a=t.indexOf(".",6),i=t.substring(6,a),o=t.indexOf(".",a+1),E=-1==o?t.substring(a+1):t.substring(a+1,o);e.getNodeMap().has(i)?s.addInEdgeTo(e.getNodeMap().get(i),E):(r.push(new ew(i,E)),n.set(s.getData().getStatement().getStatementName(),ec.format("Unable to find the step with name $",i)))}return new ew(r,n)}}var ar={};m(ar,"KIRunConstants",()=>an);class an{static{this.NAMESPACE="namespace"}static{this.NAME="name"}static{this.ID="id"}constructor(){}}var as={};m(as,"Position",()=>aa);class aa{static{this.SCHEMA_NAME="Position"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(aa.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["left",Y.ofFloat("left")],["top",Y.ofFloat("top")]]))}constructor(e,t){this.left=e,this.top=t}getLeft(){return this.left}setLeft(e){return this.left=e,this}getTop(){return this.top}setTop(e){return this.top=e,this}static from(e){if(e)return new aa(e.left,e.top)}}var ai={};m(ai,"FunctionDefinition",()=>ah);var ao={};m(ao,"Statement",()=>al);var aE={};m(aE,"AbstractStatement",()=>au);class au{constructor(e){if(this.override=!1,!e)return;this.comment=e.comment,this.description=e.description,this.position=e.position?new aa(e.position.getLeft(),e.position.getTop()):void 0,this.override=e.override}getComment(){return this.comment}setComment(e){return this.comment=e,this}isOverride(){return this.override}setOverride(e){return this.override=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getPosition(){return this.position}setPosition(e){return this.position=e,this}}var aA={};m(aA,"ParameterReference",()=>aT);class aT{static{this.SCHEMA_NAME="ParameterReference"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(aT.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["key",Y.ofString("key")],["value",Y.ofAny("value")],["expression",Y.ofString("expression")],["type",Y.ofString("type").setEnums(["EXPRESSION","VALUE"])],["order",Y.ofInteger("order")]]))}constructor(e){e instanceof aT?(this.key=e.key,this.type=e.type,this.value=_(e.value)?void 0:JSON.parse(JSON.stringify(e.value)),this.expression=e.expression,this.order=e.order):(this.type=e,this.key=s7())}getType(){return this.type}setType(e){return this.type=e,this}getKey(){return this.key}setKey(e){return this.key=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}getExpression(){return this.expression}setExpression(e){return this.expression=e,this}setOrder(e){return this.order=e,this}getOrder(){return this.order}static ofExpression(e){let t=new aT(A.EXPRESSION).setExpression(e);return[t.getKey(),t]}static ofValue(e){let t=new aT(A.VALUE).setValue(e);return[t.getKey(),t]}static from(e){return new aT(e.type).setValue(e.value).setExpression(e.expression).setKey(e.key).setOrder(e.order)}}class al extends au{static{this.SCHEMA_NAME="Statement"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(al.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["statementName",Y.ofString("statementName")],["comment",Y.ofString("comment")],["description",Y.ofString("description")],["namespace",Y.ofString("namespace")],["name",Y.ofString("name")],["dependentStatements",Y.ofObject("dependentstatement").setAdditionalProperties(new B().setSchemaValue(Y.ofBoolean("exists"))).setDefaultValue({})],["executeIftrue",Y.ofObject("executeIftrue").setAdditionalProperties(new B().setSchemaValue(Y.ofBoolean("exists"))).setDefaultValue({})],["parameterMap",new Y().setName("parameterMap").setAdditionalProperties(new B().setSchemaValue(Y.ofObject("parameterReference").setAdditionalProperties(new B().setSchemaValue(aT.SCHEMA))))],["position",aa.SCHEMA]]))}constructor(e,t,r){if(super(e instanceof al?e:void 0),e instanceof al)this.statementName=e.statementName,this.name=e.name,this.namespace=e.namespace,e.parameterMap&&(this.parameterMap=new Map(Array.from(e.parameterMap.entries()).map(e=>[e[0],new Map(Array.from(e[1].entries()).map(e=>[e[0],new aT(e[1])]))]))),e.dependentStatements&&(this.dependentStatements=new Map(Array.from(e.dependentStatements.entries())));else{if(this.statementName=e,!r||!t)throw Error("Unknown constructor");this.namespace=t,this.name=r}}getStatementName(){return this.statementName}setStatementName(e){return this.statementName=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getParameterMap(){return this.parameterMap||(this.parameterMap=new Map),this.parameterMap}setParameterMap(e){return this.parameterMap=e,this}getDependentStatements(){return this.dependentStatements??new Map}setDependentStatements(e){return this.dependentStatements=e,this}getExecuteIftrue(){return this.executeIftrue??new Map}setExecuteIftrue(e){return this.executeIftrue=e,this}equals(e){return e instanceof al&&e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}static from(e){return new al(e.statementName,e.namespace,e.name).setParameterMap(new Map(Object.entries(e.parameterMap??{}).map(([e,t])=>[e,new Map(Object.entries(t??{}).map(([e,t])=>aT.from(t)).map(e=>[e.getKey(),e]))]))).setDependentStatements(new Map(Object.entries(e.dependentStatements??{}))).setExecuteIftrue(new Map(Object.entries(e.executeIftrue??{}))).setPosition(aa.from(e.position)).setComment(e.comment).setDescription(e.description)}}var aR={};m(aR,"StatementGroup",()=>am);class am extends au{static{this.SCHEMA_NAME="StatementGroup"}static{this.SCHEMA=new Y().setNamespace(p.SYSTEM).setName(am.SCHEMA_NAME).setType(L.of(i.OBJECT)).setProperties(new Map([["statementGroupName",Y.ofString("statementGroupName")],["comment",Y.ofString("comment")],["description",Y.ofString("description")],["position",aa.SCHEMA]]))}constructor(e,t=new Map){super(),this.statementGroupName=e,this.statements=t}getStatementGroupName(){return this.statementGroupName}setStatementGroupName(e){return this.statementGroupName=e,this}getStatements(){return this.statements}setStatements(e){return this.statements=e,this}static from(e){return new am(e.statementGroupName,new Map(Object.entries(e.statements||{}).map(([e,t])=>[e,(""+t)?.toLowerCase()=="true"]))).setPosition(aa.from(e.position)).setComment(e.comment).setDescription(e.description)}}const ag=new Y().setNamespace(p.SYSTEM).setName("FunctionDefinition").setProperties(new Map([["name",Y.ofString("name")],["namespace",Y.ofString("namespace")],["parameters",Y.ofArray("parameters",X.SCHEMA)],["events",Y.ofObject("events").setAdditionalProperties(new B().setSchemaValue(es.SCHEMA))],["steps",Y.ofObject("steps").setAdditionalProperties(new B().setSchemaValue(al.SCHEMA))]]));ag.getProperties()?.set("parts",Y.ofArray("parts",ag));class ah extends eT{static{this.SCHEMA=ag}constructor(e){super(e),this.version=1}getVersion(){return this.version}setVersion(e){return this.version=e,this}getSteps(){return this.steps??new Map}setSteps(e){return this.steps=e,this}getStepGroups(){return this.stepGroups}setStepGroups(e){return this.stepGroups=e,this}getParts(){return this.parts}setParts(e){return this.parts=e,this}static from(e){return e?new ah(e.name).setSteps(new Map(Object.values(e.steps??{}).filter(e=>!!e).map(e=>[e.statementName,al.from(e)]))).setStepGroups(new Map(Object.values(e.stepGroups??{}).filter(e=>!!e).map(e=>[e.statementGroupName,am.from(e)]))).setParts(Array.from(e.parts??[]).filter(e=>!!e).map(e=>ah.from(e))).setVersion(e.version??1).setEvents(new Map(Object.values(e.events??{}).filter(e=>!!e).map(e=>[e.name,es.from(e)]))).setParameters(new Map(Object.values(e.parameters??{}).filter(e=>!!e).map(e=>[e.parameterName,X.from(e)]))).setNamespace(e.namespace):new ah("unknown")}}var ac={};m(ac,"Argument",()=>ap);class ap{constructor(e,t,r){this.argumentIndex=0,this.argumentIndex=e,this.name=t,this.value=r}getArgumentIndex(){return this.argumentIndex}setArgumentIndex(e){return this.argumentIndex=e,this}getName(){return this.name}setName(e){return this.name=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}static of(e,t){return new ap(0,e,t)}}var aN={};R(aN,r2),R(aN,r5),R(aN,r7),R(aN,ne),R(aN,r9);var af={};R(af,rl),R(af,rm),R(af,rh),R(af,rp),R(af,rf),R(af,rM),R(af,rO),R(af,ru),R(af,rI),R(af,rd),R(af,rx),R(af,rv),R(af,rV),R(af,rD),R(af,rb),R(af,rB),R(af,rH),R(af,r$),R(af,rW),R(af,rz),R(af,rJ),R(af,rQ),R(af,r0),R(af,rE),R(module.exports,g),R(module.exports,ee),R(module.exports,{}),R(module.exports,te),R(module.exports,J),R(module.exports,f),R(module.exports,eg),R(module.exports,tL),R(module.exports,eh),R(module.exports,e_),R(module.exports,eO),R(module.exports,ta),R(module.exports,em),R(module.exports,tE),R(module.exports,sk),R(module.exports,s$),R(module.exports,t8),R(module.exports,sX),R(module.exports,sq),R(module.exports,sK),R(module.exports,sZ),R(module.exports,{}),R(module.exports,s0),R(module.exports,s9),R(module.exports,ae),R(module.exports,s6),R(module.exports,tx),R(module.exports,tH),R(module.exports,nr),R(module.exports,ty),R(module.exports,ro),R(module.exports,tF),R(module.exports,tC),R(module.exports,tU),R(module.exports,tG),R(module.exports,{}),R(module.exports,el),R(module.exports,c),R(module.exports,s3),R(module.exports,h),R(module.exports,eB),R(module.exports,eD),R(module.exports,eb),R(module.exports,eV),R(module.exports,eL),R(module.exports,e$),R(module.exports,eH),R(module.exports,eR),R(module.exports,ed),R(module.exports,k),R(module.exports,eU),R(module.exports,N),R(module.exports,y),R(module.exports,O),R(module.exports,w),R(module.exports,I),R(module.exports,S),R(module.exports,eS),R(module.exports,ej),R(module.exports,sb),R(module.exports,ar),R(module.exports,H),R(module.exports,ei),R(module.exports,as),R(module.exports,ai),R(module.exports,s5),R(module.exports,er),R(module.exports,aE),R(module.exports,ao),R(module.exports,{}),R(module.exports,aR),R(module.exports,eA),R(module.exports,en),R(module.exports,j),R(module.exports,ac),R(module.exports,aA),R(module.exports,tt),R(module.exports,eo),R(module.exports,aN),R(module.exports,af),R(module.exports,na);
2
2
  //# sourceMappingURL=index.js.map