@elyx-code/project-logic-tree 0.0.6601 → 0.0.6603
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -9
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -77667,14 +77667,8 @@ class jBt {
|
|
|
77667
77667
|
`Missing dependencies: ${c.join(", ")}`
|
|
77668
77668
|
);
|
|
77669
77669
|
}
|
|
77670
|
-
if (!u.resource)
|
|
77671
|
-
throw new Error(
|
|
77672
|
-
`Resource not found for step ${u.stepType} (${u.id})`
|
|
77673
|
-
);
|
|
77674
77670
|
if (!this.steps.find((c) => c.id === u.id)) {
|
|
77675
|
-
const c =
|
|
77676
|
-
u.resourceType
|
|
77677
|
-
) || this.explicitResources.get(u.resource.resourceId), e = new K$t(
|
|
77671
|
+
const c = new K$t(
|
|
77678
77672
|
u.stepType,
|
|
77679
77673
|
u.id,
|
|
77680
77674
|
u.resourceType,
|
|
@@ -77683,9 +77677,12 @@ class jBt {
|
|
|
77683
77677
|
u.index,
|
|
77684
77678
|
i,
|
|
77685
77679
|
this,
|
|
77686
|
-
|
|
77680
|
+
null
|
|
77681
|
+
// resource as
|
|
77682
|
+
// | ImplicitGlobalInfrastructureResource
|
|
77683
|
+
// | ExplicitInfrastructureResource
|
|
77687
77684
|
);
|
|
77688
|
-
this.steps.push(
|
|
77685
|
+
this.steps.push(c);
|
|
77689
77686
|
}
|
|
77690
77687
|
}
|
|
77691
77688
|
onUpdate(u) {
|
package/dist/index.umd.cjs
CHANGED
|
@@ -69,7 +69,7 @@ If an entity is called by another, they must be in the same scope, which means t
|
|
|
69
69
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(u){return u instanceof this?u:new this(u)}static concat(u,...i){const a=new this(u);return i.forEach(l=>a.set(l)),a}static accessor(u){const a=(this[Nq]=this[Nq]={accessors:{}}).accessors,l=this.prototype;function c(e){const y=Qc(e);a[y]||(D_e(l,e),a[y]=!0)}return ge.isArray(u)?u.forEach(c):c(u),this}}qm.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ge.reduceDescriptors(qm.prototype,({value:d},u)=>{let i=u[0].toUpperCase()+u.slice(1);return{get:()=>d,set(a){this[i]=a}}}),ge.freezeMethods(qm);const Xs=qm;function $A(d,u){const i=this||OA,a=u||i,l=Xs.from(a.headers);let c=a.data;return ge.forEach(d,function(y){c=y.call(i,c,l.normalize(),u?u.status:void 0)}),l.normalize(),c}function Vq(d){return!!(d&&d.__CANCEL__)}function zu(d,u,i){Kt.call(this,d??"canceled",Kt.ERR_CANCELED,u,i),this.name="CanceledError"}ge.inherits(zu,Kt,{__CANCEL__:!0});function Lq(d,u,i){const a=i.config.validateStatus;!i.status||!a||a(i.status)?d(i):u(new Kt("Request failed with status code "+i.status,[Kt.ERR_BAD_REQUEST,Kt.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function O_e(d){const u=/^([-+\w]{1,25})(:?\/\/|:)/.exec(d);return u&&u[1]||""}function P_e(d,u){d=d||10;const i=new Array(d),a=new Array(d);let l=0,c=0,e;return u=u!==void 0?u:1e3,function(v){const T=Date.now(),I=a[c];e||(e=T),i[l]=v,a[l]=T;let b=c,D=0;for(;b!==l;)D+=i[b++],b=b%d;if(l=(l+1)%d,l===c&&(c=(c+1)%d),T-e<u)return;const V=I&&T-I;return V?Math.round(D*1e3/V):void 0}}function $_e(d,u){let i=0,a=1e3/u,l,c;const e=(T,I=Date.now())=>{i=I,l=null,c&&(clearTimeout(c),c=null),d.apply(null,T)};return[(...T)=>{const I=Date.now(),b=I-i;b>=a?e(T,I):(l=T,c||(c=setTimeout(()=>{c=null,e(l)},a-b)))},()=>l&&e(l)]}const Zm=(d,u,i=3)=>{let a=0;const l=P_e(50,250);return $_e(c=>{const e=c.loaded,y=c.lengthComputable?c.total:void 0,v=e-a,T=l(v),I=e<=y;a=e;const b={loaded:e,total:y,progress:y?e/y:void 0,bytes:v,rate:T||void 0,estimated:T&&y&&I?(y-e)/T:void 0,event:c,lengthComputable:y!=null,[u?"download":"upload"]:!0};d(b)},i)},Bq=(d,u)=>{const i=d!=null;return[a=>u[0]({lengthComputable:i,total:d,loaded:a}),u[1]]},Mq=d=>(...u)=>ge.asap(()=>d(...u)),N_e=hn.hasStandardBrowserEnv?((d,u)=>i=>(i=new URL(i,hn.origin),d.protocol===i.protocol&&d.host===i.host&&(u||d.port===i.port)))(new URL(hn.origin),hn.navigator&&/(msie|trident)/i.test(hn.navigator.userAgent)):()=>!0,V_e=hn.hasStandardBrowserEnv?{write(d,u,i,a,l,c){const e=[d+"="+encodeURIComponent(u)];ge.isNumber(i)&&e.push("expires="+new Date(i).toGMTString()),ge.isString(a)&&e.push("path="+a),ge.isString(l)&&e.push("domain="+l),c===!0&&e.push("secure"),document.cookie=e.join("; ")},read(d){const u=document.cookie.match(new RegExp("(^|;\\s*)("+d+")=([^;]*)"));return u?decodeURIComponent(u[3]):null},remove(d){this.write(d,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function L_e(d){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(d)}function B_e(d,u){return u?d.replace(/\/?\/$/,"")+"/"+u.replace(/^\/+/,""):d}function xq(d,u,i){let a=!L_e(u);return d&&(a||i==!1)?B_e(d,u):u}const Uq=d=>d instanceof Xs?{...d}:d;function bd(d,u){u=u||{};const i={};function a(T,I,b,D){return ge.isPlainObject(T)&&ge.isPlainObject(I)?ge.merge.call({caseless:D},T,I):ge.isPlainObject(I)?ge.merge({},I):ge.isArray(I)?I.slice():I}function l(T,I,b,D){if(ge.isUndefined(I)){if(!ge.isUndefined(T))return a(void 0,T,b,D)}else return a(T,I,b,D)}function c(T,I){if(!ge.isUndefined(I))return a(void 0,I)}function e(T,I){if(ge.isUndefined(I)){if(!ge.isUndefined(T))return a(void 0,T)}else return a(void 0,I)}function y(T,I,b){if(b in u)return a(T,I);if(b in d)return a(void 0,T)}const v={url:c,method:c,data:c,baseURL:e,transformRequest:e,transformResponse:e,paramsSerializer:e,timeout:e,timeoutMessage:e,withCredentials:e,withXSRFToken:e,adapter:e,responseType:e,xsrfCookieName:e,xsrfHeaderName:e,onUploadProgress:e,onDownloadProgress:e,decompress:e,maxContentLength:e,maxBodyLength:e,beforeRedirect:e,transport:e,httpAgent:e,httpsAgent:e,cancelToken:e,socketPath:e,responseEncoding:e,validateStatus:y,headers:(T,I,b)=>l(Uq(T),Uq(I),b,!0)};return ge.forEach(Object.keys(Object.assign({},d,u)),function(I){const b=v[I]||l,D=b(d[I],u[I],I);ge.isUndefined(D)&&b!==y||(i[I]=D)}),i}const jq=d=>{const u=bd({},d);let{data:i,withXSRFToken:a,xsrfHeaderName:l,xsrfCookieName:c,headers:e,auth:y}=u;u.headers=e=Xs.from(e),u.url=Dq(xq(u.baseURL,u.url,u.allowAbsoluteUrls),d.params,d.paramsSerializer),y&&e.set("Authorization","Basic "+btoa((y.username||"")+":"+(y.password?unescape(encodeURIComponent(y.password)):"")));let v;if(ge.isFormData(i)){if(hn.hasStandardBrowserEnv||hn.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if((v=e.getContentType())!==!1){const[T,...I]=v?v.split(";").map(b=>b.trim()).filter(Boolean):[];e.setContentType([T||"multipart/form-data",...I].join("; "))}}if(hn.hasStandardBrowserEnv&&(a&&ge.isFunction(a)&&(a=a(u)),a||a!==!1&&N_e(u.url))){const T=l&&c&&V_e.read(c);T&&e.set(l,T)}return u},M_e=typeof XMLHttpRequest<"u"&&function(d){return new Promise(function(i,a){const l=jq(d);let c=l.data;const e=Xs.from(l.headers).normalize();let{responseType:y,onUploadProgress:v,onDownloadProgress:T}=l,I,b,D,V,M;function x(){V&&V(),M&&M(),l.cancelToken&&l.cancelToken.unsubscribe(I),l.signal&&l.signal.removeEventListener("abort",I)}let G=new XMLHttpRequest;G.open(l.method.toUpperCase(),l.url,!0),G.timeout=l.timeout;function W(){if(!G)return;const J=Xs.from("getAllResponseHeaders"in G&&G.getAllResponseHeaders()),H={data:!y||y==="text"||y==="json"?G.responseText:G.response,status:G.status,statusText:G.statusText,headers:J,config:d,request:G};Lq(function(ae){i(ae),x()},function(ae){a(ae),x()},H),G=null}"onloadend"in G?G.onloadend=W:G.onreadystatechange=function(){!G||G.readyState!==4||G.status===0&&!(G.responseURL&&G.responseURL.indexOf("file:")===0)||setTimeout(W)},G.onabort=function(){G&&(a(new Kt("Request aborted",Kt.ECONNABORTED,d,G)),G=null)},G.onerror=function(){a(new Kt("Network Error",Kt.ERR_NETWORK,d,G)),G=null},G.ontimeout=function(){let ee=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded";const H=l.transitional||Pq;l.timeoutErrorMessage&&(ee=l.timeoutErrorMessage),a(new Kt(ee,H.clarifyTimeoutError?Kt.ETIMEDOUT:Kt.ECONNABORTED,d,G)),G=null},c===void 0&&e.setContentType(null),"setRequestHeader"in G&&ge.forEach(e.toJSON(),function(ee,H){G.setRequestHeader(H,ee)}),ge.isUndefined(l.withCredentials)||(G.withCredentials=!!l.withCredentials),y&&y!=="json"&&(G.responseType=l.responseType),T&&([D,M]=Zm(T,!0),G.addEventListener("progress",D)),v&&G.upload&&([b,V]=Zm(v),G.upload.addEventListener("progress",b),G.upload.addEventListener("loadend",V)),(l.cancelToken||l.signal)&&(I=J=>{G&&(a(!J||J.type?new zu(null,d,G):J),G.abort(),G=null)},l.cancelToken&&l.cancelToken.subscribe(I),l.signal&&(l.signal.aborted?I():l.signal.addEventListener("abort",I)));const Z=O_e(l.url);if(Z&&hn.protocols.indexOf(Z)===-1){a(new Kt("Unsupported protocol "+Z+":",Kt.ERR_BAD_REQUEST,d));return}G.send(c||null)})},x_e=(d,u)=>{const{length:i}=d=d?d.filter(Boolean):[];if(u||i){let a=new AbortController,l;const c=function(T){if(!l){l=!0,y();const I=T instanceof Error?T:this.reason;a.abort(I instanceof Kt?I:new zu(I instanceof Error?I.message:I))}};let e=u&&setTimeout(()=>{e=null,c(new Kt(`timeout ${u} of ms exceeded`,Kt.ETIMEDOUT))},u);const y=()=>{d&&(e&&clearTimeout(e),e=null,d.forEach(T=>{T.unsubscribe?T.unsubscribe(c):T.removeEventListener("abort",c)}),d=null)};d.forEach(T=>T.addEventListener("abort",c));const{signal:v}=a;return v.unsubscribe=()=>ge.asap(y),v}},U_e=function*(d,u){let i=d.byteLength;if(!u||i<u){yield d;return}let a=0,l;for(;a<i;)l=a+u,yield d.slice(a,l),a=l},j_e=async function*(d,u){for await(const i of G_e(d))yield*U_e(i,u)},G_e=async function*(d){if(d[Symbol.asyncIterator]){yield*d;return}const u=d.getReader();try{for(;;){const{done:i,value:a}=await u.read();if(i)break;yield a}}finally{await u.cancel()}},Gq=(d,u,i,a)=>{const l=j_e(d,u);let c=0,e,y=v=>{e||(e=!0,a&&a(v))};return new ReadableStream({async pull(v){try{const{done:T,value:I}=await l.next();if(T){y(),v.close();return}let b=I.byteLength;if(i){let D=c+=b;i(D)}v.enqueue(new Uint8Array(I))}catch(T){throw y(T),T}},cancel(v){return y(v),l.return()}},{highWaterMark:2})},Wm=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",kq=Wm&&typeof ReadableStream=="function",k_e=Wm&&(typeof TextEncoder=="function"?(d=>u=>d.encode(u))(new TextEncoder):async d=>new Uint8Array(await new Response(d).arrayBuffer())),Fq=(d,...u)=>{try{return!!d(...u)}catch{return!1}},F_e=kq&&Fq(()=>{let d=!1;const u=new Request(hn.origin,{body:new ReadableStream,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!u}),Kq=64*1024,NA=kq&&Fq(()=>ge.isReadableStream(new Response("").body)),Hm={stream:NA&&(d=>d.body)};Wm&&(d=>{["text","arrayBuffer","blob","formData","stream"].forEach(u=>{!Hm[u]&&(Hm[u]=ge.isFunction(d[u])?i=>i[u]():(i,a)=>{throw new Kt(`Response type '${u}' is not supported`,Kt.ERR_NOT_SUPPORT,a)})})})(new Response);const K_e=async d=>{if(d==null)return 0;if(ge.isBlob(d))return d.size;if(ge.isSpecCompliantForm(d))return(await new Request(hn.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(ge.isArrayBufferView(d)||ge.isArrayBuffer(d))return d.byteLength;if(ge.isURLSearchParams(d)&&(d=d+""),ge.isString(d))return(await k_e(d)).byteLength},q_e=async(d,u)=>{const i=ge.toFiniteNumber(d.getContentLength());return i??K_e(u)},VA={http:u_e,xhr:M_e,fetch:Wm&&(async d=>{let{url:u,method:i,data:a,signal:l,cancelToken:c,timeout:e,onDownloadProgress:y,onUploadProgress:v,responseType:T,headers:I,withCredentials:b="same-origin",fetchOptions:D}=jq(d);T=T?(T+"").toLowerCase():"text";let V=x_e([l,c&&c.toAbortSignal()],e),M;const x=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let G;try{if(v&&F_e&&i!=="get"&&i!=="head"&&(G=await q_e(I,a))!==0){let H=new Request(u,{method:"POST",body:a,duplex:"half"}),oe;if(ge.isFormData(a)&&(oe=H.headers.get("content-type"))&&I.setContentType(oe),H.body){const[ae,ye]=Bq(G,Zm(Mq(v)));a=Gq(H.body,Kq,ae,ye)}}ge.isString(b)||(b=b?"include":"omit");const W="credentials"in Request.prototype;M=new Request(u,{...D,signal:V,method:i.toUpperCase(),headers:I.normalize().toJSON(),body:a,duplex:"half",credentials:W?b:void 0});let Z=await fetch(M);const J=NA&&(T==="stream"||T==="response");if(NA&&(y||J&&x)){const H={};["status","statusText","headers"].forEach(he=>{H[he]=Z[he]});const oe=ge.toFiniteNumber(Z.headers.get("content-length")),[ae,ye]=y&&Bq(oe,Zm(Mq(y),!0))||[];Z=new Response(Gq(Z.body,Kq,ae,()=>{ye&&ye(),x&&x()}),H)}T=T||"text";let ee=await Hm[ge.findKey(Hm,T)||"text"](Z,d);return!J&&x&&x(),await new Promise((H,oe)=>{Lq(H,oe,{data:ee,headers:Xs.from(Z.headers),status:Z.status,statusText:Z.statusText,config:d,request:M})})}catch(W){throw x&&x(),W&&W.name==="TypeError"&&/Load failed|fetch/i.test(W.message)?Object.assign(new Kt("Network Error",Kt.ERR_NETWORK,d,M),{cause:W.cause||W}):Kt.from(W,W&&W.code,d,M)}})};ge.forEach(VA,(d,u)=>{if(d){try{Object.defineProperty(d,"name",{value:u})}catch{}Object.defineProperty(d,"adapterName",{value:u})}});const qq=d=>`- ${d}`,Z_e=d=>ge.isFunction(d)||d===null||d===!1,Zq={getAdapter:d=>{d=ge.isArray(d)?d:[d];const{length:u}=d;let i,a;const l={};for(let c=0;c<u;c++){i=d[c];let e;if(a=i,!Z_e(i)&&(a=VA[(e=String(i)).toLowerCase()],a===void 0))throw new Kt(`Unknown adapter '${e}'`);if(a)break;l[e||"#"+c]=a}if(!a){const c=Object.entries(l).map(([y,v])=>`adapter ${y} `+(v===!1?"is not supported by the environment":"is not available in the build"));let e=u?c.length>1?`since :
|
|
70
70
|
`+c.map(qq).join(`
|
|
71
71
|
`):" "+qq(c[0]):"as no adapter specified";throw new Kt("There is no suitable adapter to dispatch the request "+e,"ERR_NOT_SUPPORT")}return a},adapters:VA};function LA(d){if(d.cancelToken&&d.cancelToken.throwIfRequested(),d.signal&&d.signal.aborted)throw new zu(null,d)}function Wq(d){return LA(d),d.headers=Xs.from(d.headers),d.data=$A.call(d,d.transformRequest),["post","put","patch"].indexOf(d.method)!==-1&&d.headers.setContentType("application/x-www-form-urlencoded",!1),Zq.getAdapter(d.adapter||OA.adapter)(d).then(function(a){return LA(d),a.data=$A.call(d,d.transformResponse,a),a.headers=Xs.from(a.headers),a},function(a){return Vq(a)||(LA(d),a&&a.response&&(a.response.data=$A.call(d,d.transformResponse,a.response),a.response.headers=Xs.from(a.response.headers))),Promise.reject(a)})}const Hq="1.9.0",zm={};["object","boolean","number","function","string","symbol"].forEach((d,u)=>{zm[d]=function(a){return typeof a===d||"a"+(u<1?"n ":" ")+d}});const zq={};zm.transitional=function(u,i,a){function l(c,e){return"[Axios v"+Hq+"] Transitional option '"+c+"'"+e+(a?". "+a:"")}return(c,e,y)=>{if(u===!1)throw new Kt(l(e," has been removed"+(i?" in "+i:"")),Kt.ERR_DEPRECATED);return i&&!zq[e]&&(zq[e]=!0,console.warn(l(e," has been deprecated since v"+i+" and will be removed in the near future"))),u?u(c,e,y):!0}},zm.spelling=function(u){return(i,a)=>(console.warn(`${a} is likely a misspelling of ${u}`),!0)};function W_e(d,u,i){if(typeof d!="object")throw new Kt("options must be an object",Kt.ERR_BAD_OPTION_VALUE);const a=Object.keys(d);let l=a.length;for(;l-- >0;){const c=a[l],e=u[c];if(e){const y=d[c],v=y===void 0||e(y,c,d);if(v!==!0)throw new Kt("option "+c+" must be "+v,Kt.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Kt("Unknown option "+c,Kt.ERR_BAD_OPTION)}}const Jm={assertOptions:W_e,validators:zm},Ra=Jm.validators;class Ym{constructor(u){this.defaults=u||{},this.interceptors={request:new Oq,response:new Oq}}async request(u,i){try{return await this._request(u,i)}catch(a){if(a instanceof Error){let l={};Error.captureStackTrace?Error.captureStackTrace(l):l=new Error;const c=l.stack?l.stack.replace(/^.+\n/,""):"";try{a.stack?c&&!String(a.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(a.stack+=`
|
|
72
|
-
`+c):a.stack=c}catch{}}throw a}}_request(u,i){typeof u=="string"?(i=i||{},i.url=u):i=u||{},i=bd(this.defaults,i);const{transitional:a,paramsSerializer:l,headers:c}=i;a!==void 0&&Jm.assertOptions(a,{silentJSONParsing:Ra.transitional(Ra.boolean),forcedJSONParsing:Ra.transitional(Ra.boolean),clarifyTimeoutError:Ra.transitional(Ra.boolean)},!1),l!=null&&(ge.isFunction(l)?i.paramsSerializer={serialize:l}:Jm.assertOptions(l,{encode:Ra.function,serialize:Ra.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Jm.assertOptions(i,{baseUrl:Ra.spelling("baseURL"),withXsrfToken:Ra.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&ge.merge(c.common,c[i.method]);c&&ge.forEach(["delete","get","head","post","put","patch","common"],M=>{delete c[M]}),i.headers=Xs.concat(e,c);const y=[];let v=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(i)===!1||(v=v&&x.synchronous,y.unshift(x.fulfilled,x.rejected))});const T=[];this.interceptors.response.forEach(function(x){T.push(x.fulfilled,x.rejected)});let I,b=0,D;if(!v){const M=[Wq.bind(this),void 0];for(M.unshift.apply(M,y),M.push.apply(M,T),D=M.length,I=Promise.resolve(i);b<D;)I=I.then(M[b++],M[b++]);return I}D=y.length;let V=i;for(b=0;b<D;){const M=y[b++],x=y[b++];try{V=M(V)}catch(G){x.call(this,G);break}}try{I=Wq.call(this,V)}catch(M){return Promise.reject(M)}for(b=0,D=T.length;b<D;)I=I.then(T[b++],T[b++]);return I}getUri(u){u=bd(this.defaults,u);const i=xq(u.baseURL,u.url,u.allowAbsoluteUrls);return Dq(i,u.params,u.paramsSerializer)}}ge.forEach(["delete","get","head","options"],function(u){Ym.prototype[u]=function(i,a){return this.request(bd(a||{},{method:u,url:i,data:(a||{}).data}))}}),ge.forEach(["post","put","patch"],function(u){function i(a){return function(c,e,y){return this.request(bd(y||{},{method:u,headers:a?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}Ym.prototype[u]=i(),Ym.prototype[u+"Form"]=i(!0)});const Sm=Ym;class BA{constructor(u){if(typeof u!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const a=this;this.promise.then(l=>{if(!a._listeners)return;let c=a._listeners.length;for(;c-- >0;)a._listeners[c](l);a._listeners=null}),this.promise.then=l=>{let c;const e=new Promise(y=>{a.subscribe(y),c=y}).then(l);return e.cancel=function(){a.unsubscribe(c)},e},u(function(c,e,y){a.reason||(a.reason=new zu(c,e,y),i(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(u){if(this.reason){u(this.reason);return}this._listeners?this._listeners.push(u):this._listeners=[u]}unsubscribe(u){if(!this._listeners)return;const i=this._listeners.indexOf(u);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const u=new AbortController,i=a=>{u.abort(a)};return this.subscribe(i),u.signal.unsubscribe=()=>this.unsubscribe(i),u.signal}static source(){let u;return{token:new BA(function(l){u=l}),cancel:u}}}const H_e=BA;function z_e(d){return function(i){return d.apply(null,i)}}function J_e(d){return ge.isObject(d)&&d.isAxiosError===!0}const MA={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(MA).forEach(([d,u])=>{MA[u]=d});const Y_e=MA;function Jq(d){const u=new Sm(d),i=fq(Sm.prototype.request,u);return ge.extend(i,Sm.prototype,u,{allOwnKeys:!0}),ge.extend(i,u,null,{allOwnKeys:!0}),i.create=function(l){return Jq(bd(d,l))},i}const Ur=Jq(OA);Ur.Axios=Sm,Ur.CanceledError=zu,Ur.CancelToken=H_e,Ur.isCancel=Vq,Ur.VERSION=Hq,Ur.toFormData=Fm,Ur.AxiosError=Kt,Ur.Cancel=Ur.CanceledError,Ur.all=function(u){return Promise.all(u)},Ur.spread=z_e,Ur.isAxiosError=J_e,Ur.mergeConfig=bd,Ur.AxiosHeaders=Xs,Ur.formToJSON=d=>$q(ge.isHTMLForm(d)?new FormData(d):d),Ur.getAdapter=Zq.getAdapter,Ur.HttpStatusCode=Y_e,Ur.default=Ur;const S_e=Ur;class Yq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Addition);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y+v,0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Sq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Subtraction);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y-v,0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Xq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Multiplication);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y*v,1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Qq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Division);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=c/e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class e7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Remainder);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=c%e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class t7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Exponentiation);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l,y=Math.pow(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class i7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomInteger);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=Ige(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class r7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomFloat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=oq();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class n7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomHexadecimal);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=dq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class s7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomBase62);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=uq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class a7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=wge(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class l7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomAlphanumeric);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=pq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class o7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateIdentifier);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=cq(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class d7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomUUIDv4);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=Td();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class u7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{Y.log("Initializing Random Generate Short Identifier Module");const a=i.find(l=>l.contextType===De.Logic);if(a){Y.log("Project state found, setting up operation");const l=a.get(Ze.GenerateShortIdentifier);l?(Y.log("Operation found, setting autoexecutable and implementation"),l.autoexecutable=!0,l.implementation=this.module.main):Y.warn("Operation generate-short-identifier not found in project state")}else Y.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,a)=>{try{const l=Rge();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class p7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateHexadecimalToken);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=Cge();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class c7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],y=l.slice(1).join(c);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class f7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT,version:"1.0.0",description:"String split operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=c.split(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class y7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST,version:"1.0.0",description:"String delete last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.slice(0,-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class h7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST,version:"1.0.0",description:"String delete first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.slice(1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class m7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.split("").reverse().join("");return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class v7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ToLowerCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.toLowerCase();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class T7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ToUpperCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.toUpperCase();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class E7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.DeleteIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const y=c.slice(0,e)+c.slice(e+1);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class b7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=c.slice(0,e)+y+c.slice(e);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class I7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST,version:"1.0.0",description:"String replace first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.replace(e,y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class A7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST,version:"1.0.0",description:"String replace last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.lastIndexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=c.slice(0,v)+c.slice(v).replace(e,y);return{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class w7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=c.slice(0,e)+y+c.slice(e+1);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class R7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_SINGLE_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ReplaceSingleMatch);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.replace(e,y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class C7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ReplaceAllMatches);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.split(e).join(y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class g7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c.charAt(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class _7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST,version:"1.0.0",description:"String get first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.charAt(0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class D7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST,version:"1.0.0",description:"String get last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.charAt(c.length-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class O7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.GetIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c.indexOf(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class P7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c+e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class $7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=e+c;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class N7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)});if(!l||l.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No input lists provided",result:null};if(!l.every(v=>Array.isArray(v)))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"All inputs must be arrays",result:null};const c=l[0],y=l.slice(1).reduce((v,T)=>Array.isArray(T)?v.concat(T):v,c);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class V7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=c.slice(0,e),v=c.slice(e);return{value:X.Success,error:null,result:[y,v]}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class L7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice().reverse();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class B7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST,version:"1.0.0",description:"List delete last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice(0,-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class M7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST,version:"1.0.0",description:"List delete first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice(1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class x7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=[...c.slice(0,e),y,...c.slice(e)];return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class U7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=[...c];return v[e]=y,{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class j7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST,version:"1.0.0",description:"List replace first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const v=c.indexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=[...c];return T[v]=y,{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class G7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST,version:"1.0.0",description:"List replace last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const v=c.lastIndexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=[...c];return T[v]=y,{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class k7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const y=c[e];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class F7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c[0];return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class K7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c[c.length-1];return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class q7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=[...c,e];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Z7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=[e,...c];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class W7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ei.Parallel);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(b=>{var D,V;return((D=b.value)==null?void 0:D.valueAsType)||((V=b.value)==null?void 0:V.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const y=this.extensionsRegistry.requestContexts(this,[De.Editor])[0],T=c.map(b=>{const D=new oo(y.logic,[b],b,null,this.extensionsRegistry);return D.inheritValuesFromContext(y),D}).map(b=>b.execute()),I=await Promise.all(T);return{value:X.Success,error:null,result:I}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class H7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ei.Sequential);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const e=[];for(let y=0;y<c.length;y++){const v=c[y],I=this.extensionsRegistry.requestContexts(this,[De.Editor])[0],b=new oo(I.logic,[v],v,null,this.extensionsRegistry);b.inheritValuesFromContext(I);const D=await b.execute();e.push(D)}return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class z7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ei.Wait);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(e=>{var y,v;return((y=e.value)==null?void 0:y.valueAsType)||((v=e.value)==null?void 0:v.value)})[0];return typeof c!="number"||c<0?{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,c)),{value:X.Success,error:null,result:null})}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class J7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(mr.Validate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)});Y.log("Inputs for entity validation: ",l);const e=Yb(l[1]).safeParse(l[0]);return e.success?{value:X.Success,error:null,result:{data:l[0]}}:{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:e.error.errors,result:null}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Y7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(fn.HttpRequest);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[3]||{},e={method:l[0],url:l[1],params:l[2],headers:c,data:l[4]};Y.log("Axios request config: ",e);const y=await S_e(e);return{value:X.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class xA extends Mm{constructor(u,i,a=i.projectId){super(u,De.Editor),this._editor=i,this.id=a}get ready(){return this._editor.ready}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branch(){return this._editor.branch}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(u){this._editor.undoableStackValueIndex=u}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}removeValueByOwnerId(u){return this._editor.removeValueByOwnerId(u)}removeValue(u){return this._editor.removeValue(u)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(u,i){return this._editor.initTest(u,i)}removeTest(){return this._editor.removeTest()}async copyEntities(u){return this._editor.copyEntities(u)}resolveInitialChildrenPositions(u,i,a){return this._editor.resolveInitialChildrenPositions(u,i,a)}publish(){return this._editor.publish()}loadActivePublication(u){return this._editor.loadActivePublication(u)}requestActiveDynamicValue(u,i=!1){return this._editor.requestActiveDynamicValue(u,i)}}function X_e(d,u){return u instanceof xA?u:new xA(d,u)}class UA extends Mm{constructor(u,i){super(u,De.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get projectVersion(){return this._publicationRun.projectVersion}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function Q_e(d,u){return u instanceof UA?u:new UA(d,u)}function eDe(d){d.register(new lq(d)),d.register(new aq(d)),d.register(new iq(d)),d.register(new nq(d)),d.register(new sq(d)),d.register(new rq(d)),d.register(new Yq(d)),d.register(new Sq(d)),d.register(new Xq(d)),d.register(new e7(d)),d.register(new Qq(d)),d.register(new t7(d)),d.register(new i7(d)),d.register(new r7(d)),d.register(new n7(d)),d.register(new s7(d)),d.register(new a7(d)),d.register(new l7(d)),d.register(new o7(d)),d.register(new d7(d)),d.register(new u7(d)),d.register(new p7(d)),d.register(new c7(d)),d.register(new f7(d)),d.register(new y7(d)),d.register(new h7(d)),d.register(new m7(d)),d.register(new v7(d)),d.register(new T7(d)),d.register(new E7(d)),d.register(new b7(d)),d.register(new I7(d)),d.register(new A7(d)),d.register(new w7(d)),d.register(new R7(d)),d.register(new C7(d)),d.register(new g7(d)),d.register(new _7(d)),d.register(new D7(d)),d.register(new O7(d)),d.register(new P7(d)),d.register(new $7(d)),d.register(new N7(d)),d.register(new V7(d)),d.register(new L7(d)),d.register(new B7(d)),d.register(new M7(d)),d.register(new x7(d)),d.register(new U7(d)),d.register(new j7(d)),d.register(new G7(d)),d.register(new k7(d)),d.register(new F7(d)),d.register(new K7(d)),d.register(new q7(d)),d.register(new Z7(d)),d.register(new W7(d)),d.register(new H7(d)),d.register(new z7(d)),d.register(new J7(d)),d.register(new Y7(d))}class jA{constructor(u=new Gu){_(this,"extensionsRegistry",new Map);_(this,"initialized",new Set);_(this,"initializedContexts",new Set);_(this,"onResolveEditorContextCallback",()=>null);_(this,"onResolveProjectLogicContextCallback",()=>null);_(this,"onResolveEditorGUIContextCallback",()=>null);_(this,"onResolveGUIContextCallback",()=>null);_(this,"onResolveCompileContextCallback",()=>null);_(this,"onResolvePublicationRunContextCallback",()=>null);this.events=u,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(u){this.onResolveEditorContextCallback=u}onResolveProjectLogicContext(u){this.onResolveProjectLogicContextCallback=u}onResolveGUIContext(u){this.onResolveGUIContextCallback=u}onResolveEditorGUIContext(u){this.onResolveEditorGUIContextCallback=u}onResolveCompileContext(u){this.onResolveCompileContextCallback=u}onResolvePublicationRunContext(u){this.onResolvePublicationRunContextCallback=u}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((u,i)=>(u.manifest.initPriority||it.Normal)-(i.manifest.initPriority||it.Normal))}async setup(){eDe(this),Y.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case De.Editor:return this.onResolveEditorContextCallback();case De.Logic:return this.onResolveProjectLogicContextCallback();case De.EditorGUI:return this.onResolveEditorGUIContextCallback();case De.Compile:return this.onResolveCompileContextCallback();case De.PublicationRun:return this.onResolvePublicationRunContextCallback();case De.GUI:return this.onResolveGUIContextCallback();case De.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,i=[]){const a=[];i.length===0&&(i=u.manifest.contexts);for(const l of i){const c=this.requestContext(l);c&&a.push(c)}return a}requestExtension(u){const i=this.extensionsRegistry.get(u);if(i)return i;throw new Error(`Unknown extension: ${u}`)}register(u){this.extensionsRegistry.set(u.manifest.id,u)}async initAll(){var u,i;for(const a of this.extensionInOrder)if(a.module.init&&!this.initialized.has(a.manifest.id)){const l=a.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);l.length&&(await((i=(u=a.module).init)==null?void 0:i.call(u,l)),this.initialized.add(a.manifest.id))}else!a.module.init&&!this.initialized.has(a.manifest.id)&&this.initialized.add(a.manifest.id)}async initForReady(){Y.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){Y.log("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(l=>!!i.find(c=>c.contextType===l))?(await u.module.init(i),this.initialized.add(u.manifest.id)):Y.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(l=>l.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(Y.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):Y.log(`Skipping initialization of ${u.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const u of[...this.extensionInOrder].reverse())u.module.destroy&&await u.module.destroy();this.events.destroy()}on(u,i){this.events.on(u,i)}emit(u,...i){this.events.emit(u,...i)}off(u,i){this.events.off(u,i)}emitAsync(u,...i){return this.events.emitAsync(u,...i)}emitAsyncAll(u,...i){return this.events.emitAsyncAll(u,...i)}emitAsyncAllSettled(u,...i){return this.events.emitAsyncAllSettled(u,...i)}emitAsyncSequentially(u,...i){return this.events.emitAsyncSequentially(u,...i)}emitAsyncSequentiallyAll(u,...i){return this.events.emitAsyncSequentiallyAll(u,...i)}emitAsyncSequentiallyAllSettled(u,...i){return this.events.emitAsyncSequentiallyAllSettled(u,...i)}async contextAvailable(u){if(this.initializedContexts.has(u)){Y.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case De.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case De.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}Y.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}}let Xm=null;const GA={requestExtension:d=>(Xm||(Xm=new jA,Xm.setup()),Xm.requestExtension(d))},lo={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var kA=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(kA||{});const S7={...GA};class oo extends Gu{constructor(i,a,l,c=null,e=S7){super();_(this,"project");_(this,"entryPoint");_(this,"state","not-started");_(this,"events",new Gu);_(this,"entities",[]);_(this,"parentExecution",null);_(this,"executing",[]);_(this,"executed",[]);_(this,"skipped",[]);_(this,"scheduled",[]);_(this,"localTestValues");_(this,"resolvedValues");_(this,"persistedExecutionResults");_(this,"lastExecutionResults");_(this,"onAddToSkippedListCallback",null);_(this,"onRemoveFromSkippedListCallback",null);_(this,"onAddEntityCallback",null);_(this,"onRemoveEntityCallback",null);_(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=a,this.entryPoint=l,this.project=i,this.parentExecution=c,this.localTestValues=new qc(L.UUID.uuid(),this.project),this.resolvedValues=new qc(L.UUID.uuid(),this.project),this.persistedExecutionResults=new qc(L.UUID.uuid(),this.project),this.lastExecutionResults=new qc(L.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),wr.includes(i.type)&&ct(i).forEach(a=>this.skip(a))))}async schedule(i,a,l){if(this.hasExecuted(i))return null;if(Bt.includes(i.type))return this.executeBranch(i,l,a);if(xr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,l,a);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,a){const l=[];return[...Ft,...Bt].includes(a.type)?l.push(...a.inputs):_t.includes(a.type)&&l.push(...a.outputs),l.map(e=>{var v;let y=i.find(T=>T.valueOwner.id===e.id);if(y)return y;if(!y&&Bt.includes(a.type)&&(y=i.find(T=>{var I;return((I=T.valueOwner.declaration)==null?void 0:I.id)===e.id})),y){const T=(v=y.value)==null?void 0:v.clone(null);return T==null||T.setStandaloneParent(e),{...y,valueOwner:e,value:T||null,inheritanceLink:{sources:[y],target:e}}}return Xn.includes(e.type)?wa(e,this.valueResolutionContext):ao(e,this.valueResolutionContext)}).reduce((e,y)=>{const v=Ys(y==null?void 0:y.valueOwner,this.project),T=y?[y]:[];return v.forEach(I=>{var V,M,x;if(I.id===(y==null?void 0:y.valueOwner.id))return;const b=nt(I.getDataType(null),I,this.project);b==null||b.metaSync({value:(V=y==null?void 0:y.value)==null?void 0:V.value},null),b==null||b.setValueAsTypeList(((M=y==null?void 0:y.value)==null?void 0:M.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((x=y==null?void 0:y.value)==null?void 0:x.valueAsTypeSingle)||null);const D={...y,valueOwner:I,value:b};T.push(D)}),[...e,...T]},[]).sort((e,y)=>e.valueOwner.index-y.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,a,l,c={}){var y,v;const e={...lo,...c};try{let T={value:X.Success,error:null,result:null};if(a.sort((I,b)=>I.valueOwner.index-b.valueOwner.index),Object.values(ur).includes(i.declaration.id)){const I=this.parentContext.requestExtension(Zu+i.declaration.id).module.main;I?T=await I(i,a):Y.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let I=null;if(T.error){Y.warn("Raw error executing entity: ",T.error);const b=(y=i.error)==null?void 0:y.getDataType(null),D=nt(b||null,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T.error):D==null||D.metaSync({value:T.error},null),I={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:D}}return{value:T.value,entity:i,error:I,result:{value:T.result||null,valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null}}}return{...T,entity:i}}catch(T){Y.warn("Internal call execution error: ",T);let I=null;if(i.error){const b=(v=i.error)==null?void 0:v.getDataType(null),D=nt(b,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T):D==null||D.metaSync({value:T},null),I={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:D}}return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:I,result:null}}}static async executeOperation(i,a,l){var c,e;try{let y={value:X.Success,error:null,result:null};a.sort((b,D)=>b.valueOwner.index-D.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,a));let v=null;if(y.error&&i.error){Y.warn("Raw error executing entity: ",y.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,D=nt(b,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(y.error):D==null||D.metaSync({value:y.error},null),v={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:D}}const T=i==null?void 0:i.getDataType(null),I=nt(T,i,l);return T!=null&&T.asType?I==null||I.setValueAsTypeSingle(y.result):I==null||I.metaSync({value:y.result},null),{value:y.value,entity:i,error:v,result:{value:I||null,valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null}}}catch(y){Y.warn("Operation execution error: ",y);let v=null;if(i.error){const T=(e=i.error)==null?void 0:e.getDataType(null),I=nt(T,i.error,l);T!=null&&T.asType?I==null||I.setValueAsTypeSingle(y):I==null||I.metaSync({value:y},null),v={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:I}}return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:v,result:null}}}async executeSearch(i,a,l){var c;try{let e={value:X.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(ot.SEARCH_NODE_IMPLEMENTATION)).module.main(i,a),v=i==null?void 0:i.getDataType(null),T=nt(v,i,l);return T==null||T.metaSync({value:{data:y.data}},null),y.error?{value:X.UnhandledError,entity:i,error:{valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null,value:T},result:null}:{value:e.value,entity:i,error:null,result:{value:T,valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null}}}catch(e){if(Y.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null};const y=(c=i.error)==null?void 0:c.getDataType(null),v=nt(y,i.error,l);return v==null||v.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:v},result:null}}}async executeLoop(i,a,l,c={}){var y,v,T,I,b,D;const e={...lo,...c};try{let V={value:X.Success,error:null,result:null};const M=a.map(ee=>{var H,oe;return((H=ee==null?void 0:ee.value)==null?void 0:H.valueAsType)||((oe=ee==null?void 0:ee.value)==null?void 0:oe.value)});let x={};i.getUniqueInputMaps().forEach(ee=>{const H=i.body.inputs.find(he=>S(he,l)===S(ee,l)),oe=ee==null?void 0:ee.getDataType(null),ae=nt(oe,H,l);oe!=null&&oe.asType?ae==null||ae.setValueAsTypeList([]):ae==null||ae.metaSync({value:[]},null),this.lastExecutionResults.writeValue(H,ae);const ye={value:ae,valueOwner:H,type:Re.ExecutionResult,inheritanceLink:null};x[H.id]=ye});let W={value:X.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case fe.loop["counted-loop"].id:{const ee=M[0];let H=1;for(;H<=ee&&H<=50;){const oe=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const ye=i.currentIterationNumberArgumentDeclaration.getDataType(null),he=Cd(ye),Q=this.lastExecutionResults.readValue(ae.id);if(Q){Q.metaSync({value:H},null),this.lastExecutionResults.writeValue(ae,Q);const $e={value:Q,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null};return x[ae.id]=$e,$e}const ue={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:H,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:he,standaloneParent:ae.toReference()},Te=gi(ue,l);this.lastExecutionResults.writeValue(ae,Te);const _e={value:Te,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null};return x[ae.id]=_e,_e}else return x[ae.id]}).filter(ae=>!!ae);if(W=await this.executeFullFunctionDeclarationLogic(i.body,oe,e),(W.results||[]).forEach(ae=>{var ue,Te,_e,$e;if(ae.valueOwner.type!==p.InputMap||_t.includes(ae.valueOwner.parent.type))return;const ye=i.body.inputs.find(Ie=>S(Ie,l)===S(ae.valueOwner,l)),Q=[...((Te=(ue=x==null?void 0:x[ye.id])==null?void 0:ue.value)==null?void 0:Te.value)||[],((_e=ae==null?void 0:ae.value)==null?void 0:_e.value)||null];($e=x[ye.id].value)==null||$e.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ye,x[ye.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;H++}break}case fe.loop["manual-flow-loop"].id:{let ee=1;for(;ee<=50;){const H=i.body.inputs.map(oe=>{if(oe===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(oe.id);if(ae){ae.metaSync({value:ee},null),this.lastExecutionResults.writeValue(oe,ae);const ue={value:ae,valueOwner:oe,type:Re.ExecutionResult,inheritanceLink:null};return x[oe.id]=ue,ue}const ye=i.currentIterationNumberArgumentDeclaration.getDataType(null),he=nt(ye,oe,l);return he==null||he.metaSync({value:ee},null),this.lastExecutionResults.writeValue(oe,he),{value:he,valueOwner:oe,type:Re.ExecutionResult,inheritanceLink:null}}else return x[oe.id]}).filter(oe=>!!oe);if(W=await this.executeFullFunctionDeclarationLogic(i.body,H,e),(W.results||[]).forEach(oe=>{var Q,ue,Te;if(oe.valueOwner.type!==p.InputMap||_t.includes(oe.valueOwner.parent.type))return;const ae=i.body.inputs.find(_e=>S(_e,l)===S(oe.valueOwner,l)),he=[...(Q=x[ae.id].value)==null?void 0:Q.value,((ue=oe.value)==null?void 0:ue.value)||null];(Te=x[ae.id].value)==null||Te.metaSync({value:he},null),this.lastExecutionResults.writeValue(ae,x[ae.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;ee++}break}case fe.loop["list-loop"].id:{const ee=M[0];let H=1;const oe=ee;for(let ae=0;ae<oe.length;ae++){const ye=oe[ae],he=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const Te=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=nt(Te,Q,l);return _e==null||_e.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Te=Cd(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Te,standaloneParent:Q.toReference()},Ie=gi($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(W=await this.executeFullFunctionDeclarationLogic(i.body,he,e),(W.results||[]).forEach(Q=>{var $e,Ie,Ce;if(Q.valueOwner.type!==p.InputMap||_t.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Ce=x[ue.id].value)==null||Ce.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;H++}break}case fe.loop["object-keys-loop"].id:{const ee=M[0];let H=1;const oe=ee?Object.keys(ee):[];for(let ae=0;ae<oe.length;ae++){const ye=oe[ae],he=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const Te=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=nt(Te,Q,l);return _e==null||_e.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Te=Cd(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Te,standaloneParent:Q.toReference()},Ie=gi($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(W=await this.executeFullFunctionDeclarationLogic(i.body,he,e),(W.results||[]).forEach(Q=>{var $e,Ie,Ce;if(Q.valueOwner.type!==p.InputMap||_t.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Ce=x[ue.id].value)==null||Ce.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;H++}break}case fe.loop["object-values-loop"].id:{const ee=M[0];let H=1;const oe=ee?Object.values(ee):[];for(let ae=0;ae<oe.length;ae++){const ye=oe[ae],he=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const Te=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=nt(Te,Q,l);return _e==null||_e.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Te=Cd(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Te,standaloneParent:Q.toReference()},Ie=gi($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(W=await this.executeFullFunctionDeclarationLogic(i.body,he,e),(W.results||[]).forEach(Q=>{var $e,Ie,Ce;if(Q.valueOwner.type!==p.InputMap||_t.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Ce=x[ue.id].value)==null||Ce.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;H++}break}case fe.loop["string-loop"].id:{const ee=M[0];let H=1;const oe=ee.split("");for(let ae=0;ae<oe.length;ae++){const ye=oe[ae],he=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const Te=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=nt(Te,Q,l);return _e==null||_e.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Te=Cd(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Te,standaloneParent:Q.toReference()},Ie=gi($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(W=await this.executeFullFunctionDeclarationLogic(i.body,he,e),(W.results||[]).forEach(Q=>{var $e,Ie,Ce;if(Q.valueOwner.type!==p.InputMap||_t.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Ce=x[ue.id].value)==null||Ce.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;H++}break}}if(V={value:[X.CaughtError,X.Return].includes(W.value)?W.value:X.Success,error:((v=(y=W.error)==null?void 0:y.value)==null?void 0:v.value)||null,result:((I=(T=W==null?void 0:W.result)==null?void 0:T.value)==null?void 0:I.value)||null},V.error&&i.error){const ee=(b=i.error)==null?void 0:b.getDataType(null),H=nt(ee||null,i.error,l);ee!=null&&ee.asType?H==null||H.setValueAsTypeSingle(V.error):H==null||H.metaSync({value:V.error},null);const oe={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:H};return{value:V.value,entity:i,error:oe,result:null}}const Z=i==null?void 0:i.getDataType(null),J=nt(Z,i,l);return Z!=null&&Z.asType?J==null||J.setValueAsTypeSingle(V.result):J==null||J.metaSync({value:V.result},null),{value:V.value,entity:i,error:null,result:{value:J||null,valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null}}}catch(V){if(Y.warn("Error executing loop: ",V),i.error){const M=(D=i.error)==null?void 0:D.getDataType(null),x=nt(M,i.error,l);return M!=null&&M.asType?x==null||x.setValueAsTypeSingle(V):x==null||x.metaSync({value:V},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:x},result:null}}else return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,a,l,c={}){var y,v;const e={...lo,...c};try{let T={value:X.Success,error:null,result:null};T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let I=null;if(T.error&&i.error){Y.warn("Raw error executing entity: ",T.error);const b=(y=i.error)==null?void 0:y.getDataType(null),D=nt(b||null,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T.error):D==null||D.metaSync({value:T.error},null),I={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:D}}return{value:T.value,entity:i,error:I,result:T.result}}catch(T){if(!i.error)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null};const I=(v=i.error)==null?void 0:v.getDataType(null),b=nt(I,i.error,l);return I!=null&&I.asType?b==null||b.setValueAsTypeSingle(T):b==null||b.metaSync({value:T},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:b},result:null}}}async executeCondition(i,a){var c,e,y,v,T,I,b,D,V,M,x,G,W,Z,J,ee,H,oe,ae,ye,he,Q,ue,Te,_e,$e,Ie,Ce,je,Ve,xe,Fe,ft,tt,Ut,Ot,Ti,Zi,Xi,on,_r,Zt,_i,cs,fs,gy,Md,_y;let l=!1;switch(i.declaration.id){case Ar.Empty:{l=!((e=(c=a[0])==null?void 0:c.value)!=null&&e.value);break}case Ar.NotEmpty:{l=!!((v=(y=a[0])==null?void 0:y.value)!=null&&v.value);break}case ut.Equal:{if([re.String,re.Number,re.Boolean,re.Null,re.Enum,re.Date,re.UUID].includes((I=(T=a[0])==null?void 0:T.value)==null?void 0:I.name)){l=((D=(b=a[0])==null?void 0:b.value)==null?void 0:D.value)===((M=(V=a[1])==null?void 0:V.value)==null?void 0:M.value);break}if(((G=(x=a[0])==null?void 0:x.value)==null?void 0:G.name)===re.KeyValue||((Z=(W=a[0])==null?void 0:W.value)==null?void 0:Z.name)===re.Untyped){const Va=(ee=(J=a[0])==null?void 0:J.value)==null?void 0:ee.value,kr=(oe=(H=a[1])==null?void 0:H.value)==null?void 0:oe.value;l=JSON.stringify(Va)===JSON.stringify(kr);break}break}case ut.NotEqual:{if([re.String,re.Number,re.Boolean,re.Null,re.Enum,re.Date,re.UUID].includes((ye=(ae=a[0])==null?void 0:ae.value)==null?void 0:ye.name)){l=((Q=(he=a[0])==null?void 0:he.value)==null?void 0:Q.value)!==((Te=(ue=a[1])==null?void 0:ue.value)==null?void 0:Te.value);break}if((($e=(_e=a[0])==null?void 0:_e.value)==null?void 0:$e.name)===re.Untyped||((Ce=(Ie=a[0])==null?void 0:Ie.value)==null?void 0:Ce.name)===re.KeyValue){const Va=(Ve=(je=a[0])==null?void 0:je.value)==null?void 0:Ve.value,kr=(Fe=(xe=a[1])==null?void 0:xe.value)==null?void 0:Fe.value;l=JSON.stringify(Va)!==JSON.stringify(kr);break}break}case ut.MoreThanOrEqual:{l=((tt=(ft=a[0])==null?void 0:ft.value)==null?void 0:tt.value)>=((Ot=(Ut=a[1])==null?void 0:Ut.value)==null?void 0:Ot.value);break}case ut.MoreThan:{l=((Zi=(Ti=a[0])==null?void 0:Ti.value)==null?void 0:Zi.value)>((on=(Xi=a[1])==null?void 0:Xi.value)==null?void 0:on.value);break}case ut.LessThanOrEqual:{l=((Zt=(_r=a[0])==null?void 0:_r.value)==null?void 0:Zt.value)<=((cs=(_i=a[1])==null?void 0:_i.value)==null?void 0:cs.value);break}case ut.LessThan:{l=((gy=(fs=a[0])==null?void 0:fs.value)==null?void 0:gy.value)<((_y=(Md=a[1])==null?void 0:Md.value)==null?void 0:_y.value);break}case Fi.And:{l=(await Promise.all(i.andChildrenGroup.map(async kr=>{const Ep=this.mergeExernalValuesWithInternalInputs(a,kr);return(await this.executeCondition(kr,Ep)).value===X.Success}))).every(kr=>kr);break}case Fi.Or:{l=(await Promise.all(i.orChildrenGroup.map(async kr=>{const Ep=this.mergeExernalValuesWithInternalInputs(a,kr);return(await this.executeCondition(kr,Ep)).value===X.Success}))).some(kr=>kr);break}}return{value:l?X.Success:X.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,a,l,c={}){const e={...lo,...c,onBeforeEntityExecution:(T,I,b)=>{var D;return((D=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:D.call(c,T,I,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(T,I,b)=>{var D;return((D=c==null?void 0:c.onEntityExecuted)==null?void 0:D.call(c,T,I,{...b,detached:!0}))||Promise.resolve()}},y=new oo(l,[i,...tv(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,a)}async executeFullFunctionDeclarationLogic(i,a,l={}){const c={...lo,...l},e=tv(i);e.forEach(T=>{this.addEntity(T)}),e.reduce((T,I)=>_t.includes(I.type)?[...T,...I.outputs]:Ft.includes(I.type)&&I.type!==p.Condition?[...T,...I.outputs,...I.inputs]:I.type===p.Condition?[...T,...I.inputs]:T,[]).forEach(T=>{this.lastExecutionResults.removeValue(T.id)});const v=await this.executeBranch(i,c,a);return{...v||{},value:(v==null?void 0:v.value)||X.Success,entity:i,error:(v==null?void 0:v.error)||null,result:(v==null?void 0:v.result)||null}}static async executeEntryPointEntity(i,a){return{value:X.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=wa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Re.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=wa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=nt(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var G,W;if(((G=x.declaration)==null?void 0:G.type)===p.Property&&x.declaration.static){const Z=this.lastExecutionResults.readValue(x.declaration.id),J=S(x,this.project),ee=x.codeName||((W=x.declaration)==null?void 0:W.codeName)||Mi(J);if(Z)Z.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,Z);else{const H=nt(x.getDataType(null),x,this.project);H==null||H.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,H)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var Z;const x=M.codeName||((Z=M.declaration)==null?void 0:Z.codeName)||Mi(S(M,this.project)),G=e[x],W=nt(M.getDataType(null),M,this.project);W==null||W.metaSync({value:G},null),Re.ExecutionResult}),l.type=Re.ExecutionResult,{value:X.Return,entity:i,error:null,result:l}}async executeContinueStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=wa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Re.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=wa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=nt(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var G,W;if(((G=x.declaration)==null?void 0:G.type)===p.Property&&x.declaration.static){const Z=this.lastExecutionResults.readValue(x.declaration.id),J=S(x,this.project),ee=x.codeName||((W=x.declaration)==null?void 0:W.codeName)||Mi(J);if(Z)Z.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,Z);else{const H=nt(x.getDataType(null),x,this.project);H==null||H.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,H)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var Z;const x=M.codeName||((Z=M.declaration)==null?void 0:Z.codeName)||Mi(S(M,this.project)),G=e[x],W=nt(M.getDataType(null),M,this.project);W==null||W.metaSync({value:G},null),Re.ExecutionResult}),l.type=Re.ExecutionResult,{value:X.Continue,entity:i,error:null,result:l}}async executeBreakStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=wa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Re.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=wa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=nt(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var G,W;if(((G=x.declaration)==null?void 0:G.type)===p.Property&&x.declaration.static){const Z=this.lastExecutionResults.readValue(x.declaration.id),J=S(x,this.project),ee=x.codeName||((W=x.declaration)==null?void 0:W.codeName)||Mi(J);if(Z)Z.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,Z);else{const H=nt(x.getDataType(null),x,this.project);H==null||H.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,H)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var Z;const x=M.codeName||((Z=M.declaration)==null?void 0:Z.codeName)||Mi(S(M,this.project)),G=e[x],W=nt(M.getDataType(null),M,this.project);W==null||W.metaSync({value:G},null),Re.ExecutionResult}),l.type=Re.ExecutionResult,{value:X.Break,entity:i,error:null,result:l}}async executeVariable(i,a){var v,T,I,b,D,V;let l=wa(i,this.valueResolutionContext);const c=nn(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let M={};if(((v=e==null?void 0:e.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...e.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=nt(e,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:c,type:Re.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(c,l.value),c.inputs.forEach(x=>{var G,W;if(((G=x.declaration)==null?void 0:G.type)===p.Property&&x.declaration.static){const Z=this.lastExecutionResults.readValue(x.declaration.id),J=S(x,this.project),ee=x.codeName||((W=x.declaration)==null?void 0:W.codeName)||Mi(J);if(Z)Z.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,Z);else{const H=nt(x.getDataType(null),x,this.project);H==null||H.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,H)}}})}else this.lastExecutionResults.writeValue(c,l==null?void 0:l.value);const y=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var Z;const x=M.codeName||((Z=M.declaration)==null?void 0:Z.codeName)||Mi(S(M,this.project)),G=y[x],W=nt(M.getDataType(null),M,this.project);W==null||W.metaSync({value:G},null),Re.ExecutionResult}),l.type=Re.ExecutionResult,{value:X.Success,entity:i,error:null,result:l}}mergeValues(i,a){const l=[];for(let c=0;c<a.length;c++)i!=null&&i[c]?l.push(i[c]):l.push(a[c]);return l}async executeEntity(i,a=[],l={}){var y,v,T,I,b,D,V,M,x,G,W;const c={...lo,...l},e={detached:!1};switch(i.type){case p.Condition:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((y=c.onBeforeEntityExecution)==null?void 0:y.call(c,i,Z,e)),this.executeCondition(i,Z)}case p.InternalCall:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((v=c.onBeforeEntityExecution)==null?void 0:v.call(c,i,Z,e)),this.executeInternalCall(i,Z,this.project)}case p.Operation:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((T=c.onBeforeEntityExecution)==null?void 0:T.call(c,i,Z,e)),oo.executeOperation(i,Z,this.project)}case p.VariableInstance:case p.VariableDeclaration:return this.executeVariable(i,a);case p.FunctionCall:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((I=c.onBeforeEntityExecution)==null?void 0:I.call(c,i,Z,e)),this.executeFunctionCall(i,Z,this.project)}case p.FunctionDeclaration:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,Z,e)),oo.executeEntryPointEntity(i,Z)}case p.Search:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((D=c.onBeforeEntityExecution)==null?void 0:D.call(c,i,Z,e)),this.executeSearch(i,Z,this.project)}case p.Loop:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((V=c.onBeforeEntityExecution)==null?void 0:V.call(c,i,Z,e)),this.executeLoop(i,Z,this.project,c)}case p.ReturnStatement:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,Z,e)),this.executeReturnStatement(i,Z)}case p.ContinueStatement:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((x=c.onBeforeEntityExecution)==null?void 0:x.call(c,i,Z,e)),this.executeContinueStatement(i,Z)}case p.BreakStatement:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((G=c.onBeforeEntityExecution)==null?void 0:G.call(c,i,Z,e)),this.executeBreakStatement(i,Z)}case p.GlobalEvent:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((W=c.onBeforeEntityExecution)==null?void 0:W.call(c,i,Z,e)),oo.executeEntryPointEntity(i,Z)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var l,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((l=i.result)!=null&&l.valueOwner))return;const a=Ys((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?a.forEach(y=>{var v;this.lastExecutionResults.writeValue(y,(v=i.result)==null?void 0:v.value)}):a.forEach(y=>{this.lastExecutionResults.removeValue(y.id)})}async executeBranch(i,a={},l=[]){var T;const c={...lo,...a},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const v=await this.executeEntity(i,l,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(v),await((T=c.onEntityExecuted)==null?void 0:T.call(c,i,v,e)),v.value===X.Success){const I=(i.successCalls||i.calls||[]).filter(x=>this.hasEntity(x));(i.errorCalls||[]).forEach(x=>{this.skip(x)});let D=[];const V=(await Promise.all(I.map(x=>this.schedule(x,[],c)))).filter(x=>!!x),M=V.filter(x=>!!x).find(x=>x.value===X.CaughtError||x.value===X.Return||x.value===X.Break||x.value===X.Continue);return M||(D=[...D,...V],v)}else if(v.value===X.CaughtError||v.value===X.ConditionNotMet){const I=(i.errorCalls||[]).filter(x=>this.hasEntity(x));(i.successCalls||i.calls||[]).forEach(x=>{this.skip(x)});let D=[];const V=(await Promise.all(I.map(x=>this.schedule(x,[],c)))).filter(x=>!!x),M=V.filter(x=>!!x).find(x=>x.value===X.CaughtError||x.value===X.UnhandledError||x.value===X.Return||x.value===X.Break||x.value===X.Continue);return M||(D=[...D,...V],v)}else{if(v.value===X.UnhandledError)return this.executing.forEach(I=>{this.skip(I)}),this.scheduled.forEach(I=>{this.skip(I)}),wr.includes(v.entity.type)&&ct(v.entity).forEach(I=>{this.skip(I)}),v;if(v.value===X.Return)return v;if(v.value===X.Break)return v;if(v.value===X.Continue)return v}return v}async execute(i={},a=[]){const l={...lo,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,l,a);return this.state="finished-success",c}addEntity(i){var a;this.entities.includes(i)||(this.entities.push(i),(a=this.onAddEntityCallback)==null||a.call(this,i))}addEntities(i){i.forEach(a=>this.addEntity(a))}removeEntity(i){var a;if(i!==this.entryPoint){const l=this.entities.indexOf(i);l>-1&&(this.entities.splice(l,1),(a=this.onRemoveEntityCallback)==null||a.call(this,i))}}hasEntity(i){var c,e,y;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===p.FunctionDeclaration&&((y=(e=i.parent)==null?void 0:e.parent)==null?void 0:y.type)===p.DefinitionEntity)return this.entities.includes(i.parent);const a=$i(i);if(!a)return!1;const l=a.type===p.Loop&&i.parent===a.body?a.body:null;return l?this.entities.includes(l)||this.entities.includes(a):this.entities.includes(a)}removeScheduled(i){const a=this.scheduled.indexOf(i);a>-1&&this.scheduled.splice(a,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const a=this.project.get(i);return a?this.hasEntity(a):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const a=this.scheduled.indexOf(i);a>-1&&this.scheduled.splice(a,1)}removeFromExecutingList(i){var l;const a=this.executing.indexOf(i);a>-1&&(this.executing.splice(a,1),(l=this.onAbortExecutionCallback)==null||l.call(this,i))}removeFromAlreadyExecutedList(i){const a=this.executed.indexOf(i);a>-1&&this.executed.splice(a,1)}removeFromSkippedList(i){var l;const a=this.skipped.indexOf(i);a>-1&&(this.skipped.splice(a,1),(l=this.onRemoveFromSkippedListCallback)==null||l.call(this,i))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var a;this.skipped.includes(i)||(this.skipped.push(i),(a=this.onAddToSkippedListCallback)==null||a.call(this,i))}}function tDe(d){var u,i;if(d.isList)return"list";if(((u=d.entity)==null?void 0:u.type)===p.DefinitionEntity)return"definition-entity";switch((i=d.entity)==null?void 0:i.name){case re.Number:return"number";case re.String:return"text";case re.Boolean:return"boolean";case re.UUID:return"uuid";case re.Date:return"date-time";default:return"definition-entity"}}const ss={[p.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[p.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[p.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[p.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[p.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[p.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[p.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[p.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[p.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[p.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[p.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[p.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[p.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[p.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[p.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[p.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[p.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[p.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[p.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[p.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[p.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[p.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[p.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[p.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[p.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[p.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function FA(d){const u=iv(d);if(!u){const a=yp(d);if(a.includes(ce.HTTP_ENDPOINT))return"HTTP endpoint";if(a.includes(ce.PERSISTED_ENTITY))return"Persisted entity";if(a.includes(ce.CRON_JOB))return"Scheduled execution";if(a.includes(ce.RELATIONAL_DATABASE))return"Relational database"}if(u){let a="Extension of "+S(u,u.project)+" entity",l=cd(a);const c=yp(d);return c.includes(ce.HTTP_ENDPOINT)?"HTTP endpoint"+(l?", "+l:""):c.includes(ce.PERSISTED_ENTITY)?"Persisted entity"+(l?", "+l:""):c.includes(ce.CRON_JOB)?"Scheduled execution"+(l?", "+l:""):c.includes(ce.RELATIONAL_DATABASE)?"Relational database"+(l?", "+l:""):a}let i="";return d.abstract&&(i="Template "),d.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function X7(d){return d.parent.type===p.DefinitionEntity||d.parent.type===p.InstalledProject?"Internal action of "+S(d.parent,d.project):d.parent.type===p.Loop?"Action repeated on every iteration":"Internal action of entity"}function KA(d){return dR(d)?X7(d):"Custom trigger"}function iDe(d){var u;switch(d.type){case p.DefinitionEntity:return FA(d);case p.FunctionDeclaration:return KA(d)}return(u=ss[d.type])==null?void 0:u.singular}function rDe(d){var u;switch(d.type){case p.DefinitionEntity:return FA(d);case p.FunctionDeclaration:return KA(d)}return(u=ss[d.type])==null?void 0:u.singular}const qA=4e4,Q7=280,nDe=300,ZA=65,Ju=32,Qm=39,e9=26,t9=49,e0=44,sDe=35,t0=52,WA=10,hl=WA*2,i0=38,r0=90,HA=270,i9=qA/2+120,r9=qA/2+180;function n9(d){let i=Ju+e0+i0+WA;const a=[...d.inputs];return a.length&&(i+=hl,a.forEach(()=>{i+=e9})),{height:i,width:280}}function s9(d){let i=ZA;const a=[];if([p.DefinitionEntity].includes(d.type)){const v=[...d.suggestedProperties||[],...d.properties||[]];v.length&&(i+=hl,v.forEach(T=>{i+=T.static?t9:Qm}))}if([p.DefinitionEntity,p.InstalledProject,p.Loop].includes(d.type)){const v=[...(d==null?void 0:d.suggestedMethods)||[],...d.methods||[],...d.functions||[],...d.body?[d.body]:[]];v.length&&(i+=hl,v.forEach(T=>{const I=n9(T);i+=I.height}))}Ft.includes(d.type)?(Vt.includes(d.type)?a.push(...(d.usedInputs||[]).flatMap(v=>[v])||[]):a.push(...(d.inputs||[]).flatMap(v=>[v])||[]),d.error&&(i+=t0)):[p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)?(a.push(...d.outputs||[]),d.throws&&(i+=t0)):d.type===p.Condition&&(a.push(d.inputs[0]),d.inputs[1]&&a.push(d.inputs[1]));const l=a.length;l&&(i+=l*Qm,i+=hl);const c=[];if(d.type===p.FunctionDeclaration||d.type===p.GlobalEvent?c.push(...d.inputs||[]):Ft.includes(d.type)&&(Vt.includes(d.type)?c.push(...d.usedOutputs||[]):c.push(...d.outputs||[])),Vt.includes(d.type)){d.readsValue&&(i+=hl,i+=e0),d.writesValues.length&&(i+=hl,i+=e0),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>i+=t0+hl);const v=d.getDataType(null);(!v||v.inferred)&&(i+=i0)}const e=c.length;return e&&(i+=e*Qm,i+=hl),[p.DefinitionEntity,p.FunctionDeclaration,p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)&&(i+=i0),{height:i,width:280}}function ef(d){return`${d.split("-").map((a,l)=>l===0?a.charAt(0).toUpperCase()+a.slice(1):a.toLowerCase()).join(" ")}.`}function aDe(d){switch(d.code){case le.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case le.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case le.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case le.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case le.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case le.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case le.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case de.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case de.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case le.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case le.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case de.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case le.NoProperties:return"This entity has no properties, so it doesn't do anything";case le.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case le.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case le.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case le.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case le.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case le.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case le.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case le.PropertyImplementsNonAbstact:return"This property implements a non-template property";case le.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case le.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case le.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case le.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case le.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case de.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case de.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case de.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case de.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case de.UnreachableEntity:return"This entity is unreachable";case le.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case le.AbstractEntityImplements:return"This template entity implements a non-template entity";case le.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case le.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case le.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case le.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case le.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case le.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case le.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case le.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case le.MissingRequiredValue:return"This action is missing a required value";case le.NoPrimaryKeyProperty:return"This entity has no primary key property";case le.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case le.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case le.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case le.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case le.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case le.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case le.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case de.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case de.EmptyName:return"This entity has no name";case de.InvalidObjectStructure:return"This entity has an invalid structure";case de.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case de.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case de.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case de.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case de.MissingCaller:return"This action is missing a caller";case de.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case de.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case de.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case de.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case de.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case de.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case de.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case de.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Na.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Na.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case qn.UUIDMustBeString:return`UUID must be a string, eg: "${Td()}"`;case qn.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Td()}"`;case qn.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${Td()}"`;case vn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case vn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case vn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return ef(d.code)}}function lDe(d){switch(d.code){case le.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case le.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case le.IncorrectEntityImplementation:return"Incorrect implementation";case le.IncorrectMethodImplementation:return"Incorrect action implementation";case le.IncorrectPropertyImplementation:return"Incorrect property implementation";case le.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case le.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case de.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case de.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case le.MissingMethodImplementation:return"Missing action";case le.MissingPropertyImplementation:return"Missing property";case de.NameNotUniqueInScope:return"Duplicate name";case le.NoProperties:return"No properties";case le.NonStaticPropertyInStaticEntity:return"Non-static property";case le.StaticEntityWithNonStaticProperties:return"Non-static properties";case le.ReadingFromIncompatibleType:return"Read from different type";case le.WritingToIncompatibleType:return"Write to different type";case le.ScopeWithoutLogic:return"No logic";case le.NonStaticPropertyImplementsStatic:return"Invalid static property";case le.PropertyImplementsIncompatibleType:return"Incompatible data type";case le.PropertyImplementsNonAbstact:return"Non-template property";case le.StaticPropertyImplementsNonStatic:return"Non-static property";case le.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case le.VariableHasInputsAndInternalCall:return"Bad internal call";case le.VariableHasOutputsAndInternalCall:return"Bad internal call";case le.VariableIsCalledAndHasInternalCall:return"Bad internal call";case de.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case de.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case de.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case de.InternalCallParentMissingDataType:return"Parent has no data type";case de.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case de.UnreachableEntity:return"Unreachable entity";case le.DisconnectedCallableEntity:return"Disconnected entity";case le.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case le.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case le.InvalidPropertiesCombination:return"Invalid properties combination";case le.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case le.ExtendsIncompatibleEntities:return"Extends incompatible entities";case le.ImplementingNonAbstractEntity:return"Implementing non-template entity";case le.ImplementsIncompatibleEntities:return"Implements incompatible entities";case le.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case le.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case le.MissingRequiredValue:return"Missing required value";case le.NoPrimaryKeyProperty:return"No primary key property";case le.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case le.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case le.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case le.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case le.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case le.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case le.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case de.EmptyName:return"Empty name";case de.InvalidObjectStructure:return"Invalid object structure";case de.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case de.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case de.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case de.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case de.MissingCaller:return"Missing caller";case de.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case de.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case de.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case de.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case de.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case de.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case de.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case de.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Na.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Na.StatusCodeMustBeNumber:return"HTTP status code must be a number";case qn.UUIDMustBeString:return"UUID must be a string";case qn.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case qn.UUIDMustBeValidFormat:return"UUID must be in a valid format";case vn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case vn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case vn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return ef(d.code)}}function oDe(d){switch(d.code){case le.AbstractEntityWithNonAbstractMethods:return`${S(d.entity,d.entity.project)} has non-template actions`;case le.AbstractEntityWithNonAbstractProperties:return`${S(d.entity,d.entity.project)} has non-template properties`;case le.IncorrectEntityImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements template`;case le.IncorrectMethodImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template`;case le.IncorrectPropertyImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template`;case le.AbstractMethodInNonAbstractEntity:return`${S(d.entity,d.entity.project)} can't be a template`;case le.AbstractPropertyInNonAbstractEntity:return`${S(d.entity,d.entity.project)} can't be a template`;case de.MethodOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites action`;case de.PropertyOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites property`;case le.MissingMethodImplementation:return`${S(d.entity,d.entity.project)} is missing action`;case le.MissingPropertyImplementation:return`${S(d.entity,d.entity.project)} is missing property`;case de.NameNotUniqueInScope:return`${S(d.entity,d.entity.project)} name is not unique`;case le.NoProperties:return`${S(d.entity,d.entity.project)} has no properties`;case le.NonStaticPropertyInStaticEntity:return`${S(d.entity,d.entity.project)} has non-static property`;case le.StaticEntityWithNonStaticProperties:return`${S(d.entity,d.entity.project)} has non-static properties`;case le.ReadingFromIncompatibleType:return`${S(d.entity,d.entity.project)} reads from different type`;case le.WritingToIncompatibleType:return`${S(d.entity,d.entity.project)} writes to different type`;case le.ScopeWithoutLogic:return`${S(d.entity,d.entity.project)} has no logic`;case le.NonStaticPropertyImplementsStatic:return`${S(d.entity,d.entity.project)} has invalid static property`;case le.PropertyImplementsIncompatibleType:return`${S(d.entity,d.entity.project)} has incompatible data type`;case le.PropertyImplementsNonAbstact:return`${S(d.entity,d.entity.project)} has non-template property`;case le.StaticPropertyImplementsNonStatic:return`${S(d.entity,d.entity.project)} has non-static property`;case le.VariableCallsOthersAndHasInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case le.VariableHasInputsAndInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case le.VariableHasOutputsAndInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case le.VariableIsCalledAndHasInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case de.InternalCallDeclarationIsInvalidType:return`${S(d.entity,d.entity.project)} has declaration that is not an action`;case de.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has declaration that is not found in parent`;case de.InternalCallParentDeclarationEntityInvalidType:return`${S(d.entity,d.entity.project)} has invalid parent declaration type`;case de.InternalCallParentMissingDataType:return`${S(d.entity,d.entity.project)}'s parent has no data type`;case de.InternalCallDeclarationNotInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has declaration that is not in parent`;case de.UnreachableEntity:return`${S(d.entity,d.entity.project)} is unreachable`;case le.DisconnectedCallableEntity:return`${S(d.entity,d.entity.project)} is not executed by any entity`;case le.AbstractEntityImplements:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case le.AbstractExtendingNonAbstractEntity:return`${S(d.entity,d.entity.project)} extends a non-template entity`;case le.InvalidPropertiesCombination:return`${S(d.entity,d.entity.project)} has invalid properties combination`;case le.ExtendingNonInteractiveEntity:return`${S(d.entity,d.entity.project)} extends a non-interactive entity`;case le.ExtendsIncompatibleEntities:return`${S(d.entity,d.entity.project)} extends incompatible entities`;case le.ImplementingNonAbstractEntity:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case le.ImplementsIncompatibleEntities:return`${S(d.entity,d.entity.project)} implements incompatible entities`;case le.LackingReturnStatementOnSomeBranches:return`${S(d.entity,d.entity.project)} is missing termination on some branches`;case le.LastCalledEntityMustBeReturnEntity:return`${S(d.entity,d.entity.project)}'s last called entity must be a termination node`;case le.MissingRequiredValue:return`${S(d.entity,d.entity.project)} is missing a required value`;case le.NoPrimaryKeyProperty:return`${S(d.entity,d.entity.project)} has no primary key property`;case le.NonAbstractExtendingAbstractEntity:return`${S(d.entity,d.entity.project)} extends a template entity`;case le.NonStaticExtendingStaticEntity:return`${S(d.entity,d.entity.project)} extends a static entity`;case le.NonStaticImplementingStaticEntity:return`${S(d.entity,d.entity.project)} implements a static entity`;case le.StaticExtendingNonStaticEntity:return`${S(d.entity,d.entity.project)} extends a non-static entity`;case le.StaticImplementingNonStaticEntity:return`${S(d.entity,d.entity.project)} implements a non-static entity`;case le.VariableReadsValueAndInternalCall:return`${S(d.entity,d.entity.project)} reads a value and has internal call`;case le.VariableWritesValuesAndInternalCall:return`${S(d.entity,d.entity.project)} writes values and has internal call`;case de.EmptyName:return`${ss[d.entity.type]} has no name`;case de.InvalidObjectStructure:return`${S(d.entity,d.entity.project)} has invalid structure`;case de.LoopBodyFunctionOverwrite:return`${S(d.entity,d.entity.project)}'s loop body action overwrites an action`;case de.MethodOverwritesBaseMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites base action`;case de.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case de.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case de.MissingCaller:return`${S(d.entity,d.entity.project)} is missing a caller`;case de.NameAsResolvedCodeNameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a name not unique in the scope`;case de.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${S(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case de.NameMustStartWithLetterOrUnderscore:return`${S(d.entity,d.entity.project)} name must start with letter or underscore`;case de.NoOverlapWithImplementedSignature:return`${S(d.entity,d.entity.project)} has no overlap with implemented signature`;case de.PropertyOverwritesBasePropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites base property`;case de.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case de.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case de.ReaderWriterIncompatibleDataType:return`${S(d.entity,d.entity.project)} has reader/writer with incompatible data type`;case Na.StatusCodeMustBeBetween100And599:return`${S(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Na.StatusCodeMustBeNumber:return`${S(d.entity,d.entity.project)} HTTP status code must be a number`;case qn.UUIDMustBeString:return`${S(d.entity,d.entity.project)} UUID must be a string`;case qn.UUIDMustNotContainSpaces:return`${S(d.entity,d.entity.project)} UUID must not contain spaces`;case qn.UUIDMustBeValidFormat:return`${S(d.entity,d.entity.project)} UUID must be in a valid format`;case vn.MustBeUniqueAmongSameEntities:return`${S(d.entity,d.entity.project)} value must be unique among the same kind`;case vn.StringValueMustNotHaveDashes:return`${S(d.entity,d.entity.project)} value must not contain dashes`;case vn.StringValueMustNotHaveSpaces:return`${S(d.entity,d.entity.project)} value must not contain spaces`;default:return`${S(d.entity,d.entity.project)} Error: ${ef(d.code)}`}}function dDe(d){var u,i,a,l;switch(d.code){case le.AbstractEntityWithNonAbstractMethods:return`${S(d.entity,d.entity.project)} has non-template actions`;case le.AbstractEntityWithNonAbstractProperties:return`${S(d.entity,d.entity.project)} has non-template properties`;case le.IncorrectEntityImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template entity`;case le.IncorrectMethodImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case le.IncorrectPropertyImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case le.AbstractMethodInNonAbstractEntity:return`${S(d.entity,d.entity.project)} is a template action in a non-template entity`;case le.AbstractPropertyInNonAbstractEntity:return`${S(d.entity,d.entity.project)} is a template property in a non-template entity`;case de.MethodOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites an action in the template entity`;case de.PropertyOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites a property in the template entity`;case le.MissingMethodImplementation:return`${S(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case le.MissingPropertyImplementation:return`${S(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case de.NameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a duplicate name in the same scope`;case le.NoProperties:return`${S(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case le.NonStaticPropertyInStaticEntity:return`${S(d.entity,d.entity.project)} has a non-static property in a static entity`;case le.StaticEntityWithNonStaticProperties:return`${S(d.entity,d.entity.project)} has non-static properties in a static entity`;case le.ReadingFromIncompatibleType:return`${S(d.entity,d.entity.project)} reads data from a value of a different data type`;case le.WritingToIncompatibleType:return`${S(d.entity,d.entity.project)} writes data to a value of a different data type`;case le.ScopeWithoutLogic:return`${S(d.entity,d.entity.project)} has no logic`;case le.NonStaticPropertyImplementsStatic:return`${S(d.entity,d.entity.project)} has a static property in a non-static entity`;case le.PropertyImplementsIncompatibleType:return`${S(d.entity,d.entity.project)} implements a property of a different data type`;case le.PropertyImplementsNonAbstact:return`${S(d.entity,d.entity.project)} implements a non-template property`;case le.StaticPropertyImplementsNonStatic:return`${S(d.entity,d.entity.project)} has a static property in a non-static entity`;case le.VariableCallsOthersAndHasInternalCall:return`${S(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case le.VariableHasInputsAndInternalCall:return`${S(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case le.VariableHasOutputsAndInternalCall:return`${S(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case le.VariableIsCalledAndHasInternalCall:return`${S(d.entity,d.entity.project)} is called while being used to execute internal logic`;case de.InternalCallDeclarationIsInvalidType:return`${S(d.entity,d.entity.project)} has a declaration that is not an action`;case de.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has a declaration that is not found in ${(u=d.entity.parent.getDataType(null))!=null&&u.entity?S((i=d.entity.parent.getDataType(null))==null?void 0:i.entity,d.entity.project):"the variable's data-type entity"}`;case de.InternalCallParentDeclarationEntityInvalidType:return`${S(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case de.InternalCallParentMissingDataType:return`${S(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case de.InternalCallDeclarationNotInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has a declaration doesn't belong to ${(a=d.entity.parent.getDataType(null))!=null&&a.entity?S((l=d.entity.parent.getDataType(null))==null?void 0:l.entity,d.entity.project):"the variable's data-type entity"}`;case de.UnreachableEntity:return`${S(d.entity,d.entity.project)} is unreachable`;case le.DisconnectedCallableEntity:return`${S(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;case le.AbstractEntityImplements:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case le.AbstractExtendingNonAbstractEntity:return`${S(d.entity,d.entity.project)} extends a non-template entity`;case le.InvalidPropertiesCombination:return`${S(d.entity,d.entity.project)} has an invalid combination of properties`;case le.ExtendingNonInteractiveEntity:return`${S(d.entity,d.entity.project)} extends a non-interactive entity`;case le.ExtendsIncompatibleEntities:return`${S(d.entity,d.entity.project)} extends incompatible entities`;case le.ImplementingNonAbstractEntity:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case le.ImplementsIncompatibleEntities:return`${S(d.entity,d.entity.project)} implements incompatible entities`;case le.LackingReturnStatementOnSomeBranches:return`${S(d.entity,d.entity.project)} has branches that don't terminate`;case le.LastCalledEntityMustBeReturnEntity:return`${S(d.entity,d.entity.project)} must end with a termination node`;case le.MissingRequiredValue:return`${S(d.entity,d.entity.project)} is missing a required value`;case le.NoPrimaryKeyProperty:return`${S(d.entity,d.entity.project)} has no primary key property`;case le.NonAbstractExtendingAbstractEntity:return`${S(d.entity,d.entity.project)} is a non-template entity extending a template entity`;case le.NonStaticExtendingStaticEntity:return`${S(d.entity,d.entity.project)} is a non-static entity extending a static entity`;case le.NonStaticImplementingStaticEntity:return`${S(d.entity,d.entity.project)} is a non-static entity implementing a static entity`;case le.StaticExtendingNonStaticEntity:return`${S(d.entity,d.entity.project)} is a static entity extending a non-static entity`;case le.StaticImplementingNonStaticEntity:return`${S(d.entity,d.entity.project)} is a static entity implementing a non-static entity`;case le.VariableReadsValueAndInternalCall:return`${S(d.entity,d.entity.project)} reads a value and has an internal call`;case le.VariableWritesValuesAndInternalCall:return`${S(d.entity,d.entity.project)} writes values and has an internal call`;case de.EmptyName:return`${ss[d.entity.type]} has no name`;case de.InvalidObjectStructure:return`${S(d.entity,d.entity.project)} has an invalid structure`;case de.LoopBodyFunctionOverwrite:return`${S(d.entity,d.entity.project)}'s loop body action overwrites`;case de.MethodOverwritesBaseMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites a base action with same implementation`;case de.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case de.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case de.MissingCaller:return`${S(d.entity,d.entity.project)} is missing a caller`;case de.NameAsResolvedCodeNameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a name that is not unique in the scope`;case de.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${S(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case de.NameMustStartWithLetterOrUnderscore:return`${S(d.entity,d.entity.project)} name must start with letter or underscore`;case de.NoOverlapWithImplementedSignature:return`${S(d.entity,d.entity.project)} has no overlap with implemented signature`;case de.PropertyOverwritesBasePropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites a base property with same implementation`;case de.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case de.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case de.ReaderWriterIncompatibleDataType:return`${S(d.entity,d.entity.project)} has a reader/writer with incompatible data type`;case Na.StatusCodeMustBeBetween100And599:return`${S(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Na.StatusCodeMustBeNumber:return`${S(d.entity,d.entity.project)} HTTP status code must be a number, between 100 and 599`;case qn.UUIDMustBeString:return`${S(d.entity,d.entity.project)} UUID must be a string, eg: "${Td()}"`;case qn.UUIDMustNotContainSpaces:return`${S(d.entity,d.entity.project)} UUID must not contain spaces, eg: "${Td()}"`;case qn.UUIDMustBeValidFormat:return`${S(d.entity,d.entity.project)} UUID must be in a valid format. Eg: "${Td()}"`;case vn.MustBeUniqueAmongSameEntities:return`${S(d.entity,d.entity.project)} value must be unique among the same kind`;case vn.StringValueMustNotHaveDashes:return`${S(d.entity,d.entity.project)} value must not contain dashes`;case vn.StringValueMustNotHaveSpaces:return`${S(d.entity,d.entity.project)} value must not contain spaces`;default:return`${S(d.entity,d.entity.project)} Error: ${ef(d.code)}`}}var zA=(d=>(d.ValuesAlreadyConnected="values-already-connected",d.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",d.CannotReadValueFromChildren="cannot-read-value-from-children",d.CannotWriteValueToChildren="cannot-write-value-to-children",d.CannotBeCalledByChildren="cannot-be-called-by-children",d.ExecutionsAlreadyConnected="executions-already-connected",d.DataTypesNotCompatible="data-types-not-compatible",d.CannotCallAncestor="cannot-call-ancestor",d.CannotConnectToItself="cannot-connect-to-itself",d.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",d.NotInScope="not-in-scope",d.IsNotValueWrittingEntity="is-not-value-writting-entity",d.IsNotValueReadingEntity="is-not-value-reading-entity",d.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",d.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",d.CallerIsInHigherScope="caller-is-in-higher-scope",d.CallerIsInLowerScope="caller-is-in-lower-scope",d.CallIsInHigherScope="call-is-in-higher-scope",d.CallIsInLowerScope="call-is-in-lower-scope",d.OtherIncompatibleScopeReason="other-incompatible-scope-reason",d.SiblingInternalCallAlreadyUsedInParentVariable="sibling-internal-call-already-used-in-parent-variable",d.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees="error-output-map-cannot-be-connected-to-parent-success-branch-callees",d.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees="success-output-map-cannot-be-connected-to-parent-error-branch-callees",d))(zA||{});const uDe=Object.values(zA);var JA=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(JA||{});const pDe=Object.values(JA);var YA=(d=>(d.Suggestion="suggestion",d.CanvasGloballyDisabled="canvas-globally-disabled",d.CannotInteractWithInputInVariableWithInternalCalls="cannot-interact-with-input-in-variable-with-internal-calls",d.CannotInteractWithOutputInVariableWithInternalCalls="cannot-interact-with-output-in-variable-with-internal-calls",d))(YA||{});const cDe=Object.values(YA);function fDe(d,u){const i=[...d,...u];return Array.from(new Set(i))}function yDe(d,u){const i=[...d,...u],a=Array.from(new Set(i));return{hasChanged:a.length!==d.length,reasons:a}}function hDe(d,u){const i=d.filter(l=>!u.includes(l));return{hasChanged:i.length!==d.length,reasons:i}}function mDe(d,u){return d.find(i=>i.entity.id===u)||null}function a9(d){return d.filter((u,i)=>d.indexOf(u)===i)}class zr{constructor(u,i,a=null,l){_(this,"ids",[]);_(this,"entity");_(this,"entityCardHeight");_(this,"entityCardWidth");_(this,"index");_(this,"childEntities",[]);_(this,"children",[]);_(this,"parents",[]);_(this,"calculationEntryPoint");_(this,"_onlyEntities",null);_(this,"_changeSet",null);if(this.index=i,this.entity=u,this.calculationEntryPoint=a||this,this===this.calculationEntryPoint&&!l)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(u,i,a){const l=i9-HA-Q7,c=r9-r0-ZA;u.metaSync({x:u.x||l,y:u.y||c},i);const e=new zr(u,0,null,i);e._onlyEntities=a||[],e.ids=["0"];const y=[];e.next(T=>{y.push(...T)}),zr.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const v=e.flattenChildEntities();return e._onlyEntities?v.filter(T=>(e._onlyEntities||[]).includes(T)):v}static recursivelyAssembleChildrenAreas(u){const i=[];u.forEach(a=>{a.next(l=>{i.push(...l)})}),i.length>0&&zr.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(u){this.calculationEntryPoint._changeSet=u}findAreaInChildrenFromEntity(u){if(this.entity===u)return this;const i=this.children.find(l=>l.entity===u);return i||this.children.reduce((l,c)=>l||c.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,a=i.find(c=>c.entity===u);return a||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=zr.resolveIds(u,this.index);this.ids.push(...i),this.parents.push(u)}}static resolveIds(u,i){return u?u.ids.map(a=>`${a}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=ia(this.entity,!0);if(this.entity.type===p.Project){const i=[],a=[],l=[];u.forEach(e=>{if(p.DefinitionEntity===e.type){a.push(e);return}else if(Bt.includes(e.type)){l.push(e);return}i.push(e)});const c=i.sort((e,y)=>{const v=!!z0(e,y).length,T=ia(e),I=ia(y);return v?0:T.length&&!I.length?-1:!T.length&&I.length?1:0}).filter(e=>!Ro(e).length);this.childEntities=[...a,...l,...c]}else{const i=[],a=[],l=[],c=[],e=[];wr.includes(this.entity.type)&&Y0(this.entity).forEach(T=>{if(Vt.includes(T.type)){l.push(T);return}const I=$i(T);i.push(I)}),er.includes(this.entity.type)&&a.push(...this.entity.detachedChildren);const y=u.filter(v=>{const T=i.includes(v);return T||l.includes(v)||a.includes(v)?!1:Vt.includes(v.type)?(l.push(v),!1):xr.includes(v.type)&&!T?(c.push(v),!1):v.type===p.DefinitionEntity?(e.push(v),!1):!0});i.sort((v,T)=>Pd(v,T)?-1:0),c.sort((v,T)=>Pd(v,T)?-1:0),l.sort((v,T)=>iR(v,T)?1:iR(T,v)?-1:0),this.childEntities=[...e,...i,...c,...y,...l,...a]}}calculateCardSize(){const u=s9(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,i){return{top:Math.min(u.top,i.top),left:Math.min(u.left,i.left),bottom:Math.max(u.bottom,i.bottom),right:Math.max(u.right,i.right)}}static getBoundriedOfCombinedAreas(u,i){const a=u.filter(c=>!i.includes(c));return a.reduce((c,e)=>i.includes(e)?c:zr.getBoundriesOfTwoAreas(c,e.fullBranchArea),a[0].fullBranchArea)}getFullAreaUntilAny(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!u.includes(e)).map(e=>e.getFullAreaUntilAny(u)).reduce((e,y)=>zr.getBoundriesOfTwoAreas(e,y),i)}getFullAreaUntilAreaOrAnyChildren(u){const i=[u,...u.flattenChildren()],a=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(u)).reduce((e,y)=>zr.getBoundriesOfTwoAreas(e,y),a)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==u).map(c=>c.getFullAreaUntil(u)).reduce((c,e)=>zr.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(l=>l.fullBranchArea).reduce((l,c)=>zr.getBoundriesOfTwoAreas(l,c),u)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const u=this.ownEntityArea;return{top:u.top,left:u.left,bottom:u.bottom+r0,right:u.right+HA}}static filterOutRepeatedAreas(u){return u.filter((i,a)=>u.indexOf(i)===a)}getEarliestId(u,i){const a=u.split("-"),l=i.split("-");return a.length<l.length?u:a.length>l.length?i:a.reduce((e,y,v)=>y<l[v]?u:i,u)}getEarliestLevel(){return this.ids.reduce((a,l)=>this.getEarliestId(a,l),this.ids[0]).split("-").length}countColumns(){let u=0;if(this!==this.calculationEntryPoint)u++;else return u;if(!this.parents.length)return u;const a=this.parents.reduce((l,c)=>c.getEarliestLevel()>l.getEarliestLevel()?c:l,this.parents[0]).countColumns();return u+=a,u}getLatestId(u,i){if(u===i)return u;const a=u.split("-"),l=i.split("-");return a.length<l.length?i:a.length>l.length?u:a.reduce((e,y,v)=>y>l[v]?u:i,u)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((a,l)=>this.getLatestId(a,l),this.ids[0]).split("-").length}smoothPosition(){const u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(a=>{a!==this.calculationEntryPoint&&a.shiftDownAlone(i)})}else if([...Bt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=u.filter(a=>!this.parents.includes(a));i.length?i.every(l=>{const c=this.countColumns(),e=l.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(u,i){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+i});let a=[...u,this];return this.children.forEach(l=>{if(zr.getEarliestParentInChain(l)!==this)return;const e=mDe(a,l.entity.id);a=zr.filterOutRepeatedAreas([...a]),e||(a=a.filter(v=>v!==l));const y=l.shiftDownUntilAny(a,i);a.push(...y)}),a}shiftRightUntilAny(u,i){u.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(a=>{const l=zr.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);zr.getEarliestParentInChain(a)===this&&a.shiftRightUntilAny(l,i)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(i=>{const l=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(l,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+Ju,v={top:y,left:e.left,bottom:y,right:e.right};return zr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Ju;this.shiftDownAlone(a)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+Ju,v={top:y,left:e.left,bottom:y,right:e.right};return zr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Ju;return this.shiftDownAlone(a),a}resolveChildrenOverlaps(){const u=this.flattenChildren();let i=[];u.forEach(a=>{const l=a.adjustVerticallyToAvoidOverlaps();i.push(...l)}),u.forEach(a=>{a.smoothPosition()})}static getEarliestParentInChain(u){let i=u.parents[0];return u.parents.length&&(i=u.parents.sort((a,l)=>{if(!a.ids.length)return-1;if(!l.ids.length)return 1;const c=a.ids.sort((y,v)=>y.length<v.length?-1:0),e=l.ids.sort((y,v)=>y.length<v.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const e=l.children.slice(0,l.children.indexOf(this)).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...e]},[])}flattenSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const e=l.children.filter(y=>y!==this).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...e]},[])}flattenChildren(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a,...a.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((a,l)=>u.has(l.entity.id)?a:(u.add(l.entity.id),[...a,l,...l.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(l=>l.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((i,a)=>{const l=a.children.indexOf(this),c=a.children.slice(l+1);return[...i,...c]},[]);return a9(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((a,l)=>[...a,...l.getLowerAreas()],[]);return a9([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const a=zr.getEarliestParentInChain(this).children[this.index-1];if(!a)return u;const l=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...l,...c,a],T=C(e.flatMap(V=>z0(this.entity,V.entity))).filter(V=>V.id!==this.entity.id).map(V=>this.findAreaFromEntity(V)).filter(V=>!!V),I=this.getFullAreaUntilAny(T),b=a.getFullAreaUntilAny(T),D=e.reduce((V,M)=>M===this||M.fullBranchArea.left!==I.left?V:Math.max(V,M.fullBranchArea.bottom),b.bottom);if(I.top<D){const V=D-I.top+r0;return this.shiftDownUntilAny(u,V)}return u}move(u,i){(this.onlyEntities||[]).includes(u)&&u.metaSync(i,this.changeSet)}addChild(u){const i=this.childEntities[u];let a=null;i.x&&i.y?a=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),a||(a=new zr(i,u,this.calculationEntryPoint));const l=this.ownEntityPlusBufferArea;this.children.includes(a)||(this.children.push(a),a.addParent(this));const c=a.fullBranchArea;if(c.left<l.right){const e=l.right-c.left;a.shiftRight(e)}return a}flattenChildEntities(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a.entity,...a.flattenChildEntities(u)]),[])}next(u){const i=[];this.childEntities.forEach((a,l)=>{const c=this.addChild(l);c&&i.push(c)}),u(i)}}var tf=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))(tf||{}),zi=(d=>(d.RelationalDatabase="relational-database",d.CompiledLocalCodebase="compiled-local-codebase",d.CloudHostedCodebase="cloud-hosted-codebase",d.HttpApi="http-api",d.HttpEndpoint="http-endpoint",d.ServerlessFunction="serverless-function",d))(zi||{}),SA=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(SA||{}),Id=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.Skipped="skipped",d.AbortedByUser="aborted-by-user",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(Id||{}),XA=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(XA||{}),bt=(d=>(d.ProjectNotFound="project-not-found",d.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",d.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",d.DeploymentCompleted="deployment-completed",d.DeploymentStarted="deployment-started",d.DeploymentFailed="deployment-failed",d.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",d.RequestPayloadValidationFailed="request-payload-validation-failed",d.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",d.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",d.ProjectAlreadyBeingPublished="project-already-being-published",d.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",d.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",d.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",d.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",d.CreatingNewRelationalDatabase="creating-new-relational-database",d.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",d.RelationalDatabaseAlreadyExists="relational-database-already-exists",d.RelationalDatabaseDeletionStarted="relational-database-deletion-started",d.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",d.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",d.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",d.HttpApiDeploymentStarted="http-api-deployment-started",d.HttpApiDeploymentCompleted="http-api-deployment-completed",d.HttpApiDeploymentFailed="http-api-deployment-failed",d.CreatingNewHttpApi="creating-new-http-api",d.HttpApiAlreadyExists="http-api-already-exists",d.HttpApiDeletionStarted="http-api-deletion-started",d.HttpApiDeletionCompleted="http-api-deletion-completed",d.HttpApiDeletionFailed="http-api-deletion-failed",d.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",d.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",d.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",d.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",d.BundlingCodebaseForDownload="bundling-codebase-for-download",d.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",d.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",d.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",d.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",d.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",d.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",d.CodeCompilationStarted="code-compilation-started",d.CodeCompilationCompleted="code-compilation-completed",d.CodeCompilationFailed="code-compilation-failed",d.BundleCodebaseStarted="bundle-codebase-started",d.BundleCodebaseCompleted="bundle-codebase-completed",d.BundleCodebaseFailed="bundle-codebase-failed",d.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",d.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",d.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",d.MigrateRelationalDatabaseStarted="migrate-relational-database-started",d.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",d.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",d.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",d.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",d.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",d.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",d))(bt||{}),Qs=(d=>(d.CodeCompilation="code-compilation",d.RelationalDatabaseDeployment="relational-database-deployment",d.RelationalDatabaseDeletion="relational-database-deletion",d.HttpApiDeployment="http-api-deployment",d.HttpApiDeletion="http-api-deletion",d.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",d.BundleCodebase="bundle-codebase",d.MigrateRelationalDatabase="migrate-relational-database",d.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",d.ExecutePublicationCompletedEvent="execute-publication-completed-event",d.CodebaseCleanup="codebase-cleanup",d))(Qs||{});zi.CloudHostedCodebase,zi.HttpApi,zi.RelationalDatabase,zi.CloudHostedCodebase,zi.CloudHostedCodebase,zi.RelationalDatabase,zi.CloudHostedCodebase,zi.CloudHostedCodebase;function l9(d){return`project-${d}-http-api`}function n0(d){return`entity-${d}-database`}class o9{constructor(u,i,a,l,c,e,y,v,T){_(this,"stepType");_(this,"id");_(this,"resourceType");_(this,"index");_(this,"dependency",[]);_(this,"lastEvent",null);_(this,"lastEventTimestamp",null);_(this,"status",Id.Queued);_(this,"publicationRun");_(this,"resource");this.stepType=u,this.id=i,this.resourceType=a,this.status=l,this.dependency=c,this.index=e,this.lastEventTimestamp=y,this.publicationRun=v,this.resource=T}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(u){var i,a;this.status=u.status,this.dependency=u.dependency,this.index=u.index,this.stepType=u.stepType,this.resourceType=u.resourceType,this.lastEvent=u.lastEvent,this.id=u.id,(a=this.resource)==null||a.setDetails((i=u.resource)==null?void 0:i.details)}}var d9=(d=>(d.Ready="ready",d.Provisioning="provisioning",d.Queued="queued",d.ProvisioningFailed="provisioning-failed",d.Deleting="deleting",d.DeletingFailed="deleting-failed",d.Deleted="deleted",d))(d9||{});class Ad{constructor(u,i,a){_(this,"provisionedBy");_(this,"publicationRun");_(this,"resourceType");_(this,"provider");_(this,"resourceId");_(this,"details",null);_(this,"name",null);_(this,"status","queued");this.publicationRun=u,this.resourceType=i,this.provider=a}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class vDe extends Ad{constructor(i,a,l){super(i,zi.HttpEndpoint,l);_(this,"resourceType",zi.HttpEndpoint);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=n0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class TDe extends Ad{constructor(i,a,l){super(i,zi.ServerlessFunction,l);_(this,"resourceType",zi.ServerlessFunction);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=n0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class u9 extends Ad{constructor(i,a,l){super(i,zi.HttpApi,l);_(this,"resourceType",zi.HttpApi);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=l9(this.publicationRun.project.id),this.resourceId}}class p9 extends Ad{constructor(i,a,l){super(i,zi.RelationalDatabase,l);_(this,"resourceType",zi.RelationalDatabase);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=n0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class c9 extends Ad{constructor(i,a){super(i,zi.CloudHostedCodebase,a);_(this,"resourceType",zi.CloudHostedCodebase);_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class f9 extends Ad{constructor(i,a){super(i,zi.CompiledLocalCodebase,a);_(this,"resourceType",zi.CompiledLocalCodebase);_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class EDe{constructor(u,i){_(this,"id");_(this,"projectAutoIncrementPublicationCount");_(this,"projectPublishedSemanticVersion");_(this,"projectVersion");_(this,"projectId");_(this,"triggeredBy");_(this,"createdAt");_(this,"updatedAt");_(this,"status");_(this,"steps",[]);_(this,"editor");_(this,"explicitResources",new Map);_(this,"implicitGlobalResources",new Map);_(this,"finalGlobalEvent",null);_(this,"finalStatus",null);_(this,"contextType",De.PublicationRun);_(this,"extensionsRegistry");this.id=u.id,this.projectAutoIncrementPublicationCount=u.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=u.projectPublishedSemanticVersion,this.projectVersion=u.projectVersion,this.projectId=u.projectId,this.triggeredBy=u.triggeredBy,this.createdAt=u.createdAt,this.updatedAt=u.updatedAt,this.status=u.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(u){return this.steps.filter(i=>u.includes(i.resourceType))}getStepsTypes(u){return this.steps.filter(i=>u.includes(i.stepType))}toIds(u){return u.map(i=>i.id)}getResourceForEntity(u){const i=Array.from(this.explicitResources.values()).find(a=>a.owners.has(u.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(zi.CompiledLocalCodebase,new f9(this,tf.Amazon)),this.implicitGlobalResources.set(zi.CloudHostedCodebase,new c9(this,tf.Amazon));const u=this.project.entities.filter(a=>ki(a,ce.HTTP_ENDPOINT)),i=this.project.entities.filter(a=>ki(a,ce.RELATIONAL_DATABASE));if(i.length&&i.forEach(a=>{const l=new p9(this,[a],tf.Amazon);this.explicitResources.set(l.resourceId,l)}),u.length){const a=new u9(this,u,tf.Amazon);this.explicitResources.set(a.resourceId,a)}}setSteps(u,i){u.forEach(a=>{this.addStep(a,i)}),this.editor.events.emit(bt.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const a=u.dependency||[];if(a.length){const c=a.filter(e=>!this.steps.find(y=>y.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!u.resource)throw new Error(`Resource not found for step ${u.stepType} (${u.id})`);if(!this.steps.find(c=>c.id===u.id)){const c=this.implicitGlobalResources.get(u.resourceType)||this.explicitResources.get(u.resource.resourceId),e=new o9(u.stepType,u.id,u.resourceType,u.status,a,u.index,i,this,c);this.steps.push(e)}}onUpdate(u){var i;if(Y.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const a=this.steps.find(l=>{var c;return l.id===((c=u.payload)==null?void 0:c.id)});a&&B(u.emittedAt).isAfter(B(a.lastEventTimestamp))&&a.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===SA.Error?(this.finalStatus=XA.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===SA.Complete&&(this.finalStatus=XA.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}requestExtension(u){return this.extensionsRegistry.requestExtension(u)}async initRegistry(){return this.extensionsRegistry=new jA(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(De.PublicationRun),this.extensionsRegistry}}function bDe(d){switch(d){case Qs.CodeCompilation:return"Code generation";case Qs.RelationalDatabaseDeployment:return"Database creation";case Qs.HttpApiDeployment:return"HTTP gateway creation";case Qs.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Qs.BundleCodebase:return"Bundle code";case Qs.MigrateRelationalDatabase:return"Database structure migration";case Qs.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Qs.CodebaseCleanup:return"Code cleanup";case Qs.HttpApiDeletion:return"HTTP gateway deletion";case Qs.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function IDe(d){switch(d){case bt.DeploymentCompleted:return"Successfully published";case bt.DeploymentStarted:return"Publication started";case bt.DeploymentFailed:return"Publication failed";case bt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case bt.RequestPayloadValidationFailed:return"Request payload validation failed";case bt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case bt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case bt.RelationalDatabaseDeploymentStarted:return"Database creation started";case bt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case bt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case bt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case bt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case bt.RelationalDatabaseAlreadyExists:return"Database already exists";case bt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case bt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case bt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case bt.CreatingNewHttpApi:return"Creating new HTTP gateway";case bt.HttpApiAlreadyExists:return"HTTP gateway already exists";case bt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case bt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case bt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case bt.BundlingCodebaseForDownload:return"Bundling code for download";case bt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case bt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case bt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case bt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case bt.CodeCompilationStarted:return"Code generation started";case bt.CodeCompilationCompleted:return"Code generation completed";case bt.CodeCompilationFailed:return"Code generation failed";case bt.BundleCodebaseStarted:return"Code bundling started";case bt.BundleCodebaseCompleted:return"Code bundling completed";case bt.BundleCodebaseFailed:return"Code bundling failed";case bt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case bt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case bt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case bt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case bt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case bt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case bt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case bt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case bt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case bt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case bt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case bt.ProjectNotFound:return"Project not found";case bt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case bt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case bt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case bt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case bt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case bt.RelationalDatabaseDeletionStarted:return"Database deletion started";case bt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case bt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case bt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var y9=(d=>(d.NO_LOGIC="NO_LOGIC",d.NO_NAME="NO_NAME",d.NO_CHANGES="NO_CHANGES",d.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",d))(y9||{});function ADe(d){switch(d){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function wDe(d){switch(d){case zi.RelationalDatabase:return"Relational database";case zi.HttpEndpoint:case zi.HttpApi:return"HTTP endpoints";case zi.ServerlessFunction:case zi.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function RDe(d){switch(d){case Id.Running:return"In progress";case Id.Failed:return"Failed";case Id.Success:return"Succeeded";case Id.Skipped:return"Skipped";case Id.Queued:default:return"Queued"}}function h9(d){var a;if(!ki(d,ce.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=fe["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(d.type===p.BuiltInBaseEntity?ki(d,ce.EXTERNAL_INTEGRATION_CONNECTION)&&(u=QA(d.name)):d.type===p.DefinitionEntity&&d.implements.forEach(l=>{if(ki(l,ce.EXTERNAL_INTEGRATION_CONNECTION)){const c=QA(l==null?void 0:l.name);if(c)return u=c,!0}}),!u){const l=d.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var y;return((y=e.extends)==null?void 0:y.id)===i}));u=(a=l==null?void 0:l.getDefaultValue())==null?void 0:a.value}return u}function CDe(d){return mP[d]}function QA(d){return d.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?d.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function m9(d){if(d.type!==p.ActionDescriptor&&d.type!==p.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(d.type===p.ActionDescriptor){const u=d;if(u.id.startsWith("external-integration--"))return u.id.split("--")[1]}if(d.type===p.Operation){const u=d.declaration;if(Object.values(Gt).includes(u.id))return u.id.split("--")[1]||null}return null}function gDe(d){if(!d)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(ce).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===d.toLowerCase()))||null}function _De(d){return d.type===p.BuiltInBaseEntity||d.type===p.DefinitionEntity?h9(d):d.type===p.ActionDescriptor||d.type===p.Operation?m9(d):null}function v9(d){var l,c,e;if(!ki(d,ce.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=Az(d,ce.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const a=fe["built-in-base-entity"][i.id].properties.connectionId.id;if(d.type===p.BuiltInBaseEntity){if(ki(d,ce.EXTERNAL_INTEGRATION_CONNECTION)){const y=d.properties.find(v=>{var T;return((T=v.extends)==null?void 0:T.id)===a});y&&(u=(l=y.getDefaultValue())==null?void 0:l.value)}}else if(d.type===p.DefinitionEntity){const y=d.properties.find(v=>!!v.implements.find(T=>T.id===a)||!!v.implements.find(T=>{var I;return((I=T.extends)==null?void 0:I.id)===a}));if(!y&&((c=d.extends)==null?void 0:c.type)===p.DefinitionEntity)return v9(d.extends);u=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return u}function T9(d){var l;(l=d.dataType)==null||l.validate(),d.inputs.forEach(c=>c.validate()),d.outputs.forEach(c=>c.validate()),d.internalCalls.forEach(c=>c.validate());const i=[...Tl(d),...Od(d),...E9(d),...El(d),...b9(d)],a=Kw(d);return i.push(...a),ji(d.errors,i)}function E9(d,u){const a=[...d.project.getVariableDeclarations()].filter(l=>l.id!==d.id);return fy(d,[Mi],a,u)}function b9(d){const u=[];if(d.parent!==d.project)return u;if(d.catchesError){const i=Dt({id:`${d.id}--${de.GlobalVariableDeclarationCannotCatchError}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:te.Error,code:de.GlobalVariableDeclarationCannotCatchError,entity:d});u.push(i.error)}if(d.errorCalls.length){const i=Dt({id:`${d.id}--${de.GlobalVariableDeclarationCannotCallOnError}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:te.Error,code:de.GlobalVariableDeclarationCannotCallOnError,entity:d});u.push(i.error)}if(d.calledBy.length){const i=Dt({id:`${d.id}--${de.GlobalVariableDeclarationCannotBeCalled}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:te.Error,code:de.GlobalVariableDeclarationCannotBeCalled,entity:d});u.push(i.error)}return[]}const DDe=Object.freeze(Object.defineProperty({__proto__:null,validate:T9,validateGlobalVariableDeclaration:b9,validateVariableDeclarationName:E9},Symbol.toStringTag,{value:"Module"}));function I9(d){d.inputs.forEach(l=>l.validate()),d.outputs.forEach(l=>l.validate()),d.internalCalls.forEach(l=>l.validate());const i=[...Tl(d),...Od(d),...El(d)],a=Kw(d);return i.push(...a),ji(d.errors,i)}const ODe=Object.freeze(Object.defineProperty({__proto__:null,validate:I9},Symbol.toStringTag,{value:"Module"}));var ew=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(ew||{});const Qt=class Qt extends cr{constructor(i,a){super(i);_(this,"initialData");_(this,"id");_(this,"x");_(this,"y");_(this,"type",p.VariableInstance);_(this,"catchesError",!1);_(this,"defaultValue",null);_(this,"writesValues",[]);_(this,"readsValue",null);_(this,"declaration");_(this,"inputs",[]);_(this,"outputs",[]);_(this,"error",null);_(this,"calledBySuccess",[]);_(this,"calledByError",[]);_(this,"calledByEntry",[]);_(this,"successCalls",[]);_(this,"errorCalls",[]);_(this,"internalCalls",[]);_(this,"project");_(this,"errors",[]);_(this,"parent");_(this,"detachedDependents",{});_(this,"knownVersions",null);_(this,"activeVersion",!1);_(this,"initialized",!1);_(this,"startedInitialization",!1);_(this,"suggestion",!1);_(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:L.UUID.uuid(),version:L.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableInstance,catchesError:!0,declaration:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,a){let l=a;if(i.parent){const V=ie(i.parent);l=a.get(V)}const c=ie(i.declaration),e=a.get(c),y=i.calledByEntry.map(V=>{const M=ie(V);return a.get(M)}),v=i.calledBySuccess.map(V=>{const M=ie(V);return a.get(M)}),T=i.calledByError.map(V=>{const M=ie(V);return a.get(M)});let I=null;if(i.readsValue){const V=ie(i.readsValue);I=a.get(V)}const b={id:i.id,version:L.UUID.uuid(),createdAt:B().toISOString(),author:L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableInstance,catchesError:i.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:v,calledByError:T,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:I,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},D=se(b,a);return D.setParent(l,null),D}static validateGenerationTarget(i,a){let l=JSON.parse(JSON.stringify(i));const c=[],e=Gr(l,{parent:{list:!1,types:[...er,p.Project],optional:!0},declaration:{list:!1,types:[p.VariableDeclaration]}},a);return l=e.modifiedData,c.push(...e.errors,...nr(l)),{errors:c,modifiedData:l}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const a=[];let l=JSON.parse(JSON.stringify(i));const c=Dd(l,this);return l=c.modifiedData,a.push(...c.errors),i.parent&&a.push(new pe({id:`${this.id}--${z.InvalidParentUpdate}`,code:z.InvalidParentUpdate,severity:te.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
|
72
|
+
`+c):a.stack=c}catch{}}throw a}}_request(u,i){typeof u=="string"?(i=i||{},i.url=u):i=u||{},i=bd(this.defaults,i);const{transitional:a,paramsSerializer:l,headers:c}=i;a!==void 0&&Jm.assertOptions(a,{silentJSONParsing:Ra.transitional(Ra.boolean),forcedJSONParsing:Ra.transitional(Ra.boolean),clarifyTimeoutError:Ra.transitional(Ra.boolean)},!1),l!=null&&(ge.isFunction(l)?i.paramsSerializer={serialize:l}:Jm.assertOptions(l,{encode:Ra.function,serialize:Ra.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Jm.assertOptions(i,{baseUrl:Ra.spelling("baseURL"),withXsrfToken:Ra.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&ge.merge(c.common,c[i.method]);c&&ge.forEach(["delete","get","head","post","put","patch","common"],M=>{delete c[M]}),i.headers=Xs.concat(e,c);const y=[];let v=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(i)===!1||(v=v&&x.synchronous,y.unshift(x.fulfilled,x.rejected))});const T=[];this.interceptors.response.forEach(function(x){T.push(x.fulfilled,x.rejected)});let I,b=0,D;if(!v){const M=[Wq.bind(this),void 0];for(M.unshift.apply(M,y),M.push.apply(M,T),D=M.length,I=Promise.resolve(i);b<D;)I=I.then(M[b++],M[b++]);return I}D=y.length;let V=i;for(b=0;b<D;){const M=y[b++],x=y[b++];try{V=M(V)}catch(G){x.call(this,G);break}}try{I=Wq.call(this,V)}catch(M){return Promise.reject(M)}for(b=0,D=T.length;b<D;)I=I.then(T[b++],T[b++]);return I}getUri(u){u=bd(this.defaults,u);const i=xq(u.baseURL,u.url,u.allowAbsoluteUrls);return Dq(i,u.params,u.paramsSerializer)}}ge.forEach(["delete","get","head","options"],function(u){Ym.prototype[u]=function(i,a){return this.request(bd(a||{},{method:u,url:i,data:(a||{}).data}))}}),ge.forEach(["post","put","patch"],function(u){function i(a){return function(c,e,y){return this.request(bd(y||{},{method:u,headers:a?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}Ym.prototype[u]=i(),Ym.prototype[u+"Form"]=i(!0)});const Sm=Ym;class BA{constructor(u){if(typeof u!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const a=this;this.promise.then(l=>{if(!a._listeners)return;let c=a._listeners.length;for(;c-- >0;)a._listeners[c](l);a._listeners=null}),this.promise.then=l=>{let c;const e=new Promise(y=>{a.subscribe(y),c=y}).then(l);return e.cancel=function(){a.unsubscribe(c)},e},u(function(c,e,y){a.reason||(a.reason=new zu(c,e,y),i(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(u){if(this.reason){u(this.reason);return}this._listeners?this._listeners.push(u):this._listeners=[u]}unsubscribe(u){if(!this._listeners)return;const i=this._listeners.indexOf(u);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const u=new AbortController,i=a=>{u.abort(a)};return this.subscribe(i),u.signal.unsubscribe=()=>this.unsubscribe(i),u.signal}static source(){let u;return{token:new BA(function(l){u=l}),cancel:u}}}const H_e=BA;function z_e(d){return function(i){return d.apply(null,i)}}function J_e(d){return ge.isObject(d)&&d.isAxiosError===!0}const MA={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(MA).forEach(([d,u])=>{MA[u]=d});const Y_e=MA;function Jq(d){const u=new Sm(d),i=fq(Sm.prototype.request,u);return ge.extend(i,Sm.prototype,u,{allOwnKeys:!0}),ge.extend(i,u,null,{allOwnKeys:!0}),i.create=function(l){return Jq(bd(d,l))},i}const Ur=Jq(OA);Ur.Axios=Sm,Ur.CanceledError=zu,Ur.CancelToken=H_e,Ur.isCancel=Vq,Ur.VERSION=Hq,Ur.toFormData=Fm,Ur.AxiosError=Kt,Ur.Cancel=Ur.CanceledError,Ur.all=function(u){return Promise.all(u)},Ur.spread=z_e,Ur.isAxiosError=J_e,Ur.mergeConfig=bd,Ur.AxiosHeaders=Xs,Ur.formToJSON=d=>$q(ge.isHTMLForm(d)?new FormData(d):d),Ur.getAdapter=Zq.getAdapter,Ur.HttpStatusCode=Y_e,Ur.default=Ur;const S_e=Ur;class Yq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Addition);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y+v,0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Sq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Subtraction);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y-v,0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Xq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Multiplication);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const e=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)}).reduce((y,v)=>y*v,1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Qq extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Division);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=c/e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class e7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Remainder);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l;if(e===0)throw new Error("Division by zero is not allowed");const y=c%e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class t7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ni.Exponentiation);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),[c,e]=l,y=Math.pow(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class i7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomInteger);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=Ige(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class r7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomFloat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=oq();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class n7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomHexadecimal);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=dq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class s7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomBase62);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=uq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class a7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=wge(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class l7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomAlphanumeric);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0],e=pq(c);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class o7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateIdentifier);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=cq(c,e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class d7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateRandomUUIDv4);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=Td();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class u7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{Y.log("Initializing Random Generate Short Identifier Module");const a=i.find(l=>l.contextType===De.Logic);if(a){Y.log("Project state found, setting up operation");const l=a.get(Ze.GenerateShortIdentifier);l?(Y.log("Operation found, setting autoexecutable and implementation"),l.autoexecutable=!0,l.implementation=this.module.main):Y.warn("Operation generate-short-identifier not found in project state")}else Y.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,a)=>{try{const l=Rge();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class p7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ze.GenerateHexadecimalToken);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=Cge();return{value:X.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class c7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],y=l.slice(1).join(c);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class f7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT,version:"1.0.0",description:"String split operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1],y=c.split(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class y7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST,version:"1.0.0",description:"String delete last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.slice(0,-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class h7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST,version:"1.0.0",description:"String delete first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.slice(1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class m7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.split("").reverse().join("");return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class v7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ToLowerCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.toLowerCase();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class T7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ToUpperCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.toUpperCase();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class E7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.DeleteIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const y=c.slice(0,e)+c.slice(e+1);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class b7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=c.slice(0,e)+y+c.slice(e);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class I7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST,version:"1.0.0",description:"String replace first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.replace(e,y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class A7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST,version:"1.0.0",description:"String replace last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.lastIndexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=c.slice(0,v)+c.slice(v).replace(e,y);return{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class w7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=c.slice(0,e)+y+c.slice(e+1);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class R7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_SINGLE_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ReplaceSingleMatch);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.replace(e,y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class C7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.ReplaceAllMatches);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const v=c.split(e).join(y);return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class g7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c.charAt(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class _7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST,version:"1.0.0",description:"String get first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.charAt(0);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class D7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST,version:"1.0.0",description:"String get last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const e=c.charAt(c.length-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class O7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.GetIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c.indexOf(e);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class P7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=c+e;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class $7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Je.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No string provided or string is empty",result:null};const y=e+c;return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class N7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)});if(!l||l.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No input lists provided",result:null};if(!l.every(v=>Array.isArray(v)))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"All inputs must be arrays",result:null};const c=l[0],y=l.slice(1).reduce((v,T)=>Array.isArray(T)?v.concat(T):v,c);return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class V7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=c.slice(0,e),v=c.slice(e);return{value:X.Success,error:null,result:[y,v]}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class L7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice().reverse();return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class B7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST,version:"1.0.0",description:"List delete last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.DeleteLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice(0,-1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class M7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST,version:"1.0.0",description:"List delete first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.DeleteFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c.slice(1);return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class x7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.AddIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=[...c.slice(0,e),y,...c.slice(e)];return{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class U7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.ReplaceIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(T=>{var I,b;return((I=T.value)==null?void 0:I.valueAsType)||((b=T.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const v=[...c];return v[e]=y,{value:X.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class j7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST,version:"1.0.0",description:"List replace first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.ReplaceFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const v=c.indexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=[...c];return T[v]=y,{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class G7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST,version:"1.0.0",description:"List replace last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.ReplaceLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(I=>{var b,D;return((b=I.value)==null?void 0:b.valueAsType)||((D=I.value)==null?void 0:D.value)}),c=l[0],e=l[1],y=l[2];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const v=c.lastIndexOf(e);if(v===-1)return{value:X.Success,error:null,result:c};const T=[...c];return T[v]=y,{value:X.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class k7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};if(e<0||e>=c.length)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Index out of bounds",result:null};const y=c[e];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class F7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c[0];return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class K7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const e=c[c.length-1];return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class q7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=[...c,e];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Z7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(dt.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[0],e=l[1];if(!c||c.length===0)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list provided or list is empty",result:null};const y=[e,...c];return{value:X.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class W7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ei.Parallel);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(b=>{var D,V;return((D=b.value)==null?void 0:D.valueAsType)||((V=b.value)==null?void 0:V.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const y=this.extensionsRegistry.requestContexts(this,[De.Editor])[0],T=c.map(b=>{const D=new oo(y.logic,[b],b,null,this.extensionsRegistry);return D.inheritValuesFromContext(y),D}).map(b=>b.execute()),I=await Promise.all(T);return{value:X.Success,error:null,result:I}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class H7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ei.Sequential);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const e=[];for(let y=0;y<c.length;y++){const v=c[y],I=this.extensionsRegistry.requestContexts(this,[De.Editor])[0],b=new oo(I.logic,[v],v,null,this.extensionsRegistry);b.inheritValuesFromContext(I);const D=await b.execute();e.push(D)}return{value:X.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class z7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(Ei.Wait);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const c=a.map(e=>{var y,v;return((y=e.value)==null?void 0:y.valueAsType)||((v=e.value)==null?void 0:v.value)})[0];return typeof c!="number"||c<0?{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,c)),{value:X.Success,error:null,result:null})}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class J7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(mr.Validate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(y=>{var v,T;return((v=y.value)==null?void 0:v.valueAsType)||((T=y.value)==null?void 0:T.value)});Y.log("Inputs for entity validation: ",l);const e=Yb(l[1]).safeParse(l[0]);return e.success?{value:X.Success,error:null,result:{data:l[0]}}:{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:e.error.errors,result:null}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class Y7 extends pt{constructor(){super(...arguments);_(this,"manifest",{id:ot.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:it.High,permissions:[lt.All],contexts:[De.Logic]});_(this,"module",{init:i=>{const a=i.find(l=>l.contextType===De.Logic);if(a){const l=a.get(fn.HttpRequest);l&&(l.implementation=this.module.main)}},main:async(i,a)=>{try{const l=a.map(v=>{var T,I;return((T=v.value)==null?void 0:T.valueAsType)||((I=v.value)==null?void 0:I.value)}),c=l[3]||{},e={method:l[0],url:l[1],params:l[2],headers:c,data:l[4]};Y.log("Axios request config: ",e);const y=await S_e(e);return{value:X.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(l){return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,error:l,result:null}}}})}}class xA extends Mm{constructor(u,i,a=i.projectId){super(u,De.Editor),this._editor=i,this.id=a}get ready(){return this._editor.ready}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branch(){return this._editor.branch}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(u){this._editor.undoableStackValueIndex=u}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}removeValueByOwnerId(u){return this._editor.removeValueByOwnerId(u)}removeValue(u){return this._editor.removeValue(u)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(u,i){return this._editor.initTest(u,i)}removeTest(){return this._editor.removeTest()}async copyEntities(u){return this._editor.copyEntities(u)}resolveInitialChildrenPositions(u,i,a){return this._editor.resolveInitialChildrenPositions(u,i,a)}publish(){return this._editor.publish()}loadActivePublication(u){return this._editor.loadActivePublication(u)}requestActiveDynamicValue(u,i=!1){return this._editor.requestActiveDynamicValue(u,i)}}function X_e(d,u){return u instanceof xA?u:new xA(d,u)}class UA extends Mm{constructor(u,i){super(u,De.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get projectVersion(){return this._publicationRun.projectVersion}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function Q_e(d,u){return u instanceof UA?u:new UA(d,u)}function eDe(d){d.register(new lq(d)),d.register(new aq(d)),d.register(new iq(d)),d.register(new nq(d)),d.register(new sq(d)),d.register(new rq(d)),d.register(new Yq(d)),d.register(new Sq(d)),d.register(new Xq(d)),d.register(new e7(d)),d.register(new Qq(d)),d.register(new t7(d)),d.register(new i7(d)),d.register(new r7(d)),d.register(new n7(d)),d.register(new s7(d)),d.register(new a7(d)),d.register(new l7(d)),d.register(new o7(d)),d.register(new d7(d)),d.register(new u7(d)),d.register(new p7(d)),d.register(new c7(d)),d.register(new f7(d)),d.register(new y7(d)),d.register(new h7(d)),d.register(new m7(d)),d.register(new v7(d)),d.register(new T7(d)),d.register(new E7(d)),d.register(new b7(d)),d.register(new I7(d)),d.register(new A7(d)),d.register(new w7(d)),d.register(new R7(d)),d.register(new C7(d)),d.register(new g7(d)),d.register(new _7(d)),d.register(new D7(d)),d.register(new O7(d)),d.register(new P7(d)),d.register(new $7(d)),d.register(new N7(d)),d.register(new V7(d)),d.register(new L7(d)),d.register(new B7(d)),d.register(new M7(d)),d.register(new x7(d)),d.register(new U7(d)),d.register(new j7(d)),d.register(new G7(d)),d.register(new k7(d)),d.register(new F7(d)),d.register(new K7(d)),d.register(new q7(d)),d.register(new Z7(d)),d.register(new W7(d)),d.register(new H7(d)),d.register(new z7(d)),d.register(new J7(d)),d.register(new Y7(d))}class jA{constructor(u=new Gu){_(this,"extensionsRegistry",new Map);_(this,"initialized",new Set);_(this,"initializedContexts",new Set);_(this,"onResolveEditorContextCallback",()=>null);_(this,"onResolveProjectLogicContextCallback",()=>null);_(this,"onResolveEditorGUIContextCallback",()=>null);_(this,"onResolveGUIContextCallback",()=>null);_(this,"onResolveCompileContextCallback",()=>null);_(this,"onResolvePublicationRunContextCallback",()=>null);this.events=u,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(u){this.onResolveEditorContextCallback=u}onResolveProjectLogicContext(u){this.onResolveProjectLogicContextCallback=u}onResolveGUIContext(u){this.onResolveGUIContextCallback=u}onResolveEditorGUIContext(u){this.onResolveEditorGUIContextCallback=u}onResolveCompileContext(u){this.onResolveCompileContextCallback=u}onResolvePublicationRunContext(u){this.onResolvePublicationRunContextCallback=u}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((u,i)=>(u.manifest.initPriority||it.Normal)-(i.manifest.initPriority||it.Normal))}async setup(){eDe(this),Y.log("Initializing extensions without context..."),this.initForReady()}requestContext(u){switch(u){case De.Editor:return this.onResolveEditorContextCallback();case De.Logic:return this.onResolveProjectLogicContextCallback();case De.EditorGUI:return this.onResolveEditorGUIContextCallback();case De.Compile:return this.onResolveCompileContextCallback();case De.PublicationRun:return this.onResolvePublicationRunContextCallback();case De.GUI:return this.onResolveGUIContextCallback();case De.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${u}`)}}requestContexts(u,i=[]){const a=[];i.length===0&&(i=u.manifest.contexts);for(const l of i){const c=this.requestContext(l);c&&a.push(c)}return a}requestExtension(u){const i=this.extensionsRegistry.get(u);if(i)return i;throw new Error(`Unknown extension: ${u}`)}register(u){this.extensionsRegistry.set(u.manifest.id,u)}async initAll(){var u,i;for(const a of this.extensionInOrder)if(a.module.init&&!this.initialized.has(a.manifest.id)){const l=a.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);l.length&&(await((i=(u=a.module).init)==null?void 0:i.call(u,l)),this.initialized.add(a.manifest.id))}else!a.module.init&&!this.initialized.has(a.manifest.id)&&this.initialized.add(a.manifest.id)}async initForReady(){Y.log("Initializing extensions for ready contexts...");for(const u of this.extensionInOrder)if(u.module.init&&!this.initialized.has(u.manifest.id)){Y.log("Initializing "+u.manifest.id+" extension...");const i=this.requestContexts(u);u.manifest.contexts.every(l=>!!i.find(c=>c.contextType===l))?(await u.module.init(i),this.initialized.add(u.manifest.id)):Y.warn(`Skipping initialization of ${u.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${u.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(l=>l.contextType).join(", ")}`)}else!u.module.init&&!this.initialized.has(u.manifest.id)?(Y.log("Set "+u.manifest.id+" extension as initialized by default..."),this.initialized.add(u.manifest.id)):Y.log(`Skipping initialization of ${u.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const u of[...this.extensionInOrder].reverse())u.module.destroy&&await u.module.destroy();this.events.destroy()}on(u,i){this.events.on(u,i)}emit(u,...i){this.events.emit(u,...i)}off(u,i){this.events.off(u,i)}emitAsync(u,...i){return this.events.emitAsync(u,...i)}emitAsyncAll(u,...i){return this.events.emitAsyncAll(u,...i)}emitAsyncAllSettled(u,...i){return this.events.emitAsyncAllSettled(u,...i)}emitAsyncSequentially(u,...i){return this.events.emitAsyncSequentially(u,...i)}emitAsyncSequentiallyAll(u,...i){return this.events.emitAsyncSequentiallyAll(u,...i)}emitAsyncSequentiallyAllSettled(u,...i){return this.events.emitAsyncSequentiallyAllSettled(u,...i)}async contextAvailable(u){if(this.initializedContexts.has(u)){Y.warn(`Context ${u} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(u),u){case De.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case De.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}Y.log(`Context ${u} is now available. Initializing extensions for this context...`),await this.initForReady()}}let Xm=null;const GA={requestExtension:d=>(Xm||(Xm=new jA,Xm.setup()),Xm.requestExtension(d))},lo={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var kA=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(kA||{});const S7={...GA};class oo extends Gu{constructor(i,a,l,c=null,e=S7){super();_(this,"project");_(this,"entryPoint");_(this,"state","not-started");_(this,"events",new Gu);_(this,"entities",[]);_(this,"parentExecution",null);_(this,"executing",[]);_(this,"executed",[]);_(this,"skipped",[]);_(this,"scheduled",[]);_(this,"localTestValues");_(this,"resolvedValues");_(this,"persistedExecutionResults");_(this,"lastExecutionResults");_(this,"onAddToSkippedListCallback",null);_(this,"onRemoveFromSkippedListCallback",null);_(this,"onAddEntityCallback",null);_(this,"onRemoveEntityCallback",null);_(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=a,this.entryPoint=l,this.project=i,this.parentExecution=c,this.localTestValues=new qc(L.UUID.uuid(),this.project),this.resolvedValues=new qc(L.UUID.uuid(),this.project),this.persistedExecutionResults=new qc(L.UUID.uuid(),this.project),this.lastExecutionResults=new qc(L.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),wr.includes(i.type)&&ct(i).forEach(a=>this.skip(a))))}async schedule(i,a,l){if(this.hasExecuted(i))return null;if(Bt.includes(i.type))return this.executeBranch(i,l,a);if(xr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,l,a);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,a){const l=[];return[...Ft,...Bt].includes(a.type)?l.push(...a.inputs):_t.includes(a.type)&&l.push(...a.outputs),l.map(e=>{var v;let y=i.find(T=>T.valueOwner.id===e.id);if(y)return y;if(!y&&Bt.includes(a.type)&&(y=i.find(T=>{var I;return((I=T.valueOwner.declaration)==null?void 0:I.id)===e.id})),y){const T=(v=y.value)==null?void 0:v.clone(null);return T==null||T.setStandaloneParent(e),{...y,valueOwner:e,value:T||null,inheritanceLink:{sources:[y],target:e}}}return Xn.includes(e.type)?wa(e,this.valueResolutionContext):ao(e,this.valueResolutionContext)}).reduce((e,y)=>{const v=Ys(y==null?void 0:y.valueOwner,this.project),T=y?[y]:[];return v.forEach(I=>{var V,M,x;if(I.id===(y==null?void 0:y.valueOwner.id))return;const b=nt(I.getDataType(null),I,this.project);b==null||b.metaSync({value:(V=y==null?void 0:y.value)==null?void 0:V.value},null),b==null||b.setValueAsTypeList(((M=y==null?void 0:y.value)==null?void 0:M.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((x=y==null?void 0:y.value)==null?void 0:x.valueAsTypeSingle)||null);const D={...y,valueOwner:I,value:b};T.push(D)}),[...e,...T]},[]).sort((e,y)=>e.valueOwner.index-y.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,a,l,c={}){var y,v;const e={...lo,...c};try{let T={value:X.Success,error:null,result:null};if(a.sort((I,b)=>I.valueOwner.index-b.valueOwner.index),Object.values(ur).includes(i.declaration.id)){const I=this.parentContext.requestExtension(Zu+i.declaration.id).module.main;I?T=await I(i,a):Y.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let I=null;if(T.error){Y.warn("Raw error executing entity: ",T.error);const b=(y=i.error)==null?void 0:y.getDataType(null),D=nt(b||null,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T.error):D==null||D.metaSync({value:T.error},null),I={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:D}}return{value:T.value,entity:i,error:I,result:{value:T.result||null,valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null}}}return{...T,entity:i}}catch(T){Y.warn("Internal call execution error: ",T);let I=null;if(i.error){const b=(v=i.error)==null?void 0:v.getDataType(null),D=nt(b,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T):D==null||D.metaSync({value:T},null),I={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:D}}return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:I,result:null}}}static async executeOperation(i,a,l){var c,e;try{let y={value:X.Success,error:null,result:null};a.sort((b,D)=>b.valueOwner.index-D.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,a));let v=null;if(y.error&&i.error){Y.warn("Raw error executing entity: ",y.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,D=nt(b,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(y.error):D==null||D.metaSync({value:y.error},null),v={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:D}}const T=i==null?void 0:i.getDataType(null),I=nt(T,i,l);return T!=null&&T.asType?I==null||I.setValueAsTypeSingle(y.result):I==null||I.metaSync({value:y.result},null),{value:y.value,entity:i,error:v,result:{value:I||null,valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null}}}catch(y){Y.warn("Operation execution error: ",y);let v=null;if(i.error){const T=(e=i.error)==null?void 0:e.getDataType(null),I=nt(T,i.error,l);T!=null&&T.asType?I==null||I.setValueAsTypeSingle(y):I==null||I.metaSync({value:y},null),v={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:I}}return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:v,result:null}}}async executeSearch(i,a,l){var c;try{let e={value:X.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(ot.SEARCH_NODE_IMPLEMENTATION)).module.main(i,a),v=i==null?void 0:i.getDataType(null),T=nt(v,i,l);return T==null||T.metaSync({value:{data:y.data}},null),y.error?{value:X.UnhandledError,entity:i,error:{valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null,value:T},result:null}:{value:e.value,entity:i,error:null,result:{value:T,valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null}}}catch(e){if(Y.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null};const y=(c=i.error)==null?void 0:c.getDataType(null),v=nt(y,i.error,l);return v==null||v.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:v},result:null}}}async executeLoop(i,a,l,c={}){var y,v,T,I,b,D;const e={...lo,...c};try{let V={value:X.Success,error:null,result:null};const M=a.map(ee=>{var H,oe;return((H=ee==null?void 0:ee.value)==null?void 0:H.valueAsType)||((oe=ee==null?void 0:ee.value)==null?void 0:oe.value)});let x={};i.getUniqueInputMaps().forEach(ee=>{const H=i.body.inputs.find(he=>S(he,l)===S(ee,l)),oe=ee==null?void 0:ee.getDataType(null),ae=nt(oe,H,l);oe!=null&&oe.asType?ae==null||ae.setValueAsTypeList([]):ae==null||ae.metaSync({value:[]},null),this.lastExecutionResults.writeValue(H,ae);const ye={value:ae,valueOwner:H,type:Re.ExecutionResult,inheritanceLink:null};x[H.id]=ye});let W={value:X.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case fe.loop["counted-loop"].id:{const ee=M[0];let H=1;for(;H<=ee&&H<=50;){const oe=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const ye=i.currentIterationNumberArgumentDeclaration.getDataType(null),he=Cd(ye),Q=this.lastExecutionResults.readValue(ae.id);if(Q){Q.metaSync({value:H},null),this.lastExecutionResults.writeValue(ae,Q);const $e={value:Q,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null};return x[ae.id]=$e,$e}const ue={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:H,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:he,standaloneParent:ae.toReference()},Te=gi(ue,l);this.lastExecutionResults.writeValue(ae,Te);const _e={value:Te,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null};return x[ae.id]=_e,_e}else return x[ae.id]}).filter(ae=>!!ae);if(W=await this.executeFullFunctionDeclarationLogic(i.body,oe,e),(W.results||[]).forEach(ae=>{var ue,Te,_e,$e;if(ae.valueOwner.type!==p.InputMap||_t.includes(ae.valueOwner.parent.type))return;const ye=i.body.inputs.find(Ie=>S(Ie,l)===S(ae.valueOwner,l)),Q=[...((Te=(ue=x==null?void 0:x[ye.id])==null?void 0:ue.value)==null?void 0:Te.value)||[],((_e=ae==null?void 0:ae.value)==null?void 0:_e.value)||null];($e=x[ye.id].value)==null||$e.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ye,x[ye.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;H++}break}case fe.loop["manual-flow-loop"].id:{let ee=1;for(;ee<=50;){const H=i.body.inputs.map(oe=>{if(oe===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(oe.id);if(ae){ae.metaSync({value:ee},null),this.lastExecutionResults.writeValue(oe,ae);const ue={value:ae,valueOwner:oe,type:Re.ExecutionResult,inheritanceLink:null};return x[oe.id]=ue,ue}const ye=i.currentIterationNumberArgumentDeclaration.getDataType(null),he=nt(ye,oe,l);return he==null||he.metaSync({value:ee},null),this.lastExecutionResults.writeValue(oe,he),{value:he,valueOwner:oe,type:Re.ExecutionResult,inheritanceLink:null}}else return x[oe.id]}).filter(oe=>!!oe);if(W=await this.executeFullFunctionDeclarationLogic(i.body,H,e),(W.results||[]).forEach(oe=>{var Q,ue,Te;if(oe.valueOwner.type!==p.InputMap||_t.includes(oe.valueOwner.parent.type))return;const ae=i.body.inputs.find(_e=>S(_e,l)===S(oe.valueOwner,l)),he=[...(Q=x[ae.id].value)==null?void 0:Q.value,((ue=oe.value)==null?void 0:ue.value)||null];(Te=x[ae.id].value)==null||Te.metaSync({value:he},null),this.lastExecutionResults.writeValue(ae,x[ae.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;ee++}break}case fe.loop["list-loop"].id:{const ee=M[0];let H=1;const oe=ee;for(let ae=0;ae<oe.length;ae++){const ye=oe[ae],he=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const Te=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=nt(Te,Q,l);return _e==null||_e.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Te=Cd(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Te,standaloneParent:Q.toReference()},Ie=gi($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(W=await this.executeFullFunctionDeclarationLogic(i.body,he,e),(W.results||[]).forEach(Q=>{var $e,Ie,Ce;if(Q.valueOwner.type!==p.InputMap||_t.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Ce=x[ue.id].value)==null||Ce.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;H++}break}case fe.loop["object-keys-loop"].id:{const ee=M[0];let H=1;const oe=ee?Object.keys(ee):[];for(let ae=0;ae<oe.length;ae++){const ye=oe[ae],he=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const Te=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=nt(Te,Q,l);return _e==null||_e.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Te=Cd(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Te,standaloneParent:Q.toReference()},Ie=gi($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(W=await this.executeFullFunctionDeclarationLogic(i.body,he,e),(W.results||[]).forEach(Q=>{var $e,Ie,Ce;if(Q.valueOwner.type!==p.InputMap||_t.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Ce=x[ue.id].value)==null||Ce.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;H++}break}case fe.loop["object-values-loop"].id:{const ee=M[0];let H=1;const oe=ee?Object.values(ee):[];for(let ae=0;ae<oe.length;ae++){const ye=oe[ae],he=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const Te=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=nt(Te,Q,l);return _e==null||_e.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Te=Cd(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Te,standaloneParent:Q.toReference()},Ie=gi($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(W=await this.executeFullFunctionDeclarationLogic(i.body,he,e),(W.results||[]).forEach(Q=>{var $e,Ie,Ce;if(Q.valueOwner.type!==p.InputMap||_t.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Ce=x[ue.id].value)==null||Ce.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;H++}break}case fe.loop["string-loop"].id:{const ee=M[0];let H=1;const oe=ee.split("");for(let ae=0;ae<oe.length;ae++){const ye=oe[ae],he=i.body.inputs.map(Q=>{if(Q===i.currentIterationNumberArgumentDeclaration){const ue=this.lastExecutionResults.readValue(Q.id);if(ue)return ue.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,ue),{value:ue,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const Te=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=nt(Te,Q,l);return _e==null||_e.metaSync({value:H},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else if(Q===i.currentValueArgumentDeclaration){const ue=i.currentValueArgumentDeclaration.getDataType(null),Te=Cd(ue),_e=this.lastExecutionResults.readValue(Q.id);if(_e)return _e.metaSync({value:ye},null),this.lastExecutionResults.writeValue(Q,_e),{value:_e,valueOwner:Q,type:Re.ExecutionResult,inheritanceLink:null};const $e={id:L.UUID.uuid(),deletable:!0,editable:!0,type:p.LiteralValue,autogeneration:null,version:L.UUID.uuid(),createdAt:new Date().toISOString(),author:L.sessionAuthor,deleted:!1,previousVersion:null,value:ye,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Te,standaloneParent:Q.toReference()},Ie=gi($e,l);return this.lastExecutionResults.writeValue(Q,Ie),{value:Ie,valueOwner:i.currentValueArgumentDeclaration,type:Re.ExecutionResult,inheritanceLink:null}}else return x[Q.id]}).filter(Q=>!!Q);if(W=await this.executeFullFunctionDeclarationLogic(i.body,he,e),(W.results||[]).forEach(Q=>{var $e,Ie,Ce;if(Q.valueOwner.type!==p.InputMap||_t.includes(Q.valueOwner.parent.type))return;const ue=i.body.inputs.find(je=>S(je,l)===S(Q.valueOwner,l)),_e=[...($e=x[ue.id].value)==null?void 0:$e.value,((Ie=Q.value)==null?void 0:Ie.value)||null];(Ce=x[ue.id].value)==null||Ce.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ue,x[ue.id].value)}),[X.CaughtError,X.Break,X.Return].includes(W.value))break;H++}break}}if(V={value:[X.CaughtError,X.Return].includes(W.value)?W.value:X.Success,error:((v=(y=W.error)==null?void 0:y.value)==null?void 0:v.value)||null,result:((I=(T=W==null?void 0:W.result)==null?void 0:T.value)==null?void 0:I.value)||null},V.error&&i.error){const ee=(b=i.error)==null?void 0:b.getDataType(null),H=nt(ee||null,i.error,l);ee!=null&&ee.asType?H==null||H.setValueAsTypeSingle(V.error):H==null||H.metaSync({value:V.error},null);const oe={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:H};return{value:V.value,entity:i,error:oe,result:null}}const Z=i==null?void 0:i.getDataType(null),J=nt(Z,i,l);return Z!=null&&Z.asType?J==null||J.setValueAsTypeSingle(V.result):J==null||J.metaSync({value:V.result},null),{value:V.value,entity:i,error:null,result:{value:J||null,valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null}}}catch(V){if(Y.warn("Error executing loop: ",V),i.error){const M=(D=i.error)==null?void 0:D.getDataType(null),x=nt(M,i.error,l);return M!=null&&M.asType?x==null||x.setValueAsTypeSingle(V):x==null||x.metaSync({value:V},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:x},result:null}}else return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,a,l,c={}){var y,v;const e={...lo,...c};try{let T={value:X.Success,error:null,result:null};T=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,a,l,e);let I=null;if(T.error&&i.error){Y.warn("Raw error executing entity: ",T.error);const b=(y=i.error)==null?void 0:y.getDataType(null),D=nt(b||null,i.error,l);b!=null&&b.asType?D==null||D.setValueAsTypeSingle(T.error):D==null||D.metaSync({value:T.error},null),I={valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:D}}return{value:T.value,entity:i,error:I,result:T.result}}catch(T){if(!i.error)return{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:null,result:null};const I=(v=i.error)==null?void 0:v.getDataType(null),b=nt(I,i.error,l);return I!=null&&I.asType?b==null||b.setValueAsTypeSingle(T):b==null||b.metaSync({value:T},null),{value:i.catchesError||i.errorCalls.length?X.CaughtError:X.UnhandledError,entity:i,error:{valueOwner:i.error,type:Re.ExecutionResult,inheritanceLink:null,value:b},result:null}}}async executeCondition(i,a){var c,e,y,v,T,I,b,D,V,M,x,G,W,Z,J,ee,H,oe,ae,ye,he,Q,ue,Te,_e,$e,Ie,Ce,je,Ve,xe,Fe,ft,tt,Ut,Ot,Ti,Zi,Xi,on,_r,Zt,_i,cs,fs,gy,Md,_y;let l=!1;switch(i.declaration.id){case Ar.Empty:{l=!((e=(c=a[0])==null?void 0:c.value)!=null&&e.value);break}case Ar.NotEmpty:{l=!!((v=(y=a[0])==null?void 0:y.value)!=null&&v.value);break}case ut.Equal:{if([re.String,re.Number,re.Boolean,re.Null,re.Enum,re.Date,re.UUID].includes((I=(T=a[0])==null?void 0:T.value)==null?void 0:I.name)){l=((D=(b=a[0])==null?void 0:b.value)==null?void 0:D.value)===((M=(V=a[1])==null?void 0:V.value)==null?void 0:M.value);break}if(((G=(x=a[0])==null?void 0:x.value)==null?void 0:G.name)===re.KeyValue||((Z=(W=a[0])==null?void 0:W.value)==null?void 0:Z.name)===re.Untyped){const Va=(ee=(J=a[0])==null?void 0:J.value)==null?void 0:ee.value,kr=(oe=(H=a[1])==null?void 0:H.value)==null?void 0:oe.value;l=JSON.stringify(Va)===JSON.stringify(kr);break}break}case ut.NotEqual:{if([re.String,re.Number,re.Boolean,re.Null,re.Enum,re.Date,re.UUID].includes((ye=(ae=a[0])==null?void 0:ae.value)==null?void 0:ye.name)){l=((Q=(he=a[0])==null?void 0:he.value)==null?void 0:Q.value)!==((Te=(ue=a[1])==null?void 0:ue.value)==null?void 0:Te.value);break}if((($e=(_e=a[0])==null?void 0:_e.value)==null?void 0:$e.name)===re.Untyped||((Ce=(Ie=a[0])==null?void 0:Ie.value)==null?void 0:Ce.name)===re.KeyValue){const Va=(Ve=(je=a[0])==null?void 0:je.value)==null?void 0:Ve.value,kr=(Fe=(xe=a[1])==null?void 0:xe.value)==null?void 0:Fe.value;l=JSON.stringify(Va)!==JSON.stringify(kr);break}break}case ut.MoreThanOrEqual:{l=((tt=(ft=a[0])==null?void 0:ft.value)==null?void 0:tt.value)>=((Ot=(Ut=a[1])==null?void 0:Ut.value)==null?void 0:Ot.value);break}case ut.MoreThan:{l=((Zi=(Ti=a[0])==null?void 0:Ti.value)==null?void 0:Zi.value)>((on=(Xi=a[1])==null?void 0:Xi.value)==null?void 0:on.value);break}case ut.LessThanOrEqual:{l=((Zt=(_r=a[0])==null?void 0:_r.value)==null?void 0:Zt.value)<=((cs=(_i=a[1])==null?void 0:_i.value)==null?void 0:cs.value);break}case ut.LessThan:{l=((gy=(fs=a[0])==null?void 0:fs.value)==null?void 0:gy.value)<((_y=(Md=a[1])==null?void 0:Md.value)==null?void 0:_y.value);break}case Fi.And:{l=(await Promise.all(i.andChildrenGroup.map(async kr=>{const Ep=this.mergeExernalValuesWithInternalInputs(a,kr);return(await this.executeCondition(kr,Ep)).value===X.Success}))).every(kr=>kr);break}case Fi.Or:{l=(await Promise.all(i.orChildrenGroup.map(async kr=>{const Ep=this.mergeExernalValuesWithInternalInputs(a,kr);return(await this.executeCondition(kr,Ep)).value===X.Success}))).some(kr=>kr);break}}return{value:l?X.Success:X.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,a,l,c={}){const e={...lo,...c,onBeforeEntityExecution:(T,I,b)=>{var D;return((D=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:D.call(c,T,I,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(T,I,b)=>{var D;return((D=c==null?void 0:c.onEntityExecuted)==null?void 0:D.call(c,T,I,{...b,detached:!0}))||Promise.resolve()}},y=new oo(l,[i,...tv(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,a)}async executeFullFunctionDeclarationLogic(i,a,l={}){const c={...lo,...l},e=tv(i);e.forEach(T=>{this.addEntity(T)}),e.reduce((T,I)=>_t.includes(I.type)?[...T,...I.outputs]:Ft.includes(I.type)&&I.type!==p.Condition?[...T,...I.outputs,...I.inputs]:I.type===p.Condition?[...T,...I.inputs]:T,[]).forEach(T=>{this.lastExecutionResults.removeValue(T.id)});const v=await this.executeBranch(i,c,a);return{...v||{},value:(v==null?void 0:v.value)||X.Success,entity:i,error:(v==null?void 0:v.error)||null,result:(v==null?void 0:v.result)||null}}static async executeEntryPointEntity(i,a){return{value:X.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=wa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Re.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=wa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=nt(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var G,W;if(((G=x.declaration)==null?void 0:G.type)===p.Property&&x.declaration.static){const Z=this.lastExecutionResults.readValue(x.declaration.id),J=S(x,this.project),ee=x.codeName||((W=x.declaration)==null?void 0:W.codeName)||Mi(J);if(Z)Z.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,Z);else{const H=nt(x.getDataType(null),x,this.project);H==null||H.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,H)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var Z;const x=M.codeName||((Z=M.declaration)==null?void 0:Z.codeName)||Mi(S(M,this.project)),G=e[x],W=nt(M.getDataType(null),M,this.project);W==null||W.metaSync({value:G},null),Re.ExecutionResult}),l.type=Re.ExecutionResult,{value:X.Return,entity:i,error:null,result:l}}async executeContinueStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=wa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Re.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=wa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=nt(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var G,W;if(((G=x.declaration)==null?void 0:G.type)===p.Property&&x.declaration.static){const Z=this.lastExecutionResults.readValue(x.declaration.id),J=S(x,this.project),ee=x.codeName||((W=x.declaration)==null?void 0:W.codeName)||Mi(J);if(Z)Z.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,Z);else{const H=nt(x.getDataType(null),x,this.project);H==null||H.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,H)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var Z;const x=M.codeName||((Z=M.declaration)==null?void 0:Z.codeName)||Mi(S(M,this.project)),G=e[x],W=nt(M.getDataType(null),M,this.project);W==null||W.metaSync({value:G},null),Re.ExecutionResult}),l.type=Re.ExecutionResult,{value:X.Continue,entity:i,error:null,result:l}}async executeBreakStatement(i,a){var y,v,T,I,b,D,V;if((y=i.throws)!=null&&y.readsValue){const M=wa(i.throws,this.valueResolutionContext);return{value:X.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Re.ExecutionResult,inheritanceLink:null,value:(M==null?void 0:M.value)||null},result:null}}let l=wa(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let M={};if(((v=c==null?void 0:c.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=nt(c,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:i,type:Re.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(x=>{var G,W;if(((G=x.declaration)==null?void 0:G.type)===p.Property&&x.declaration.static){const Z=this.lastExecutionResults.readValue(x.declaration.id),J=S(x,this.project),ee=x.codeName||((W=x.declaration)==null?void 0:W.codeName)||Mi(J);if(Z)Z.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,Z);else{const H=nt(x.getDataType(null),x,this.project);H==null||H.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,H)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var Z;const x=M.codeName||((Z=M.declaration)==null?void 0:Z.codeName)||Mi(S(M,this.project)),G=e[x],W=nt(M.getDataType(null),M,this.project);W==null||W.metaSync({value:G},null),Re.ExecutionResult}),l.type=Re.ExecutionResult,{value:X.Break,entity:i,error:null,result:l}}async executeVariable(i,a){var v,T,I,b,D,V;let l=wa(i,this.valueResolutionContext);const c=nn(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let M={};if(((v=e==null?void 0:e.entity)==null?void 0:v.type)===p.DefinitionEntity&&(M={...M,...e.entity.getActiveRawDefaultValue()}),l!=null&&l.value)bi((T=l==null?void 0:l.value)==null?void 0:T.value)&&(M={...M,...(I=l==null?void 0:l.value)==null?void 0:I.value}),l==null||l.value.metaSync({value:M},null);else{const x=nt(e,i,this.project);x==null||x.metaSync({value:M},null),l={valueOwner:c,type:Re.ExecutionResult,inheritanceLink:null,value:x}}this.lastExecutionResults.writeValue(c,l.value),c.inputs.forEach(x=>{var G,W;if(((G=x.declaration)==null?void 0:G.type)===p.Property&&x.declaration.static){const Z=this.lastExecutionResults.readValue(x.declaration.id),J=S(x,this.project),ee=x.codeName||((W=x.declaration)==null?void 0:W.codeName)||Mi(J);if(Z)Z.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,Z);else{const H=nt(x.getDataType(null),x,this.project);H==null||H.metaSync({value:M[ee]},null),this.lastExecutionResults.writeValue(x.declaration,H)}}})}else this.lastExecutionResults.writeValue(c,l==null?void 0:l.value);const y=(b=l==null?void 0:l.value)!=null&&b.value&&bi((D=l.value)==null?void 0:D.value)?((V=l.value)==null?void 0:V.value)||{}:{};return i.outputs.map(M=>{var Z;const x=M.codeName||((Z=M.declaration)==null?void 0:Z.codeName)||Mi(S(M,this.project)),G=y[x],W=nt(M.getDataType(null),M,this.project);W==null||W.metaSync({value:G},null),Re.ExecutionResult}),l.type=Re.ExecutionResult,{value:X.Success,entity:i,error:null,result:l}}mergeValues(i,a){const l=[];for(let c=0;c<a.length;c++)i!=null&&i[c]?l.push(i[c]):l.push(a[c]);return l}async executeEntity(i,a=[],l={}){var y,v,T,I,b,D,V,M,x,G,W;const c={...lo,...l},e={detached:!1};switch(i.type){case p.Condition:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((y=c.onBeforeEntityExecution)==null?void 0:y.call(c,i,Z,e)),this.executeCondition(i,Z)}case p.InternalCall:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((v=c.onBeforeEntityExecution)==null?void 0:v.call(c,i,Z,e)),this.executeInternalCall(i,Z,this.project)}case p.Operation:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((T=c.onBeforeEntityExecution)==null?void 0:T.call(c,i,Z,e)),oo.executeOperation(i,Z,this.project)}case p.VariableInstance:case p.VariableDeclaration:return this.executeVariable(i,a);case p.FunctionCall:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((I=c.onBeforeEntityExecution)==null?void 0:I.call(c,i,Z,e)),this.executeFunctionCall(i,Z,this.project)}case p.FunctionDeclaration:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,Z,e)),oo.executeEntryPointEntity(i,Z)}case p.Search:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((D=c.onBeforeEntityExecution)==null?void 0:D.call(c,i,Z,e)),this.executeSearch(i,Z,this.project)}case p.Loop:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((V=c.onBeforeEntityExecution)==null?void 0:V.call(c,i,Z,e)),this.executeLoop(i,Z,this.project,c)}case p.ReturnStatement:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,Z,e)),this.executeReturnStatement(i,Z)}case p.ContinueStatement:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((x=c.onBeforeEntityExecution)==null?void 0:x.call(c,i,Z,e)),this.executeContinueStatement(i,Z)}case p.BreakStatement:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((G=c.onBeforeEntityExecution)==null?void 0:G.call(c,i,Z,e)),this.executeBreakStatement(i,Z)}case p.GlobalEvent:{const Z=this.mergeExernalValuesWithInternalInputs(a,i);return await((W=c.onBeforeEntityExecution)==null?void 0:W.call(c,i,Z,e)),oo.executeEntryPointEntity(i,Z)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var l,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((l=i.result)!=null&&l.valueOwner))return;const a=Ys((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?a.forEach(y=>{var v;this.lastExecutionResults.writeValue(y,(v=i.result)==null?void 0:v.value)}):a.forEach(y=>{this.lastExecutionResults.removeValue(y.id)})}async executeBranch(i,a={},l=[]){var T;const c={...lo,...a},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const v=await this.executeEntity(i,l,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(v),await((T=c.onEntityExecuted)==null?void 0:T.call(c,i,v,e)),v.value===X.Success){const I=(i.successCalls||i.calls||[]).filter(x=>this.hasEntity(x));(i.errorCalls||[]).forEach(x=>{this.skip(x)});let D=[];const V=(await Promise.all(I.map(x=>this.schedule(x,[],c)))).filter(x=>!!x),M=V.filter(x=>!!x).find(x=>x.value===X.CaughtError||x.value===X.Return||x.value===X.Break||x.value===X.Continue);return M||(D=[...D,...V],v)}else if(v.value===X.CaughtError||v.value===X.ConditionNotMet){const I=(i.errorCalls||[]).filter(x=>this.hasEntity(x));(i.successCalls||i.calls||[]).forEach(x=>{this.skip(x)});let D=[];const V=(await Promise.all(I.map(x=>this.schedule(x,[],c)))).filter(x=>!!x),M=V.filter(x=>!!x).find(x=>x.value===X.CaughtError||x.value===X.UnhandledError||x.value===X.Return||x.value===X.Break||x.value===X.Continue);return M||(D=[...D,...V],v)}else{if(v.value===X.UnhandledError)return this.executing.forEach(I=>{this.skip(I)}),this.scheduled.forEach(I=>{this.skip(I)}),wr.includes(v.entity.type)&&ct(v.entity).forEach(I=>{this.skip(I)}),v;if(v.value===X.Return)return v;if(v.value===X.Break)return v;if(v.value===X.Continue)return v}return v}async execute(i={},a=[]){const l={...lo,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,l,a);return this.state="finished-success",c}addEntity(i){var a;this.entities.includes(i)||(this.entities.push(i),(a=this.onAddEntityCallback)==null||a.call(this,i))}addEntities(i){i.forEach(a=>this.addEntity(a))}removeEntity(i){var a;if(i!==this.entryPoint){const l=this.entities.indexOf(i);l>-1&&(this.entities.splice(l,1),(a=this.onRemoveEntityCallback)==null||a.call(this,i))}}hasEntity(i){var c,e,y;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===p.FunctionDeclaration&&((y=(e=i.parent)==null?void 0:e.parent)==null?void 0:y.type)===p.DefinitionEntity)return this.entities.includes(i.parent);const a=$i(i);if(!a)return!1;const l=a.type===p.Loop&&i.parent===a.body?a.body:null;return l?this.entities.includes(l)||this.entities.includes(a):this.entities.includes(a)}removeScheduled(i){const a=this.scheduled.indexOf(i);a>-1&&this.scheduled.splice(a,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const a=this.project.get(i);return a?this.hasEntity(a):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const a=this.scheduled.indexOf(i);a>-1&&this.scheduled.splice(a,1)}removeFromExecutingList(i){var l;const a=this.executing.indexOf(i);a>-1&&(this.executing.splice(a,1),(l=this.onAbortExecutionCallback)==null||l.call(this,i))}removeFromAlreadyExecutedList(i){const a=this.executed.indexOf(i);a>-1&&this.executed.splice(a,1)}removeFromSkippedList(i){var l;const a=this.skipped.indexOf(i);a>-1&&(this.skipped.splice(a,1),(l=this.onRemoveFromSkippedListCallback)==null||l.call(this,i))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var a;this.skipped.includes(i)||(this.skipped.push(i),(a=this.onAddToSkippedListCallback)==null||a.call(this,i))}}function tDe(d){var u,i;if(d.isList)return"list";if(((u=d.entity)==null?void 0:u.type)===p.DefinitionEntity)return"definition-entity";switch((i=d.entity)==null?void 0:i.name){case re.Number:return"number";case re.String:return"text";case re.Boolean:return"boolean";case re.UUID:return"uuid";case re.Date:return"date-time";default:return"definition-entity"}}const ss={[p.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[p.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[p.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[p.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[p.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[p.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[p.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[p.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[p.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[p.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[p.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[p.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[p.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[p.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[p.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[p.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[p.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[p.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[p.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[p.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[p.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[p.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[p.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[p.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[p.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[p.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function FA(d){const u=iv(d);if(!u){const a=yp(d);if(a.includes(ce.HTTP_ENDPOINT))return"HTTP endpoint";if(a.includes(ce.PERSISTED_ENTITY))return"Persisted entity";if(a.includes(ce.CRON_JOB))return"Scheduled execution";if(a.includes(ce.RELATIONAL_DATABASE))return"Relational database"}if(u){let a="Extension of "+S(u,u.project)+" entity",l=cd(a);const c=yp(d);return c.includes(ce.HTTP_ENDPOINT)?"HTTP endpoint"+(l?", "+l:""):c.includes(ce.PERSISTED_ENTITY)?"Persisted entity"+(l?", "+l:""):c.includes(ce.CRON_JOB)?"Scheduled execution"+(l?", "+l:""):c.includes(ce.RELATIONAL_DATABASE)?"Relational database"+(l?", "+l:""):a}let i="";return d.abstract&&(i="Template "),d.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function X7(d){return d.parent.type===p.DefinitionEntity||d.parent.type===p.InstalledProject?"Internal action of "+S(d.parent,d.project):d.parent.type===p.Loop?"Action repeated on every iteration":"Internal action of entity"}function KA(d){return dR(d)?X7(d):"Custom trigger"}function iDe(d){var u;switch(d.type){case p.DefinitionEntity:return FA(d);case p.FunctionDeclaration:return KA(d)}return(u=ss[d.type])==null?void 0:u.singular}function rDe(d){var u;switch(d.type){case p.DefinitionEntity:return FA(d);case p.FunctionDeclaration:return KA(d)}return(u=ss[d.type])==null?void 0:u.singular}const qA=4e4,Q7=280,nDe=300,ZA=65,Ju=32,Qm=39,e9=26,t9=49,e0=44,sDe=35,t0=52,WA=10,hl=WA*2,i0=38,r0=90,HA=270,i9=qA/2+120,r9=qA/2+180;function n9(d){let i=Ju+e0+i0+WA;const a=[...d.inputs];return a.length&&(i+=hl,a.forEach(()=>{i+=e9})),{height:i,width:280}}function s9(d){let i=ZA;const a=[];if([p.DefinitionEntity].includes(d.type)){const v=[...d.suggestedProperties||[],...d.properties||[]];v.length&&(i+=hl,v.forEach(T=>{i+=T.static?t9:Qm}))}if([p.DefinitionEntity,p.InstalledProject,p.Loop].includes(d.type)){const v=[...(d==null?void 0:d.suggestedMethods)||[],...d.methods||[],...d.functions||[],...d.body?[d.body]:[]];v.length&&(i+=hl,v.forEach(T=>{const I=n9(T);i+=I.height}))}Ft.includes(d.type)?(Vt.includes(d.type)?a.push(...(d.usedInputs||[]).flatMap(v=>[v])||[]):a.push(...(d.inputs||[]).flatMap(v=>[v])||[]),d.error&&(i+=t0)):[p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)?(a.push(...d.outputs||[]),d.throws&&(i+=t0)):d.type===p.Condition&&(a.push(d.inputs[0]),d.inputs[1]&&a.push(d.inputs[1]));const l=a.length;l&&(i+=l*Qm,i+=hl);const c=[];if(d.type===p.FunctionDeclaration||d.type===p.GlobalEvent?c.push(...d.inputs||[]):Ft.includes(d.type)&&(Vt.includes(d.type)?c.push(...d.usedOutputs||[]):c.push(...d.outputs||[])),Vt.includes(d.type)){d.readsValue&&(i+=hl,i+=e0),d.writesValues.length&&(i+=hl,i+=e0),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>i+=t0+hl);const v=d.getDataType(null);(!v||v.inferred)&&(i+=i0)}const e=c.length;return e&&(i+=e*Qm,i+=hl),[p.DefinitionEntity,p.FunctionDeclaration,p.ReturnStatement,p.BreakStatement,p.ContinueStatement].includes(d.type)&&(i+=i0),{height:i,width:280}}function ef(d){return`${d.split("-").map((a,l)=>l===0?a.charAt(0).toUpperCase()+a.slice(1):a.toLowerCase()).join(" ")}.`}function aDe(d){switch(d.code){case le.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case le.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case le.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case le.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case le.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case le.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case le.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case de.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case de.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case le.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case le.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case de.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case le.NoProperties:return"This entity has no properties, so it doesn't do anything";case le.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case le.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case le.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case le.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case le.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case le.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case le.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case le.PropertyImplementsNonAbstact:return"This property implements a non-template property";case le.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case le.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case le.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case le.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case le.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case de.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case de.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case de.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case de.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case de.UnreachableEntity:return"This entity is unreachable";case le.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case le.AbstractEntityImplements:return"This template entity implements a non-template entity";case le.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case le.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case le.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case le.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case le.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case le.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case le.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case le.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case le.MissingRequiredValue:return"This action is missing a required value";case le.NoPrimaryKeyProperty:return"This entity has no primary key property";case le.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case le.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case le.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case le.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case le.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case le.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case le.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case de.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case de.EmptyName:return"This entity has no name";case de.InvalidObjectStructure:return"This entity has an invalid structure";case de.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case de.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case de.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case de.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case de.MissingCaller:return"This action is missing a caller";case de.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case de.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case de.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case de.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case de.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case de.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case de.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case de.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Na.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Na.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case qn.UUIDMustBeString:return`UUID must be a string, eg: "${Td()}"`;case qn.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Td()}"`;case qn.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${Td()}"`;case vn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case vn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case vn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return ef(d.code)}}function lDe(d){switch(d.code){case le.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case le.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case le.IncorrectEntityImplementation:return"Incorrect implementation";case le.IncorrectMethodImplementation:return"Incorrect action implementation";case le.IncorrectPropertyImplementation:return"Incorrect property implementation";case le.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case le.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case de.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case de.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case le.MissingMethodImplementation:return"Missing action";case le.MissingPropertyImplementation:return"Missing property";case de.NameNotUniqueInScope:return"Duplicate name";case le.NoProperties:return"No properties";case le.NonStaticPropertyInStaticEntity:return"Non-static property";case le.StaticEntityWithNonStaticProperties:return"Non-static properties";case le.ReadingFromIncompatibleType:return"Read from different type";case le.WritingToIncompatibleType:return"Write to different type";case le.ScopeWithoutLogic:return"No logic";case le.NonStaticPropertyImplementsStatic:return"Invalid static property";case le.PropertyImplementsIncompatibleType:return"Incompatible data type";case le.PropertyImplementsNonAbstact:return"Non-template property";case le.StaticPropertyImplementsNonStatic:return"Non-static property";case le.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case le.VariableHasInputsAndInternalCall:return"Bad internal call";case le.VariableHasOutputsAndInternalCall:return"Bad internal call";case le.VariableIsCalledAndHasInternalCall:return"Bad internal call";case de.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case de.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case de.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case de.InternalCallParentMissingDataType:return"Parent has no data type";case de.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case de.UnreachableEntity:return"Unreachable entity";case le.DisconnectedCallableEntity:return"Disconnected entity";case le.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case le.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case le.InvalidPropertiesCombination:return"Invalid properties combination";case le.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case le.ExtendsIncompatibleEntities:return"Extends incompatible entities";case le.ImplementingNonAbstractEntity:return"Implementing non-template entity";case le.ImplementsIncompatibleEntities:return"Implements incompatible entities";case le.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case le.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case le.MissingRequiredValue:return"Missing required value";case le.NoPrimaryKeyProperty:return"No primary key property";case le.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case le.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case le.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case le.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case le.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case le.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case le.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case de.EmptyName:return"Empty name";case de.InvalidObjectStructure:return"Invalid object structure";case de.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case de.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case de.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case de.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case de.MissingCaller:return"Missing caller";case de.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case de.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case de.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case de.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case de.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case de.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case de.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case de.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Na.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Na.StatusCodeMustBeNumber:return"HTTP status code must be a number";case qn.UUIDMustBeString:return"UUID must be a string";case qn.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case qn.UUIDMustBeValidFormat:return"UUID must be in a valid format";case vn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case vn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case vn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return ef(d.code)}}function oDe(d){switch(d.code){case le.AbstractEntityWithNonAbstractMethods:return`${S(d.entity,d.entity.project)} has non-template actions`;case le.AbstractEntityWithNonAbstractProperties:return`${S(d.entity,d.entity.project)} has non-template properties`;case le.IncorrectEntityImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements template`;case le.IncorrectMethodImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template`;case le.IncorrectPropertyImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template`;case le.AbstractMethodInNonAbstractEntity:return`${S(d.entity,d.entity.project)} can't be a template`;case le.AbstractPropertyInNonAbstractEntity:return`${S(d.entity,d.entity.project)} can't be a template`;case de.MethodOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites action`;case de.PropertyOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites property`;case le.MissingMethodImplementation:return`${S(d.entity,d.entity.project)} is missing action`;case le.MissingPropertyImplementation:return`${S(d.entity,d.entity.project)} is missing property`;case de.NameNotUniqueInScope:return`${S(d.entity,d.entity.project)} name is not unique`;case le.NoProperties:return`${S(d.entity,d.entity.project)} has no properties`;case le.NonStaticPropertyInStaticEntity:return`${S(d.entity,d.entity.project)} has non-static property`;case le.StaticEntityWithNonStaticProperties:return`${S(d.entity,d.entity.project)} has non-static properties`;case le.ReadingFromIncompatibleType:return`${S(d.entity,d.entity.project)} reads from different type`;case le.WritingToIncompatibleType:return`${S(d.entity,d.entity.project)} writes to different type`;case le.ScopeWithoutLogic:return`${S(d.entity,d.entity.project)} has no logic`;case le.NonStaticPropertyImplementsStatic:return`${S(d.entity,d.entity.project)} has invalid static property`;case le.PropertyImplementsIncompatibleType:return`${S(d.entity,d.entity.project)} has incompatible data type`;case le.PropertyImplementsNonAbstact:return`${S(d.entity,d.entity.project)} has non-template property`;case le.StaticPropertyImplementsNonStatic:return`${S(d.entity,d.entity.project)} has non-static property`;case le.VariableCallsOthersAndHasInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case le.VariableHasInputsAndInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case le.VariableHasOutputsAndInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case le.VariableIsCalledAndHasInternalCall:return`${S(d.entity,d.entity.project)} has bad internal call`;case de.InternalCallDeclarationIsInvalidType:return`${S(d.entity,d.entity.project)} has declaration that is not an action`;case de.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has declaration that is not found in parent`;case de.InternalCallParentDeclarationEntityInvalidType:return`${S(d.entity,d.entity.project)} has invalid parent declaration type`;case de.InternalCallParentMissingDataType:return`${S(d.entity,d.entity.project)}'s parent has no data type`;case de.InternalCallDeclarationNotInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has declaration that is not in parent`;case de.UnreachableEntity:return`${S(d.entity,d.entity.project)} is unreachable`;case le.DisconnectedCallableEntity:return`${S(d.entity,d.entity.project)} is not executed by any entity`;case le.AbstractEntityImplements:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case le.AbstractExtendingNonAbstractEntity:return`${S(d.entity,d.entity.project)} extends a non-template entity`;case le.InvalidPropertiesCombination:return`${S(d.entity,d.entity.project)} has invalid properties combination`;case le.ExtendingNonInteractiveEntity:return`${S(d.entity,d.entity.project)} extends a non-interactive entity`;case le.ExtendsIncompatibleEntities:return`${S(d.entity,d.entity.project)} extends incompatible entities`;case le.ImplementingNonAbstractEntity:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case le.ImplementsIncompatibleEntities:return`${S(d.entity,d.entity.project)} implements incompatible entities`;case le.LackingReturnStatementOnSomeBranches:return`${S(d.entity,d.entity.project)} is missing termination on some branches`;case le.LastCalledEntityMustBeReturnEntity:return`${S(d.entity,d.entity.project)}'s last called entity must be a termination node`;case le.MissingRequiredValue:return`${S(d.entity,d.entity.project)} is missing a required value`;case le.NoPrimaryKeyProperty:return`${S(d.entity,d.entity.project)} has no primary key property`;case le.NonAbstractExtendingAbstractEntity:return`${S(d.entity,d.entity.project)} extends a template entity`;case le.NonStaticExtendingStaticEntity:return`${S(d.entity,d.entity.project)} extends a static entity`;case le.NonStaticImplementingStaticEntity:return`${S(d.entity,d.entity.project)} implements a static entity`;case le.StaticExtendingNonStaticEntity:return`${S(d.entity,d.entity.project)} extends a non-static entity`;case le.StaticImplementingNonStaticEntity:return`${S(d.entity,d.entity.project)} implements a non-static entity`;case le.VariableReadsValueAndInternalCall:return`${S(d.entity,d.entity.project)} reads a value and has internal call`;case le.VariableWritesValuesAndInternalCall:return`${S(d.entity,d.entity.project)} writes values and has internal call`;case de.EmptyName:return`${ss[d.entity.type]} has no name`;case de.InvalidObjectStructure:return`${S(d.entity,d.entity.project)} has invalid structure`;case de.LoopBodyFunctionOverwrite:return`${S(d.entity,d.entity.project)}'s loop body action overwrites an action`;case de.MethodOverwritesBaseMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites base action`;case de.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case de.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case de.MissingCaller:return`${S(d.entity,d.entity.project)} is missing a caller`;case de.NameAsResolvedCodeNameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a name not unique in the scope`;case de.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${S(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case de.NameMustStartWithLetterOrUnderscore:return`${S(d.entity,d.entity.project)} name must start with letter or underscore`;case de.NoOverlapWithImplementedSignature:return`${S(d.entity,d.entity.project)} has no overlap with implemented signature`;case de.PropertyOverwritesBasePropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites base property`;case de.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case de.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case de.ReaderWriterIncompatibleDataType:return`${S(d.entity,d.entity.project)} has reader/writer with incompatible data type`;case Na.StatusCodeMustBeBetween100And599:return`${S(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Na.StatusCodeMustBeNumber:return`${S(d.entity,d.entity.project)} HTTP status code must be a number`;case qn.UUIDMustBeString:return`${S(d.entity,d.entity.project)} UUID must be a string`;case qn.UUIDMustNotContainSpaces:return`${S(d.entity,d.entity.project)} UUID must not contain spaces`;case qn.UUIDMustBeValidFormat:return`${S(d.entity,d.entity.project)} UUID must be in a valid format`;case vn.MustBeUniqueAmongSameEntities:return`${S(d.entity,d.entity.project)} value must be unique among the same kind`;case vn.StringValueMustNotHaveDashes:return`${S(d.entity,d.entity.project)} value must not contain dashes`;case vn.StringValueMustNotHaveSpaces:return`${S(d.entity,d.entity.project)} value must not contain spaces`;default:return`${S(d.entity,d.entity.project)} Error: ${ef(d.code)}`}}function dDe(d){var u,i,a,l;switch(d.code){case le.AbstractEntityWithNonAbstractMethods:return`${S(d.entity,d.entity.project)} has non-template actions`;case le.AbstractEntityWithNonAbstractProperties:return`${S(d.entity,d.entity.project)} has non-template properties`;case le.IncorrectEntityImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template entity`;case le.IncorrectMethodImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case le.IncorrectPropertyImplementation:return`${S(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case le.AbstractMethodInNonAbstractEntity:return`${S(d.entity,d.entity.project)} is a template action in a non-template entity`;case le.AbstractPropertyInNonAbstractEntity:return`${S(d.entity,d.entity.project)} is a template property in a non-template entity`;case de.MethodOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites an action in the template entity`;case de.PropertyOverwritesOtherSiblingWithSameName:return`${S(d.entity,d.entity.project)} overwrites a property in the template entity`;case le.MissingMethodImplementation:return`${S(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case le.MissingPropertyImplementation:return`${S(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case de.NameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a duplicate name in the same scope`;case le.NoProperties:return`${S(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case le.NonStaticPropertyInStaticEntity:return`${S(d.entity,d.entity.project)} has a non-static property in a static entity`;case le.StaticEntityWithNonStaticProperties:return`${S(d.entity,d.entity.project)} has non-static properties in a static entity`;case le.ReadingFromIncompatibleType:return`${S(d.entity,d.entity.project)} reads data from a value of a different data type`;case le.WritingToIncompatibleType:return`${S(d.entity,d.entity.project)} writes data to a value of a different data type`;case le.ScopeWithoutLogic:return`${S(d.entity,d.entity.project)} has no logic`;case le.NonStaticPropertyImplementsStatic:return`${S(d.entity,d.entity.project)} has a static property in a non-static entity`;case le.PropertyImplementsIncompatibleType:return`${S(d.entity,d.entity.project)} implements a property of a different data type`;case le.PropertyImplementsNonAbstact:return`${S(d.entity,d.entity.project)} implements a non-template property`;case le.StaticPropertyImplementsNonStatic:return`${S(d.entity,d.entity.project)} has a static property in a non-static entity`;case le.VariableCallsOthersAndHasInternalCall:return`${S(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case le.VariableHasInputsAndInternalCall:return`${S(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case le.VariableHasOutputsAndInternalCall:return`${S(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case le.VariableIsCalledAndHasInternalCall:return`${S(d.entity,d.entity.project)} is called while being used to execute internal logic`;case de.InternalCallDeclarationIsInvalidType:return`${S(d.entity,d.entity.project)} has a declaration that is not an action`;case de.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has a declaration that is not found in ${(u=d.entity.parent.getDataType(null))!=null&&u.entity?S((i=d.entity.parent.getDataType(null))==null?void 0:i.entity,d.entity.project):"the variable's data-type entity"}`;case de.InternalCallParentDeclarationEntityInvalidType:return`${S(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case de.InternalCallParentMissingDataType:return`${S(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case de.InternalCallDeclarationNotInParentDatatypeEntity:return`${S(d.entity,d.entity.project)} has a declaration doesn't belong to ${(a=d.entity.parent.getDataType(null))!=null&&a.entity?S((l=d.entity.parent.getDataType(null))==null?void 0:l.entity,d.entity.project):"the variable's data-type entity"}`;case de.UnreachableEntity:return`${S(d.entity,d.entity.project)} is unreachable`;case le.DisconnectedCallableEntity:return`${S(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;case le.AbstractEntityImplements:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case le.AbstractExtendingNonAbstractEntity:return`${S(d.entity,d.entity.project)} extends a non-template entity`;case le.InvalidPropertiesCombination:return`${S(d.entity,d.entity.project)} has an invalid combination of properties`;case le.ExtendingNonInteractiveEntity:return`${S(d.entity,d.entity.project)} extends a non-interactive entity`;case le.ExtendsIncompatibleEntities:return`${S(d.entity,d.entity.project)} extends incompatible entities`;case le.ImplementingNonAbstractEntity:return`${S(d.entity,d.entity.project)} implements a non-template entity`;case le.ImplementsIncompatibleEntities:return`${S(d.entity,d.entity.project)} implements incompatible entities`;case le.LackingReturnStatementOnSomeBranches:return`${S(d.entity,d.entity.project)} has branches that don't terminate`;case le.LastCalledEntityMustBeReturnEntity:return`${S(d.entity,d.entity.project)} must end with a termination node`;case le.MissingRequiredValue:return`${S(d.entity,d.entity.project)} is missing a required value`;case le.NoPrimaryKeyProperty:return`${S(d.entity,d.entity.project)} has no primary key property`;case le.NonAbstractExtendingAbstractEntity:return`${S(d.entity,d.entity.project)} is a non-template entity extending a template entity`;case le.NonStaticExtendingStaticEntity:return`${S(d.entity,d.entity.project)} is a non-static entity extending a static entity`;case le.NonStaticImplementingStaticEntity:return`${S(d.entity,d.entity.project)} is a non-static entity implementing a static entity`;case le.StaticExtendingNonStaticEntity:return`${S(d.entity,d.entity.project)} is a static entity extending a non-static entity`;case le.StaticImplementingNonStaticEntity:return`${S(d.entity,d.entity.project)} is a static entity implementing a non-static entity`;case le.VariableReadsValueAndInternalCall:return`${S(d.entity,d.entity.project)} reads a value and has an internal call`;case le.VariableWritesValuesAndInternalCall:return`${S(d.entity,d.entity.project)} writes values and has an internal call`;case de.EmptyName:return`${ss[d.entity.type]} has no name`;case de.InvalidObjectStructure:return`${S(d.entity,d.entity.project)} has an invalid structure`;case de.LoopBodyFunctionOverwrite:return`${S(d.entity,d.entity.project)}'s loop body action overwrites`;case de.MethodOverwritesBaseMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites a base action with same implementation`;case de.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case de.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another action with same implementation`;case de.MissingCaller:return`${S(d.entity,d.entity.project)} is missing a caller`;case de.NameAsResolvedCodeNameNotUniqueInScope:return`${S(d.entity,d.entity.project)} has a name that is not unique in the scope`;case de.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${S(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case de.NameMustStartWithLetterOrUnderscore:return`${S(d.entity,d.entity.project)} name must start with letter or underscore`;case de.NoOverlapWithImplementedSignature:return`${S(d.entity,d.entity.project)} has no overlap with implemented signature`;case de.PropertyOverwritesBasePropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites a base property with same implementation`;case de.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case de.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${S(d.entity,d.entity.project)} overwrites another property with same implementation`;case de.ReaderWriterIncompatibleDataType:return`${S(d.entity,d.entity.project)} has a reader/writer with incompatible data type`;case Na.StatusCodeMustBeBetween100And599:return`${S(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Na.StatusCodeMustBeNumber:return`${S(d.entity,d.entity.project)} HTTP status code must be a number, between 100 and 599`;case qn.UUIDMustBeString:return`${S(d.entity,d.entity.project)} UUID must be a string, eg: "${Td()}"`;case qn.UUIDMustNotContainSpaces:return`${S(d.entity,d.entity.project)} UUID must not contain spaces, eg: "${Td()}"`;case qn.UUIDMustBeValidFormat:return`${S(d.entity,d.entity.project)} UUID must be in a valid format. Eg: "${Td()}"`;case vn.MustBeUniqueAmongSameEntities:return`${S(d.entity,d.entity.project)} value must be unique among the same kind`;case vn.StringValueMustNotHaveDashes:return`${S(d.entity,d.entity.project)} value must not contain dashes`;case vn.StringValueMustNotHaveSpaces:return`${S(d.entity,d.entity.project)} value must not contain spaces`;default:return`${S(d.entity,d.entity.project)} Error: ${ef(d.code)}`}}var zA=(d=>(d.ValuesAlreadyConnected="values-already-connected",d.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",d.CannotReadValueFromChildren="cannot-read-value-from-children",d.CannotWriteValueToChildren="cannot-write-value-to-children",d.CannotBeCalledByChildren="cannot-be-called-by-children",d.ExecutionsAlreadyConnected="executions-already-connected",d.DataTypesNotCompatible="data-types-not-compatible",d.CannotCallAncestor="cannot-call-ancestor",d.CannotConnectToItself="cannot-connect-to-itself",d.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",d.NotInScope="not-in-scope",d.IsNotValueWrittingEntity="is-not-value-writting-entity",d.IsNotValueReadingEntity="is-not-value-reading-entity",d.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",d.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",d.CallerIsInHigherScope="caller-is-in-higher-scope",d.CallerIsInLowerScope="caller-is-in-lower-scope",d.CallIsInHigherScope="call-is-in-higher-scope",d.CallIsInLowerScope="call-is-in-lower-scope",d.OtherIncompatibleScopeReason="other-incompatible-scope-reason",d.SiblingInternalCallAlreadyUsedInParentVariable="sibling-internal-call-already-used-in-parent-variable",d.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees="error-output-map-cannot-be-connected-to-parent-success-branch-callees",d.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees="success-output-map-cannot-be-connected-to-parent-error-branch-callees",d))(zA||{});const uDe=Object.values(zA);var JA=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(JA||{});const pDe=Object.values(JA);var YA=(d=>(d.Suggestion="suggestion",d.CanvasGloballyDisabled="canvas-globally-disabled",d.CannotInteractWithInputInVariableWithInternalCalls="cannot-interact-with-input-in-variable-with-internal-calls",d.CannotInteractWithOutputInVariableWithInternalCalls="cannot-interact-with-output-in-variable-with-internal-calls",d))(YA||{});const cDe=Object.values(YA);function fDe(d,u){const i=[...d,...u];return Array.from(new Set(i))}function yDe(d,u){const i=[...d,...u],a=Array.from(new Set(i));return{hasChanged:a.length!==d.length,reasons:a}}function hDe(d,u){const i=d.filter(l=>!u.includes(l));return{hasChanged:i.length!==d.length,reasons:i}}function mDe(d,u){return d.find(i=>i.entity.id===u)||null}function a9(d){return d.filter((u,i)=>d.indexOf(u)===i)}class zr{constructor(u,i,a=null,l){_(this,"ids",[]);_(this,"entity");_(this,"entityCardHeight");_(this,"entityCardWidth");_(this,"index");_(this,"childEntities",[]);_(this,"children",[]);_(this,"parents",[]);_(this,"calculationEntryPoint");_(this,"_onlyEntities",null);_(this,"_changeSet",null);if(this.index=i,this.entity=u,this.calculationEntryPoint=a||this,this===this.calculationEntryPoint&&!l)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(u,i,a){const l=i9-HA-Q7,c=r9-r0-ZA;u.metaSync({x:u.x||l,y:u.y||c},i);const e=new zr(u,0,null,i);e._onlyEntities=a||[],e.ids=["0"];const y=[];e.next(T=>{y.push(...T)}),zr.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const v=e.flattenChildEntities();return e._onlyEntities?v.filter(T=>(e._onlyEntities||[]).includes(T)):v}static recursivelyAssembleChildrenAreas(u){const i=[];u.forEach(a=>{a.next(l=>{i.push(...l)})}),i.length>0&&zr.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(u){this.calculationEntryPoint._changeSet=u}findAreaInChildrenFromEntity(u){if(this.entity===u)return this;const i=this.children.find(l=>l.entity===u);return i||this.children.reduce((l,c)=>l||c.findAreaInChildrenFromEntity(u),null)}findAreaFromEntity(u){if(this.entity===u)return this;const i=this.calculationEntryPoint.children,a=i.find(c=>c.entity===u);return a||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(u),null)}addParent(u){if(!this.parents.includes(u)){const i=zr.resolveIds(u,this.index);this.ids.push(...i),this.parents.push(u)}}static resolveIds(u,i){return u?u.ids.map(a=>`${a}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const u=ia(this.entity,!0);if(this.entity.type===p.Project){const i=[],a=[],l=[];u.forEach(e=>{if(p.DefinitionEntity===e.type){a.push(e);return}else if(Bt.includes(e.type)){l.push(e);return}i.push(e)});const c=i.sort((e,y)=>{const v=!!z0(e,y).length,T=ia(e),I=ia(y);return v?0:T.length&&!I.length?-1:!T.length&&I.length?1:0}).filter(e=>!Ro(e).length);this.childEntities=[...a,...l,...c]}else{const i=[],a=[],l=[],c=[],e=[];wr.includes(this.entity.type)&&Y0(this.entity).forEach(T=>{if(Vt.includes(T.type)){l.push(T);return}const I=$i(T);i.push(I)}),er.includes(this.entity.type)&&a.push(...this.entity.detachedChildren);const y=u.filter(v=>{const T=i.includes(v);return T||l.includes(v)||a.includes(v)?!1:Vt.includes(v.type)?(l.push(v),!1):xr.includes(v.type)&&!T?(c.push(v),!1):v.type===p.DefinitionEntity?(e.push(v),!1):!0});i.sort((v,T)=>Pd(v,T)?-1:0),c.sort((v,T)=>Pd(v,T)?-1:0),l.sort((v,T)=>iR(v,T)?1:iR(T,v)?-1:0),this.childEntities=[...e,...i,...c,...y,...l,...a]}}calculateCardSize(){const u=s9(this.entity);this.entityCardWidth=u.width,this.entityCardHeight=u.height}static getBoundriesOfTwoAreas(u,i){return{top:Math.min(u.top,i.top),left:Math.min(u.left,i.left),bottom:Math.max(u.bottom,i.bottom),right:Math.max(u.right,i.right)}}static getBoundriedOfCombinedAreas(u,i){const a=u.filter(c=>!i.includes(c));return a.reduce((c,e)=>i.includes(e)?c:zr.getBoundriesOfTwoAreas(c,e.fullBranchArea),a[0].fullBranchArea)}getFullAreaUntilAny(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!u.includes(e)).map(e=>e.getFullAreaUntilAny(u)).reduce((e,y)=>zr.getBoundriesOfTwoAreas(e,y),i)}getFullAreaUntilAreaOrAnyChildren(u){const i=[u,...u.flattenChildren()],a=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(u)).reduce((e,y)=>zr.getBoundriesOfTwoAreas(e,y),a)}getFullAreaUntil(u){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==u).map(c=>c.getFullAreaUntil(u)).reduce((c,e)=>zr.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const u=this.ownEntityPlusBufferArea;return this.children.map(l=>l.fullBranchArea).reduce((l,c)=>zr.getBoundriesOfTwoAreas(l,c),u)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const u=this.ownEntityArea;return{top:u.top,left:u.left,bottom:u.bottom+r0,right:u.right+HA}}static filterOutRepeatedAreas(u){return u.filter((i,a)=>u.indexOf(i)===a)}getEarliestId(u,i){const a=u.split("-"),l=i.split("-");return a.length<l.length?u:a.length>l.length?i:a.reduce((e,y,v)=>y<l[v]?u:i,u)}getEarliestLevel(){return this.ids.reduce((a,l)=>this.getEarliestId(a,l),this.ids[0]).split("-").length}countColumns(){let u=0;if(this!==this.calculationEntryPoint)u++;else return u;if(!this.parents.length)return u;const a=this.parents.reduce((l,c)=>c.getEarliestLevel()>l.getEarliestLevel()?c:l,this.parents[0]).countColumns();return u+=a,u}getLatestId(u,i){if(u===i)return u;const a=u.split("-"),l=i.split("-");return a.length<l.length?i:a.length>l.length?u:a.reduce((e,y,v)=>y>l[v]?u:i,u)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((a,l)=>this.getLatestId(a,l),this.ids[0]).split("-").length}smoothPosition(){const u=this.flattenSiblings();if(!u.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(a=>{a!==this.calculationEntryPoint&&a.shiftDownAlone(i)})}else if([...Bt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=u.filter(a=>!this.parents.includes(a));i.length?i.every(l=>{const c=this.countColumns(),e=l.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(u,i){if(u.includes(this))return u;this.move(this.entity,{y:this.entity.y+i});let a=[...u,this];return this.children.forEach(l=>{if(zr.getEarliestParentInChain(l)!==this)return;const e=mDe(a,l.entity.id);a=zr.filterOutRepeatedAreas([...a]),e||(a=a.filter(v=>v!==l));const y=l.shiftDownUntilAny(a,i);a.push(...y)}),a}shiftRightUntilAny(u,i){u.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(a=>{const l=zr.filterOutRepeatedAreas([...this.flattenSiblings(),...u]);zr.getEarliestParentInChain(a)===this&&a.shiftRightUntilAny(l,i)}))}shiftRight(u){this.move(this.entity,{x:this.entity.x+u}),this.children.forEach(i=>{const l=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(l,u)})}shiftDownAlone(u){this.move(this.entity,{y:this.entity.y+u})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const u=this.parents.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+Ju,v={top:y,left:e.left,bottom:y,right:e.right};return zr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Ju;this.shiftDownAlone(a)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const u=this.children.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+Ju,v={top:y,left:e.left,bottom:y,right:e.right};return zr.getBoundriesOfTwoAreas(l,v)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),a=(u.bottom-u.top)/2-Ju;return this.shiftDownAlone(a),a}resolveChildrenOverlaps(){const u=this.flattenChildren();let i=[];u.forEach(a=>{const l=a.adjustVerticallyToAvoidOverlaps();i.push(...l)}),u.forEach(a=>{a.smoothPosition()})}static getEarliestParentInChain(u){let i=u.parents[0];return u.parents.length&&(i=u.parents.sort((a,l)=>{if(!a.ids.length)return-1;if(!l.ids.length)return 1;const c=a.ids.sort((y,v)=>y.length<v.length?-1:0),e=l.ids.sort((y,v)=>y.length<v.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const e=l.children.slice(0,l.children.indexOf(this)).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...e]},[])}flattenSiblings(u=new Set){return u.add(this.entity.id),this.parents.reduce((a,l)=>{if(u.has(l.entity.id))return a;u.add(l.entity.id);const e=l.children.filter(y=>y!==this).reduce((y,v)=>[...y,v,...v.flattenChildren(u)],[]);return[...a,...e]},[])}flattenChildren(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a,...a.flattenChildren(u)]),[])}flattenParents(u=new Set){return this.parents.reduce((a,l)=>u.has(l.entity.id)?a:(u.add(l.entity.id),[...a,l,...l.flattenParents(u)]),[])}getAreaIfRendered(u){return this.calculationEntryPoint.flattenChildren().find(l=>l.entity.id===u.id)||null}getLowerSiblings(){const u=this.parents.reduce((i,a)=>{const l=a.children.indexOf(this),c=a.children.slice(l+1);return[...i,...c]},[]);return a9(u)}getLowerAreas(){const u=this.getLowerSiblings(),i=this.parents.reduce((a,l)=>[...a,...l.getLowerAreas()],[]);return a9([...u,...i])}adjustVerticallyToAvoidOverlaps(u=[]){const a=zr.getEarliestParentInChain(this).children[this.index-1];if(!a)return u;const l=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...l,...c,a],T=C(e.flatMap(V=>z0(this.entity,V.entity))).filter(V=>V.id!==this.entity.id).map(V=>this.findAreaFromEntity(V)).filter(V=>!!V),I=this.getFullAreaUntilAny(T),b=a.getFullAreaUntilAny(T),D=e.reduce((V,M)=>M===this||M.fullBranchArea.left!==I.left?V:Math.max(V,M.fullBranchArea.bottom),b.bottom);if(I.top<D){const V=D-I.top+r0;return this.shiftDownUntilAny(u,V)}return u}move(u,i){(this.onlyEntities||[]).includes(u)&&u.metaSync(i,this.changeSet)}addChild(u){const i=this.childEntities[u];let a=null;i.x&&i.y?a=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),a||(a=new zr(i,u,this.calculationEntryPoint));const l=this.ownEntityPlusBufferArea;this.children.includes(a)||(this.children.push(a),a.addParent(this));const c=a.fullBranchArea;if(c.left<l.right){const e=l.right-c.left;a.shiftRight(e)}return a}flattenChildEntities(u=new Set){return this.children.reduce((i,a)=>u.has(a.entity.id)?i:(u.add(a.entity.id),[...i,a.entity,...a.flattenChildEntities(u)]),[])}next(u){const i=[];this.childEntities.forEach((a,l)=>{const c=this.addChild(l);c&&i.push(c)}),u(i)}}var tf=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))(tf||{}),zi=(d=>(d.RelationalDatabase="relational-database",d.CompiledLocalCodebase="compiled-local-codebase",d.CloudHostedCodebase="cloud-hosted-codebase",d.HttpApi="http-api",d.HttpEndpoint="http-endpoint",d.ServerlessFunction="serverless-function",d))(zi||{}),SA=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(SA||{}),Id=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.Skipped="skipped",d.AbortedByUser="aborted-by-user",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(Id||{}),XA=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(XA||{}),bt=(d=>(d.ProjectNotFound="project-not-found",d.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",d.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",d.DeploymentCompleted="deployment-completed",d.DeploymentStarted="deployment-started",d.DeploymentFailed="deployment-failed",d.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",d.RequestPayloadValidationFailed="request-payload-validation-failed",d.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",d.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",d.ProjectAlreadyBeingPublished="project-already-being-published",d.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",d.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",d.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",d.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",d.CreatingNewRelationalDatabase="creating-new-relational-database",d.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",d.RelationalDatabaseAlreadyExists="relational-database-already-exists",d.RelationalDatabaseDeletionStarted="relational-database-deletion-started",d.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",d.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",d.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",d.HttpApiDeploymentStarted="http-api-deployment-started",d.HttpApiDeploymentCompleted="http-api-deployment-completed",d.HttpApiDeploymentFailed="http-api-deployment-failed",d.CreatingNewHttpApi="creating-new-http-api",d.HttpApiAlreadyExists="http-api-already-exists",d.HttpApiDeletionStarted="http-api-deletion-started",d.HttpApiDeletionCompleted="http-api-deletion-completed",d.HttpApiDeletionFailed="http-api-deletion-failed",d.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",d.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",d.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",d.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",d.BundlingCodebaseForDownload="bundling-codebase-for-download",d.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",d.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",d.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",d.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",d.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",d.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",d.CodeCompilationStarted="code-compilation-started",d.CodeCompilationCompleted="code-compilation-completed",d.CodeCompilationFailed="code-compilation-failed",d.BundleCodebaseStarted="bundle-codebase-started",d.BundleCodebaseCompleted="bundle-codebase-completed",d.BundleCodebaseFailed="bundle-codebase-failed",d.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",d.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",d.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",d.MigrateRelationalDatabaseStarted="migrate-relational-database-started",d.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",d.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",d.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",d.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",d.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",d.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",d))(bt||{}),Qs=(d=>(d.CodeCompilation="code-compilation",d.RelationalDatabaseDeployment="relational-database-deployment",d.RelationalDatabaseDeletion="relational-database-deletion",d.HttpApiDeployment="http-api-deployment",d.HttpApiDeletion="http-api-deletion",d.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",d.BundleCodebase="bundle-codebase",d.MigrateRelationalDatabase="migrate-relational-database",d.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",d.ExecutePublicationCompletedEvent="execute-publication-completed-event",d.CodebaseCleanup="codebase-cleanup",d))(Qs||{});zi.CloudHostedCodebase,zi.HttpApi,zi.RelationalDatabase,zi.CloudHostedCodebase,zi.CloudHostedCodebase,zi.RelationalDatabase,zi.CloudHostedCodebase,zi.CloudHostedCodebase;function l9(d){return`project-${d}-http-api`}function n0(d){return`entity-${d}-database`}class o9{constructor(u,i,a,l,c,e,y,v,T){_(this,"stepType");_(this,"id");_(this,"resourceType");_(this,"index");_(this,"dependency",[]);_(this,"lastEvent",null);_(this,"lastEventTimestamp",null);_(this,"status",Id.Queued);_(this,"publicationRun");_(this,"resource");this.stepType=u,this.id=i,this.resourceType=a,this.status=l,this.dependency=c,this.index=e,this.lastEventTimestamp=y,this.publicationRun=v,this.resource=T}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(u){var i,a;this.status=u.status,this.dependency=u.dependency,this.index=u.index,this.stepType=u.stepType,this.resourceType=u.resourceType,this.lastEvent=u.lastEvent,this.id=u.id,(a=this.resource)==null||a.setDetails((i=u.resource)==null?void 0:i.details)}}var d9=(d=>(d.Ready="ready",d.Provisioning="provisioning",d.Queued="queued",d.ProvisioningFailed="provisioning-failed",d.Deleting="deleting",d.DeletingFailed="deleting-failed",d.Deleted="deleted",d))(d9||{});class Ad{constructor(u,i,a){_(this,"provisionedBy");_(this,"publicationRun");_(this,"resourceType");_(this,"provider");_(this,"resourceId");_(this,"details",null);_(this,"name",null);_(this,"status","queued");this.publicationRun=u,this.resourceType=i,this.provider=a}setDetails(u){this.details=u}setStatus(u){this.status=u}setProvisionedBy(u){this.provisionedBy=u}}class vDe extends Ad{constructor(i,a,l){super(i,zi.HttpEndpoint,l);_(this,"resourceType",zi.HttpEndpoint);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=n0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class TDe extends Ad{constructor(i,a,l){super(i,zi.ServerlessFunction,l);_(this,"resourceType",zi.ServerlessFunction);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=n0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class u9 extends Ad{constructor(i,a,l){super(i,zi.HttpApi,l);_(this,"resourceType",zi.HttpApi);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=l9(this.publicationRun.project.id),this.resourceId}}class p9 extends Ad{constructor(i,a,l){super(i,zi.RelationalDatabase,l);_(this,"resourceType",zi.RelationalDatabase);_(this,"owners",new Map);_(this,"details",null);_(this,"status","queued");a.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,a;return this.resourceId=n0((a=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:a.id),this.resourceId}}class c9 extends Ad{constructor(i,a){super(i,zi.CloudHostedCodebase,a);_(this,"resourceType",zi.CloudHostedCodebase);_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class f9 extends Ad{constructor(i,a){super(i,zi.CompiledLocalCodebase,a);_(this,"resourceType",zi.CompiledLocalCodebase);_(this,"details",null);_(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class EDe{constructor(u,i){_(this,"id");_(this,"projectAutoIncrementPublicationCount");_(this,"projectPublishedSemanticVersion");_(this,"projectVersion");_(this,"projectId");_(this,"triggeredBy");_(this,"createdAt");_(this,"updatedAt");_(this,"status");_(this,"steps",[]);_(this,"editor");_(this,"explicitResources",new Map);_(this,"implicitGlobalResources",new Map);_(this,"finalGlobalEvent",null);_(this,"finalStatus",null);_(this,"contextType",De.PublicationRun);_(this,"extensionsRegistry");this.id=u.id,this.projectAutoIncrementPublicationCount=u.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=u.projectPublishedSemanticVersion,this.projectVersion=u.projectVersion,this.projectId=u.projectId,this.triggeredBy=u.triggeredBy,this.createdAt=u.createdAt,this.updatedAt=u.updatedAt,this.status=u.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(u){return this.steps.filter(i=>u.includes(i.resourceType))}getStepsTypes(u){return this.steps.filter(i=>u.includes(i.stepType))}toIds(u){return u.map(i=>i.id)}getResourceForEntity(u){const i=Array.from(this.explicitResources.values()).find(a=>a.owners.has(u.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(zi.CompiledLocalCodebase,new f9(this,tf.Amazon)),this.implicitGlobalResources.set(zi.CloudHostedCodebase,new c9(this,tf.Amazon));const u=this.project.entities.filter(a=>ki(a,ce.HTTP_ENDPOINT)),i=this.project.entities.filter(a=>ki(a,ce.RELATIONAL_DATABASE));if(i.length&&i.forEach(a=>{const l=new p9(this,[a],tf.Amazon);this.explicitResources.set(l.resourceId,l)}),u.length){const a=new u9(this,u,tf.Amazon);this.explicitResources.set(a.resourceId,a)}}setSteps(u,i){u.forEach(a=>{this.addStep(a,i)}),this.editor.events.emit(bt.ProjectPublishRequestAcknowledged,{})}addStep(u,i){const a=u.dependency||[];if(a.length){const c=a.filter(e=>!this.steps.find(y=>y.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===u.id)){const c=new o9(u.stepType,u.id,u.resourceType,u.status,a,u.index,i,this,null);this.steps.push(c)}}onUpdate(u){var i;if(Y.log("onUpdate",u),(i=u.payload)!=null&&i.stepType){const a=this.steps.find(l=>{var c;return l.id===((c=u.payload)==null?void 0:c.id)});a&&B(u.emittedAt).isAfter(B(a.lastEventTimestamp))&&a.update(u.payload)}this.editor.events.emit("publication-updated",{}),u.type===SA.Error?(this.finalStatus=XA.Failed,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-error",u)):u.type===SA.Complete&&(this.finalStatus=XA.Success,this.finalGlobalEvent=u.event,this.editor.events.emit("project-publication-completed",u))}requestExtension(u){return this.extensionsRegistry.requestExtension(u)}async initRegistry(){return this.extensionsRegistry=new jA(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(De.PublicationRun),this.extensionsRegistry}}function bDe(d){switch(d){case Qs.CodeCompilation:return"Code generation";case Qs.RelationalDatabaseDeployment:return"Database creation";case Qs.HttpApiDeployment:return"HTTP gateway creation";case Qs.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Qs.BundleCodebase:return"Bundle code";case Qs.MigrateRelationalDatabase:return"Database structure migration";case Qs.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Qs.CodebaseCleanup:return"Code cleanup";case Qs.HttpApiDeletion:return"HTTP gateway deletion";case Qs.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function IDe(d){switch(d){case bt.DeploymentCompleted:return"Successfully published";case bt.DeploymentStarted:return"Publication started";case bt.DeploymentFailed:return"Publication failed";case bt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case bt.RequestPayloadValidationFailed:return"Request payload validation failed";case bt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case bt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case bt.RelationalDatabaseDeploymentStarted:return"Database creation started";case bt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case bt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case bt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case bt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case bt.RelationalDatabaseAlreadyExists:return"Database already exists";case bt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case bt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case bt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case bt.CreatingNewHttpApi:return"Creating new HTTP gateway";case bt.HttpApiAlreadyExists:return"HTTP gateway already exists";case bt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case bt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case bt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case bt.BundlingCodebaseForDownload:return"Bundling code for download";case bt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case bt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case bt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case bt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case bt.CodeCompilationStarted:return"Code generation started";case bt.CodeCompilationCompleted:return"Code generation completed";case bt.CodeCompilationFailed:return"Code generation failed";case bt.BundleCodebaseStarted:return"Code bundling started";case bt.BundleCodebaseCompleted:return"Code bundling completed";case bt.BundleCodebaseFailed:return"Code bundling failed";case bt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case bt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case bt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case bt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case bt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case bt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case bt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case bt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case bt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case bt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case bt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case bt.ProjectNotFound:return"Project not found";case bt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case bt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case bt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case bt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case bt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case bt.RelationalDatabaseDeletionStarted:return"Database deletion started";case bt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case bt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case bt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var y9=(d=>(d.NO_LOGIC="NO_LOGIC",d.NO_NAME="NO_NAME",d.NO_CHANGES="NO_CHANGES",d.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",d))(y9||{});function ADe(d){switch(d){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function wDe(d){switch(d){case zi.RelationalDatabase:return"Relational database";case zi.HttpEndpoint:case zi.HttpApi:return"HTTP endpoints";case zi.ServerlessFunction:case zi.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function RDe(d){switch(d){case Id.Running:return"In progress";case Id.Failed:return"Failed";case Id.Success:return"Succeeded";case Id.Skipped:return"Skipped";case Id.Queued:default:return"Queued"}}function h9(d){var a;if(!ki(d,ce.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=fe["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(d.type===p.BuiltInBaseEntity?ki(d,ce.EXTERNAL_INTEGRATION_CONNECTION)&&(u=QA(d.name)):d.type===p.DefinitionEntity&&d.implements.forEach(l=>{if(ki(l,ce.EXTERNAL_INTEGRATION_CONNECTION)){const c=QA(l==null?void 0:l.name);if(c)return u=c,!0}}),!u){const l=d.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var y;return((y=e.extends)==null?void 0:y.id)===i}));u=(a=l==null?void 0:l.getDefaultValue())==null?void 0:a.value}return u}function CDe(d){return mP[d]}function QA(d){return d.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?d.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function m9(d){if(d.type!==p.ActionDescriptor&&d.type!==p.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(d.type===p.ActionDescriptor){const u=d;if(u.id.startsWith("external-integration--"))return u.id.split("--")[1]}if(d.type===p.Operation){const u=d.declaration;if(Object.values(Gt).includes(u.id))return u.id.split("--")[1]||null}return null}function gDe(d){if(!d)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(ce).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===d.toLowerCase()))||null}function _De(d){return d.type===p.BuiltInBaseEntity||d.type===p.DefinitionEntity?h9(d):d.type===p.ActionDescriptor||d.type===p.Operation?m9(d):null}function v9(d){var l,c,e;if(!ki(d,ce.EXTERNAL_INTEGRATION_CONNECTION))return null;let u=null;const i=Az(d,ce.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const a=fe["built-in-base-entity"][i.id].properties.connectionId.id;if(d.type===p.BuiltInBaseEntity){if(ki(d,ce.EXTERNAL_INTEGRATION_CONNECTION)){const y=d.properties.find(v=>{var T;return((T=v.extends)==null?void 0:T.id)===a});y&&(u=(l=y.getDefaultValue())==null?void 0:l.value)}}else if(d.type===p.DefinitionEntity){const y=d.properties.find(v=>!!v.implements.find(T=>T.id===a)||!!v.implements.find(T=>{var I;return((I=T.extends)==null?void 0:I.id)===a}));if(!y&&((c=d.extends)==null?void 0:c.type)===p.DefinitionEntity)return v9(d.extends);u=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return u}function T9(d){var l;(l=d.dataType)==null||l.validate(),d.inputs.forEach(c=>c.validate()),d.outputs.forEach(c=>c.validate()),d.internalCalls.forEach(c=>c.validate());const i=[...Tl(d),...Od(d),...E9(d),...El(d),...b9(d)],a=Kw(d);return i.push(...a),ji(d.errors,i)}function E9(d,u){const a=[...d.project.getVariableDeclarations()].filter(l=>l.id!==d.id);return fy(d,[Mi],a,u)}function b9(d){const u=[];if(d.parent!==d.project)return u;if(d.catchesError){const i=Dt({id:`${d.id}--${de.GlobalVariableDeclarationCannotCatchError}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:te.Error,code:de.GlobalVariableDeclarationCannotCatchError,entity:d});u.push(i.error)}if(d.errorCalls.length){const i=Dt({id:`${d.id}--${de.GlobalVariableDeclarationCannotCallOnError}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:te.Error,code:de.GlobalVariableDeclarationCannotCallOnError,entity:d});u.push(i.error)}if(d.calledBy.length){const i=Dt({id:`${d.id}--${de.GlobalVariableDeclarationCannotBeCalled}`,message:`${ss[d.type].singular} "${S(d,d.project)}" with id "${d.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:te.Error,code:de.GlobalVariableDeclarationCannotBeCalled,entity:d});u.push(i.error)}return[]}const DDe=Object.freeze(Object.defineProperty({__proto__:null,validate:T9,validateGlobalVariableDeclaration:b9,validateVariableDeclarationName:E9},Symbol.toStringTag,{value:"Module"}));function I9(d){d.inputs.forEach(l=>l.validate()),d.outputs.forEach(l=>l.validate()),d.internalCalls.forEach(l=>l.validate());const i=[...Tl(d),...Od(d),...El(d)],a=Kw(d);return i.push(...a),ji(d.errors,i)}const ODe=Object.freeze(Object.defineProperty({__proto__:null,validate:I9},Symbol.toStringTag,{value:"Module"}));var ew=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(ew||{});const Qt=class Qt extends cr{constructor(i,a){super(i);_(this,"initialData");_(this,"id");_(this,"x");_(this,"y");_(this,"type",p.VariableInstance);_(this,"catchesError",!1);_(this,"defaultValue",null);_(this,"writesValues",[]);_(this,"readsValue",null);_(this,"declaration");_(this,"inputs",[]);_(this,"outputs",[]);_(this,"error",null);_(this,"calledBySuccess",[]);_(this,"calledByError",[]);_(this,"calledByEntry",[]);_(this,"successCalls",[]);_(this,"errorCalls",[]);_(this,"internalCalls",[]);_(this,"project");_(this,"errors",[]);_(this,"parent");_(this,"detachedDependents",{});_(this,"knownVersions",null);_(this,"activeVersion",!1);_(this,"initialized",!1);_(this,"startedInitialization",!1);_(this,"suggestion",!1);_(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:L.UUID.uuid(),version:L.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableInstance,catchesError:!0,declaration:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,a){let l=a;if(i.parent){const V=ie(i.parent);l=a.get(V)}const c=ie(i.declaration),e=a.get(c),y=i.calledByEntry.map(V=>{const M=ie(V);return a.get(M)}),v=i.calledBySuccess.map(V=>{const M=ie(V);return a.get(M)}),T=i.calledByError.map(V=>{const M=ie(V);return a.get(M)});let I=null;if(i.readsValue){const V=ie(i.readsValue);I=a.get(V)}const b={id:i.id,version:L.UUID.uuid(),createdAt:B().toISOString(),author:L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableInstance,catchesError:i.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:v,calledByError:T,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:I,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},D=se(b,a);return D.setParent(l,null),D}static validateGenerationTarget(i,a){let l=JSON.parse(JSON.stringify(i));const c=[],e=Gr(l,{parent:{list:!1,types:[...er,p.Project],optional:!0},declaration:{list:!1,types:[p.VariableDeclaration]}},a);return l=e.modifiedData,c.push(...e.errors,...nr(l)),{errors:c,modifiedData:l}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const a=[];let l=JSON.parse(JSON.stringify(i));const c=Dd(l,this);return l=c.modifiedData,a.push(...c.errors),i.parent&&a.push(new pe({id:`${this.id}--${z.InvalidParentUpdate}`,code:z.InvalidParentUpdate,severity:te.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
|
73
73
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
74
74
|
Specifically for variables, their scope is also calculated from their value readers and value writters.
|
|
75
75
|
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its value readers, value writters, or callers.`})),{errors:a,modifiedData:l}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),l.push(...v.added),c.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,a,l){const c=[],e=[],y=[],v=[];if(a==="parent"){const{updated:T,added:I,removed:b}=this.remove({ignoreUpstream:!1},l);c.push(...T),e.push(...I),y.push(...b)}if(a==="var-declaration"){const{updated:T,added:I,removed:b}=this.remove({ignoreUpstream:!1},l);c.push(...T),e.push(...I),y.push(...b)}return{updated:C(c),added:C(e),removed:C(y),affected:C(v),self:this}}onDetachedDependencyRestored(i,a,l){const c=[],e=[],y=[],v=[];if(a==="parent"){const{updated:T,added:I,removed:b}=this.restore({},l);c.push(...T),e.push(...I),y.push(...b)}if(a==="var-declaration"){const{updated:T,added:I,removed:b}=this.restore({},l);c.push(...T),e.push(...I),y.push(...b)}return{updated:C(c),added:C(e),removed:C(y),affected:C(v),self:this}}unsubscribeFromDependencies(){var i,a,l,c,e,y,v;return(a=(i=this.parent)==null?void 0:i.unsubscribeDependents)==null||a.call(i,[{entity:this,field:"parent"}]),(e=(c=(l=this.declaration.dataType)==null?void 0:l.entity)==null?void 0:c.unsubscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),(v=(y=this.declaration)==null?void 0:y.unsubscribeDependents)==null||v.call(y,[{entity:this,field:"var-declaration"}]),this}subscribeToDependencies(){var i,a,l,c;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),(c=(l=(a=this.declaration.dataType)==null?void 0:a.entity)==null?void 0:l.subscribeDependents)==null||c.call(l,[{entity:this,field:"data-type-entity"}]),this.declaration.subscribeDependents([{entity:this,field:"var-declaration"}]),this}increaseVersion(i){if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&B(i).isSame(B(this.createdAt))?this:(this.previousVersion=this.version,this.version=L.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Qt(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.outputs=[...this.outputs],i.internalCalls=[...this.internalCalls],i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.writesValues=[...this.writesValues],i.readsValue=this.readsValue,i.defaultValue=this.defaultValue,i.declaration=this.declaration,i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.error=this.error,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],l=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),l.push(...y.added),c.push(...y.removed)}return{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}async restoreVersion(i){var v;const a=[],l=[],c=[],e=[];if(this.version===i)return{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this};if(!this.knownVersions){const T=new Map;for(const[I,b]of this.knownVersions||new Map){if(T.set(I,b),b.activeVersion=!1,b.knownVersions)for(const[D,V]of b.knownVersions)T.set(D,V);b.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const T=await this.APILoadVersion({},i);if(!T)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Qt(T,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.outputs=y.outputs,this.internalCalls=y.internalCalls,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.writesValues=y.writesValues,this.readsValue=y.readsValue,this.defaultValue=y.defaultValue,this.declaration=y.declaration,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.calledByEntry=y.calledByEntry,this.error=y.error,this.parent=y.parent,{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,a))return Y.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose(P.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const l=ie(i.parent),c=this.project.get(l),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(a),c)this.setParent(c,a);else throw a==null||a.attemptAutoclose(P.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose(P.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.readsValue){const l=ie(i.readsValue),c=this.project.get(l),e=this.readsValue;e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(a),c&&this.setValueWriter(c,a)}if(i.declaration){const l=ie(i.declaration),c=this.project.get(l);c&&this.setDeclaration(c)}return i.calledByEntry.forEach(l=>{const c=ie(l),e=this.project.get(c);e&&(this.addEntryCaller(e,a),e.addCall(this,a))}),[...this.calledByEntry].forEach(l=>{i.calledByEntry.find(e=>ie(e)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),i.calledBySuccess.forEach(l=>{const c=ie(l),e=this.project.get(c);e&&(this.addSuccessCaller(e,a),e.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(e=>ie(e)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),i.calledByError.forEach(l=>{const c=ie(l),e=this.project.get(c);e&&(this.addErrorCaller(e,a),e.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(e=>ie(e)===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose(P.UpdateWithShallowTransfer,this.id),this}hydrateAncestors(){const i=[],a=[],l=[],c=[];if(this.initialData.parent){const e=ie(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.readsValue){const e=ie(this.initialData.readsValue),y=this.project.get(e);y&&(this.setValueWriter(y,null),i.push(y))}if(this.initialData.declaration){const e=ie(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=ie(e),v=this.project.get(y);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=ie(e),v=this.project.get(y);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(e=>{const y=ie(e),v=this.project.get(y);v&&this.addErrorCaller(v,null)}),{updated:C(i),added:C(a),removed:C(l),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AfterAllChildrenInitialized))){var Ie;if(!this.checkCanEdit(this,i))return Y.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];if(this.initialized=!0,!this.declaration.dataType||(Ie=this.declaration.dataType)!=null&&Ie.inferred){const{added:Ce,updated:je,removed:Ve,affected:xe}=this.declaration.inferDataTypeAndSyncInstancesInputsAndOutputs(i);l.push(...Ce),a.push(...je),c.push(...Ve),e.push(...xe)}const{added:y,updated:v,removed:T,affected:I}=this.syncInputs(i);l.push(...y),a.push(...v),c.push(...T),e.push(...I);const{added:b,updated:D,removed:V,affected:M}=this.syncOutputs(i);l.push(...b),a.push(...D),c.push(...V),e.push(...M);const{added:x,updated:G,removed:W,affected:Z}=this.generateUnusedInternalCalls(i);l.push(...x),a.push(...G),c.push(...W),e.push(...Z);const{added:J,updated:ee,removed:H,affected:oe}=this.removeUnrecognizedInputs(i);l.push(...J),a.push(...ee),c.push(...H),e.push(...oe);const{added:ae,updated:ye,removed:he,affected:Q}=this.removeUnrecognizedOutputs(i);l.push(...ae),a.push(...ye),c.push(...he),e.push(...Q);const{added:ue,updated:Te,removed:_e,affected:$e}=this.removeUnrecognizedInternalCalls(i);return l.push(...ue),a.push(...Te),c.push(..._e),e.push(...$e),this.inputs.sort((Ce,je)=>{var Ve,xe;return(Ce.index??((Ve=Ce.declaration)==null?void 0:Ve.index))-(je.index??((xe=je.declaration)==null?void 0:xe.index))}),this.outputs.sort((Ce,je)=>{var Ve,xe;return(Ce.index??((Ve=Ce.declaration)==null?void 0:Ve.index))-(je.index??((xe=je.declaration)==null?void 0:xe.index))}),this.captureVersion(),i==null||i.attemptAutoclose(P.AfterAllChildrenInitialized,this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){const a=[this],l=[],c=[],e=[];return this.parent===this.project&&this.project.addVariableInstance(this),this.readsValue&&(this.readsValue.addValueReader(this,i),a.push(this.readsValue)),this.writesValues.forEach(y=>{y.setValueWriter(this,i),a.push(y)}),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),a.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),a.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),a.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),a.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),a.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}get usedInputs(){return this.inputs.filter(i=>i.readsValue||i.defaultValue)}get unusedInputs(){return this.inputs.filter(i=>!i.readsValue&&!i.defaultValue)}get usedOutputs(){return this.outputs.filter(i=>i.writesValues.length)}get unusedOutputs(){return this.outputs.filter(i=>!i.writesValues.length)}get usedInternalCalls(){return this.internalCalls.filter(i=>!!i.calledBy.length||!!i.writesValues.length||!!i.successCalls.length||!!i.errorCalls.length)}get unusedInternalCalls(){const i=this.usedInternalCalls;return this.internalCalls.filter(l=>!(i.find(y=>y.id===l.id)||i.find(y=>y.declaration===l.declaration)))}removeInternalCall(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"remove-variable-instance-internal-call"))){const l=this.internalCalls.findIndex(c=>c.id===i.id);return l>-1&&(this.internalCalls.splice(l,1),a&&(a==null||a.add(this,F.Affected))),a==null||a.attemptAutoclose("remove-variable-instance-internal-call",this.id),this}removeInput(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveInput))){if(!this.checkCanEdit(this,a))return Y.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose(P.RemoveInput,this.id),this;const l=this.inputs.findIndex(c=>c.id===i.id);return l>-1&&(this.inputs.splice(l,1),a&&(a==null||a.add(this,F.Affected))),a==null||a.attemptAutoclose(P.RemoveInput,this.id),this}addInput(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddInput))){return this.checkCanEdit(this,a)?this.inputs.includes(i)?(a==null||a.attemptAutoclose(P.AddInput,this.id),this):(this.inputs.push(i),a==null||a.add(this,F.Affected),a==null||a.attemptAutoclose(P.AddInput,this.id),this):(Y.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose(P.AddInput,this.id),this)}addOutput(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"add-output"))){return this.checkCanEdit(this,a)?this.outputs.includes(i)?(a==null||a.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),a==null||a.add(this,F.Affected),a==null||a.attemptAutoclose("add-output",this.id),this):(Y.warn(`[addOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose("add-output",this.id),this)}removeOutput(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this,a))return Y.warn(`[removeOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose("remove-output",this.id),this;const l=this.outputs.findIndex(c=>c.id===i.id);return l>-1&&(this.outputs.splice(l,1),a&&(a==null||a.add(this,F.Affected))),a==null||a.attemptAutoclose("remove-output",this.id),this}addSuccessCaller(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddSuccessCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddSuccessCaller,a)?(this.calledBySuccess.find(c=>c.id===i.id)||(this.calledBySuccess.push(i),a==null||a.add(this,F.Updated),l&&et(this,a)),a==null||a.attemptAutoclose(P.AddSuccessCaller,this.id),this):this}addErrorCaller(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddErrorCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddErrorCaller,a)?(this.calledByError.find(c=>c.id===i.id)||(this.calledByError.push(i),a==null||a.add(this,F.Updated),l&&et(this,a)),a==null||a.attemptAutoclose(P.AddErrorCaller,this.id),this):this}addEntryCaller(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddEntryCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddEntryCaller,a)?(this.calledByEntry.find(c=>c.id===i.id)||(this.calledByEntry.push(i),a==null||a.add(this,F.Updated),l&&et(this,a)),a==null||a.attemptAutoclose(P.AddEntryCaller,this.id),this):this}addErrorCall(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddErrorCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddErrorCall,a)?(this.errorCalls.find(c=>c.id===i.id)||(this.errorCalls.push(i),l&&et(this,a),a==null||a.add(this,F.Affected)),a==null||a.attemptAutoclose(P.AddErrorCall,this.id),this):this}addSuccessCall(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddSuccessCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.AddSuccessCall,a)?(this.successCalls.find(c=>c.id===i.id)||(this.successCalls.push(i),l&&et(this,a),a==null||a.add(this,F.Affected)),a==null||a.attemptAutoclose(P.AddSuccessCall,this.id),this):this}removeCall(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveCall)),l=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,P.RemoveCall,a))return this;const c=this.successCalls.findIndex(y=>y.id===i.id);c>-1&&(this.successCalls.splice(c,1),a==null||a.add(this,F.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),a==null||a.add(this,F.Affected)),l&&et(this,a),a==null||a.attemptAutoclose(P.RemoveCall,this.id),this}removeCaller(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"remove-caller")),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.RemoveCaller,a)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(a==null||a.add(this,F.Updated),a==null||a.add(c,F.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(a==null||a.add(this,F.Updated),a==null||a.add(c,F.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(a==null||a.add(this,F.Updated),a==null||a.add(c,F.Affected),!1)),l&&et(this,a),a==null||a.attemptAutoclose(P.RemoveCaller,this.id),this):this}addValueReader(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.AddValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,P.AddValueReader,a)?this.writesValues.includes(i)?(a==null||a.attemptAutoclose(P.AddValueReader,this.id),this):(this.writesValues.push(i),a==null||a.add(this,F.Affected),this):this}setParent(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.SetParent))){var l;return this.checkCanEditWithCounterpartAndSideEffects(this,i,P.SetParent,a)?(((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,F.Updated))),a==null||a.attemptAutoclose(P.SetParent,this.id),this):this}initChildren(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=se(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.declaration.type===p.GenericReference){const a=this.project.findSubscribedInstanceFromReference(this.initialData.declaration);if(!a)return this;this.declaration=a}else this.declaration=se(this.initialData.declaration,this.project),this.declaration.initChildren(i);return wy.initWritesValues(this,this.parent),Ld.initReadsValue(this),this.initialData.inputs.forEach(a=>{const l=se(a,this.project);return l.setParent(this,null),l.initChildren(i),this.addInput(l,null),l}),this.initialData.outputs.forEach(a=>{const l=se(a,this.project);return l.setParent(this,null),l.initChildren(i),this.addOutput(l,i),l}),this.successCalls=this.initialData.successCalls.map(a=>{const l=se(a,this.project);if(l.addSuccessCaller(this,null),[p.BreakStatement,p.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===p.ReturnStatement){const c=gr(this,this.project);l.setParent(c,null),l.initChildren(i)}else l.type!==p.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.errorCalls=this.initialData.errorCalls.map(a=>{const l=se(a,this.project);if(l.addErrorCaller(this,null),[p.BreakStatement,p.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===p.ReturnStatement){const c=gr(this,this.project);l.setParent(c,null),l.initChildren(i)}else l.type!==p.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.internalCalls=this.initialData.internalCalls.reduce((a,l)=>{if(l.type===p.GenericReference){const c=this.project.findSubscribedInstanceFromReference(l);if(!c)return a;const e=c;return e.setParent(this,null),[...a,e]}else{const c=se(l,this.project);return c.setParent(this,null),c.initChildren(i),[...a,c]}},[]),this.initialData.error&&(this.error=se(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(i)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}setValueWriter(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.SetValueWriter))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,P.SetValueWriter,a)?(this.readsValue!==i&&(this.readsValue=i,a==null||a.add(this,F.Updated)),a==null||a.attemptAutoclose(P.SetValueWriter,this.id),this):this}removeValueWriter(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveValueWriter))){return this.readsValue&&!this.checkCanEditWithCounterpartAndSideEffects(this,this.readsValue,P.RemoveValueWriter,i)?this:(this.readsValue&&(this.readsValue=null,i==null||i.add(this,F.Updated)),i==null||i.attemptAutoclose(P.RemoveValueWriter,this.id),this)}removeValueReader(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,P.RemoveValueReader,a)?this.writesValues.includes(i)?(this.writesValues=this.writesValues.filter(l=>l.id!==i.id),a==null||a.add(this,F.Affected),this):(a==null||a.attemptAutoclose(P.RemoveValueReader,this.id),this):this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const l=ar(this,i,a),c=sr(this,l),e=this.toMeta();return this.x=l.x||e.x,this.y=l.y||e.y,this.catchesError=l.catchesError!==void 0?l.catchesError:this.catchesError,super.baseMetaSync(l,this,a),l.deleted===!0&&!e.deleted?a==null||a.add(this,F.Removed):l.deleted===!1&&e.deleted?a==null||a.add(this,F.Added):c&&(a==null||a.add(this,F.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=we,...a){return await Qt.repository.APILoad(this.id,...a),this}async APICreate(i=we,...a){return await Qt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=we,...a){return await Qt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=we,...a){return await Qt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=we,...a){return await Qt.repository.APIClone(this.id,...a),this}async APILoadVersion(i=we,a,...l){return await Qt.repository.APILoadVersion(this.id,a,...l)}removeFromParent(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveFromParent))){if(!this.checkCanEdit(this,i))return Y.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];return this.parent.type===p.Project?(this.parent.removeVariableInstance(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(P.RemoveFromParent,this.id),{added:C(c),updated:C(a),removed:C(l),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveEntity))){var v;if(!this.checkCanDelete(this,a))return Y.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),a==null||a.event({id:`${P.RemoveEntity}-${this.id}`,action:P.RemoveEntity,owner:this,errorReason:Ui.ActionOwnerEntityNonDeletable,rootAction:((v=a==null?void 0:a.self)==null?void 0:v.id)===this.id&&(a==null?void 0:a.autoCloseActionName)===P.RemoveEntity}),a==null||a.attemptAutoclose(P.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[],c=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose(P.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(T=>{const{updated:I,removed:b,added:D}=T.entity.onDetachedDependencyRemoved(this,T.field,a);l.push(...I),c.push(...b),e.push(...D)}),this.defaultValue){const{updated:T,removed:I}=this.defaultValue.remove({ignoreUpstream:!0},a);l.push(...T),c.push(...I)}if(this.readsValue&&(l.push(this.readsValue),this.readsValue.removeValueReader(this,a)),this.writesValues.forEach(T=>{l.push(T),T.setValueWriter(null,a)}),this.inputs.forEach(T=>{const{updated:I,removed:b}=T.remove({ignoreUpstream:!0},a);l.push(...I),c.push(...b)}),this.outputs.forEach(T=>{const{updated:I,removed:b}=T.remove({ignoreUpstream:!0},a);l.push(...I),c.push(...b)}),this.successCalls.forEach(T=>{l.push(T),T.removeCaller(this,a)}),this.errorCalls.forEach(T=>{l.push(T),T.removeCaller(this,a)}),this.internalCalls.forEach(T=>{const{updated:I,removed:b}=T.remove({ignoreUpstream:!0},a);l.push(...I),c.push(...b)}),!i){const T=this.removeFromParent(a);e.push(...T.added),l.push(...T.updated),c.push(...T.removed),y.push(...T.affected),this.calledBy.forEach(I=>{l.push(I),I.removeCall(this,a)})}return a==null||a.attemptAutoclose(P.RemoveEntity,this.id),{added:C(e),updated:C(l),removed:C(c),affected:C(y),self:this}}restore({}={},i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RestoreEntity))){if(!this.checkCanEdit(this,i))return Y.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(P.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:v,removed:T,added:I}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...v),c.push(...T),a.push(...I)}),this.defaultValue){const{updated:y}=this.defaultValue.restore({},i);l.push(...y)}return this.readsValue&&(l.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.writesValues.forEach(y=>{l.push(y),y.setValueWriter(this,i)}),this.inputs.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.outputs.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.successCalls.forEach(y=>{l.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{l.push(y),y.addErrorCaller(this,i)}),this.internalCalls.forEach(y=>{const{updated:v}=y.restore({},i);l.push(...v)}),this.calledBySuccess.forEach(y=>{l.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{l.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{l.push(y),y.addCall(this,i)}),i==null||i.attemptAutoclose(P.RestoreEntity,this.id),{added:C(a),updated:C(l),removed:C(c),affected:C(e),self:this}}toFlat(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this,...((l=this.defaultValue)==null?void 0:l.toFlat(i))||[],...this.writesValues.flatMap(e=>e.toFlat(i)),...((c=this.readsValue)==null?void 0:c.toFlat(i))||[],...this.successCalls.flatMap(e=>e.toFlat(i)),...this.errorCalls.flatMap(e=>e.toFlat(i)),...this.inputs.flatMap(e=>e.toFlat(i)),...this.outputs.flatMap(e=>e.toFlat(i)),...this.internalCalls.flatMap(e=>e.toFlat(i))])}toFlatIds(i=new Set){var l;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((l=this.defaultValue)==null?void 0:l.toFlatIds(i))||[],...this.writesValues.flatMap(c=>c.toFlatIds(i)),...this.successCalls.flatMap(c=>c.toFlatIds(i)),...this.errorCalls.flatMap(c=>c.toFlatIds(i)),...this.inputs.flatMap(c=>c.toFlatIds(i)),...this.outputs.flatMap(c=>c.toFlatIds(i)),...this.internalCalls.flatMap(c=>c.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,catchesError:this.catchesError,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,x:this.x,y:this.y,type:this.type,editable:this.editable,deletable:this.deletable}}toJSON(i=new Set){var a,l,c;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,declaration:this.declaration.toJSON(i),defaultValue:((a=this.defaultValue)==null?void 0:a.toJSON(i))||null,readsValue:((l=this.readsValue)==null?void 0:l.toReference())||null,writesValues:this.writesValues.map(e=>e.toJSON(i)),inputs:this.inputs.map(e=>e.toJSON(i)),outputs:this.outputs.map(e=>e.toJSON(i)),successCalls:this.successCalls.map(e=>e.toJSON(i)),errorCalls:this.errorCalls.map(e=>e.toJSON(i)),internalCalls:this.internalCalls.map(e=>e.toJSON(i)),calledBySuccess:this.calledBySuccess.map(e=>e.toReference()),calledByError:this.calledByError.map(e=>e.toReference()),calledByEntry:this.calledByEntry.map(e=>e.toReference()),parent:this.parent.toReference(),error:((c=this.error)==null?void 0:c.toJSON(i))||null,x:this.x,y:this.y})}toJSONClone(i=He){var l,c,e,y,v,T,I,b;let a;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||yr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(c=i.seenEntities)!=null&&c.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:L.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,defaultValue:((T=this.defaultValue)==null?void 0:T.toJSONClone({...i,newId:null}))||null,declaration:this.declaration.toReference({seenEntityMaps:i.seenEntityMaps}),readsValue:((I=this.readsValue)==null?void 0:I.toReference({seenEntityMaps:i.seenEntityMaps}))||null,writesValues:this.writesValues.map(D=>D.toJSONClone({...i,newId:null})),inputs:this.inputs.map(D=>D.toJSONClone({...i,newId:null})),outputs:this.outputs.map(D=>D.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(D=>D.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(D=>D.toJSONClone({...i,newId:null})),internalCalls:this.internalCalls.map(D=>this.calledBy.length||this.readsValue?D.toJSONClone({...i,newId:null}):D.toReference({seenEntityMaps:i.seenEntityMaps})),calledBySuccess:this.calledBySuccess.map(D=>D.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(D=>D.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(D=>D.toReference({seenEntityMaps:i.seenEntityMaps})),error:((b=this.error)==null?void 0:b.toJSONClone({...i,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps}),x:this.x,y:this.y})}toReference(i=He){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+L.UUID.uuid()+"--ref",type:p.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=He){var l,c,e,y,v;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,x:this.x,y:this.y,defaultValue:((c=this.defaultValue)==null?void 0:c.toReference(i))||null,declaration:((e=this.declaration)==null?void 0:e.toReference(i))||null,readsValue:((y=this.readsValue)==null?void 0:y.toReference(i))||null,writesValues:this.writesValues.map(T=>T.toReference(i)),inputs:this.inputs.map(T=>T.toReference(i)),outputs:this.outputs.map(T=>T.toReference(i)),successCalls:this.successCalls.map(T=>T.toReference(i)),errorCalls:this.errorCalls.map(T=>T.toReference(i)),calledBySuccess:this.calledBySuccess.map(T=>T.toReference(i)),calledByError:this.calledByError.map(T=>T.toReference(i)),calledByEntry:this.calledByEntry.map(T=>T.toReference(i)),internalCalls:this.internalCalls.map(T=>T.toReference(i)),error:((v=this.error)==null?void 0:v.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((l=this.defaultValue)==null?void 0:l.toFlatJSON(i))||[],...((c=this.declaration)==null?void 0:c.toFlatJSON(i))||[],...this.writesValues.flatMap(e=>e.toFlatJSON(i)),...this.successCalls.flatMap(e=>e.toFlatJSON(i)),...this.errorCalls.flatMap(e=>e.toFlatJSON(i)),...this.inputs.flatMap(e=>e.toFlatJSON(i)),...this.outputs.flatMap(e=>e.toFlatJSON(i)),...this.internalCalls.flatMap(e=>e.toFlatJSON(i)),...this.calledBy.flatMap(e=>e.toFlatJSON(i))])}toGenerationTarget(){const i=this.parent.type===p.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(a=>a.id),calledBySuccess:this.calledBySuccess.map(a=>a.id),calledByError:this.calledByError.map(a=>a.id),parent:i}}toFlatGenerationTarget(i=new Set){var l,c,e;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((l=this.defaultValue)==null?void 0:l.toFlatGenerationTarget(i))||[],...((c=this.declaration)==null?void 0:c.toFlatGenerationTarget(i))||[],...((e=this.readsValue)==null?void 0:e.toFlatGenerationTarget(i))||[],...this.writesValues.flatMap(y=>y.toFlatGenerationTarget(i)),...this.successCalls.flatMap(y=>y.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(y=>y.toFlatGenerationTarget(i)),...this.inputs.flatMap(y=>y.toFlatGenerationTarget(i)),...this.outputs.flatMap(y=>y.toFlatGenerationTarget(i)),...this.internalCalls.flatMap(y=>y.toFlatGenerationTarget(i))])}clearErrors(){var i;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),this.inputs.forEach(a=>a.clearErrors()),this.outputs.forEach(a=>a.clearErrors()),this.successCalls.forEach(a=>a.clearErrors()),this.errorCalls.forEach(a=>a.clearErrors()),this.internalCalls.forEach(a=>a.clearErrors()),this}validate(){const i=I9(this);return this.errors=i,{success:!0}}getErrors(){var a,l;return[...this.errors,...((a=this.defaultValue)==null?void 0:a.getErrors())||[],...this.inputs.flatMap(c=>c.getErrors()),...this.internalCalls.flatMap(c=>c.getErrors()),...this.outputs.flatMap(c=>c.getErrors()),...((l=this.readsValue)==null?void 0:l.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.defaultValue)||null}setDefaultValue(i,a=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this,a))return Y.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),a==null||a.attemptAutoclose("set-default-value",this.id),this;const l=this.defaultValue;return(l==null?void 0:l.id)!==(i==null?void 0:i.id)&&(l==null||l.remove({ignoreUpstream:!0},a),this.defaultValue=i,a==null||a.add(this,F.Affected)),a==null||a.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.CloneEntity)),a=null,l=null,c=!0){var M,x,G,W;let e=fr(a,this);const y=this.toJSON(),v=l||L.UUID.uuid();y.inputs=[],y.id=v,y.version=L.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1,y.deletable=!0,y.editable=!0;const T=gi(y,e);a?T.setParent(a,null):T.setParent(this.parent,null),c&&T.subscribe(),T.initChildren(i),i==null||i.add(T,F.Added);const I=(M=this.defaultValue)==null?void 0:M.clone(i,T,L.UUID.uuid(),c);T.defaultValue=I||null;const b=(x=this.inputs)==null?void 0:x.map(Z=>Z.clone(i,T,L.UUID.uuid(),c));T.inputs=b;const D=(G=this.outputs)==null?void 0:G.map(Z=>Z.clone(i,T,L.UUID.uuid(),c));T.outputs=D;const V=(W=this.internalCalls)==null?void 0:W.map(Z=>Z.clone(i,T,L.UUID.uuid(),c));return T.internalCalls=V,i==null||i.attemptAutoclose(P.CloneEntity,this.id),T}addInternalCall(i){return this.internalCalls.find(a=>a===i)||this.internalCalls.push(i),this}setDeclaration(i){return this.declaration!==i&&(this.declaration=i),this}removeUnrecognizedInputs(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return Y.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.inputs].forEach(y=>{const v=y.remove({ignoreUpstream:!1},i);c.push(...v.removed),a.push(...v.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.inputs].forEach(y=>{var T;if(!y.declaration){const I=y.remove({ignoreUpstream:!1},i);c.push(...I.removed),a.push(...I.updated);return}if(![...((T=this.declaration.dataType)==null?void 0:T.entity).allProperties].find(I=>y.declaration===I)){const I=y.remove({ignoreUpstream:!1},i);c.push(...I.removed),a.push(...I.updated)}}),i==null||i.attemptAutoclose(P.RemoveUnrecognizedInputs,this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}removeUnrecognizedOutputs(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"remove-unrecognized-variable-instance-outputs"))){if(!this.checkCanEdit(this,i))return Y.warn(`[removeUnrecognizedOutputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.RemoveUnrecognizedOutputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.outputs].forEach(y=>{const v=y.remove({ignoreUpstream:!1},i);c.push(...v.removed),a.push(...v.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.outputs].forEach(y=>{var T;if(!y.declaration){const I=y.remove({ignoreUpstream:!1},i);c.push(...I.removed),a.push(...I.updated);return}if(![...((T=this.declaration.dataType)==null?void 0:T.entity).allProperties].find(I=>y.declaration===I)){const I=y.remove({ignoreUpstream:!1},i);c.push(...I.removed),a.push(...I.updated)}}),i==null||i.attemptAutoclose("remove-unrecognized-variable-instance-outputs",this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}removeUnrecognizedInternalCalls(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"remove-unrecognized-variable-declaration-internal-calls"))){const a=[],l=[],c=[],e=[];if(!this.declaration.dataType||!this.declaration.dataType.entity||![p.DefinitionEntity,p.PrimitiveEntity,p.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))[...this.internalCalls].forEach(v=>{const T=v.remove({ignoreUpstream:!1},i);c.push(...T.removed),a.push(...T.updated)});else if(this.declaration.dataType&&this.declaration.dataType.entity&&[p.DefinitionEntity,p.PrimitiveEntity,p.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)){const v=[...this.declaration.dataType.entity.getAllInteractiveMethods()],T=[...v].filter(I=>!v.some(b=>{var D,V;return b.id!==I.id&&(((D=b.implements)==null?void 0:D.id)===I.id||((V=b.extends)==null?void 0:V.id)===I.id)})&&!I.deleted);[...this.internalCalls].forEach(I=>{if(!I.declaration){const D=I.remove({ignoreUpstream:!1},i);c.push(...D.removed),a.push(...D.updated);return}if(!T.find(D=>I.declaration===D)){const D=I.remove({ignoreUpstream:!1},i);c.push(...D.removed),a.push(...D.updated);return}})}return this.internalCalls.filter((v,T)=>{const I=this.internalCalls.findIndex(D=>D.declaration===v.declaration&&D!==v);if(I===-1)return!1;const b=this.internalCalls[I];return B(b==null?void 0:b.createdAt).isSame(B(v.createdAt))?T>I:!!B(b==null?void 0:b.createdAt).isAfter(v.createdAt)}).forEach(v=>{const T=v.remove({ignoreUpstream:!1},i);c.push(...T.removed),a.push(...T.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-variable-declaration-internal-calls",this.id),{updated:C(a),added:C(l),removed:C(c),affected:C(e),self:this}}syncInputs(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"sync-variable-instance-inputs"))){const a=[],l=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([p.DefinitionEntity,p.PrimitiveEntity,p.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.properties];y.filter(b=>!b.getDataType(i)).forEach(b=>{const D=this.inputs.find(x=>S(x,this.project)===S(b,this.project));if(!D)return;const V=this.declaration.getMasterInputWithValueWritterFromAllInstances(D);if(!V)return;const M=_a(V);b.setDataType(M,i),D.setDeclaration(b,i)}),y.filter(b=>!this.inputs.find(D=>{var V;return((V=D.declaration)==null?void 0:V.id)===b.id})).forEach(b=>{const D={id:L.UUID.uuid(),version:L.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.InputMap,parentRelationType:null,parent:this.toReference(),name:null,description:null,codeName:null,declaration:b,defaultValue:null,index:b.index,readsValue:null},V=se(D,this.project);return V.setParent(this,i),V.initChildren(i),i==null||i.add(V,F.Added),this.addInput(V,i),V}),this.inputs.filter(b=>!b.declaration).forEach(b=>{const D=y.find(V=>S(V,this.project)===S(b,this.project));D&&b.setDeclaration(D,i)})}}else return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:C(a),updated:C(l),removed:C(c),affected:C(e),self:this}}syncOutputs(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,P.SyncOutputs))){if(!this.checkCanEdit(this,i))return Y.warn(`[syncOutputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(P.SyncOutputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const a=[],l=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity)[p.DefinitionEntity,p.PrimitiveEntity,p.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList&&[...this.declaration.dataType.entity.properties].filter(T=>!this.outputs.find(I=>I.declaration===T)).map(T=>{const I={id:L.UUID.uuid(),version:L.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.OutputMap,parent:this.toReference(),declaration:T,index:T.index,writesValues:[]},b=se(I,this.project);return b.setParent(this,i),b.initChildren(i),i==null||i.add(b,F.Added),this.addOutput(b,i),b});else return i==null||i.attemptAutoclose(P.SyncOutputs,this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose(P.SyncOutputs,this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose(P.SyncOutputs,this.id),{added:C(a),updated:C(l),removed:C(c),affected:C(e),self:this}}generateUnusedInternalCalls(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"generate-unused-internal-calls"))){const a=[],l=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([p.DefinitionEntity,p.PrimitiveEntity,p.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.getAllInteractiveMethods()];[...y].filter(I=>!y.some(b=>{var D,V;return b.id!==I.id&&(((D=b.implements)==null?void 0:D.id)===I.id||((V=b.extends)==null?void 0:V.id)===I.id)})&&!I.deleted).filter(I=>!this.internalCalls.find(D=>{var M,x,G,W,Z;return(((M=D.declaration)==null?void 0:M.id)||((G=(x=D.initialData)==null?void 0:x.declaration)==null?void 0:G.entityId)||((Z=(W=D.initialData)==null?void 0:W.declaration)==null?void 0:Z.id))===I.id})).forEach(I=>{const b=this.internalCalls.find(D=>{const V=Nd(D.declaration),M=Nd(I);return V.id===M.id});if(b)b.setDeclaration(I),b.subscribeToDependencies();else{const D=I.createInternalCall(i,this);i==null||i.add(D,F.Added),this.addInternalCall(D)}})}}else return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:C(a),updated:C(l),removed:C(c),affected:C(e),self:this}}getDataType(i=this.project.addChangeSet(new k(this.project,L.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var l;const a=((l=this.declaration)==null?void 0:l.getDataType(i))||null;return i==null||i.attemptAutoclose("get-data-type",this.id),a}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return this.outputs.filter(i=>i.suggestion||!i.writesValues.length)}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return this.outputs.filter(i=>!i.suggestion&&i.writesValues.length)}};_(Qt,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...l)=>null}),_(Qt,"type",p.VariableInstance),_(Qt,"USER_MANAGED_PARENT_TYPES",[...er,p.Project]),_(Qt,"PARENT_TYPES",[...Qt.USER_MANAGED_PARENT_TYPES]),_(Qt,"MUTABLE_BASE_PROPERTIES",["catchesError"]),_(Qt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),_(Qt,"BASE_PROPERTIES",[...Qt.MUTABLE_BASE_PROPERTIES,...Qt.INMUTABLE_BASE_PROPERTIES]),_(Qt,"MUTABLE_META_PROPERTIES",[...Qt.MUTABLE_BASE_PROPERTIES,"x","y"]),_(Qt,"INMUTABLE_META_PROPERTIES",[...Qt.INMUTABLE_BASE_PROPERTIES]),_(Qt,"META_PROPERTIES",[...Qt.MUTABLE_META_PROPERTIES,...Qt.INMUTABLE_META_PROPERTIES]),_(Qt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),_(Qt,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),_(Qt,"UPSTREAM_PROPERTIES",[...Qt.MUTABLE_UPSTREAM_PROPERTIES,...Qt.INMUTABLE_UPSTREAM_PROPERTIES]),_(Qt,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),_(Qt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),_(Qt,"DOWNSTREAM_PROPERTIES",[...Qt.MUTABLE_DOWNSTREAM_PROPERTIES,...Qt.INMUTABLE_DOWNSTREAM_PROPERTIES]),_(Qt,"PROPERTIES",[...Qt.META_PROPERTIES,...Qt.UPSTREAM_PROPERTIES,...Qt.DOWNSTREAM_PROPERTIES]);let uo=Qt;var A9=(d=>(d.Parent="variable-declaration-parent",d.DataTypeEntity="variable-declaration-data-type-entity",d.DataType="variable-declaration-data-type",d))(A9||{});const ei=class ei extends cr{constructor(i,a){super(i);_(this,"initialData");_(this,"id");_(this,"name");_(this,"codeName",null);_(this,"description",null);_(this,"required",!1);_(this,"constant",!1);_(this,"x");_(this,"y");_(this,"type",p.VariableDeclaration);_(this,"catchesError",!1);_(this,"defaultValue",null);_(this,"dataType",null);_(this,"writesValues",[]);_(this,"readsValue",null);_(this,"inputs",[]);_(this,"outputs",[]);_(this,"error",null);_(this,"calledBySuccess",[]);_(this,"calledByError",[]);_(this,"calledByEntry",[]);_(this,"successCalls",[]);_(this,"errorCalls",[]);_(this,"internalCalls",[]);_(this,"parent");_(this,"errors",[]);_(this,"project");_(this,"detachedDependents",{});_(this,"knownVersions",null);_(this,"activeVersion",!1);_(this,"initialized",!1);_(this,"startedInitialization",!1);_(this,"suggestion",!1);_(this,"codeNativeValueValidation",null);this.initialData=i,this.project=a,this.id=i.id,this.name=i.name,this.description=i.description,this.constant=i.constant,this.codeName=i.codeName,this.required=i.required,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:L.UUID.uuid(),version:L.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableDeclaration,catchesError:!0,name:"",codeName:null,description:"",dataType:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,constant:!1,required:!1,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,a){let l=a;if(i.parent){const b=ie(i.parent);l=a.get(b)}const c=i.calledByEntry.map(b=>{const D=ie(b);return a.get(D)}),e=i.calledBySuccess.map(b=>{const D=ie(b);return a.get(D)}),y=i.calledByError.map(b=>{const D=ie(b);return a.get(D)});let v=null;if(i.readsValue){const b=ie(i.readsValue);v=a.get(b)}const T={id:i.id,version:L.UUID.uuid(),createdAt:B().toISOString(),author:L.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:p.VariableDeclaration,catchesError:i.catchesError||!1,name:i.name,defaultValue:null,codeName:i.codeName||null,description:i.description||null,constant:i.constant||!1,required:i.required||!1,calledByEntry:c,calledBySuccess:e,calledByError:y,dataType:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:v,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},I=se(T,a);return I.setParent(l,null),I}static validateGenerationTarget(i,a){let l=JSON.parse(JSON.stringify(i));const c=[],e=Gr(l,{parent:{list:!1,types:[...er,p.Project],optional:!0}},a);l=e.modifiedData;const y=mR(l,a);return c.push(...e.errors,...y,...nr(l)),{errors:c,modifiedData:l}}get variableInstances(){const i=[];return Object.values(this.detachedDependents).forEach(a=>{a.field===ew.VarDeclaration&&!i.includes(a.entity)&&i.push(a.entity)}),i}validateGeneratedUpdate(i){const a=[];let l=JSON.parse(JSON.stringify(i));const c=Dd(l,this);return l=c.modifiedData,a.push(...c.errors),i.parent&&a.push(new pe({id:`${this.id}--${z.InvalidParentUpdate}`,code:z.InvalidParentUpdate,severity:te.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyx-code/project-logic-tree",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6603",
|
|
4
4
|
"author": "Sergio Herrero",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "An installable module which contains the type definitions and ephemeral state management for a projects' logic tree data structure",
|