@elyx-code/project-logic-tree 0.0.6750 → 0.0.6751
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.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -89,7 +89,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
|
|
|
89
89
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(p){return p instanceof this?p:new this(p)}static concat(p,...i){const n=new this(p);return i.forEach(s=>n.set(s)),n}static accessor(p){const n=(this[C4]=this[C4]={accessors:{}}).accessors,s=this.prototype;function c(e){const y=j0(e);n[y]||(lbi(s,e),n[y]=!0)}return Ue.isArray(p)?p.forEach(c):c(p),this}}XI.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ue.reduceDescriptors(XI.prototype,({value:o},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>o,set(n){this[i]=n}}});Ue.freezeMethods(XI);const bl=XI;function gO(o,p){const i=this||uN,n=p||i,s=bl.from(n.headers);let c=n.data;return Ue.forEach(o,function(y){c=y.call(i,c,s.normalize(),p?p.status:void 0)}),s.normalize(),c}function jxe(o){return!!(o&&o.__CANCEL__)}function Bh(o,p,i){si.call(this,o??"canceled",si.ERR_CANCELED,p,i),this.name="CanceledError"}Ue.inherits(Bh,si,{__CANCEL__:!0});function Uxe(o,p,i){const n=i.config.validateStatus;!i.status||!n||n(i.status)?o(i):p(new si("Request failed with status code "+i.status,[si.ERR_BAD_REQUEST,si.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function obi(o){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return p&&p[1]||""}function dbi(o,p){o=o||10;const i=new Array(o),n=new Array(o);let s=0,c=0,e;return p=p!==void 0?p:1e3,function(m){const v=Date.now(),E=n[c];e||(e=v),i[s]=m,n[s]=v;let b=c,w=0;for(;b!==s;)w+=i[b++],b=b%o;if(s=(s+1)%o,s===c&&(c=(c+1)%o),v-e<p)return;const V=E&&v-E;return V?Math.round(w*1e3/V):void 0}}function ubi(o,p){let i=0,n=1e3/p,s,c;const e=(v,E=Date.now())=>{i=E,s=null,c&&(clearTimeout(c),c=null),o(...v)};return[(...v)=>{const E=Date.now(),b=E-i;b>=n?e(v,E):(s=v,c||(c=setTimeout(()=>{c=null,e(s)},n-b)))},()=>s&&e(s)]}const vA=(o,p,i=3)=>{let n=0;const s=dbi(50,250);return ubi(c=>{const e=c.loaded,y=c.lengthComputable?c.total:void 0,m=e-n,v=s(m),E=e<=y;n=e;const b={loaded:e,total:y,progress:y?e/y:void 0,bytes:m,rate:v||void 0,estimated:v&&y&&E?(y-e)/v:void 0,event:c,lengthComputable:y!=null,[p?"download":"upload"]:!0};o(b)},i)},_4=(o,p)=>{const i=o!=null;return[n=>p[0]({lengthComputable:i,total:o,loaded:n}),p[1]]},V4=o=>(...p)=>Ue.asap(()=>o(...p)),pbi=ra.hasStandardBrowserEnv?((o,p)=>i=>(i=new URL(i,ra.origin),o.protocol===i.protocol&&o.host===i.host&&(p||o.port===i.port)))(new URL(ra.origin),ra.navigator&&/(msie|trident)/i.test(ra.navigator.userAgent)):()=>!0,cbi=ra.hasStandardBrowserEnv?{write(o,p,i,n,s,c,e){if(typeof document>"u")return;const y=[`${o}=${encodeURIComponent(p)}`];Ue.isNumber(i)&&y.push(`expires=${new Date(i).toUTCString()}`),Ue.isString(n)&&y.push(`path=${n}`),Ue.isString(s)&&y.push(`domain=${s}`),c===!0&&y.push("secure"),Ue.isString(e)&&y.push(`SameSite=${e}`),document.cookie=y.join("; ")},read(o){if(typeof document>"u")return null;const p=document.cookie.match(new RegExp("(?:^|; )"+o+"=([^;]*)"));return p?decodeURIComponent(p[1]):null},remove(o){this.write(o,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function fbi(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function ybi(o,p){return p?o.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):o}function Kxe(o,p,i){let n=!fbi(p);return o&&(n||i==!1)?ybi(o,p):p}const P4=o=>o instanceof bl?{...o}:o;function Cc(o,p){p=p||{};const i={};function n(v,E,b,w){return Ue.isPlainObject(v)&&Ue.isPlainObject(E)?Ue.merge.call({caseless:w},v,E):Ue.isPlainObject(E)?Ue.merge({},E):Ue.isArray(E)?E.slice():E}function s(v,E,b,w){if(Ue.isUndefined(E)){if(!Ue.isUndefined(v))return n(void 0,v,b,w)}else return n(v,E,b,w)}function c(v,E){if(!Ue.isUndefined(E))return n(void 0,E)}function e(v,E){if(Ue.isUndefined(E)){if(!Ue.isUndefined(v))return n(void 0,v)}else return n(void 0,E)}function y(v,E,b){if(b in p)return n(v,E);if(b in o)return n(void 0,v)}const m={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:(v,E,b)=>s(P4(v),P4(E),b,!0)};return Ue.forEach(Object.keys({...o,...p}),function(E){const b=m[E]||s,w=b(o[E],p[E],E);Ue.isUndefined(w)&&b!==y||(i[E]=w)}),i}const Fxe=o=>{const p=Cc({},o);let{data:i,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:c,headers:e,auth:y}=p;if(p.headers=e=bl.from(e),p.url=Bxe(Kxe(p.baseURL,p.url,p.allowAbsoluteUrls),o.params,o.paramsSerializer),y&&e.set("Authorization","Basic "+btoa((y.username||"")+":"+(y.password?unescape(encodeURIComponent(y.password)):""))),Ue.isFormData(i)){if(ra.hasStandardBrowserEnv||ra.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if(Ue.isFunction(i.getHeaders)){const m=i.getHeaders(),v=["content-type","content-length"];Object.entries(m).forEach(([E,b])=>{v.includes(E.toLowerCase())&&e.set(E,b)})}}if(ra.hasStandardBrowserEnv&&(n&&Ue.isFunction(n)&&(n=n(p)),n||n!==!1&&pbi(p.url))){const m=s&&c&&cbi.read(c);m&&e.set(s,m)}return p},hbi=typeof XMLHttpRequest<"u",mbi=hbi&&function(o){return new Promise(function(i,n){const s=Fxe(o);let c=s.data;const e=bl.from(s.headers).normalize();let{responseType:y,onUploadProgress:m,onDownloadProgress:v}=s,E,b,w,V,$;function M(){V&&V(),$&&$(),s.cancelToken&&s.cancelToken.unsubscribe(E),s.signal&&s.signal.removeEventListener("abort",E)}let k=new XMLHttpRequest;k.open(s.method.toUpperCase(),s.url,!0),k.timeout=s.timeout;function F(){if(!k)return;const Y=bl.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),ee={data:!y||y==="text"||y==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:Y,config:o,request:k};Uxe(function(ae){i(ae),M()},function(ae){n(ae),M()},ee),k=null}"onloadend"in k?k.onloadend=F:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(F)},k.onabort=function(){k&&(n(new si("Request aborted",si.ECONNABORTED,o,k)),k=null)},k.onerror=function(ie){const ee=ie&&ie.message?ie.message:"Network Error",de=new si(ee,si.ERR_NETWORK,o,k);de.event=ie||null,n(de),k=null},k.ontimeout=function(){let ie=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const ee=s.transitional||Gxe;s.timeoutErrorMessage&&(ie=s.timeoutErrorMessage),n(new si(ie,ee.clarifyTimeoutError?si.ETIMEDOUT:si.ECONNABORTED,o,k)),k=null},c===void 0&&e.setContentType(null),"setRequestHeader"in k&&Ue.forEach(e.toJSON(),function(ie,ee){k.setRequestHeader(ee,ie)}),Ue.isUndefined(s.withCredentials)||(k.withCredentials=!!s.withCredentials),y&&y!=="json"&&(k.responseType=s.responseType),v&&([w,$]=vA(v,!0),k.addEventListener("progress",w)),m&&k.upload&&([b,V]=vA(m),k.upload.addEventListener("progress",b),k.upload.addEventListener("loadend",V)),(s.cancelToken||s.signal)&&(E=Y=>{k&&(n(!Y||Y.type?new Bh(null,o,k):Y),k.abort(),k=null)},s.cancelToken&&s.cancelToken.subscribe(E),s.signal&&(s.signal.aborted?E():s.signal.addEventListener("abort",E)));const K=obi(s.url);if(K&&ra.protocols.indexOf(K)===-1){n(new si("Unsupported protocol "+K+":",si.ERR_BAD_REQUEST,o));return}k.send(c||null)})},Tbi=(o,p)=>{const{length:i}=o=o?o.filter(Boolean):[];if(p||i){let n=new AbortController,s;const c=function(v){if(!s){s=!0,y();const E=v instanceof Error?v:this.reason;n.abort(E instanceof si?E:new Bh(E instanceof Error?E.message:E))}};let e=p&&setTimeout(()=>{e=null,c(new si(`timeout ${p} of ms exceeded`,si.ETIMEDOUT))},p);const y=()=>{o&&(e&&clearTimeout(e),e=null,o.forEach(v=>{v.unsubscribe?v.unsubscribe(c):v.removeEventListener("abort",c)}),o=null)};o.forEach(v=>v.addEventListener("abort",c));const{signal:m}=n;return m.unsubscribe=()=>Ue.asap(y),m}},vbi=Tbi,Ebi=function*(o,p){let i=o.byteLength;if(!p||i<p){yield o;return}let n=0,s;for(;n<i;)s=n+p,yield o.slice(n,s),n=s},bbi=async function*(o,p){for await(const i of Abi(o))yield*Ebi(i,p)},Abi=async function*(o){if(o[Symbol.asyncIterator]){yield*o;return}const p=o.getReader();try{for(;;){const{done:i,value:n}=await p.read();if(i)break;yield n}}finally{await p.cancel()}},N4=(o,p,i,n)=>{const s=bbi(o,p);let c=0,e,y=m=>{e||(e=!0,n&&n(m))};return new ReadableStream({async pull(m){try{const{done:v,value:E}=await s.next();if(v){y(),m.close();return}let b=E.byteLength;if(i){let w=c+=b;i(w)}m.enqueue(new Uint8Array(E))}catch(v){throw y(v),v}},cancel(m){return y(m),s.return()}},{highWaterMark:2})},x4=64*1024,{isFunction:Mb}=Ue,gbi=(({Request:o,Response:p})=>({Request:o,Response:p}))(Ue.global),{ReadableStream:$4,TextEncoder:L4}=Ue.global,M4=(o,...p)=>{try{return!!o(...p)}catch{return!1}},Ibi=o=>{o=Ue.merge.call({skipUndefined:!0},gbi,o);const{fetch:p,Request:i,Response:n}=o,s=p?Mb(p):typeof fetch=="function",c=Mb(i),e=Mb(n);if(!s)return!1;const y=s&&Mb($4),m=s&&(typeof L4=="function"?($=>M=>$.encode(M))(new L4):async $=>new Uint8Array(await new i($).arrayBuffer())),v=c&&y&&M4(()=>{let $=!1;const M=new i(ra.origin,{body:new $4,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type");return $&&!M}),E=e&&y&&M4(()=>Ue.isReadableStream(new n("").body)),b={stream:E&&($=>$.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach($=>{!b[$]&&(b[$]=(M,k)=>{let F=M&&M[$];if(F)return F.call(M);throw new si(`Response type '${$}' is not supported`,si.ERR_NOT_SUPPORT,k)})});const w=async $=>{if($==null)return 0;if(Ue.isBlob($))return $.size;if(Ue.isSpecCompliantForm($))return(await new i(ra.origin,{method:"POST",body:$}).arrayBuffer()).byteLength;if(Ue.isArrayBufferView($)||Ue.isArrayBuffer($))return $.byteLength;if(Ue.isURLSearchParams($)&&($=$+""),Ue.isString($))return(await m($)).byteLength},V=async($,M)=>{const k=Ue.toFiniteNumber($.getContentLength());return k??w(M)};return async $=>{let{url:M,method:k,data:F,signal:K,cancelToken:Y,timeout:ie,onDownloadProgress:ee,onUploadProgress:de,responseType:ae,headers:fe,withCredentials:ve="same-origin",fetchOptions:ue}=Fxe($),ye=p||fetch;ae=ae?(ae+"").toLowerCase():"text";let Ve=vbi([K,Y&&Y.toAbortSignal()],ie),_e=null;const $e=Ve&&Ve.unsubscribe&&(()=>{Ve.unsubscribe()});let Ne;try{if(de&&v&&k!=="get"&&k!=="head"&&(Ne=await V(fe,F))!==0){let st=new i(M,{method:"POST",body:F,duplex:"half"}),dt;if(Ue.isFormData(F)&&(dt=st.headers.get("content-type"))&&fe.setContentType(dt),st.body){const[_t,Bt]=_4(Ne,vA(V4(de)));F=N4(st.body,x4,_t,Bt)}}Ue.isString(ve)||(ve=ve?"include":"omit");const Be=c&&"credentials"in i.prototype,Se={...ue,signal:Ve,method:k.toUpperCase(),headers:fe.normalize().toJSON(),body:F,duplex:"half",credentials:Be?ve:void 0};_e=c&&new i(M,Se);let je=await(c?ye(_e,ue):ye(M,Se));const Ze=E&&(ae==="stream"||ae==="response");if(E&&(ee||Ze&&$e)){const st={};["status","statusText","headers"].forEach(Gi=>{st[Gi]=je[Gi]});const dt=Ue.toFiniteNumber(je.headers.get("content-length")),[_t,Bt]=ee&&_4(dt,vA(V4(ee),!0))||[];je=new n(N4(je.body,x4,_t,()=>{Bt&&Bt(),$e&&$e()}),st)}ae=ae||"text";let Ye=await b[Ue.findKey(b,ae)||"text"](je,$);return!Ze&&$e&&$e(),await new Promise((st,dt)=>{Uxe(st,dt,{data:Ye,headers:bl.from(je.headers),status:je.status,statusText:je.statusText,config:$,request:_e})})}catch(Be){throw $e&&$e(),Be&&Be.name==="TypeError"&&/Load failed|fetch/i.test(Be.message)?Object.assign(new si("Network Error",si.ERR_NETWORK,$,_e),{cause:Be.cause||Be}):si.from(Be,Be&&Be.code,$,_e)}}},Rbi=new Map,Sxe=o=>{let p=o&&o.env||{};const{fetch:i,Request:n,Response:s}=p,c=[n,s,i];let e=c.length,y=e,m,v,E=Rbi;for(;y--;)m=c[y],v=E.get(m),v===void 0&&E.set(m,v=y?new Map:Ibi(p)),E=v;return v};Sxe();const pN={http:kEi,xhr:mbi,fetch:{get:Sxe}};Ue.forEach(pN,(o,p)=>{if(o){try{Object.defineProperty(o,"name",{value:p})}catch{}Object.defineProperty(o,"adapterName",{value:p})}});const B4=o=>`- ${o}`,Dbi=o=>Ue.isFunction(o)||o===null||o===!1;function wbi(o,p){o=Ue.isArray(o)?o:[o];const{length:i}=o;let n,s;const c={};for(let e=0;e<i;e++){n=o[e];let y;if(s=n,!Dbi(n)&&(s=pN[(y=String(n)).toLowerCase()],s===void 0))throw new si(`Unknown adapter '${y}'`);if(s&&(Ue.isFunction(s)||(s=s.get(p))))break;c[y||"#"+e]=s}if(!s){const e=Object.entries(c).map(([m,v])=>`adapter ${m} `+(v===!1?"is not supported by the environment":"is not available in the build"));let y=i?e.length>1?`since :
|
|
90
90
|
`+e.map(B4).join(`
|
|
91
91
|
`):" "+B4(e[0]):"as no adapter specified";throw new si("There is no suitable adapter to dispatch the request "+y,"ERR_NOT_SUPPORT")}return s}const qxe={getAdapter:wbi,adapters:pN};function IO(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new Bh(null,o)}function G4(o){return IO(o),o.headers=bl.from(o.headers),o.data=gO.call(o,o.transformRequest),["post","put","patch"].indexOf(o.method)!==-1&&o.headers.setContentType("application/x-www-form-urlencoded",!1),qxe.getAdapter(o.adapter||uN.adapter,o)(o).then(function(n){return IO(o),n.data=gO.call(o,o.transformResponse,n),n.headers=bl.from(n.headers),n},function(n){return jxe(n)||(IO(o),n&&n.response&&(n.response.data=gO.call(o,o.transformResponse,n.response),n.response.headers=bl.from(n.response.headers))),Promise.reject(n)})}const Zxe="1.13.2",QI={};["object","boolean","number","function","string","symbol"].forEach((o,p)=>{QI[o]=function(n){return typeof n===o||"a"+(p<1?"n ":" ")+o}});const k4={};QI.transitional=function(p,i,n){function s(c,e){return"[Axios v"+Zxe+"] Transitional option '"+c+"'"+e+(n?". "+n:"")}return(c,e,y)=>{if(p===!1)throw new si(s(e," has been removed"+(i?" in "+i:"")),si.ERR_DEPRECATED);return i&&!k4[e]&&(k4[e]=!0,console.warn(s(e," has been deprecated since v"+i+" and will be removed in the near future"))),p?p(c,e,y):!0}};QI.spelling=function(p){return(i,n)=>(console.warn(`${n} is likely a misspelling of ${p}`),!0)};function Obi(o,p,i){if(typeof o!="object")throw new si("options must be an object",si.ERR_BAD_OPTION_VALUE);const n=Object.keys(o);let s=n.length;for(;s-- >0;){const c=n[s],e=p[c];if(e){const y=o[c],m=y===void 0||e(y,c,o);if(m!==!0)throw new si("option "+c+" must be "+m,si.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new si("Unknown option "+c,si.ERR_BAD_OPTION)}}const Zb={assertOptions:Obi,validators:QI},Eo=Zb.validators;class EA{constructor(p){this.defaults=p||{},this.interceptors={request:new O4,response:new O4}}async request(p,i){try{return await this._request(p,i)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const c=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?c&&!String(n.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
92
|
-
`+c):n.stack=c}catch{}}throw n}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=Cc(this.defaults,i);const{transitional:n,paramsSerializer:s,headers:c}=i;n!==void 0&&Zb.assertOptions(n,{silentJSONParsing:Eo.transitional(Eo.boolean),forcedJSONParsing:Eo.transitional(Eo.boolean),clarifyTimeoutError:Eo.transitional(Eo.boolean)},!1),s!=null&&(Ue.isFunction(s)?i.paramsSerializer={serialize:s}:Zb.assertOptions(s,{encode:Eo.function,serialize:Eo.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Zb.assertOptions(i,{baseUrl:Eo.spelling("baseURL"),withXsrfToken:Eo.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&Ue.merge(c.common,c[i.method]);c&&Ue.forEach(["delete","get","head","post","put","patch","common"],$=>{delete c[$]}),i.headers=bl.concat(e,c);const y=[];let m=!0;this.interceptors.request.forEach(function(M){typeof M.runWhen=="function"&&M.runWhen(i)===!1||(m=m&&M.synchronous,y.unshift(M.fulfilled,M.rejected))});const v=[];this.interceptors.response.forEach(function(M){v.push(M.fulfilled,M.rejected)});let E,b=0,w;if(!m){const $=[G4.bind(this),void 0];for($.unshift(...y),$.push(...v),w=$.length,E=Promise.resolve(i);b<w;)E=E.then($[b++],$[b++]);return E}w=y.length;let V=i;for(;b<w;){const $=y[b++],M=y[b++];try{V=$(V)}catch(k){M.call(this,k);break}}try{E=G4.call(this,V)}catch($){return Promise.reject($)}for(b=0,w=v.length;b<w;)E=E.then(v[b++],v[b++]);return E}getUri(p){p=Cc(this.defaults,p);const i=Kxe(p.baseURL,p.url,p.allowAbsoluteUrls);return Bxe(i,p.params,p.paramsSerializer)}}Ue.forEach(["delete","get","head","options"],function(p){EA.prototype[p]=function(i,n){return this.request(Cc(n||{},{method:p,url:i,data:(n||{}).data}))}});Ue.forEach(["post","put","patch"],function(p){function i(n){return function(c,e,y){return this.request(Cc(y||{},{method:p,headers:n?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}EA.prototype[p]=i(),EA.prototype[p+"Form"]=i(!0)});const Hb=EA;class cN{constructor(p){if(typeof p!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const n=this;this.promise.then(s=>{if(!n._listeners)return;let c=n._listeners.length;for(;c-- >0;)n._listeners[c](s);n._listeners=null}),this.promise.then=s=>{let c;const e=new Promise(y=>{n.subscribe(y),c=y}).then(s);return e.cancel=function(){n.unsubscribe(c)},e},p(function(c,e,y){n.reason||(n.reason=new Bh(c,e,y),i(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(p){if(this.reason){p(this.reason);return}this._listeners?this._listeners.push(p):this._listeners=[p]}unsubscribe(p){if(!this._listeners)return;const i=this._listeners.indexOf(p);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const p=new AbortController,i=n=>{p.abort(n)};return this.subscribe(i),p.signal.unsubscribe=()=>this.unsubscribe(i),p.signal}static source(){let p;return{token:new cN(function(s){p=s}),cancel:p}}}const Cbi=cN;function _bi(o){return function(i){return o.apply(null,i)}}function Vbi(o){return Ue.isObject(o)&&o.isAxiosError===!0}const aC={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(aC).forEach(([o,p])=>{aC[p]=o});const Pbi=aC;function Hxe(o){const p=new Hb(o),i=Dxe(Hb.prototype.request,p);return Ue.extend(i,Hb.prototype,p,{allOwnKeys:!0}),Ue.extend(i,p,null,{allOwnKeys:!0}),i.create=function(s){return Hxe(Cc(o,s))},i}const vn=Hxe(uN);vn.Axios=Hb;vn.CanceledError=Bh;vn.CancelToken=Cbi;vn.isCancel=jxe;vn.VERSION=Zxe;vn.toFormData=YI;vn.AxiosError=si;vn.Cancel=vn.CanceledError;vn.all=function(p){return Promise.all(p)};vn.spread=_bi;vn.isAxiosError=Vbi;vn.mergeConfig=Cc;vn.AxiosHeaders=bl;vn.formToJSON=o=>kxe(Ue.isHTMLForm(o)?new FormData(o):o);vn.getAdapter=qxe.getAdapter;vn.HttpStatusCode=Pbi;vn.default=vn;const Nbi=vn;class Wxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Wn.HttpRequest);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[3]||{},e={method:s[0],url:s[1],params:s[2],headers:c,data:s[4]};J.Logger.log("Axios request config: ",e);const y=await Nbi(e);return{value:G.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}const j4=Symbol("missing"),xbi=o=>o!=null&&typeof o=="object";function pv(o,p){if(typeof o!="string")throw new TypeError(`${p} expects the key to be a string.`);return o}function Gh(o,p){if(typeof o!="string"&&!Array.isArray(o))throw new TypeError(`${p} expects the path to be string or array.`);return o}function tf(o,p){if(!yr(o))throw new TypeError(`${p} expects the first argument to be an object.`);return o??{}}function zxe(o,p){const i=pv(p,"ReadKey");return(o??{})[i]}function Jxe(o,p,i){const n=pv(p,"WriteKey"),s=av(o??{});return s[n]=i,s}function Yxe(o,p){const i=pv(p,"DeleteKey"),n=av(o??{});return delete n[i],n}function Xxe(o,p,i){const n=tf(o,"ReadNestedKey"),s=Gh(p,"ReadNestedKey");return JP(n,s,i)}function Qxe(o,p,i){const n=tf(o,"WriteNestedKey"),s=Gh(p,"WriteNestedKey"),c=av(n);return YP(c,s,!1),$Oe(c,s,i,{createMissing:!1})}function e$e(o,p,i){const n=tf(o,"WriteSafeNestedKeyRecursively"),s=Gh(p,"WriteSafeNestedKeyRecursively"),c=av(n);return YP(c,s,!0),$Oe(c,s,i,{createMissing:!0})}function t$e(o,p){const i=tf(o,"DeleteNestedKey"),n=Gh(p,"DeleteNestedKey"),s=av(i),{target:c,lastKey:e}=YP(s,n,!1);return delete c[e],s}function i$e(o,p){const i=pv(p,"HasKey"),n=o;return n!=null&&xbi(n)&&Object.prototype.hasOwnProperty.call(n,i)}function r$e(o,p,i){const n=pv(p,"KeyValueEquals");return o==null||typeof o!="object"?!1:o[n]===i}function n$e(o,p){const i=o,n=Gh(p,"HasNestedKey");return JP(i,n,j4)!==j4}function a$e(o,p,i){const n=Gh(p,"NestedKeyValueEquals");return JP(o,n)===i}function s$e(...o){const p={};for(let i=0;i<o.length;i++){const n=o[i];if(n!=null){if(!yr(n))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,n)}}return p}function l$e(o){const p=tf(o,"ObjectKeys");return Object.keys(p)}function o$e(o){const p=tf(o,"ObjectValues");return Object.values(p)}function d$e(o){const p=tf(o,"ObjectEntries");return Object.entries(p)}class u$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.Validate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)});J.Logger.log("Inputs for entity validation: ",s);const e=GR(s[1]).safeParse(s[0]);return e.success?{value:G.Success,error:null,result:{data:s[0]}}:{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e.error.errors,result:null}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}const Ia=o=>o.map(p=>{var i,n;return((i=p.value)==null?void 0:i.valueAsType)??((n=p.value)==null?void 0:n.value)});class p$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.ReadKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=zxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class c$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.WriteKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Jxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class f$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.DeleteKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=Yxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.ReadNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Xxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class h$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY,version:"1.0.0",description:"Entity write-nested-key operation implementation module (immutable, no auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.WriteNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Qxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class m$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY,version:"1.0.0",description:"Entity write-safe-nested-key-recursively operation implementation module (immutable, auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.WriteSafeNestedKeyRecursively);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=e$e(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class T$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.DeleteNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=t$e(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class v$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Ce.HasKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=Ia(n),e=i$e(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class E$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Ce.KeyValueEquals);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=r$e(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class b$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Ce.HasNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=Ia(n),e=n$e(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class A$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Ce.NestedKeyValueEquals);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=a$e(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class g$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Ce.IsInstanceOfType);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,y,m,v,E,b,w,V;try{const $=((c=(s=n[0])==null?void 0:s.value)==null?void 0:c.parent)||((y=(e=n[0])==null?void 0:e.value)==null?void 0:y.standaloneParent),M=(v=(m=n[0])==null?void 0:m.value)==null?void 0:v.value,k=(b=(E=n[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!M)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!k)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!$)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(k.type!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType expects expectedType to be a DefinitionEntity.");const F=$.getDataType(null);if(((w=F==null?void 0:F.entity)==null?void 0:w.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let K=!1;return((V=F==null?void 0:F.entity)==null?void 0:V.id)!==(k==null?void 0:k.id)?K=!1:GR(F==null?void 0:F.entity).safeParse(M).success?K=!0:K=!1,{value:G.Success,error:null,result:K}}catch($){return{value:G.UnhandledError,error:$,result:null}}}})}}class I$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(Ce.Merge);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const s=Ia(n),c=s$e(...s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class R$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(Ce.Keys);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=l$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class D$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(Ce.Values);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=o$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class w$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(Ce.Entries);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=d$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}let ls=null;try{ls=require("crypto")}catch{}const Mm=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:ls&&ls.webcrypto?ls.webcrypto:null,wu=Mm?Mm.subtle:null;function Zm(o){const p=new ArrayBuffer(o.byteLength);return new Uint8Array(p).set(o),p}function Hr(o,p="utf8"){if(o instanceof Uint8Array)return o;const i=String(o);if(p==="utf8"){if(typeof TextEncoder<"u")return new TextEncoder().encode(i);if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"utf8"))}else if(p==="hex"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"hex"))}else if(p==="base64"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"base64"))}else if(p==="base64url"){const n=i.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(n,"base64"));const s=typeof atob=="function"?atob(n):"",c=new Uint8Array(s.length);for(let e=0;e<s.length;e++)c[e]=s.charCodeAt(e);return c}throw new Error(`Unsupported environment/encoding combo for toBytes(${p})`)}function Ql(o,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(o);if(typeof Buffer<"u")return Buffer.from(o).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(o).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(o).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(o).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const O$e=o=>Hr(o,"base64"),C$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64")},Cy=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64url")},_c=o=>Hr(o,"base64url"),_$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"hex")},V$e=o=>Hr(o,"hex");function fN(o){if(Mm&&Mm.getRandomValues){const p=new Uint8Array(o);return Mm.getRandomValues(p),p}if(ls&&ls.randomBytes)return new Uint8Array(ls.randomBytes(o));throw new Error("Secure random not available")}function eR(o,p){if(!(o instanceof Uint8Array)||!(p instanceof Uint8Array)||o.length!==p.length)return!1;let i=0;for(let n=0;n<o.length;n++)i|=o[n]^p[n];return i===0}function P$e(o,p,i,n){if((typeof o!="string"||typeof p!="string")&&typeof o!="string"&&typeof p!="string")throw new Error("Invalid input types");const s=i??"utf8",c=n??"utf8",e=Hr(o??"",s),y=Hr(p??"",c);return eR(e,y)}async function N$e(o,p){if(wu){const i=await wu.digest({name:o},Zm(p));return new Uint8Array(i)}if(ls){const i=o.replace("SHA-","sha"),n=ls.createHash(i);return n.update(Buffer.from(p)),new Uint8Array(n.digest())}throw new Error("Hash not available")}async function x$e(o,p,i,n){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const s=String(o??"SHA-256"),c=i??"utf8",e=n??"base64url",y=Hr(p??"",c),m=await N$e(s,y);return Ql(m,e)}async function tR(o,p,i){if(wu){const n=await wu.importKey("raw",Zm(p),{name:"HMAC",hash:{name:o}},!1,["sign"]),s=await wu.sign("HMAC",n,Zm(i));return new Uint8Array(s)}if(ls){const n=`sha${o.split("-")[1]}`,s=ls.createHmac(n,Buffer.from(p));return s.update(Buffer.from(i)),new Uint8Array(s.digest())}throw new Error("HMAC not available")}async function $$e(o,p,i,n,s,c){if(typeof o!="string"||typeof p!="string")throw new Error("Invalid input types for key or data; expected strings");const e=String(i??"SHA-256"),y=n??"utf8",m=s??"utf8",v=c??"base64url",E=Hr(o??"",y),b=Hr(p??"",m),w=await tR(e,E,b);return Ql(w,v)}async function iR(o,p,{iterations:i,length:n,hashAlg:s="SHA-256"}){if(wu){const c=await wu.importKey("raw",Zm(o),"PBKDF2",!1,["deriveBits"]),e=await wu.deriveBits({name:"PBKDF2",salt:Zm(p),iterations:i,hash:s},c,n*8);return new Uint8Array(e)}if(ls){const c=s==="SHA-512"?"sha512":"sha256";return await new Promise((e,y)=>{ls.pbkdf2(Buffer.from(o),Buffer.from(p),i,n,c,(m,v)=>{m?y(m):e(new Uint8Array(v))})})}throw new Error("PBKDF2 not available")}async function L$e(o,p,i,n,s,c,e,y){if(typeof o!="string"||typeof p!="string")throw new Error("Invalid input types for password or salt; expected strings");const m=c??"utf8",v=e??"utf8",E=y??"base64url",b=Math.max(1,Number(i)||21e4),w=Math.max(1,Number(n)||32),V=s??"SHA-256",$=Hr(o??"",m),M=Hr(p??"",v),k=await iR($,M,{iterations:b,length:w,hashAlg:V});return Ql(k,E)}async function M$e(o,p=fN(16),i=21e4,n=32,s="SHA-256"){const c=Hr(o,"utf8"),e=await iR(c,p,{iterations:i,length:n,hashAlg:s}),y=Cy(p),m=Cy(e);return`pbkdf2$${s.toLowerCase()}$${i}$${y}$${m}`}async function B$e(o,p){const i=String(p).split("$");if(i.length!==5||i[0]!=="pbkdf2")return!1;const n=i[1].toLowerCase(),s=parseInt(i[2],10),c=_c(i[3]),e=_c(i[4]),y=n.includes("512")?"SHA-512":"SHA-256",m=await iR(Hr(o,"utf8"),c,{iterations:s,length:e.length,hashAlg:y});return eR(m,e)}async function G$e(o,p,i,n,s,c){const e=p!=null?Math.max(1,Number(p)||0):void 0,y=i!=null?Math.max(1,Number(i)||0):void 0,m=n??void 0,v=c??"base64url",E=s!=null?Hr(s,v):void 0;return await M$e(String(o??""),E,e,y,m)}function U4(o){return Cy(Hr(JSON.stringify(o),"utf8"))}function bA(o){try{return JSON.parse(Ql(_c(o),"utf8"))}catch{return null}}async function k$e(o,p,{alg:i="HS256",includeIat:n=!0,expiresInSeconds:s,notBeforeSeconds:c,issuer:e,subject:y,audience:m,jwtid:v,header:E={}}={}){const b={alg:i,typ:"JWT",...E},w=Math.floor(Date.now()/1e3),V={...o||{}};n&&(V.iat=w),typeof s=="number"&&(V.exp=w+s),typeof c=="number"&&(V.nbf=w+c),e&&(V.iss=e),y&&(V.sub=y),m&&(V.aud=m),v&&(V.jti=v);const $=U4(b),M=U4(V),k=Hr(`${$}.${M}`,"utf8"),K=await tR(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,k),Y=Cy(K);return`${$}.${M}.${Y}`}async function j$e(o,p,i,n,s,c,e,y,m,v,E,b){if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(o!=null&&typeof o!="object")throw new Error("Invalid input type for payload; expected object");if(E!=null&&typeof E!="object")throw new Error("Invalid input type for header; expected object");if(v!=null&&typeof v!="string")throw new Error("Invalid input type for jwtid; expected string");if(e!=null&&typeof e!="string")throw new Error("Invalid input type for issuer; expected string");if(y!=null&&typeof y!="string")throw new Error("Invalid input type for subject; expected string");if(m!=null&&typeof m!="string"&&!Array.isArray(m))throw new Error("Invalid input type for audience; expected string or string[]");const V=Hr(p??"",b??"utf8");return await k$e(o??{},V,{alg:i??"HS256",includeIat:n==null?!0:!!n,expiresInSeconds:s!=null?Number(s):void 0,notBeforeSeconds:c!=null?Number(c):void 0,issuer:e??void 0,subject:y??void 0,audience:m??void 0,jwtid:v??void 0,header:E??void 0})}async function U$e(o,p,{alg:i="HS256",issuer:n,audience:s,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[y,m,v]=String(o).split(".");if(!y||!m||!v)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=bA(y),b=bA(m);if(!E||!b)return{valid:!1,header:E,payload:b,reason:"Bad base64/json"};if(E.alg!==i)return{valid:!1,header:E,payload:b,reason:"Alg mismatch"};const w=Hr(`${y}.${m}`,"utf8"),$=await tR(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,w),M=_c(v);if(!eR($,M))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const k=Math.floor(Date.now()/1e3),F=Math.max(0,Number(e)||0);if(b.nbf!=null&&k+F<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&k-F>=Number(b.exp))return{valid:!1,header:E,payload:b,reason:"Expired"};if(n&&b.iss!==n)return{valid:!1,header:E,payload:b,reason:"Issuer mismatch"};if(s){const K=b.aud;if(!(Array.isArray(K)?K.includes(s):K===s))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&k-Number(b.iat)>Number(c)+F?{valid:!1,header:E,payload:b,reason:"MaxAge exceeded"}:{valid:!0,header:E,payload:b}}catch(y){return{valid:!1,header:null,payload:null,reason:String((y==null?void 0:y.message)??y)}}}async function K$e(o,p,i,n,s,c,e,y){if(typeof o!="string")throw new Error("Invalid input type for token; expected string");if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(typeof n!="string")throw new Error("Invalid input type for issuer; expected string");if(s!=null&&typeof s!="string")throw new Error("Invalid input type for audience; expected string");const v=Hr(p??"",y??"utf8");return await U$e(String(o??""),v,{alg:i??"HS256",issuer:n??void 0,audience:s??void 0,maxAgeSeconds:c!=null?Number(c):void 0,clockSkewSeconds:e!=null?Number(e):void 0})}function F$e(o){const[p,i,n]=String(o).split(".");return{header:p?bA(p):null,payload:i?bA(i):null,signature:n?_c(n):new Uint8Array}}function S$e(o,p){if(!o)throw new Error("Token is required for decoding");if(typeof o!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:n,payload:s,signature:c}=F$e(String(o??"")),e=Ql(c,i);return{header:n,payload:s,signature:e}}class q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(et.GenerateRandomBytes);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)}),e=Math.max(0,Number(s)||0),y=c??"base64url",m=fN(e),v=Ql(m,y);return{value:G.Success,error:null,result:v}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomInteger);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[0],e=s[1],y=TOe(c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class H$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomFloat);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=qI();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class W$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomHexadecimal);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=FP(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomBase62);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=SP(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class J$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=EOe(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomAlphanumeric);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=qP(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class X$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateIdentifier);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[0],e=s[1],y=ZP(c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomUUIDv4);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=Du();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class eLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{J.Logger.log("Initializing Random Generate Short Identifier Module");const n=i.find(s=>s.contextType===X.Logic);if(n){J.Logger.log("Project state found, setting up operation");const s=n.get(et.GenerateShortIdentifier);s?(J.Logger.log("Operation found, setting autoexecutable and implementation"),s.autoexecutable=!0,s.implementation=this.module.main):J.Logger.warn("Operation generate-short-identifier not found in project state")}else J.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,n)=>{try{const s=bOe();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class tLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateHexadecimalToken);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=AOe();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}function $bi(o){let p;if(o===null?p="null":Array.isArray(o)?p="array":p=typeof o,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class iLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(ze.GetTypeOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)||((m=e.value)==null?void 0:m.value)})[0];return{value:G.Success,error:null,result:$bi(c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class rLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.ToString);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=String(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class nLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.ToNumber);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=Number(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class aLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.ToBytes);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)}),y=Hr(s,c||"utf8");return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class sLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.FromBytesToString);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)}),y=Ql(s,c||"utf8");return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class lLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.EncodeBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)});return{value:G.Success,error:null,result:C$e(s,c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class oLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.DecodeBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=O$e(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class dLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.EncodeBase64Url);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Cy(s,c||"utf8");return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class uLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.DecodeBase64Url);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=_c(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class pLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.EncodeHex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=_$e(s,c||"utf8");return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class cLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.DecodeHex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=V$e(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class fLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(li.Hash);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:x$e(s,c,e,y)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class yLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(li.Hmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)});return{value:G.Success,error:null,result:$$e(c,e,s,y,m,v)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class hLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(li.ConstantTimeEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:P$e(s,c,e,y)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class mLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(li.DeriveKeyPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b]=n.map(w=>{var V,$;return((V=w.value)==null?void 0:V.valueAsType)??(($=w.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:L$e(s,c,e,y,m,v,E,b)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class TLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Xr.Parse);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{var s;try{const c=(s=n[0].value)==null?void 0:s.value;if(typeof c!="string")throw new Error(`Invalid input type for JSON.parse operation: expected string, got ${typeof c}`);const e=JSON.parse(c);return{value:G.Success,error:null,result:e}}catch(c){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:c,result:null}}}})}}class vLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Xr.Stringify);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{var s,c;try{const e=(s=n[0].value)==null?void 0:s.value,y=(c=n[1].value)==null?void 0:c.value;if(!e||typeof e!="object"&&!Array.isArray(e))throw new Error(`Invalid input type for JSON.stringify operation: expected object or array, got ${typeof e}`);if(!y&&y!==0){const v=JSON.stringify(e);return{value:G.Success,error:null,result:v}}const m=JSON.stringify(e,null,y);return{value:G.Success,error:null,result:m}}catch(e){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e,result:null}}}})}}class ELe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(er.BuildJwtHmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b,w,V,$,M]=n.map(k=>{var F,K;return((F=k.value)==null?void 0:F.valueAsType)??((K=k.value)==null?void 0:K.value)});return{value:G.Success,error:null,result:await j$e(s,c,e,y,m,v,E,b,w,V,$,M)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class bLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(er.VerifyJwtHmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b]=n.map(w=>{var V,$;return((V=w.value)==null?void 0:V.valueAsType)??(($=w.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:await K$e(s,c,e,y,m,v,E,b)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class ALe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(er.DecodeJwt);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)});return{value:G.Success,error:null,result:S$e(s,c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class gLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Qr.HashPasswordPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)});return{value:G.Success,error:null,result:await G$e(s,c,e,y,m,v)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class ILe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Qr.VerifyPasswordPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=await B$e(String(s??""),String(c??""));return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class sC extends HI{constructor(p,i,n=i.projectId){super(p,X.Editor),this._editor=i,this.id=n}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(p){this._editor.undoableStackValueIndex=p}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,i){return this._editor.initTest(p,i)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p){return this._editor.copyEntities(p)}resolveInitialChildrenPositions(p,i,n){return this._editor.resolveInitialChildrenPositions(p,i,n)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,i=!1){return this._editor.requestActiveDynamicValue(p,i)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,i){return this._editor.setValueTypePreference(p,i)}}function Lbi(o,p){return p instanceof sC?p:new sC(o,p)}class lC extends HI{constructor(p,i){super(p,X.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 Mbi(o,p){return p instanceof lC?p:new lC(o,p)}function Bbi(o){o.register(new tCe(o)),o.register(new eCe(o)),o.register(new JOe(o)),o.register(new XOe(o)),o.register(new QOe(o)),o.register(new YOe(o)),o.register(new GNe(o)),o.register(new kNe(o)),o.register(new jNe(o)),o.register(new KNe(o)),o.register(new UNe(o)),o.register(new FNe(o)),o.register(new Z$e(o)),o.register(new H$e(o)),o.register(new W$e(o)),o.register(new z$e(o)),o.register(new J$e(o)),o.register(new Y$e(o)),o.register(new X$e(o)),o.register(new Q$e(o)),o.register(new eLe(o)),o.register(new tLe(o)),o.register(new BPe(o)),o.register(new GPe(o)),o.register(new kPe(o)),o.register(new jPe(o)),o.register(new UPe(o)),o.register(new KPe(o)),o.register(new FPe(o)),o.register(new SPe(o)),o.register(new qPe(o)),o.register(new ZPe(o)),o.register(new HPe(o)),o.register(new WPe(o)),o.register(new zPe(o)),o.register(new JPe(o)),o.register(new YPe(o)),o.register(new XPe(o)),o.register(new QPe(o)),o.register(new eNe(o)),o.register(new tNe(o)),o.register(new nNe(o)),o.register(new aNe(o)),o.register(new sNe(o)),o.register(new rPe(o)),o.register(new nPe(o)),o.register(new aPe(o)),o.register(new sPe(o)),o.register(new lPe(o)),o.register(new oPe(o)),o.register(new dPe(o)),o.register(new uPe(o)),o.register(new pPe(o)),o.register(new fPe(o)),o.register(new yPe(o)),o.register(new hPe(o)),o.register(new mPe(o)),o.register(new TPe(o)),o.register(new bVe(o)),o.register(new AVe(o)),o.register(new gVe(o)),o.register(new u$e(o)),o.register(new Wxe(o)),o.register(new E_e(o)),o.register(new b_e(o)),o.register(new A_e(o)),o.register(new g_e(o)),o.register(new I_e(o)),o.register(new R_e(o)),o.register(new D_e(o)),o.register(new w_e(o)),o.register(new O_e(o)),o.register(new j_e(o)),o.register(new TVe(o)),o.register(new vVe(o)),o.register(new EVe(o)),o.register(new C_e(o)),o.register(new __e(o)),o.register(new V_e(o)),o.register(new P_e(o)),o.register(new N_e(o)),o.register(new x_e(o)),o.register(new $_e(o)),o.register(new L_e(o)),o.register(new M_e(o)),o.register(new B_e(o)),o.register(new G_e(o)),o.register(new k_e(o)),o.register(new U_e(o)),o.register(new K_e(o)),o.register(new F_e(o)),o.register(new S_e(o)),o.register(new q_e(o)),o.register(new Z_e(o)),o.register(new H_e(o)),o.register(new W_e(o)),o.register(new z_e(o)),o.register(new J_e(o)),o.register(new Y_e(o)),o.register(new X_e(o)),o.register(new lVe(o)),o.register(new oVe(o)),o.register(new dVe(o)),o.register(new Q_e(o)),o.register(new eVe(o)),o.register(new tVe(o)),o.register(new iVe(o)),o.register(new rVe(o)),o.register(new nVe(o)),o.register(new aVe(o)),o.register(new sVe(o)),o.register(new y$e(o)),o.register(new h$e(o)),o.register(new m$e(o)),o.register(new T$e(o)),o.register(new p$e(o)),o.register(new c$e(o)),o.register(new f$e(o)),o.register(new v$e(o)),o.register(new b$e(o)),o.register(new g$e(o)),o.register(new E$e(o)),o.register(new A$e(o)),o.register(new I$e(o)),o.register(new w$e(o)),o.register(new R$e(o)),o.register(new D$e(o)),o.register(new vPe(o)),o.register(new gPe(o)),o.register(new IPe(o)),o.register(new wPe(o)),o.register(new OPe(o)),o.register(new CPe(o)),o.register(new _Pe(o)),o.register(new VPe(o)),o.register(new PPe(o)),o.register(new NPe(o)),o.register(new xPe(o)),o.register(new RPe(o)),o.register(new DPe(o)),o.register(new bPe(o)),o.register(new APe(o)),o.register(new EPe(o)),o.register(new cPe(o)),o.register(new LPe(o)),o.register(new MPe(o)),o.register(new $Pe(o)),o.register(new qNe(o)),o.register(new hxe(o)),o.register(new yxe(o)),o.register(new mxe(o)),o.register(new Txe(o)),o.register(new WNe(o)),o.register(new zNe(o)),o.register(new txe(o)),o.register(new QNe(o)),o.register(new cxe(o)),o.register(new sxe(o)),o.register(new oxe(o)),o.register(new uxe(o)),o.register(new dxe(o)),o.register(new exe(o)),o.register(new rxe(o)),o.register(new nxe(o)),o.register(new ixe(o)),o.register(new SNe(o)),o.register(new JNe(o)),o.register(new lxe(o)),o.register(new bxe(o)),o.register(new tC(o)),o.register(new HNe(o)),o.register(new YNe(o)),o.register(new ZNe(o)),o.register(new pxe(o)),o.register(new XNe(o)),o.register(new axe(o)),o.register(new fxe(o)),o.register(new Exe(o)),o.register(new vxe(o)),o.register(new Axe(o)),o.register(new tC(o)),o.register(new Ixe(o)),o.register(new gxe(o)),o.register(new Rxe(o)),o.register(new ANe(o)),o.register(new gNe(o)),o.register(new INe(o)),o.register(new oNe(o)),o.register(new rNe(o)),o.register(new cNe(o)),o.register(new mNe(o)),o.register(new iNe(o)),o.register(new TNe(o)),o.register(new bNe(o)),o.register(new yNe(o)),o.register(new fNe(o)),o.register(new TA(o)),o.register(new RNe(o)),o.register(new DNe(o)),o.register(new hNe(o)),o.register(new ENe(o)),o.register(new vNe(o)),o.register(new pNe(o)),o.register(new uNe(o)),o.register(new dNe(o)),o.register(new lNe(o)),o.register(new CNe(o)),o.register(new ONe(o)),o.register(new _Ne(o)),o.register(new wNe(o)),o.register(new fVe(o)),o.register(new uVe(o)),o.register(new cVe(o)),o.register(new yVe(o)),o.register(new hVe(o)),o.register(new pVe(o)),o.register(new mVe(o)),o.register(new iLe(o)),o.register(new oLe(o)),o.register(new uLe(o)),o.register(new cLe(o)),o.register(new lLe(o)),o.register(new dLe(o)),o.register(new pLe(o)),o.register(new sLe(o)),o.register(new aLe(o)),o.register(new nLe(o)),o.register(new rLe(o)),o.register(new TLe(o)),o.register(new vLe(o)),o.register(new hLe(o)),o.register(new mLe(o)),o.register(new q$e(o)),o.register(new fLe(o)),o.register(new yLe(o)),o.register(new bLe(o)),o.register(new ELe(o)),o.register(new ALe(o)),o.register(new gLe(o)),o.register(new ILe(o)),o.register(new rCe(o)),o.register(new nCe(o)),o.register(new hA(o)),o.register(new mA(o))}class yN{constructor(p=new J.Events("extensions-registry-fallback-events")){I(this,"extensionsRegistry",new Map);I(this,"initialized",new Set);I(this,"initializedContexts",new Set);I(this,"onResolveEditorContextCallback",()=>null);I(this,"onResolveProjectLogicContextCallback",()=>null);I(this,"onResolveEditorGUIContextCallback",()=>null);I(this,"onResolveGUIContextCallback",()=>null);I(this,"onResolveCompileContextCallback",()=>null);I(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,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(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,i)=>(p.manifest.initPriority||Ee.Normal)-(i.manifest.initPriority||Ee.Normal))}async setup(){Bbi(this),J.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case X.Editor:return this.onResolveEditorContextCallback();case X.Logic:return this.onResolveProjectLogicContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();case X.Compile:return this.onResolveCompileContextCallback();case X.PublicationRun:return this.onResolvePublicationRunContextCallback();case X.GUI:return this.onResolveGUIContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,i=[]){const n=[];i.length===0&&(i=p.manifest.contexts);for(const s of i){const c=this.requestContext(s);c&&n.push(c)}return n}requestExtension(p){const i=this.extensionsRegistry.get(p);if(i)return i;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){var p,i;for(const n of this.extensionInOrder)if(n.module.init&&!this.initialized.has(n.manifest.id)){const s=n.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);s.length&&(await((i=(p=n.module).init)==null?void 0:i.call(p,s)),this.initialized.add(n.manifest.id))}else!n.module.init&&!this.initialized.has(n.manifest.id)&&this.initialized.add(n.manifest.id)}async initForReady(){J.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){J.Logger.log("Initializing "+p.manifest.id+" extension...");const i=this.requestContexts(p);p.manifest.contexts.every(s=>!!i.find(c=>c.contextType===s))?(await p.module.init(i),this.initialized.add(p.manifest.id)):J.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(s=>s.contextType).join(", ")}`)}else!p.module.init&&!this.initialized.has(p.manifest.id)?(J.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):J.Logger.log(`Skipping initialization of ${p.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,i){this.events.on(p,i)}emit(p,...i){this.events.emit(p,...i)}off(p,i){this.events.off(p,i)}emitAsync(p,...i){return this.events.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.events.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.events.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.events.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.events.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.events.emitAsyncSequentiallyAllSettled(p,...i)}async contextAvailable(p){if(this.initializedContexts.has(p)){J.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case X.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case X.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}J.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,i){window.localStorage.setItem("dynamic-value-type-preference--"+p,(i==null?void 0:i.toString())||""),this.emit(p,{})}}let Bb=null;const hN={requestExtension:o=>(Bb||(Bb=new yN,Bb.setup()),Bb.requestExtension(o))},Eu={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var mN=(o=>(o.FinishedSuccess="finished-success",o.FinishedError="finished-error",o.Running="running",o.Paused="paused",o.Stopped="stopped",o.NotStarted="not-started",o))(mN||{});const RLe={...hN,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class Iu extends J.Events{constructor(i,n,s,c=null,e=RLe){super();I(this,"project");I(this,"entryPoint");I(this,"state","not-started");I(this,"events",new J.Events("fe-exec-inst-events"));I(this,"entities",[]);I(this,"parentExecution",null);I(this,"executing",[]);I(this,"executed",[]);I(this,"skipped",[]);I(this,"scheduled",[]);I(this,"localTestValues");I(this,"resolvedValues");I(this,"persistedExecutionResults");I(this,"lastExecutionResults");I(this,"onAddToSkippedListCallback",null);I(this,"onRemoveFromSkippedListCallback",null);I(this,"onAddEntityCallback",null);I(this,"onRemoveEntityCallback",null);I(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=i,this.parentExecution=c,this.localTestValues=new Vm(x.UUID.uuid(),this.project),this.resolvedValues=new Vm(x.UUID.uuid(),this.project),this.persistedExecutionResults=new Vm(x.UUID.uuid(),this.project),this.lastExecutionResults=new Vm(x.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Zr.includes(i.type)&&wt(i).forEach(n=>this.skip(n))))}async schedule(i,n,s){if(this.hasExecuted(i))return null;if(Yt.includes(i.type))return this.executeBranch(i,s,n);if(qr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,s,n);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,n){const s=[];return[...ei,...Yt].includes(n.type)?s.push(...n.inputs):Ut.includes(n.type)&&s.push(...n.outputs),s.map(e=>{var m;let y=i.find(v=>v.valueOwner.id===e.id);if(y)return y;if(!y&&Yt.includes(n.type)&&(y=i.find(v=>{var E;return((E=v.valueOwner.declaration)==null?void 0:E.id)===e.id})),y){const v=(m=y.value)==null?void 0:m.clone(null);return v==null||v.setStandaloneParent(e,null),{...y,valueOwner:e,value:v||null,inheritanceLink:{sources:[y],target:e}}}return Ba.includes(e.type)?Ao(e,this.valueResolutionContext):Mu(e,this.valueResolutionContext)}).reduce((e,y)=>{const m=Oo(y==null?void 0:y.valueOwner,this.project),v=y?[y]:[];return m.forEach(E=>{var V,$,M;if(E.id===(y==null?void 0:y.valueOwner.id))return;const b=It(E.getDataType(null),E,this.project);b==null||b.metaSync({value:(V=y==null?void 0:y.value)==null?void 0:V.value},null),b==null||b.setValueAsTypeList((($=y==null?void 0:y.value)==null?void 0:$.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((M=y==null?void 0:y.value)==null?void 0:M.valueAsTypeSingle)||null);const w={...y,valueOwner:E,value:b};v.push(w)}),[...e,...v]},[]).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,n,s,c={}){var y,m;const e={...Eu,...c};try{let v={value:G.Success,error:null,result:null};if(n.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(vr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(uy+i.declaration.id).module.main;E?v=await E(i,n):J.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{v=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);let E=null;if(v.error){J.Logger.warn("Raw error executing entity: ",v.error);const b=(y=i.error)==null?void 0:y.getDataType(null),w=It(b||null,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(v.error):w==null||w.metaSync({value:v.error},null),E={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:w}}return{value:v.value,entity:i,error:E,result:{value:v.result||null,valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null}}}return{...v,entity:i}}catch(v){J.Logger.warn("Internal call execution error: ",v);let E=null;if(i.error){const b=(m=i.error)==null?void 0:m.getDataType(null),w=It(b,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(v):w==null||w.metaSync({value:v},null),E={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:w}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:E,result:null}}}static async executeOperation(i,n,s){var c,e;try{let y={value:G.Success,error:null,result:null};n.sort((b,w)=>b.valueOwner.index-w.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,n));let m=null;if(y.error&&i.error){J.Logger.warn("Raw error executing entity: ",y.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,w=It(b,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(y.error):w==null||w.metaSync({value:y.error},null),m={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:w}}const v=i==null?void 0:i.getDataType(null),E=It(v,i,s);return v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y.result):E==null||E.metaSync({value:y.result},null),{value:y.value,entity:i,error:m,result:{value:E||null,valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null}}}catch(y){J.Logger.warn("Operation execution error: ",y);let m=null;if(i.error){const v=(e=i.error)==null?void 0:e.getDataType(null),E=It(v,i.error,s);v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y):E==null||E.metaSync({value:y},null),m={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:m,result:null}}}async executeSearch(i,n,s){var c;try{let e={value:G.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(Ae.SEARCH_NODE_IMPLEMENTATION)).module.main(i,n),m=i==null?void 0:i.getDataType(null),v=It(m,i,s);return v==null||v.metaSync({value:y},null),y.error?{value:G.UnhandledError,entity:i,error:{valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null,value:v},result:null}:{value:e.value,entity:i,error:null,result:{value:v,valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null}}}catch(e){if(J.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const y=(c=i.error)==null?void 0:c.getDataType(null),m=It(y,i.error,s);return m==null||m.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:m},result:null}}}async executeLoop(i,n,s,c={}){var y,m,v,E,b,w;const e={...Eu,...c};try{let V={value:G.Success,error:null,result:null};const $=n.map(ie=>{var ee,de;return((ee=ie==null?void 0:ie.value)==null?void 0:ee.valueAsType)||((de=ie==null?void 0:ie.value)==null?void 0:de.value)});let M={};i.getUniqueInputMaps().forEach(ie=>{const ee=i.body.inputs.find(ve=>le(ve,s)===le(ie,s)),de=ie==null?void 0:ie.getDataType(null),ae=It(de,ee,s);de!=null&&de.asType?ae==null||ae.setValueAsTypeList([]):ae==null||ae.metaSync({value:[]},null),this.lastExecutionResults.writeValue(ee,ae);const fe={value:ae,valueOwner:ee,type:Pe.ExecutionResult,inheritanceLink:null};M[ee.id]=fe});let F={value:G.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case Q.loop["counted-loop"].id:{const ie=$[0];let ee=1;for(;ee<=ie&&ee<=50;){const de=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const fe=i.currentIterationNumberArgumentDeclaration.getDataType(null),ve=mc(fe),ue=this.lastExecutionResults.readValue(ae.id);if(ue){ue.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ae,ue);const $e={value:ue,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null};return M[ae.id]=$e,$e}const ye={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ee,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ve,standaloneParent:ae.toReference()},Ve=Si(ye,s);this.lastExecutionResults.writeValue(ae,Ve);const _e={value:Ve,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null};return M[ae.id]=_e,_e}else return M[ae.id]}).filter(ae=>!!ae);if(F=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(F.results||[]).forEach(ae=>{var ye,Ve,_e,$e;if(ae.valueOwner.type!==d.InputMap||Ut.includes(ae.valueOwner.parent.type))return;const fe=i.body.inputs.find(Ne=>le(Ne,s)===le(ae.valueOwner,s)),ue=[...((Ve=(ye=M==null?void 0:M[fe.id])==null?void 0:ye.value)==null?void 0:Ve.value)||[],((_e=ae==null?void 0:ae.value)==null?void 0:_e.value)||null];($e=M[fe.id].value)==null||$e.metaSync({value:ue},null),this.lastExecutionResults.writeValue(fe,M[fe.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["manual-flow-loop"].id:{let ie=1;for(;ie<=50;){const ee=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(de.id);if(ae){ae.metaSync({value:ie},null),this.lastExecutionResults.writeValue(de,ae);const ye={value:ae,valueOwner:de,type:Pe.ExecutionResult,inheritanceLink:null};return M[de.id]=ye,ye}const fe=i.currentIterationNumberArgumentDeclaration.getDataType(null),ve=It(fe,de,s);return ve==null||ve.metaSync({value:ie},null),this.lastExecutionResults.writeValue(de,ve),{value:ve,valueOwner:de,type:Pe.ExecutionResult,inheritanceLink:null}}else return M[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ee,e),(F.results||[]).forEach(de=>{var ue,ye,Ve;if(de.valueOwner.type!==d.InputMap||Ut.includes(de.valueOwner.parent.type))return;const ae=i.body.inputs.find(_e=>le(_e,s)===le(de.valueOwner,s)),ve=[...(ue=M[ae.id].value)==null?void 0:ue.value,((ye=de.value)==null?void 0:ye.value)||null];(Ve=M[ae.id].value)==null||Ve.metaSync({value:ve},null),this.lastExecutionResults.writeValue(ae,M[ae.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ie++}break}case Q.loop["list-loop"].id:{const ie=$[0];let ee=1;const de=ie;for(let ae=0;ae<de.length;ae++){const fe=de[ae],ve=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ue.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,ye),{value:ye,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const Ve=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=It(Ve,ue,s);return _e==null||_e.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=mc(ye),_e=this.lastExecutionResults.readValue(ue.id);if(_e)return _e.metaSync({value:fe},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const $e={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:fe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ve,standaloneParent:ue.toReference()},Ne=Si($e,s);return this.lastExecutionResults.writeValue(ue,Ne),{value:Ne,valueOwner:i.currentValueArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else return M[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Ne,Be;if(ue.valueOwner.type!==d.InputMap||Ut.includes(ue.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>le(Se,s)===le(ue.valueOwner,s)),_e=[...($e=M[ye.id].value)==null?void 0:$e.value,((Ne=ue.value)==null?void 0:Ne.value)||null];(Be=M[ye.id].value)==null||Be.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,M[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["object-keys-loop"].id:{const ie=$[0];let ee=1;const de=ie?Object.keys(ie):[];for(let ae=0;ae<de.length;ae++){const fe=de[ae],ve=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ue.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,ye),{value:ye,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const Ve=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=It(Ve,ue,s);return _e==null||_e.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=mc(ye),_e=this.lastExecutionResults.readValue(ue.id);if(_e)return _e.metaSync({value:fe},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const $e={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:fe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ve,standaloneParent:ue.toReference()},Ne=Si($e,s);return this.lastExecutionResults.writeValue(ue,Ne),{value:Ne,valueOwner:i.currentValueArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else return M[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Ne,Be;if(ue.valueOwner.type!==d.InputMap||Ut.includes(ue.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>le(Se,s)===le(ue.valueOwner,s)),_e=[...($e=M[ye.id].value)==null?void 0:$e.value,((Ne=ue.value)==null?void 0:Ne.value)||null];(Be=M[ye.id].value)==null||Be.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,M[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["object-values-loop"].id:{const ie=$[0];let ee=1;const de=ie?Object.values(ie):[];for(let ae=0;ae<de.length;ae++){const fe=de[ae],ve=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ue.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,ye),{value:ye,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const Ve=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=It(Ve,ue,s);return _e==null||_e.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=mc(ye),_e=this.lastExecutionResults.readValue(ue.id);if(_e)return _e.metaSync({value:fe},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const $e={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:fe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ve,standaloneParent:ue.toReference()},Ne=Si($e,s);return this.lastExecutionResults.writeValue(ue,Ne),{value:Ne,valueOwner:i.currentValueArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else return M[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Ne,Be;if(ue.valueOwner.type!==d.InputMap||Ut.includes(ue.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>le(Se,s)===le(ue.valueOwner,s)),_e=[...($e=M[ye.id].value)==null?void 0:$e.value,((Ne=ue.value)==null?void 0:Ne.value)||null];(Be=M[ye.id].value)==null||Be.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,M[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["string-loop"].id:{const ie=$[0];let ee=1;const de=ie.split("");for(let ae=0;ae<de.length;ae++){const fe=de[ae],ve=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ue.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,ye),{value:ye,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const Ve=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=It(Ve,ue,s);return _e==null||_e.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=mc(ye),_e=this.lastExecutionResults.readValue(ue.id);if(_e)return _e.metaSync({value:fe},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const $e={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:fe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ve,standaloneParent:ue.toReference()},Ne=Si($e,s);return this.lastExecutionResults.writeValue(ue,Ne),{value:Ne,valueOwner:i.currentValueArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else return M[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Ne,Be;if(ue.valueOwner.type!==d.InputMap||Ut.includes(ue.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>le(Se,s)===le(ue.valueOwner,s)),_e=[...($e=M[ye.id].value)==null?void 0:$e.value,((Ne=ue.value)==null?void 0:Ne.value)||null];(Be=M[ye.id].value)==null||Be.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,M[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}}if(V={value:[G.CaughtError,G.Return].includes(F.value)?F.value:G.Success,error:((m=(y=F.error)==null?void 0:y.value)==null?void 0:m.value)||null,result:((E=(v=F==null?void 0:F.result)==null?void 0:v.value)==null?void 0:E.value)||null},V.error&&i.error){const ie=(b=i.error)==null?void 0:b.getDataType(null),ee=It(ie||null,i.error,s);ie!=null&&ie.asType?ee==null||ee.setValueAsTypeSingle(V.error):ee==null||ee.metaSync({value:V.error},null);const de={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:ee};return{value:V.value,entity:i,error:de,result:null}}const K=i==null?void 0:i.getDataType(null),Y=It(K,i,s);return K!=null&&K.asType?Y==null||Y.setValueAsTypeSingle(V.result):Y==null||Y.metaSync({value:V.result},null),{value:V.value,entity:i,error:null,result:{value:Y||null,valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null}}}catch(V){if(J.Logger.warn("Error executing loop: ",V),i.error){const $=(w=i.error)==null?void 0:w.getDataType(null),M=It($,i.error,s);return $!=null&&$.asType?M==null||M.setValueAsTypeSingle(V):M==null||M.metaSync({value:V},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:M},result:null}}else return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,n,s,c={}){var y,m,v,E,b,w,V,$,M,k,F,K,Y,ie,ee,de,ae,fe,ve,ue,ye,Ve,_e,$e,Ne,Be;const e={...Eu,...c};try{const Se=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);let je=null;if(Se.error&&i.error){J.Logger.warn("Raw error executing entity: ",Se.error);const dt=(y=i.error)==null?void 0:y.getDataType(null),_t=It(dt||null,i.error,s);dt!=null&&dt.asType?(v=(m=Se.error)==null?void 0:m.value)!=null&&v.valueAsTypeSingle?_t==null||_t.setValueAsTypeSingle((b=(E=Se.error)==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle):(V=(w=Se.error)==null?void 0:w.value)!=null&&V.valueAsTypeList&&Array.isArray((M=($=Se.error)==null?void 0:$.value)==null?void 0:M.valueAsTypeList)&&(_t==null||_t.setValueAsTypeList((F=(k=Se.error)==null?void 0:k.value)==null?void 0:F.valueAsTypeList)):_t==null||_t.metaSync({value:(Y=(K=Se.error)==null?void 0:K.value)==null?void 0:Y.value},null),je={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:_t}}let Ze=G.Success;Se.value===G.UnhandledError&&(i.catchesError||i.errorCalls.length?Ze=G.CaughtError:Ze=G.UnhandledError);const Ye=i==null?void 0:i.getDataType(null),st=It(Ye,i,s);return Ye!=null&&Ye.asType?(ee=(ie=Se.result)==null?void 0:ie.value)!=null&&ee.valueAsTypeSingle?st==null||st.setValueAsTypeSingle((ae=(de=Se.result)==null?void 0:de.value)==null?void 0:ae.valueAsTypeSingle):(ve=(fe=Se.result)==null?void 0:fe.value)!=null&&ve.valueAsTypeList&&Array.isArray((ye=(ue=Se.result)==null?void 0:ue.value)==null?void 0:ye.valueAsTypeList)&&(st==null||st.setValueAsTypeList((_e=(Ve=Se.result)==null?void 0:Ve.value)==null?void 0:_e.valueAsTypeList)):st==null||st.metaSync({value:((Ne=($e=Se.result)==null?void 0:$e.value)==null?void 0:Ne.value)||null},null),{value:Ze,entity:i,error:je,result:{value:st||null,valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null}}}catch(Se){if(!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const je=(Be=i.error)==null?void 0:Be.getDataType(null),Ze=It(je,i.error,s);return je!=null&&je.asType?Ze==null||Ze.setValueAsTypeSingle(Se):Ze==null||Ze.metaSync({value:Se},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:Ze},result:null}}}async executeCondition(i,n){var c,e,y,m;let s=!1;switch(i.declaration.id){case en.BooleanIsTrue:{const v=(e=(c=n[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof v!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");s=v===!0;break}case en.BooleanIsFalse:{const v=(m=(y=n[0])==null?void 0:y.value)==null?void 0:m.value;if(typeof v!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");s=v===!1;break}case or.And:{s=(await Promise.all(i.andChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).every(E=>E);break}case or.Or:{s=(await Promise.all(i.orChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).some(E=>E);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:s?G.Success:G.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,n,s,c={}){const e={...Eu,...c,onBeforeEntityExecution:(v,E,b)=>{var w;return((w=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:w.call(c,v,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(v,E,b)=>{var w;return((w=c==null?void 0:c.onEntityExecuted)==null?void 0:w.call(c,v,E,{...b,detached:!0}))||Promise.resolve()}},y=new Iu(s,[i,...xA(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,n)}async executeFullFunctionDeclarationLogic(i,n,s={}){const c={...Eu,...s},e=xA(i);e.forEach(v=>{this.addEntity(v)}),e.reduce((v,E)=>Ut.includes(E.type)?[...v,...E.outputs]:ei.includes(E.type)&&E.type!==d.Condition?[...v,...E.outputs,...E.inputs]:E.type===d.Condition?[...v,...E.inputs]:v,[]).forEach(v=>{this.lastExecutionResults.removeValue(v.id)});const m=await this.executeBranch(i,c,n);return{...m||{},value:(m==null?void 0:m.value)||G.Success,entity:i,error:(m==null?void 0:m.error)||null,result:(m==null?void 0:m.result)||null}}static async executeEntryPointEntity(i,n){return{value:G.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,n){var y,m,v,E,b,w,V;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Pe.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)yr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const M=It(c,i,this.project);M==null||M.metaSync({value:$},null),s={valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null,value:M}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(M=>{var k,F;if(((k=M.declaration)==null?void 0:k.type)===d.Property&&M.declaration.static){const K=this.lastExecutionResults.readValue(M.declaration.id),Y=le(M,this.project),ie=M.codeName||((F=M.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,K);else{const ee=It(M.getDataType(null),M,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&yr((w=s.value)==null?void 0:w.value)?((V=s.value)==null?void 0:V.value)||{}:{};return i.outputs.map($=>{var K;const M=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),k=e[M],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:k},null),Pe.ExecutionResult}),s.type=Pe.ExecutionResult,{value:G.Return,entity:i,error:null,result:s}}async executeContinueStatement(i,n){var y,m,v,E,b,w,V;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Pe.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)yr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const M=It(c,i,this.project);M==null||M.metaSync({value:$},null),s={valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null,value:M}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(M=>{var k,F;if(((k=M.declaration)==null?void 0:k.type)===d.Property&&M.declaration.static){const K=this.lastExecutionResults.readValue(M.declaration.id),Y=le(M,this.project),ie=M.codeName||((F=M.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,K);else{const ee=It(M.getDataType(null),M,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&yr((w=s.value)==null?void 0:w.value)?((V=s.value)==null?void 0:V.value)||{}:{};return i.outputs.map($=>{var K;const M=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),k=e[M],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:k},null),Pe.ExecutionResult}),s.type=Pe.ExecutionResult,{value:G.Continue,entity:i,error:null,result:s}}async executeBreakStatement(i,n){var y,m,v,E,b,w,V;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Pe.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)yr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const M=It(c,i,this.project);M==null||M.metaSync({value:$},null),s={valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null,value:M}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(M=>{var k,F;if(((k=M.declaration)==null?void 0:k.type)===d.Property&&M.declaration.static){const K=this.lastExecutionResults.readValue(M.declaration.id),Y=le(M,this.project),ie=M.codeName||((F=M.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,K);else{const ee=It(M.getDataType(null),M,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&yr((w=s.value)==null?void 0:w.value)?((V=s.value)==null?void 0:V.value)||{}:{};return i.outputs.map($=>{var K;const M=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),k=e[M],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:k},null),Pe.ExecutionResult}),s.type=Pe.ExecutionResult,{value:G.Break,entity:i,error:null,result:s}}async executeVariable(i,n){var m,v,E,b,w,V;let s=Ao(i,this.valueResolutionContext);const c=Hn(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let $={};if(((m=e==null?void 0:e.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...e.entity.getActiveRawDefaultValue()}),s!=null&&s.value)yr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const M=It(e,i,this.project);M==null||M.metaSync({value:$},null),s={valueOwner:c,type:Pe.ExecutionResult,inheritanceLink:null,value:M}}this.lastExecutionResults.writeValue(c,s.value),c.inputs.forEach(M=>{var k,F;if(((k=M.declaration)==null?void 0:k.type)===d.Property&&M.declaration.static){const K=this.lastExecutionResults.readValue(M.declaration.id),Y=le(M,this.project),ie=M.codeName||((F=M.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,K);else{const ee=It(M.getDataType(null),M,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,ee)}}})}else this.lastExecutionResults.writeValue(c,s==null?void 0:s.value);const y=(b=s==null?void 0:s.value)!=null&&b.value&&yr((w=s.value)==null?void 0:w.value)?((V=s.value)==null?void 0:V.value)||{}:{};return i.outputs.map($=>{var K;const M=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),k=y[M],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:k},null),Pe.ExecutionResult}),s.type=Pe.ExecutionResult,{value:G.Success,entity:i,error:null,result:s}}mergeValues(i,n){const s=[];for(let c=0;c<n.length;c++)i!=null&&i[c]?s.push(i[c]):s.push(n[c]);return s}async executeEntity(i,n=[],s={}){var y,m,v,E,b,w,V,$,M,k,F;const c={...Eu,...s},e={detached:!1};switch(i.type){case d.Condition:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((y=c.onBeforeEntityExecution)==null?void 0:y.call(c,i,K,e)),this.executeCondition(i,K)}case d.InternalCall:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((m=c.onBeforeEntityExecution)==null?void 0:m.call(c,i,K,e)),this.executeInternalCall(i,K,this.project)}case d.Operation:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((v=c.onBeforeEntityExecution)==null?void 0:v.call(c,i,K,e)),Iu.executeOperation(i,K,this.project)}case d.VariableInstance:case d.VariableDeclaration:return this.executeVariable(i,n);case d.FunctionCall:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,K,e)),this.executeFunctionCall(i,K,this.project)}case d.FunctionDeclaration:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,K,e)),Iu.executeEntryPointEntity(i,K)}case d.Search:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((w=c.onBeforeEntityExecution)==null?void 0:w.call(c,i,K,e)),this.executeSearch(i,K,this.project)}case d.Loop:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((V=c.onBeforeEntityExecution)==null?void 0:V.call(c,i,K,e)),this.executeLoop(i,K,this.project,c)}case d.ReturnStatement:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await(($=c.onBeforeEntityExecution)==null?void 0:$.call(c,i,K,e)),this.executeReturnStatement(i,K)}case d.ContinueStatement:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,K,e)),this.executeContinueStatement(i,K)}case d.BreakStatement:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((k=c.onBeforeEntityExecution)==null?void 0:k.call(c,i,K,e)),this.executeBreakStatement(i,K)}case d.GlobalEvent:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((F=c.onBeforeEntityExecution)==null?void 0:F.call(c,i,K,e)),Iu.executeEntryPointEntity(i,K)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var s,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((s=i.result)!=null&&s.valueOwner))return;const n=Oo((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?n.forEach(y=>{var m;this.lastExecutionResults.writeValue(y,(m=i.result)==null?void 0:m.value)}):n.forEach(y=>{this.lastExecutionResults.removeValue(y.id)})}async executeBranch(i,n={},s=[]){var v;const c={...Eu,...n},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const m=await this.executeEntity(i,s,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(m),await((v=c.onEntityExecuted)==null?void 0:v.call(c,i,m,e)),m.value===G.Success){const E=(i.successCalls||i.calls||[]).filter(M=>this.hasEntity(M));(i.errorCalls||[]).forEach(M=>{this.skip(M)});let w=[];const V=(await Promise.all(E.map(M=>this.schedule(M,[],c)))).filter(M=>!!M),$=V.filter(M=>!!M).find(M=>M.value===G.CaughtError||M.value===G.Return||M.value===G.Break||M.value===G.Continue);return $||(w=[...w,...V],m)}else if(m.value===G.CaughtError||m.value===G.ConditionNotMet){const E=(i.errorCalls||[]).filter(M=>this.hasEntity(M));(i.successCalls||i.calls||[]).forEach(M=>{this.skip(M)});let w=[];const V=(await Promise.all(E.map(M=>this.schedule(M,[],c)))).filter(M=>!!M),$=V.filter(M=>!!M).find(M=>M.value===G.CaughtError||M.value===G.UnhandledError||M.value===G.Return||M.value===G.Break||M.value===G.Continue);return $||(w=[...w,...V],m)}else{if(m.value===G.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),Zr.includes(m.entity.type)&&wt(m.entity).forEach(E=>{this.skip(E)}),m;if(m.value===G.Return)return m;if(m.value===G.Break)return m;if(m.value===G.Continue)return m}return m}async execute(i={},n=[]){const s={...Eu,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,s,n);return this.state="finished-success",c}addEntity(i){var n;this.entities.includes(i)||(this.entities.push(i),(n=this.onAddEntityCallback)==null||n.call(this,i,{}))}async addEntityAsync(i,n={}){var s;this.entities.includes(i)||(this.entities.push(i),await((s=this.onAddEntityCallback)==null?void 0:s.call(this,i,n)))}addEntities(i){i.forEach(n=>this.addEntity(n))}async addEntitiesAsync(i,n={}){const s=J.YieldTracker.from(n),c=[];for(const e of i)c.push(this.addEntityAsync(e,n)),await s.tick();await Promise.all(c)}removeEntity(i){var n;if(i!==this.entryPoint){const s=this.entities.indexOf(i);s>-1&&(this.entities.splice(s,1),(n=this.onRemoveEntityCallback)==null||n.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)===d.FunctionDeclaration&&((y=(e=i.parent)==null?void 0:e.parent)==null?void 0:y.type)===d.DefinitionEntity)return this.entities.includes(i.parent);const n=oi(i);if(!n)return!1;const s=n.type===d.Loop&&i.parent===n.body?n.body:null;return s?this.entities.includes(s)||this.entities.includes(n):this.entities.includes(n)}removeScheduled(i){const n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,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 n=this.project.get(i);return n?this.hasEntity(n):!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 n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,1)}removeFromExecutingList(i){var s;const n=this.executing.indexOf(i);n>-1&&(this.executing.splice(n,1),(s=this.onAbortExecutionCallback)==null||s.call(this,i,{}))}removeFromAlreadyExecutedList(i){const n=this.executed.indexOf(i);n>-1&&this.executed.splice(n,1)}removeFromSkippedList(i){var s;const n=this.skipped.indexOf(i);n>-1&&(this.skipped.splice(n,1),(s=this.onRemoveFromSkippedListCallback)==null||s.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var n;this.skipped.includes(i)||(this.skipped.push(i),(n=this.onAddToSkippedListCallback)==null||n.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,n){this.parentContext.setValueTypePreference(i,n),this.emit(i,{})}}function Gbi(o){var p,i;if(o.isList)return"list";if(((p=o.entity)==null?void 0:p.type)===d.DefinitionEntity)return"definition-entity";switch((i=o.entity)==null?void 0:i.name){case oe.Number:return"number";case oe.String:return"text";case oe.Boolean:return"boolean";case oe.UUID:return"uuid";case oe.Date:return"date-time";default:return"definition-entity"}}const ss={[d.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[d.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[d.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[d.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[d.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[d.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[d.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[d.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[d.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[d.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[d.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[d.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[d.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[d.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[d.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[d.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[d.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[d.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[d.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[d.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[d.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[d.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function TN(o){const p=LR(o);if(!p){const n=$y(o);if(n.includes(Re.HTTP_ENDPOINT))return"HTTP endpoint";if(n.includes(Re.PERSISTED_ENTITY))return"Persisted entity";if(n.includes(Re.CRON_JOB))return"Scheduled execution";if(n.includes(Re.RELATIONAL_DATABASE))return"Relational database"}if(p){let n="Extension of "+le(p,p.project)+" entity",s=wo(n);const c=$y(o);return c.includes(Re.HTTP_ENDPOINT)?"HTTP endpoint"+(s?", "+s:""):c.includes(Re.PERSISTED_ENTITY)?"Persisted entity"+(s?", "+s:""):c.includes(Re.CRON_JOB)?"Scheduled execution"+(s?", "+s:""):c.includes(Re.RELATIONAL_DATABASE)?"Relational database"+(s?", "+s:""):n}let i="";return o.abstract&&(i="Template "),o.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function DLe(o){return o.parent.type===d.DefinitionEntity||o.parent.type===d.InstalledProject?"Internal action of "+le(o.parent,o.project):o.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function vN(o){return hx(o)?DLe(o):"Custom trigger"}function kbi(o){var p;switch(o.type){case d.DefinitionEntity:return TN(o);case d.FunctionDeclaration:return vN(o)}return(p=ss[o.type])==null?void 0:p.singular}function jbi(o){var p;switch(o.type){case d.DefinitionEntity:return TN(o);case d.FunctionDeclaration:return vN(o)}return(p=ss[o.type])==null?void 0:p.singular}const EN=4e4,wLe=280,Ubi=300,bN=65,py=32,Wb=39,OLe=26,CLe=49,AA=44,Kbi=35,zb=52,AN=10,ud=AN*2,gA=38,Jb=90,oC=270,_Le=EN/2+120,VLe=EN/2+180;function PLe(o){let i=py+AA+gA+AN;const n=[...o.inputs];return n.length&&(i+=ud,n.forEach(()=>{i+=OLe})),{height:i,width:280}}function NLe(o){let i=bN;const n=[];if([d.DefinitionEntity].includes(o.type)){const m=[...o.suggestedProperties||[],...o.properties||[]];m.length&&(i+=ud,m.forEach(v=>{i+=v.static?CLe:Wb}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(o.type)){const m=[...(o==null?void 0:o.suggestedMethods)||[],...o.methods||[],...o.functions||[],...o.body?[o.body]:[]];m.length&&(i+=ud,m.forEach(v=>{const E=PLe(v);i+=E.height}))}ei.includes(o.type)?(Gt.includes(o.type)?n.push(...(o.usedInputs||[]).flatMap(m=>[m])||[]):n.push(...(o.inputs||[]).flatMap(m=>[m])||[]),o.error&&(i+=zb)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)?(n.push(...o.outputs||[]),o.throws&&(i+=zb)):o.type===d.Condition&&(n.push(o.inputs[0]),o.inputs[1]&&n.push(o.inputs[1]));const s=n.length;s&&(i+=s*Wb,i+=ud);const c=[];if(o.type===d.FunctionDeclaration||o.type===d.GlobalEvent?c.push(...o.inputs||[]):ei.includes(o.type)&&(Gt.includes(o.type)?c.push(...o.usedOutputs||[]):c.push(...o.outputs||[])),Gt.includes(o.type)){o.readsValue&&(i+=ud,i+=AA),o.writesValues.length&&(i+=ud,i+=AA),o.internalCalls.length&&o.usedInternalCalls.forEach(()=>i+=zb+ud);const m=o.getDataType(null);(!m||m.inferred)&&(i+=gA)}const e=c.length;return e&&(i+=e*Wb,i+=ud),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)&&(i+=gA),{height:i,width:280}}function cv(o){return`${o.split("-").map((n,s)=>s===0?n.charAt(0).toUpperCase()+n.slice(1):n.toLowerCase()).join(" ")}.`}function Fbi(o){switch(o.code){case he.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case he.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case he.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case he.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case he.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case he.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case he.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case he.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case he.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Ie.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case he.NoProperties:return"This entity has no properties, so it doesn't do anything";case he.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case he.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case he.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case he.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case he.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case he.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case he.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case he.PropertyImplementsNonAbstact:return"This property implements a non-template property";case he.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case he.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case he.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case he.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case he.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Ie.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ie.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ie.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ie.UnreachableEntity:return"This entity is unreachable";case he.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case he.AbstractEntityImplements:return"This template entity implements a non-template entity";case he.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case he.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case he.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case he.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case he.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case he.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case he.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case he.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case he.MissingRequiredValue:return"This action is missing a required value";case he.NoPrimaryKeyProperty:return"This entity has no primary key property";case he.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case he.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case he.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case he.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case he.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case he.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case he.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ie.EmptyName:return"This entity has no name";case Ie.InvalidObjectStructure:return"This entity has an invalid structure";case Ie.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ie.MissingCaller:return"This action is missing a caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ie.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ie.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case xo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case xo.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case Ga.UUIDMustBeString:return`UUID must be a string, eg: "${Du()}"`;case Ga.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Du()}"`;case Ga.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${Du()}"`;case aa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case aa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case aa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cv(o.code)}}function Sbi(o){switch(o.code){case he.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case he.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case he.IncorrectEntityImplementation:return"Incorrect implementation";case he.IncorrectMethodImplementation:return"Incorrect action implementation";case he.IncorrectPropertyImplementation:return"Incorrect property implementation";case he.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case he.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case he.MissingMethodImplementation:return"Missing action";case he.MissingPropertyImplementation:return"Missing property";case Ie.NameNotUniqueInScope:return"Duplicate name";case he.NoProperties:return"No properties";case he.NonStaticPropertyInStaticEntity:return"Non-static property";case he.StaticEntityWithNonStaticProperties:return"Non-static properties";case he.ReadingFromIncompatibleType:return"Read from different type";case he.WritingToIncompatibleType:return"Write to different type";case he.ScopeWithoutLogic:return"No logic";case he.NonStaticPropertyImplementsStatic:return"Invalid static property";case he.PropertyImplementsIncompatibleType:return"Incompatible data type";case he.PropertyImplementsNonAbstact:return"Non-template property";case he.StaticPropertyImplementsNonStatic:return"Non-static property";case he.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case he.VariableHasInputsAndInternalCall:return"Bad internal call";case he.VariableHasOutputsAndInternalCall:return"Bad internal call";case he.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Ie.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ie.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ie.InternalCallParentMissingDataType:return"Parent has no data type";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ie.UnreachableEntity:return"Unreachable entity";case he.DisconnectedCallableEntity:return"Disconnected entity";case he.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case he.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case he.InvalidPropertiesCombination:return"Invalid properties combination";case he.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case he.ExtendsIncompatibleEntities:return"Extends incompatible entities";case he.ImplementingNonAbstractEntity:return"Implementing non-template entity";case he.ImplementsIncompatibleEntities:return"Implements incompatible entities";case he.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case he.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case he.MissingRequiredValue:return"Missing required value";case he.NoPrimaryKeyProperty:return"No primary key property";case he.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case he.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case he.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case he.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case he.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case he.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case he.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Ie.EmptyName:return"Empty name";case Ie.InvalidObjectStructure:return"Invalid object structure";case Ie.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MissingCaller:return"Missing caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ie.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case xo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case xo.StatusCodeMustBeNumber:return"HTTP status code must be a number";case Ga.UUIDMustBeString:return"UUID must be a string";case Ga.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case Ga.UUIDMustBeValidFormat:return"UUID must be in a valid format";case aa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case aa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case aa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cv(o.code)}}function qbi(o){switch(o.code){case he.AbstractEntityWithNonAbstractMethods:return`${le(o.entity,o.entity.project)} has non-template actions`;case he.AbstractEntityWithNonAbstractProperties:return`${le(o.entity,o.entity.project)} has non-template properties`;case he.IncorrectEntityImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements template`;case he.IncorrectMethodImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements the template`;case he.IncorrectPropertyImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements the template`;case he.AbstractMethodInNonAbstractEntity:return`${le(o.entity,o.entity.project)} can't be a template`;case he.AbstractPropertyInNonAbstractEntity:return`${le(o.entity,o.entity.project)} can't be a template`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${le(o.entity,o.entity.project)} overwrites action`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${le(o.entity,o.entity.project)} overwrites property`;case he.MissingMethodImplementation:return`${le(o.entity,o.entity.project)} is missing action`;case he.MissingPropertyImplementation:return`${le(o.entity,o.entity.project)} is missing property`;case Ie.NameNotUniqueInScope:return`${le(o.entity,o.entity.project)} name is not unique`;case he.NoProperties:return`${le(o.entity,o.entity.project)} has no properties`;case he.NonStaticPropertyInStaticEntity:return`${le(o.entity,o.entity.project)} has non-static property`;case he.StaticEntityWithNonStaticProperties:return`${le(o.entity,o.entity.project)} has non-static properties`;case he.ReadingFromIncompatibleType:return`${le(o.entity,o.entity.project)} reads from different type`;case he.WritingToIncompatibleType:return`${le(o.entity,o.entity.project)} writes to different type`;case he.ScopeWithoutLogic:return`${le(o.entity,o.entity.project)} has no logic`;case he.NonStaticPropertyImplementsStatic:return`${le(o.entity,o.entity.project)} has invalid static property`;case he.PropertyImplementsIncompatibleType:return`${le(o.entity,o.entity.project)} has incompatible data type`;case he.PropertyImplementsNonAbstact:return`${le(o.entity,o.entity.project)} has non-template property`;case he.StaticPropertyImplementsNonStatic:return`${le(o.entity,o.entity.project)} has non-static property`;case he.VariableCallsOthersAndHasInternalCall:return`${le(o.entity,o.entity.project)} has bad internal call`;case he.VariableHasInputsAndInternalCall:return`${le(o.entity,o.entity.project)} has bad internal call`;case he.VariableHasOutputsAndInternalCall:return`${le(o.entity,o.entity.project)} has bad internal call`;case he.VariableIsCalledAndHasInternalCall:return`${le(o.entity,o.entity.project)} has bad internal call`;case Ie.InternalCallDeclarationIsInvalidType:return`${le(o.entity,o.entity.project)} has declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(o.entity,o.entity.project)} has declaration that is not found in parent`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${le(o.entity,o.entity.project)} has invalid parent declaration type`;case Ie.InternalCallParentMissingDataType:return`${le(o.entity,o.entity.project)}'s parent has no data type`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(o.entity,o.entity.project)} has declaration that is not in parent`;case Ie.UnreachableEntity:return`${le(o.entity,o.entity.project)} is unreachable`;case he.DisconnectedCallableEntity:return`${le(o.entity,o.entity.project)} is not executed by any entity`;case he.AbstractEntityImplements:return`${le(o.entity,o.entity.project)} implements a non-template entity`;case he.AbstractExtendingNonAbstractEntity:return`${le(o.entity,o.entity.project)} extends a non-template entity`;case he.InvalidPropertiesCombination:return`${le(o.entity,o.entity.project)} has invalid properties combination`;case he.ExtendingNonInteractiveEntity:return`${le(o.entity,o.entity.project)} extends a non-interactive entity`;case he.ExtendsIncompatibleEntities:return`${le(o.entity,o.entity.project)} extends incompatible entities`;case he.ImplementingNonAbstractEntity:return`${le(o.entity,o.entity.project)} implements a non-template entity`;case he.ImplementsIncompatibleEntities:return`${le(o.entity,o.entity.project)} implements incompatible entities`;case he.LackingReturnStatementOnSomeBranches:return`${le(o.entity,o.entity.project)} is missing termination on some branches`;case he.LastCalledEntityMustBeReturnEntity:return`${le(o.entity,o.entity.project)}'s last called entity must be a termination node`;case he.MissingRequiredValue:return`${le(o.entity,o.entity.project)} is missing a required value`;case he.NoPrimaryKeyProperty:return`${le(o.entity,o.entity.project)} has no primary key property`;case he.NonAbstractExtendingAbstractEntity:return`${le(o.entity,o.entity.project)} extends a template entity`;case he.NonStaticExtendingStaticEntity:return`${le(o.entity,o.entity.project)} extends a static entity`;case he.NonStaticImplementingStaticEntity:return`${le(o.entity,o.entity.project)} implements a static entity`;case he.StaticExtendingNonStaticEntity:return`${le(o.entity,o.entity.project)} extends a non-static entity`;case he.StaticImplementingNonStaticEntity:return`${le(o.entity,o.entity.project)} implements a non-static entity`;case he.VariableReadsValueAndInternalCall:return`${le(o.entity,o.entity.project)} reads a value and has internal call`;case he.VariableWritesValuesAndInternalCall:return`${le(o.entity,o.entity.project)} writes values and has internal call`;case Ie.EmptyName:return`${ss[o.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${le(o.entity,o.entity.project)} has invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${le(o.entity,o.entity.project)}'s loop body action overwrites an action`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites base action`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${le(o.entity,o.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${le(o.entity,o.entity.project)} has a name not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(o.entity,o.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${le(o.entity,o.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${le(o.entity,o.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites base property`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${le(o.entity,o.entity.project)} has reader/writer with incompatible data type`;case xo.StatusCodeMustBeBetween100And599:return`${le(o.entity,o.entity.project)} HTTP status code must be between 100 and 599`;case xo.StatusCodeMustBeNumber:return`${le(o.entity,o.entity.project)} HTTP status code must be a number`;case Ga.UUIDMustBeString:return`${le(o.entity,o.entity.project)} UUID must be a string`;case Ga.UUIDMustNotContainSpaces:return`${le(o.entity,o.entity.project)} UUID must not contain spaces`;case Ga.UUIDMustBeValidFormat:return`${le(o.entity,o.entity.project)} UUID must be in a valid format`;case aa.MustBeUniqueAmongSameEntities:return`${le(o.entity,o.entity.project)} value must be unique among the same kind`;case aa.StringValueMustNotHaveDashes:return`${le(o.entity,o.entity.project)} value must not contain dashes`;case aa.StringValueMustNotHaveSpaces:return`${le(o.entity,o.entity.project)} value must not contain spaces`;default:return`${le(o.entity,o.entity.project)} Error: ${cv(o.code)}`}}function Zbi(o){var p,i,n,s;switch(o.code){case he.AbstractEntityWithNonAbstractMethods:return`${le(o.entity,o.entity.project)} has non-template actions`;case he.AbstractEntityWithNonAbstractProperties:return`${le(o.entity,o.entity.project)} has non-template properties`;case he.IncorrectEntityImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements the template entity`;case he.IncorrectMethodImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements the template action it's based on`;case he.IncorrectPropertyImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements the template property it's based on`;case he.AbstractMethodInNonAbstractEntity:return`${le(o.entity,o.entity.project)} is a template action in a non-template entity`;case he.AbstractPropertyInNonAbstractEntity:return`${le(o.entity,o.entity.project)} is a template property in a non-template entity`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${le(o.entity,o.entity.project)} overwrites an action in the template entity`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${le(o.entity,o.entity.project)} overwrites a property in the template entity`;case he.MissingMethodImplementation:return`${le(o.entity,o.entity.project)} is missing an action implementation from the template entity`;case he.MissingPropertyImplementation:return`${le(o.entity,o.entity.project)} is missing a property implementation from the template entity`;case Ie.NameNotUniqueInScope:return`${le(o.entity,o.entity.project)} has a duplicate name in the same scope`;case he.NoProperties:return`${le(o.entity,o.entity.project)} has no properties, so it doesn't do anything`;case he.NonStaticPropertyInStaticEntity:return`${le(o.entity,o.entity.project)} has a non-static property in a static entity`;case he.StaticEntityWithNonStaticProperties:return`${le(o.entity,o.entity.project)} has non-static properties in a static entity`;case he.ReadingFromIncompatibleType:return`${le(o.entity,o.entity.project)} reads data from a value of a different data type`;case he.WritingToIncompatibleType:return`${le(o.entity,o.entity.project)} writes data to a value of a different data type`;case he.ScopeWithoutLogic:return`${le(o.entity,o.entity.project)} has no logic`;case he.NonStaticPropertyImplementsStatic:return`${le(o.entity,o.entity.project)} has a static property in a non-static entity`;case he.PropertyImplementsIncompatibleType:return`${le(o.entity,o.entity.project)} implements a property of a different data type`;case he.PropertyImplementsNonAbstact:return`${le(o.entity,o.entity.project)} implements a non-template property`;case he.StaticPropertyImplementsNonStatic:return`${le(o.entity,o.entity.project)} has a static property in a non-static entity`;case he.VariableCallsOthersAndHasInternalCall:return`${le(o.entity,o.entity.project)} calls other entities while being used to execute internal logic`;case he.VariableHasInputsAndInternalCall:return`${le(o.entity,o.entity.project)} has inputs while being used to execute internal logic`;case he.VariableHasOutputsAndInternalCall:return`${le(o.entity,o.entity.project)} has outputs while being used to execute internal logic`;case he.VariableIsCalledAndHasInternalCall:return`${le(o.entity,o.entity.project)} is called while being used to execute internal logic`;case Ie.InternalCallDeclarationIsInvalidType:return`${le(o.entity,o.entity.project)} has a declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(o.entity,o.entity.project)} has a declaration that is not found in ${(p=o.entity.parent.getDataType(null))!=null&&p.entity?le((i=o.entity.parent.getDataType(null))==null?void 0:i.entity,o.entity.project):"the variable's data-type entity"}`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${le(o.entity,o.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ie.InternalCallParentMissingDataType:return`${le(o.entity,o.entity.project)} is part of a variable with no data-type entity`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(o.entity,o.entity.project)} has a declaration doesn't belong to ${(n=o.entity.parent.getDataType(null))!=null&&n.entity?le((s=o.entity.parent.getDataType(null))==null?void 0:s.entity,o.entity.project):"the variable's data-type entity"}`;case Ie.UnreachableEntity:return`${le(o.entity,o.entity.project)} is unreachable`;case he.DisconnectedCallableEntity:return`${le(o.entity,o.entity.project)} is disconnected and won't be executed by anything after publishing`;case he.AbstractEntityImplements:return`${le(o.entity,o.entity.project)} implements a non-template entity`;case he.AbstractExtendingNonAbstractEntity:return`${le(o.entity,o.entity.project)} extends a non-template entity`;case he.InvalidPropertiesCombination:return`${le(o.entity,o.entity.project)} has an invalid combination of properties`;case he.ExtendingNonInteractiveEntity:return`${le(o.entity,o.entity.project)} extends a non-interactive entity`;case he.ExtendsIncompatibleEntities:return`${le(o.entity,o.entity.project)} extends incompatible entities`;case he.ImplementingNonAbstractEntity:return`${le(o.entity,o.entity.project)} implements a non-template entity`;case he.ImplementsIncompatibleEntities:return`${le(o.entity,o.entity.project)} implements incompatible entities`;case he.LackingReturnStatementOnSomeBranches:return`${le(o.entity,o.entity.project)} has branches that don't terminate`;case he.LastCalledEntityMustBeReturnEntity:return`${le(o.entity,o.entity.project)} must end with a termination node`;case he.MissingRequiredValue:return`${le(o.entity,o.entity.project)} is missing a required value`;case he.NoPrimaryKeyProperty:return`${le(o.entity,o.entity.project)} has no primary key property`;case he.NonAbstractExtendingAbstractEntity:return`${le(o.entity,o.entity.project)} is a non-template entity extending a template entity`;case he.NonStaticExtendingStaticEntity:return`${le(o.entity,o.entity.project)} is a non-static entity extending a static entity`;case he.NonStaticImplementingStaticEntity:return`${le(o.entity,o.entity.project)} is a non-static entity implementing a static entity`;case he.StaticExtendingNonStaticEntity:return`${le(o.entity,o.entity.project)} is a static entity extending a non-static entity`;case he.StaticImplementingNonStaticEntity:return`${le(o.entity,o.entity.project)} is a static entity implementing a non-static entity`;case he.VariableReadsValueAndInternalCall:return`${le(o.entity,o.entity.project)} reads a value and has an internal call`;case he.VariableWritesValuesAndInternalCall:return`${le(o.entity,o.entity.project)} writes values and has an internal call`;case Ie.EmptyName:return`${ss[o.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${le(o.entity,o.entity.project)} has an invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${le(o.entity,o.entity.project)}'s loop body action overwrites`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites a base action with same implementation`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${le(o.entity,o.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${le(o.entity,o.entity.project)} has a name that is not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(o.entity,o.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${le(o.entity,o.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${le(o.entity,o.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites a base property with same implementation`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${le(o.entity,o.entity.project)} has a reader/writer with incompatible data type`;case xo.StatusCodeMustBeBetween100And599:return`${le(o.entity,o.entity.project)} HTTP status code must be between 100 and 599`;case xo.StatusCodeMustBeNumber:return`${le(o.entity,o.entity.project)} HTTP status code must be a number, between 100 and 599`;case Ga.UUIDMustBeString:return`${le(o.entity,o.entity.project)} UUID must be a string, eg: "${Du()}"`;case Ga.UUIDMustNotContainSpaces:return`${le(o.entity,o.entity.project)} UUID must not contain spaces, eg: "${Du()}"`;case Ga.UUIDMustBeValidFormat:return`${le(o.entity,o.entity.project)} UUID must be in a valid format. Eg: "${Du()}"`;case aa.MustBeUniqueAmongSameEntities:return`${le(o.entity,o.entity.project)} value must be unique among the same kind`;case aa.StringValueMustNotHaveDashes:return`${le(o.entity,o.entity.project)} value must not contain dashes`;case aa.StringValueMustNotHaveSpaces:return`${le(o.entity,o.entity.project)} value must not contain spaces`;default:return`${le(o.entity,o.entity.project)} Error: ${cv(o.code)}`}}var gN=(o=>(o.ValuesAlreadyConnected="values-already-connected",o.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",o.CannotReadValueFromChildren="cannot-read-value-from-children",o.CannotWriteValueToChildren="cannot-write-value-to-children",o.CannotBeCalledByChildren="cannot-be-called-by-children",o.ExecutionsAlreadyConnected="executions-already-connected",o.DataTypesNotCompatible="data-types-not-compatible",o.CannotCallAncestor="cannot-call-ancestor",o.CannotConnectToItself="cannot-connect-to-itself",o.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",o.NotInScope="not-in-scope",o.IsNotValueWrittingEntity="is-not-value-writting-entity",o.IsNotValueReadingEntity="is-not-value-reading-entity",o.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",o.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",o.CallerIsInHigherScope="caller-is-in-higher-scope",o.CallerIsInLowerScope="caller-is-in-lower-scope",o.CallIsInHigherScope="call-is-in-higher-scope",o.CallIsInLowerScope="call-is-in-lower-scope",o.OtherIncompatibleScopeReason="other-incompatible-scope-reason",o.SiblingInternalCallAlreadyUsedInParentVariable="sibling-internal-call-already-used-in-parent-variable",o.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees="error-output-map-cannot-be-connected-to-parent-success-branch-callees",o.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees="success-output-map-cannot-be-connected-to-parent-error-branch-callees",o))(gN||{});const Hbi=Object.values(gN);var IN=(o=>(o.NotPartOfOngoingTest="not-part-of-ongoing-test",o.CannotBeAddedToTest="cannot-be-added-to-test",o))(IN||{});const Wbi=Object.values(IN);var RN=(o=>(o.Suggestion="suggestion",o.CanvasGloballyDisabled="canvas-globally-disabled",o.CannotInteractWithInputInVariableWithInternalCalls="cannot-interact-with-input-in-variable-with-internal-calls",o.CannotInteractWithOutputInVariableWithInternalCalls="cannot-interact-with-output-in-variable-with-internal-calls",o.PropertyIsConstantItsValueCantBeReset="property-is-constant-its-value-cant-be-reset",o.CannotWriteValueOfGlobalVariableDeclaration="cannot-write-value-of-global-variable-declaration",o.CannotReSetValueOfConstantVariable="cannot-reset-value-of-constant-variable",o))(RN||{});const zbi=Object.values(RN);function Jbi(o,p){const i=[...o,...p];return Array.from(new Set(i))}function Ybi(o,p){const i=[...o,...p],n=Array.from(new Set(i));return{hasChanged:n.length!==o.length,reasons:n}}function Xbi(o,p){const i=o.filter(s=>!p.includes(s));return{hasChanged:i.length!==o.length,reasons:i}}function Qbi(o,p){return o.find(i=>i.entity.id===p)||null}function K4(o){return o.filter((p,i)=>o.indexOf(p)===i)}class gn{constructor(p,i,n=null,s){I(this,"ids",[]);I(this,"entity");I(this,"entityCardHeight");I(this,"entityCardWidth");I(this,"index");I(this,"childEntities",[]);I(this,"children",[]);I(this,"parents",[]);I(this,"calculationEntryPoint");I(this,"_onlyEntities",null);I(this,"_changeSet",null);if(this.index=i,this.entity=p,this.calculationEntryPoint=n||this,this===this.calculationEntryPoint&&!s)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(p,i,n){const s=_Le-oC-wLe,c=VLe-Jb-bN;p.metaSync({x:p.x||s,y:p.y||c},i);const e=new gn(p,0,null,i);e._onlyEntities=n||[],e.ids=["0"];const y=[];e.next(v=>{y.push(...v)}),gn.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const m=e.flattenChildEntities();return e._onlyEntities?m.filter(v=>(e._onlyEntities||[]).includes(v)):m}static recursivelyAssembleChildrenAreas(p){const i=[];p.forEach(n=>{n.next(s=>{i.push(...s)})}),i.length>0&&gn.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(p){this.calculationEntryPoint._changeSet=p}findAreaInChildrenFromEntity(p){if(this.entity===p)return this;const i=this.children.find(s=>s.entity===p);return i||this.children.reduce((s,c)=>s||c.findAreaInChildrenFromEntity(p),null)}findAreaFromEntity(p){if(this.entity===p)return this;const i=this.calculationEntryPoint.children,n=i.find(c=>c.entity===p);return n||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(p),null)}addParent(p){if(!this.parents.includes(p)){const i=gn.resolveIds(p,this.index);this.ids.push(...i),this.parents.push(p)}}static resolveIds(p,i){return p?p.ids.map(n=>`${n}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const p=gl(this.entity,!0);if(this.entity.type===d.Project){const i=[],n=[],s=[];p.forEach(e=>{if(d.DefinitionEntity===e.type){n.push(e);return}else if(Yt.includes(e.type)){s.push(e);return}i.push(e)});const c=i.sort((e,y)=>{const m=!!_A(e,y).length,v=gl(e),E=gl(y);return m?0:v.length&&!E.length?-1:!v.length&&E.length?1:0}).filter(e=>!Fp(e).length);this.childEntities=[...n,...s,...c]}else{const i=[],n=[],s=[],c=[],e=[];Zr.includes(this.entity.type)&&NR(this.entity).forEach(v=>{if(Gt.includes(v.type)){s.push(v);return}const E=oi(v);i.push(E)}),nr.includes(this.entity.type)&&n.push(...this.entity.detachedChildren);const y=p.filter(m=>{const v=i.includes(m);return v||s.includes(m)||n.includes(m)?!1:Gt.includes(m.type)?(s.push(m),!1):qr.includes(m.type)&&!v?(c.push(m),!1):m.type===d.DefinitionEntity?(e.push(m),!1):!0});i.sort((m,v)=>Vc(m,v)?-1:0),c.sort((m,v)=>Vc(m,v)?-1:0),s.sort((m,v)=>IC(m,v)?1:IC(v,m)?-1:0),this.childEntities=[...e,...i,...c,...y,...s,...n]}}calculateCardSize(){const p=NLe(this.entity);this.entityCardWidth=p.width,this.entityCardHeight=p.height}static getBoundriesOfTwoAreas(p,i){return{top:Math.min(p.top,i.top),left:Math.min(p.left,i.left),bottom:Math.max(p.bottom,i.bottom),right:Math.max(p.right,i.right)}}static getBoundriedOfCombinedAreas(p,i){const n=p.filter(c=>!i.includes(c));return n.reduce((c,e)=>i.includes(e)?c:gn.getBoundriesOfTwoAreas(c,e.fullBranchArea),n[0].fullBranchArea)}getFullAreaUntilAny(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!p.includes(e)).map(e=>e.getFullAreaUntilAny(p)).reduce((e,y)=>gn.getBoundriesOfTwoAreas(e,y),i)}getFullAreaUntilAreaOrAnyChildren(p){const i=[p,...p.flattenChildren()],n=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(p)).reduce((e,y)=>gn.getBoundriesOfTwoAreas(e,y),n)}getFullAreaUntil(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==p).map(c=>c.getFullAreaUntil(p)).reduce((c,e)=>gn.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(s=>s.fullBranchArea).reduce((s,c)=>gn.getBoundriesOfTwoAreas(s,c),p)}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 p=this.ownEntityArea;return{top:p.top,left:p.left,bottom:p.bottom+Jb,right:p.right+oC}}static filterOutRepeatedAreas(p){return p.filter((i,n)=>p.indexOf(i)===n)}getEarliestId(p,i){const n=p.split("-"),s=i.split("-");return n.length<s.length?p:n.length>s.length?i:n.reduce((e,y,m)=>y<s[m]?p:i,p)}getEarliestLevel(){return this.ids.reduce((n,s)=>this.getEarliestId(n,s),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const n=this.parents.reduce((s,c)=>c.getEarliestLevel()>s.getEarliestLevel()?c:s,this.parents[0]).countColumns();return p+=n,p}getLatestId(p,i){if(p===i)return p;const n=p.split("-"),s=i.split("-");return n.length<s.length?i:n.length>s.length?p:n.reduce((e,y,m)=>y>s[m]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((n,s)=>this.getLatestId(n,s),this.ids[0]).split("-").length}smoothPosition(){const p=this.flattenSiblings();if(!p.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(n=>{n!==this.calculationEntryPoint&&n.shiftDownAlone(i)})}else if([...Yt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(n=>!this.parents.includes(n));i.length?i.every(s=>{const c=this.countColumns(),e=s.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(p,i){if(p.includes(this))return p;this.move(this.entity,{y:this.entity.y+i});let n=[...p,this];return this.children.forEach(s=>{if(gn.getEarliestParentInChain(s)!==this)return;const e=Qbi(n,s.entity.id);n=gn.filterOutRepeatedAreas([...n]),e||(n=n.filter(m=>m!==s));const y=s.shiftDownUntilAny(n,i);n.push(...y)}),n}shiftRightUntilAny(p,i){p.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(n=>{const s=gn.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);gn.getEarliestParentInChain(n)===this&&n.shiftRightUntilAny(s,i)}))}shiftRight(p){this.move(this.entity,{x:this.entity.x+p}),this.children.forEach(i=>{const s=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(s,p)})}shiftDownAlone(p){this.move(this.entity,{y:this.entity.y+p})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const p=this.parents.reduce((s,c)=>{const e=c.ownEntityArea,y=e.top+py,m={top:y,left:e.left,bottom:y,right:e.right};return gn.getBoundriesOfTwoAreas(s,m)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-py;this.shiftDownAlone(n)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((s,c)=>{const e=c.ownEntityArea,y=e.top+py,m={top:y,left:e.left,bottom:y,right:e.right};return gn.getBoundriesOfTwoAreas(s,m)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-py;return this.shiftDownAlone(n),n}resolveChildrenOverlaps(){const p=this.flattenChildren();let i=[];p.forEach(n=>{const s=n.adjustVerticallyToAvoidOverlaps();i.push(...s)}),p.forEach(n=>{n.smoothPosition()})}static getEarliestParentInChain(p){let i=p.parents[0];return p.parents.length&&(i=p.parents.sort((n,s)=>{if(!n.ids.length)return-1;if(!s.ids.length)return 1;const c=n.ids.sort((y,m)=>y.length<m.length?-1:0),e=s.ids.sort((y,m)=>y.length<m.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,s)=>{if(p.has(s.entity.id))return n;p.add(s.entity.id);const e=s.children.slice(0,s.children.indexOf(this)).reduce((y,m)=>[...y,m,...m.flattenChildren(p)],[]);return[...n,...e]},[])}flattenSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,s)=>{if(p.has(s.entity.id))return n;p.add(s.entity.id);const e=s.children.filter(y=>y!==this).reduce((y,m)=>[...y,m,...m.flattenChildren(p)],[]);return[...n,...e]},[])}flattenChildren(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n,...n.flattenChildren(p)]),[])}flattenParents(p=new Set){return this.parents.reduce((n,s)=>p.has(s.entity.id)?n:(p.add(s.entity.id),[...n,s,...s.flattenParents(p)]),[])}getAreaIfRendered(p){return this.calculationEntryPoint.flattenChildren().find(s=>s.entity.id===p.id)||null}getLowerSiblings(){const p=this.parents.reduce((i,n)=>{const s=n.children.indexOf(this),c=n.children.slice(s+1);return[...i,...c]},[]);return K4(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((n,s)=>[...n,...s.getLowerAreas()],[]);return K4([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const n=gn.getEarliestParentInChain(this).children[this.index-1];if(!n)return p;const s=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...s,...c,n],v=D(e.flatMap(V=>_A(this.entity,V.entity))).filter(V=>V.id!==this.entity.id).map(V=>this.findAreaFromEntity(V)).filter(V=>!!V),E=this.getFullAreaUntilAny(v),b=n.getFullAreaUntilAny(v),w=e.reduce((V,$)=>$===this||$.fullBranchArea.left!==E.left?V:Math.max(V,$.fullBranchArea.bottom),b.bottom);if(E.top<w){const V=w-E.top+Jb;return this.shiftDownUntilAny(p,V)}return p}move(p,i){(this.onlyEntities||[]).includes(p)&&p.metaSync(i,this.changeSet)}addChild(p){const i=this.childEntities[p];let n=null;i.x&&i.y?n=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),n||(n=new gn(i,p,this.calculationEntryPoint));const s=this.ownEntityPlusBufferArea;this.children.includes(n)||(this.children.push(n),n.addParent(this));const c=n.fullBranchArea;if(c.left<s.right){const e=s.right-c.left;n.shiftRight(e)}return n}flattenChildEntities(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n.entity,...n.flattenChildEntities(p)]),[])}next(p){const i=[];this.childEntities.forEach((n,s)=>{const c=this.addChild(s);c&&i.push(c)}),p(i)}}var Nm=(o=>(o.Amazon="amazon",o.Google="google",o.Microsoft="microsoft",o))(Nm||{}),hr=(o=>(o.RelationalDatabase="relational-database",o.CompiledLocalCodebase="compiled-local-codebase",o.CloudHostedCodebase="cloud-hosted-codebase",o.HttpApi="http-api",o.HttpEndpoint="http-endpoint",o.ServerlessFunction="serverless-function",o))(hr||{}),dC=(o=>(o.Post="post",o.Get="get",o.Acknowledgement="acknowledgment",o.Progress="progress",o.Error="error",o.Complete="complete",o))(dC||{}),Tc=(o=>(o.Queued="queued",o.Running="running",o.Success="success",o.Failed="failed",o.CleanedUp="cleaned-up",o.Skipped="skipped",o.AbortedByUser="aborted-by-user",o.UnrecoverableFailure="unrecoverable-failure",o.Reverted="reverted",o.UnpublishingStarted="unpublishing-started",o.Unpublished="unpublished",o))(Tc||{}),uC=(o=>(o.Queued="queued",o.Running="running",o.Success="success",o.Failed="failed",o.CleanedUp="cleaned-up",o.UnrecoverableFailure="unrecoverable-failure",o.Reverted="reverted",o.UnpublishingStarted="unpublishing-started",o.Unpublished="unpublished",o))(uC||{}),$t=(o=>(o.ProjectNotFound="project-not-found",o.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",o.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",o.DeploymentCompleted="deployment-completed",o.DeploymentStarted="deployment-started",o.DeploymentFailed="deployment-failed",o.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",o.RequestPayloadValidationFailed="request-payload-validation-failed",o.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",o.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",o.ProjectAlreadyBeingPublished="project-already-being-published",o.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",o.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",o.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",o.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",o.CreatingNewRelationalDatabase="creating-new-relational-database",o.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",o.RelationalDatabaseAlreadyExists="relational-database-already-exists",o.RelationalDatabaseDeletionStarted="relational-database-deletion-started",o.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",o.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",o.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",o.HttpApiDeploymentStarted="http-api-deployment-started",o.HttpApiDeploymentCompleted="http-api-deployment-completed",o.HttpApiDeploymentFailed="http-api-deployment-failed",o.CreatingNewHttpApi="creating-new-http-api",o.HttpApiAlreadyExists="http-api-already-exists",o.HttpApiDeletionStarted="http-api-deletion-started",o.HttpApiDeletionCompleted="http-api-deletion-completed",o.HttpApiDeletionFailed="http-api-deletion-failed",o.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",o.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",o.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",o.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",o.BundlingCodebaseForDownload="bundling-codebase-for-download",o.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",o.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",o.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",o.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",o.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",o.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",o.CodeCompilationStarted="code-compilation-started",o.CodeCompilationCompleted="code-compilation-completed",o.CodeCompilationFailed="code-compilation-failed",o.BundleCodebaseStarted="bundle-codebase-started",o.BundleCodebaseCompleted="bundle-codebase-completed",o.BundleCodebaseFailed="bundle-codebase-failed",o.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",o.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",o.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",o.MigrateRelationalDatabaseStarted="migrate-relational-database-started",o.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",o.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",o.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",o.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",o.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",o.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",o))($t||{}),Tl=(o=>(o.CodeCompilation="code-compilation",o.RelationalDatabaseDeployment="relational-database-deployment",o.RelationalDatabaseDeletion="relational-database-deletion",o.HttpApiDeployment="http-api-deployment",o.HttpApiDeletion="http-api-deletion",o.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",o.BundleCodebase="bundle-codebase",o.MigrateRelationalDatabase="migrate-relational-database",o.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",o.ExecutePublicationCompletedEvent="execute-publication-completed-event",o.CodebaseCleanup="codebase-cleanup",o))(Tl||{});hr.CloudHostedCodebase,hr.HttpApi,hr.RelationalDatabase,hr.CloudHostedCodebase,hr.CloudHostedCodebase,hr.RelationalDatabase,hr.CloudHostedCodebase,hr.CloudHostedCodebase;function xLe(o){return`project-${o}-http-api`}function rR(o){return`entity-${o}-database`}class $Le{constructor(p,i,n,s,c,e,y,m,v){I(this,"stepType");I(this,"id");I(this,"resourceType");I(this,"index");I(this,"dependency",[]);I(this,"lastEvent",null);I(this,"lastEventTimestamp",null);I(this,"status",Tc.Queued);I(this,"publicationRun");I(this,"resource");this.stepType=p,this.id=i,this.resourceType=n,this.status=s,this.dependency=c,this.index=e,this.lastEventTimestamp=y,this.publicationRun=m,this.resource=v}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(p){var i,n;this.status=p.status,this.dependency=p.dependency,this.index=p.index,this.stepType=p.stepType,this.resourceType=p.resourceType,this.lastEvent=p.lastEvent,this.id=p.id,(n=this.resource)==null||n.setDetails((i=p.resource)==null?void 0:i.details)}}var LLe=(o=>(o.Ready="ready",o.Provisioning="provisioning",o.Queued="queued",o.ProvisioningFailed="provisioning-failed",o.Deleting="deleting",o.DeletingFailed="deleting-failed",o.Deleted="deleted",o))(LLe||{});class rf{constructor(p,i,n){I(this,"provisionedBy");I(this,"publicationRun");I(this,"resourceType");I(this,"provider");I(this,"resourceId");I(this,"details",null);I(this,"name",null);I(this,"status","queued");this.publicationRun=p,this.resourceType=i,this.provider=n}setDetails(p){this.details=p}setStatus(p){this.status=p}setProvisionedBy(p){this.provisionedBy=p}}class eAi extends rf{constructor(i,n,s){super(i,hr.HttpEndpoint,s);I(this,"resourceType",hr.HttpEndpoint);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=rR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class tAi extends rf{constructor(i,n,s){super(i,hr.ServerlessFunction,s);I(this,"resourceType",hr.ServerlessFunction);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=rR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class MLe extends rf{constructor(i,n,s){super(i,hr.HttpApi,s);I(this,"resourceType",hr.HttpApi);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=xLe(this.publicationRun.project.id),this.resourceId}}class BLe extends rf{constructor(i,n,s){super(i,hr.RelationalDatabase,s);I(this,"resourceType",hr.RelationalDatabase);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=rR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class GLe extends rf{constructor(i,n){super(i,hr.CloudHostedCodebase,n);I(this,"resourceType",hr.CloudHostedCodebase);I(this,"details",null);I(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class kLe extends rf{constructor(i,n){super(i,hr.CompiledLocalCodebase,n);I(this,"resourceType",hr.CompiledLocalCodebase);I(this,"details",null);I(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 iAi{constructor(p,i){I(this,"id");I(this,"projectAutoIncrementPublicationCount");I(this,"projectPublishedSemanticVersion");I(this,"projectVersion");I(this,"projectId");I(this,"triggeredBy");I(this,"createdAt");I(this,"updatedAt");I(this,"status");I(this,"steps",[]);I(this,"editor");I(this,"explicitResources",new Map);I(this,"implicitGlobalResources",new Map);I(this,"finalGlobalEvent",null);I(this,"finalStatus",null);I(this,"contextType",X.PublicationRun);I(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.projectVersion=p.projectVersion,this.projectId=p.projectId,this.triggeredBy=p.triggeredBy,this.createdAt=p.createdAt,this.updatedAt=p.updatedAt,this.status=p.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(p){return this.steps.filter(i=>p.includes(i.resourceType))}getStepsTypes(p){return this.steps.filter(i=>p.includes(i.stepType))}toIds(p){return p.map(i=>i.id)}getResourceForEntity(p){const i=Array.from(this.explicitResources.values()).find(n=>n.owners.has(p.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(hr.CompiledLocalCodebase,new kLe(this,Nm.Amazon)),this.implicitGlobalResources.set(hr.CloudHostedCodebase,new GLe(this,Nm.Amazon));const p=this.project.entities.filter(n=>Wi(n,Re.HTTP_ENDPOINT)),i=this.project.entities.filter(n=>Wi(n,Re.RELATIONAL_DATABASE));if(i.length&&i.forEach(n=>{const s=new BLe(this,[n],Nm.Amazon);this.explicitResources.set(s.resourceId,s)}),p.length){const n=new MLe(this,p,Nm.Amazon);this.explicitResources.set(n.resourceId,n)}}setSteps(p,i){p.forEach(n=>{this.addStep(n,i)}),this.editor.events.emit($t.ProjectPublishRequestAcknowledged,{})}addStep(p,i){const n=p.dependency||[];if(n.length){const c=n.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===p.id)){const c=new $Le(p.stepType,p.id,p.resourceType,p.status,n,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(J.Logger.log("onUpdate",p),(i=p.payload)!=null&&i.stepType){const n=this.steps.find(s=>{var c;return s.id===((c=p.payload)==null?void 0:c.id)});n&&L(p.emittedAt).isAfter(L(n.lastEventTimestamp))&&n.update(p.payload)}this.editor.events.emit("publication-updated",{}),p.type===dC.Error?(this.finalStatus=uC.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===dC.Complete&&(this.finalStatus=uC.Success,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-completed",p))}requestExtension(p){return this.extensionsRegistry.requestExtension(p)}async initRegistry(){return this.extensionsRegistry=new yN(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(X.PublicationRun),this.extensionsRegistry}}function rAi(o){switch(o){case Tl.CodeCompilation:return"Code generation";case Tl.RelationalDatabaseDeployment:return"Database creation";case Tl.HttpApiDeployment:return"HTTP gateway creation";case Tl.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Tl.BundleCodebase:return"Bundle code";case Tl.MigrateRelationalDatabase:return"Database structure migration";case Tl.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Tl.CodebaseCleanup:return"Code cleanup";case Tl.HttpApiDeletion:return"HTTP gateway deletion";case Tl.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function nAi(o){switch(o){case $t.DeploymentCompleted:return"Successfully published";case $t.DeploymentStarted:return"Publication started";case $t.DeploymentFailed:return"Publication failed";case $t.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case $t.RequestPayloadValidationFailed:return"Request payload validation failed";case $t.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case $t.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case $t.RelationalDatabaseDeploymentStarted:return"Database creation started";case $t.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case $t.RelationalDatabaseDeploymentFailed:return"Database creation failed";case $t.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case $t.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case $t.RelationalDatabaseAlreadyExists:return"Database already exists";case $t.HttpApiDeploymentStarted:return"HTTP gateway creation started";case $t.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case $t.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case $t.CreatingNewHttpApi:return"Creating new HTTP gateway";case $t.HttpApiAlreadyExists:return"HTTP gateway already exists";case $t.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case $t.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case $t.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case $t.BundlingCodebaseForDownload:return"Bundling code for download";case $t.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case $t.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case $t.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case $t.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case $t.CodeCompilationStarted:return"Code generation started";case $t.CodeCompilationCompleted:return"Code generation completed";case $t.CodeCompilationFailed:return"Code generation failed";case $t.BundleCodebaseStarted:return"Code bundling started";case $t.BundleCodebaseCompleted:return"Code bundling completed";case $t.BundleCodebaseFailed:return"Code bundling failed";case $t.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case $t.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case $t.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case $t.MigrateRelationalDatabaseStarted:return"Database structure migration started";case $t.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case $t.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case $t.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case $t.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case $t.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case $t.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case $t.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case $t.ProjectNotFound:return"Project not found";case $t.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case $t.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case $t.HttpApiDeletionStarted:return"HTTP gateway deletion started";case $t.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case $t.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case $t.RelationalDatabaseDeletionStarted:return"Database deletion started";case $t.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case $t.RelationalDatabaseDeletionFailed:return"Database deletion failed";case $t.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var jLe=(o=>(o.NO_LOGIC="NO_LOGIC",o.NO_NAME="NO_NAME",o.NO_CHANGES="NO_CHANGES",o.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",o))(jLe||{});function aAi(o){switch(o){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 sAi(o){switch(o){case hr.RelationalDatabase:return"Relational database";case hr.HttpEndpoint:case hr.HttpApi:return"HTTP endpoints";case hr.ServerlessFunction:case hr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function lAi(o){switch(o){case Tc.Running:return"In progress";case Tc.Failed:return"Failed";case Tc.Success:return"Succeeded";case Tc.Skipped:return"Skipped";case Tc.Queued:default:return"Queued"}}function ULe(o){var n;if(!Wi(o,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=Q["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(o.type===d.BuiltInBaseEntity?Wi(o,Re.EXTERNAL_INTEGRATION_CONNECTION)&&(p=pC(o.name)):o.type===d.DefinitionEntity&&o.implements.forEach(s=>{if(Wi(s,Re.EXTERNAL_INTEGRATION_CONNECTION)){const c=pC(s==null?void 0:s.name);if(c)return p=c,!0}}),!p){const s=o.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}));p=(n=s==null?void 0:s.getDefaultValue())==null?void 0:n.value}return p}function oAi(o){return Ehe[o]}function pC(o){return o.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?o.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function KLe(o){if(o.type!==d.ActionDescriptor&&o.type!==d.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(o.type===d.ActionDescriptor){const p=o;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(o.type===d.Operation){const p=o.declaration;if(Object.values(Qt).includes(p.id))return p.id.split("--")[1]||null}return null}function dAi(o){if(!o)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(Re).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===o.toLowerCase()))||null}function uAi(o){return o.type===d.BuiltInBaseEntity||o.type===d.DefinitionEntity?ULe(o):o.type===d.ActionDescriptor||o.type===d.Operation?KLe(o):null}function FLe(o){var s,c,e;if(!Wi(o,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=tke(o,Re.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const n=Q["built-in-base-entity"][i.id].properties.connectionId.id;if(o.type===d.BuiltInBaseEntity){if(Wi(o,Re.EXTERNAL_INTEGRATION_CONNECTION)){const y=o.properties.find(m=>{var v;return((v=m.extends)==null?void 0:v.id)===n});y&&(p=(s=y.getDefaultValue())==null?void 0:s.value)}}else if(o.type===d.DefinitionEntity){const y=o.properties.find(m=>!!m.implements.find(v=>v.id===n)||!!m.implements.find(v=>{var E;return((E=v.extends)==null?void 0:E.id)===n}));if(!y&&((c=o.extends)==null?void 0:c.type)===d.DefinitionEntity)return FLe(o.extends);p=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return p}async function SLe(o,p={}){var y;const i=J.YieldTracker.from(p),s=[...ea(o),...Ds(o),...DN(o),...ta(o),...wN(o)],c=_v(o);s.push(...c);const e=Lt(o.errors,s);await i.tick();for(const m of o.inputs)await m.validateAsync({tracker:i});for(const m of o.outputs)await m.validateAsync({tracker:i});for(const m of o.internalCalls)await m.validateAsync({tracker:i});return await((y=o.dataType)==null?void 0:y.validateAsync({tracker:i})),e}function qLe(o){var s;(s=o.dataType)==null||s.validate(),o.inputs.forEach(c=>c.validate()),o.outputs.forEach(c=>c.validate()),o.internalCalls.forEach(c=>c.validate());const i=[...ea(o),...Ds(o),...DN(o),...ta(o),...wN(o)],n=_v(o);return i.push(...n),Lt(o.errors,i)}function DN(o,p){const n=[...o.project.getVariableDeclarations()].filter(s=>s.id!==o.id);return Pv(o,[Hi],n,p)}function wN(o){const p=[];if(o.parent!==o.project)return p;if(o.catchesError){const i=Ot({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotCatchError}`,message:`${ss[o.type].singular} "${le(o,o.project)}" with id "${o.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:ce.Error,code:Ie.GlobalVariableDeclarationCannotCatchError,entity:o});p.push(i.error)}if(o.errorCalls.length){const i=Ot({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotCallOnError}`,message:`${ss[o.type].singular} "${le(o,o.project)}" with id "${o.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:ce.Error,code:Ie.GlobalVariableDeclarationCannotCallOnError,entity:o});p.push(i.error)}if(o.calledBy.length){const i=Ot({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotBeCalled}`,message:`${ss[o.type].singular} "${le(o,o.project)}" with id "${o.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:ce.Error,code:Ie.GlobalVariableDeclarationCannotBeCalled,entity:o});p.push(i.error)}return[]}const pAi=Object.freeze(Object.defineProperty({__proto__:null,validate:qLe,validateAsync:SLe,validateGlobalVariableDeclaration:wN,validateVariableDeclarationName:DN},Symbol.toStringTag,{value:"Module"}));async function ZLe(o,p={}){const i=J.YieldTracker.from(p),s=[...ea(o),...Ds(o),...ta(o)],c=_v(o);s.push(...c);const e=Lt(o.errors,s);await i.tick();for(const y of o.inputs)await y.validateAsync({tracker:i});for(const y of o.outputs)await y.validateAsync({tracker:i});for(const y of o.internalCalls)await y.validateAsync({tracker:i});return e}function HLe(o){o.inputs.forEach(s=>s.validate()),o.outputs.forEach(s=>s.validate()),o.internalCalls.forEach(s=>s.validate());const i=[...ea(o),...Ds(o),...ta(o)],n=_v(o);return i.push(...n),Lt(o.errors,i)}function cAi(o){const p=[],i=o.declaration.constant;if(i&&o.readsValue){const n=Ot({id:`${o.id}--${he.ValueReadingOverridesConstantVariable}`,message:`The '${o.type}' entity "${le(o,o.project)}" with id "${o.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:ce.Error,code:he.ValueReadingOverridesConstantVariable,entity:o});p.push(n.error)}if(i&&o.defaultValue){const n=Ot({id:`${o.id}--${he.DefaultValueOverridesConstantVariable}`,message:`The '${o.type}' entity "${le(o,o.project)}" with id "${o.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:ce.Error,code:he.DefaultValueOverridesConstantVariable,entity:o});p.push(n.error)}return p}const fAi=Object.freeze(Object.defineProperty({__proto__:null,validate:HLe,validateAsync:ZLe,validateConstantValueOverride:cAi},Symbol.toStringTag,{value:"Module"}));var ON=(o=>(o.Parent="parent",o.DataTypeEntity="data-type-entity",o.VarDeclaration="var-declaration",o))(ON||{});const mi=class mi extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"x");I(this,"y");I(this,"type",d.VariableInstance);I(this,"catchesError",!1);I(this,"defaultValue",null);I(this,"writesValues",[]);I(this,"readsValue",null);I(this,"declaration");I(this,"inputs",[]);I(this,"outputs",[]);I(this,"error",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"successCalls",[]);I(this,"errorCalls",[]);I(this,"internalCalls",[]);I(this,"project");I(this,"errors",[]);I(this,"parent");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableInstance,catchesError:!1,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,n){let s=n;if(i.parent){const V=ne(i.parent);s=n.get(V)}const c=ne(i.declaration),e=n.get(c),y=i.calledByEntry.map(V=>{const $=ne(V);return n.get($)}),m=i.calledBySuccess.map(V=>{const $=ne(V);return n.get($)}),v=i.calledByError.map(V=>{const $=ne(V);return n.get($)});let E=null;if(i.readsValue){const V=ne(i.readsValue);E=n.get(V)}const b={id:i.id,version:x.UUID.uuid(),createdAt:L().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableInstance,catchesError:i.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:m,calledByError:v,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:E,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:s},w=me(b,n);return w.setParent(s,null),w}static validateGenerationTarget(i,n){let s=JSON.parse(JSON.stringify(i));const c=[],e=En(s,{parent:{list:!1,types:[...nr,d.Project],optional:!0},declaration:{list:!1,types:[d.VariableDeclaration]}},n);return s=e.modifiedData,c.push(...e.errors,...xr(s)),{errors:c,modifiedData:s}}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 n=[];let s=JSON.parse(JSON.stringify(i));const c=sf(s,this);return s=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${se.InvalidParentUpdate}`,code:se.InvalidParentUpdate,severity:ce.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.
|
|
92
|
+
`+c):n.stack=c}catch{}}throw n}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=Cc(this.defaults,i);const{transitional:n,paramsSerializer:s,headers:c}=i;n!==void 0&&Zb.assertOptions(n,{silentJSONParsing:Eo.transitional(Eo.boolean),forcedJSONParsing:Eo.transitional(Eo.boolean),clarifyTimeoutError:Eo.transitional(Eo.boolean)},!1),s!=null&&(Ue.isFunction(s)?i.paramsSerializer={serialize:s}:Zb.assertOptions(s,{encode:Eo.function,serialize:Eo.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Zb.assertOptions(i,{baseUrl:Eo.spelling("baseURL"),withXsrfToken:Eo.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&Ue.merge(c.common,c[i.method]);c&&Ue.forEach(["delete","get","head","post","put","patch","common"],$=>{delete c[$]}),i.headers=bl.concat(e,c);const y=[];let m=!0;this.interceptors.request.forEach(function(M){typeof M.runWhen=="function"&&M.runWhen(i)===!1||(m=m&&M.synchronous,y.unshift(M.fulfilled,M.rejected))});const v=[];this.interceptors.response.forEach(function(M){v.push(M.fulfilled,M.rejected)});let E,b=0,w;if(!m){const $=[G4.bind(this),void 0];for($.unshift(...y),$.push(...v),w=$.length,E=Promise.resolve(i);b<w;)E=E.then($[b++],$[b++]);return E}w=y.length;let V=i;for(;b<w;){const $=y[b++],M=y[b++];try{V=$(V)}catch(k){M.call(this,k);break}}try{E=G4.call(this,V)}catch($){return Promise.reject($)}for(b=0,w=v.length;b<w;)E=E.then(v[b++],v[b++]);return E}getUri(p){p=Cc(this.defaults,p);const i=Kxe(p.baseURL,p.url,p.allowAbsoluteUrls);return Bxe(i,p.params,p.paramsSerializer)}}Ue.forEach(["delete","get","head","options"],function(p){EA.prototype[p]=function(i,n){return this.request(Cc(n||{},{method:p,url:i,data:(n||{}).data}))}});Ue.forEach(["post","put","patch"],function(p){function i(n){return function(c,e,y){return this.request(Cc(y||{},{method:p,headers:n?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}EA.prototype[p]=i(),EA.prototype[p+"Form"]=i(!0)});const Hb=EA;class cN{constructor(p){if(typeof p!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const n=this;this.promise.then(s=>{if(!n._listeners)return;let c=n._listeners.length;for(;c-- >0;)n._listeners[c](s);n._listeners=null}),this.promise.then=s=>{let c;const e=new Promise(y=>{n.subscribe(y),c=y}).then(s);return e.cancel=function(){n.unsubscribe(c)},e},p(function(c,e,y){n.reason||(n.reason=new Bh(c,e,y),i(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(p){if(this.reason){p(this.reason);return}this._listeners?this._listeners.push(p):this._listeners=[p]}unsubscribe(p){if(!this._listeners)return;const i=this._listeners.indexOf(p);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const p=new AbortController,i=n=>{p.abort(n)};return this.subscribe(i),p.signal.unsubscribe=()=>this.unsubscribe(i),p.signal}static source(){let p;return{token:new cN(function(s){p=s}),cancel:p}}}const Cbi=cN;function _bi(o){return function(i){return o.apply(null,i)}}function Vbi(o){return Ue.isObject(o)&&o.isAxiosError===!0}const aC={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(aC).forEach(([o,p])=>{aC[p]=o});const Pbi=aC;function Hxe(o){const p=new Hb(o),i=Dxe(Hb.prototype.request,p);return Ue.extend(i,Hb.prototype,p,{allOwnKeys:!0}),Ue.extend(i,p,null,{allOwnKeys:!0}),i.create=function(s){return Hxe(Cc(o,s))},i}const vn=Hxe(uN);vn.Axios=Hb;vn.CanceledError=Bh;vn.CancelToken=Cbi;vn.isCancel=jxe;vn.VERSION=Zxe;vn.toFormData=YI;vn.AxiosError=si;vn.Cancel=vn.CanceledError;vn.all=function(p){return Promise.all(p)};vn.spread=_bi;vn.isAxiosError=Vbi;vn.mergeConfig=Cc;vn.AxiosHeaders=bl;vn.formToJSON=o=>kxe(Ue.isHTMLForm(o)?new FormData(o):o);vn.getAdapter=qxe.getAdapter;vn.HttpStatusCode=Pbi;vn.default=vn;const Nbi=vn;class Wxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Wn.HttpRequest);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[3]||{},e={method:s[0],url:s[1],params:s[2],headers:c,data:s[4]};J.Logger.log("Axios request config: ",e);const y=await Nbi(e);return{value:G.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}const j4=Symbol("missing"),xbi=o=>o!=null&&typeof o=="object";function pv(o,p){if(typeof o!="string")throw new TypeError(`${p} expects the key to be a string.`);return o}function Gh(o,p){if(typeof o!="string"&&!Array.isArray(o))throw new TypeError(`${p} expects the path to be string or array.`);return o}function tf(o,p){if(!yr(o))throw new TypeError(`${p} expects the first argument to be an object.`);return o??{}}function zxe(o,p){const i=pv(p,"ReadKey");return(o??{})[i]}function Jxe(o,p,i){const n=pv(p,"WriteKey"),s=av(o??{});return s[n]=i,s}function Yxe(o,p){const i=pv(p,"DeleteKey"),n=av(o??{});return delete n[i],n}function Xxe(o,p,i){const n=tf(o,"ReadNestedKey"),s=Gh(p,"ReadNestedKey");return JP(n,s,i)}function Qxe(o,p,i){const n=tf(o,"WriteNestedKey"),s=Gh(p,"WriteNestedKey"),c=av(n);return YP(c,s,!1),$Oe(c,s,i,{createMissing:!1})}function e$e(o,p,i){const n=tf(o,"WriteSafeNestedKeyRecursively"),s=Gh(p,"WriteSafeNestedKeyRecursively"),c=av(n);return YP(c,s,!0),$Oe(c,s,i,{createMissing:!0})}function t$e(o,p){const i=tf(o,"DeleteNestedKey"),n=Gh(p,"DeleteNestedKey"),s=av(i),{target:c,lastKey:e}=YP(s,n,!1);return delete c[e],s}function i$e(o,p){const i=pv(p,"HasKey"),n=o;return n!=null&&xbi(n)&&Object.prototype.hasOwnProperty.call(n,i)}function r$e(o,p,i){const n=pv(p,"KeyValueEquals");return o==null||typeof o!="object"?!1:o[n]===i}function n$e(o,p){const i=o,n=Gh(p,"HasNestedKey");return JP(i,n,j4)!==j4}function a$e(o,p,i){const n=Gh(p,"NestedKeyValueEquals");return JP(o,n)===i}function s$e(...o){const p={};for(let i=0;i<o.length;i++){const n=o[i];if(n!=null){if(!yr(n))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,n)}}return p}function l$e(o){const p=tf(o,"ObjectKeys");return Object.keys(p)}function o$e(o){const p=tf(o,"ObjectValues");return Object.values(p)}function d$e(o){const p=tf(o,"ObjectEntries");return Object.entries(p)}class u$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.Validate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)});J.Logger.log("Inputs for entity validation: ",s);const e=GR(s[1]).safeParse(s[0]);return e.success?{value:G.Success,error:null,result:{data:s[0]}}:{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e.error.errors,result:null}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}const Ia=o=>o.map(p=>{var i,n;return((i=p.value)==null?void 0:i.valueAsType)??((n=p.value)==null?void 0:n.value)});class p$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.ReadKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=zxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class c$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.WriteKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Jxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class f$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.DeleteKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=Yxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.ReadNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Xxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class h$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY,version:"1.0.0",description:"Entity write-nested-key operation implementation module (immutable, no auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.WriteNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Qxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class m$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY,version:"1.0.0",description:"Entity write-safe-nested-key-recursively operation implementation module (immutable, auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.WriteSafeNestedKeyRecursively);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=e$e(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class T$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Ce.DeleteNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=t$e(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class v$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Ce.HasKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=Ia(n),e=i$e(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class E$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Ce.KeyValueEquals);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=r$e(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class b$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Ce.HasNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=Ia(n),e=n$e(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class A$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Ce.NestedKeyValueEquals);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=a$e(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class g$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Ce.IsInstanceOfType);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,y,m,v,E,b,w,V;try{const $=((c=(s=n[0])==null?void 0:s.value)==null?void 0:c.parent)||((y=(e=n[0])==null?void 0:e.value)==null?void 0:y.standaloneParent),M=(v=(m=n[0])==null?void 0:m.value)==null?void 0:v.value,k=(b=(E=n[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!M)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!k)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!$)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(k.type!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType expects expectedType to be a DefinitionEntity.");const F=$.getDataType(null);if(((w=F==null?void 0:F.entity)==null?void 0:w.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let K=!1;return((V=F==null?void 0:F.entity)==null?void 0:V.id)!==(k==null?void 0:k.id)?K=!1:GR(F==null?void 0:F.entity).safeParse(M).success?K=!0:K=!1,{value:G.Success,error:null,result:K}}catch($){return{value:G.UnhandledError,error:$,result:null}}}})}}class I$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(Ce.Merge);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const s=Ia(n),c=s$e(...s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class R$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(Ce.Keys);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=l$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class D$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(Ce.Values);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=o$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class w$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic);if(!n)return;const s=n.get(Ce.Entries);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=d$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}let ls=null;try{ls=require("crypto")}catch{}const Mm=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:ls&&ls.webcrypto?ls.webcrypto:null,wu=Mm?Mm.subtle:null;function Zm(o){const p=new ArrayBuffer(o.byteLength);return new Uint8Array(p).set(o),p}function Hr(o,p="utf8"){if(o instanceof Uint8Array)return o;const i=String(o);if(p==="utf8"){if(typeof TextEncoder<"u")return new TextEncoder().encode(i);if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"utf8"))}else if(p==="hex"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"hex"))}else if(p==="base64"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"base64"))}else if(p==="base64url"){const n=i.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(n,"base64"));const s=typeof atob=="function"?atob(n):"",c=new Uint8Array(s.length);for(let e=0;e<s.length;e++)c[e]=s.charCodeAt(e);return c}throw new Error(`Unsupported environment/encoding combo for toBytes(${p})`)}function Ql(o,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(o);if(typeof Buffer<"u")return Buffer.from(o).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(o).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(o).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(o).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const O$e=o=>Hr(o,"base64"),C$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64")},Cy=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64url")},_c=o=>Hr(o,"base64url"),_$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"hex")},V$e=o=>Hr(o,"hex");function fN(o){if(Mm&&Mm.getRandomValues){const p=new Uint8Array(o);return Mm.getRandomValues(p),p}if(ls&&ls.randomBytes)return new Uint8Array(ls.randomBytes(o));throw new Error("Secure random not available")}function eR(o,p){if(!(o instanceof Uint8Array)||!(p instanceof Uint8Array)||o.length!==p.length)return!1;let i=0;for(let n=0;n<o.length;n++)i|=o[n]^p[n];return i===0}function P$e(o,p,i,n){if((typeof o!="string"||typeof p!="string")&&typeof o!="string"&&typeof p!="string")throw new Error("Invalid input types");const s=i??"utf8",c=n??"utf8",e=Hr(o??"",s),y=Hr(p??"",c);return eR(e,y)}async function N$e(o,p){if(wu){const i=await wu.digest({name:o},Zm(p));return new Uint8Array(i)}if(ls){const i=o.replace("SHA-","sha"),n=ls.createHash(i);return n.update(Buffer.from(p)),new Uint8Array(n.digest())}throw new Error("Hash not available")}async function x$e(o,p,i,n){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const s=String(o??"SHA-256"),c=i??"utf8",e=n??"base64url",y=Hr(p??"",c),m=await N$e(s,y);return Ql(m,e)}async function tR(o,p,i){if(wu){const n=await wu.importKey("raw",Zm(p),{name:"HMAC",hash:{name:o}},!1,["sign"]),s=await wu.sign("HMAC",n,Zm(i));return new Uint8Array(s)}if(ls){const n=`sha${o.split("-")[1]}`,s=ls.createHmac(n,Buffer.from(p));return s.update(Buffer.from(i)),new Uint8Array(s.digest())}throw new Error("HMAC not available")}async function $$e(o,p,i,n,s,c){if(typeof o!="string"||typeof p!="string")throw new Error("Invalid input types for key or data; expected strings");const e=String(i??"SHA-256"),y=n??"utf8",m=s??"utf8",v=c??"base64url",E=Hr(o??"",y),b=Hr(p??"",m),w=await tR(e,E,b);return Ql(w,v)}async function iR(o,p,{iterations:i,length:n,hashAlg:s="SHA-256"}){if(wu){const c=await wu.importKey("raw",Zm(o),"PBKDF2",!1,["deriveBits"]),e=await wu.deriveBits({name:"PBKDF2",salt:Zm(p),iterations:i,hash:s},c,n*8);return new Uint8Array(e)}if(ls){const c=s==="SHA-512"?"sha512":"sha256";return await new Promise((e,y)=>{ls.pbkdf2(Buffer.from(o),Buffer.from(p),i,n,c,(m,v)=>{m?y(m):e(new Uint8Array(v))})})}throw new Error("PBKDF2 not available")}async function L$e(o,p,i,n,s,c,e,y){if(typeof o!="string"||typeof p!="string")throw new Error("Invalid input types for password or salt; expected strings");const m=c??"utf8",v=e??"utf8",E=y??"base64url",b=Math.max(1,Number(i)||21e4),w=Math.max(1,Number(n)||32),V=s??"SHA-256",$=Hr(o??"",m),M=Hr(p??"",v),k=await iR($,M,{iterations:b,length:w,hashAlg:V});return Ql(k,E)}async function M$e(o,p=fN(16),i=21e4,n=32,s="SHA-256"){const c=Hr(o,"utf8"),e=await iR(c,p,{iterations:i,length:n,hashAlg:s}),y=Cy(p),m=Cy(e);return`pbkdf2$${s.toLowerCase()}$${i}$${y}$${m}`}async function B$e(o,p){const i=String(p).split("$");if(i.length!==5||i[0]!=="pbkdf2")return!1;const n=i[1].toLowerCase(),s=parseInt(i[2],10),c=_c(i[3]),e=_c(i[4]),y=n.includes("512")?"SHA-512":"SHA-256",m=await iR(Hr(o,"utf8"),c,{iterations:s,length:e.length,hashAlg:y});return eR(m,e)}async function G$e(o,p,i,n,s,c){const e=p!=null?Math.max(1,Number(p)||0):void 0,y=i!=null?Math.max(1,Number(i)||0):void 0,m=n??void 0,v=c??"base64url",E=s!=null?Hr(s,v):void 0;return await M$e(String(o??""),E,e,y,m)}function U4(o){return Cy(Hr(JSON.stringify(o),"utf8"))}function bA(o){try{return JSON.parse(Ql(_c(o),"utf8"))}catch{return null}}async function k$e(o,p,{alg:i="HS256",includeIat:n=!0,expiresInSeconds:s,notBeforeSeconds:c,issuer:e,subject:y,audience:m,jwtid:v,header:E={}}={}){const b={alg:i,typ:"JWT",...E},w=Math.floor(Date.now()/1e3),V={...o||{}};n&&(V.iat=w),typeof s=="number"&&(V.exp=w+s),typeof c=="number"&&(V.nbf=w+c),e&&(V.iss=e),y&&(V.sub=y),m&&(V.aud=m),v&&(V.jti=v);const $=U4(b),M=U4(V),k=Hr(`${$}.${M}`,"utf8"),K=await tR(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,k),Y=Cy(K);return`${$}.${M}.${Y}`}async function j$e(o,p,i,n,s,c,e,y,m,v,E,b){if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(o!=null&&typeof o!="object")throw new Error("Invalid input type for payload; expected object");if(E!=null&&typeof E!="object")throw new Error("Invalid input type for header; expected object");if(v!=null&&typeof v!="string")throw new Error("Invalid input type for jwtid; expected string");if(e!=null&&typeof e!="string")throw new Error("Invalid input type for issuer; expected string");if(y!=null&&typeof y!="string")throw new Error("Invalid input type for subject; expected string");if(m!=null&&typeof m!="string"&&!Array.isArray(m))throw new Error("Invalid input type for audience; expected string or string[]");const V=Hr(p??"",b??"utf8");return await k$e(o??{},V,{alg:i??"HS256",includeIat:n==null?!0:!!n,expiresInSeconds:s!=null?Number(s):void 0,notBeforeSeconds:c!=null?Number(c):void 0,issuer:e??void 0,subject:y??void 0,audience:m??void 0,jwtid:v??void 0,header:E??void 0})}async function U$e(o,p,{alg:i="HS256",issuer:n,audience:s,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[y,m,v]=String(o).split(".");if(!y||!m||!v)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=bA(y),b=bA(m);if(!E||!b)return{valid:!1,header:E,payload:b,reason:"Bad base64/json"};if(E.alg!==i)return{valid:!1,header:E,payload:b,reason:"Alg mismatch"};const w=Hr(`${y}.${m}`,"utf8"),$=await tR(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,w),M=_c(v);if(!eR($,M))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const k=Math.floor(Date.now()/1e3),F=Math.max(0,Number(e)||0);if(b.nbf!=null&&k+F<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&k-F>=Number(b.exp))return{valid:!1,header:E,payload:b,reason:"Expired"};if(n&&b.iss!==n)return{valid:!1,header:E,payload:b,reason:"Issuer mismatch"};if(s){const K=b.aud;if(!(Array.isArray(K)?K.includes(s):K===s))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&k-Number(b.iat)>Number(c)+F?{valid:!1,header:E,payload:b,reason:"MaxAge exceeded"}:{valid:!0,header:E,payload:b}}catch(y){return{valid:!1,header:null,payload:null,reason:String((y==null?void 0:y.message)??y)}}}async function K$e(o,p,i,n,s,c,e,y){if(typeof o!="string")throw new Error("Invalid input type for token; expected string");if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(typeof n!="string")throw new Error("Invalid input type for issuer; expected string");if(s!=null&&typeof s!="string")throw new Error("Invalid input type for audience; expected string");const v=Hr(p??"",y??"utf8");return await U$e(String(o??""),v,{alg:i??"HS256",issuer:n??void 0,audience:s??void 0,maxAgeSeconds:c!=null?Number(c):void 0,clockSkewSeconds:e!=null?Number(e):void 0})}function F$e(o){const[p,i,n]=String(o).split(".");return{header:p?bA(p):null,payload:i?bA(i):null,signature:n?_c(n):new Uint8Array}}function S$e(o,p){if(!o)throw new Error("Token is required for decoding");if(typeof o!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:n,payload:s,signature:c}=F$e(String(o??"")),e=Ql(c,i);return{header:n,payload:s,signature:e}}class q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(et.GenerateRandomBytes);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)}),e=Math.max(0,Number(s)||0),y=c??"base64url",m=fN(e),v=Ql(m,y);return{value:G.Success,error:null,result:v}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomInteger);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[0],e=s[1],y=TOe(c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class H$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomFloat);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=qI();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class W$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomHexadecimal);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=FP(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomBase62);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=SP(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class J$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=EOe(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomAlphanumeric);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=qP(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class X$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateIdentifier);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[0],e=s[1],y=ZP(c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateRandomUUIDv4);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=Du();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class eLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{J.Logger.log("Initializing Random Generate Short Identifier Module");const n=i.find(s=>s.contextType===X.Logic);if(n){J.Logger.log("Project state found, setting up operation");const s=n.get(et.GenerateShortIdentifier);s?(J.Logger.log("Operation found, setting autoexecutable and implementation"),s.autoexecutable=!0,s.implementation=this.module.main):J.Logger.warn("Operation generate-short-identifier not found in project state")}else J.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,n)=>{try{const s=bOe();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class tLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(et.GenerateHexadecimalToken);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=AOe();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}function $bi(o){let p;if(o===null?p="null":Array.isArray(o)?p="array":p=typeof o,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class iLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(ze.GetTypeOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)||((m=e.value)==null?void 0:m.value)})[0];return{value:G.Success,error:null,result:$bi(c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class rLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.ToString);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=String(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class nLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.ToNumber);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=Number(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class aLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.ToBytes);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)}),y=Hr(s,c||"utf8");return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class sLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.FromBytesToString);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)}),y=Ql(s,c||"utf8");return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class lLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.EncodeBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)});return{value:G.Success,error:null,result:C$e(s,c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class oLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.DecodeBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=O$e(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class dLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.EncodeBase64Url);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Cy(s,c||"utf8");return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class uLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.DecodeBase64Url);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=_c(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class pLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.EncodeHex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=_$e(s,c||"utf8");return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class cLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(ze.DecodeHex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=V$e(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class fLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(li.Hash);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:x$e(s,c,e,y)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class yLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(li.Hmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)});return{value:G.Success,error:null,result:$$e(c,e,s,y,m,v)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class hLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(li.ConstantTimeEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:P$e(s,c,e,y)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class mLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(li.DeriveKeyPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b]=n.map(w=>{var V,$;return((V=w.value)==null?void 0:V.valueAsType)??(($=w.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:L$e(s,c,e,y,m,v,E,b)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class TLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Xr.Parse);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{var s;try{const c=(s=n[0].value)==null?void 0:s.value;if(typeof c!="string")throw new Error(`Invalid input type for JSON.parse operation: expected string, got ${typeof c}`);const e=JSON.parse(c);return{value:G.Success,error:null,result:e}}catch(c){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:c,result:null}}}})}}class vLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===X.Logic);if(n){const s=n.get(Xr.Stringify);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{var s,c;try{const e=(s=n[0].value)==null?void 0:s.value,y=(c=n[1].value)==null?void 0:c.value;if(!e||typeof e!="object"&&!Array.isArray(e))throw new Error(`Invalid input type for JSON.stringify operation: expected object or array, got ${typeof e}`);if(!y&&y!==0){const v=JSON.stringify(e);return{value:G.Success,error:null,result:v}}const m=JSON.stringify(e,null,y);return{value:G.Success,error:null,result:m}}catch(e){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e,result:null}}}})}}class ELe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(er.BuildJwtHmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b,w,V,$,M]=n.map(k=>{var F,K;return((F=k.value)==null?void 0:F.valueAsType)??((K=k.value)==null?void 0:K.value)});return{value:G.Success,error:null,result:await j$e(s,c,e,y,m,v,E,b,w,V,$,M)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class bLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(er.VerifyJwtHmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b]=n.map(w=>{var V,$;return((V=w.value)==null?void 0:V.valueAsType)??(($=w.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:await K$e(s,c,e,y,m,v,E,b)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class ALe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(er.DecodeJwt);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)});return{value:G.Success,error:null,result:S$e(s,c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class gLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Qr.HashPasswordPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)});return{value:G.Success,error:null,result:await G$e(s,c,e,y,m,v)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class ILe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[X.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===X.Logic),s=n==null?void 0:n.get(Qr.VerifyPasswordPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=await B$e(String(s??""),String(c??""));return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class sC extends HI{constructor(p,i,n=i.projectId){super(p,X.Editor),this._editor=i,this.id=n}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(p){this._editor.undoableStackValueIndex=p}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,i){return this._editor.initTest(p,i)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p,i={}){return this._editor.copyEntities(p,i)}resolveInitialChildrenPositions(p,i,n){return this._editor.resolveInitialChildrenPositions(p,i,n)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,i=!1){return this._editor.requestActiveDynamicValue(p,i)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,i){return this._editor.setValueTypePreference(p,i)}}function Lbi(o,p){return p instanceof sC?p:new sC(o,p)}class lC extends HI{constructor(p,i){super(p,X.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 Mbi(o,p){return p instanceof lC?p:new lC(o,p)}function Bbi(o){o.register(new tCe(o)),o.register(new eCe(o)),o.register(new JOe(o)),o.register(new XOe(o)),o.register(new QOe(o)),o.register(new YOe(o)),o.register(new GNe(o)),o.register(new kNe(o)),o.register(new jNe(o)),o.register(new KNe(o)),o.register(new UNe(o)),o.register(new FNe(o)),o.register(new Z$e(o)),o.register(new H$e(o)),o.register(new W$e(o)),o.register(new z$e(o)),o.register(new J$e(o)),o.register(new Y$e(o)),o.register(new X$e(o)),o.register(new Q$e(o)),o.register(new eLe(o)),o.register(new tLe(o)),o.register(new BPe(o)),o.register(new GPe(o)),o.register(new kPe(o)),o.register(new jPe(o)),o.register(new UPe(o)),o.register(new KPe(o)),o.register(new FPe(o)),o.register(new SPe(o)),o.register(new qPe(o)),o.register(new ZPe(o)),o.register(new HPe(o)),o.register(new WPe(o)),o.register(new zPe(o)),o.register(new JPe(o)),o.register(new YPe(o)),o.register(new XPe(o)),o.register(new QPe(o)),o.register(new eNe(o)),o.register(new tNe(o)),o.register(new nNe(o)),o.register(new aNe(o)),o.register(new sNe(o)),o.register(new rPe(o)),o.register(new nPe(o)),o.register(new aPe(o)),o.register(new sPe(o)),o.register(new lPe(o)),o.register(new oPe(o)),o.register(new dPe(o)),o.register(new uPe(o)),o.register(new pPe(o)),o.register(new fPe(o)),o.register(new yPe(o)),o.register(new hPe(o)),o.register(new mPe(o)),o.register(new TPe(o)),o.register(new bVe(o)),o.register(new AVe(o)),o.register(new gVe(o)),o.register(new u$e(o)),o.register(new Wxe(o)),o.register(new E_e(o)),o.register(new b_e(o)),o.register(new A_e(o)),o.register(new g_e(o)),o.register(new I_e(o)),o.register(new R_e(o)),o.register(new D_e(o)),o.register(new w_e(o)),o.register(new O_e(o)),o.register(new j_e(o)),o.register(new TVe(o)),o.register(new vVe(o)),o.register(new EVe(o)),o.register(new C_e(o)),o.register(new __e(o)),o.register(new V_e(o)),o.register(new P_e(o)),o.register(new N_e(o)),o.register(new x_e(o)),o.register(new $_e(o)),o.register(new L_e(o)),o.register(new M_e(o)),o.register(new B_e(o)),o.register(new G_e(o)),o.register(new k_e(o)),o.register(new U_e(o)),o.register(new K_e(o)),o.register(new F_e(o)),o.register(new S_e(o)),o.register(new q_e(o)),o.register(new Z_e(o)),o.register(new H_e(o)),o.register(new W_e(o)),o.register(new z_e(o)),o.register(new J_e(o)),o.register(new Y_e(o)),o.register(new X_e(o)),o.register(new lVe(o)),o.register(new oVe(o)),o.register(new dVe(o)),o.register(new Q_e(o)),o.register(new eVe(o)),o.register(new tVe(o)),o.register(new iVe(o)),o.register(new rVe(o)),o.register(new nVe(o)),o.register(new aVe(o)),o.register(new sVe(o)),o.register(new y$e(o)),o.register(new h$e(o)),o.register(new m$e(o)),o.register(new T$e(o)),o.register(new p$e(o)),o.register(new c$e(o)),o.register(new f$e(o)),o.register(new v$e(o)),o.register(new b$e(o)),o.register(new g$e(o)),o.register(new E$e(o)),o.register(new A$e(o)),o.register(new I$e(o)),o.register(new w$e(o)),o.register(new R$e(o)),o.register(new D$e(o)),o.register(new vPe(o)),o.register(new gPe(o)),o.register(new IPe(o)),o.register(new wPe(o)),o.register(new OPe(o)),o.register(new CPe(o)),o.register(new _Pe(o)),o.register(new VPe(o)),o.register(new PPe(o)),o.register(new NPe(o)),o.register(new xPe(o)),o.register(new RPe(o)),o.register(new DPe(o)),o.register(new bPe(o)),o.register(new APe(o)),o.register(new EPe(o)),o.register(new cPe(o)),o.register(new LPe(o)),o.register(new MPe(o)),o.register(new $Pe(o)),o.register(new qNe(o)),o.register(new hxe(o)),o.register(new yxe(o)),o.register(new mxe(o)),o.register(new Txe(o)),o.register(new WNe(o)),o.register(new zNe(o)),o.register(new txe(o)),o.register(new QNe(o)),o.register(new cxe(o)),o.register(new sxe(o)),o.register(new oxe(o)),o.register(new uxe(o)),o.register(new dxe(o)),o.register(new exe(o)),o.register(new rxe(o)),o.register(new nxe(o)),o.register(new ixe(o)),o.register(new SNe(o)),o.register(new JNe(o)),o.register(new lxe(o)),o.register(new bxe(o)),o.register(new tC(o)),o.register(new HNe(o)),o.register(new YNe(o)),o.register(new ZNe(o)),o.register(new pxe(o)),o.register(new XNe(o)),o.register(new axe(o)),o.register(new fxe(o)),o.register(new Exe(o)),o.register(new vxe(o)),o.register(new Axe(o)),o.register(new tC(o)),o.register(new Ixe(o)),o.register(new gxe(o)),o.register(new Rxe(o)),o.register(new ANe(o)),o.register(new gNe(o)),o.register(new INe(o)),o.register(new oNe(o)),o.register(new rNe(o)),o.register(new cNe(o)),o.register(new mNe(o)),o.register(new iNe(o)),o.register(new TNe(o)),o.register(new bNe(o)),o.register(new yNe(o)),o.register(new fNe(o)),o.register(new TA(o)),o.register(new RNe(o)),o.register(new DNe(o)),o.register(new hNe(o)),o.register(new ENe(o)),o.register(new vNe(o)),o.register(new pNe(o)),o.register(new uNe(o)),o.register(new dNe(o)),o.register(new lNe(o)),o.register(new CNe(o)),o.register(new ONe(o)),o.register(new _Ne(o)),o.register(new wNe(o)),o.register(new fVe(o)),o.register(new uVe(o)),o.register(new cVe(o)),o.register(new yVe(o)),o.register(new hVe(o)),o.register(new pVe(o)),o.register(new mVe(o)),o.register(new iLe(o)),o.register(new oLe(o)),o.register(new uLe(o)),o.register(new cLe(o)),o.register(new lLe(o)),o.register(new dLe(o)),o.register(new pLe(o)),o.register(new sLe(o)),o.register(new aLe(o)),o.register(new nLe(o)),o.register(new rLe(o)),o.register(new TLe(o)),o.register(new vLe(o)),o.register(new hLe(o)),o.register(new mLe(o)),o.register(new q$e(o)),o.register(new fLe(o)),o.register(new yLe(o)),o.register(new bLe(o)),o.register(new ELe(o)),o.register(new ALe(o)),o.register(new gLe(o)),o.register(new ILe(o)),o.register(new rCe(o)),o.register(new nCe(o)),o.register(new hA(o)),o.register(new mA(o))}class yN{constructor(p=new J.Events("extensions-registry-fallback-events")){I(this,"extensionsRegistry",new Map);I(this,"initialized",new Set);I(this,"initializedContexts",new Set);I(this,"onResolveEditorContextCallback",()=>null);I(this,"onResolveProjectLogicContextCallback",()=>null);I(this,"onResolveEditorGUIContextCallback",()=>null);I(this,"onResolveGUIContextCallback",()=>null);I(this,"onResolveCompileContextCallback",()=>null);I(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,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(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,i)=>(p.manifest.initPriority||Ee.Normal)-(i.manifest.initPriority||Ee.Normal))}async setup(){Bbi(this),J.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case X.Editor:return this.onResolveEditorContextCallback();case X.Logic:return this.onResolveProjectLogicContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();case X.Compile:return this.onResolveCompileContextCallback();case X.PublicationRun:return this.onResolvePublicationRunContextCallback();case X.GUI:return this.onResolveGUIContextCallback();case X.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,i=[]){const n=[];i.length===0&&(i=p.manifest.contexts);for(const s of i){const c=this.requestContext(s);c&&n.push(c)}return n}requestExtension(p){const i=this.extensionsRegistry.get(p);if(i)return i;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){var p,i;for(const n of this.extensionInOrder)if(n.module.init&&!this.initialized.has(n.manifest.id)){const s=n.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);s.length&&(await((i=(p=n.module).init)==null?void 0:i.call(p,s)),this.initialized.add(n.manifest.id))}else!n.module.init&&!this.initialized.has(n.manifest.id)&&this.initialized.add(n.manifest.id)}async initForReady(){J.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){J.Logger.log("Initializing "+p.manifest.id+" extension...");const i=this.requestContexts(p);p.manifest.contexts.every(s=>!!i.find(c=>c.contextType===s))?(await p.module.init(i),this.initialized.add(p.manifest.id)):J.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(s=>s.contextType).join(", ")}`)}else!p.module.init&&!this.initialized.has(p.manifest.id)?(J.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):J.Logger.log(`Skipping initialization of ${p.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,i){this.events.on(p,i)}emit(p,...i){this.events.emit(p,...i)}off(p,i){this.events.off(p,i)}emitAsync(p,...i){return this.events.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.events.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.events.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.events.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.events.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.events.emitAsyncSequentiallyAllSettled(p,...i)}async contextAvailable(p){if(this.initializedContexts.has(p)){J.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case X.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case X.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}J.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,i){window.localStorage.setItem("dynamic-value-type-preference--"+p,(i==null?void 0:i.toString())||""),this.emit(p,{})}}let Bb=null;const hN={requestExtension:o=>(Bb||(Bb=new yN,Bb.setup()),Bb.requestExtension(o))},Eu={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var mN=(o=>(o.FinishedSuccess="finished-success",o.FinishedError="finished-error",o.Running="running",o.Paused="paused",o.Stopped="stopped",o.NotStarted="not-started",o))(mN||{});const RLe={...hN,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class Iu extends J.Events{constructor(i,n,s,c=null,e=RLe){super();I(this,"project");I(this,"entryPoint");I(this,"state","not-started");I(this,"events",new J.Events("fe-exec-inst-events"));I(this,"entities",[]);I(this,"parentExecution",null);I(this,"executing",[]);I(this,"executed",[]);I(this,"skipped",[]);I(this,"scheduled",[]);I(this,"localTestValues");I(this,"resolvedValues");I(this,"persistedExecutionResults");I(this,"lastExecutionResults");I(this,"onAddToSkippedListCallback",null);I(this,"onRemoveFromSkippedListCallback",null);I(this,"onAddEntityCallback",null);I(this,"onRemoveEntityCallback",null);I(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=i,this.parentExecution=c,this.localTestValues=new Vm(x.UUID.uuid(),this.project),this.resolvedValues=new Vm(x.UUID.uuid(),this.project),this.persistedExecutionResults=new Vm(x.UUID.uuid(),this.project),this.lastExecutionResults=new Vm(x.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Zr.includes(i.type)&&wt(i).forEach(n=>this.skip(n))))}async schedule(i,n,s){if(this.hasExecuted(i))return null;if(Yt.includes(i.type))return this.executeBranch(i,s,n);if(qr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,s,n);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,n){const s=[];return[...ei,...Yt].includes(n.type)?s.push(...n.inputs):Ut.includes(n.type)&&s.push(...n.outputs),s.map(e=>{var m;let y=i.find(v=>v.valueOwner.id===e.id);if(y)return y;if(!y&&Yt.includes(n.type)&&(y=i.find(v=>{var E;return((E=v.valueOwner.declaration)==null?void 0:E.id)===e.id})),y){const v=(m=y.value)==null?void 0:m.clone(null);return v==null||v.setStandaloneParent(e,null),{...y,valueOwner:e,value:v||null,inheritanceLink:{sources:[y],target:e}}}return Ba.includes(e.type)?Ao(e,this.valueResolutionContext):Mu(e,this.valueResolutionContext)}).reduce((e,y)=>{const m=Oo(y==null?void 0:y.valueOwner,this.project),v=y?[y]:[];return m.forEach(E=>{var V,$,M;if(E.id===(y==null?void 0:y.valueOwner.id))return;const b=It(E.getDataType(null),E,this.project);b==null||b.metaSync({value:(V=y==null?void 0:y.value)==null?void 0:V.value},null),b==null||b.setValueAsTypeList((($=y==null?void 0:y.value)==null?void 0:$.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((M=y==null?void 0:y.value)==null?void 0:M.valueAsTypeSingle)||null);const w={...y,valueOwner:E,value:b};v.push(w)}),[...e,...v]},[]).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,n,s,c={}){var y,m;const e={...Eu,...c};try{let v={value:G.Success,error:null,result:null};if(n.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(vr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(uy+i.declaration.id).module.main;E?v=await E(i,n):J.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{v=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);let E=null;if(v.error){J.Logger.warn("Raw error executing entity: ",v.error);const b=(y=i.error)==null?void 0:y.getDataType(null),w=It(b||null,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(v.error):w==null||w.metaSync({value:v.error},null),E={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:w}}return{value:v.value,entity:i,error:E,result:{value:v.result||null,valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null}}}return{...v,entity:i}}catch(v){J.Logger.warn("Internal call execution error: ",v);let E=null;if(i.error){const b=(m=i.error)==null?void 0:m.getDataType(null),w=It(b,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(v):w==null||w.metaSync({value:v},null),E={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:w}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:E,result:null}}}static async executeOperation(i,n,s){var c,e;try{let y={value:G.Success,error:null,result:null};n.sort((b,w)=>b.valueOwner.index-w.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,n));let m=null;if(y.error&&i.error){J.Logger.warn("Raw error executing entity: ",y.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,w=It(b,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(y.error):w==null||w.metaSync({value:y.error},null),m={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:w}}const v=i==null?void 0:i.getDataType(null),E=It(v,i,s);return v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y.result):E==null||E.metaSync({value:y.result},null),{value:y.value,entity:i,error:m,result:{value:E||null,valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null}}}catch(y){J.Logger.warn("Operation execution error: ",y);let m=null;if(i.error){const v=(e=i.error)==null?void 0:e.getDataType(null),E=It(v,i.error,s);v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y):E==null||E.metaSync({value:y},null),m={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:m,result:null}}}async executeSearch(i,n,s){var c;try{let e={value:G.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(Ae.SEARCH_NODE_IMPLEMENTATION)).module.main(i,n),m=i==null?void 0:i.getDataType(null),v=It(m,i,s);return v==null||v.metaSync({value:y},null),y.error?{value:G.UnhandledError,entity:i,error:{valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null,value:v},result:null}:{value:e.value,entity:i,error:null,result:{value:v,valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null}}}catch(e){if(J.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const y=(c=i.error)==null?void 0:c.getDataType(null),m=It(y,i.error,s);return m==null||m.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:m},result:null}}}async executeLoop(i,n,s,c={}){var y,m,v,E,b,w;const e={...Eu,...c};try{let V={value:G.Success,error:null,result:null};const $=n.map(ie=>{var ee,de;return((ee=ie==null?void 0:ie.value)==null?void 0:ee.valueAsType)||((de=ie==null?void 0:ie.value)==null?void 0:de.value)});let M={};i.getUniqueInputMaps().forEach(ie=>{const ee=i.body.inputs.find(ve=>le(ve,s)===le(ie,s)),de=ie==null?void 0:ie.getDataType(null),ae=It(de,ee,s);de!=null&&de.asType?ae==null||ae.setValueAsTypeList([]):ae==null||ae.metaSync({value:[]},null),this.lastExecutionResults.writeValue(ee,ae);const fe={value:ae,valueOwner:ee,type:Pe.ExecutionResult,inheritanceLink:null};M[ee.id]=fe});let F={value:G.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case Q.loop["counted-loop"].id:{const ie=$[0];let ee=1;for(;ee<=ie&&ee<=50;){const de=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const fe=i.currentIterationNumberArgumentDeclaration.getDataType(null),ve=mc(fe),ue=this.lastExecutionResults.readValue(ae.id);if(ue){ue.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ae,ue);const $e={value:ue,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null};return M[ae.id]=$e,$e}const ye={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ee,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:ve,standaloneParent:ae.toReference()},Ve=Si(ye,s);this.lastExecutionResults.writeValue(ae,Ve);const _e={value:Ve,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null};return M[ae.id]=_e,_e}else return M[ae.id]}).filter(ae=>!!ae);if(F=await this.executeFullFunctionDeclarationLogic(i.body,de,e),(F.results||[]).forEach(ae=>{var ye,Ve,_e,$e;if(ae.valueOwner.type!==d.InputMap||Ut.includes(ae.valueOwner.parent.type))return;const fe=i.body.inputs.find(Ne=>le(Ne,s)===le(ae.valueOwner,s)),ue=[...((Ve=(ye=M==null?void 0:M[fe.id])==null?void 0:ye.value)==null?void 0:Ve.value)||[],((_e=ae==null?void 0:ae.value)==null?void 0:_e.value)||null];($e=M[fe.id].value)==null||$e.metaSync({value:ue},null),this.lastExecutionResults.writeValue(fe,M[fe.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["manual-flow-loop"].id:{let ie=1;for(;ie<=50;){const ee=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ae=this.lastExecutionResults.readValue(de.id);if(ae){ae.metaSync({value:ie},null),this.lastExecutionResults.writeValue(de,ae);const ye={value:ae,valueOwner:de,type:Pe.ExecutionResult,inheritanceLink:null};return M[de.id]=ye,ye}const fe=i.currentIterationNumberArgumentDeclaration.getDataType(null),ve=It(fe,de,s);return ve==null||ve.metaSync({value:ie},null),this.lastExecutionResults.writeValue(de,ve),{value:ve,valueOwner:de,type:Pe.ExecutionResult,inheritanceLink:null}}else return M[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ee,e),(F.results||[]).forEach(de=>{var ue,ye,Ve;if(de.valueOwner.type!==d.InputMap||Ut.includes(de.valueOwner.parent.type))return;const ae=i.body.inputs.find(_e=>le(_e,s)===le(de.valueOwner,s)),ve=[...(ue=M[ae.id].value)==null?void 0:ue.value,((ye=de.value)==null?void 0:ye.value)||null];(Ve=M[ae.id].value)==null||Ve.metaSync({value:ve},null),this.lastExecutionResults.writeValue(ae,M[ae.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ie++}break}case Q.loop["list-loop"].id:{const ie=$[0];let ee=1;const de=ie;for(let ae=0;ae<de.length;ae++){const fe=de[ae],ve=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ue.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,ye),{value:ye,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const Ve=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=It(Ve,ue,s);return _e==null||_e.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=mc(ye),_e=this.lastExecutionResults.readValue(ue.id);if(_e)return _e.metaSync({value:fe},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const $e={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:fe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ve,standaloneParent:ue.toReference()},Ne=Si($e,s);return this.lastExecutionResults.writeValue(ue,Ne),{value:Ne,valueOwner:i.currentValueArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else return M[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Ne,Be;if(ue.valueOwner.type!==d.InputMap||Ut.includes(ue.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>le(Se,s)===le(ue.valueOwner,s)),_e=[...($e=M[ye.id].value)==null?void 0:$e.value,((Ne=ue.value)==null?void 0:Ne.value)||null];(Be=M[ye.id].value)==null||Be.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,M[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["object-keys-loop"].id:{const ie=$[0];let ee=1;const de=ie?Object.keys(ie):[];for(let ae=0;ae<de.length;ae++){const fe=de[ae],ve=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ue.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,ye),{value:ye,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const Ve=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=It(Ve,ue,s);return _e==null||_e.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=mc(ye),_e=this.lastExecutionResults.readValue(ue.id);if(_e)return _e.metaSync({value:fe},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const $e={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:fe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ve,standaloneParent:ue.toReference()},Ne=Si($e,s);return this.lastExecutionResults.writeValue(ue,Ne),{value:Ne,valueOwner:i.currentValueArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else return M[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Ne,Be;if(ue.valueOwner.type!==d.InputMap||Ut.includes(ue.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>le(Se,s)===le(ue.valueOwner,s)),_e=[...($e=M[ye.id].value)==null?void 0:$e.value,((Ne=ue.value)==null?void 0:Ne.value)||null];(Be=M[ye.id].value)==null||Be.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,M[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["object-values-loop"].id:{const ie=$[0];let ee=1;const de=ie?Object.values(ie):[];for(let ae=0;ae<de.length;ae++){const fe=de[ae],ve=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ue.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,ye),{value:ye,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const Ve=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=It(Ve,ue,s);return _e==null||_e.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=mc(ye),_e=this.lastExecutionResults.readValue(ue.id);if(_e)return _e.metaSync({value:fe},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const $e={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:fe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ve,standaloneParent:ue.toReference()},Ne=Si($e,s);return this.lastExecutionResults.writeValue(ue,Ne),{value:Ne,valueOwner:i.currentValueArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else return M[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Ne,Be;if(ue.valueOwner.type!==d.InputMap||Ut.includes(ue.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>le(Se,s)===le(ue.valueOwner,s)),_e=[...($e=M[ye.id].value)==null?void 0:$e.value,((Ne=ue.value)==null?void 0:Ne.value)||null];(Be=M[ye.id].value)==null||Be.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,M[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["string-loop"].id:{const ie=$[0];let ee=1;const de=ie.split("");for(let ae=0;ae<de.length;ae++){const fe=de[ae],ve=i.body.inputs.map(ue=>{if(ue===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ue.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,ye),{value:ye,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const Ve=i.currentIterationNumberArgumentDeclaration.getDataType(null),_e=It(Ve,ue,s);return _e==null||_e.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=mc(ye),_e=this.lastExecutionResults.readValue(ue.id);if(_e)return _e.metaSync({value:fe},null),this.lastExecutionResults.writeValue(ue,_e),{value:_e,valueOwner:ue,type:Pe.ExecutionResult,inheritanceLink:null};const $e={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:fe,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Ve,standaloneParent:ue.toReference()},Ne=Si($e,s);return this.lastExecutionResults.writeValue(ue,Ne),{value:Ne,valueOwner:i.currentValueArgumentDeclaration,type:Pe.ExecutionResult,inheritanceLink:null}}else return M[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Ne,Be;if(ue.valueOwner.type!==d.InputMap||Ut.includes(ue.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>le(Se,s)===le(ue.valueOwner,s)),_e=[...($e=M[ye.id].value)==null?void 0:$e.value,((Ne=ue.value)==null?void 0:Ne.value)||null];(Be=M[ye.id].value)==null||Be.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,M[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}}if(V={value:[G.CaughtError,G.Return].includes(F.value)?F.value:G.Success,error:((m=(y=F.error)==null?void 0:y.value)==null?void 0:m.value)||null,result:((E=(v=F==null?void 0:F.result)==null?void 0:v.value)==null?void 0:E.value)||null},V.error&&i.error){const ie=(b=i.error)==null?void 0:b.getDataType(null),ee=It(ie||null,i.error,s);ie!=null&&ie.asType?ee==null||ee.setValueAsTypeSingle(V.error):ee==null||ee.metaSync({value:V.error},null);const de={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:ee};return{value:V.value,entity:i,error:de,result:null}}const K=i==null?void 0:i.getDataType(null),Y=It(K,i,s);return K!=null&&K.asType?Y==null||Y.setValueAsTypeSingle(V.result):Y==null||Y.metaSync({value:V.result},null),{value:V.value,entity:i,error:null,result:{value:Y||null,valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null}}}catch(V){if(J.Logger.warn("Error executing loop: ",V),i.error){const $=(w=i.error)==null?void 0:w.getDataType(null),M=It($,i.error,s);return $!=null&&$.asType?M==null||M.setValueAsTypeSingle(V):M==null||M.metaSync({value:V},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:M},result:null}}else return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,n,s,c={}){var y,m,v,E,b,w,V,$,M,k,F,K,Y,ie,ee,de,ae,fe,ve,ue,ye,Ve,_e,$e,Ne,Be;const e={...Eu,...c};try{const Se=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);let je=null;if(Se.error&&i.error){J.Logger.warn("Raw error executing entity: ",Se.error);const dt=(y=i.error)==null?void 0:y.getDataType(null),_t=It(dt||null,i.error,s);dt!=null&&dt.asType?(v=(m=Se.error)==null?void 0:m.value)!=null&&v.valueAsTypeSingle?_t==null||_t.setValueAsTypeSingle((b=(E=Se.error)==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle):(V=(w=Se.error)==null?void 0:w.value)!=null&&V.valueAsTypeList&&Array.isArray((M=($=Se.error)==null?void 0:$.value)==null?void 0:M.valueAsTypeList)&&(_t==null||_t.setValueAsTypeList((F=(k=Se.error)==null?void 0:k.value)==null?void 0:F.valueAsTypeList)):_t==null||_t.metaSync({value:(Y=(K=Se.error)==null?void 0:K.value)==null?void 0:Y.value},null),je={valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:_t}}let Ze=G.Success;Se.value===G.UnhandledError&&(i.catchesError||i.errorCalls.length?Ze=G.CaughtError:Ze=G.UnhandledError);const Ye=i==null?void 0:i.getDataType(null),st=It(Ye,i,s);return Ye!=null&&Ye.asType?(ee=(ie=Se.result)==null?void 0:ie.value)!=null&&ee.valueAsTypeSingle?st==null||st.setValueAsTypeSingle((ae=(de=Se.result)==null?void 0:de.value)==null?void 0:ae.valueAsTypeSingle):(ve=(fe=Se.result)==null?void 0:fe.value)!=null&&ve.valueAsTypeList&&Array.isArray((ye=(ue=Se.result)==null?void 0:ue.value)==null?void 0:ye.valueAsTypeList)&&(st==null||st.setValueAsTypeList((_e=(Ve=Se.result)==null?void 0:Ve.value)==null?void 0:_e.valueAsTypeList)):st==null||st.metaSync({value:((Ne=($e=Se.result)==null?void 0:$e.value)==null?void 0:Ne.value)||null},null),{value:Ze,entity:i,error:je,result:{value:st||null,valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null}}}catch(Se){if(!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const je=(Be=i.error)==null?void 0:Be.getDataType(null),Ze=It(je,i.error,s);return je!=null&&je.asType?Ze==null||Ze.setValueAsTypeSingle(Se):Ze==null||Ze.metaSync({value:Se},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Pe.ExecutionResult,inheritanceLink:null,value:Ze},result:null}}}async executeCondition(i,n){var c,e,y,m;let s=!1;switch(i.declaration.id){case en.BooleanIsTrue:{const v=(e=(c=n[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof v!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");s=v===!0;break}case en.BooleanIsFalse:{const v=(m=(y=n[0])==null?void 0:y.value)==null?void 0:m.value;if(typeof v!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");s=v===!1;break}case or.And:{s=(await Promise.all(i.andChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).every(E=>E);break}case or.Or:{s=(await Promise.all(i.orChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).some(E=>E);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:s?G.Success:G.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,n,s,c={}){const e={...Eu,...c,onBeforeEntityExecution:(v,E,b)=>{var w;return((w=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:w.call(c,v,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(v,E,b)=>{var w;return((w=c==null?void 0:c.onEntityExecuted)==null?void 0:w.call(c,v,E,{...b,detached:!0}))||Promise.resolve()}},y=new Iu(s,[i,...xA(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,n)}async executeFullFunctionDeclarationLogic(i,n,s={}){const c={...Eu,...s},e=xA(i);e.forEach(v=>{this.addEntity(v)}),e.reduce((v,E)=>Ut.includes(E.type)?[...v,...E.outputs]:ei.includes(E.type)&&E.type!==d.Condition?[...v,...E.outputs,...E.inputs]:E.type===d.Condition?[...v,...E.inputs]:v,[]).forEach(v=>{this.lastExecutionResults.removeValue(v.id)});const m=await this.executeBranch(i,c,n);return{...m||{},value:(m==null?void 0:m.value)||G.Success,entity:i,error:(m==null?void 0:m.error)||null,result:(m==null?void 0:m.result)||null}}static async executeEntryPointEntity(i,n){return{value:G.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,n){var y,m,v,E,b,w,V;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Pe.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)yr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const M=It(c,i,this.project);M==null||M.metaSync({value:$},null),s={valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null,value:M}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(M=>{var k,F;if(((k=M.declaration)==null?void 0:k.type)===d.Property&&M.declaration.static){const K=this.lastExecutionResults.readValue(M.declaration.id),Y=le(M,this.project),ie=M.codeName||((F=M.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,K);else{const ee=It(M.getDataType(null),M,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&yr((w=s.value)==null?void 0:w.value)?((V=s.value)==null?void 0:V.value)||{}:{};return i.outputs.map($=>{var K;const M=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),k=e[M],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:k},null),Pe.ExecutionResult}),s.type=Pe.ExecutionResult,{value:G.Return,entity:i,error:null,result:s}}async executeContinueStatement(i,n){var y,m,v,E,b,w,V;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Pe.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)yr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const M=It(c,i,this.project);M==null||M.metaSync({value:$},null),s={valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null,value:M}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(M=>{var k,F;if(((k=M.declaration)==null?void 0:k.type)===d.Property&&M.declaration.static){const K=this.lastExecutionResults.readValue(M.declaration.id),Y=le(M,this.project),ie=M.codeName||((F=M.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,K);else{const ee=It(M.getDataType(null),M,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&yr((w=s.value)==null?void 0:w.value)?((V=s.value)==null?void 0:V.value)||{}:{};return i.outputs.map($=>{var K;const M=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),k=e[M],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:k},null),Pe.ExecutionResult}),s.type=Pe.ExecutionResult,{value:G.Continue,entity:i,error:null,result:s}}async executeBreakStatement(i,n){var y,m,v,E,b,w,V;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Pe.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)yr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const M=It(c,i,this.project);M==null||M.metaSync({value:$},null),s={valueOwner:i,type:Pe.ExecutionResult,inheritanceLink:null,value:M}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(M=>{var k,F;if(((k=M.declaration)==null?void 0:k.type)===d.Property&&M.declaration.static){const K=this.lastExecutionResults.readValue(M.declaration.id),Y=le(M,this.project),ie=M.codeName||((F=M.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,K);else{const ee=It(M.getDataType(null),M,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&yr((w=s.value)==null?void 0:w.value)?((V=s.value)==null?void 0:V.value)||{}:{};return i.outputs.map($=>{var K;const M=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),k=e[M],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:k},null),Pe.ExecutionResult}),s.type=Pe.ExecutionResult,{value:G.Break,entity:i,error:null,result:s}}async executeVariable(i,n){var m,v,E,b,w,V;let s=Ao(i,this.valueResolutionContext);const c=Hn(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let $={};if(((m=e==null?void 0:e.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...e.entity.getActiveRawDefaultValue()}),s!=null&&s.value)yr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const M=It(e,i,this.project);M==null||M.metaSync({value:$},null),s={valueOwner:c,type:Pe.ExecutionResult,inheritanceLink:null,value:M}}this.lastExecutionResults.writeValue(c,s.value),c.inputs.forEach(M=>{var k,F;if(((k=M.declaration)==null?void 0:k.type)===d.Property&&M.declaration.static){const K=this.lastExecutionResults.readValue(M.declaration.id),Y=le(M,this.project),ie=M.codeName||((F=M.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,K);else{const ee=It(M.getDataType(null),M,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(M.declaration,ee)}}})}else this.lastExecutionResults.writeValue(c,s==null?void 0:s.value);const y=(b=s==null?void 0:s.value)!=null&&b.value&&yr((w=s.value)==null?void 0:w.value)?((V=s.value)==null?void 0:V.value)||{}:{};return i.outputs.map($=>{var K;const M=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),k=y[M],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:k},null),Pe.ExecutionResult}),s.type=Pe.ExecutionResult,{value:G.Success,entity:i,error:null,result:s}}mergeValues(i,n){const s=[];for(let c=0;c<n.length;c++)i!=null&&i[c]?s.push(i[c]):s.push(n[c]);return s}async executeEntity(i,n=[],s={}){var y,m,v,E,b,w,V,$,M,k,F;const c={...Eu,...s},e={detached:!1};switch(i.type){case d.Condition:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((y=c.onBeforeEntityExecution)==null?void 0:y.call(c,i,K,e)),this.executeCondition(i,K)}case d.InternalCall:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((m=c.onBeforeEntityExecution)==null?void 0:m.call(c,i,K,e)),this.executeInternalCall(i,K,this.project)}case d.Operation:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((v=c.onBeforeEntityExecution)==null?void 0:v.call(c,i,K,e)),Iu.executeOperation(i,K,this.project)}case d.VariableInstance:case d.VariableDeclaration:return this.executeVariable(i,n);case d.FunctionCall:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,K,e)),this.executeFunctionCall(i,K,this.project)}case d.FunctionDeclaration:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,K,e)),Iu.executeEntryPointEntity(i,K)}case d.Search:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((w=c.onBeforeEntityExecution)==null?void 0:w.call(c,i,K,e)),this.executeSearch(i,K,this.project)}case d.Loop:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((V=c.onBeforeEntityExecution)==null?void 0:V.call(c,i,K,e)),this.executeLoop(i,K,this.project,c)}case d.ReturnStatement:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await(($=c.onBeforeEntityExecution)==null?void 0:$.call(c,i,K,e)),this.executeReturnStatement(i,K)}case d.ContinueStatement:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,K,e)),this.executeContinueStatement(i,K)}case d.BreakStatement:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((k=c.onBeforeEntityExecution)==null?void 0:k.call(c,i,K,e)),this.executeBreakStatement(i,K)}case d.GlobalEvent:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((F=c.onBeforeEntityExecution)==null?void 0:F.call(c,i,K,e)),Iu.executeEntryPointEntity(i,K)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var s,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((s=i.result)!=null&&s.valueOwner))return;const n=Oo((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?n.forEach(y=>{var m;this.lastExecutionResults.writeValue(y,(m=i.result)==null?void 0:m.value)}):n.forEach(y=>{this.lastExecutionResults.removeValue(y.id)})}async executeBranch(i,n={},s=[]){var v;const c={...Eu,...n},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const m=await this.executeEntity(i,s,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(m),await((v=c.onEntityExecuted)==null?void 0:v.call(c,i,m,e)),m.value===G.Success){const E=(i.successCalls||i.calls||[]).filter(M=>this.hasEntity(M));(i.errorCalls||[]).forEach(M=>{this.skip(M)});let w=[];const V=(await Promise.all(E.map(M=>this.schedule(M,[],c)))).filter(M=>!!M),$=V.filter(M=>!!M).find(M=>M.value===G.CaughtError||M.value===G.Return||M.value===G.Break||M.value===G.Continue);return $||(w=[...w,...V],m)}else if(m.value===G.CaughtError||m.value===G.ConditionNotMet){const E=(i.errorCalls||[]).filter(M=>this.hasEntity(M));(i.successCalls||i.calls||[]).forEach(M=>{this.skip(M)});let w=[];const V=(await Promise.all(E.map(M=>this.schedule(M,[],c)))).filter(M=>!!M),$=V.filter(M=>!!M).find(M=>M.value===G.CaughtError||M.value===G.UnhandledError||M.value===G.Return||M.value===G.Break||M.value===G.Continue);return $||(w=[...w,...V],m)}else{if(m.value===G.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),Zr.includes(m.entity.type)&&wt(m.entity).forEach(E=>{this.skip(E)}),m;if(m.value===G.Return)return m;if(m.value===G.Break)return m;if(m.value===G.Continue)return m}return m}async execute(i={},n=[]){const s={...Eu,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,s,n);return this.state="finished-success",c}addEntity(i){var n;this.entities.includes(i)||(this.entities.push(i),(n=this.onAddEntityCallback)==null||n.call(this,i,{}))}async addEntityAsync(i,n={}){var s;this.entities.includes(i)||(this.entities.push(i),await((s=this.onAddEntityCallback)==null?void 0:s.call(this,i,n)))}addEntities(i){i.forEach(n=>this.addEntity(n))}async addEntitiesAsync(i,n={}){const s=J.YieldTracker.from(n),c=[];for(const e of i)c.push(this.addEntityAsync(e,n)),await s.tick();await Promise.all(c)}removeEntity(i){var n;if(i!==this.entryPoint){const s=this.entities.indexOf(i);s>-1&&(this.entities.splice(s,1),(n=this.onRemoveEntityCallback)==null||n.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)===d.FunctionDeclaration&&((y=(e=i.parent)==null?void 0:e.parent)==null?void 0:y.type)===d.DefinitionEntity)return this.entities.includes(i.parent);const n=oi(i);if(!n)return!1;const s=n.type===d.Loop&&i.parent===n.body?n.body:null;return s?this.entities.includes(s)||this.entities.includes(n):this.entities.includes(n)}removeScheduled(i){const n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,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 n=this.project.get(i);return n?this.hasEntity(n):!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 n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,1)}removeFromExecutingList(i){var s;const n=this.executing.indexOf(i);n>-1&&(this.executing.splice(n,1),(s=this.onAbortExecutionCallback)==null||s.call(this,i,{}))}removeFromAlreadyExecutedList(i){const n=this.executed.indexOf(i);n>-1&&this.executed.splice(n,1)}removeFromSkippedList(i){var s;const n=this.skipped.indexOf(i);n>-1&&(this.skipped.splice(n,1),(s=this.onRemoveFromSkippedListCallback)==null||s.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var n;this.skipped.includes(i)||(this.skipped.push(i),(n=this.onAddToSkippedListCallback)==null||n.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,n){this.parentContext.setValueTypePreference(i,n),this.emit(i,{})}}function Gbi(o){var p,i;if(o.isList)return"list";if(((p=o.entity)==null?void 0:p.type)===d.DefinitionEntity)return"definition-entity";switch((i=o.entity)==null?void 0:i.name){case oe.Number:return"number";case oe.String:return"text";case oe.Boolean:return"boolean";case oe.UUID:return"uuid";case oe.Date:return"date-time";default:return"definition-entity"}}const ss={[d.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[d.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[d.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[d.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[d.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[d.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[d.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[d.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[d.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[d.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[d.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[d.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[d.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[d.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[d.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[d.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[d.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[d.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[d.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[d.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[d.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[d.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function TN(o){const p=LR(o);if(!p){const n=$y(o);if(n.includes(Re.HTTP_ENDPOINT))return"HTTP endpoint";if(n.includes(Re.PERSISTED_ENTITY))return"Persisted entity";if(n.includes(Re.CRON_JOB))return"Scheduled execution";if(n.includes(Re.RELATIONAL_DATABASE))return"Relational database"}if(p){let n="Extension of "+le(p,p.project)+" entity",s=wo(n);const c=$y(o);return c.includes(Re.HTTP_ENDPOINT)?"HTTP endpoint"+(s?", "+s:""):c.includes(Re.PERSISTED_ENTITY)?"Persisted entity"+(s?", "+s:""):c.includes(Re.CRON_JOB)?"Scheduled execution"+(s?", "+s:""):c.includes(Re.RELATIONAL_DATABASE)?"Relational database"+(s?", "+s:""):n}let i="";return o.abstract&&(i="Template "),o.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function DLe(o){return o.parent.type===d.DefinitionEntity||o.parent.type===d.InstalledProject?"Internal action of "+le(o.parent,o.project):o.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function vN(o){return hx(o)?DLe(o):"Custom trigger"}function kbi(o){var p;switch(o.type){case d.DefinitionEntity:return TN(o);case d.FunctionDeclaration:return vN(o)}return(p=ss[o.type])==null?void 0:p.singular}function jbi(o){var p;switch(o.type){case d.DefinitionEntity:return TN(o);case d.FunctionDeclaration:return vN(o)}return(p=ss[o.type])==null?void 0:p.singular}const EN=4e4,wLe=280,Ubi=300,bN=65,py=32,Wb=39,OLe=26,CLe=49,AA=44,Kbi=35,zb=52,AN=10,ud=AN*2,gA=38,Jb=90,oC=270,_Le=EN/2+120,VLe=EN/2+180;function PLe(o){let i=py+AA+gA+AN;const n=[...o.inputs];return n.length&&(i+=ud,n.forEach(()=>{i+=OLe})),{height:i,width:280}}function NLe(o){let i=bN;const n=[];if([d.DefinitionEntity].includes(o.type)){const m=[...o.suggestedProperties||[],...o.properties||[]];m.length&&(i+=ud,m.forEach(v=>{i+=v.static?CLe:Wb}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(o.type)){const m=[...(o==null?void 0:o.suggestedMethods)||[],...o.methods||[],...o.functions||[],...o.body?[o.body]:[]];m.length&&(i+=ud,m.forEach(v=>{const E=PLe(v);i+=E.height}))}ei.includes(o.type)?(Gt.includes(o.type)?n.push(...(o.usedInputs||[]).flatMap(m=>[m])||[]):n.push(...(o.inputs||[]).flatMap(m=>[m])||[]),o.error&&(i+=zb)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)?(n.push(...o.outputs||[]),o.throws&&(i+=zb)):o.type===d.Condition&&(n.push(o.inputs[0]),o.inputs[1]&&n.push(o.inputs[1]));const s=n.length;s&&(i+=s*Wb,i+=ud);const c=[];if(o.type===d.FunctionDeclaration||o.type===d.GlobalEvent?c.push(...o.inputs||[]):ei.includes(o.type)&&(Gt.includes(o.type)?c.push(...o.usedOutputs||[]):c.push(...o.outputs||[])),Gt.includes(o.type)){o.readsValue&&(i+=ud,i+=AA),o.writesValues.length&&(i+=ud,i+=AA),o.internalCalls.length&&o.usedInternalCalls.forEach(()=>i+=zb+ud);const m=o.getDataType(null);(!m||m.inferred)&&(i+=gA)}const e=c.length;return e&&(i+=e*Wb,i+=ud),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)&&(i+=gA),{height:i,width:280}}function cv(o){return`${o.split("-").map((n,s)=>s===0?n.charAt(0).toUpperCase()+n.slice(1):n.toLowerCase()).join(" ")}.`}function Fbi(o){switch(o.code){case he.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case he.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case he.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case he.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case he.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case he.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case he.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case he.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case he.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Ie.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case he.NoProperties:return"This entity has no properties, so it doesn't do anything";case he.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case he.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case he.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case he.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case he.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case he.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case he.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case he.PropertyImplementsNonAbstact:return"This property implements a non-template property";case he.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case he.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case he.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case he.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case he.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Ie.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ie.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ie.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ie.UnreachableEntity:return"This entity is unreachable";case he.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case he.AbstractEntityImplements:return"This template entity implements a non-template entity";case he.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case he.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case he.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case he.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case he.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case he.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case he.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case he.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case he.MissingRequiredValue:return"This action is missing a required value";case he.NoPrimaryKeyProperty:return"This entity has no primary key property";case he.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case he.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case he.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case he.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case he.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case he.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case he.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ie.EmptyName:return"This entity has no name";case Ie.InvalidObjectStructure:return"This entity has an invalid structure";case Ie.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ie.MissingCaller:return"This action is missing a caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ie.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ie.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case xo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case xo.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case Ga.UUIDMustBeString:return`UUID must be a string, eg: "${Du()}"`;case Ga.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Du()}"`;case Ga.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${Du()}"`;case aa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case aa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case aa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cv(o.code)}}function Sbi(o){switch(o.code){case he.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case he.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case he.IncorrectEntityImplementation:return"Incorrect implementation";case he.IncorrectMethodImplementation:return"Incorrect action implementation";case he.IncorrectPropertyImplementation:return"Incorrect property implementation";case he.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case he.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case he.MissingMethodImplementation:return"Missing action";case he.MissingPropertyImplementation:return"Missing property";case Ie.NameNotUniqueInScope:return"Duplicate name";case he.NoProperties:return"No properties";case he.NonStaticPropertyInStaticEntity:return"Non-static property";case he.StaticEntityWithNonStaticProperties:return"Non-static properties";case he.ReadingFromIncompatibleType:return"Read from different type";case he.WritingToIncompatibleType:return"Write to different type";case he.ScopeWithoutLogic:return"No logic";case he.NonStaticPropertyImplementsStatic:return"Invalid static property";case he.PropertyImplementsIncompatibleType:return"Incompatible data type";case he.PropertyImplementsNonAbstact:return"Non-template property";case he.StaticPropertyImplementsNonStatic:return"Non-static property";case he.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case he.VariableHasInputsAndInternalCall:return"Bad internal call";case he.VariableHasOutputsAndInternalCall:return"Bad internal call";case he.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Ie.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ie.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ie.InternalCallParentMissingDataType:return"Parent has no data type";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ie.UnreachableEntity:return"Unreachable entity";case he.DisconnectedCallableEntity:return"Disconnected entity";case he.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case he.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case he.InvalidPropertiesCombination:return"Invalid properties combination";case he.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case he.ExtendsIncompatibleEntities:return"Extends incompatible entities";case he.ImplementingNonAbstractEntity:return"Implementing non-template entity";case he.ImplementsIncompatibleEntities:return"Implements incompatible entities";case he.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case he.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case he.MissingRequiredValue:return"Missing required value";case he.NoPrimaryKeyProperty:return"No primary key property";case he.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case he.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case he.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case he.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case he.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case he.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case he.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Ie.EmptyName:return"Empty name";case Ie.InvalidObjectStructure:return"Invalid object structure";case Ie.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MissingCaller:return"Missing caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ie.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case xo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case xo.StatusCodeMustBeNumber:return"HTTP status code must be a number";case Ga.UUIDMustBeString:return"UUID must be a string";case Ga.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case Ga.UUIDMustBeValidFormat:return"UUID must be in a valid format";case aa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case aa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case aa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cv(o.code)}}function qbi(o){switch(o.code){case he.AbstractEntityWithNonAbstractMethods:return`${le(o.entity,o.entity.project)} has non-template actions`;case he.AbstractEntityWithNonAbstractProperties:return`${le(o.entity,o.entity.project)} has non-template properties`;case he.IncorrectEntityImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements template`;case he.IncorrectMethodImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements the template`;case he.IncorrectPropertyImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements the template`;case he.AbstractMethodInNonAbstractEntity:return`${le(o.entity,o.entity.project)} can't be a template`;case he.AbstractPropertyInNonAbstractEntity:return`${le(o.entity,o.entity.project)} can't be a template`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${le(o.entity,o.entity.project)} overwrites action`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${le(o.entity,o.entity.project)} overwrites property`;case he.MissingMethodImplementation:return`${le(o.entity,o.entity.project)} is missing action`;case he.MissingPropertyImplementation:return`${le(o.entity,o.entity.project)} is missing property`;case Ie.NameNotUniqueInScope:return`${le(o.entity,o.entity.project)} name is not unique`;case he.NoProperties:return`${le(o.entity,o.entity.project)} has no properties`;case he.NonStaticPropertyInStaticEntity:return`${le(o.entity,o.entity.project)} has non-static property`;case he.StaticEntityWithNonStaticProperties:return`${le(o.entity,o.entity.project)} has non-static properties`;case he.ReadingFromIncompatibleType:return`${le(o.entity,o.entity.project)} reads from different type`;case he.WritingToIncompatibleType:return`${le(o.entity,o.entity.project)} writes to different type`;case he.ScopeWithoutLogic:return`${le(o.entity,o.entity.project)} has no logic`;case he.NonStaticPropertyImplementsStatic:return`${le(o.entity,o.entity.project)} has invalid static property`;case he.PropertyImplementsIncompatibleType:return`${le(o.entity,o.entity.project)} has incompatible data type`;case he.PropertyImplementsNonAbstact:return`${le(o.entity,o.entity.project)} has non-template property`;case he.StaticPropertyImplementsNonStatic:return`${le(o.entity,o.entity.project)} has non-static property`;case he.VariableCallsOthersAndHasInternalCall:return`${le(o.entity,o.entity.project)} has bad internal call`;case he.VariableHasInputsAndInternalCall:return`${le(o.entity,o.entity.project)} has bad internal call`;case he.VariableHasOutputsAndInternalCall:return`${le(o.entity,o.entity.project)} has bad internal call`;case he.VariableIsCalledAndHasInternalCall:return`${le(o.entity,o.entity.project)} has bad internal call`;case Ie.InternalCallDeclarationIsInvalidType:return`${le(o.entity,o.entity.project)} has declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(o.entity,o.entity.project)} has declaration that is not found in parent`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${le(o.entity,o.entity.project)} has invalid parent declaration type`;case Ie.InternalCallParentMissingDataType:return`${le(o.entity,o.entity.project)}'s parent has no data type`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(o.entity,o.entity.project)} has declaration that is not in parent`;case Ie.UnreachableEntity:return`${le(o.entity,o.entity.project)} is unreachable`;case he.DisconnectedCallableEntity:return`${le(o.entity,o.entity.project)} is not executed by any entity`;case he.AbstractEntityImplements:return`${le(o.entity,o.entity.project)} implements a non-template entity`;case he.AbstractExtendingNonAbstractEntity:return`${le(o.entity,o.entity.project)} extends a non-template entity`;case he.InvalidPropertiesCombination:return`${le(o.entity,o.entity.project)} has invalid properties combination`;case he.ExtendingNonInteractiveEntity:return`${le(o.entity,o.entity.project)} extends a non-interactive entity`;case he.ExtendsIncompatibleEntities:return`${le(o.entity,o.entity.project)} extends incompatible entities`;case he.ImplementingNonAbstractEntity:return`${le(o.entity,o.entity.project)} implements a non-template entity`;case he.ImplementsIncompatibleEntities:return`${le(o.entity,o.entity.project)} implements incompatible entities`;case he.LackingReturnStatementOnSomeBranches:return`${le(o.entity,o.entity.project)} is missing termination on some branches`;case he.LastCalledEntityMustBeReturnEntity:return`${le(o.entity,o.entity.project)}'s last called entity must be a termination node`;case he.MissingRequiredValue:return`${le(o.entity,o.entity.project)} is missing a required value`;case he.NoPrimaryKeyProperty:return`${le(o.entity,o.entity.project)} has no primary key property`;case he.NonAbstractExtendingAbstractEntity:return`${le(o.entity,o.entity.project)} extends a template entity`;case he.NonStaticExtendingStaticEntity:return`${le(o.entity,o.entity.project)} extends a static entity`;case he.NonStaticImplementingStaticEntity:return`${le(o.entity,o.entity.project)} implements a static entity`;case he.StaticExtendingNonStaticEntity:return`${le(o.entity,o.entity.project)} extends a non-static entity`;case he.StaticImplementingNonStaticEntity:return`${le(o.entity,o.entity.project)} implements a non-static entity`;case he.VariableReadsValueAndInternalCall:return`${le(o.entity,o.entity.project)} reads a value and has internal call`;case he.VariableWritesValuesAndInternalCall:return`${le(o.entity,o.entity.project)} writes values and has internal call`;case Ie.EmptyName:return`${ss[o.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${le(o.entity,o.entity.project)} has invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${le(o.entity,o.entity.project)}'s loop body action overwrites an action`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites base action`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${le(o.entity,o.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${le(o.entity,o.entity.project)} has a name not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(o.entity,o.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${le(o.entity,o.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${le(o.entity,o.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites base property`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${le(o.entity,o.entity.project)} has reader/writer with incompatible data type`;case xo.StatusCodeMustBeBetween100And599:return`${le(o.entity,o.entity.project)} HTTP status code must be between 100 and 599`;case xo.StatusCodeMustBeNumber:return`${le(o.entity,o.entity.project)} HTTP status code must be a number`;case Ga.UUIDMustBeString:return`${le(o.entity,o.entity.project)} UUID must be a string`;case Ga.UUIDMustNotContainSpaces:return`${le(o.entity,o.entity.project)} UUID must not contain spaces`;case Ga.UUIDMustBeValidFormat:return`${le(o.entity,o.entity.project)} UUID must be in a valid format`;case aa.MustBeUniqueAmongSameEntities:return`${le(o.entity,o.entity.project)} value must be unique among the same kind`;case aa.StringValueMustNotHaveDashes:return`${le(o.entity,o.entity.project)} value must not contain dashes`;case aa.StringValueMustNotHaveSpaces:return`${le(o.entity,o.entity.project)} value must not contain spaces`;default:return`${le(o.entity,o.entity.project)} Error: ${cv(o.code)}`}}function Zbi(o){var p,i,n,s;switch(o.code){case he.AbstractEntityWithNonAbstractMethods:return`${le(o.entity,o.entity.project)} has non-template actions`;case he.AbstractEntityWithNonAbstractProperties:return`${le(o.entity,o.entity.project)} has non-template properties`;case he.IncorrectEntityImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements the template entity`;case he.IncorrectMethodImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements the template action it's based on`;case he.IncorrectPropertyImplementation:return`${le(o.entity,o.entity.project)} incorrectly implements the template property it's based on`;case he.AbstractMethodInNonAbstractEntity:return`${le(o.entity,o.entity.project)} is a template action in a non-template entity`;case he.AbstractPropertyInNonAbstractEntity:return`${le(o.entity,o.entity.project)} is a template property in a non-template entity`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${le(o.entity,o.entity.project)} overwrites an action in the template entity`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${le(o.entity,o.entity.project)} overwrites a property in the template entity`;case he.MissingMethodImplementation:return`${le(o.entity,o.entity.project)} is missing an action implementation from the template entity`;case he.MissingPropertyImplementation:return`${le(o.entity,o.entity.project)} is missing a property implementation from the template entity`;case Ie.NameNotUniqueInScope:return`${le(o.entity,o.entity.project)} has a duplicate name in the same scope`;case he.NoProperties:return`${le(o.entity,o.entity.project)} has no properties, so it doesn't do anything`;case he.NonStaticPropertyInStaticEntity:return`${le(o.entity,o.entity.project)} has a non-static property in a static entity`;case he.StaticEntityWithNonStaticProperties:return`${le(o.entity,o.entity.project)} has non-static properties in a static entity`;case he.ReadingFromIncompatibleType:return`${le(o.entity,o.entity.project)} reads data from a value of a different data type`;case he.WritingToIncompatibleType:return`${le(o.entity,o.entity.project)} writes data to a value of a different data type`;case he.ScopeWithoutLogic:return`${le(o.entity,o.entity.project)} has no logic`;case he.NonStaticPropertyImplementsStatic:return`${le(o.entity,o.entity.project)} has a static property in a non-static entity`;case he.PropertyImplementsIncompatibleType:return`${le(o.entity,o.entity.project)} implements a property of a different data type`;case he.PropertyImplementsNonAbstact:return`${le(o.entity,o.entity.project)} implements a non-template property`;case he.StaticPropertyImplementsNonStatic:return`${le(o.entity,o.entity.project)} has a static property in a non-static entity`;case he.VariableCallsOthersAndHasInternalCall:return`${le(o.entity,o.entity.project)} calls other entities while being used to execute internal logic`;case he.VariableHasInputsAndInternalCall:return`${le(o.entity,o.entity.project)} has inputs while being used to execute internal logic`;case he.VariableHasOutputsAndInternalCall:return`${le(o.entity,o.entity.project)} has outputs while being used to execute internal logic`;case he.VariableIsCalledAndHasInternalCall:return`${le(o.entity,o.entity.project)} is called while being used to execute internal logic`;case Ie.InternalCallDeclarationIsInvalidType:return`${le(o.entity,o.entity.project)} has a declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(o.entity,o.entity.project)} has a declaration that is not found in ${(p=o.entity.parent.getDataType(null))!=null&&p.entity?le((i=o.entity.parent.getDataType(null))==null?void 0:i.entity,o.entity.project):"the variable's data-type entity"}`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${le(o.entity,o.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ie.InternalCallParentMissingDataType:return`${le(o.entity,o.entity.project)} is part of a variable with no data-type entity`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(o.entity,o.entity.project)} has a declaration doesn't belong to ${(n=o.entity.parent.getDataType(null))!=null&&n.entity?le((s=o.entity.parent.getDataType(null))==null?void 0:s.entity,o.entity.project):"the variable's data-type entity"}`;case Ie.UnreachableEntity:return`${le(o.entity,o.entity.project)} is unreachable`;case he.DisconnectedCallableEntity:return`${le(o.entity,o.entity.project)} is disconnected and won't be executed by anything after publishing`;case he.AbstractEntityImplements:return`${le(o.entity,o.entity.project)} implements a non-template entity`;case he.AbstractExtendingNonAbstractEntity:return`${le(o.entity,o.entity.project)} extends a non-template entity`;case he.InvalidPropertiesCombination:return`${le(o.entity,o.entity.project)} has an invalid combination of properties`;case he.ExtendingNonInteractiveEntity:return`${le(o.entity,o.entity.project)} extends a non-interactive entity`;case he.ExtendsIncompatibleEntities:return`${le(o.entity,o.entity.project)} extends incompatible entities`;case he.ImplementingNonAbstractEntity:return`${le(o.entity,o.entity.project)} implements a non-template entity`;case he.ImplementsIncompatibleEntities:return`${le(o.entity,o.entity.project)} implements incompatible entities`;case he.LackingReturnStatementOnSomeBranches:return`${le(o.entity,o.entity.project)} has branches that don't terminate`;case he.LastCalledEntityMustBeReturnEntity:return`${le(o.entity,o.entity.project)} must end with a termination node`;case he.MissingRequiredValue:return`${le(o.entity,o.entity.project)} is missing a required value`;case he.NoPrimaryKeyProperty:return`${le(o.entity,o.entity.project)} has no primary key property`;case he.NonAbstractExtendingAbstractEntity:return`${le(o.entity,o.entity.project)} is a non-template entity extending a template entity`;case he.NonStaticExtendingStaticEntity:return`${le(o.entity,o.entity.project)} is a non-static entity extending a static entity`;case he.NonStaticImplementingStaticEntity:return`${le(o.entity,o.entity.project)} is a non-static entity implementing a static entity`;case he.StaticExtendingNonStaticEntity:return`${le(o.entity,o.entity.project)} is a static entity extending a non-static entity`;case he.StaticImplementingNonStaticEntity:return`${le(o.entity,o.entity.project)} is a static entity implementing a non-static entity`;case he.VariableReadsValueAndInternalCall:return`${le(o.entity,o.entity.project)} reads a value and has an internal call`;case he.VariableWritesValuesAndInternalCall:return`${le(o.entity,o.entity.project)} writes values and has an internal call`;case Ie.EmptyName:return`${ss[o.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${le(o.entity,o.entity.project)} has an invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${le(o.entity,o.entity.project)}'s loop body action overwrites`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites a base action with same implementation`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${le(o.entity,o.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${le(o.entity,o.entity.project)} has a name that is not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(o.entity,o.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${le(o.entity,o.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${le(o.entity,o.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites a base property with same implementation`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${le(o.entity,o.entity.project)} has a reader/writer with incompatible data type`;case xo.StatusCodeMustBeBetween100And599:return`${le(o.entity,o.entity.project)} HTTP status code must be between 100 and 599`;case xo.StatusCodeMustBeNumber:return`${le(o.entity,o.entity.project)} HTTP status code must be a number, between 100 and 599`;case Ga.UUIDMustBeString:return`${le(o.entity,o.entity.project)} UUID must be a string, eg: "${Du()}"`;case Ga.UUIDMustNotContainSpaces:return`${le(o.entity,o.entity.project)} UUID must not contain spaces, eg: "${Du()}"`;case Ga.UUIDMustBeValidFormat:return`${le(o.entity,o.entity.project)} UUID must be in a valid format. Eg: "${Du()}"`;case aa.MustBeUniqueAmongSameEntities:return`${le(o.entity,o.entity.project)} value must be unique among the same kind`;case aa.StringValueMustNotHaveDashes:return`${le(o.entity,o.entity.project)} value must not contain dashes`;case aa.StringValueMustNotHaveSpaces:return`${le(o.entity,o.entity.project)} value must not contain spaces`;default:return`${le(o.entity,o.entity.project)} Error: ${cv(o.code)}`}}var gN=(o=>(o.ValuesAlreadyConnected="values-already-connected",o.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",o.CannotReadValueFromChildren="cannot-read-value-from-children",o.CannotWriteValueToChildren="cannot-write-value-to-children",o.CannotBeCalledByChildren="cannot-be-called-by-children",o.ExecutionsAlreadyConnected="executions-already-connected",o.DataTypesNotCompatible="data-types-not-compatible",o.CannotCallAncestor="cannot-call-ancestor",o.CannotConnectToItself="cannot-connect-to-itself",o.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",o.NotInScope="not-in-scope",o.IsNotValueWrittingEntity="is-not-value-writting-entity",o.IsNotValueReadingEntity="is-not-value-reading-entity",o.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",o.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",o.CallerIsInHigherScope="caller-is-in-higher-scope",o.CallerIsInLowerScope="caller-is-in-lower-scope",o.CallIsInHigherScope="call-is-in-higher-scope",o.CallIsInLowerScope="call-is-in-lower-scope",o.OtherIncompatibleScopeReason="other-incompatible-scope-reason",o.SiblingInternalCallAlreadyUsedInParentVariable="sibling-internal-call-already-used-in-parent-variable",o.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees="error-output-map-cannot-be-connected-to-parent-success-branch-callees",o.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees="success-output-map-cannot-be-connected-to-parent-error-branch-callees",o))(gN||{});const Hbi=Object.values(gN);var IN=(o=>(o.NotPartOfOngoingTest="not-part-of-ongoing-test",o.CannotBeAddedToTest="cannot-be-added-to-test",o))(IN||{});const Wbi=Object.values(IN);var RN=(o=>(o.Suggestion="suggestion",o.CanvasGloballyDisabled="canvas-globally-disabled",o.CannotInteractWithInputInVariableWithInternalCalls="cannot-interact-with-input-in-variable-with-internal-calls",o.CannotInteractWithOutputInVariableWithInternalCalls="cannot-interact-with-output-in-variable-with-internal-calls",o.PropertyIsConstantItsValueCantBeReset="property-is-constant-its-value-cant-be-reset",o.CannotWriteValueOfGlobalVariableDeclaration="cannot-write-value-of-global-variable-declaration",o.CannotReSetValueOfConstantVariable="cannot-reset-value-of-constant-variable",o))(RN||{});const zbi=Object.values(RN);function Jbi(o,p){const i=[...o,...p];return Array.from(new Set(i))}function Ybi(o,p){const i=[...o,...p],n=Array.from(new Set(i));return{hasChanged:n.length!==o.length,reasons:n}}function Xbi(o,p){const i=o.filter(s=>!p.includes(s));return{hasChanged:i.length!==o.length,reasons:i}}function Qbi(o,p){return o.find(i=>i.entity.id===p)||null}function K4(o){return o.filter((p,i)=>o.indexOf(p)===i)}class gn{constructor(p,i,n=null,s){I(this,"ids",[]);I(this,"entity");I(this,"entityCardHeight");I(this,"entityCardWidth");I(this,"index");I(this,"childEntities",[]);I(this,"children",[]);I(this,"parents",[]);I(this,"calculationEntryPoint");I(this,"_onlyEntities",null);I(this,"_changeSet",null);if(this.index=i,this.entity=p,this.calculationEntryPoint=n||this,this===this.calculationEntryPoint&&!s)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(p,i,n){const s=_Le-oC-wLe,c=VLe-Jb-bN;p.metaSync({x:p.x||s,y:p.y||c},i);const e=new gn(p,0,null,i);e._onlyEntities=n||[],e.ids=["0"];const y=[];e.next(v=>{y.push(...v)}),gn.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const m=e.flattenChildEntities();return e._onlyEntities?m.filter(v=>(e._onlyEntities||[]).includes(v)):m}static recursivelyAssembleChildrenAreas(p){const i=[];p.forEach(n=>{n.next(s=>{i.push(...s)})}),i.length>0&&gn.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(p){this.calculationEntryPoint._changeSet=p}findAreaInChildrenFromEntity(p){if(this.entity===p)return this;const i=this.children.find(s=>s.entity===p);return i||this.children.reduce((s,c)=>s||c.findAreaInChildrenFromEntity(p),null)}findAreaFromEntity(p){if(this.entity===p)return this;const i=this.calculationEntryPoint.children,n=i.find(c=>c.entity===p);return n||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(p),null)}addParent(p){if(!this.parents.includes(p)){const i=gn.resolveIds(p,this.index);this.ids.push(...i),this.parents.push(p)}}static resolveIds(p,i){return p?p.ids.map(n=>`${n}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const p=gl(this.entity,!0);if(this.entity.type===d.Project){const i=[],n=[],s=[];p.forEach(e=>{if(d.DefinitionEntity===e.type){n.push(e);return}else if(Yt.includes(e.type)){s.push(e);return}i.push(e)});const c=i.sort((e,y)=>{const m=!!_A(e,y).length,v=gl(e),E=gl(y);return m?0:v.length&&!E.length?-1:!v.length&&E.length?1:0}).filter(e=>!Fp(e).length);this.childEntities=[...n,...s,...c]}else{const i=[],n=[],s=[],c=[],e=[];Zr.includes(this.entity.type)&&NR(this.entity).forEach(v=>{if(Gt.includes(v.type)){s.push(v);return}const E=oi(v);i.push(E)}),nr.includes(this.entity.type)&&n.push(...this.entity.detachedChildren);const y=p.filter(m=>{const v=i.includes(m);return v||s.includes(m)||n.includes(m)?!1:Gt.includes(m.type)?(s.push(m),!1):qr.includes(m.type)&&!v?(c.push(m),!1):m.type===d.DefinitionEntity?(e.push(m),!1):!0});i.sort((m,v)=>Vc(m,v)?-1:0),c.sort((m,v)=>Vc(m,v)?-1:0),s.sort((m,v)=>IC(m,v)?1:IC(v,m)?-1:0),this.childEntities=[...e,...i,...c,...y,...s,...n]}}calculateCardSize(){const p=NLe(this.entity);this.entityCardWidth=p.width,this.entityCardHeight=p.height}static getBoundriesOfTwoAreas(p,i){return{top:Math.min(p.top,i.top),left:Math.min(p.left,i.left),bottom:Math.max(p.bottom,i.bottom),right:Math.max(p.right,i.right)}}static getBoundriedOfCombinedAreas(p,i){const n=p.filter(c=>!i.includes(c));return n.reduce((c,e)=>i.includes(e)?c:gn.getBoundriesOfTwoAreas(c,e.fullBranchArea),n[0].fullBranchArea)}getFullAreaUntilAny(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!p.includes(e)).map(e=>e.getFullAreaUntilAny(p)).reduce((e,y)=>gn.getBoundriesOfTwoAreas(e,y),i)}getFullAreaUntilAreaOrAnyChildren(p){const i=[p,...p.flattenChildren()],n=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(p)).reduce((e,y)=>gn.getBoundriesOfTwoAreas(e,y),n)}getFullAreaUntil(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==p).map(c=>c.getFullAreaUntil(p)).reduce((c,e)=>gn.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(s=>s.fullBranchArea).reduce((s,c)=>gn.getBoundriesOfTwoAreas(s,c),p)}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 p=this.ownEntityArea;return{top:p.top,left:p.left,bottom:p.bottom+Jb,right:p.right+oC}}static filterOutRepeatedAreas(p){return p.filter((i,n)=>p.indexOf(i)===n)}getEarliestId(p,i){const n=p.split("-"),s=i.split("-");return n.length<s.length?p:n.length>s.length?i:n.reduce((e,y,m)=>y<s[m]?p:i,p)}getEarliestLevel(){return this.ids.reduce((n,s)=>this.getEarliestId(n,s),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const n=this.parents.reduce((s,c)=>c.getEarliestLevel()>s.getEarliestLevel()?c:s,this.parents[0]).countColumns();return p+=n,p}getLatestId(p,i){if(p===i)return p;const n=p.split("-"),s=i.split("-");return n.length<s.length?i:n.length>s.length?p:n.reduce((e,y,m)=>y>s[m]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((n,s)=>this.getLatestId(n,s),this.ids[0]).split("-").length}smoothPosition(){const p=this.flattenSiblings();if(!p.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(n=>{n!==this.calculationEntryPoint&&n.shiftDownAlone(i)})}else if([...Yt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(n=>!this.parents.includes(n));i.length?i.every(s=>{const c=this.countColumns(),e=s.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(p,i){if(p.includes(this))return p;this.move(this.entity,{y:this.entity.y+i});let n=[...p,this];return this.children.forEach(s=>{if(gn.getEarliestParentInChain(s)!==this)return;const e=Qbi(n,s.entity.id);n=gn.filterOutRepeatedAreas([...n]),e||(n=n.filter(m=>m!==s));const y=s.shiftDownUntilAny(n,i);n.push(...y)}),n}shiftRightUntilAny(p,i){p.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(n=>{const s=gn.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);gn.getEarliestParentInChain(n)===this&&n.shiftRightUntilAny(s,i)}))}shiftRight(p){this.move(this.entity,{x:this.entity.x+p}),this.children.forEach(i=>{const s=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(s,p)})}shiftDownAlone(p){this.move(this.entity,{y:this.entity.y+p})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const p=this.parents.reduce((s,c)=>{const e=c.ownEntityArea,y=e.top+py,m={top:y,left:e.left,bottom:y,right:e.right};return gn.getBoundriesOfTwoAreas(s,m)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-py;this.shiftDownAlone(n)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((s,c)=>{const e=c.ownEntityArea,y=e.top+py,m={top:y,left:e.left,bottom:y,right:e.right};return gn.getBoundriesOfTwoAreas(s,m)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-py;return this.shiftDownAlone(n),n}resolveChildrenOverlaps(){const p=this.flattenChildren();let i=[];p.forEach(n=>{const s=n.adjustVerticallyToAvoidOverlaps();i.push(...s)}),p.forEach(n=>{n.smoothPosition()})}static getEarliestParentInChain(p){let i=p.parents[0];return p.parents.length&&(i=p.parents.sort((n,s)=>{if(!n.ids.length)return-1;if(!s.ids.length)return 1;const c=n.ids.sort((y,m)=>y.length<m.length?-1:0),e=s.ids.sort((y,m)=>y.length<m.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,s)=>{if(p.has(s.entity.id))return n;p.add(s.entity.id);const e=s.children.slice(0,s.children.indexOf(this)).reduce((y,m)=>[...y,m,...m.flattenChildren(p)],[]);return[...n,...e]},[])}flattenSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,s)=>{if(p.has(s.entity.id))return n;p.add(s.entity.id);const e=s.children.filter(y=>y!==this).reduce((y,m)=>[...y,m,...m.flattenChildren(p)],[]);return[...n,...e]},[])}flattenChildren(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n,...n.flattenChildren(p)]),[])}flattenParents(p=new Set){return this.parents.reduce((n,s)=>p.has(s.entity.id)?n:(p.add(s.entity.id),[...n,s,...s.flattenParents(p)]),[])}getAreaIfRendered(p){return this.calculationEntryPoint.flattenChildren().find(s=>s.entity.id===p.id)||null}getLowerSiblings(){const p=this.parents.reduce((i,n)=>{const s=n.children.indexOf(this),c=n.children.slice(s+1);return[...i,...c]},[]);return K4(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((n,s)=>[...n,...s.getLowerAreas()],[]);return K4([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const n=gn.getEarliestParentInChain(this).children[this.index-1];if(!n)return p;const s=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...s,...c,n],v=D(e.flatMap(V=>_A(this.entity,V.entity))).filter(V=>V.id!==this.entity.id).map(V=>this.findAreaFromEntity(V)).filter(V=>!!V),E=this.getFullAreaUntilAny(v),b=n.getFullAreaUntilAny(v),w=e.reduce((V,$)=>$===this||$.fullBranchArea.left!==E.left?V:Math.max(V,$.fullBranchArea.bottom),b.bottom);if(E.top<w){const V=w-E.top+Jb;return this.shiftDownUntilAny(p,V)}return p}move(p,i){(this.onlyEntities||[]).includes(p)&&p.metaSync(i,this.changeSet)}addChild(p){const i=this.childEntities[p];let n=null;i.x&&i.y?n=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),n||(n=new gn(i,p,this.calculationEntryPoint));const s=this.ownEntityPlusBufferArea;this.children.includes(n)||(this.children.push(n),n.addParent(this));const c=n.fullBranchArea;if(c.left<s.right){const e=s.right-c.left;n.shiftRight(e)}return n}flattenChildEntities(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n.entity,...n.flattenChildEntities(p)]),[])}next(p){const i=[];this.childEntities.forEach((n,s)=>{const c=this.addChild(s);c&&i.push(c)}),p(i)}}var Nm=(o=>(o.Amazon="amazon",o.Google="google",o.Microsoft="microsoft",o))(Nm||{}),hr=(o=>(o.RelationalDatabase="relational-database",o.CompiledLocalCodebase="compiled-local-codebase",o.CloudHostedCodebase="cloud-hosted-codebase",o.HttpApi="http-api",o.HttpEndpoint="http-endpoint",o.ServerlessFunction="serverless-function",o))(hr||{}),dC=(o=>(o.Post="post",o.Get="get",o.Acknowledgement="acknowledgment",o.Progress="progress",o.Error="error",o.Complete="complete",o))(dC||{}),Tc=(o=>(o.Queued="queued",o.Running="running",o.Success="success",o.Failed="failed",o.CleanedUp="cleaned-up",o.Skipped="skipped",o.AbortedByUser="aborted-by-user",o.UnrecoverableFailure="unrecoverable-failure",o.Reverted="reverted",o.UnpublishingStarted="unpublishing-started",o.Unpublished="unpublished",o))(Tc||{}),uC=(o=>(o.Queued="queued",o.Running="running",o.Success="success",o.Failed="failed",o.CleanedUp="cleaned-up",o.UnrecoverableFailure="unrecoverable-failure",o.Reverted="reverted",o.UnpublishingStarted="unpublishing-started",o.Unpublished="unpublished",o))(uC||{}),$t=(o=>(o.ProjectNotFound="project-not-found",o.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",o.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",o.DeploymentCompleted="deployment-completed",o.DeploymentStarted="deployment-started",o.DeploymentFailed="deployment-failed",o.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",o.RequestPayloadValidationFailed="request-payload-validation-failed",o.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",o.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",o.ProjectAlreadyBeingPublished="project-already-being-published",o.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",o.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",o.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",o.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",o.CreatingNewRelationalDatabase="creating-new-relational-database",o.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",o.RelationalDatabaseAlreadyExists="relational-database-already-exists",o.RelationalDatabaseDeletionStarted="relational-database-deletion-started",o.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",o.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",o.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",o.HttpApiDeploymentStarted="http-api-deployment-started",o.HttpApiDeploymentCompleted="http-api-deployment-completed",o.HttpApiDeploymentFailed="http-api-deployment-failed",o.CreatingNewHttpApi="creating-new-http-api",o.HttpApiAlreadyExists="http-api-already-exists",o.HttpApiDeletionStarted="http-api-deletion-started",o.HttpApiDeletionCompleted="http-api-deletion-completed",o.HttpApiDeletionFailed="http-api-deletion-failed",o.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",o.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",o.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",o.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",o.BundlingCodebaseForDownload="bundling-codebase-for-download",o.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",o.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",o.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",o.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",o.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",o.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",o.CodeCompilationStarted="code-compilation-started",o.CodeCompilationCompleted="code-compilation-completed",o.CodeCompilationFailed="code-compilation-failed",o.BundleCodebaseStarted="bundle-codebase-started",o.BundleCodebaseCompleted="bundle-codebase-completed",o.BundleCodebaseFailed="bundle-codebase-failed",o.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",o.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",o.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",o.MigrateRelationalDatabaseStarted="migrate-relational-database-started",o.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",o.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",o.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",o.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",o.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",o.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",o))($t||{}),Tl=(o=>(o.CodeCompilation="code-compilation",o.RelationalDatabaseDeployment="relational-database-deployment",o.RelationalDatabaseDeletion="relational-database-deletion",o.HttpApiDeployment="http-api-deployment",o.HttpApiDeletion="http-api-deletion",o.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",o.BundleCodebase="bundle-codebase",o.MigrateRelationalDatabase="migrate-relational-database",o.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",o.ExecutePublicationCompletedEvent="execute-publication-completed-event",o.CodebaseCleanup="codebase-cleanup",o))(Tl||{});hr.CloudHostedCodebase,hr.HttpApi,hr.RelationalDatabase,hr.CloudHostedCodebase,hr.CloudHostedCodebase,hr.RelationalDatabase,hr.CloudHostedCodebase,hr.CloudHostedCodebase;function xLe(o){return`project-${o}-http-api`}function rR(o){return`entity-${o}-database`}class $Le{constructor(p,i,n,s,c,e,y,m,v){I(this,"stepType");I(this,"id");I(this,"resourceType");I(this,"index");I(this,"dependency",[]);I(this,"lastEvent",null);I(this,"lastEventTimestamp",null);I(this,"status",Tc.Queued);I(this,"publicationRun");I(this,"resource");this.stepType=p,this.id=i,this.resourceType=n,this.status=s,this.dependency=c,this.index=e,this.lastEventTimestamp=y,this.publicationRun=m,this.resource=v}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(p){var i,n;this.status=p.status,this.dependency=p.dependency,this.index=p.index,this.stepType=p.stepType,this.resourceType=p.resourceType,this.lastEvent=p.lastEvent,this.id=p.id,(n=this.resource)==null||n.setDetails((i=p.resource)==null?void 0:i.details)}}var LLe=(o=>(o.Ready="ready",o.Provisioning="provisioning",o.Queued="queued",o.ProvisioningFailed="provisioning-failed",o.Deleting="deleting",o.DeletingFailed="deleting-failed",o.Deleted="deleted",o))(LLe||{});class rf{constructor(p,i,n){I(this,"provisionedBy");I(this,"publicationRun");I(this,"resourceType");I(this,"provider");I(this,"resourceId");I(this,"details",null);I(this,"name",null);I(this,"status","queued");this.publicationRun=p,this.resourceType=i,this.provider=n}setDetails(p){this.details=p}setStatus(p){this.status=p}setProvisionedBy(p){this.provisionedBy=p}}class eAi extends rf{constructor(i,n,s){super(i,hr.HttpEndpoint,s);I(this,"resourceType",hr.HttpEndpoint);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=rR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class tAi extends rf{constructor(i,n,s){super(i,hr.ServerlessFunction,s);I(this,"resourceType",hr.ServerlessFunction);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=rR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class MLe extends rf{constructor(i,n,s){super(i,hr.HttpApi,s);I(this,"resourceType",hr.HttpApi);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=xLe(this.publicationRun.project.id),this.resourceId}}class BLe extends rf{constructor(i,n,s){super(i,hr.RelationalDatabase,s);I(this,"resourceType",hr.RelationalDatabase);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=rR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class GLe extends rf{constructor(i,n){super(i,hr.CloudHostedCodebase,n);I(this,"resourceType",hr.CloudHostedCodebase);I(this,"details",null);I(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class kLe extends rf{constructor(i,n){super(i,hr.CompiledLocalCodebase,n);I(this,"resourceType",hr.CompiledLocalCodebase);I(this,"details",null);I(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 iAi{constructor(p,i){I(this,"id");I(this,"projectAutoIncrementPublicationCount");I(this,"projectPublishedSemanticVersion");I(this,"projectVersion");I(this,"projectId");I(this,"triggeredBy");I(this,"createdAt");I(this,"updatedAt");I(this,"status");I(this,"steps",[]);I(this,"editor");I(this,"explicitResources",new Map);I(this,"implicitGlobalResources",new Map);I(this,"finalGlobalEvent",null);I(this,"finalStatus",null);I(this,"contextType",X.PublicationRun);I(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.projectVersion=p.projectVersion,this.projectId=p.projectId,this.triggeredBy=p.triggeredBy,this.createdAt=p.createdAt,this.updatedAt=p.updatedAt,this.status=p.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(p){return this.steps.filter(i=>p.includes(i.resourceType))}getStepsTypes(p){return this.steps.filter(i=>p.includes(i.stepType))}toIds(p){return p.map(i=>i.id)}getResourceForEntity(p){const i=Array.from(this.explicitResources.values()).find(n=>n.owners.has(p.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(hr.CompiledLocalCodebase,new kLe(this,Nm.Amazon)),this.implicitGlobalResources.set(hr.CloudHostedCodebase,new GLe(this,Nm.Amazon));const p=this.project.entities.filter(n=>Wi(n,Re.HTTP_ENDPOINT)),i=this.project.entities.filter(n=>Wi(n,Re.RELATIONAL_DATABASE));if(i.length&&i.forEach(n=>{const s=new BLe(this,[n],Nm.Amazon);this.explicitResources.set(s.resourceId,s)}),p.length){const n=new MLe(this,p,Nm.Amazon);this.explicitResources.set(n.resourceId,n)}}setSteps(p,i){p.forEach(n=>{this.addStep(n,i)}),this.editor.events.emit($t.ProjectPublishRequestAcknowledged,{})}addStep(p,i){const n=p.dependency||[];if(n.length){const c=n.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===p.id)){const c=new $Le(p.stepType,p.id,p.resourceType,p.status,n,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(J.Logger.log("onUpdate",p),(i=p.payload)!=null&&i.stepType){const n=this.steps.find(s=>{var c;return s.id===((c=p.payload)==null?void 0:c.id)});n&&L(p.emittedAt).isAfter(L(n.lastEventTimestamp))&&n.update(p.payload)}this.editor.events.emit("publication-updated",{}),p.type===dC.Error?(this.finalStatus=uC.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===dC.Complete&&(this.finalStatus=uC.Success,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-completed",p))}requestExtension(p){return this.extensionsRegistry.requestExtension(p)}async initRegistry(){return this.extensionsRegistry=new yN(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(X.PublicationRun),this.extensionsRegistry}}function rAi(o){switch(o){case Tl.CodeCompilation:return"Code generation";case Tl.RelationalDatabaseDeployment:return"Database creation";case Tl.HttpApiDeployment:return"HTTP gateway creation";case Tl.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Tl.BundleCodebase:return"Bundle code";case Tl.MigrateRelationalDatabase:return"Database structure migration";case Tl.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Tl.CodebaseCleanup:return"Code cleanup";case Tl.HttpApiDeletion:return"HTTP gateway deletion";case Tl.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function nAi(o){switch(o){case $t.DeploymentCompleted:return"Successfully published";case $t.DeploymentStarted:return"Publication started";case $t.DeploymentFailed:return"Publication failed";case $t.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case $t.RequestPayloadValidationFailed:return"Request payload validation failed";case $t.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case $t.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case $t.RelationalDatabaseDeploymentStarted:return"Database creation started";case $t.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case $t.RelationalDatabaseDeploymentFailed:return"Database creation failed";case $t.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case $t.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case $t.RelationalDatabaseAlreadyExists:return"Database already exists";case $t.HttpApiDeploymentStarted:return"HTTP gateway creation started";case $t.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case $t.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case $t.CreatingNewHttpApi:return"Creating new HTTP gateway";case $t.HttpApiAlreadyExists:return"HTTP gateway already exists";case $t.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case $t.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case $t.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case $t.BundlingCodebaseForDownload:return"Bundling code for download";case $t.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case $t.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case $t.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case $t.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case $t.CodeCompilationStarted:return"Code generation started";case $t.CodeCompilationCompleted:return"Code generation completed";case $t.CodeCompilationFailed:return"Code generation failed";case $t.BundleCodebaseStarted:return"Code bundling started";case $t.BundleCodebaseCompleted:return"Code bundling completed";case $t.BundleCodebaseFailed:return"Code bundling failed";case $t.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case $t.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case $t.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case $t.MigrateRelationalDatabaseStarted:return"Database structure migration started";case $t.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case $t.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case $t.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case $t.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case $t.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case $t.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case $t.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case $t.ProjectNotFound:return"Project not found";case $t.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case $t.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case $t.HttpApiDeletionStarted:return"HTTP gateway deletion started";case $t.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case $t.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case $t.RelationalDatabaseDeletionStarted:return"Database deletion started";case $t.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case $t.RelationalDatabaseDeletionFailed:return"Database deletion failed";case $t.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var jLe=(o=>(o.NO_LOGIC="NO_LOGIC",o.NO_NAME="NO_NAME",o.NO_CHANGES="NO_CHANGES",o.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",o))(jLe||{});function aAi(o){switch(o){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 sAi(o){switch(o){case hr.RelationalDatabase:return"Relational database";case hr.HttpEndpoint:case hr.HttpApi:return"HTTP endpoints";case hr.ServerlessFunction:case hr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function lAi(o){switch(o){case Tc.Running:return"In progress";case Tc.Failed:return"Failed";case Tc.Success:return"Succeeded";case Tc.Skipped:return"Skipped";case Tc.Queued:default:return"Queued"}}function ULe(o){var n;if(!Wi(o,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=Q["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(o.type===d.BuiltInBaseEntity?Wi(o,Re.EXTERNAL_INTEGRATION_CONNECTION)&&(p=pC(o.name)):o.type===d.DefinitionEntity&&o.implements.forEach(s=>{if(Wi(s,Re.EXTERNAL_INTEGRATION_CONNECTION)){const c=pC(s==null?void 0:s.name);if(c)return p=c,!0}}),!p){const s=o.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}));p=(n=s==null?void 0:s.getDefaultValue())==null?void 0:n.value}return p}function oAi(o){return Ehe[o]}function pC(o){return o.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?o.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function KLe(o){if(o.type!==d.ActionDescriptor&&o.type!==d.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(o.type===d.ActionDescriptor){const p=o;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(o.type===d.Operation){const p=o.declaration;if(Object.values(Qt).includes(p.id))return p.id.split("--")[1]||null}return null}function dAi(o){if(!o)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(Re).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===o.toLowerCase()))||null}function uAi(o){return o.type===d.BuiltInBaseEntity||o.type===d.DefinitionEntity?ULe(o):o.type===d.ActionDescriptor||o.type===d.Operation?KLe(o):null}function FLe(o){var s,c,e;if(!Wi(o,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=tke(o,Re.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const n=Q["built-in-base-entity"][i.id].properties.connectionId.id;if(o.type===d.BuiltInBaseEntity){if(Wi(o,Re.EXTERNAL_INTEGRATION_CONNECTION)){const y=o.properties.find(m=>{var v;return((v=m.extends)==null?void 0:v.id)===n});y&&(p=(s=y.getDefaultValue())==null?void 0:s.value)}}else if(o.type===d.DefinitionEntity){const y=o.properties.find(m=>!!m.implements.find(v=>v.id===n)||!!m.implements.find(v=>{var E;return((E=v.extends)==null?void 0:E.id)===n}));if(!y&&((c=o.extends)==null?void 0:c.type)===d.DefinitionEntity)return FLe(o.extends);p=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return p}async function SLe(o,p={}){var y;const i=J.YieldTracker.from(p),s=[...ea(o),...Ds(o),...DN(o),...ta(o),...wN(o)],c=_v(o);s.push(...c);const e=Lt(o.errors,s);await i.tick();for(const m of o.inputs)await m.validateAsync({tracker:i});for(const m of o.outputs)await m.validateAsync({tracker:i});for(const m of o.internalCalls)await m.validateAsync({tracker:i});return await((y=o.dataType)==null?void 0:y.validateAsync({tracker:i})),e}function qLe(o){var s;(s=o.dataType)==null||s.validate(),o.inputs.forEach(c=>c.validate()),o.outputs.forEach(c=>c.validate()),o.internalCalls.forEach(c=>c.validate());const i=[...ea(o),...Ds(o),...DN(o),...ta(o),...wN(o)],n=_v(o);return i.push(...n),Lt(o.errors,i)}function DN(o,p){const n=[...o.project.getVariableDeclarations()].filter(s=>s.id!==o.id);return Pv(o,[Hi],n,p)}function wN(o){const p=[];if(o.parent!==o.project)return p;if(o.catchesError){const i=Ot({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotCatchError}`,message:`${ss[o.type].singular} "${le(o,o.project)}" with id "${o.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:ce.Error,code:Ie.GlobalVariableDeclarationCannotCatchError,entity:o});p.push(i.error)}if(o.errorCalls.length){const i=Ot({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotCallOnError}`,message:`${ss[o.type].singular} "${le(o,o.project)}" with id "${o.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:ce.Error,code:Ie.GlobalVariableDeclarationCannotCallOnError,entity:o});p.push(i.error)}if(o.calledBy.length){const i=Ot({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotBeCalled}`,message:`${ss[o.type].singular} "${le(o,o.project)}" with id "${o.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:ce.Error,code:Ie.GlobalVariableDeclarationCannotBeCalled,entity:o});p.push(i.error)}return[]}const pAi=Object.freeze(Object.defineProperty({__proto__:null,validate:qLe,validateAsync:SLe,validateGlobalVariableDeclaration:wN,validateVariableDeclarationName:DN},Symbol.toStringTag,{value:"Module"}));async function ZLe(o,p={}){const i=J.YieldTracker.from(p),s=[...ea(o),...Ds(o),...ta(o)],c=_v(o);s.push(...c);const e=Lt(o.errors,s);await i.tick();for(const y of o.inputs)await y.validateAsync({tracker:i});for(const y of o.outputs)await y.validateAsync({tracker:i});for(const y of o.internalCalls)await y.validateAsync({tracker:i});return e}function HLe(o){o.inputs.forEach(s=>s.validate()),o.outputs.forEach(s=>s.validate()),o.internalCalls.forEach(s=>s.validate());const i=[...ea(o),...Ds(o),...ta(o)],n=_v(o);return i.push(...n),Lt(o.errors,i)}function cAi(o){const p=[],i=o.declaration.constant;if(i&&o.readsValue){const n=Ot({id:`${o.id}--${he.ValueReadingOverridesConstantVariable}`,message:`The '${o.type}' entity "${le(o,o.project)}" with id "${o.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:ce.Error,code:he.ValueReadingOverridesConstantVariable,entity:o});p.push(n.error)}if(i&&o.defaultValue){const n=Ot({id:`${o.id}--${he.DefaultValueOverridesConstantVariable}`,message:`The '${o.type}' entity "${le(o,o.project)}" with id "${o.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:ce.Error,code:he.DefaultValueOverridesConstantVariable,entity:o});p.push(n.error)}return p}const fAi=Object.freeze(Object.defineProperty({__proto__:null,validate:HLe,validateAsync:ZLe,validateConstantValueOverride:cAi},Symbol.toStringTag,{value:"Module"}));var ON=(o=>(o.Parent="parent",o.DataTypeEntity="data-type-entity",o.VarDeclaration="var-declaration",o))(ON||{});const mi=class mi extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"x");I(this,"y");I(this,"type",d.VariableInstance);I(this,"catchesError",!1);I(this,"defaultValue",null);I(this,"writesValues",[]);I(this,"readsValue",null);I(this,"declaration");I(this,"inputs",[]);I(this,"outputs",[]);I(this,"error",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"successCalls",[]);I(this,"errorCalls",[]);I(this,"internalCalls",[]);I(this,"project");I(this,"errors",[]);I(this,"parent");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableInstance,catchesError:!1,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,n){let s=n;if(i.parent){const V=ne(i.parent);s=n.get(V)}const c=ne(i.declaration),e=n.get(c),y=i.calledByEntry.map(V=>{const $=ne(V);return n.get($)}),m=i.calledBySuccess.map(V=>{const $=ne(V);return n.get($)}),v=i.calledByError.map(V=>{const $=ne(V);return n.get($)});let E=null;if(i.readsValue){const V=ne(i.readsValue);E=n.get(V)}const b={id:i.id,version:x.UUID.uuid(),createdAt:L().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableInstance,catchesError:i.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:m,calledByError:v,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:E,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:s},w=me(b,n);return w.setParent(s,null),w}static validateGenerationTarget(i,n){let s=JSON.parse(JSON.stringify(i));const c=[],e=En(s,{parent:{list:!1,types:[...nr,d.Project],optional:!0},declaration:{list:!1,types:[d.VariableDeclaration]}},n);return s=e.modifiedData,c.push(...e.errors,...xr(s)),{errors:c,modifiedData:s}}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 n=[];let s=JSON.parse(JSON.stringify(i));const c=sf(s,this);return s=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${se.InvalidParentUpdate}`,code:se.InvalidParentUpdate,severity:ce.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.
|
|
93
93
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
94
94
|
Specifically for variables, their scope is also calculated from their value readers and value writters.
|
|
95
95
|
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its value readers, value writters, or callers.`})),{errors:n,modifiedData:s}}subscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const n=[],s=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const m=y.entity.afterAllChildrenInitialized(i);n.push(...m.updated),s.push(...m.added),c.push(...m.removed),e.push(...m.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}onDetachedDependencyRemoved(i,n,s){const c=[],e=[],y=[],m=[];if(n==="parent"){const{updated:v,added:E,removed:b}=this.remove({ignoreUpstream:!1},s);c.push(...v),e.push(...E),y.push(...b)}if(n==="var-declaration"){const{updated:v,added:E,removed:b}=this.remove({ignoreUpstream:!1},s);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(m),self:this}}onDetachedDependencyRestored(i,n,s){const c=[],e=[],y=[],m=[];if(n==="parent"){const{updated:v,added:E,removed:b}=this.restore({},s);c.push(...v),e.push(...E),y.push(...b)}if(n==="var-declaration"){const{updated:v,added:E,removed:b}=this.restore({},s);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(m),self:this}}unsubscribeFromDependencies(){var i,n,s,c,e,y,m;return(n=(i=this.parent)==null?void 0:i.unsubscribeDependents)==null||n.call(i,[{entity:this,field:"parent"}]),(e=(c=(s=this.declaration.dataType)==null?void 0:s.entity)==null?void 0:c.unsubscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),(m=(y=this.declaration)==null?void 0:y.unsubscribeDependents)==null||m.call(y,[{entity:this,field:"var-declaration"}]),this}subscribeToDependencies(){var i,n,s,c;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),(c=(s=(n=this.declaration.dataType)==null?void 0:n.entity)==null?void 0:s.subscribeDependents)==null||c.call(s,[{entity:this,field:"data-type-entity"}]),this.declaration.subscribeDependents([{entity:this,field:"var-declaration"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var n;const i=((n=this.knownVersions)==null?void 0:n.get(this.version))||new mi(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 n=[],s=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);n.push(this.parent,...y.updated),s.push(...y.added),c.push(...y.removed)}return{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}async restoreVersion(i){var m;const n=[],s=[],c=[],e=[];if(this.version===i)return{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this};if(!this.knownVersions){const v=new Map;for(const[E,b]of this.knownVersions||new Map){if(v.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[w,V]of b.knownVersions)v.set(w,V);b.knownVersions=null}}let y=(m=this.knownVersions)==null?void 0:m.get(i);if(!y){const v=await this.APILoadVersion({},i);if(!v)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new mi(v,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:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}updateWithShallowTransfer(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,n))return J.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,n),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 s=ne(i.parent),c=this.project.get(s),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(n),c)this.setParent(c,n),this.addSelfToProject(n);else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${s}' that isn't found in the project`)}else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.readsValue){const s=ne(i.readsValue),c=this.project.get(s),e=this.readsValue;e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(n),c&&this.setValueWriter(c,n)}else this.removeValueWriter(n);if(i.declaration){const s=ne(i.declaration),c=this.project.get(s);c&&this.setDeclaration(c)}if(i.calledByEntry.forEach(s=>{const c=ne(s),e=this.project.get(c);e&&(this.addEntryCaller(e,n),e.addCall(this,n))}),[...this.calledByEntry].forEach(s=>{i.calledByEntry.find(e=>ne(e)===s.id)||(this.removeCaller(s,n),s.removeCall(this,n))}),i.calledBySuccess.forEach(s=>{const c=ne(s),e=this.project.get(c);e&&(this.addSuccessCaller(e,n),e.addSuccessCall(this,n))}),[...this.calledBySuccess].forEach(s=>{i.calledBySuccess.find(e=>ne(e)===s.id)||(this.removeCaller(s,n),s.removeCall(this,n))}),i.calledByError.forEach(s=>{const c=ne(s),e=this.project.get(c);e&&(this.addErrorCaller(e,n),e.addErrorCall(this,n))}),[...this.calledByError].forEach(s=>{i.calledByError.find(e=>ne(e)===s.id)||(this.removeCaller(s,n),s.removeCall(this,n))}),i.outputs.forEach(s=>{const c=ne(s),e=this.project.get(c);e&&(this.addOutput(e,n),e.setParent(this,n))}),[...this.outputs].forEach(s=>{i.outputs.find(e=>ne(e)===s.id)||(this.removeOutput(s,n),s.removeFromParent(n))}),i.inputs.forEach(s=>{const c=ne(s),e=this.project.get(c);e&&(this.addInput(e,n),e.setParent(this,n))}),[...this.inputs].forEach(s=>{i.inputs.find(e=>ne(e)===s.id)||(this.removeInput(s,n),s.removeFromParent(n))}),i.defaultValue){const s=ne(i.defaultValue),c=this.project.get(s);c&&this.setDefaultValue(c,n)}else this.setDefaultValue(null,n);return i.writesValues.forEach(s=>{const c=ne(s),e=this.project.get(c);e&&(this.addValueReader(e,n),e.setValueWriter(this,n))}),[...this.writesValues].forEach(s=>{i.writesValues.find(e=>ne(e)===s.id)||(this.removeValueReader(s,n),s.setValueWriter(null,n))}),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this}hydrateAncestors(){const i=[],n=[],s=[],c=[];if(this.initialData.parent){const e=ne(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=ne(this.initialData.readsValue),y=this.project.get(e);y&&(this.setValueWriter(y,null),i.push(y))}if(this.initialData.declaration){const e=ne(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=ne(e),m=this.project.get(y);m&&this.addEntryCaller(m,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=ne(e),m=this.project.get(y);m&&this.addSuccessCaller(m,null)}),this.initialData.calledByError.forEach(e=>{const y=ne(e),m=this.project.get(y);m&&this.addErrorCaller(m,null)}),{updated:D(i),added:D(n),removed:D(s),affected:D(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.AfterAllChildrenInitialized))){var Ne;if(!this.checkCanEdit(this,i))return J.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];if(this.initialized=!0,!this.declaration.dataType||(Ne=this.declaration.dataType)!=null&&Ne.inferred){const{added:Be,updated:Se,removed:je,affected:Ze}=this.declaration.inferDataTypeAndSyncInstancesInputsAndOutputs(i);s.push(...Be),n.push(...Se),c.push(...je),e.push(...Ze)}const{added:y,updated:m,removed:v,affected:E}=this.syncInputs(i);s.push(...y),n.push(...m),c.push(...v),e.push(...E);const{added:b,updated:w,removed:V,affected:$}=this.syncOutputs(i);s.push(...b),n.push(...w),c.push(...V),e.push(...$);const{added:M,updated:k,removed:F,affected:K}=this.generateUnusedInternalCalls(i);s.push(...M),n.push(...k),c.push(...F),e.push(...K);const{added:Y,updated:ie,removed:ee,affected:de}=this.removeUnrecognizedInputs(i);s.push(...Y),n.push(...ie),c.push(...ee),e.push(...de);const{added:ae,updated:fe,removed:ve,affected:ue}=this.removeUnrecognizedOutputs(i);s.push(...ae),n.push(...fe),c.push(...ve),e.push(...ue);const{added:ye,updated:Ve,removed:_e,affected:$e}=this.removeUnrecognizedInternalCalls(i);return s.push(...ye),n.push(...Ve),c.push(..._e),e.push(...$e),this.inputs.sort((Be,Se)=>{var je,Ze;return(Be.index??((je=Be.declaration)==null?void 0:je.index))-(Se.index??((Ze=Se.declaration)==null?void 0:Ze.index))}),this.outputs.sort((Be,Se)=>{var je,Ze;return(Be.index??((je=Be.declaration)==null?void 0:je.index))-(Se.index??((Ze=Se.declaration)==null?void 0:Ze.index))}),this.declaration.constant&&this.readsValue&&(this.readsValue.removeValueReader(this,i),this.removeValueWriter(i)),this.declaration.constant&&this.defaultValue&&this.defaultValue.remove({ignoreUpstream:!1},i),this.captureVersion(),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const n=[this],s=[],c=[],e=[];return this.parent===this.project&&this.project.addVariableInstance(this),this.readsValue&&(this.readsValue.addValueReader(this,i),n.push(this.readsValue)),this.writesValues.forEach(y=>{y.setValueWriter(this,i),n.push(y)}),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),n.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),n.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),n.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),n.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),n.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(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(s=>!(i.find(y=>y.id===s.id)||i.find(y=>y.declaration===s.declaration)))}removeInternalCall(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"remove-variable-instance-internal-call"))){const s=this.internalCalls.findIndex(c=>c.id===i.id);return s>-1&&(this.internalCalls.splice(s,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose("remove-variable-instance-internal-call",this.id),this}removeInput(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.RemoveInput))){if(!this.checkCanEdit(this,n))return J.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.RemoveInput,this.id),this;const s=this.inputs.findIndex(c=>c.id===i.id);return s>-1&&(this.inputs.splice(s,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose(_.RemoveInput,this.id),this}addInput(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.AddInput))){return this.checkCanEdit(this,n)?this.inputs.includes(i)?(n==null||n.attemptAutoclose(_.AddInput,this.id),this):(this.inputs.push(i),n==null||n.add(this,H.Affected),n==null||n.attemptAutoclose(_.AddInput,this.id),this):(J.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.AddInput,this.id),this)}addOutput(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"add-output"))){return this.checkCanEdit(this,n)?this.outputs.includes(i)?(n==null||n.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),n==null||n.add(this,H.Affected),n==null||n.attemptAutoclose("add-output",this.id),this):(J.Logger.warn(`[addOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("add-output",this.id),this)}removeOutput(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this,n))return J.Logger.warn(`[removeOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("remove-output",this.id),this;const s=this.outputs.findIndex(c=>c.id===i.id);return s>-1&&(this.outputs.splice(s,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose("remove-output",this.id),this}addSuccessCaller(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.AddSuccessCaller)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCaller,n)?(this.calledBySuccess.find(c=>c.id===i.id)||(this.calledBySuccess.push(i),n==null||n.add(this,H.Updated),s&&mt(this,n)),n==null||n.attemptAutoclose(_.AddSuccessCaller,this.id),this):this}addErrorCaller(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.AddErrorCaller)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCaller,n)?(this.calledByError.find(c=>c.id===i.id)||(this.calledByError.push(i),n==null||n.add(this,H.Updated),s&&mt(this,n)),n==null||n.attemptAutoclose(_.AddErrorCaller,this.id),this):this}addEntryCaller(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.AddEntryCaller)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddEntryCaller,n)?(this.calledByEntry.find(c=>c.id===i.id)||(this.calledByEntry.push(i),n==null||n.add(this,H.Updated),s&&mt(this,n)),n==null||n.attemptAutoclose(_.AddEntryCaller,this.id),this):this}addErrorCall(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.AddErrorCall)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCall,n)?(this.errorCalls.find(c=>c.id===i.id)||(this.errorCalls.push(i),s&&mt(this,n),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.AddErrorCall,this.id),this):this}addSuccessCall(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.AddSuccessCall)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCall,n)?(this.successCalls.find(c=>c.id===i.id)||(this.successCalls.push(i),s&&mt(this,n),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.AddSuccessCall,this.id),this):this}removeCall(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.RemoveCall)),s=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCall,n))return this;const c=this.successCalls.findIndex(y=>y.id===i.id);c>-1&&(this.successCalls.splice(c,1),n==null||n.add(this,H.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),n==null||n.add(this,H.Affected)),s&&mt(this,n),n==null||n.attemptAutoclose(_.RemoveCall,this.id),this}removeCaller(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"remove-caller")),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCaller,n)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),s&&mt(this,n),n==null||n.attemptAutoclose(_.RemoveCaller,this.id),this):this}addValueReader(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.AddValueReader))){var e,y,m;if(!this.checkCanEditFromScopeOwnerWithSideEffects(this,_.AddValueReader,n))return this;const s=i.type===d.InputMap&&i.parent.type===d.VariableInstance&&((e=i.declaration)==null?void 0:e.type)===d.Property&&((y=i.declaration)==null?void 0:y.constant),c=i.type===d.VariableInstance&&((m=i.declaration)==null?void 0:m.constant);return(s||c)&&i?(n==null||n.event({id:`${_.SetValueWriter}-${this.id}--${this.id}`,action:_.SetValueWriter,owner:i,counterpart:this,errorReason:Ri.ValueReadingOverridesConstantVariable,rootAction:!1}),n==null||n.attemptAutoclose(_.AddValueReader,this.id),this):this.writesValues.includes(i)?(n==null||n.attemptAutoclose(_.AddValueReader,this.id),this):(this.writesValues.push(i),n==null||n.add(this,H.Affected),this)}setError(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.SetErrorEntity))){if(!this.checkCanEdit(this,n))return J.Logger.warn(`[setError] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.SetErrorEntity,this.id),this;const s=this.error;return(s==null?void 0:s.id)!==(i==null?void 0:i.id)&&(s==null||s.remove({ignoreUpstream:!0},n),this.error=i,this.subscribeToDependencies(),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.SetErrorEntity,this.id),this}setParent(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.SetParent))){var s;return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.SetParent,n)?(((s=this.parent)==null?void 0:s.id)!==(i==null?void 0:i.id)&&(this.parent=i,n&&(n==null||n.add(this,H.Updated))),n==null||n.attemptAutoclose(_.SetParent,this.id),this):this}initChildren(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=me(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.declaration.type===d.GenericReference){const n=this.project.findSubscribedInstanceFromReference(this.initialData.declaration);if(!n)return this;this.declaration=n}else this.declaration=me(this.initialData.declaration,this.project),this.declaration.initChildren(i);return Nv.initWritesValues(this,this.parent),lf.initReadsValue(this),this.initialData.inputs.forEach(n=>{const s=me(n,this.project);return s.setParent(this,null),s.initChildren(i),this.addInput(s,null),s}),this.initialData.outputs.forEach(n=>{const s=me(n,this.project);return s.setParent(this,null),s.initChildren(i),this.addOutput(s,i),s}),this.successCalls=this.initialData.successCalls.map(n=>{const s=me(n,this.project);if(s.addSuccessCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(s.type))s.setParent(this.parent.parent,null),s.initChildren(i);else if(s.type===d.ReturnStatement){const c=tn(this,this.project);s.setParent(c,null),s.initChildren(i)}else s.type!==d.InternalCall&&(s.setParent(this.parent,null),s.initChildren(i));return s}),this.errorCalls=this.initialData.errorCalls.map(n=>{const s=me(n,this.project);if(s.addErrorCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(s.type))s.setParent(this.parent.parent,null),s.initChildren(i);else if(s.type===d.ReturnStatement){const c=tn(this,this.project);s.setParent(c,null),s.initChildren(i)}else s.type!==d.InternalCall&&(s.setParent(this.parent,null),s.initChildren(i));return s}),this.internalCalls=this.initialData.internalCalls.reduce((n,s)=>{if(s.type===d.GenericReference){const c=this.project.findSubscribedInstanceFromReference(s);if(!c)return n;const e=c;return e.setParent(this,null),[...n,e]}else{const c=me(s,this.project);return c.setParent(this,null),c.initChildren(i),[...n,c]}},[]),this.initialData.error&&(this.error=me(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,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.SetValueWriter))){var s,c,e;return this.checkCanEditFromScopeOwnerWithSideEffects(this,_.SetValueWriter,n)?(s=this.declaration)!=null&&s.constant&&i?(n==null||n.event({id:`${_.SetValueWriter}-${this.id}--${i.id}`,action:_.SetValueWriter,owner:this,counterpart:i,errorReason:Ri.ValueReadingOverridesConstantVariable,rootAction:((c=n==null?void 0:n.self)==null?void 0:c.id)===this.id&&(n==null?void 0:n.autoCloseActionName)===_.SetValueWriter}),n==null||n.attemptAutoclose(_.SetValueWriter,this.id),this):(this.readsValue!==i&&(this.readsValue=i,this.readsValue&&((e=this.defaultValue)==null||e.remove({ignoreUpstream:!1},n)),n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose(_.SetValueWriter,this.id),this):this}removeValueWriter(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.RemoveValueWriter))){return this.readsValue&&!this.checkCanEditWithCounterpartAndSideEffects(this,this.readsValue,_.RemoveValueWriter,i)?this:(this.readsValue&&(this.readsValue=null,i==null||i.add(this,H.Updated)),i==null||i.attemptAutoclose(_.RemoveValueWriter,this.id),this)}removeValueReader(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.RemoveValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,_.RemoveValueReader,n)?this.writesValues.includes(i)?(this.writesValues=this.writesValues.filter(s=>s.id!==i.id),n==null||n.add(this,H.Affected),this):(n==null||n.attemptAutoclose(_.RemoveValueReader,this.id),this):this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const s=Lr(this,i,n),c=$r(this,s),e=this.toMeta();return this.x=s.x||e.x,this.y=s.y||e.y,this.catchesError=s.catchesError!==void 0?s.catchesError:this.catchesError,super.baseMetaSync(s,this,n),s.deleted===!0&&!e.deleted?n==null||n.add(this,H.Removed):s.deleted===!1&&e.deleted?n==null||n.add(this,H.Added):c&&(n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ke,...n){return await mi.repository.APILoad(this.id,...n),this}async APICreate(i=ke,...n){return await mi.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(i=ke,...n){return await mi.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(i=ke,...n){return await mi.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(i=ke,...n){return await mi.repository.APIClone(this.id,...n),this}async APILoadVersion(i=ke,n,...s){return await mi.repository.APILoadVersion(this.id,n,...s)}removeFromParent(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.RemoveFromParent))){if(!this.checkCanEdit(this,i))return J.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];return this.parent.type===d.Project?(this.parent.removeVariableInstance(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:D(c),updated:D(n),removed:D(s),affected:D(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.RemoveEntity))){var m;if(!this.checkCanDelete(this,n))return J.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${_.RemoveEntity}-${this.id}`,action:_.RemoveEntity,owner:this,errorReason:Ri.ActionOwnerEntityNonDeletable,rootAction:((m=n==null?void 0:n.self)==null?void 0:m.id)===this.id&&(n==null?void 0:n.autoCloseActionName)===_.RemoveEntity}),n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const s=[],c=[],e=[],y=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(_.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},n),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:w}=v.entity.onDetachedDependencyRemoved(this,v.field,n);s.push(...E),c.push(...b),e.push(...w)}),this.defaultValue){const{updated:v,removed:E}=this.defaultValue.remove({ignoreUpstream:!0},n);s.push(...v),c.push(...E)}if(this.readsValue&&(s.push(this.readsValue),this.readsValue.removeValueReader(this,n)),this.writesValues.forEach(v=>{s.push(v),v.setValueWriter(null,n)}),this.inputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);s.push(...E),c.push(...b)}),this.outputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);s.push(...E),c.push(...b)}),this.successCalls.forEach(v=>{s.push(v),v.removeCaller(this,n)}),this.errorCalls.forEach(v=>{s.push(v),v.removeCaller(this,n)}),this.internalCalls.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);s.push(...E),c.push(...b)}),!i){const v=this.removeFromParent(n);e.push(...v.added),s.push(...v.updated),c.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{s.push(E),E.removeCall(this,n)})}return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:D(e),updated:D(s),removed:D(c),affected:D(y),self:this}}restore({}={},i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.RestoreEntity))){if(!this.checkCanEdit(this,i))return J.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(_.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:m,removed:v,added:E}=y.entity.onDetachedDependencyRestored(this,y.field,i);s.push(...m),c.push(...v),n.push(...E)}),this.defaultValue){const{updated:y}=this.defaultValue.restore({},i);s.push(...y)}return this.readsValue&&(s.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.writesValues.forEach(y=>{s.push(y),y.setValueWriter(this,i)}),this.inputs.forEach(y=>{const{updated:m}=y.restore({},i);s.push(...m)}),this.outputs.forEach(y=>{const{updated:m}=y.restore({},i);s.push(...m)}),this.successCalls.forEach(y=>{s.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{s.push(y),y.addErrorCaller(this,i)}),this.internalCalls.forEach(y=>{const{updated:m}=y.restore({},i);s.push(...m)}),this.calledBySuccess.forEach(y=>{s.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{s.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{s.push(y),y.addCall(this,i)}),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:D(n),updated:D(s),removed:D(c),affected:D(e),self:this}}toFlat(i=new Set){var s,c;return i.has(this.id)?[]:(i.add(this.id),[this,...((s=this.defaultValue)==null?void 0:s.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 s;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((s=this.defaultValue)==null?void 0:s.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 n,s,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:((n=this.defaultValue)==null?void 0:n.toJSON(i))||null,readsValue:((s=this.readsValue)==null?void 0:s.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=ct){var s,c,e,y,m,v,E,b;let n;return(s=i.seenEntityMaps)!=null&&s.has(this.id)?n=i.seenEntityMaps.get(this.id):(n=i.newId||jr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,n)),(c=i.seenEntities)!=null&&c.has(n)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(n),(m=i.seenEntities)==null||m.add(this.id),{id:n,version:x.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,defaultValue:((v=this.defaultValue)==null?void 0:v.toJSONClone({...i,newId:null}))||null,declaration:this.declaration.toReference({seenEntityMaps:i.seenEntityMaps}),readsValue:((E=this.readsValue)==null?void 0:E.toReference({seenEntityMaps:i.seenEntityMaps}))||null,writesValues:this.writesValues.map(w=>w.toJSONClone({...i,newId:null})),inputs:this.inputs.map(w=>w.toJSONClone({...i,newId:null})),outputs:this.outputs.map(w=>w.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(w=>w.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(w=>w.toJSONClone({...i,newId:null})),internalCalls:this.internalCalls.map(w=>this.calledBy.length||this.readsValue?w.toJSONClone({...i,newId:null}):w.toReference({seenEntityMaps:i.seenEntityMaps})),calledBySuccess:this.calledBySuccess.map(w=>w.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(w=>w.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(w=>w.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=ct){var s;let n=this.id;return(s=i.seenEntityMaps)!=null&&s.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(i=ct){var s,c,e,y,m;let n=this.id;return(s=i.seenEntityMaps)!=null&&s.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n,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(v=>v.toReference(i)),inputs:this.inputs.map(v=>v.toReference(i)),outputs:this.outputs.map(v=>v.toReference(i)),successCalls:this.successCalls.map(v=>v.toReference(i)),errorCalls:this.errorCalls.map(v=>v.toReference(i)),calledBySuccess:this.calledBySuccess.map(v=>v.toReference(i)),calledByError:this.calledByError.map(v=>v.toReference(i)),calledByEntry:this.calledByEntry.map(v=>v.toReference(i)),internalCalls:this.internalCalls.map(v=>v.toReference(i)),error:((m=this.error)==null?void 0:m.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var s,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((s=this.defaultValue)==null?void 0:s.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===d.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(n=>n.id),calledBySuccess:this.calledBySuccess.map(n=>n.id),calledByError:this.calledByError.map(n=>n.id),parent:i}}toFlatGenerationTarget(i=new Set){var s,c,e;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((s=this.defaultValue)==null?void 0:s.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(n=>n.clearErrors()),this.outputs.forEach(n=>n.clearErrors()),this.successCalls.forEach(n=>n.clearErrors()),this.errorCalls.forEach(n=>n.clearErrors()),this.internalCalls.forEach(n=>n.clearErrors()),this}validate(){return this.errors=HLe(this),{success:!0}}async validateAsync(i={}){const n=J.YieldTracker.from(i);return this.errors=await ZLe(this,{tracker:n}),{success:!0}}getErrors(){var n;return[...this.errors,...((n=this.defaultValue)==null?void 0:n.getErrors())||[],...this.inputs.flatMap(s=>s.getErrors()),...this.internalCalls.flatMap(s=>s.getErrors()),...this.outputs.flatMap(s=>s.getErrors())]}async getErrorsAsync(i={}){var e;const n=J.YieldTracker.from(i),s=[...this.errors];await n.tick();const c=await((e=this.defaultValue)==null?void 0:e.getErrorsAsync({tracker:n}));c&&s.push(...c);for(const y of this.inputs){const m=await y.getErrorsAsync({tracker:n});s.push(...m)}for(const y of this.internalCalls){const m=await y.getErrorsAsync({tracker:n});s.push(...m)}for(const y of this.outputs){const m=await y.getErrorsAsync({tracker:n});s.push(...m)}return s}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.defaultValue)||null}setDefaultValue(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this,n))return J.Logger.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("set-default-value",this.id),this;const s=this.defaultValue;if((s==null?void 0:s.id)!==(i==null?void 0:i.id)){if(s==null||s.remove({ignoreUpstream:!0},n),this.defaultValue=i,this.defaultValue){const c=this.readsValue;this.removeValueWriter(n),c==null||c.removeValueReader(this,n)}n==null||n.add(this,H.Affected)}return n==null||n.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.CloneEntity)),n=null,s=null,c=!0){var $,M,k,F;const e=Ir(n,this),y=this.toJSON(),m=s||x.UUID.uuid();y.inputs=[],y.id=m,y.version=x.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||L().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1,y.deletable=!0,y.editable=!0;const v=Si(y,e);n?v.setParent(n,i):v.setParent(this.parent,null),c&&v.subscribe(),v.initChildren(i),i==null||i.add(v,H.Added);const E=($=this.defaultValue)==null?void 0:$.clone(i,v,x.UUID.uuid(),c);v.defaultValue=E||null;const b=(M=this.inputs)==null?void 0:M.map(K=>K.clone(i,v,x.UUID.uuid(),c));v.inputs=b;const w=(k=this.outputs)==null?void 0:k.map(K=>K.clone(i,v,x.UUID.uuid(),c));v.outputs=w;const V=(F=this.internalCalls)==null?void 0:F.map(K=>K.clone(i,v,x.UUID.uuid(),c));return v.internalCalls=V,i==null||i.attemptAutoclose(_.CloneEntity,this.id),v}addInternalCall(i){return this.internalCalls.find(n=>n===i)||this.internalCalls.push(i),this}setDeclaration(i){return this.declaration!==i&&(this.declaration=i),this}removeUnrecognizedInputs(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return J.Logger.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.inputs].forEach(y=>{const m=y.remove({ignoreUpstream:!1},i);c.push(...m.removed),n.push(...m.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.inputs].forEach(y=>{var v;if(!y.declaration){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated);return}if(![...((v=this.declaration.dataType)==null?void 0:v.entity).allProperties].find(E=>y.declaration===E)){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated)}}),i==null||i.attemptAutoclose(_.RemoveUnrecognizedInputs,this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}removeUnrecognizedOutputs(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-variable-instance-outputs"))){if(!this.checkCanEdit(this,i))return J.Logger.warn(`[removeUnrecognizedOutputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveUnrecognizedOutputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.outputs].forEach(y=>{const m=y.remove({ignoreUpstream:!1},i);c.push(...m.removed),n.push(...m.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.outputs].forEach(y=>{var v;if(!y.declaration){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated);return}if(![...((v=this.declaration.dataType)==null?void 0:v.entity).allProperties].find(E=>y.declaration===E)){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated)}}),i==null||i.attemptAutoclose("remove-unrecognized-variable-instance-outputs",this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}removeUnrecognizedInternalCalls(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"remove-unrecognized-variable-declaration-internal-calls"))){const n=[],s=[],c=[],e=[];if(!this.declaration.dataType||!this.declaration.dataType.entity||![d.DefinitionEntity,d.PrimitiveEntity,d.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))[...this.internalCalls].forEach(m=>{const v=m.remove({ignoreUpstream:!1},i);c.push(...v.removed),n.push(...v.updated)});else if(this.declaration.dataType&&this.declaration.dataType.entity&&[d.DefinitionEntity,d.PrimitiveEntity,d.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)){const m=[...this.declaration.dataType.entity.getAllInteractiveMethods()],v=[...m].filter(E=>!m.some(b=>{var w,V;return b.id!==E.id&&(((w=b.implements)==null?void 0:w.id)===E.id||((V=b.extends)==null?void 0:V.id)===E.id)})&&!E.deleted);[...this.internalCalls].forEach(E=>{if(!E.declaration){const w=E.remove({ignoreUpstream:!1},i);c.push(...w.removed),n.push(...w.updated);return}if(!v.find(w=>E.declaration===w)){const w=E.remove({ignoreUpstream:!1},i);c.push(...w.removed),n.push(...w.updated);return}})}return this.internalCalls.filter((m,v)=>{const E=this.internalCalls.findIndex(w=>w.declaration===m.declaration&&w!==m);if(E===-1)return!1;const b=this.internalCalls[E];return L(b==null?void 0:b.createdAt).isSame(L(m.createdAt))?v>E:!!L(b==null?void 0:b.createdAt).isAfter(m.createdAt)}).forEach(m=>{const v=m.remove({ignoreUpstream:!1},i);c.push(...v.removed),n.push(...v.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-variable-declaration-internal-calls",this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}syncInputs(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"sync-variable-instance-inputs"))){const n=[],s=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([d.DefinitionEntity,d.PrimitiveEntity,d.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 w=this.inputs.find(M=>le(M,this.project)===le(b,this.project));if(!w)return;const V=this.declaration.getMasterInputWithValueWritterFromAllInstances(w);if(!V)return;const $=md(V);b.setDataType($,i),w.setDeclaration(b,i)}),y.filter(b=>!this.inputs.find(w=>{var V;return((V=w.declaration)==null?void 0:V.id)===b.id})).forEach(b=>{const w={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,parent:this.toReference(),name:null,description:null,codeName:null,declaration:b,defaultValue:null,index:b.index,readsValue:null},V=me(w,this.project);return V.setParent(this,i),V.initChildren(i),i==null||i.add(V,H.Added),this.addInput(V,i),V}),this.inputs.filter(b=>!b.declaration).forEach(b=>{const w=y.find(V=>le(V,this.project)===le(b,this.project));w&&b.setDeclaration(w,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:D(n),updated:D(s),removed:D(c),affected:D(e),self:this}}syncOutputs(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,_.SyncOutputs))){if(!this.checkCanEdit(this,i))return J.Logger.warn(`[syncOutputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity)[d.DefinitionEntity,d.PrimitiveEntity,d.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList&&[...this.declaration.dataType.entity.properties].filter(v=>!this.outputs.find(E=>E.declaration===v)).map(v=>{const E={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.OutputMap,parent:this.toReference(),declaration:v,index:v.index,writesValues:[]},b=me(E,this.project);return b.setParent(this,i),b.initChildren(i),i==null||i.add(b,H.Added),this.addOutput(b,i),b});else return i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{added:D(n),updated:D(s),removed:D(c),affected:D(e),self:this}}generateUnusedInternalCalls(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"generate-unused-internal-calls"))){const n=[],s=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([d.DefinitionEntity,d.PrimitiveEntity,d.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.getAllInteractiveMethods()];[...y].filter(E=>!y.some(b=>{var w,V;return b.id!==E.id&&(((w=b.implements)==null?void 0:w.id)===E.id||((V=b.extends)==null?void 0:V.id)===E.id)})&&!E.deleted).filter(E=>!this.internalCalls.find(w=>{var $,M,k,F,K;return((($=w.declaration)==null?void 0:$.id)||((k=(M=w.initialData)==null?void 0:M.declaration)==null?void 0:k.entityId)||((K=(F=w.initialData)==null?void 0:F.declaration)==null?void 0:K.id))===E.id})).forEach(E=>{const b=this.internalCalls.find(w=>{const V=Pc(w.declaration),$=Pc(E);return V.id===$.id});if(b)b.setDeclaration(E),b.subscribeToDependencies();else{const w=E.createInternalCall(i,this);i==null||i.add(w,H.Added),this.addInternalCall(w)}})}}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:D(n),updated:D(s),removed:D(c),affected:D(e),self:this}}getDataType(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,L().toISOString(),this,!0,"get-data-type"))){var s;const n=((s=this.declaration)==null?void 0:s.getDataType(i))||null;return i==null||i.attemptAutoclose("get-data-type",this.id),n}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)}};I(mi,"repository",{APICreate:async(i,...n)=>i,APIUpdate:async(i,...n)=>i,APIDelete:async(i,...n)=>i,APIClone:async(i,...n)=>{},APILoad:async(i,...n)=>null,APILoadVersion:async(i,n,...s)=>null}),I(mi,"type",d.VariableInstance),I(mi,"USER_MANAGED_PARENT_TYPES",[...nr,d.Project]),I(mi,"PARENT_TYPES",[...mi.USER_MANAGED_PARENT_TYPES]),I(mi,"MUTABLE_BASE_PROPERTIES",["catchesError"]),I(mi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),I(mi,"BASE_PROPERTIES",[...mi.MUTABLE_BASE_PROPERTIES,...mi.INMUTABLE_BASE_PROPERTIES]),I(mi,"MUTABLE_META_PROPERTIES",[...mi.MUTABLE_BASE_PROPERTIES,"x","y"]),I(mi,"INMUTABLE_META_PROPERTIES",[...mi.INMUTABLE_BASE_PROPERTIES]),I(mi,"META_PROPERTIES",[...mi.MUTABLE_META_PROPERTIES,...mi.INMUTABLE_META_PROPERTIES]),I(mi,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),I(mi,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),I(mi,"UPSTREAM_PROPERTIES",[...mi.MUTABLE_UPSTREAM_PROPERTIES,...mi.INMUTABLE_UPSTREAM_PROPERTIES]),I(mi,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),I(mi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),I(mi,"DOWNSTREAM_PROPERTIES",[...mi.MUTABLE_DOWNSTREAM_PROPERTIES,...mi.INMUTABLE_DOWNSTREAM_PROPERTIES]),I(mi,"PROPERTIES",[...mi.META_PROPERTIES,...mi.UPSTREAM_PROPERTIES,...mi.DOWNSTREAM_PROPERTIES]);let Bu=mi;var WLe=(o=>(o.Parent="variable-declaration-parent",o.DataTypeEntity="variable-declaration-data-type-entity",o.DataType="variable-declaration-data-type",o))(WLe||{});const Ti=class Ti extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"name");I(this,"codeName",null);I(this,"description",null);I(this,"required",!1);I(this,"constant",!1);I(this,"x");I(this,"y");I(this,"type",d.VariableDeclaration);I(this,"catchesError",!1);I(this,"defaultValue",null);I(this,"dataType",null);I(this,"writesValues",[]);I(this,"readsValue",null);I(this,"inputs",[]);I(this,"outputs",[]);I(this,"error",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"successCalls",[]);I(this,"errorCalls",[]);I(this,"internalCalls",[]);I(this,"parent");I(this,"errors",[]);I(this,"project");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"codeNativeValueValidation",null);this.initialData=i,this.project=n,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:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableDeclaration,catchesError:!1,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,n){let s=n;if(i.parent){const b=ne(i.parent);s=n.get(b)}const c=i.calledByEntry.map(b=>{const w=ne(b);return n.get(w)}),e=i.calledBySuccess.map(b=>{const w=ne(b);return n.get(w)}),y=i.calledByError.map(b=>{const w=ne(b);return n.get(w)});let m=null;if(i.readsValue){const b=ne(i.readsValue);m=n.get(b)}const v={id:i.id,version:x.UUID.uuid(),createdAt:L().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.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:m,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:s},E=me(v,n);return E.setParent(s,null),E}static validateGenerationTarget(i,n){let s=JSON.parse(JSON.stringify(i));const c=[],e=En(s,{parent:{list:!1,types:[...nr,d.Project],optional:!0}},n);s=e.modifiedData;const y=xP(s,n);return c.push(...e.errors,...y,...xr(s)),{errors:c,modifiedData:s}}get variableInstances(){const i=[];return Object.values(this.detachedDependents).forEach(n=>{n.field===ON.VarDeclaration&&!i.includes(n.entity)&&i.push(n.entity)}),i}validateGeneratedUpdate(i){const n=[];let s=JSON.parse(JSON.stringify(i));const c=sf(s,this);return s=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${se.InvalidParentUpdate}`,code:se.InvalidParentUpdate,severity:ce.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/dist/index.d.ts
CHANGED
|
@@ -11517,7 +11517,7 @@ export declare class DefaultEditorContext extends ExtensionContextBase<Extension
|
|
|
11517
11517
|
removeTest(options: YieldOptions & {
|
|
11518
11518
|
skipValidate?: boolean;
|
|
11519
11519
|
}): Promise<ITest>;
|
|
11520
|
-
copyEntities(entities:
|
|
11520
|
+
copyEntities(entities: UserManagedElementShallowTransfer[], options?: YieldOptions): Promise<ChangeSet>;
|
|
11521
11521
|
resolveInitialChildrenPositions(parent: CanvasEntityState | null, children: CanvasEntityState[], changeSet: ChangeSet | null): CanvasEntityState[];
|
|
11522
11522
|
publish(): Promise<void>;
|
|
11523
11523
|
loadGivenPublication(publicationId: string): Promise<IPublication>;
|
|
@@ -21167,7 +21167,7 @@ export declare function getReferencedEntityStateOrErrors(data: ElementGeneration
|
|
|
21167
21167
|
removeTest(options: YieldOptions & {
|
|
21168
21168
|
skipValidate?: boolean;
|
|
21169
21169
|
}): Promise<ITest>;
|
|
21170
|
-
copyEntities(entities:
|
|
21170
|
+
copyEntities(entities: UserManagedElementShallowTransfer[], options?: YieldOptions): Promise<ChangeSet>;
|
|
21171
21171
|
resolveInitialChildrenPositions(parent: CanvasEntityState | null, children: CanvasEntityState[], changeSet: ChangeSet | null): CanvasEntityState[];
|
|
21172
21172
|
publish(): Promise<void>;
|
|
21173
21173
|
loadGivenPublication(publicationId: string): Promise<IPublication>;
|
package/dist/index.js
CHANGED
|
@@ -119644,8 +119644,8 @@ class J2 extends pO {
|
|
|
119644
119644
|
removeTest(p) {
|
|
119645
119645
|
return this._editor.removeTest(p);
|
|
119646
119646
|
}
|
|
119647
|
-
async copyEntities(p) {
|
|
119648
|
-
return this._editor.copyEntities(p);
|
|
119647
|
+
async copyEntities(p, i = {}) {
|
|
119648
|
+
return this._editor.copyEntities(p, i);
|
|
119649
119649
|
}
|
|
119650
119650
|
resolveInitialChildrenPositions(p, i, n) {
|
|
119651
119651
|
return this._editor.resolveInitialChildrenPositions(
|
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.6751",
|
|
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",
|