@elyx-code/project-logic-tree 0.0.6758 → 0.0.6759
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.js +1 -1
- package/package.json +3 -3
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[O4]=this[O4]={accessors:{}}).accessors,s=this.prototype;function c(e){const y=K0(e);n[y]||(abi(s,e),n[y]=!0)}return Ue.isArray(p)?p.forEach(c):c(p),this}}YI.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ue.reduceDescriptors(YI.prototype,({value:o},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>o,set(n){this[i]=n}}});Ue.freezeMethods(YI);const bl=YI;function bO(o,p){const i=this||oN,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 Mxe(o){return!!(o&&o.__CANCEL__)}function jh(o,p,i){si.call(this,o??"canceled",si.ERR_CANCELED,p,i),this.name="CanceledError"}Ue.inherits(jh,si,{__CANCEL__:!0});function Gxe(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 sbi(o){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return p&&p[1]||""}function lbi(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 obi(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 mA=(o,p,i=3)=>{let n=0;const s=lbi(50,250);return obi(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)},C4=(o,p)=>{const i=o!=null;return[n=>p[0]({lengthComputable:i,total:o,loaded:n}),p[1]]},_4=o=>(...p)=>Ue.asap(()=>o(...p)),dbi=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,ubi=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 pbi(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function cbi(o,p){return p?o.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):o}function kxe(o,p,i){let n=!pbi(p);return o&&(n||i==!1)?cbi(o,p):p}const V4=o=>o instanceof bl?{...o}:o;function _c(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(V4(v),V4(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 jxe=o=>{const p=_c({},o);let{data:i,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:c,headers:e,auth:y}=p;if(p.headers=e=bl.from(e),p.url=$xe(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&&dbi(p.url))){const m=s&&c&&ubi.read(c);m&&e.set(s,m)}return p},fbi=typeof XMLHttpRequest<"u",ybi=fbi&&function(o){return new Promise(function(i,n){const s=jxe(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 B(){V&&V(),$&&$(),s.cancelToken&&s.cancelToken.unsubscribe(E),s.signal&&s.signal.removeEventListener("abort",E)}let j=new XMLHttpRequest;j.open(s.method.toUpperCase(),s.url,!0),j.timeout=s.timeout;function F(){if(!j)return;const Y=bl.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),ee={data:!y||y==="text"||y==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:Y,config:o,request:j};Gxe(function(ae){i(ae),B()},function(ae){n(ae),B()},ee),j=null}"onloadend"in j?j.onloadend=F:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(F)},j.onabort=function(){j&&(n(new si("Request aborted",si.ECONNABORTED,o,j)),j=null)},j.onerror=function(ie){const ee=ie&&ie.message?ie.message:"Network Error",de=new si(ee,si.ERR_NETWORK,o,j);de.event=ie||null,n(de),j=null},j.ontimeout=function(){let ie=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const ee=s.transitional||Lxe;s.timeoutErrorMessage&&(ie=s.timeoutErrorMessage),n(new si(ie,ee.clarifyTimeoutError?si.ETIMEDOUT:si.ECONNABORTED,o,j)),j=null},c===void 0&&e.setContentType(null),"setRequestHeader"in j&&Ue.forEach(e.toJSON(),function(ie,ee){j.setRequestHeader(ee,ie)}),Ue.isUndefined(s.withCredentials)||(j.withCredentials=!!s.withCredentials),y&&y!=="json"&&(j.responseType=s.responseType),v&&([w,$]=mA(v,!0),j.addEventListener("progress",w)),m&&j.upload&&([b,V]=mA(m),j.upload.addEventListener("progress",b),j.upload.addEventListener("loadend",V)),(s.cancelToken||s.signal)&&(E=Y=>{j&&(n(!Y||Y.type?new jh(null,o,j):Y),j.abort(),j=null)},s.cancelToken&&s.cancelToken.subscribe(E),s.signal&&(s.signal.aborted?E():s.signal.addEventListener("abort",E)));const K=sbi(s.url);if(K&&ra.protocols.indexOf(K)===-1){n(new si("Unsupported protocol "+K+":",si.ERR_BAD_REQUEST,o));return}j.send(c||null)})},hbi=(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 jh(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}},mbi=hbi,Tbi=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},vbi=async function*(o,p){for await(const i of Ebi(o))yield*Tbi(i,p)},Ebi=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()}},P4=(o,p,i,n)=>{const s=vbi(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})},N4=64*1024,{isFunction:$b}=Ue,bbi=(({Request:o,Response:p})=>({Request:o,Response:p}))(Ue.global),{ReadableStream:x4,TextEncoder:$4}=Ue.global,L4=(o,...p)=>{try{return!!o(...p)}catch{return!1}},Abi=o=>{o=Ue.merge.call({skipUndefined:!0},bbi,o);const{fetch:p,Request:i,Response:n}=o,s=p?$b(p):typeof fetch=="function",c=$b(i),e=$b(n);if(!s)return!1;const y=s&&$b(x4),m=s&&(typeof $4=="function"?($=>B=>$.encode(B))(new $4):async $=>new Uint8Array(await new i($).arrayBuffer())),v=c&&y&&L4(()=>{let $=!1;const B=new i(ra.origin,{body:new x4,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type");return $&&!B}),E=e&&y&&L4(()=>Ue.isReadableStream(new n("").body)),b={stream:E&&($=>$.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach($=>{!b[$]&&(b[$]=(B,j)=>{let F=B&&B[$];if(F)return F.call(B);throw new si(`Response type '${$}' is not supported`,si.ERR_NOT_SUPPORT,j)})});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($,B)=>{const j=Ue.toFiniteNumber($.getContentLength());return j??w(B)};return async $=>{let{url:B,method:j,data:F,signal:K,cancelToken:Y,timeout:ie,onDownloadProgress:ee,onUploadProgress:de,responseType:ae,headers:fe,withCredentials:ve="same-origin",fetchOptions:ue}=jxe($),ye=p||fetch;ae=ae?(ae+"").toLowerCase():"text";let Ve=mbi([K,Y&&Y.toAbortSignal()],ie),_e=null;const $e=Ve&&Ve.unsubscribe&&(()=>{Ve.unsubscribe()});let Pe;try{if(de&&v&&j!=="get"&&j!=="head"&&(Pe=await V(fe,F))!==0){let st=new i(B,{method:"POST",body:F,duplex:"half"}),dt;if(Ue.isFormData(F)&&(dt=st.headers.get("content-type"))&&fe.setContentType(dt),st.body){const[_t,Mt]=C4(Pe,mA(_4(de)));F=P4(st.body,N4,_t,Mt)}}Ue.isString(ve)||(ve=ve?"include":"omit");const Me=c&&"credentials"in i.prototype,Se={...ue,signal:Ve,method:j.toUpperCase(),headers:fe.normalize().toJSON(),body:F,duplex:"half",credentials:Me?ve:void 0};_e=c&&new i(B,Se);let je=await(c?ye(_e,ue):ye(B,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,Mt]=ee&&C4(dt,mA(_4(ee),!0))||[];je=new n(P4(je.body,N4,_t,()=>{Mt&&Mt(),$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)=>{Gxe(st,dt,{data:Ye,headers:bl.from(je.headers),status:je.status,statusText:je.statusText,config:$,request:_e})})}catch(Me){throw $e&&$e(),Me&&Me.name==="TypeError"&&/Load failed|fetch/i.test(Me.message)?Object.assign(new si("Network Error",si.ERR_NETWORK,$,_e),{cause:Me.cause||Me}):si.from(Me,Me&&Me.code,$,_e)}}},gbi=new Map,Uxe=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=gbi;for(;y--;)m=c[y],v=E.get(m),v===void 0&&E.set(m,v=y?new Map:Abi(p)),E=v;return v};Uxe();const dN={http:MEi,xhr:ybi,fetch:{get:Uxe}};Ue.forEach(dN,(o,p)=>{if(o){try{Object.defineProperty(o,"name",{value:p})}catch{}Object.defineProperty(o,"adapterName",{value:p})}});const B4=o=>`- ${o}`,Ibi=o=>Ue.isFunction(o)||o===null||o===!1;function Rbi(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,!Ibi(n)&&(s=dN[(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 Kxe={getAdapter:Rbi,adapters:dN};function AO(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new jh(null,o)}function M4(o){return AO(o),o.headers=bl.from(o.headers),o.data=bO.call(o,o.transformRequest),["post","put","patch"].indexOf(o.method)!==-1&&o.headers.setContentType("application/x-www-form-urlencoded",!1),Kxe.getAdapter(o.adapter||oN.adapter,o)(o).then(function(n){return AO(o),n.data=bO.call(o,o.transformResponse,n),n.headers=bl.from(n.headers),n},function(n){return Mxe(n)||(AO(o),n&&n.response&&(n.response.data=bO.call(o,o.transformResponse,n.response),n.response.headers=bl.from(n.response.headers))),Promise.reject(n)})}const Fxe="1.13.2",XI={};["object","boolean","number","function","string","symbol"].forEach((o,p)=>{XI[o]=function(n){return typeof n===o||"a"+(p<1?"n ":" ")+o}});const G4={};XI.transitional=function(p,i,n){function s(c,e){return"[Axios v"+Fxe+"] 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&&!G4[e]&&(G4[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}};XI.spelling=function(p){return(i,n)=>(console.warn(`${n} is likely a misspelling of ${p}`),!0)};function Dbi(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 Sb={assertOptions:Dbi,validators:XI},Eo=Sb.validators;class TA{constructor(p){this.defaults=p||{},this.interceptors={request:new w4,response:new w4}}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=_c(this.defaults,i);const{transitional:n,paramsSerializer:s,headers:c}=i;n!==void 0&&Sb.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}:Sb.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),Sb.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(B){typeof B.runWhen=="function"&&B.runWhen(i)===!1||(m=m&&B.synchronous,y.unshift(B.fulfilled,B.rejected))});const v=[];this.interceptors.response.forEach(function(B){v.push(B.fulfilled,B.rejected)});let E,b=0,w;if(!m){const $=[M4.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++],B=y[b++];try{V=$(V)}catch(j){B.call(this,j);break}}try{E=M4.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=_c(this.defaults,p);const i=kxe(p.baseURL,p.url,p.allowAbsoluteUrls);return $xe(i,p.params,p.paramsSerializer)}}Ue.forEach(["delete","get","head","options"],function(p){TA.prototype[p]=function(i,n){return this.request(_c(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(_c(y||{},{method:p,headers:n?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}TA.prototype[p]=i(),TA.prototype[p+"Form"]=i(!0)});const qb=TA;class uN{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 jh(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 uN(function(s){p=s}),cancel:p}}}const wbi=uN;function Obi(o){return function(i){return o.apply(null,i)}}function Cbi(o){return Ue.isObject(o)&&o.isAxiosError===!0}const rC={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(rC).forEach(([o,p])=>{rC[p]=o});const _bi=rC;function Sxe(o){const p=new qb(o),i=gxe(qb.prototype.request,p);return Ue.extend(i,qb.prototype,p,{allOwnKeys:!0}),Ue.extend(i,p,null,{allOwnKeys:!0}),i.create=function(s){return Sxe(_c(o,s))},i}const vn=Sxe(oN);vn.Axios=qb;vn.CanceledError=jh;vn.CancelToken=wbi;vn.isCancel=Mxe;vn.VERSION=Fxe;vn.toFormData=JI;vn.AxiosError=si;vn.Cancel=vn.CanceledError;vn.all=function(p){return Promise.all(p)};vn.spread=Obi;vn.isAxiosError=Cbi;vn.mergeConfig=_c;vn.AxiosHeaders=bl;vn.formToJSON=o=>Bxe(Ue.isHTMLForm(o)?new FormData(o):o);vn.getAdapter=Kxe.getAdapter;vn.HttpStatusCode=_bi;vn.default=vn;const Vbi=vn;class qxe 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 Vbi(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}}}})}}class Zxe 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=BR(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 Hxe 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=rvi(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class Wxe 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=nvi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class zxe 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=avi(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class Jxe 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=svi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class Yxe 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=lvi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class Xxe 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=ovi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class Qxe 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=dvi(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_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=uvi(s,c);return{value:G.Success,error:null,result:e}}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__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=pvi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class i$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=cvi(s,c);return{value:G.Success,error:null,result:e}}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_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=fvi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class n$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),B=(v=(m=n[0])==null?void 0:m.value)==null?void 0:v.value,j=(b=(E=n[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!B)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!j)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!$)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(j.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)!==(j==null?void 0:j.id)?K=!1:BR(F==null?void 0:F.entity).safeParse(B).success?K=!0:K=!1,{value:G.Success,error:null,result:K}}catch($){return{value:G.UnhandledError,error:$,result:null}}}})}}class a$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=yvi(...s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class s$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=hvi(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class l$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=mvi(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class o$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=Tvi(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}let ss=null;try{ss=require("crypto")}catch{}const Gm=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:ss&&ss.webcrypto?ss.webcrypto:null,wu=Gm?Gm.subtle:null;function Wm(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 d$e=o=>Hr(o,"base64"),u$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64")},_y=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64url")},Vc=o=>Hr(o,"base64url"),p$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"hex")},c$e=o=>Hr(o,"hex");function pN(o){if(Gm&&Gm.getRandomValues){const p=new Uint8Array(o);return Gm.getRandomValues(p),p}if(ss&&ss.randomBytes)return new Uint8Array(ss.randomBytes(o));throw new Error("Secure random not available")}function QI(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 f$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 QI(e,y)}async function y$e(o,p){if(wu){const i=await wu.digest({name:o},Wm(p));return new Uint8Array(i)}if(ss){const i=o.replace("SHA-","sha"),n=ss.createHash(i);return n.update(Buffer.from(p)),new Uint8Array(n.digest())}throw new Error("Hash not available")}async function h$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 y$e(s,y);return Ql(m,e)}async function eR(o,p,i){if(wu){const n=await wu.importKey("raw",Wm(p),{name:"HMAC",hash:{name:o}},!1,["sign"]),s=await wu.sign("HMAC",n,Wm(i));return new Uint8Array(s)}if(ss){const n=`sha${o.split("-")[1]}`,s=ss.createHmac(n,Buffer.from(p));return s.update(Buffer.from(i)),new Uint8Array(s.digest())}throw new Error("HMAC not available")}async function m$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 eR(e,E,b);return Ql(w,v)}async function tR(o,p,{iterations:i,length:n,hashAlg:s="SHA-256"}){if(wu){const c=await wu.importKey("raw",Wm(o),"PBKDF2",!1,["deriveBits"]),e=await wu.deriveBits({name:"PBKDF2",salt:Wm(p),iterations:i,hash:s},c,n*8);return new Uint8Array(e)}if(ss){const c=s==="SHA-512"?"sha512":"sha256";return await new Promise((e,y)=>{ss.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 T$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),B=Hr(p??"",v),j=await tR($,B,{iterations:b,length:w,hashAlg:V});return Ql(j,E)}async function v$e(o,p=pN(16),i=21e4,n=32,s="SHA-256"){const c=Hr(o,"utf8"),e=await tR(c,p,{iterations:i,length:n,hashAlg:s}),y=_y(p),m=_y(e);return`pbkdf2$${s.toLowerCase()}$${i}$${y}$${m}`}async function E$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=Vc(i[3]),e=Vc(i[4]),y=n.includes("512")?"SHA-512":"SHA-256",m=await tR(Hr(o,"utf8"),c,{iterations:s,length:e.length,hashAlg:y});return QI(m,e)}async function b$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 v$e(String(o??""),E,e,y,m)}function k4(o){return _y(Hr(JSON.stringify(o),"utf8"))}function vA(o){try{return JSON.parse(Ql(Vc(o),"utf8"))}catch{return null}}async function A$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 $=k4(b),B=k4(V),j=Hr(`${$}.${B}`,"utf8"),K=await eR(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,j),Y=_y(K);return`${$}.${B}.${Y}`}async function g$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 A$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 I$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=vA(y),b=vA(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 eR(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,w),B=Vc(v);if(!QI($,B))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const j=Math.floor(Date.now()/1e3),F=Math.max(0,Number(e)||0);if(b.nbf!=null&&j+F<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&j-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&&j-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 R$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 I$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 D$e(o){const[p,i,n]=String(o).split(".");return{header:p?vA(p):null,payload:i?vA(i):null,signature:n?Vc(n):new Uint8Array}}function w$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}=D$e(String(o??"")),e=Ql(c,i);return{header:n,payload:s,signature:e}}class O$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=pN(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 C$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=hOe(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 _$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=FI();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 V$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=UP(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 P$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=KP(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 N$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=TOe(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_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=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 $$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=SP(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 L$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 B$e 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=vOe();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 M$e 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=EOe();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 Pbi(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 G$e 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:Pbi(c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class k$e 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 j$e 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 U$e 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 K$e 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 F$e 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:u$e(s,c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class S$e 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=d$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 q$e 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=_y(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 Z$e 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=Vc(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 H$e 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=p$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 W$e 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=c$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 z$e 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:h$e(s,c,e,y)}}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__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:m$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 Y$e 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:f$e(s,c,e,y)}}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__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:T$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 Q$e 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 eLe 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 tLe 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,$,B]=n.map(j=>{var F,K;return((F=j.value)==null?void 0:F.valueAsType)??((K=j.value)==null?void 0:K.value)});return{value:G.Success,error:null,result:await g$e(s,c,e,y,m,v,E,b,w,V,$,B)}}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__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 R$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 rLe 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:w$e(s,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__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 b$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 aLe 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 E$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 nC extends ZI{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 Nbi(o,p){return p instanceof nC?p:new nC(o,p)}class aC extends ZI{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 xbi(o,p){return p instanceof aC?p:new aC(o,p)}function $bi(o){o.register(new XOe(o)),o.register(new YOe(o)),o.register(new HOe(o)),o.register(new zOe(o)),o.register(new JOe(o)),o.register(new WOe(o)),o.register(new LNe(o)),o.register(new BNe(o)),o.register(new MNe(o)),o.register(new kNe(o)),o.register(new GNe(o)),o.register(new jNe(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 B$e(o)),o.register(new M$e(o)),o.register(new $Pe(o)),o.register(new LPe(o)),o.register(new BPe(o)),o.register(new MPe(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 tNe(o)),o.register(new iNe(o)),o.register(new rNe(o)),o.register(new ePe(o)),o.register(new tPe(o)),o.register(new iPe(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 uPe(o)),o.register(new pPe(o)),o.register(new cPe(o)),o.register(new fPe(o)),o.register(new yPe(o)),o.register(new TVe(o)),o.register(new vVe(o)),o.register(new EVe(o)),o.register(new Zxe(o)),o.register(new qxe(o)),o.register(new m_e(o)),o.register(new T_e(o)),o.register(new v_e(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 M_e(o)),o.register(new yVe(o)),o.register(new hVe(o)),o.register(new mVe(o)),o.register(new D_e(o)),o.register(new w_e(o)),o.register(new O_e(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 B_e(o)),o.register(new G_e(o)),o.register(new k_e(o)),o.register(new j_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 nVe(o)),o.register(new aVe(o)),o.register(new sVe(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 eVe(o)),o.register(new tVe(o)),o.register(new iVe(o)),o.register(new rVe(o)),o.register(new Jxe(o)),o.register(new Yxe(o)),o.register(new Xxe(o)),o.register(new Qxe(o)),o.register(new Hxe(o)),o.register(new Wxe(o)),o.register(new zxe(o)),o.register(new e$e(o)),o.register(new i$e(o)),o.register(new n$e(o)),o.register(new t$e(o)),o.register(new r$e(o)),o.register(new a$e(o)),o.register(new o$e(o)),o.register(new s$e(o)),o.register(new l$e(o)),o.register(new hPe(o)),o.register(new EPe(o)),o.register(new bPe(o)),o.register(new IPe(o)),o.register(new RPe(o)),o.register(new DPe(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 APe(o)),o.register(new gPe(o)),o.register(new TPe(o)),o.register(new vPe(o)),o.register(new mPe(o)),o.register(new dPe(o)),o.register(new NPe(o)),o.register(new xPe(o)),o.register(new PPe(o)),o.register(new KNe(o)),o.register(new cxe(o)),o.register(new pxe(o)),o.register(new fxe(o)),o.register(new yxe(o)),o.register(new qNe(o)),o.register(new ZNe(o)),o.register(new XNe(o)),o.register(new JNe(o)),o.register(new dxe(o)),o.register(new rxe(o)),o.register(new axe(o)),o.register(new lxe(o)),o.register(new sxe(o)),o.register(new YNe(o)),o.register(new exe(o)),o.register(new txe(o)),o.register(new QNe(o)),o.register(new UNe(o)),o.register(new HNe(o)),o.register(new nxe(o)),o.register(new Txe(o)),o.register(new QO(o)),o.register(new SNe(o)),o.register(new WNe(o)),o.register(new FNe(o)),o.register(new oxe(o)),o.register(new zNe(o)),o.register(new ixe(o)),o.register(new uxe(o)),o.register(new mxe(o)),o.register(new hxe(o)),o.register(new vxe(o)),o.register(new QO(o)),o.register(new bxe(o)),o.register(new Exe(o)),o.register(new Axe(o)),o.register(new vNe(o)),o.register(new ENe(o)),o.register(new bNe(o)),o.register(new aNe(o)),o.register(new eNe(o)),o.register(new dNe(o)),o.register(new fNe(o)),o.register(new QPe(o)),o.register(new yNe(o)),o.register(new TNe(o)),o.register(new pNe(o)),o.register(new uNe(o)),o.register(new hA(o)),o.register(new ANe(o)),o.register(new gNe(o)),o.register(new cNe(o)),o.register(new mNe(o)),o.register(new hNe(o)),o.register(new oNe(o)),o.register(new lNe(o)),o.register(new sNe(o)),o.register(new nNe(o)),o.register(new DNe(o)),o.register(new RNe(o)),o.register(new wNe(o)),o.register(new INe(o)),o.register(new uVe(o)),o.register(new lVe(o)),o.register(new dVe(o)),o.register(new pVe(o)),o.register(new cVe(o)),o.register(new oVe(o)),o.register(new fVe(o)),o.register(new G$e(o)),o.register(new S$e(o)),o.register(new Z$e(o)),o.register(new W$e(o)),o.register(new F$e(o)),o.register(new q$e(o)),o.register(new H$e(o)),o.register(new K$e(o)),o.register(new U$e(o)),o.register(new j$e(o)),o.register(new k$e(o)),o.register(new Q$e(o)),o.register(new eLe(o)),o.register(new Y$e(o)),o.register(new X$e(o)),o.register(new O$e(o)),o.register(new z$e(o)),o.register(new J$e(o)),o.register(new iLe(o)),o.register(new tLe(o)),o.register(new rLe(o)),o.register(new nLe(o)),o.register(new aLe(o)),o.register(new eCe(o)),o.register(new tCe(o)),o.register(new fA(o)),o.register(new yA(o))}class cN{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(){$bi(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 Lb=null;const fN={requestExtension:o=>(Lb||(Lb=new cN,Lb.setup()),Lb.requestExtension(o))},Eu={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var yN=(o=>(o.FinishedSuccess="finished-success",o.FinishedError="finished-error",o.Running="running",o.Paused="paused",o.Stopped="stopped",o.NotStarted="not-started",o))(yN||{});const sLe={...fN,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class Iu extends J.Events{constructor(i,n,s,c=null,e=sLe){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 Nm(x.UUID.uuid(),this.project),this.resolvedValues=new Nm(x.UUID.uuid(),this.project),this.persistedExecutionResults=new Nm(x.UUID.uuid(),this.project),this.lastExecutionResults=new Nm(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)&&Rt(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,$,B;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(((B=y==null?void 0:y.value)==null?void 0:B.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(cy+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:Ne.ExecutionResult,inheritanceLink:null,value:w}}return{value:v.value,entity:i,error:E,result:{value:v.result||null,valueOwner:i,type:Ne.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:Ne.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:Ne.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:Ne.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:Ne.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:Ne.ExecutionResult,inheritanceLink:null,value:v},result:null}:{value:e.value,entity:i,error:null,result:{value:v,valueOwner:i,type:Ne.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:Ne.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 B={};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:Ne.ExecutionResult,inheritanceLink:null};B[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=Tc(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:Ne.ExecutionResult,inheritanceLink:null};return B[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:Ne.ExecutionResult,inheritanceLink:null};return B[ae.id]=_e,_e}else return B[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(Pe=>le(Pe,s)===le(ae.valueOwner,s)),ue=[...((Ve=(ye=B==null?void 0:B[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=B[fe.id].value)==null||$e.metaSync({value:ue},null),this.lastExecutionResults.writeValue(fe,B[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:Ne.ExecutionResult,inheritanceLink:null};return B[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:Ne.ExecutionResult,inheritanceLink:null}}else return B[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=B[ae.id].value)==null?void 0:ue.value,((ye=de.value)==null?void 0:ye.value)||null];(Ve=B[ae.id].value)==null||Ve.metaSync({value:ve},null),this.lastExecutionResults.writeValue(ae,B[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:Ne.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:Ne.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=Tc(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:Ne.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()},Pe=Si($e,s);return this.lastExecutionResults.writeValue(ue,Pe),{value:Pe,valueOwner:i.currentValueArgumentDeclaration,type:Ne.ExecutionResult,inheritanceLink:null}}else return B[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Pe,Me;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=B[ye.id].value)==null?void 0:$e.value,((Pe=ue.value)==null?void 0:Pe.value)||null];(Me=B[ye.id].value)==null||Me.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,B[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:Ne.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:Ne.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=Tc(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:Ne.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()},Pe=Si($e,s);return this.lastExecutionResults.writeValue(ue,Pe),{value:Pe,valueOwner:i.currentValueArgumentDeclaration,type:Ne.ExecutionResult,inheritanceLink:null}}else return B[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Pe,Me;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=B[ye.id].value)==null?void 0:$e.value,((Pe=ue.value)==null?void 0:Pe.value)||null];(Me=B[ye.id].value)==null||Me.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,B[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:Ne.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:Ne.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=Tc(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:Ne.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()},Pe=Si($e,s);return this.lastExecutionResults.writeValue(ue,Pe),{value:Pe,valueOwner:i.currentValueArgumentDeclaration,type:Ne.ExecutionResult,inheritanceLink:null}}else return B[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Pe,Me;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=B[ye.id].value)==null?void 0:$e.value,((Pe=ue.value)==null?void 0:Pe.value)||null];(Me=B[ye.id].value)==null||Me.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,B[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:Ne.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:Ne.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=Tc(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:Ne.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()},Pe=Si($e,s);return this.lastExecutionResults.writeValue(ue,Pe),{value:Pe,valueOwner:i.currentValueArgumentDeclaration,type:Ne.ExecutionResult,inheritanceLink:null}}else return B[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Pe,Me;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=B[ye.id].value)==null?void 0:$e.value,((Pe=ue.value)==null?void 0:Pe.value)||null];(Me=B[ye.id].value)==null||Me.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,B[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:Ne.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:Ne.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),B=It($,i.error,s);return $!=null&&$.asType?B==null||B.setValueAsTypeSingle(V):B==null||B.metaSync({value:V},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ne.ExecutionResult,inheritanceLink:null,value:B},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,$,B,j,F,K,Y,ie,ee,de,ae,fe,ve,ue,ye,Ve,_e,$e,Pe,Me;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((B=($=Se.error)==null?void 0:$.value)==null?void 0:B.valueAsTypeList)&&(_t==null||_t.setValueAsTypeList((F=(j=Se.error)==null?void 0:j.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:Ne.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:((Pe=($e=Se.result)==null?void 0:$e.value)==null?void 0:Pe.value)||null},null),{value:Ze,entity:i,error:je,result:{value:st||null,valueOwner:i,type:Ne.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=(Me=i.error)==null?void 0:Me.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:Ne.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,...PA(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,n)}async executeFullFunctionDeclarationLogic(i,n,s={}){const c={...Eu,...s},e=PA(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:Ne.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 B=It(c,i,this.project);B==null||B.metaSync({value:$},null),s={valueOwner:i,type:Ne.ExecutionResult,inheritanceLink:null,value:B}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(B=>{var j,F;if(((j=B.declaration)==null?void 0:j.type)===d.Property&&B.declaration.static){const K=this.lastExecutionResults.readValue(B.declaration.id),Y=le(B,this.project),ie=B.codeName||((F=B.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.declaration,K);else{const ee=It(B.getDataType(null),B,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.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 B=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),j=e[B],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ne.ExecutionResult}),s.type=Ne.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:Ne.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 B=It(c,i,this.project);B==null||B.metaSync({value:$},null),s={valueOwner:i,type:Ne.ExecutionResult,inheritanceLink:null,value:B}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(B=>{var j,F;if(((j=B.declaration)==null?void 0:j.type)===d.Property&&B.declaration.static){const K=this.lastExecutionResults.readValue(B.declaration.id),Y=le(B,this.project),ie=B.codeName||((F=B.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.declaration,K);else{const ee=It(B.getDataType(null),B,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.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 B=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),j=e[B],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ne.ExecutionResult}),s.type=Ne.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:Ne.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 B=It(c,i,this.project);B==null||B.metaSync({value:$},null),s={valueOwner:i,type:Ne.ExecutionResult,inheritanceLink:null,value:B}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(B=>{var j,F;if(((j=B.declaration)==null?void 0:j.type)===d.Property&&B.declaration.static){const K=this.lastExecutionResults.readValue(B.declaration.id),Y=le(B,this.project),ie=B.codeName||((F=B.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.declaration,K);else{const ee=It(B.getDataType(null),B,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.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 B=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),j=e[B],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ne.ExecutionResult}),s.type=Ne.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 B=It(e,i,this.project);B==null||B.metaSync({value:$},null),s={valueOwner:c,type:Ne.ExecutionResult,inheritanceLink:null,value:B}}this.lastExecutionResults.writeValue(c,s.value),c.inputs.forEach(B=>{var j,F;if(((j=B.declaration)==null?void 0:j.type)===d.Property&&B.declaration.static){const K=this.lastExecutionResults.readValue(B.declaration.id),Y=le(B,this.project),ie=B.codeName||((F=B.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.declaration,K);else{const ee=It(B.getDataType(null),B,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.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 B=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),j=y[B],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ne.ExecutionResult}),s.type=Ne.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,$,B,j,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((B=c.onBeforeEntityExecution)==null?void 0:B.call(c,i,K,e)),this.executeContinueStatement(i,K)}case d.BreakStatement:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((j=c.onBeforeEntityExecution)==null?void 0:j.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(B=>this.hasEntity(B));(i.errorCalls||[]).forEach(B=>{this.skip(B)});let w=[];const V=(await Promise.all(E.map(B=>this.schedule(B,[],c)))).filter(B=>!!B),$=V.filter(B=>!!B).find(B=>B.value===G.CaughtError||B.value===G.Return||B.value===G.Break||B.value===G.Continue);return $||(w=[...w,...V],m)}else if(m.value===G.CaughtError||m.value===G.ConditionNotMet){const E=(i.errorCalls||[]).filter(B=>this.hasEntity(B));(i.successCalls||i.calls||[]).forEach(B=>{this.skip(B)});let w=[];const V=(await Promise.all(E.map(B=>this.schedule(B,[],c)))).filter(B=>!!B),$=V.filter(B=>!!B).find(B=>B.value===G.CaughtError||B.value===G.UnhandledError||B.value===G.Return||B.value===G.Break||B.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)&&Rt(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 Lbi(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 as={[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 hN(o){const p=xR(o);if(!p){const n=Ly(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=Ly(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 lLe(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 mN(o){return fx(o)?lLe(o):"Custom trigger"}function Bbi(o){var p;switch(o.type){case d.DefinitionEntity:return hN(o);case d.FunctionDeclaration:return mN(o)}return(p=as[o.type])==null?void 0:p.singular}function Mbi(o){var p;switch(o.type){case d.DefinitionEntity:return hN(o);case d.FunctionDeclaration:return mN(o)}return(p=as[o.type])==null?void 0:p.singular}const TN=4e4,oLe=280,Gbi=300,vN=65,fy=32,Zb=39,dLe=26,uLe=49,EA=44,kbi=35,Hb=52,EN=10,ud=EN*2,bA=38,Wb=90,sC=270,pLe=TN/2+120,cLe=TN/2+180;function fLe(o){let i=fy+EA+bA+EN;const n=[...o.inputs];return n.length&&(i+=ud,n.forEach(()=>{i+=dLe})),{height:i,width:280}}function yLe(o){let i=vN;const n=[];if([d.DefinitionEntity].includes(o.type)){const m=[...o.suggestedProperties||[],...o.properties||[]];m.length&&(i+=ud,m.forEach(v=>{i+=v.static?uLe:Zb}))}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=fLe(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+=Hb)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)?(n.push(...o.outputs||[]),o.throws&&(i+=Hb)):o.type===d.Condition&&(n.push(o.inputs[0]),o.inputs[1]&&n.push(o.inputs[1]));const s=n.length;s&&(i+=s*Zb,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+=EA),o.writesValues.length&&(i+=ud,i+=EA),o.internalCalls.length&&o.usedInternalCalls.forEach(()=>i+=Hb+ud);const m=o.getDataType(null);(!m||m.inferred)&&(i+=bA)}const e=c.length;return e&&(i+=e*Zb,i+=ud),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)&&(i+=bA),{height:i,width:280}}function pv(o){return`${o.split("-").map((n,s)=>s===0?n.charAt(0).toUpperCase()+n.slice(1):n.toLowerCase()).join(" ")}.`}function jbi(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 Ma.UUIDMustBeString:return`UUID must be a string, eg: "${Du()}"`;case Ma.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Du()}"`;case Ma.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 pv(o.code)}}function Ubi(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 Ma.UUIDMustBeString:return"UUID must be a string";case Ma.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case Ma.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 pv(o.code)}}function Kbi(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`${as[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 Ma.UUIDMustBeString:return`${le(o.entity,o.entity.project)} UUID must be a string`;case Ma.UUIDMustNotContainSpaces:return`${le(o.entity,o.entity.project)} UUID must not contain spaces`;case Ma.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: ${pv(o.code)}`}}function Fbi(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`${as[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 Ma.UUIDMustBeString:return`${le(o.entity,o.entity.project)} UUID must be a string, eg: "${Du()}"`;case Ma.UUIDMustNotContainSpaces:return`${le(o.entity,o.entity.project)} UUID must not contain spaces, eg: "${Du()}"`;case Ma.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: ${pv(o.code)}`}}var bN=(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))(bN||{});const Sbi=Object.values(bN);var AN=(o=>(o.NotPartOfOngoingTest="not-part-of-ongoing-test",o.CannotBeAddedToTest="cannot-be-added-to-test",o))(AN||{});const qbi=Object.values(AN);var gN=(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))(gN||{});const Zbi=Object.values(gN);function Hbi(o,p){const i=[...o,...p];return Array.from(new Set(i))}function Wbi(o,p){const i=[...o,...p],n=Array.from(new Set(i));return{hasChanged:n.length!==o.length,reasons:n}}function zbi(o,p){const i=o.filter(s=>!p.includes(s));return{hasChanged:i.length!==o.length,reasons:i}}function Jbi(o,p){return o.find(i=>i.entity.id===p)||null}function j4(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=pLe-sC-oLe,c=cLe-Wb-vN;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=!!OA(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=>!Sp(e).length);this.childEntities=[...n,...s,...c]}else{const i=[],n=[],s=[],c=[],e=[];Zr.includes(this.entity.type)&&PR(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)=>Pc(m,v)?-1:0),c.sort((m,v)=>Pc(m,v)?-1:0),s.sort((m,v)=>AC(m,v)?1:AC(v,m)?-1:0),this.childEntities=[...e,...i,...c,...y,...s,...n]}}calculateCardSize(){const p=yLe(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+Wb,right:p.right+sC}}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=Jbi(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+fy,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-fy;this.shiftDownAlone(n)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((s,c)=>{const e=c.ownEntityArea,y=e.top+fy,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-fy;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 j4(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((n,s)=>[...n,...s.getLowerAreas()],[]);return j4([...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=>OA(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+Wb;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 $m=(o=>(o.Amazon="amazon",o.Google="google",o.Microsoft="microsoft",o))($m||{}),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||{}),lC=(o=>(o.Post="post",o.Get="get",o.Acknowledgement="acknowledgment",o.Progress="progress",o.Error="error",o.Complete="complete",o))(lC||{}),vc=(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))(vc||{}),oC=(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))(oC||{}),$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 hLe(o){return`project-${o}-http-api`}function iR(o){return`entity-${o}-database`}class mLe{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",vc.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 TLe=(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))(TLe||{});class nf{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 Ybi extends nf{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=iR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class Xbi extends nf{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=iR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class vLe extends nf{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=hLe(this.publicationRun.project.id),this.resourceId}}class ELe extends nf{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=iR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class bLe extends nf{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 ALe extends nf{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 Qbi{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 ALe(this,$m.Amazon)),this.implicitGlobalResources.set(hr.CloudHostedCodebase,new bLe(this,$m.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 ELe(this,[n],$m.Amazon);this.explicitResources.set(s.resourceId,s)}),p.length){const n=new vLe(this,p,$m.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 mLe(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===lC.Error?(this.finalStatus=oC.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===lC.Complete&&(this.finalStatus=oC.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 cN(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(X.PublicationRun),this.extensionsRegistry}}function eAi(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 tAi(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 gLe=(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))(gLe||{});function iAi(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 rAi(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 nAi(o){switch(o){case vc.Running:return"In progress";case vc.Failed:return"Failed";case vc.Success:return"Succeeded";case vc.Skipped:return"Skipped";case vc.Queued:default:return"Queued"}}function ILe(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=dC(o.name)):o.type===d.DefinitionEntity&&o.implements.forEach(s=>{if(Wi(s,Re.EXTERNAL_INTEGRATION_CONNECTION)){const c=dC(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 aAi(o){return The[o]}function dC(o){return o.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?o.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function RLe(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 sAi(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 lAi(o){return o.type===d.BuiltInBaseEntity||o.type===d.DefinitionEntity?ILe(o):o.type===d.ActionDescriptor||o.type===d.Operation?RLe(o):null}function DLe(o){var s,c,e;if(!Wi(o,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=G4e(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 DLe(o.extends);p=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return p}async function wLe(o,p={}){var y;const i=J.YieldTracker.from(p),s=[...ea(o),...Rs(o),...IN(o),...ta(o),...RN(o)],c=Cv(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 OLe(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),...Rs(o),...IN(o),...ta(o),...RN(o)],n=Cv(o);return i.push(...n),Lt(o.errors,i)}function IN(o,p){const n=[...o.project.getVariableDeclarations()].filter(s=>s.id!==o.id);return Vv(o,[Hi],n,p)}function RN(o){const p=[];if(o.parent!==o.project)return p;if(o.catchesError){const i=Ot({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotCatchError}`,message:`${as[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:`${as[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:`${as[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 oAi=Object.freeze(Object.defineProperty({__proto__:null,validate:OLe,validateAsync:wLe,validateGlobalVariableDeclaration:RN,validateVariableDeclarationName:IN},Symbol.toStringTag,{value:"Module"}));async function CLe(o,p={}){const i=J.YieldTracker.from(p),s=[...ea(o),...Rs(o),...ta(o)],c=Cv(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 _Le(o){o.inputs.forEach(s=>s.validate()),o.outputs.forEach(s=>s.validate()),o.internalCalls.forEach(s=>s.validate());const i=[...ea(o),...Rs(o),...ta(o)],n=Cv(o);return i.push(...n),Lt(o.errors,i)}function dAi(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 uAi=Object.freeze(Object.defineProperty({__proto__:null,validate:_Le,validateAsync:CLe,validateConstantValueOverride:dAi},Symbol.toStringTag,{value:"Module"}));var DN=(o=>(o.Parent="parent",o.DataTypeEntity="data-type-entity",o.VarDeclaration="var-declaration",o))(DN||{});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=lf(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=_c(this.defaults,i);const{transitional:n,paramsSerializer:s,headers:c}=i;n!==void 0&&Sb.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}:Sb.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),Sb.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(B){typeof B.runWhen=="function"&&B.runWhen(i)===!1||(m=m&&B.synchronous,y.unshift(B.fulfilled,B.rejected))});const v=[];this.interceptors.response.forEach(function(B){v.push(B.fulfilled,B.rejected)});let E,b=0,w;if(!m){const $=[M4.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++],B=y[b++];try{V=$(V)}catch(j){B.call(this,j);break}}try{E=M4.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=_c(this.defaults,p);const i=kxe(p.baseURL,p.url,p.allowAbsoluteUrls);return $xe(i,p.params,p.paramsSerializer)}}Ue.forEach(["delete","get","head","options"],function(p){TA.prototype[p]=function(i,n){return this.request(_c(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(_c(y||{},{method:p,headers:n?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}TA.prototype[p]=i(),TA.prototype[p+"Form"]=i(!0)});const qb=TA;class uN{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 jh(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 uN(function(s){p=s}),cancel:p}}}const wbi=uN;function Obi(o){return function(i){return o.apply(null,i)}}function Cbi(o){return Ue.isObject(o)&&o.isAxiosError===!0}const rC={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(rC).forEach(([o,p])=>{rC[p]=o});const _bi=rC;function Sxe(o){const p=new qb(o),i=gxe(qb.prototype.request,p);return Ue.extend(i,qb.prototype,p,{allOwnKeys:!0}),Ue.extend(i,p,null,{allOwnKeys:!0}),i.create=function(s){return Sxe(_c(o,s))},i}const vn=Sxe(oN);vn.Axios=qb;vn.CanceledError=jh;vn.CancelToken=wbi;vn.isCancel=Mxe;vn.VERSION=Fxe;vn.toFormData=JI;vn.AxiosError=si;vn.Cancel=vn.CanceledError;vn.all=function(p){return Promise.all(p)};vn.spread=Obi;vn.isAxiosError=Cbi;vn.mergeConfig=_c;vn.AxiosHeaders=bl;vn.formToJSON=o=>Bxe(Ue.isHTMLForm(o)?new FormData(o):o);vn.getAdapter=Kxe.getAdapter;vn.HttpStatusCode=_bi;vn.default=vn;const Vbi=vn;class qxe 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 Vbi(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}}}})}}class Zxe 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=BR(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 Hxe 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=rvi(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class Wxe 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=nvi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class zxe 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=avi(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class Jxe 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=svi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class Yxe 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=lvi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class Xxe 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=ovi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class Qxe 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=dvi(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_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=uvi(s,c);return{value:G.Success,error:null,result:e}}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__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=pvi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class i$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=cvi(s,c);return{value:G.Success,error:null,result:e}}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_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=fvi(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class n$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),B=(v=(m=n[0])==null?void 0:m.value)==null?void 0:v.value,j=(b=(E=n[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!B)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!j)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!$)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(j.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)!==(j==null?void 0:j.id)?K=!1:BR(F==null?void 0:F.entity).safeParse(B).success?K=!0:K=!1,{value:G.Success,error:null,result:K}}catch($){return{value:G.UnhandledError,error:$,result:null}}}})}}class a$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=yvi(...s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class s$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=hvi(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class l$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=mvi(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class o$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=Tvi(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}let ss=null;try{ss=require("crypto")}catch{}const Gm=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:ss&&ss.webcrypto?ss.webcrypto:null,wu=Gm?Gm.subtle:null;function Wm(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 d$e=o=>Hr(o,"base64"),u$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64")},_y=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64url")},Vc=o=>Hr(o,"base64url"),p$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"hex")},c$e=o=>Hr(o,"hex");function pN(o){if(Gm&&Gm.getRandomValues){const p=new Uint8Array(o);return Gm.getRandomValues(p),p}if(ss&&ss.randomBytes)return new Uint8Array(ss.randomBytes(o));throw new Error("Secure random not available")}function QI(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 f$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 QI(e,y)}async function y$e(o,p){if(wu){const i=await wu.digest({name:o},Wm(p));return new Uint8Array(i)}if(ss){const i=o.replace("SHA-","sha"),n=ss.createHash(i);return n.update(Buffer.from(p)),new Uint8Array(n.digest())}throw new Error("Hash not available")}async function h$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 y$e(s,y);return Ql(m,e)}async function eR(o,p,i){if(wu){const n=await wu.importKey("raw",Wm(p),{name:"HMAC",hash:{name:o}},!1,["sign"]),s=await wu.sign("HMAC",n,Wm(i));return new Uint8Array(s)}if(ss){const n=`sha${o.split("-")[1]}`,s=ss.createHmac(n,Buffer.from(p));return s.update(Buffer.from(i)),new Uint8Array(s.digest())}throw new Error("HMAC not available")}async function m$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 eR(e,E,b);return Ql(w,v)}async function tR(o,p,{iterations:i,length:n,hashAlg:s="SHA-256"}){if(wu){const c=await wu.importKey("raw",Wm(o),"PBKDF2",!1,["deriveBits"]),e=await wu.deriveBits({name:"PBKDF2",salt:Wm(p),iterations:i,hash:s},c,n*8);return new Uint8Array(e)}if(ss){const c=s==="SHA-512"?"sha512":"sha256";return await new Promise((e,y)=>{ss.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 T$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),B=Hr(p??"",v),j=await tR($,B,{iterations:b,length:w,hashAlg:V});return Ql(j,E)}async function v$e(o,p=pN(16),i=21e4,n=32,s="SHA-256"){const c=Hr(o,"utf8"),e=await tR(c,p,{iterations:i,length:n,hashAlg:s}),y=_y(p),m=_y(e);return`pbkdf2$${s.toLowerCase()}$${i}$${y}$${m}`}async function E$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=Vc(i[3]),e=Vc(i[4]),y=n.includes("512")?"SHA-512":"SHA-256",m=await tR(Hr(o,"utf8"),c,{iterations:s,length:e.length,hashAlg:y});return QI(m,e)}async function b$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 v$e(String(o??""),E,e,y,m)}function k4(o){return _y(Hr(JSON.stringify(o),"utf8"))}function vA(o){try{return JSON.parse(Ql(Vc(o),"utf8"))}catch{return null}}async function A$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 $=k4(b),B=k4(V),j=Hr(`${$}.${B}`,"utf8"),K=await eR(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,j),Y=_y(K);return`${$}.${B}.${Y}`}async function g$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 A$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 I$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=vA(y),b=vA(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 eR(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,w),B=Vc(v);if(!QI($,B))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const j=Math.floor(Date.now()/1e3),F=Math.max(0,Number(e)||0);if(b.nbf!=null&&j+F<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&j-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&&j-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 R$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 I$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 D$e(o){const[p,i,n]=String(o).split(".");return{header:p?vA(p):null,payload:i?vA(i):null,signature:n?Vc(n):new Uint8Array}}function w$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}=D$e(String(o??"")),e=Ql(c,i);return{header:n,payload:s,signature:e}}class O$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=pN(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 C$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=hOe(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 _$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=FI();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 V$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=UP(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 P$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=KP(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 N$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=TOe(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_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=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 $$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=SP(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 L$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 B$e 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=vOe();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 M$e 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=EOe();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 Pbi(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 G$e 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:Pbi(c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class k$e 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 j$e 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 U$e 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 K$e 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 F$e 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:u$e(s,c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class S$e 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=d$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 q$e 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=_y(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 Z$e 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=Vc(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 H$e 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=p$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 W$e 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=c$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 z$e 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:h$e(s,c,e,y)}}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__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:m$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 Y$e 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:f$e(s,c,e,y)}}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__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:T$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 Q$e 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 eLe 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 tLe 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,$,B]=n.map(j=>{var F,K;return((F=j.value)==null?void 0:F.valueAsType)??((K=j.value)==null?void 0:K.value)});return{value:G.Success,error:null,result:await g$e(s,c,e,y,m,v,E,b,w,V,$,B)}}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__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 R$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 rLe 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:w$e(s,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__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 b$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 aLe 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 E$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 nC extends ZI{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 Nbi(o,p){return p instanceof nC?p:new nC(o,p)}class aC extends ZI{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 xbi(o,p){return p instanceof aC?p:new aC(o,p)}function $bi(o){o.register(new XOe(o)),o.register(new YOe(o)),o.register(new HOe(o)),o.register(new zOe(o)),o.register(new JOe(o)),o.register(new WOe(o)),o.register(new LNe(o)),o.register(new BNe(o)),o.register(new MNe(o)),o.register(new kNe(o)),o.register(new GNe(o)),o.register(new jNe(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 B$e(o)),o.register(new M$e(o)),o.register(new $Pe(o)),o.register(new LPe(o)),o.register(new BPe(o)),o.register(new MPe(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 tNe(o)),o.register(new iNe(o)),o.register(new rNe(o)),o.register(new ePe(o)),o.register(new tPe(o)),o.register(new iPe(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 uPe(o)),o.register(new pPe(o)),o.register(new cPe(o)),o.register(new fPe(o)),o.register(new yPe(o)),o.register(new TVe(o)),o.register(new vVe(o)),o.register(new EVe(o)),o.register(new Zxe(o)),o.register(new qxe(o)),o.register(new m_e(o)),o.register(new T_e(o)),o.register(new v_e(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 M_e(o)),o.register(new yVe(o)),o.register(new hVe(o)),o.register(new mVe(o)),o.register(new D_e(o)),o.register(new w_e(o)),o.register(new O_e(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 B_e(o)),o.register(new G_e(o)),o.register(new k_e(o)),o.register(new j_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 nVe(o)),o.register(new aVe(o)),o.register(new sVe(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 eVe(o)),o.register(new tVe(o)),o.register(new iVe(o)),o.register(new rVe(o)),o.register(new Jxe(o)),o.register(new Yxe(o)),o.register(new Xxe(o)),o.register(new Qxe(o)),o.register(new Hxe(o)),o.register(new Wxe(o)),o.register(new zxe(o)),o.register(new e$e(o)),o.register(new i$e(o)),o.register(new n$e(o)),o.register(new t$e(o)),o.register(new r$e(o)),o.register(new a$e(o)),o.register(new o$e(o)),o.register(new s$e(o)),o.register(new l$e(o)),o.register(new hPe(o)),o.register(new EPe(o)),o.register(new bPe(o)),o.register(new IPe(o)),o.register(new RPe(o)),o.register(new DPe(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 APe(o)),o.register(new gPe(o)),o.register(new TPe(o)),o.register(new vPe(o)),o.register(new mPe(o)),o.register(new dPe(o)),o.register(new NPe(o)),o.register(new xPe(o)),o.register(new PPe(o)),o.register(new KNe(o)),o.register(new cxe(o)),o.register(new pxe(o)),o.register(new fxe(o)),o.register(new yxe(o)),o.register(new qNe(o)),o.register(new ZNe(o)),o.register(new XNe(o)),o.register(new JNe(o)),o.register(new dxe(o)),o.register(new rxe(o)),o.register(new axe(o)),o.register(new lxe(o)),o.register(new sxe(o)),o.register(new YNe(o)),o.register(new exe(o)),o.register(new txe(o)),o.register(new QNe(o)),o.register(new UNe(o)),o.register(new HNe(o)),o.register(new nxe(o)),o.register(new Txe(o)),o.register(new QO(o)),o.register(new SNe(o)),o.register(new WNe(o)),o.register(new FNe(o)),o.register(new oxe(o)),o.register(new zNe(o)),o.register(new ixe(o)),o.register(new uxe(o)),o.register(new mxe(o)),o.register(new hxe(o)),o.register(new vxe(o)),o.register(new QO(o)),o.register(new bxe(o)),o.register(new Exe(o)),o.register(new Axe(o)),o.register(new vNe(o)),o.register(new ENe(o)),o.register(new bNe(o)),o.register(new aNe(o)),o.register(new eNe(o)),o.register(new dNe(o)),o.register(new fNe(o)),o.register(new QPe(o)),o.register(new yNe(o)),o.register(new TNe(o)),o.register(new pNe(o)),o.register(new uNe(o)),o.register(new hA(o)),o.register(new ANe(o)),o.register(new gNe(o)),o.register(new cNe(o)),o.register(new mNe(o)),o.register(new hNe(o)),o.register(new oNe(o)),o.register(new lNe(o)),o.register(new sNe(o)),o.register(new nNe(o)),o.register(new DNe(o)),o.register(new RNe(o)),o.register(new wNe(o)),o.register(new INe(o)),o.register(new uVe(o)),o.register(new lVe(o)),o.register(new dVe(o)),o.register(new pVe(o)),o.register(new cVe(o)),o.register(new oVe(o)),o.register(new fVe(o)),o.register(new G$e(o)),o.register(new S$e(o)),o.register(new Z$e(o)),o.register(new W$e(o)),o.register(new F$e(o)),o.register(new q$e(o)),o.register(new H$e(o)),o.register(new K$e(o)),o.register(new U$e(o)),o.register(new j$e(o)),o.register(new k$e(o)),o.register(new Q$e(o)),o.register(new eLe(o)),o.register(new Y$e(o)),o.register(new X$e(o)),o.register(new O$e(o)),o.register(new z$e(o)),o.register(new J$e(o)),o.register(new iLe(o)),o.register(new tLe(o)),o.register(new rLe(o)),o.register(new nLe(o)),o.register(new aLe(o)),o.register(new eCe(o)),o.register(new tCe(o)),o.register(new fA(o)),o.register(new yA(o))}class cN{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(){$bi(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 Lb=null;const fN={requestExtension:o=>(Lb||(Lb=new cN,Lb.setup()),Lb.requestExtension(o))},Eu={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var yN=(o=>(o.FinishedSuccess="finished-success",o.FinishedError="finished-error",o.Running="running",o.Paused="paused",o.Stopped="stopped",o.NotStarted="not-started",o))(yN||{});const sLe={...fN,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class Iu extends J.Events{constructor(i,n,s,c=null,e=sLe){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 Nm(x.UUID.uuid(),this.project),this.resolvedValues=new Nm(x.UUID.uuid(),this.project),this.persistedExecutionResults=new Nm(x.UUID.uuid(),this.project),this.lastExecutionResults=new Nm(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)&&Rt(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,$,B;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(((B=y==null?void 0:y.value)==null?void 0:B.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(cy+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:Ne.ExecutionResult,inheritanceLink:null,value:w}}return{value:v.value,entity:i,error:E,result:{value:v.result||null,valueOwner:i,type:Ne.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:Ne.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:Ne.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:Ne.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:Ne.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:Ne.ExecutionResult,inheritanceLink:null,value:v},result:null}:{value:e.value,entity:i,error:null,result:{value:v,valueOwner:i,type:Ne.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:Ne.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 B={};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:Ne.ExecutionResult,inheritanceLink:null};B[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=Tc(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:Ne.ExecutionResult,inheritanceLink:null};return B[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:Ne.ExecutionResult,inheritanceLink:null};return B[ae.id]=_e,_e}else return B[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(Pe=>le(Pe,s)===le(ae.valueOwner,s)),ue=[...((Ve=(ye=B==null?void 0:B[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=B[fe.id].value)==null||$e.metaSync({value:ue},null),this.lastExecutionResults.writeValue(fe,B[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:Ne.ExecutionResult,inheritanceLink:null};return B[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:Ne.ExecutionResult,inheritanceLink:null}}else return B[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=B[ae.id].value)==null?void 0:ue.value,((ye=de.value)==null?void 0:ye.value)||null];(Ve=B[ae.id].value)==null||Ve.metaSync({value:ve},null),this.lastExecutionResults.writeValue(ae,B[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:Ne.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:Ne.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=Tc(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:Ne.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()},Pe=Si($e,s);return this.lastExecutionResults.writeValue(ue,Pe),{value:Pe,valueOwner:i.currentValueArgumentDeclaration,type:Ne.ExecutionResult,inheritanceLink:null}}else return B[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Pe,Me;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=B[ye.id].value)==null?void 0:$e.value,((Pe=ue.value)==null?void 0:Pe.value)||null];(Me=B[ye.id].value)==null||Me.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,B[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:Ne.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:Ne.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=Tc(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:Ne.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()},Pe=Si($e,s);return this.lastExecutionResults.writeValue(ue,Pe),{value:Pe,valueOwner:i.currentValueArgumentDeclaration,type:Ne.ExecutionResult,inheritanceLink:null}}else return B[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Pe,Me;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=B[ye.id].value)==null?void 0:$e.value,((Pe=ue.value)==null?void 0:Pe.value)||null];(Me=B[ye.id].value)==null||Me.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,B[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:Ne.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:Ne.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=Tc(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:Ne.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()},Pe=Si($e,s);return this.lastExecutionResults.writeValue(ue,Pe),{value:Pe,valueOwner:i.currentValueArgumentDeclaration,type:Ne.ExecutionResult,inheritanceLink:null}}else return B[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Pe,Me;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=B[ye.id].value)==null?void 0:$e.value,((Pe=ue.value)==null?void 0:Pe.value)||null];(Me=B[ye.id].value)==null||Me.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,B[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:Ne.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:Ne.ExecutionResult,inheritanceLink:null}}else if(ue===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),Ve=Tc(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:Ne.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()},Pe=Si($e,s);return this.lastExecutionResults.writeValue(ue,Pe),{value:Pe,valueOwner:i.currentValueArgumentDeclaration,type:Ne.ExecutionResult,inheritanceLink:null}}else return B[ue.id]}).filter(ue=>!!ue);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ve,e),(F.results||[]).forEach(ue=>{var $e,Pe,Me;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=B[ye.id].value)==null?void 0:$e.value,((Pe=ue.value)==null?void 0:Pe.value)||null];(Me=B[ye.id].value)==null||Me.metaSync({value:_e},null),this.lastExecutionResults.writeValue(ye,B[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:Ne.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:Ne.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),B=It($,i.error,s);return $!=null&&$.asType?B==null||B.setValueAsTypeSingle(V):B==null||B.metaSync({value:V},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ne.ExecutionResult,inheritanceLink:null,value:B},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,$,B,j,F,K,Y,ie,ee,de,ae,fe,ve,ue,ye,Ve,_e,$e,Pe,Me;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((B=($=Se.error)==null?void 0:$.value)==null?void 0:B.valueAsTypeList)&&(_t==null||_t.setValueAsTypeList((F=(j=Se.error)==null?void 0:j.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:Ne.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:((Pe=($e=Se.result)==null?void 0:$e.value)==null?void 0:Pe.value)||null},null),{value:Ze,entity:i,error:je,result:{value:st||null,valueOwner:i,type:Ne.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=(Me=i.error)==null?void 0:Me.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:Ne.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,...PA(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,n)}async executeFullFunctionDeclarationLogic(i,n,s={}){const c={...Eu,...s},e=PA(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:Ne.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 B=It(c,i,this.project);B==null||B.metaSync({value:$},null),s={valueOwner:i,type:Ne.ExecutionResult,inheritanceLink:null,value:B}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(B=>{var j,F;if(((j=B.declaration)==null?void 0:j.type)===d.Property&&B.declaration.static){const K=this.lastExecutionResults.readValue(B.declaration.id),Y=le(B,this.project),ie=B.codeName||((F=B.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.declaration,K);else{const ee=It(B.getDataType(null),B,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.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 B=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),j=e[B],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ne.ExecutionResult}),s.type=Ne.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:Ne.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 B=It(c,i,this.project);B==null||B.metaSync({value:$},null),s={valueOwner:i,type:Ne.ExecutionResult,inheritanceLink:null,value:B}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(B=>{var j,F;if(((j=B.declaration)==null?void 0:j.type)===d.Property&&B.declaration.static){const K=this.lastExecutionResults.readValue(B.declaration.id),Y=le(B,this.project),ie=B.codeName||((F=B.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.declaration,K);else{const ee=It(B.getDataType(null),B,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.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 B=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),j=e[B],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ne.ExecutionResult}),s.type=Ne.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:Ne.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 B=It(c,i,this.project);B==null||B.metaSync({value:$},null),s={valueOwner:i,type:Ne.ExecutionResult,inheritanceLink:null,value:B}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(B=>{var j,F;if(((j=B.declaration)==null?void 0:j.type)===d.Property&&B.declaration.static){const K=this.lastExecutionResults.readValue(B.declaration.id),Y=le(B,this.project),ie=B.codeName||((F=B.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.declaration,K);else{const ee=It(B.getDataType(null),B,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.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 B=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),j=e[B],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ne.ExecutionResult}),s.type=Ne.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 B=It(e,i,this.project);B==null||B.metaSync({value:$},null),s={valueOwner:c,type:Ne.ExecutionResult,inheritanceLink:null,value:B}}this.lastExecutionResults.writeValue(c,s.value),c.inputs.forEach(B=>{var j,F;if(((j=B.declaration)==null?void 0:j.type)===d.Property&&B.declaration.static){const K=this.lastExecutionResults.readValue(B.declaration.id),Y=le(B,this.project),ie=B.codeName||((F=B.declaration)==null?void 0:F.codeName)||Hi(Y);if(K)K.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.declaration,K);else{const ee=It(B.getDataType(null),B,this.project);ee==null||ee.metaSync({value:$[ie]},null),this.lastExecutionResults.writeValue(B.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 B=$.codeName||((K=$.declaration)==null?void 0:K.codeName)||Hi(le($,this.project)),j=y[B],F=It($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ne.ExecutionResult}),s.type=Ne.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,$,B,j,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((B=c.onBeforeEntityExecution)==null?void 0:B.call(c,i,K,e)),this.executeContinueStatement(i,K)}case d.BreakStatement:{const K=this.mergeExernalValuesWithInternalInputs(n,i);return await((j=c.onBeforeEntityExecution)==null?void 0:j.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(B=>this.hasEntity(B));(i.errorCalls||[]).forEach(B=>{this.skip(B)});let w=[];const V=(await Promise.all(E.map(B=>this.schedule(B,[],c)))).filter(B=>!!B),$=V.filter(B=>!!B).find(B=>B.value===G.CaughtError||B.value===G.Return||B.value===G.Break||B.value===G.Continue);return $||(w=[...w,...V],m)}else if(m.value===G.CaughtError||m.value===G.ConditionNotMet){const E=(i.errorCalls||[]).filter(B=>this.hasEntity(B));(i.successCalls||i.calls||[]).forEach(B=>{this.skip(B)});let w=[];const V=(await Promise.all(E.map(B=>this.schedule(B,[],c)))).filter(B=>!!B),$=V.filter(B=>!!B).find(B=>B.value===G.CaughtError||B.value===G.UnhandledError||B.value===G.Return||B.value===G.Break||B.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)&&Rt(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 Lbi(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 as={[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 hN(o){const p=xR(o);if(!p){const n=Ly(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=Ly(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 lLe(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 mN(o){return fx(o)?lLe(o):"Custom trigger"}function Bbi(o){var p;switch(o.type){case d.DefinitionEntity:return hN(o);case d.FunctionDeclaration:return mN(o)}return(p=as[o.type])==null?void 0:p.singular}function Mbi(o){var p;switch(o.type){case d.DefinitionEntity:return hN(o);case d.FunctionDeclaration:return mN(o)}return(p=as[o.type])==null?void 0:p.singular}const TN=4e4,oLe=280,Gbi=300,vN=65,fy=32,Zb=39,dLe=26,uLe=49,EA=44,kbi=35,Hb=52,EN=10,ud=EN*2,bA=38,Wb=90,sC=270,pLe=TN/2+120,cLe=TN/2+180;function fLe(o){let i=fy+EA+bA+EN;const n=[...o.inputs];return n.length&&(i+=ud,n.forEach(()=>{i+=dLe})),{height:i,width:280}}function yLe(o){let i=vN;const n=[];if([d.DefinitionEntity].includes(o.type)){const m=[...o.suggestedProperties||[],...o.properties||[]];m.length&&(i+=ud,m.forEach(v=>{i+=v.static?uLe:Zb}))}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=fLe(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+=Hb)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)?(n.push(...o.outputs||[]),o.throws&&(i+=Hb)):o.type===d.Condition&&(n.push(o.inputs[0]),o.inputs[1]&&n.push(o.inputs[1]));const s=n.length;s&&(i+=s*Zb,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+=EA),o.writesValues.length&&(i+=ud,i+=EA),o.internalCalls.length&&o.usedInternalCalls.forEach(()=>i+=Hb+ud);const m=o.getDataType(null);(!m||m.inferred)&&(i+=bA)}const e=c.length;return e&&(i+=e*Zb,i+=ud),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)&&(i+=bA),{height:i,width:280}}function pv(o){return`${o.split("-").map((n,s)=>s===0?n.charAt(0).toUpperCase()+n.slice(1):n.toLowerCase()).join(" ")}.`}function jbi(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 Ma.UUIDMustBeString:return`UUID must be a string, eg: "${Du()}"`;case Ma.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Du()}"`;case Ma.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 pv(o.code)}}function Ubi(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 Ma.UUIDMustBeString:return"UUID must be a string";case Ma.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case Ma.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 pv(o.code)}}function Kbi(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`${as[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 Ma.UUIDMustBeString:return`${le(o.entity,o.entity.project)} UUID must be a string`;case Ma.UUIDMustNotContainSpaces:return`${le(o.entity,o.entity.project)} UUID must not contain spaces`;case Ma.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: ${pv(o.code)}`}}function Fbi(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`${as[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 Ma.UUIDMustBeString:return`${le(o.entity,o.entity.project)} UUID must be a string, eg: "${Du()}"`;case Ma.UUIDMustNotContainSpaces:return`${le(o.entity,o.entity.project)} UUID must not contain spaces, eg: "${Du()}"`;case Ma.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: ${pv(o.code)}`}}var bN=(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))(bN||{});const Sbi=Object.values(bN);var AN=(o=>(o.NotPartOfOngoingTest="not-part-of-ongoing-test",o.CannotBeAddedToTest="cannot-be-added-to-test",o))(AN||{});const qbi=Object.values(AN);var gN=(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))(gN||{});const Zbi=Object.values(gN);function Hbi(o,p){const i=[...o,...p];return Array.from(new Set(i))}function Wbi(o,p){const i=[...o,...p],n=Array.from(new Set(i));return{hasChanged:n.length!==o.length,reasons:n}}function zbi(o,p){const i=o.filter(s=>!p.includes(s));return{hasChanged:i.length!==o.length,reasons:i}}function Jbi(o,p){return o.find(i=>i.entity.id===p)||null}function j4(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=pLe-sC-oLe,c=cLe-Wb-vN;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=!!OA(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=>!Sp(e).length);this.childEntities=[...n,...s,...c]}else{const i=[],n=[],s=[],c=[],e=[];Zr.includes(this.entity.type)&&PR(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)=>Pc(m,v)?-1:0),c.sort((m,v)=>Pc(m,v)?-1:0),s.sort((m,v)=>AC(m,v)?1:AC(v,m)?-1:0),this.childEntities=[...e,...i,...c,...y,...s,...n]}}calculateCardSize(){const p=yLe(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+Wb,right:p.right+sC}}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=Jbi(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+fy,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-fy;this.shiftDownAlone(n)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((s,c)=>{const e=c.ownEntityArea,y=e.top+fy,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-fy;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 j4(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((n,s)=>[...n,...s.getLowerAreas()],[]);return j4([...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=>OA(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+Wb;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 $m=(o=>(o.Amazon="amazon",o.Google="google",o.Microsoft="microsoft",o))($m||{}),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.CronJob="cron-job",o))(hr||{}),lC=(o=>(o.Post="post",o.Get="get",o.Acknowledgement="acknowledgment",o.Progress="progress",o.Error="error",o.Complete="complete",o))(lC||{}),vc=(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))(vc||{}),oC=(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))(oC||{}),$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 hLe(o){return`project-${o}-http-api`}function iR(o){return`entity-${o}-database`}class mLe{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",vc.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 TLe=(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))(TLe||{});class nf{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 Ybi extends nf{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=iR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class Xbi extends nf{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=iR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class vLe extends nf{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=hLe(this.publicationRun.project.id),this.resourceId}}class ELe extends nf{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=iR((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class bLe extends nf{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 ALe extends nf{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 Qbi{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 ALe(this,$m.Amazon)),this.implicitGlobalResources.set(hr.CloudHostedCodebase,new bLe(this,$m.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 ELe(this,[n],$m.Amazon);this.explicitResources.set(s.resourceId,s)}),p.length){const n=new vLe(this,p,$m.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 mLe(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===lC.Error?(this.finalStatus=oC.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===lC.Complete&&(this.finalStatus=oC.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 cN(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(X.PublicationRun),this.extensionsRegistry}}function eAi(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 tAi(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 gLe=(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))(gLe||{});function iAi(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 rAi(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 nAi(o){switch(o){case vc.Running:return"In progress";case vc.Failed:return"Failed";case vc.Success:return"Succeeded";case vc.Skipped:return"Skipped";case vc.Queued:default:return"Queued"}}function ILe(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=dC(o.name)):o.type===d.DefinitionEntity&&o.implements.forEach(s=>{if(Wi(s,Re.EXTERNAL_INTEGRATION_CONNECTION)){const c=dC(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 aAi(o){return The[o]}function dC(o){return o.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?o.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function RLe(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 sAi(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 lAi(o){return o.type===d.BuiltInBaseEntity||o.type===d.DefinitionEntity?ILe(o):o.type===d.ActionDescriptor||o.type===d.Operation?RLe(o):null}function DLe(o){var s,c,e;if(!Wi(o,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=G4e(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 DLe(o.extends);p=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return p}async function wLe(o,p={}){var y;const i=J.YieldTracker.from(p),s=[...ea(o),...Rs(o),...IN(o),...ta(o),...RN(o)],c=Cv(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 OLe(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),...Rs(o),...IN(o),...ta(o),...RN(o)],n=Cv(o);return i.push(...n),Lt(o.errors,i)}function IN(o,p){const n=[...o.project.getVariableDeclarations()].filter(s=>s.id!==o.id);return Vv(o,[Hi],n,p)}function RN(o){const p=[];if(o.parent!==o.project)return p;if(o.catchesError){const i=Ot({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotCatchError}`,message:`${as[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:`${as[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:`${as[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 oAi=Object.freeze(Object.defineProperty({__proto__:null,validate:OLe,validateAsync:wLe,validateGlobalVariableDeclaration:RN,validateVariableDeclarationName:IN},Symbol.toStringTag,{value:"Module"}));async function CLe(o,p={}){const i=J.YieldTracker.from(p),s=[...ea(o),...Rs(o),...ta(o)],c=Cv(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 _Le(o){o.inputs.forEach(s=>s.validate()),o.outputs.forEach(s=>s.validate()),o.internalCalls.forEach(s=>s.validate());const i=[...ea(o),...Rs(o),...ta(o)],n=Cv(o);return i.push(...n),Lt(o.errors,i)}function dAi(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 uAi=Object.freeze(Object.defineProperty({__proto__:null,validate:_Le,validateAsync:CLe,validateConstantValueOverride:dAi},Symbol.toStringTag,{value:"Module"}));var DN=(o=>(o.Parent="parent",o.DataTypeEntity="data-type-entity",o.VarDeclaration="var-declaration",o))(DN||{});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=lf(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 Pe;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||(Pe=this.declaration.dataType)!=null&&Pe.inferred){const{added:Me,updated:Se,removed:je,affected:Ze}=this.declaration.inferDataTypeAndSyncInstancesInputsAndOutputs(i);s.push(...Me),n.push(...Se),c.push(...je),e.push(...Ze)}if(this.readsValue&&this.defaultValue&&(this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)||this.defaultValue.remove({ignoreUpstream:!1},i),this.setDefaultValue(null,i)),this.defaultValue&&!this.readsValue&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.id)&&this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)){const Me=this.defaultValue.clone(i,this);this.setDefaultValue(Me,i)}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:B,updated:j,removed:F,affected:K}=this.generateUnusedInternalCalls(i);s.push(...B),n.push(...j),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((Me,Se)=>{var je,Ze;return(Me.index??((je=Me.declaration)==null?void 0:je.index))-(Se.index??((Ze=Se.declaration)==null?void 0:Ze.index))}),this.outputs.sort((Me,Se)=>{var je,Ze;return(Me.index??((je=Me.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 Pv.initWritesValues(this,this.parent),of.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=_Le(this),{success:!0}}async validateAsync(i={}){const n=J.YieldTracker.from(i);return this.errors=await CLe(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 $,B,j,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=(B=this.inputs)==null?void 0:B.map(K=>K.clone(i,v,x.UUID.uuid(),c));v.inputs=b;const w=(j=this.outputs)==null?void 0:j.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(B=>le(B,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 $,B,j,F,K;return((($=w.declaration)==null?void 0:$.id)||((j=(B=w.initialData)==null?void 0:B.declaration)==null?void 0:j.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=Nc(w.declaration),$=Nc(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 Gu=mi;var VLe=(o=>(o.Parent="variable-declaration-parent",o.DataTypeEntity="variable-declaration-data-type-entity",o.DataType="variable-declaration-data-type",o))(VLe||{});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=PP(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===DN.VarDeclaration&&!i.includes(n.entity)&&i.push(n.entity)}),i}validateGeneratedUpdate(i){const n=[];let s=JSON.parse(JSON.stringify(i));const c=lf(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.js
CHANGED
|
@@ -124468,7 +124468,7 @@ class Vn {
|
|
|
124468
124468
|
}), p(i);
|
|
124469
124469
|
}
|
|
124470
124470
|
}
|
|
124471
|
-
var dm = /* @__PURE__ */ ((o) => (o.Amazon = "amazon", o.Google = "google", o.Microsoft = "microsoft", o))(dm || {}), yr = /* @__PURE__ */ ((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))(yr || {}), GD = /* @__PURE__ */ ((o) => (o.Post = "post", o.Get = "get", o.Acknowledgement = "acknowledgment", o.Progress = "progress", o.Error = "error", o.Complete = "complete", o))(GD || {}), Sp = /* @__PURE__ */ ((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))(Sp || {}), MD = /* @__PURE__ */ ((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))(MD || {}), $t = /* @__PURE__ */ ((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 || {}), yl = /* @__PURE__ */ ((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))(yl || {});
|
|
124471
|
+
var dm = /* @__PURE__ */ ((o) => (o.Amazon = "amazon", o.Google = "google", o.Microsoft = "microsoft", o))(dm || {}), yr = /* @__PURE__ */ ((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.CronJob = "cron-job", o))(yr || {}), GD = /* @__PURE__ */ ((o) => (o.Post = "post", o.Get = "get", o.Acknowledgement = "acknowledgment", o.Progress = "progress", o.Error = "error", o.Complete = "complete", o))(GD || {}), Sp = /* @__PURE__ */ ((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))(Sp || {}), MD = /* @__PURE__ */ ((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))(MD || {}), $t = /* @__PURE__ */ ((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 || {}), yl = /* @__PURE__ */ ((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))(yl || {});
|
|
124472
124472
|
yr.CloudHostedCodebase, yr.HttpApi, yr.RelationalDatabase, yr.CloudHostedCodebase, yr.CloudHostedCodebase, yr.RelationalDatabase, yr.CloudHostedCodebase, yr.CloudHostedCodebase;
|
|
124473
124473
|
function S0i(o) {
|
|
124474
124474
|
return `project-${o}-http-api`;
|
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.6759",
|
|
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",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"module": "./dist/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
|
-
".": {
|
|
12
|
+
".": {
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js",
|
|
15
15
|
"require": "./dist/index.cjs"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"gen:aggregate-definitions": "tsx --tsconfig tsconfig.scripts.json scripts/gen-aggregate-definitions/command.ts"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@elyx-code/definitions": "^0.0.
|
|
31
|
+
"@elyx-code/definitions": "^0.0.7996",
|
|
32
32
|
"axios": "^1.9.0",
|
|
33
33
|
"dayjs": "^1.11.13",
|
|
34
34
|
"sql-parser-cst": "^0.33.1",
|