@elyx-code/project-logic-tree 0.0.6906 → 0.0.6908

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 CHANGED
@@ -51,7 +51,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
51
51
  `)}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 r=new this(p);return i.forEach(a=>r.set(a)),r}static accessor(p){const r=(this[zk]=this[zk]={accessors:{}}).accessors,a=this.prototype;function c(e){const f=F0(e);r[f]||(KRi(a,e),r[f]=!0)}return qe.isArray(p)?p.forEach(c):c(p),this}}I1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);qe.reduceDescriptors(I1.prototype,({value:s},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>s,set(r){this[i]=r}}});qe.freezeMethods(I1);const ao=I1;function e_(s,p){const i=this||l$,r=p||i,a=ao.from(r.headers);let c=r.data;return qe.forEach(s,function(f){c=f.call(i,c,a.normalize(),p?p.status:void 0)}),a.normalize(),c}function K2e(s){return!!(s&&s.__CANCEL__)}class qRi extends ir{constructor(p,i,r){super(p??"canceled",ir.ERR_CANCELED,i,r),this.name="CanceledError",this.__CANCEL__=!0}}const wE=qRi;function q2e(s,p,i){const r=i.config.validateStatus;!i.status||!r||r(i.status)?s(i):p(new ir("Request failed with status code "+i.status,[ir.ERR_BAD_REQUEST,ir.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function SRi(s){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(s);return p&&p[1]||""}function ZRi(s,p){s=s||10;const i=new Array(s),r=new Array(s);let a=0,c=0,e;return p=p!==void 0?p:1e3,function(h){const m=Date.now(),E=r[c];e||(e=m),i[a]=h,r[a]=m;let b=c,A=0;for(;b!==a;)A+=i[b++],b=b%s;if(a=(a+1)%s,a===c&&(c=(c+1)%s),m-e<p)return;const _=E&&m-E;return _?Math.round(A*1e3/_):void 0}}function HRi(s,p){let i=0,r=1e3/p,a,c;const e=(m,E=Date.now())=>{i=E,a=null,c&&(clearTimeout(c),c=null),s(...m)};return[(...m)=>{const E=Date.now(),b=E-i;b>=r?e(m,E):(a=m,c||(c=setTimeout(()=>{c=null,e(a)},r-b)))},()=>a&&e(a)]}const xg=(s,p,i=3)=>{let r=0;const a=ZRi(50,250);return HRi(c=>{const e=c.loaded,f=c.lengthComputable?c.total:void 0,h=e-r,m=a(h),E=e<=f;r=e;const b={loaded:e,total:f,progress:f?e/f:void 0,bytes:h,rate:m||void 0,estimated:m&&f&&E?(f-e)/m:void 0,event:c,lengthComputable:f!=null,[p?"download":"upload"]:!0};s(b)},i)},Yk=(s,p)=>{const i=s!=null;return[r=>p[0]({lengthComputable:i,total:s,loaded:r}),p[1]]},Jk=s=>(...p)=>qe.asap(()=>s(...p)),WRi=Ra.hasStandardBrowserEnv?((s,p)=>i=>(i=new URL(i,Ra.origin),s.protocol===i.protocol&&s.host===i.host&&(p||s.port===i.port)))(new URL(Ra.origin),Ra.navigator&&/(msie|trident)/i.test(Ra.navigator.userAgent)):()=>!0,zRi=Ra.hasStandardBrowserEnv?{write(s,p,i,r,a,c,e){if(typeof document>"u")return;const f=[`${s}=${encodeURIComponent(p)}`];qe.isNumber(i)&&f.push(`expires=${new Date(i).toUTCString()}`),qe.isString(r)&&f.push(`path=${r}`),qe.isString(a)&&f.push(`domain=${a}`),c===!0&&f.push("secure"),qe.isString(e)&&f.push(`SameSite=${e}`),document.cookie=f.join("; ")},read(s){if(typeof document>"u")return null;const p=document.cookie.match(new RegExp("(?:^|; )"+s+"=([^;]*)"));return p?decodeURIComponent(p[1]):null},remove(s){this.write(s,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function YRi(s){return typeof s!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s)}function JRi(s,p){return p?s.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):s}function S2e(s,p,i){let r=!YRi(p);return s&&(r||i==!1)?JRi(s,p):p}const Qk=s=>s instanceof ao?{...s}:s;function Df(s,p){p=p||{};const i={};function r(m,E,b,A){return qe.isPlainObject(m)&&qe.isPlainObject(E)?qe.merge.call({caseless:A},m,E):qe.isPlainObject(E)?qe.merge({},E):qe.isArray(E)?E.slice():E}function a(m,E,b,A){if(qe.isUndefined(E)){if(!qe.isUndefined(m))return r(void 0,m,b,A)}else return r(m,E,b,A)}function c(m,E){if(!qe.isUndefined(E))return r(void 0,E)}function e(m,E){if(qe.isUndefined(E)){if(!qe.isUndefined(m))return r(void 0,m)}else return r(void 0,E)}function f(m,E,b){if(b in p)return r(m,E);if(b in s)return r(void 0,m)}const h={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:f,headers:(m,E,b)=>a(Qk(m),Qk(E),b,!0)};return qe.forEach(Object.keys({...s,...p}),function(E){if(E==="__proto__"||E==="constructor"||E==="prototype")return;const b=qe.hasOwnProp(h,E)?h[E]:a,A=b(s[E],p[E],E);qe.isUndefined(A)&&b!==f||(i[E]=A)}),i}const Z2e=s=>{const p=Df({},s);let{data:i,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:c,headers:e,auth:f}=p;if(p.headers=e=ao.from(e),p.url=U2e(S2e(p.baseURL,p.url,p.allowAbsoluteUrls),s.params,s.paramsSerializer),f&&e.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),qe.isFormData(i)){if(Ra.hasStandardBrowserEnv||Ra.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if(qe.isFunction(i.getHeaders)){const h=i.getHeaders(),m=["content-type","content-length"];Object.entries(h).forEach(([E,b])=>{m.includes(E.toLowerCase())&&e.set(E,b)})}}if(Ra.hasStandardBrowserEnv&&(r&&qe.isFunction(r)&&(r=r(p)),r||r!==!1&&WRi(p.url))){const h=a&&c&&zRi.read(c);h&&e.set(a,h)}return p},QRi=typeof XMLHttpRequest<"u",XRi=QRi&&function(s){return new Promise(function(i,r){const a=Z2e(s);let c=a.data;const e=ao.from(a.headers).normalize();let{responseType:f,onUploadProgress:h,onDownloadProgress:m}=a,E,b,A,_,P;function V(){_&&_(),P&&P(),a.cancelToken&&a.cancelToken.unsubscribe(E),a.signal&&a.signal.removeEventListener("abort",E)}let j=new XMLHttpRequest;j.open(a.method.toUpperCase(),a.url,!0),j.timeout=a.timeout;function M(){if(!j)return;const K=ao.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),ee={data:!f||f==="text"||f==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:K,config:s,request:j};q2e(function(ie){i(ie),V()},function(ie){r(ie),V()},ee),j=null}"onloadend"in j?j.onloadend=M:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(M)},j.onabort=function(){j&&(r(new ir("Request aborted",ir.ECONNABORTED,s,j)),j=null)},j.onerror=function(ne){const ee=ne&&ne.message?ne.message:"Network Error",oe=new ir(ee,ir.ERR_NETWORK,s,j);oe.event=ne||null,r(oe),j=null},j.ontimeout=function(){let ne=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const ee=a.transitional||n$;a.timeoutErrorMessage&&(ne=a.timeoutErrorMessage),r(new ir(ne,ee.clarifyTimeoutError?ir.ETIMEDOUT:ir.ECONNABORTED,s,j)),j=null},c===void 0&&e.setContentType(null),"setRequestHeader"in j&&qe.forEach(e.toJSON(),function(ne,ee){j.setRequestHeader(ee,ne)}),qe.isUndefined(a.withCredentials)||(j.withCredentials=!!a.withCredentials),f&&f!=="json"&&(j.responseType=a.responseType),m&&([A,P]=xg(m,!0),j.addEventListener("progress",A)),h&&j.upload&&([b,_]=xg(h),j.upload.addEventListener("progress",b),j.upload.addEventListener("loadend",_)),(a.cancelToken||a.signal)&&(E=K=>{j&&(r(!K||K.type?new wE(null,s,j):K),j.abort(),j=null)},a.cancelToken&&a.cancelToken.subscribe(E),a.signal&&(a.signal.aborted?E():a.signal.addEventListener("abort",E)));const G=SRi(a.url);if(G&&Ra.protocols.indexOf(G)===-1){r(new ir("Unsupported protocol "+G+":",ir.ERR_BAD_REQUEST,s));return}j.send(c||null)})},e1i=(s,p)=>{const{length:i}=s=s?s.filter(Boolean):[];if(p||i){let r=new AbortController,a;const c=function(m){if(!a){a=!0,f();const E=m instanceof Error?m:this.reason;r.abort(E instanceof ir?E:new wE(E instanceof Error?E.message:E))}};let e=p&&setTimeout(()=>{e=null,c(new ir(`timeout of ${p}ms exceeded`,ir.ETIMEDOUT))},p);const f=()=>{s&&(e&&clearTimeout(e),e=null,s.forEach(m=>{m.unsubscribe?m.unsubscribe(c):m.removeEventListener("abort",c)}),s=null)};s.forEach(m=>m.addEventListener("abort",c));const{signal:h}=r;return h.unsubscribe=()=>qe.asap(f),h}},t1i=e1i,i1i=function*(s,p){let i=s.byteLength;if(!p||i<p){yield s;return}let r=0,a;for(;r<i;)a=r+p,yield s.slice(r,a),r=a},r1i=async function*(s,p){for await(const i of n1i(s))yield*i1i(i,p)},n1i=async function*(s){if(s[Symbol.asyncIterator]){yield*s;return}const p=s.getReader();try{for(;;){const{done:i,value:r}=await p.read();if(i)break;yield r}}finally{await p.cancel()}},Xk=(s,p,i,r)=>{const a=r1i(s,p);let c=0,e,f=h=>{e||(e=!0,r&&r(h))};return new ReadableStream({async pull(h){try{const{done:m,value:E}=await a.next();if(m){f(),h.close();return}let b=E.byteLength;if(i){let A=c+=b;i(A)}h.enqueue(new Uint8Array(E))}catch(m){throw f(m),m}},cancel(h){return f(h),a.return()}},{highWaterMark:2})},eU=64*1024,{isFunction:ig}=qe,a1i=(({Request:s,Response:p})=>({Request:s,Response:p}))(qe.global),{ReadableStream:tU,TextEncoder:iU}=qe.global,rU=(s,...p)=>{try{return!!s(...p)}catch{return!1}},s1i=s=>{s=qe.merge.call({skipUndefined:!0},a1i,s);const{fetch:p,Request:i,Response:r}=s,a=p?ig(p):typeof fetch=="function",c=ig(i),e=ig(r);if(!a)return!1;const f=a&&ig(tU),h=a&&(typeof iU=="function"?(P=>V=>P.encode(V))(new iU):async P=>new Uint8Array(await new i(P).arrayBuffer())),m=c&&f&&rU(()=>{let P=!1;const V=new i(Ra.origin,{body:new tU,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!V}),E=e&&f&&rU(()=>qe.isReadableStream(new r("").body)),b={stream:E&&(P=>P.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(P=>{!b[P]&&(b[P]=(V,j)=>{let M=V&&V[P];if(M)return M.call(V);throw new ir(`Response type '${P}' is not supported`,ir.ERR_NOT_SUPPORT,j)})});const A=async P=>{if(P==null)return 0;if(qe.isBlob(P))return P.size;if(qe.isSpecCompliantForm(P))return(await new i(Ra.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if(qe.isArrayBufferView(P)||qe.isArrayBuffer(P))return P.byteLength;if(qe.isURLSearchParams(P)&&(P=P+""),qe.isString(P))return(await h(P)).byteLength},_=async(P,V)=>{const j=qe.toFiniteNumber(P.getContentLength());return j??A(V)};return async P=>{let{url:V,method:j,data:M,signal:G,cancelToken:K,timeout:ne,onDownloadProgress:ee,onUploadProgress:oe,responseType:ie,headers:se,withCredentials:ue="same-origin",fetchOptions:z}=Z2e(P),X=p||fetch;ie=ie?(ie+"").toLowerCase():"text";let pe=t1i([G,K&&K.toAbortSignal()],ne),le=null;const me=pe&&pe.unsubscribe&&(()=>{pe.unsubscribe()});let ve;try{if(oe&&m&&j!=="get"&&j!=="head"&&(ve=await _(se,M))!==0){let Je=new i(V,{method:"POST",body:M,duplex:"half"}),Ze;if(qe.isFormData(M)&&(Ze=Je.headers.get("content-type"))&&se.setContentType(Ze),Je.body){const[et,Dt]=Yk(ve,xg(Jk(oe)));M=Xk(Je.body,eU,et,Dt)}}qe.isString(ue)||(ue=ue?"include":"omit");const we=c&&"credentials"in i.prototype,Re={...z,signal:pe,method:j.toUpperCase(),headers:se.normalize().toJSON(),body:M,duplex:"half",credentials:we?ue:void 0};le=c&&new i(V,Re);let xe=await(c?X(le,z):X(V,Re));const je=E&&(ie==="stream"||ie==="response");if(E&&(ee||je&&me)){const Je={};["status","statusText","headers"].forEach(jt=>{Je[jt]=xe[jt]});const Ze=qe.toFiniteNumber(xe.headers.get("content-length")),[et,Dt]=ee&&Yk(Ze,xg(Jk(ee),!0))||[];xe=new r(Xk(xe.body,eU,et,()=>{Dt&&Dt(),me&&me()}),Je)}ie=ie||"text";let Se=await b[qe.findKey(b,ie)||"text"](xe,P);return!je&&me&&me(),await new Promise((Je,Ze)=>{q2e(Je,Ze,{data:Se,headers:ao.from(xe.headers),status:xe.status,statusText:xe.statusText,config:P,request:le})})}catch(we){throw me&&me(),we&&we.name==="TypeError"&&/Load failed|fetch/i.test(we.message)?Object.assign(new ir("Network Error",ir.ERR_NETWORK,P,le,we&&we.response),{cause:we.cause||we}):ir.from(we,we&&we.code,P,le,we&&we.response)}}},l1i=new Map,H2e=s=>{let p=s&&s.env||{};const{fetch:i,Request:r,Response:a}=p,c=[r,a,i];let e=c.length,f=e,h,m,E=l1i;for(;f--;)h=c[f],m=E.get(h),m===void 0&&E.set(h,m=f?new Map:s1i(p)),E=m;return m};H2e();const o$={http:ARi,xhr:XRi,fetch:{get:H2e}};qe.forEach(o$,(s,p)=>{if(s){try{Object.defineProperty(s,"name",{value:p})}catch{}Object.defineProperty(s,"adapterName",{value:p})}});const nU=s=>`- ${s}`,o1i=s=>qe.isFunction(s)||s===null||s===!1;function d1i(s,p){s=qe.isArray(s)?s:[s];const{length:i}=s;let r,a;const c={};for(let e=0;e<i;e++){r=s[e];let f;if(a=r,!o1i(r)&&(a=o$[(f=String(r)).toLowerCase()],a===void 0))throw new ir(`Unknown adapter '${f}'`);if(a&&(qe.isFunction(a)||(a=a.get(p))))break;c[f||"#"+e]=a}if(!a){const e=Object.entries(c).map(([h,m])=>`adapter ${h} `+(m===!1?"is not supported by the environment":"is not available in the build"));let f=i?e.length>1?`since :
52
52
  `+e.map(nU).join(`
53
53
  `):" "+nU(e[0]):"as no adapter specified";throw new ir("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return a}const W2e={getAdapter:d1i,adapters:o$};function t_(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new wE(null,s)}function aU(s){return t_(s),s.headers=ao.from(s.headers),s.data=e_.call(s,s.transformRequest),["post","put","patch"].indexOf(s.method)!==-1&&s.headers.setContentType("application/x-www-form-urlencoded",!1),W2e.getAdapter(s.adapter||l$.adapter,s)(s).then(function(r){return t_(s),r.data=e_.call(s,s.transformResponse,r),r.headers=ao.from(r.headers),r},function(r){return K2e(r)||(t_(s),r&&r.response&&(r.response.data=e_.call(s,s.transformResponse,r.response),r.response.headers=ao.from(r.response.headers))),Promise.reject(r)})}const z2e="1.13.6",R1={};["object","boolean","number","function","string","symbol"].forEach((s,p)=>{R1[s]=function(r){return typeof r===s||"a"+(p<1?"n ":" ")+s}});const sU={};R1.transitional=function(p,i,r){function a(c,e){return"[Axios v"+z2e+"] Transitional option '"+c+"'"+e+(r?". "+r:"")}return(c,e,f)=>{if(p===!1)throw new ir(a(e," has been removed"+(i?" in "+i:"")),ir.ERR_DEPRECATED);return i&&!sU[e]&&(sU[e]=!0,console.warn(a(e," has been deprecated since v"+i+" and will be removed in the near future"))),p?p(c,e,f):!0}};R1.spelling=function(p){return(i,r)=>(console.warn(`${r} is likely a misspelling of ${p}`),!0)};function u1i(s,p,i){if(typeof s!="object")throw new ir("options must be an object",ir.ERR_BAD_OPTION_VALUE);const r=Object.keys(s);let a=r.length;for(;a-- >0;){const c=r[a],e=p[c];if(e){const f=s[c],h=f===void 0||e(f,c,s);if(h!==!0)throw new ir("option "+c+" must be "+h,ir.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new ir("Unknown option "+c,ir.ERR_BAD_OPTION)}}const cg={assertOptions:u1i,validators:R1},yl=cg.validators;class $g{constructor(p){this.defaults=p||{},this.interceptors={request:new Wk,response:new Wk}}async request(p,i){try{return await this._request(p,i)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const c=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?c&&!String(r.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(r.stack+=`
54
- `+c):r.stack=c}catch{}}throw r}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=Df(this.defaults,i);const{transitional:r,paramsSerializer:a,headers:c}=i;r!==void 0&&cg.assertOptions(r,{silentJSONParsing:yl.transitional(yl.boolean),forcedJSONParsing:yl.transitional(yl.boolean),clarifyTimeoutError:yl.transitional(yl.boolean),legacyInterceptorReqResOrdering:yl.transitional(yl.boolean)},!1),a!=null&&(qe.isFunction(a)?i.paramsSerializer={serialize:a}:cg.assertOptions(a,{encode:yl.function,serialize:yl.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),cg.assertOptions(i,{baseUrl:yl.spelling("baseURL"),withXsrfToken:yl.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&qe.merge(c.common,c[i.method]);c&&qe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete c[P]}),i.headers=ao.concat(e,c);const f=[];let h=!0;this.interceptors.request.forEach(function(V){if(typeof V.runWhen=="function"&&V.runWhen(i)===!1)return;h=h&&V.synchronous;const j=i.transitional||n$;j&&j.legacyInterceptorReqResOrdering?f.unshift(V.fulfilled,V.rejected):f.push(V.fulfilled,V.rejected)});const m=[];this.interceptors.response.forEach(function(V){m.push(V.fulfilled,V.rejected)});let E,b=0,A;if(!h){const P=[aU.bind(this),void 0];for(P.unshift(...f),P.push(...m),A=P.length,E=Promise.resolve(i);b<A;)E=E.then(P[b++],P[b++]);return E}A=f.length;let _=i;for(;b<A;){const P=f[b++],V=f[b++];try{_=P(_)}catch(j){V.call(this,j);break}}try{E=aU.call(this,_)}catch(P){return Promise.reject(P)}for(b=0,A=m.length;b<A;)E=E.then(m[b++],m[b++]);return E}getUri(p){p=Df(this.defaults,p);const i=S2e(p.baseURL,p.url,p.allowAbsoluteUrls);return U2e(i,p.params,p.paramsSerializer)}}qe.forEach(["delete","get","head","options"],function(p){$g.prototype[p]=function(i,r){return this.request(Df(r||{},{method:p,url:i,data:(r||{}).data}))}});qe.forEach(["post","put","patch"],function(p){function i(r){return function(c,e,f){return this.request(Df(f||{},{method:p,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}$g.prototype[p]=i(),$g.prototype[p+"Form"]=i(!0)});const fg=$g;class d${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 r=this;this.promise.then(a=>{if(!r._listeners)return;let c=r._listeners.length;for(;c-- >0;)r._listeners[c](a);r._listeners=null}),this.promise.then=a=>{let c;const e=new Promise(f=>{r.subscribe(f),c=f}).then(a);return e.cancel=function(){r.unsubscribe(c)},e},p(function(c,e,f){r.reason||(r.reason=new wE(c,e,f),i(r.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=r=>{p.abort(r)};return this.subscribe(i),p.signal.unsubscribe=()=>this.unsubscribe(i),p.signal}static source(){let p;return{token:new d$(function(a){p=a}),cancel:p}}}const p1i=d$;function c1i(s){return function(i){return s.apply(null,i)}}function f1i(s){return qe.isObject(s)&&s.isAxiosError===!0}const F_={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(F_).forEach(([s,p])=>{F_[p]=s});const y1i=F_;function Y2e(s){const p=new fg(s),i=P2e(fg.prototype.request,p);return qe.extend(i,fg.prototype,p,{allOwnKeys:!0}),qe.extend(i,p,null,{allOwnKeys:!0}),i.create=function(a){return Y2e(Df(s,a))},i}const Fn=Y2e(l$);Fn.Axios=fg;Fn.CanceledError=wE;Fn.CancelToken=p1i;Fn.isCancel=K2e;Fn.VERSION=z2e;Fn.toFormData=g1;Fn.AxiosError=ir;Fn.Cancel=Fn.CanceledError;Fn.all=function(p){return Promise.all(p)};Fn.spread=c1i;Fn.isAxiosError=f1i;Fn.mergeConfig=Df;Fn.AxiosHeaders=ao;Fn.formToJSON=s=>F2e(qe.isHTMLForm(s)?new FormData(s):s);Fn.getAdapter=W2e.getAdapter;Fn.HttpStatusCode=y1i;Fn.default=Fn;const J2e=Fn;class Q2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Tn.HttpRequest);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h;try{const m=r.find(ee=>{var oe,ie;return((ie=(oe=ee.valueOwner)==null?void 0:oe.declaration)==null?void 0:ie.id)===re.operation[Tn.HttpRequest].inputs.method.id}),E=((a=m==null?void 0:m.value)==null?void 0:a.value)||"",b=r.find(ee=>{var oe,ie;return((ie=(oe=ee.valueOwner)==null?void 0:oe.declaration)==null?void 0:ie.id)===re.operation[Tn.HttpRequest].inputs.url.id}),A=((c=b==null?void 0:b.value)==null?void 0:c.value)||"",_=r.find(ee=>{var oe,ie;return((ie=(oe=ee.valueOwner)==null?void 0:oe.declaration)==null?void 0:ie.id)===re.operation[Tn.HttpRequest].inputs.query.id}),P=((e=_==null?void 0:_.value)==null?void 0:e.value)||"",V=r.find(ee=>{var oe,ie;return((ie=(oe=ee.valueOwner)==null?void 0:oe.declaration)==null?void 0:ie.id)===re.operation[Tn.HttpRequest].inputs.body.id}),j=((f=V==null?void 0:V.value)==null?void 0:f.value)||"",M=r.find(ee=>{var oe,ie;return((ie=(oe=ee.valueOwner)==null?void 0:oe.declaration)==null?void 0:ie.id)===re.operation[Tn.HttpRequest].inputs.headers.id}),G=((h=M==null?void 0:M.value)==null?void 0:h.value)||"",K={method:E,url:A,params:P,headers:G,data:j};Y.Logger.log("Axios request config: ",K);const ne=await J2e(K);return{value:U.Success,error:null,result:{status:ne.status,headers:ne.headers,data:ne.data}}}catch(m){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:m,result:null}}}})}}class X2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SQL,version:"1.0.0",description:"Execute SQL operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(no.ExecuteSQL);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e;try{const f=r.find(_=>{var P,V;return((V=(P=_.valueOwner)==null?void 0:P.declaration)==null?void 0:V.id)===re.operation[no.ExecuteSQL].inputs.connectionConfig.id}),h=((a=f==null?void 0:f.value)==null?void 0:a.value)||"",m=r.find(_=>{var P,V;return((V=(P=_.valueOwner)==null?void 0:P.declaration)==null?void 0:V.id)===re.operation[no.ExecuteSQL].inputs.query.id}),E=((c=m==null?void 0:m.value)==null?void 0:c.value)||"",b=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0],A=await J2e.post(((e=b.env)==null?void 0:e.API_BASE_URL)+"/editor-runtime/v1/execute-sql",{connectionConfig:h,query:E},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await b.getAccessToken()}`}});return{value:U.Success,error:null,result:{results:A.data.results||[]}}}catch(f){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:f,result:null}}}})}}class eBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.Validate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)});Y.Logger.log("Inputs for entity validation: ",a);const e=hD(a[1]).safeParse(a[0]);return e.success?{value:U.Success,error:null,result:{data:a[0]}}:{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:e.error.errors,result:null}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}const Ya=s=>s.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class tBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.ReadKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ya(r),e=wVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class iBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=CVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class rBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.DeleteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ya(r),e=OVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class nBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.ReadNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=_Ve(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class aBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.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:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=VVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class sBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.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:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteSafeNestedKeyRecursively);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=PVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class lBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.DeleteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ya(r),e=NVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class oBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.HasKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ya(r),e=xVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class dBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.KeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=$Ve(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class uBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.HasNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ya(r),e=LVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class pBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.NestedKeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=BVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class cBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.IsInstanceOfType);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m,E,b,A,_;try{const P=((c=(a=r[0])==null?void 0:a.value)==null?void 0:c.parent)||((f=(e=r[0])==null?void 0:e.value)==null?void 0:f.standaloneParent),V=(m=(h=r[0])==null?void 0:h.value)==null?void 0:m.value,j=(b=(E=r[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!V)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!j)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!P)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 M=P.getDataType(null);if(((A=M==null?void 0:M.entity)==null?void 0:A.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let G=!1;return((_=M==null?void 0:M.entity)==null?void 0:_.id)!==(j==null?void 0:j.id)?G=!1:hD(M==null?void 0:M.entity).safeParse(V).success?G=!0:G=!1,{value:U.Success,error:null,result:G}}catch(P){return{value:U.UnhandledError,error:P,result:null}}}})}}class fBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Merge);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ya(r),c=MVe(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class yBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Keys);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ya(r),c=GVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class hBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Values);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ya(r),c=jVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class mBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Entries);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ya(r),c=kVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}let js=null;try{js=require("crypto")}catch{}const qT=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:js&&js.webcrypto?js.webcrypto:null,Ep=qT?qT.subtle:null;function iv(s){const p=new ArrayBuffer(s.byteLength);return new Uint8Array(p).set(s),p}function fn(s,p="utf8"){if(s instanceof Uint8Array)return s;const i=String(s);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 r=i.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(r,"base64"));const a=typeof atob=="function"?atob(r):"",c=new Uint8Array(a.length);for(let e=0;e<a.length;e++)c[e]=a.charCodeAt(e);return c}throw new Error(`Unsupported environment/encoding combo for toBytes(${p})`)}function ko(s,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(s);if(typeof Buffer<"u")return Buffer.from(s).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(s).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(s).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(s).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const TBe=s=>fn(s,"base64"),vBe=(s,p)=>{const i=s instanceof Uint8Array?s:fn(String(s),p||"utf8");return ko(i,"base64")},wh=(s,p)=>{const i=s instanceof Uint8Array?s:fn(String(s),p||"utf8");return ko(i,"base64url")},wf=s=>fn(s,"base64url"),EBe=(s,p)=>{const i=s instanceof Uint8Array?s:fn(String(s),p||"utf8");return ko(i,"hex")},bBe=s=>fn(s,"hex");function u$(s){if(qT&&qT.getRandomValues){const p=new Uint8Array(s);return qT.getRandomValues(p),p}if(js&&js.randomBytes)return new Uint8Array(js.randomBytes(s));throw new Error("Secure random not available")}function D1(s,p){if(!(s instanceof Uint8Array)||!(p instanceof Uint8Array)||s.length!==p.length)return!1;let i=0;for(let r=0;r<s.length;r++)i|=s[r]^p[r];return i===0}function ABe(s,p,i,r){if((typeof s!="string"||typeof p!="string")&&typeof s!="string"&&typeof p!="string")throw new Error("Invalid input types");const a=i??"utf8",c=r??"utf8",e=fn(s??"",a),f=fn(p??"",c);return D1(e,f)}async function gBe(s,p){if(Ep){const i=await Ep.digest({name:s},iv(p));return new Uint8Array(i)}if(js){const i=s.replace("SHA-","sha"),r=js.createHash(i);return r.update(Buffer.from(p)),new Uint8Array(r.digest())}throw new Error("Hash not available")}async function IBe(s,p,i,r){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const a=String(s??"SHA-256"),c=i??"utf8",e=r??"base64url",f=fn(p??"",c),h=await gBe(a,f);return ko(h,e)}async function w1(s,p,i){if(Ep){const r=await Ep.importKey("raw",iv(p),{name:"HMAC",hash:{name:s}},!1,["sign"]),a=await Ep.sign("HMAC",r,iv(i));return new Uint8Array(a)}if(js){const r=`sha${s.split("-")[1]}`,a=js.createHmac(r,Buffer.from(p));return a.update(Buffer.from(i)),new Uint8Array(a.digest())}throw new Error("HMAC not available")}async function RBe(s,p,i,r,a,c){if(typeof s!="string"||typeof p!="string")throw new Error("Invalid input types for key or data; expected strings");const e=String(i??"SHA-256"),f=r??"utf8",h=a??"utf8",m=c??"base64url",E=fn(s??"",f),b=fn(p??"",h),A=await w1(e,E,b);return ko(A,m)}async function C1(s,p,{iterations:i,length:r,hashAlg:a="SHA-256"}){if(Ep){const c=await Ep.importKey("raw",iv(s),"PBKDF2",!1,["deriveBits"]),e=await Ep.deriveBits({name:"PBKDF2",salt:iv(p),iterations:i,hash:a},c,r*8);return new Uint8Array(e)}if(js){const c=a==="SHA-512"?"sha512":"sha256";return await new Promise((e,f)=>{js.pbkdf2(Buffer.from(s),Buffer.from(p),i,r,c,(h,m)=>{h?f(h):e(new Uint8Array(m))})})}throw new Error("PBKDF2 not available")}async function DBe(s,p,i,r,a,c,e,f){if(typeof s!="string"||typeof p!="string")throw new Error("Invalid input types for password or salt; expected strings");const h=c??"utf8",m=e??"utf8",E=f??"base64url",b=Math.max(1,Number(i)||21e4),A=Math.max(1,Number(r)||32),_=a??"SHA-256",P=fn(s??"",h),V=fn(p??"",m),j=await C1(P,V,{iterations:b,length:A,hashAlg:_});return ko(j,E)}async function wBe(s,p=u$(16),i=21e4,r=32,a="SHA-256"){const c=fn(s,"utf8"),e=await C1(c,p,{iterations:i,length:r,hashAlg:a}),f=wh(p),h=wh(e);return`pbkdf2$${a.toLowerCase()}$${i}$${f}$${h}`}async function CBe(s,p){const i=String(p).split("$");if(i.length!==5||i[0]!=="pbkdf2")return!1;const r=i[1].toLowerCase(),a=parseInt(i[2],10),c=wf(i[3]),e=wf(i[4]),f=r.includes("512")?"SHA-512":"SHA-256",h=await C1(fn(s,"utf8"),c,{iterations:a,length:e.length,hashAlg:f});return D1(h,e)}async function OBe(s,p,i,r,a,c){const e=p!=null?Math.max(1,Number(p)||0):void 0,f=i!=null?Math.max(1,Number(i)||0):void 0,h=r??void 0,m=c??"base64url",E=a!=null?fn(a,m):void 0;return await wBe(String(s??""),E,e,f,h)}function lU(s){return wh(fn(JSON.stringify(s),"utf8"))}function Lg(s){try{return JSON.parse(ko(wf(s),"utf8"))}catch{return null}}async function _Be(s,p,{alg:i="HS256",includeIat:r=!0,expiresInSeconds:a,notBeforeSeconds:c,issuer:e,subject:f,audience:h,jwtid:m,header:E={}}={}){const b={alg:i,typ:"JWT",...E},A=Math.floor(Date.now()/1e3),_={...s||{}};r&&(_.iat=A),typeof a=="number"&&(_.exp=A+a),typeof c=="number"&&(_.nbf=A+c),e&&(_.iss=e),f&&(_.sub=f),h&&(_.aud=h),m&&(_.jti=m);const P=lU(b),V=lU(_),j=fn(`${P}.${V}`,"utf8"),G=await w1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,j),K=wh(G);return`${P}.${V}.${K}`}async function VBe(s,p,i,r,a,c,e,f,h,m,E,b){if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(s!=null&&typeof s!="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(m!=null&&typeof m!="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(f!=null&&typeof f!="string")throw new Error("Invalid input type for subject; expected string");if(h!=null&&typeof h!="string"&&!Array.isArray(h))throw new Error("Invalid input type for audience; expected string or string[]");const _=fn(p??"",b??"utf8");return await _Be(s??{},_,{alg:i??"HS256",includeIat:r==null?!0:!!r,expiresInSeconds:a!=null?Number(a):void 0,notBeforeSeconds:c!=null?Number(c):void 0,issuer:e??void 0,subject:f??void 0,audience:h??void 0,jwtid:m??void 0,header:E??void 0})}async function PBe(s,p,{alg:i="HS256",issuer:r,audience:a,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[f,h,m]=String(s).split(".");if(!f||!h||!m)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=Lg(f),b=Lg(h);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 A=fn(`${f}.${h}`,"utf8"),P=await w1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,A),V=wf(m);if(!D1(P,V))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const j=Math.floor(Date.now()/1e3),M=Math.max(0,Number(e)||0);if(b.nbf!=null&&j+M<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&j-M>=Number(b.exp))return{valid:!1,header:E,payload:b,reason:"Expired"};if(r&&b.iss!==r)return{valid:!1,header:E,payload:b,reason:"Issuer mismatch"};if(a){const G=b.aud;if(!(Array.isArray(G)?G.includes(a):G===a))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&j-Number(b.iat)>Number(c)+M?{valid:!1,header:E,payload:b,reason:"MaxAge exceeded"}:{valid:!0,header:E,payload:b}}catch(f){return{valid:!1,header:null,payload:null,reason:String((f==null?void 0:f.message)??f)}}}async function NBe(s,p,i,r,a,c,e,f){if(typeof s!="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 r!="string")throw new Error("Invalid input type for issuer; expected string");if(a!=null&&typeof a!="string")throw new Error("Invalid input type for audience; expected string");const m=fn(p??"",f??"utf8");return await PBe(String(s??""),m,{alg:i??"HS256",issuer:r??void 0,audience:a??void 0,maxAgeSeconds:c!=null?Number(c):void 0,clockSkewSeconds:e!=null?Number(e):void 0})}function xBe(s){const[p,i,r]=String(s).split(".");return{header:p?Lg(p):null,payload:i?Lg(i):null,signature:r?wf(r):new Uint8Array}}function $Be(s,p){if(!s)throw new Error("Token is required for decoding");if(typeof s!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:r,payload:a,signature:c}=xBe(String(s??"")),e=ko(c,i);return{header:r,payload:a,signature:e}}class LBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(nt.GenerateRandomBytes);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)}),e=Math.max(0,Number(a)||0),f=c??"base64url",h=u$(e),m=ko(h,f);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class BBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomInteger);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=oVe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class MBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomFloat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=c1();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class GBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomHexadecimal);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=kx(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class jBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomBase62);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=Ux(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class kBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=uVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class UBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomAlphanumeric);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=Fx(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class FBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateIdentifier);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=Kx(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class KBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomUUIDv4);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=vp();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class qBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{Y.Logger.log("Initializing Random Generate Short Identifier Module");const r=i.find(a=>a.contextType===ae.Logic);if(r){Y.Logger.log("Project state found, setting up operation");const a=r.get(nt.GenerateShortIdentifier);a?(Y.Logger.log("Operation found, setting autoexecutable and implementation"),a.autoexecutable=!0,a.implementation=this.module.main):Y.Logger.warn("Operation generate-short-identifier not found in project state")}else Y.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,r)=>{try{const a=pVe();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class SBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateHexadecimalToken);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=cVe();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}function h1i(s){let p;if(s===null?p="null":Array.isArray(s)?p="array":p=typeof s,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class ZBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Xe.GetTypeOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)})[0];return{value:U.Success,error:null,result:h1i(c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class HBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.ToString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=String(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class WBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.ToNumber);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=Number(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class zBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.ToBytes);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=fn(a,c||"utf8");return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class YBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.FromBytesToString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=ko(a,c||"utf8");return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class JBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.EncodeBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)});return{value:U.Success,error:null,result:vBe(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class QBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.DecodeBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=TBe(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class XBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.EncodeBase64Url);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=wh(a,c||"utf8");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.DecodeBase64Url);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=wf(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class tMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.EncodeHex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=EBe(a,c||"utf8");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class iMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.DecodeHex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=bBe(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class rMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(xi.Hash);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});return{value:U.Success,error:null,result:IBe(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(xi.Hmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m]=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)});return{value:U.Success,error:null,result:RBe(c,e,a,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(xi.ConstantTimeEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});return{value:U.Success,error:null,result:ABe(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(xi.DeriveKeyPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b]=r.map(A=>{var _,P;return((_=A.value)==null?void 0:_.valueAsType)??((P=A.value)==null?void 0:P.value)});return{value:U.Success,error:null,result:DBe(a,c,e,f,h,m,E,b)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class lMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(vn.Parse);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a;try{const c=(a=r[0].value)==null?void 0:a.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:U.Success,error:null,result:e}}catch(c){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:c,result:null}}}})}}class oMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(vn.Stringify);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a,c;try{const e=(a=r[0].value)==null?void 0:a.value,f=(c=r[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(!f&&f!==0){const m=JSON.stringify(e);return{value:U.Success,error:null,result:m}}const h=JSON.stringify(e,null,f);return{value:U.Success,error:null,result:h}}catch(e){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:e,result:null}}}})}}class dMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(cr.BuildJwtHmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b,A,_,P,V]=r.map(j=>{var M,G;return((M=j.value)==null?void 0:M.valueAsType)??((G=j.value)==null?void 0:G.value)});return{value:U.Success,error:null,result:await VBe(a,c,e,f,h,m,E,b,A,_,P,V)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class uMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(cr.VerifyJwtHmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b]=r.map(A=>{var _,P;return((_=A.value)==null?void 0:_.valueAsType)??((P=A.value)==null?void 0:P.value)});return{value:U.Success,error:null,result:await NBe(a,c,e,f,h,m,E,b)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class pMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(cr.DecodeJwt);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)});return{value:U.Success,error:null,result:$Be(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(En.HashPasswordPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m]=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)});return{value:U.Success,error:null,result:await OBe(a,c,e,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(En.VerifyPasswordPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=await CBe(String(a??""),String(c??""));return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class K_ extends v1{constructor(p,i,r=i.projectId){super(p,ae.Editor),this._editor=i,this.id=r}get ready(){return this._editor.ready}get env(){return this._editor.env}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 activeWorkspace(){return this._editor.activeWorkspace}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}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,r){return this._editor.resolveInitialChildrenPositions(p,i,r)}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)}implementFeature(p){return this._editor.implementFeature(p)}}function m1i(s,p){return p instanceof K_?p:new K_(s,p)}class q_ extends v1{constructor(p,i){super(p,ae.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}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 T1i(s,p){return p instanceof q_?p:new q_(s,p)}function v1i(s){s.register(new dPe(s)),s.register(new oPe(s)),s.register(new nPe(s)),s.register(new sPe(s)),s.register(new lPe(s)),s.register(new aPe(s)),s.register(new qLe(s)),s.register(new SLe(s)),s.register(new ZLe(s)),s.register(new WLe(s)),s.register(new HLe(s)),s.register(new zLe(s)),s.register(new BBe(s)),s.register(new MBe(s)),s.register(new GBe(s)),s.register(new jBe(s)),s.register(new kBe(s)),s.register(new UBe(s)),s.register(new FBe(s)),s.register(new KBe(s)),s.register(new qBe(s)),s.register(new SBe(s)),s.register(new K$e(s)),s.register(new q$e(s)),s.register(new S$e(s)),s.register(new Z$e(s)),s.register(new H$e(s)),s.register(new W$e(s)),s.register(new z$e(s)),s.register(new Y$e(s)),s.register(new J$e(s)),s.register(new Q$e(s)),s.register(new X$e(s)),s.register(new eLe(s)),s.register(new tLe(s)),s.register(new iLe(s)),s.register(new rLe(s)),s.register(new nLe(s)),s.register(new aLe(s)),s.register(new sLe(s)),s.register(new lLe(s)),s.register(new uLe(s)),s.register(new pLe(s)),s.register(new cLe(s)),s.register(new d$e(s)),s.register(new u$e(s)),s.register(new p$e(s)),s.register(new c$e(s)),s.register(new f$e(s)),s.register(new y$e(s)),s.register(new h$e(s)),s.register(new m$e(s)),s.register(new T$e(s)),s.register(new E$e(s)),s.register(new b$e(s)),s.register(new A$e(s)),s.register(new g$e(s)),s.register(new I$e(s)),s.register(new Oxe(s)),s.register(new eBe(s)),s.register(new Q2e(s)),s.register(new X2e(s)),s.register(new CNe(s)),s.register(new ONe(s)),s.register(new _Ne(s)),s.register(new VNe(s)),s.register(new PNe(s)),s.register(new NNe(s)),s.register(new xNe(s)),s.register(new $Ne(s)),s.register(new LNe(s)),s.register(new WNe(s)),s.register(new Dxe(s)),s.register(new wxe(s)),s.register(new Cxe(s)),s.register(new BNe(s)),s.register(new MNe(s)),s.register(new GNe(s)),s.register(new jNe(s)),s.register(new kNe(s)),s.register(new UNe(s)),s.register(new FNe(s)),s.register(new KNe(s)),s.register(new qNe(s)),s.register(new SNe(s)),s.register(new ZNe(s)),s.register(new HNe(s)),s.register(new zNe(s)),s.register(new YNe(s)),s.register(new JNe(s)),s.register(new QNe(s)),s.register(new XNe(s)),s.register(new exe(s)),s.register(new txe(s)),s.register(new ixe(s)),s.register(new rxe(s)),s.register(new nxe(s)),s.register(new axe(s)),s.register(new sxe(s)),s.register(new hxe(s)),s.register(new mxe(s)),s.register(new Txe(s)),s.register(new lxe(s)),s.register(new oxe(s)),s.register(new dxe(s)),s.register(new uxe(s)),s.register(new pxe(s)),s.register(new cxe(s)),s.register(new fxe(s)),s.register(new yxe(s)),s.register(new nBe(s)),s.register(new aBe(s)),s.register(new sBe(s)),s.register(new lBe(s)),s.register(new tBe(s)),s.register(new iBe(s)),s.register(new rBe(s)),s.register(new oBe(s)),s.register(new uBe(s)),s.register(new cBe(s)),s.register(new dBe(s)),s.register(new pBe(s)),s.register(new fBe(s)),s.register(new mBe(s)),s.register(new yBe(s)),s.register(new hBe(s)),s.register(new R$e(s)),s.register(new O$e(s)),s.register(new _$e(s)),s.register(new N$e(s)),s.register(new x$e(s)),s.register(new $$e(s)),s.register(new L$e(s)),s.register(new B$e(s)),s.register(new M$e(s)),s.register(new G$e(s)),s.register(new j$e(s)),s.register(new V$e(s)),s.register(new P$e(s)),s.register(new w$e(s)),s.register(new C$e(s)),s.register(new D$e(s)),s.register(new v$e(s)),s.register(new U$e(s)),s.register(new F$e(s)),s.register(new k$e(s)),s.register(new JLe(s)),s.register(new A2e(s)),s.register(new b2e(s)),s.register(new g2e(s)),s.register(new I2e(s)),s.register(new e2e(s)),s.register(new t2e(s)),s.register(new l2e(s)),s.register(new a2e(s)),s.register(new v2e(s)),s.register(new c2e(s)),s.register(new y2e(s)),s.register(new m2e(s)),s.register(new h2e(s)),s.register(new s2e(s)),s.register(new d2e(s)),s.register(new u2e(s)),s.register(new o2e(s)),s.register(new YLe(s)),s.register(new i2e(s)),s.register(new f2e(s)),s.register(new w2e(s)),s.register(new G_(s)),s.register(new XLe(s)),s.register(new r2e(s)),s.register(new QLe(s)),s.register(new T2e(s)),s.register(new n2e(s)),s.register(new p2e(s)),s.register(new E2e(s)),s.register(new D2e(s)),s.register(new R2e(s)),s.register(new C2e(s)),s.register(new G_(s)),s.register(new _2e(s)),s.register(new O2e(s)),s.register(new V2e(s)),s.register(new CLe(s)),s.register(new OLe(s)),s.register(new _Le(s)),s.register(new yLe(s)),s.register(new dLe(s)),s.register(new vLe(s)),s.register(new gLe(s)),s.register(new oLe(s)),s.register(new ILe(s)),s.register(new wLe(s)),s.register(new bLe(s)),s.register(new ELe(s)),s.register(new Ng(s)),s.register(new VLe(s)),s.register(new PLe(s)),s.register(new ALe(s)),s.register(new DLe(s)),s.register(new RLe(s)),s.register(new TLe(s)),s.register(new mLe(s)),s.register(new hLe(s)),s.register(new fLe(s)),s.register(new $Le(s)),s.register(new xLe(s)),s.register(new LLe(s)),s.register(new NLe(s)),s.register(new Axe(s)),s.register(new vxe(s)),s.register(new bxe(s)),s.register(new gxe(s)),s.register(new Ixe(s)),s.register(new Exe(s)),s.register(new Rxe(s)),s.register(new ZBe(s)),s.register(new QBe(s)),s.register(new eMe(s)),s.register(new iMe(s)),s.register(new JBe(s)),s.register(new XBe(s)),s.register(new tMe(s)),s.register(new YBe(s)),s.register(new zBe(s)),s.register(new WBe(s)),s.register(new HBe(s)),s.register(new lMe(s)),s.register(new oMe(s)),s.register(new aMe(s)),s.register(new sMe(s)),s.register(new LBe(s)),s.register(new rMe(s)),s.register(new nMe(s)),s.register(new uMe(s)),s.register(new dMe(s)),s.register(new pMe(s)),s.register(new cMe(s)),s.register(new fMe(s)),s.register(new pPe(s)),s.register(new cPe(s)),s.register(new Vg(s)),s.register(new Pg(s))}class p${constructor(p=new Y.Events("extensions-registry-fallback-events")){R(this,"extensionsRegistry",new Map);R(this,"initialized",new Set);R(this,"initializedContexts",new Set);R(this,"onResolveEditorContextCallback",()=>null);R(this,"onResolveProjectLogicContextCallback",()=>null);R(this,"onResolveEditorGUIContextCallback",()=>null);R(this,"onResolveGUIContextCallback",()=>null);R(this,"onResolveCompileContextCallback",()=>null);R(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||Oe.Normal)-(i.manifest.initPriority||Oe.Normal))}async setup(){v1i(this),Y.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case ae.Editor:return this.onResolveEditorContextCallback();case ae.Logic:return this.onResolveProjectLogicContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();case ae.Compile:return this.onResolveCompileContextCallback();case ae.PublicationRun:return this.onResolvePublicationRunContextCallback();case ae.GUI:return this.onResolveGUIContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,i=[]){const r=[];i.length===0&&(i=p.manifest.contexts);for(const a of i){const c=this.requestContext(a);c&&r.push(c)}return r}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 r of this.extensionInOrder)if(r.module.init&&!this.initialized.has(r.manifest.id)){const a=r.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);a.length&&(await((i=(p=r.module).init)==null?void 0:i.call(p,a)),this.initialized.add(r.manifest.id))}else!r.module.init&&!this.initialized.has(r.manifest.id)&&this.initialized.add(r.manifest.id)}async initForReady(){Y.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){Y.Logger.log("Initializing "+p.manifest.id+" extension...");const i=this.requestContexts(p);p.manifest.contexts.every(a=>!!i.find(c=>c.contextType===a))?(await p.module.init(i),this.initialized.add(p.manifest.id)):Y.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(a=>a.contextType).join(", ")}`)}else!p.module.init&&!this.initialized.has(p.manifest.id)?(Y.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):Y.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)){Y.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case ae.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case ae.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}Y.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 rg=null;const c$={requestExtension:s=>(rg||(rg=new p$,rg.setup()),rg.requestExtension(s))};function E1i(s){return!(s instanceof Error)&&typeof s=="object"&&s!==null?s:s instanceof Error?{name:s.name,message:s.message,stack:s.stack,...s}:s}const ap={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var f$=(s=>(s.FinishedSuccess="finished-success",s.FinishedError="finished-error",s.Running="running",s.Paused="paused",s.Stopped="stopped",s.NotStarted="not-started",s))(f$||{});const yMe={...c$,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class ph extends Y.Events{constructor(i,r,a,c=null,e=yMe){super();R(this,"project");R(this,"entryPoint");R(this,"state","not-started");R(this,"events",new Y.Events("fe-exec-inst-events"));R(this,"entities",[]);R(this,"parentExecution",null);R(this,"executing",[]);R(this,"executed",[]);R(this,"skipped",[]);R(this,"scheduled",[]);R(this,"localTestValues");R(this,"resolvedValues");R(this,"persistedExecutionResults");R(this,"lastExecutionResults");R(this,"onAddToSkippedListCallback",null);R(this,"onRemoveFromSkippedListCallback",null);R(this,"onAddEntityCallback",null);R(this,"onRemoveEntityCallback",null);R(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=r,this.entryPoint=a,this.project=i,this.parentExecution=c,this.localTestValues=new NT(x.UUID.uuid(),this.project),this.resolvedValues=new NT(x.UUID.uuid(),this.project),this.persistedExecutionResults=new NT(x.UUID.uuid(),this.project),this.lastExecutionResults=new NT(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),Qi.includes(i.type)&&pt(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Gt.includes(i.type))return this.executeBranch(i,a,r);if(rr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,a,r);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,r){const a=[];return[...wt,...Gt].includes(r.type)?a.push(...r.inputs):At.includes(r.type)&&a.push(...r.outputs),a.map(e=>{var h;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Gt.includes(r.type)&&(f=i.find(m=>{var E;return((E=m.valueOwner.declaration)==null?void 0:E.id)===e.id})),f){const m=(h=f.value)==null?void 0:h.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return Wr.includes(e.type)?Xl(e,this.valueResolutionContext):Rf(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=ud(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(E=>{var _,P,V;if(E.id===(f==null?void 0:f.valueOwner.id))return;const b=Ht(E.getDataType(null),E,this.project);b==null||b.metaSync({value:(_=f==null?void 0:f.value)==null?void 0:_.value},null),b==null||b.setValueAsTypeList(((P=f==null?void 0:f.value)==null?void 0:P.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((V=f==null?void 0:f.value)==null?void 0:V.valueAsTypeSingle)||null);const A={...f,valueOwner:E,value:b};m.push(A)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,r,a,c={}){var f,h;const e={...ap,...c};try{let m={value:U.Success,error:null,result:null};if(r.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Lr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(uh+i.declaration.id).module.main;E?m=await E(i,r):Y.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{m=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let E=null;if(m.error){Y.Logger.warn("Raw error executing entity: ",m.error);const b=(f=i.error)==null?void 0:f.getDataType(null),A=Ht(b||null,i.error,a);b!=null&&b.asType?A==null||A.setValueAsTypeSingle(m.error):A==null||A.metaSync({value:m.error},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:A}}return{value:m.value,entity:i,error:E,result:{value:m.result||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}return{...m,entity:i}}catch(m){Y.Logger.warn("Internal call execution error: ",m);let E=null;if(i.error){const b=(h=i.error)==null?void 0:h.getDataType(null),A=Ht(b,i.error,a);b!=null&&b.asType?A==null||A.setValueAsTypeSingle(m):A==null||A.metaSync({value:m},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:A}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:E,result:null}}}static async executeOperation(i,r,a){var c,e;try{let f={value:U.Success,error:null,result:null};r.sort((b,A)=>b.valueOwner.index-A.valueOwner.index),i.declaration.implementation&&(f=await i.declaration.implementation(i,r.sort((b,A)=>b.valueOwner.index-A.valueOwner.index)));let h=null;if(f.error&&i.error){const b=E1i(f.error),A=((c=i.error)==null?void 0:c.getDataType(null))||null,_=Ht(A,i.error,a);if(A!=null&&A.asType)_==null||_.setValueAsTypeSingle(f.error);else{const P=an(b)?JSON.stringify(b,null,2):b;_==null||_.metaSync({value:P},null)}h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:_}}const m=i==null?void 0:i.getDataType(null),E=Ht(m,i,a);return m!=null&&m.asType?E==null||E.setValueAsTypeSingle(f.result):E==null||E.metaSync({value:f.result},null),{value:f.value,entity:i,error:h,result:{value:E||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(f){console.warn("Operation execution error: ",f);let h=null;if(i.error){const m=(e=i.error)==null?void 0:e.getDataType(null),E=Ht(m,i.error,a);m!=null&&m.asType?E==null||E.setValueAsTypeSingle(f):E==null||E.metaSync({value:f},null),h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:h,result:null}}}async executeSearch(i,r,a){var c;try{let e={value:U.Success,error:null,result:null};const f=await(await this.parentContext.requestExtension(Ve.SEARCH_NODE_IMPLEMENTATION)).module.main(i,r),h=i==null?void 0:i.getDataType(null),m=Ht(h,i,a);return m==null||m.metaSync({value:f},null),f.error?{value:U.UnhandledError,entity:i,error:{valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:m},result:null}:{value:e.value,entity:i,error:null,result:{value:m,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(e){if(Y.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const f=(c=i.error)==null?void 0:c.getDataType(null),h=Ht(f,i.error,a);return h==null||h.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:h},result:null}}}async executeLoop(i,r,a,c={}){var f,h,m,E,b,A;const e={...ap,...c};try{let _={value:U.Success,error:null,result:null};const P=r.map(ne=>{var ee,oe;return((ee=ne==null?void 0:ne.value)==null?void 0:ee.valueAsType)||((oe=ne==null?void 0:ne.value)==null?void 0:oe.value)});let V={};i.getUniqueInputMaps().forEach(ne=>{const ee=i.body.inputs.find(ue=>de(ue,a)===de(ne,a)),oe=ne==null?void 0:ne.getDataType(null),ie=Ht(oe,ee,a);oe!=null&&oe.asType?ie==null||ie.setValueAsTypeList([]):ie==null||ie.metaSync({value:[]},null),this.lastExecutionResults.writeValue(ee,ie);const se={value:ie,valueOwner:ee,type:Me.ExecutionResult,inheritanceLink:null};V[ee.id]=se});let M={value:U.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case re.loop["counted-loop"].id:{const ne=P[0];let ee=1;for(;ee<=ne&&ee<=50;){const oe=i.body.inputs.map(ie=>{if(ie===i.currentIterationNumberArgumentDeclaration){const se=i.currentIterationNumberArgumentDeclaration.getDataType(null),ue=ff(se),z=this.lastExecutionResults.readValue(ie.id);if(z){z.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ie,z);const me={value:z,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return V[ie.id]=me,me}const X={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:ue,standaloneParent:ie.toReference()},pe=nr(X,a);this.lastExecutionResults.writeValue(ie,pe);const le={value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return V[ie.id]=le,le}else return V[ie.id]}).filter(ie=>!!ie);if(M=await this.executeFullFunctionDeclarationLogic(i.body,oe,e),(M.results||[]).forEach(ie=>{var X,pe,le,me;if(ie.valueOwner.type!==d.InputMap||At.includes(ie.valueOwner.parent.type))return;const se=i.body.inputs.find(ve=>de(ve,a)===de(ie.valueOwner,a)),z=[...((pe=(X=V==null?void 0:V[se.id])==null?void 0:X.value)==null?void 0:pe.value)||[],((le=ie==null?void 0:ie.value)==null?void 0:le.value)||null];(me=V[se.id].value)==null||me.metaSync({value:z},null),this.lastExecutionResults.writeValue(se,V[se.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case re.loop["manual-flow-loop"].id:{let ne=1;for(;ne<=50;){const ee=i.body.inputs.map(oe=>{if(oe===i.currentIterationNumberArgumentDeclaration){const ie=this.lastExecutionResults.readValue(oe.id);if(ie){ie.metaSync({value:ne},null),this.lastExecutionResults.writeValue(oe,ie);const X={value:ie,valueOwner:oe,type:Me.ExecutionResult,inheritanceLink:null};return V[oe.id]=X,X}const se=i.currentIterationNumberArgumentDeclaration.getDataType(null),ue=Ht(se,oe,a);return ue==null||ue.metaSync({value:ne},null),this.lastExecutionResults.writeValue(oe,ue),{value:ue,valueOwner:oe,type:Me.ExecutionResult,inheritanceLink:null}}else return V[oe.id]}).filter(oe=>!!oe);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ee,e),(M.results||[]).forEach(oe=>{var z,X,pe;if(oe.valueOwner.type!==d.InputMap||At.includes(oe.valueOwner.parent.type))return;const ie=i.body.inputs.find(le=>de(le,a)===de(oe.valueOwner,a)),ue=[...(z=V[ie.id].value)==null?void 0:z.value,((X=oe.value)==null?void 0:X.value)||null];(pe=V[ie.id].value)==null||pe.metaSync({value:ue},null),this.lastExecutionResults.writeValue(ie,V[ie.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ne++}break}case re.loop["list-loop"].id:{const ne=P[0];let ee=1;const oe=ne;for(let ie=0;ie<oe.length;ie++){const se=oe[ie],ue=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const pe=i.currentIterationNumberArgumentDeclaration.getDataType(null),le=Ht(pe,z,a);return le==null||le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),pe=ff(X),le=this.lastExecutionResults.readValue(z.id);if(le)return le.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={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:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:z.toReference()},ve=nr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>de(Re,a)===de(z.valueOwner,a)),le=[...(me=V[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=V[X.id].value)==null||we.metaSync({value:le},null),this.lastExecutionResults.writeValue(X,V[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case re.loop["object-keys-loop"].id:{const ne=P[0];let ee=1;const oe=ne?Object.keys(ne):[];for(let ie=0;ie<oe.length;ie++){const se=oe[ie],ue=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const pe=i.currentIterationNumberArgumentDeclaration.getDataType(null),le=Ht(pe,z,a);return le==null||le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),pe=ff(X),le=this.lastExecutionResults.readValue(z.id);if(le)return le.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={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:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:z.toReference()},ve=nr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>de(Re,a)===de(z.valueOwner,a)),le=[...(me=V[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=V[X.id].value)==null||we.metaSync({value:le},null),this.lastExecutionResults.writeValue(X,V[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case re.loop["object-values-loop"].id:{const ne=P[0];let ee=1;const oe=ne?Object.values(ne):[];for(let ie=0;ie<oe.length;ie++){const se=oe[ie],ue=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const pe=i.currentIterationNumberArgumentDeclaration.getDataType(null),le=Ht(pe,z,a);return le==null||le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),pe=ff(X),le=this.lastExecutionResults.readValue(z.id);if(le)return le.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={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:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:z.toReference()},ve=nr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>de(Re,a)===de(z.valueOwner,a)),le=[...(me=V[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=V[X.id].value)==null||we.metaSync({value:le},null),this.lastExecutionResults.writeValue(X,V[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case re.loop["string-loop"].id:{const ne=P[0];let ee=1;const oe=ne.split("");for(let ie=0;ie<oe.length;ie++){const se=oe[ie],ue=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const pe=i.currentIterationNumberArgumentDeclaration.getDataType(null),le=Ht(pe,z,a);return le==null||le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),pe=ff(X),le=this.lastExecutionResults.readValue(z.id);if(le)return le.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={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:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:z.toReference()},ve=nr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>de(Re,a)===de(z.valueOwner,a)),le=[...(me=V[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=V[X.id].value)==null||we.metaSync({value:le},null),this.lastExecutionResults.writeValue(X,V[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}}if(_={value:[U.CaughtError,U.Return].includes(M.value)?M.value:U.Success,error:((h=(f=M.error)==null?void 0:f.value)==null?void 0:h.value)||null,result:((E=(m=M==null?void 0:M.result)==null?void 0:m.value)==null?void 0:E.value)||null},_.error&&i.error){const ne=(b=i.error)==null?void 0:b.getDataType(null),ee=Ht(ne||null,i.error,a);ne!=null&&ne.asType?ee==null||ee.setValueAsTypeSingle(_.error):ee==null||ee.metaSync({value:_.error},null);const oe={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:ee};return{value:_.value,entity:i,error:oe,result:null}}const G=i==null?void 0:i.getDataType(null),K=Ht(G,i,a);return G!=null&&G.asType?K==null||K.setValueAsTypeSingle(_.result):K==null||K.metaSync({value:_.result},null),{value:_.value,entity:i,error:null,result:{value:K||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(_){if(Y.Logger.warn("Error executing loop: ",_),i.error){const P=(A=i.error)==null?void 0:A.getDataType(null),V=Ht(P,i.error,a);return P!=null&&P.asType?V==null||V.setValueAsTypeSingle(_):V==null||V.metaSync({value:_},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:V},result:null}}else return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,r,a,c={}){var f,h,m,E,b,A,_,P,V,j,M,G,K,ne,ee,oe,ie,se,ue,z,X,pe,le,me,ve,we;const e={...ap,...c};try{const Re=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let xe=null;if(Re.error&&i.error){Y.Logger.warn("Raw error executing entity: ",Re.error);const Ze=(f=i.error)==null?void 0:f.getDataType(null),et=Ht(Ze||null,i.error,a);Ze!=null&&Ze.asType?(m=(h=Re.error)==null?void 0:h.value)!=null&&m.valueAsTypeSingle?et==null||et.setValueAsTypeSingle((b=(E=Re.error)==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle):(_=(A=Re.error)==null?void 0:A.value)!=null&&_.valueAsTypeList&&Array.isArray((V=(P=Re.error)==null?void 0:P.value)==null?void 0:V.valueAsTypeList)&&(et==null||et.setValueAsTypeList((M=(j=Re.error)==null?void 0:j.value)==null?void 0:M.valueAsTypeList)):et==null||et.metaSync({value:(K=(G=Re.error)==null?void 0:G.value)==null?void 0:K.value},null),xe={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:et}}let je=U.Success;Re.value===U.UnhandledError&&(i.catchesError||i.errorCalls.length?je=U.CaughtError:je=U.UnhandledError);const Se=i==null?void 0:i.getDataType(null),Je=Ht(Se,i,a);return Se!=null&&Se.asType?(ee=(ne=Re.result)==null?void 0:ne.value)!=null&&ee.valueAsTypeSingle?Je==null||Je.setValueAsTypeSingle((ie=(oe=Re.result)==null?void 0:oe.value)==null?void 0:ie.valueAsTypeSingle):(ue=(se=Re.result)==null?void 0:se.value)!=null&&ue.valueAsTypeList&&Array.isArray((X=(z=Re.result)==null?void 0:z.value)==null?void 0:X.valueAsTypeList)&&(Je==null||Je.setValueAsTypeList((le=(pe=Re.result)==null?void 0:pe.value)==null?void 0:le.valueAsTypeList)):Je==null||Je.metaSync({value:((ve=(me=Re.result)==null?void 0:me.value)==null?void 0:ve.value)||null},null),{value:je,entity:i,error:xe,result:{value:Je||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(Re){if(!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const xe=(we=i.error)==null?void 0:we.getDataType(null),je=Ht(xe,i.error,a);return xe!=null&&xe.asType?je==null||je.setValueAsTypeSingle(Re):je==null||je.metaSync({value:Re},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:je},result:null}}}async executeCondition(i,r){var c,e,f,h;let a=!1;switch(i.declaration.id){case bn.BooleanIsTrue:{const m=(e=(c=r[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof m!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");a=m===!0;break}case bn.BooleanIsFalse:{const m=(h=(f=r[0])==null?void 0:f.value)==null?void 0:h.value;if(typeof m!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");a=m===!1;break}case wr.And:{a=(await Promise.all(i.andChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(r,E);return(await this.executeCondition(E,b)).value===U.Success}))).every(E=>E);break}case wr.Or:{a=(await Promise.all(i.orChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(r,E);return(await this.executeCondition(E,b)).value===U.Success}))).some(E=>E);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:a?U.Success:U.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,r,a,c={}){const e={...ap,...c,onBeforeEntityExecution:(m,E,b)=>{var A;return((A=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:A.call(c,m,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,E,b)=>{var A;return((A=c==null?void 0:c.onEntityExecuted)==null?void 0:A.call(c,m,E,{...b,detached:!0}))||Promise.resolve()}},f=new ph(a,[i,...Qg(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,r)}async executeFullFunctionDeclarationLogic(i,r,a={}){const c={...ap,...a},e=Qg(i);e.forEach(m=>{this.addEntity(m)}),e.reduce((m,E)=>At.includes(E.type)?[...m,...E.outputs]:wt.includes(E.type)&&E.type!==d.Condition?[...m,...E.outputs,...E.inputs]:E.type===d.Condition?[...m,...E.inputs]:m,[]).forEach(m=>{this.lastExecutionResults.removeValue(m.id)});const h=await this.executeBranch(i,c,r);return{...h||{},value:(h==null?void 0:h.value)||U.Success,entity:i,error:(h==null?void 0:h.error)||null,result:(h==null?void 0:h.result)||null}}static async executeEntryPointEntity(i,r){return{value:U.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,r){var f,h,m,E,b,A,_;if((f=i.throws)!=null&&f.readsValue){const P=Xl(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=Xl(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)an((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Ht(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var j,M;if(((j=V.declaration)==null?void 0:j.type)===d.Property&&V.declaration.static){const G=this.lastExecutionResults.readValue(V.declaration.id),K=de(V,this.project),ne=V.codeName||((M=V.declaration)==null?void 0:M.codeName)||Xi(K);if(G)G.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,G);else{const ee=Ht(V.getDataType(null),V,this.project);ee==null||ee.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&an((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var G;const V=P.codeName||((G=P.declaration)==null?void 0:G.codeName)||Xi(de(P,this.project)),j=e[V],M=Ht(P.getDataType(null),P,this.project);M==null||M.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Return,entity:i,error:null,result:a}}async executeContinueStatement(i,r){var f,h,m,E,b,A,_;if((f=i.throws)!=null&&f.readsValue){const P=Xl(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=Xl(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)an((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Ht(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var j,M;if(((j=V.declaration)==null?void 0:j.type)===d.Property&&V.declaration.static){const G=this.lastExecutionResults.readValue(V.declaration.id),K=de(V,this.project),ne=V.codeName||((M=V.declaration)==null?void 0:M.codeName)||Xi(K);if(G)G.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,G);else{const ee=Ht(V.getDataType(null),V,this.project);ee==null||ee.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&an((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var G;const V=P.codeName||((G=P.declaration)==null?void 0:G.codeName)||Xi(de(P,this.project)),j=e[V],M=Ht(P.getDataType(null),P,this.project);M==null||M.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Continue,entity:i,error:null,result:a}}async executeBreakStatement(i,r){var f,h,m,E,b,A,_;if((f=i.throws)!=null&&f.readsValue){const P=Xl(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=Xl(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)an((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Ht(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var j,M;if(((j=V.declaration)==null?void 0:j.type)===d.Property&&V.declaration.static){const G=this.lastExecutionResults.readValue(V.declaration.id),K=de(V,this.project),ne=V.codeName||((M=V.declaration)==null?void 0:M.codeName)||Xi(K);if(G)G.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,G);else{const ee=Ht(V.getDataType(null),V,this.project);ee==null||ee.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&an((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var G;const V=P.codeName||((G=P.declaration)==null?void 0:G.codeName)||Xi(de(P,this.project)),j=e[V],M=Ht(P.getDataType(null),P,this.project);M==null||M.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Break,entity:i,error:null,result:a}}async executeVariable(i,r){var h,m,E,b,A,_,P;let a=Xl(i,this.valueResolutionContext);const c=Er(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let V={};if(((h=e==null?void 0:e.entity)==null?void 0:h.type)===d.DefinitionEntity?V={...V,...e.entity.getActiveRawDefaultValue()}:((m=e==null?void 0:e.entity)==null?void 0:m.type)===d.BuiltInBaseEntity&&(V={...V,...e.entity.getRawDefaultValue()}),a!=null&&a.value)an((E=a==null?void 0:a.value)==null?void 0:E.value)&&(V={...V,...(b=a==null?void 0:a.value)==null?void 0:b.value}),a==null||a.value.metaSync({value:V},null);else{const j=Ht(e,i,this.project);j==null||j.metaSync({value:V},null),a={valueOwner:c,type:Me.ExecutionResult,inheritanceLink:null,value:j}}i.inputs.forEach(j=>{var K,ne,ee,oe,ie,se;const M=Xl(j,this.valueResolutionContext),G=c.inputs.find(ue=>{var z,X;return((z=ue.declaration)==null?void 0:z.id)===((X=j.declaration)==null?void 0:X.id)});if(((K=G==null?void 0:G.declaration)==null?void 0:K.type)===d.Property&&((ne=G==null?void 0:G.declaration)!=null&&ne.static))M!=null&&M.value?this.lastExecutionResults.writeValue(G==null?void 0:G.declaration,M==null?void 0:M.value):this.lastExecutionResults.removeValue(G==null?void 0:G.declaration.id);else if(M!=null&&M.value){const ue=de(j,this.project),z=j.codeName||((ee=j.declaration)==null?void 0:ee.codeName)||Xi(ue);(se=a==null?void 0:a.value)==null||se.metaSync({value:{...(oe=a.value)==null?void 0:oe.value,[z]:(ie=M==null?void 0:M.value)==null?void 0:ie.value}},null)}}),this.lastExecutionResults.writeValue(c,a.value)}else this.lastExecutionResults.writeValue(c,a==null?void 0:a.value);const f=(A=a==null?void 0:a.value)!=null&&A.value&&an((_=a.value)==null?void 0:_.value)?((P=a.value)==null?void 0:P.value)||{}:{};return i.outputs.map(V=>{var K;const j=V.codeName||((K=V.declaration)==null?void 0:K.codeName)||Xi(de(V,this.project)),M=f[j],G=Ht(V.getDataType(null),V,this.project);G==null||G.metaSync({value:M},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Success,entity:i,error:null,result:a}}mergeValues(i,r){const a=[];for(let c=0;c<r.length;c++)i!=null&&i[c]?a.push(i[c]):a.push(r[c]);return a}async executeEntity(i,r=[],a={}){var f,h,m,E,b,A,_,P,V,j,M,G;const c={...ap,...a},e={detached:!1};switch(i.type){case d.Condition:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((f=c.onBeforeEntityExecution)==null?void 0:f.call(c,i,K,e)),this.executeCondition(i,K)}case d.InternalCall:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((h=c.onBeforeEntityExecution)==null?void 0:h.call(c,i,K,e)),this.executeInternalCall(i,K,this.project)}case d.Operation:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((m=c.onBeforeEntityExecution)==null?void 0:m.call(c,i,K,e)),ph.executeOperation(i,K,this.project)}case d.VariableInstance:case d.VariableDeclaration:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,K,e)),this.executeVariable(i,K)}case d.FunctionCall:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,K,e)),this.executeFunctionCall(i,K,this.project)}case d.FunctionDeclaration:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((A=c.onBeforeEntityExecution)==null?void 0:A.call(c,i,K,e)),ph.executeEntryPointEntity(i,K)}case d.Search:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((_=c.onBeforeEntityExecution)==null?void 0:_.call(c,i,K,e)),this.executeSearch(i,K,this.project)}case d.Loop:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((P=c.onBeforeEntityExecution)==null?void 0:P.call(c,i,K,e)),this.executeLoop(i,K,this.project,c)}case d.ReturnStatement:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((V=c.onBeforeEntityExecution)==null?void 0:V.call(c,i,K,e)),this.executeReturnStatement(i,K)}case d.ContinueStatement:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((j=c.onBeforeEntityExecution)==null?void 0:j.call(c,i,K,e)),this.executeContinueStatement(i,K)}case d.BreakStatement:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,K,e)),this.executeBreakStatement(i,K)}case d.GlobalEvent:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((G=c.onBeforeEntityExecution)==null?void 0:G.call(c,i,K,e)),ph.executeEntryPointEntity(i,K)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var a,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((a=i.result)!=null&&a.valueOwner))return;const r=ud((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?r.forEach(f=>{var h;this.lastExecutionResults.writeValue(f,(h=i.result)==null?void 0:h.value)}):r.forEach(f=>{this.lastExecutionResults.removeValue(f.id)})}async executeBranch(i,r={},a=[]){var m;const c={...ap,...r},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const h=await this.executeEntity(i,a,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(h),await((m=c.onEntityExecuted)==null?void 0:m.call(c,i,h,e)),h.value===U.Success){const E=(i.successCalls||i.calls||[]).filter(V=>this.hasEntity(V));(i.errorCalls||[]).forEach(V=>{this.skip(V)});let A=[];const _=(await Promise.all(E.map(V=>this.schedule(V,[],c)))).filter(V=>!!V),P=_.filter(V=>!!V).find(V=>V.value===U.CaughtError||V.value===U.Return||V.value===U.Break||V.value===U.Continue);return P||(A=[...A,..._],h)}else if(h.value===U.CaughtError||h.value===U.ConditionNotMet){const E=(i.errorCalls||[]).filter(V=>this.hasEntity(V));(i.successCalls||i.calls||[]).forEach(V=>{this.skip(V)});let A=[];const _=(await Promise.all(E.map(V=>this.schedule(V,[],c)))).filter(V=>!!V),P=_.filter(V=>!!V).find(V=>V.value===U.CaughtError||V.value===U.UnhandledError||V.value===U.Return||V.value===U.Break||V.value===U.Continue);return P||(A=[...A,..._],h)}else{if(h.value===U.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),Qi.includes(h.entity.type)&&pt(h.entity).forEach(E=>{this.skip(E)}),h;if(h.value===U.Return)return h;if(h.value===U.Break)return h;if(h.value===U.Continue)return h}return h}async execute(i={},r=[]){const a={...ap,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,a,r);return this.state="finished-success",c}addEntity(i){var r;this.entities.includes(i)||(this.entities.push(i),(r=this.onAddEntityCallback)==null||r.call(this,i,{}))}async addEntityAsync(i,r={}){var a;this.entities.includes(i)||(this.entities.push(i),await((a=this.onAddEntityCallback)==null?void 0:a.call(this,i,r)))}addEntities(i){i.forEach(r=>this.addEntity(r))}async addEntitiesAsync(i,r={}){const a=Y.YieldTracker.from(r),c=[];for(const e of i)c.push(this.addEntityAsync(e,r)),await a.tick();await Promise.all(c)}removeEntity(i){var r;if(i!==this.entryPoint){const a=this.entities.indexOf(i);a>-1&&(this.entities.splice(a,1),(r=this.onRemoveEntityCallback)==null||r.call(this,i,{}))}}hasEntity(i){var c,e,f;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===d.FunctionDeclaration&&((f=(e=i.parent)==null?void 0:e.parent)==null?void 0:f.type)===d.DefinitionEntity)return this.entities.includes(i.parent);const r=yt(i);if(!r)return!1;const a=r.type===d.Loop&&i.parent===r.body?r.body:null;return a?this.entities.includes(a)||this.entities.includes(r):this.entities.includes(r)}removeScheduled(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,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 r=this.project.get(i);return r?this.hasEntity(r):!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 r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}removeFromExecutingList(i){var a;const r=this.executing.indexOf(i);r>-1&&(this.executing.splice(r,1),(a=this.onAbortExecutionCallback)==null||a.call(this,i,{}))}removeFromAlreadyExecutedList(i){const r=this.executed.indexOf(i);r>-1&&this.executed.splice(r,1)}removeFromSkippedList(i){var a;const r=this.skipped.indexOf(i);r>-1&&(this.skipped.splice(r,1),(a=this.onRemoveFromSkippedListCallback)==null||a.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var r;this.skipped.includes(i)||(this.skipped.push(i),(r=this.onAddToSkippedListCallback)==null||r.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,r){this.parentContext.setValueTypePreference(i,r),this.emit(i,{})}}function b1i(s){var p,i;if(s.isList)return"list";if(((p=s.entity)==null?void 0:p.type)===d.DefinitionEntity)return"definition-entity";switch((i=s.entity)==null?void 0:i.name){case fe.Number:return"number";case fe.String:return"text";case fe.Boolean:return"boolean";case fe.UUID:return"uuid";case fe.Date:return"date-time";default:return"definition-entity"}}const ds={[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 y$(s){const p=pD(s);if(!p){const r=xh(s);if(r.includes(Ae.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(Ae.PERSISTED_ENTITY))return"Persisted entity";if(r.includes(Ae.CRON_JOB))return"Scheduled execution";if(r.includes(Ae.RELATIONAL_DATABASE))return"Relational database"}if(p){let r="Extension of "+de(p,p.project)+" entity",a=ps(r);const c=xh(s);return c.includes(Ae.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(Ae.PERSISTED_ENTITY)?"Persisted entity"+(a?", "+a:""):c.includes(Ae.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(Ae.RELATIONAL_DATABASE)?"Relational database"+(a?", "+a:""):r}let i="";return s.abstract&&(i="Template "),s.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function hMe(s){return s.parent.type===d.DefinitionEntity||s.parent.type===d.InstalledProject?"Internal action of "+de(s.parent,s.project):s.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function h$(s){return BL(s)?hMe(s):"Custom trigger"}function A1i(s){var p;switch(s.type){case d.DefinitionEntity:return y$(s);case d.FunctionDeclaration:return h$(s)}return(p=ds[s.type])==null?void 0:p.singular}function g1i(s){var p;switch(s.type){case d.DefinitionEntity:return y$(s);case d.FunctionDeclaration:return h$(s)}return(p=ds[s.type])==null?void 0:p.singular}const m$=4e4,T$=280,I1i=300,v$=65,Tf=32,yh=39,rv=26,mMe=49,nv=44,R1i=35,yg=52,O1=10,ka=O1*2,yp=38,hg=90,Bg=270,TMe=m$/2+120,vMe=m$/2+180;function E$(s){let i=Tf+nv+yp+O1;const r=[...s.inputs];return r.length&&(i+=ka,r.forEach(()=>{i+=rv})),{height:i,width:280}}function av(s){var a,c;let i=Tf+nv+yp+O1;const r=[...s.inputs];return r.length&&(i+=ka,r.forEach(()=>{i+=rv})),s.andChildrenGroup&&(i+=ka,s.andChildrenGroup.forEach(e=>{i+=av(e).height})),s.orChildrenGroup&&(i+=ka,s.orChildrenGroup.forEach(e=>{i+=av(e).height})),(((a=s.declaration)==null?void 0:a.id)===re.condition["condition-group-and"].id||((c=s.declaration)==null?void 0:c.id)===re.condition["condition-group-or"].id)&&(i+=yp),{height:i,width:280}}function EMe(s){var h,m;let i=v$;const r=[];if([d.DefinitionEntity].includes(s.type)){const E=[...s.suggestedProperties||[],...s.properties||[]];E.length&&(i+=ka,E.forEach(b=>{i+=b.static?mMe:yh}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(s.type)){const E=[...(s==null?void 0:s.suggestedMethods)||[],...s.methods||[],...s.functions||[],...s.body?[s.body]:[]];E.length&&(i+=ka,E.forEach(b=>{const A=E$(b);i+=A.height}))}wt.includes(s.type)?(r.push(...(s.inputs||[]).flatMap(E=>[E])||[]),i+=ka,i+=nv,s.error&&(i+=yg)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)?(r.push(...s.outputs||[]),s.throws&&(i+=yg)):s.type===d.Condition&&(r.push(s.inputs[0]),s.inputs[1]&&r.push(s.inputs[1]),(((h=s.declaration)==null?void 0:h.id)===re.condition["condition-group-and"].id||((m=s.declaration)==null?void 0:m.id)===re.condition["condition-group-or"].id)&&(i+=yp),s.andChildrenGroup&&(i+=ka,s.andChildrenGroup.forEach(E=>{i+=av(E).height})),s.orChildrenGroup&&(i+=ka,s.orChildrenGroup.forEach(E=>{i+=av(E).height})));const a=r.length;a&&(i+=a*yh,i+=ka);const c=[];if(s.type===d.FunctionDeclaration||s.type===d.GlobalEvent?c.push(...s.inputs||[]):wt.includes(s.type)&&c.push(...s.outputs||[]),Lt.includes(s.type)){i+=ka,i+=nv,s.usedInternalCalls.length&&s.usedInternalCalls.forEach(b=>{i+=yg+ka,i+=b.inputs.length*rv,i+=b.outputs.length*rv});const E=s.getDataType(null);(!E||E.canModifyObjectStructure())&&(i+=yp)}s.type===d.Search&&(i+=yp);const e=c.length;return e&&(i+=e*yh,i+=ka),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)&&(i+=yp),{height:i,width:280}}function bMe(s){let p=0;if(s.parent.type!==d.DefinitionEntity)return{offset:p};const i=s.parent,r=i.methods.findIndex(c=>c.id===s.id);return i.methods.slice(0,r).forEach(c=>{const e=E$(c);p+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(p+=ka,i.suggestedProperties.forEach(()=>{p+=yh}),i.properties.forEach(()=>{p+=yh})),{offset:p}}function CE(s){return`${s.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function D1i(s){switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case be.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case be.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case be.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case be.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case be.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case be.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Ce.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ce.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case be.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case be.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Ce.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case be.NoProperties:return"This entity has no properties, so it doesn't do anything";case be.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case be.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case be.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case be.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case be.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case be.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case be.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case be.PropertyImplementsNonAbstact:return"This property implements a non-template property";case be.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case be.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case be.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case be.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case be.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Ce.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ce.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ce.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ce.UnreachableEntity:return"This entity is unreachable";case be.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case be.AbstractEntityImplements:return"This template entity implements a non-template entity";case be.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case be.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case be.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case be.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case be.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case be.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case be.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case be.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case be.MissingRequiredValue:return"This action is missing a required value";case be.NoPrimaryKeyProperty:return"This entity has no primary key property";case be.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case be.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case be.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case be.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case be.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case be.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case be.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ce.EmptyName:return"This entity has no name";case Ce.InvalidObjectStructure:return"This entity has an invalid structure";case Ce.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ce.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ce.MissingCaller:return"This action is missing a caller";case Ce.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ce.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ce.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ce.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Td.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Td.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case cs.UUIDMustBeString:return`UUID must be a string, eg: "${vp()}"`;case cs.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${vp()}"`;case cs.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${vp()}"`;case Nn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Nn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Nn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case Nn.ValueMustBeString:return"This value must be a string";case KT.DayOfMonthAndWeekConflict:return"Cron expression cannot have both day of month and day of week";case KT.InvalidCharacters:return"Cron expression has invalid characters";case KT.MustHaveSixFields:return"Cron expression must have six fields";default:return CE(s.code)}}function w1i(s){switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case be.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case be.IncorrectEntityImplementation:return"Incorrect implementation";case be.IncorrectMethodImplementation:return"Incorrect action implementation";case be.IncorrectPropertyImplementation:return"Incorrect property implementation";case be.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case be.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Ce.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ce.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case be.MissingMethodImplementation:return"Missing action";case be.MissingPropertyImplementation:return"Missing property";case Ce.NameNotUniqueInScope:return"Duplicate name";case be.NoProperties:return"No properties";case be.NonStaticPropertyInStaticEntity:return"Non-static property";case be.StaticEntityWithNonStaticProperties:return"Non-static properties";case be.ReadingFromIncompatibleType:return"Read from different type";case be.WritingToIncompatibleType:return"Write to different type";case be.ScopeWithoutLogic:return"No logic";case be.NonStaticPropertyImplementsStatic:return"Invalid static property";case be.PropertyImplementsIncompatibleType:return"Incompatible data type";case be.PropertyImplementsNonAbstact:return"Non-template property";case be.StaticPropertyImplementsNonStatic:return"Non-static property";case be.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case be.VariableHasInputsAndInternalCall:return"Bad internal call";case be.VariableHasOutputsAndInternalCall:return"Bad internal call";case be.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Ce.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ce.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ce.InternalCallParentMissingDataType:return"Parent has no data type";case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ce.UnreachableEntity:return"Unreachable entity";case be.DisconnectedCallableEntity:return"Disconnected entity";case be.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case be.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case be.InvalidPropertiesCombination:return"Invalid properties combination";case be.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case be.ExtendsIncompatibleEntities:return"Extends incompatible entities";case be.ImplementingNonAbstractEntity:return"Implementing non-template entity";case be.ImplementsIncompatibleEntities:return"Implements incompatible entities";case be.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case be.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case be.MissingRequiredValue:return"Missing required value";case be.NoPrimaryKeyProperty:return"No primary key property";case be.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case be.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case be.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case be.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case be.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case be.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case be.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Ce.EmptyName:return"Empty name";case Ce.InvalidObjectStructure:return"Invalid object structure";case Ce.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ce.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ce.MissingCaller:return"Missing caller";case Ce.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ce.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ce.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ce.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Td.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Td.StatusCodeMustBeNumber:return"HTTP status code must be a number";case cs.UUIDMustBeString:return"UUID must be a string";case cs.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case cs.UUIDMustBeValidFormat:return"UUID must be in a valid format";case Nn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Nn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Nn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return CE(s.code)}}function C1i(s){switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return`${de(s.entity,s.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${de(s.entity,s.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements template`;case be.IncorrectMethodImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements the template`;case be.IncorrectPropertyImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements the template`;case be.AbstractMethodInNonAbstractEntity:return`${de(s.entity,s.entity.project)} can't be a template`;case be.AbstractPropertyInNonAbstractEntity:return`${de(s.entity,s.entity.project)} can't be a template`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${de(s.entity,s.entity.project)} overwrites action`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${de(s.entity,s.entity.project)} overwrites property`;case be.MissingMethodImplementation:return`${de(s.entity,s.entity.project)} is missing action`;case be.MissingPropertyImplementation:return`${de(s.entity,s.entity.project)} is missing property`;case Ce.NameNotUniqueInScope:return`${de(s.entity,s.entity.project)} name is not unique`;case be.NoProperties:return`${de(s.entity,s.entity.project)} has no properties`;case be.NonStaticPropertyInStaticEntity:return`${de(s.entity,s.entity.project)} has non-static property`;case be.StaticEntityWithNonStaticProperties:return`${de(s.entity,s.entity.project)} has non-static properties`;case be.ReadingFromIncompatibleType:return`${de(s.entity,s.entity.project)} reads from different type`;case be.WritingToIncompatibleType:return`${de(s.entity,s.entity.project)} writes to different type`;case be.ScopeWithoutLogic:return`${de(s.entity,s.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${de(s.entity,s.entity.project)} has invalid static property`;case be.PropertyImplementsIncompatibleType:return`${de(s.entity,s.entity.project)} has incompatible data type`;case be.PropertyImplementsNonAbstact:return`${de(s.entity,s.entity.project)} has non-template property`;case be.StaticPropertyImplementsNonStatic:return`${de(s.entity,s.entity.project)} has non-static property`;case be.VariableCallsOthersAndHasInternalCall:return`${de(s.entity,s.entity.project)} has bad internal call`;case be.VariableHasInputsAndInternalCall:return`${de(s.entity,s.entity.project)} has bad internal call`;case be.VariableHasOutputsAndInternalCall:return`${de(s.entity,s.entity.project)} has bad internal call`;case be.VariableIsCalledAndHasInternalCall:return`${de(s.entity,s.entity.project)} has bad internal call`;case Ce.InternalCallDeclarationIsInvalidType:return`${de(s.entity,s.entity.project)} has declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${de(s.entity,s.entity.project)} has declaration that is not found in parent`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${de(s.entity,s.entity.project)} has invalid parent declaration type`;case Ce.InternalCallParentMissingDataType:return`${de(s.entity,s.entity.project)}'s parent has no data type`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${de(s.entity,s.entity.project)} has declaration that is not in parent`;case Ce.UnreachableEntity:return`${de(s.entity,s.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${de(s.entity,s.entity.project)} is not executed by any entity`;case be.AbstractEntityImplements:return`${de(s.entity,s.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${de(s.entity,s.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${de(s.entity,s.entity.project)} has invalid properties combination`;case be.ExtendingNonInteractiveEntity:return`${de(s.entity,s.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${de(s.entity,s.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${de(s.entity,s.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${de(s.entity,s.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${de(s.entity,s.entity.project)} is missing termination on some branches`;case be.LastCalledEntityMustBeReturnEntity:return`${de(s.entity,s.entity.project)}'s last called entity must be a termination node`;case be.MissingRequiredValue:return`${de(s.entity,s.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${de(s.entity,s.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${de(s.entity,s.entity.project)} extends a template entity`;case be.NonStaticExtendingStaticEntity:return`${de(s.entity,s.entity.project)} extends a static entity`;case be.NonStaticImplementingStaticEntity:return`${de(s.entity,s.entity.project)} implements a static entity`;case be.StaticExtendingNonStaticEntity:return`${de(s.entity,s.entity.project)} extends a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${de(s.entity,s.entity.project)} implements a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${de(s.entity,s.entity.project)} reads a value and has internal call`;case be.VariableWritesValuesAndInternalCall:return`${de(s.entity,s.entity.project)} writes values and has internal call`;case Ce.EmptyName:return`${ds[s.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${de(s.entity,s.entity.project)} has invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${de(s.entity,s.entity.project)}'s loop body action overwrites an action`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites base action`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${de(s.entity,s.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${de(s.entity,s.entity.project)} has a name not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${de(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${de(s.entity,s.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${de(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites base property`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${de(s.entity,s.entity.project)} has reader/writer with incompatible data type`;case Td.StatusCodeMustBeBetween100And599:return`${de(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case Td.StatusCodeMustBeNumber:return`${de(s.entity,s.entity.project)} HTTP status code must be a number`;case cs.UUIDMustBeString:return`${de(s.entity,s.entity.project)} UUID must be a string`;case cs.UUIDMustNotContainSpaces:return`${de(s.entity,s.entity.project)} UUID must not contain spaces`;case cs.UUIDMustBeValidFormat:return`${de(s.entity,s.entity.project)} UUID must be in a valid format`;case Nn.MustBeUniqueAmongSameEntities:return`${de(s.entity,s.entity.project)} value must be unique among the same kind`;case Nn.StringValueMustNotHaveDashes:return`${de(s.entity,s.entity.project)} value must not contain dashes`;case Nn.StringValueMustNotHaveSpaces:return`${de(s.entity,s.entity.project)} value must not contain spaces`;default:return`${de(s.entity,s.entity.project)} Error: ${CE(s.code)}`}}function O1i(s){var p,i,r,a;switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return`${de(s.entity,s.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${de(s.entity,s.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements the template entity`;case be.IncorrectMethodImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements the template action it's based on`;case be.IncorrectPropertyImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements the template property it's based on`;case be.AbstractMethodInNonAbstractEntity:return`${de(s.entity,s.entity.project)} is a template action in a non-template entity`;case be.AbstractPropertyInNonAbstractEntity:return`${de(s.entity,s.entity.project)} is a template property in a non-template entity`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${de(s.entity,s.entity.project)} overwrites an action in the template entity`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${de(s.entity,s.entity.project)} overwrites a property in the template entity`;case be.MissingMethodImplementation:return`${de(s.entity,s.entity.project)} is missing an action implementation from the template entity`;case be.MissingPropertyImplementation:return`${de(s.entity,s.entity.project)} is missing a property implementation from the template entity`;case Ce.NameNotUniqueInScope:return`${de(s.entity,s.entity.project)} has a duplicate name in the same scope`;case be.NoProperties:return`${de(s.entity,s.entity.project)} has no properties, so it doesn't do anything`;case be.NonStaticPropertyInStaticEntity:return`${de(s.entity,s.entity.project)} has a non-static property in a static entity`;case be.StaticEntityWithNonStaticProperties:return`${de(s.entity,s.entity.project)} has non-static properties in a static entity`;case be.ReadingFromIncompatibleType:return`${de(s.entity,s.entity.project)} reads data from a value of a different data type`;case be.WritingToIncompatibleType:return`${de(s.entity,s.entity.project)} writes data to a value of a different data type`;case be.ScopeWithoutLogic:return`${de(s.entity,s.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${de(s.entity,s.entity.project)} has a static property in a non-static entity`;case be.PropertyImplementsIncompatibleType:return`${de(s.entity,s.entity.project)} implements a property of a different data type`;case be.PropertyImplementsNonAbstact:return`${de(s.entity,s.entity.project)} implements a non-template property`;case be.StaticPropertyImplementsNonStatic:return`${de(s.entity,s.entity.project)} has a static property in a non-static entity`;case be.VariableCallsOthersAndHasInternalCall:return`${de(s.entity,s.entity.project)} calls other entities while being used to execute internal logic`;case be.VariableHasInputsAndInternalCall:return`${de(s.entity,s.entity.project)} has inputs while being used to execute internal logic`;case be.VariableHasOutputsAndInternalCall:return`${de(s.entity,s.entity.project)} has outputs while being used to execute internal logic`;case be.VariableIsCalledAndHasInternalCall:return`${de(s.entity,s.entity.project)} is called while being used to execute internal logic`;case Ce.InternalCallDeclarationIsInvalidType:return`${de(s.entity,s.entity.project)} has a declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${de(s.entity,s.entity.project)} has a declaration that is not found in ${(p=s.entity.parent.getDataType(null))!=null&&p.entity?de((i=s.entity.parent.getDataType(null))==null?void 0:i.entity,s.entity.project):"the variable's data-type entity"}`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${de(s.entity,s.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ce.InternalCallParentMissingDataType:return`${de(s.entity,s.entity.project)} is part of a variable with no data-type entity`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${de(s.entity,s.entity.project)} has a declaration doesn't belong to ${(r=s.entity.parent.getDataType(null))!=null&&r.entity?de((a=s.entity.parent.getDataType(null))==null?void 0:a.entity,s.entity.project):"the variable's data-type entity"}`;case Ce.UnreachableEntity:return`${de(s.entity,s.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${de(s.entity,s.entity.project)} is disconnected and won't be executed by anything after publishing`;case be.AbstractEntityImplements:return`${de(s.entity,s.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${de(s.entity,s.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${de(s.entity,s.entity.project)} has an invalid combination of properties`;case be.ExtendingNonInteractiveEntity:return`${de(s.entity,s.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${de(s.entity,s.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${de(s.entity,s.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${de(s.entity,s.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${de(s.entity,s.entity.project)} has branches that don't terminate`;case be.LastCalledEntityMustBeReturnEntity:return`${de(s.entity,s.entity.project)} must end with a termination node`;case be.MissingRequiredValue:return`${de(s.entity,s.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${de(s.entity,s.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${de(s.entity,s.entity.project)} is a non-template entity extending a template entity`;case be.NonStaticExtendingStaticEntity:return`${de(s.entity,s.entity.project)} is a non-static entity extending a static entity`;case be.NonStaticImplementingStaticEntity:return`${de(s.entity,s.entity.project)} is a non-static entity implementing a static entity`;case be.StaticExtendingNonStaticEntity:return`${de(s.entity,s.entity.project)} is a static entity extending a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${de(s.entity,s.entity.project)} is a static entity implementing a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${de(s.entity,s.entity.project)} reads a value and has an internal call`;case be.VariableWritesValuesAndInternalCall:return`${de(s.entity,s.entity.project)} writes values and has an internal call`;case Ce.EmptyName:return`${ds[s.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${de(s.entity,s.entity.project)} has an invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${de(s.entity,s.entity.project)}'s loop body action overwrites`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites a base action with same implementation`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${de(s.entity,s.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${de(s.entity,s.entity.project)} has a name that is not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${de(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${de(s.entity,s.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${de(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites a base property with same implementation`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${de(s.entity,s.entity.project)} has a reader/writer with incompatible data type`;case Td.StatusCodeMustBeBetween100And599:return`${de(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case Td.StatusCodeMustBeNumber:return`${de(s.entity,s.entity.project)} HTTP status code must be a number, between 100 and 599`;case cs.UUIDMustBeString:return`${de(s.entity,s.entity.project)} UUID must be a string, eg: "${vp()}"`;case cs.UUIDMustNotContainSpaces:return`${de(s.entity,s.entity.project)} UUID must not contain spaces, eg: "${vp()}"`;case cs.UUIDMustBeValidFormat:return`${de(s.entity,s.entity.project)} UUID must be in a valid format. Eg: "${vp()}"`;case Nn.MustBeUniqueAmongSameEntities:return`${de(s.entity,s.entity.project)} value must be unique among the same kind`;case Nn.StringValueMustNotHaveDashes:return`${de(s.entity,s.entity.project)} value must not contain dashes`;case Nn.StringValueMustNotHaveSpaces:return`${de(s.entity,s.entity.project)} value must not contain spaces`;default:return`${de(s.entity,s.entity.project)} Error: ${CE(s.code)}`}}function OE(s){const p=(s||"").startsWith("error-caller-only--");switch(p?s.replace("error-caller-only--",""):s){case Yt.CallIsInHigherScope:return"In a higher scope";case Yt.CallIsInLowerScope:return"In a lower scope";case Yt.CallerIsInHigherScope:return"Caller is in a higher scope";case Yt.CallerIsInLowerScope:return"Caller is in a lower scope";case Yt.CannotBeCalledByChildren:return"Cannot be called by children";case Yt.CannotCallAncestor:return"Cannot call ancestor";case Yt.CannotConnectToItself:return"Cannot connect to itself";case Yt.CannotReadMoreThanOneValue:return"Cannot read more than one value";case Yt.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case Yt.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case hv.Suggestion:return"Suggestion";case Yt.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case Yt.DataTypesNotCompatible:return"Data types not compatible";case Yt.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case Yt.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case Yt.ExecutionsAlreadyConnected:return"Executions already connected";case Yt.IsNotValueReadingEntity:return"Is not a value reading entity";case Yt.IsNotValueWritingEntity:return"Is not a value writing entity";case Yt.NotInScope:return"Not in a compatible scope";case Yt.OtherIncompatibleScopeReason:return"Incompatible scope";case Yt.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case Yt.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case Yt.ValuesAlreadyConnected:return"Values already connected";case Yt.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case Yt.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case hv.CanvasGloballyDisabled:return"Canvas is globally disabled";case Yt.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case Yt.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case Yt.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case Yt.CannotConnectToOwnNode:return"It is part of the same node";case Yt.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case Yt.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case Yt.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:return"Cannot change scope because it is already called by other entities in different scope";case Yt.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case Yt.CalledBySourceMustBeCallerEntity:return"Not a caller type";case Yt.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case Yt.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case Yt.RedundantCall:return"Redundant call. Already connected further down the execution path";case Yt.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case Yt.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case Yt.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case Yt.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case Yt.EntityAlreadyCalledBySuccessCannotBeConnectedToUnrelatedErrorBranch:return p?"Cannot connect error: Already connected to a success branch from a common origin caller":"Already connected to a success branch from a common origin caller";case Yt.CannotInteractWithInputInGlobalVariableDeclaration:return"Cannot interact with input in global variable declaration";case Yt.IsNotCallableEntity:return"Is not a callable node type";case Yt.IsNotCallerEntity:return"Is not a caller node type";case Yt.IsNotPassThroughCallableEntity:return"Is not a pass-through callable node type that has an error branch";case Yt.NotAConnectableEntityType:return"Not a connectable node type";case Yt.WouldMakeAnEarlierNodeBeCalledBeforeItsDeclaration:return"Would make an earlier node be called before its declaration";default:return $c(s||"")}}function _1i(s,p){const i=[...s,...p],r=Array.from(new Set(i));return{hasChanged:r.length!==s.length,reasons:r}}function V1i(s,p){const i=s.filter(a=>!p.includes(a));return{hasChanged:i.length!==s.length,reasons:i}}function P1i(s,p){return s.find(i=>i.entity.id===p)||null}function oU(s){return s.filter((p,i)=>s.indexOf(p)===i)}class rn{constructor(p,i,r=null,a){R(this,"ids",[]);R(this,"entity");R(this,"entityCardHeight");R(this,"entityCardWidth");R(this,"index");R(this,"childEntities",[]);R(this,"children",[]);R(this,"parents",[]);R(this,"calculationEntryPoint");R(this,"_onlyEntities",null);R(this,"_changeSet",null);if(this.index=i,this.entity=p,this.calculationEntryPoint=r||this,this._changeSet=a||null,this===this.calculationEntryPoint&&!a)throw new Error("Change-set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(p,i,r){const a=TMe-Bg-T$,c=vMe-hg-v$;p.type===d.Project?(p.x=a,p.y=c):p.metaSync({x:p.x||a,y:p.y||c},i);const e=new rn(p,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),rn.recursivelyAssembleChildrenAreas(f),e.resolveChildrenOverlaps();const h=e.flattenChildEntities();return e._onlyEntities?h.filter(m=>{var E;return(E=e._onlyEntities)==null?void 0:E.includes(m)}):h}static recursivelyAssembleChildrenAreas(p){const i=[];p.forEach(r=>{r.next(a=>{i.push(...a)})}),i.length>0&&rn.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(a=>a.entity===p);return i||this.children.reduce((a,c)=>a||c.findAreaInChildrenFromEntity(p),null)}findAreaFromEntity(p){if(this.entity===p)return this;const i=this.calculationEntryPoint.children,r=i.find(c=>c.entity===p);return r||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(p),null)}addParent(p){if(!this.parents.includes(p)){const i=rn.resolveIds(p,this.index);this.ids.push(...i),this.parents.push(p)}}static resolveIds(p,i){return p?p.ids.map(r=>`${r}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const p=oo(this.entity,!0);if(this.entity.type===d.Project){const i=[],r=[],a=[];p.forEach(e=>{if(d.DefinitionEntity===e.type){r.push(e);return}else if(Gt.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!Wg(e,f).length,m=oo(e),E=oo(f);return h?0:m.length&&!E.length?-1:!m.length&&E.length?1:0}).filter(e=>!jc(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];Qi.includes(this.entity.type)&&oD(this.entity).forEach(m=>{if(Lt.includes(m.type)){a.push(m);return}const E=yt(m);i.push(E)}),gr.includes(this.entity.type)&&r.push(...this.entity.detachedChildren);const f=p.filter(h=>{const m=i.includes(h);return m||a.includes(h)||r.includes(h)?!1:Lt.includes(h.type)?(a.push(h),!1):rr.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>ro(h,m)?-1:0),c.sort((h,m)=>ro(h,m)?-1:0),a.sort((h,m)=>vV(h,m)?1:vV(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const p=EMe(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 r=p.filter(c=>!i.includes(c));return r.reduce((c,e)=>i.includes(e)?c:rn.getBoundriesOfTwoAreas(c,e.fullBranchArea),r[0].fullBranchArea)}getFullAreaUntilAny(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!p.includes(e)).map(e=>e.getFullAreaUntilAny(p)).reduce((e,f)=>rn.getBoundriesOfTwoAreas(e,f),i)}getFullAreaUntilAreaOrAnyChildren(p){const i=[p,...p.flattenChildren()],r=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(p)).reduce((e,f)=>rn.getBoundriesOfTwoAreas(e,f),r)}getFullAreaUntil(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==p).map(c=>c.getFullAreaUntil(p)).reduce((c,e)=>rn.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>rn.getBoundriesOfTwoAreas(a,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+hg,right:p.right+Bg}}static filterOutRepeatedAreas(p){return p.filter((i,r)=>p.indexOf(i)===r)}getEarliestId(p,i){const r=p.split("-"),a=i.split("-");return r.length<a.length?p:r.length>a.length?i:r.reduce((e,f,h)=>f<a[h]?p:i,p)}getEarliestLevel(){return this.ids.reduce((r,a)=>this.getEarliestId(r,a),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const r=this.parents.reduce((a,c)=>c.getEarliestLevel()>a.getEarliestLevel()?c:a,this.parents[0]).countColumns();return p+=r,p}getLatestId(p,i){if(p===i)return p;const r=p.split("-"),a=i.split("-");return r.length<a.length?i:r.length>a.length?p:r.reduce((e,f,h)=>f>a[h]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((r,a)=>this.getLatestId(r,a),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(r=>{r!==this.calculationEntryPoint&&r.shiftDownAlone(i)})}else if([...Gt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(r=>!this.parents.includes(r));i.length?i.every(a=>{const c=this.countColumns(),e=a.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 r=[...p,this];return this.children.forEach(a=>{if(rn.getEarliestParentInChain(a)!==this)return;const e=P1i(r,a.entity.id);r=rn.filterOutRepeatedAreas([...r]),e||(r=r.filter(h=>h!==a));const f=a.shiftDownUntilAny(r,i);r.push(...f)}),r}shiftRightUntilAny(p,i){p.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(r=>{const a=rn.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);rn.getEarliestParentInChain(r)===this&&r.shiftRightUntilAny(a,i)}))}shiftRight(p){this.move(this.entity,{x:this.entity.x+p}),this.children.forEach(i=>{const a=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(a,p)})}shiftDownAlone(p){this.move(this.entity,{y:this.entity.y+p})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const p=this.parents.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+Tf,h={top:f,left:e.left,bottom:f,right:e.right};return rn.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-Tf;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+Tf,h={top:f,left:e.left,bottom:f,right:e.right};return rn.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-Tf;return this.shiftDownAlone(r),r}resolveChildrenOverlaps(){const p=this.flattenChildren();let i=[];p.forEach(r=>{const a=r.adjustVerticallyToAvoidOverlaps();i.push(...a)}),p.forEach(r=>{r.smoothPosition()})}static getEarliestParentInChain(p){let i=p.parents[0];return p.parents.length&&(i=p.parents.sort((r,a)=>{if(!r.ids.length)return-1;if(!a.ids.length)return 1;const c=r.ids.sort((f,h)=>f.length<h.length?-1:0),e=a.ids.sort((f,h)=>f.length<h.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((r,a)=>{if(p.has(a.entity.id))return r;p.add(a.entity.id);const e=a.children.slice(0,a.children.indexOf(this)).reduce((f,h)=>[...f,h,...h.flattenChildren(p)],[]);return[...r,...e]},[])}flattenSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((r,a)=>{if(p.has(a.entity.id))return r;p.add(a.entity.id);const e=a.children.filter(f=>f!==this).reduce((f,h)=>[...f,h,...h.flattenChildren(p)],[]);return[...r,...e]},[])}flattenChildren(p=new Set){return this.children.reduce((i,r)=>p.has(r.entity.id)?i:(p.add(r.entity.id),[...i,r,...r.flattenChildren(p)]),[])}flattenParents(p=new Set){return this.parents.reduce((r,a)=>p.has(a.entity.id)?r:(p.add(a.entity.id),[...r,a,...a.flattenParents(p)]),[])}getAreaIfRendered(p){return this.calculationEntryPoint.flattenChildren().find(a=>a.entity.id===p.id)||null}getLowerSiblings(){const p=this.parents.reduce((i,r)=>{const a=r.children.indexOf(this),c=r.children.slice(a+1);return[...i,...c]},[]);return oU(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return oU([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const r=rn.getEarliestParentInChain(this).children[this.index-1];if(!r)return p;const a=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...a,...c,r],m=C(e.flatMap(_=>Wg(this.entity,_.entity))).filter(_=>_.id!==this.entity.id).map(_=>this.findAreaFromEntity(_)).filter(_=>!!_),E=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),A=e.reduce((_,P)=>P===this||P.fullBranchArea.left!==E.left?_:Math.max(_,P.fullBranchArea.bottom),b.bottom);if(E.top<A){const _=A-E.top+hg;return this.shiftDownUntilAny(p,_)}return p}move(p,i){if(this.onlyEntities.includes(p)){if(!this.changeSet)throw new Error("Change set is not defined for this area, cannot move entity");p.metaSync(i,this.changeSet)}}addChild(p){const i=this.childEntities[p];let r=null;i.x&&i.y?r=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),r||(r=new rn(i,p,this.calculationEntryPoint));const a=this.ownEntityPlusBufferArea;this.children.includes(r)||(this.children.push(r),r.addParent(this));const c=r.fullBranchArea;if(c.left<a.right){const e=a.right-c.left;r.shiftRight(e)}return r}flattenChildEntities(p=new Set){return this.children.reduce((i,r)=>p.has(r.entity.id)?i:(p.add(r.entity.id),[...i,r.entity,...r.flattenChildEntities(p)]),[])}next(p){const i=[];this.childEntities.forEach((r,a)=>{const c=this.addChild(a);c&&i.push(c)}),p(i)}}async function N1i(s,p,i={}){var c;const r=Y.YieldTracker.from(i),a=[];console.log("Generating layout for project...");for(const e of s.instancesList){if(s.diggestedBuiltInBaseEntitiesIds.has(e.id)||!Pf.includes(e.type)||((c=yt(e))==null?void 0:c.id)!==e.id)continue;let f=kt(e,s);if(!f){console.log("No top scope owner for instance: ",e," in project: ",s);continue}if(!(Gt.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s;)f=f.parent,Gt.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,W.Updated),a.push(e),await r.tick()}}rn.autoGenerateLayout(s,p,a)}async function x1i(s,p,i={}){const r=Y.YieldTracker.from(i),a=[],c=[s,...pt(s)].map(e=>yt(e)).filter(Boolean);for(const e of c){if(s.project.diggestedBuiltInBaseEntitiesIds.has(e.id))continue;let f=kt(e,s.project);if(f&&!(Gt.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s.project;)f=f.parent,Gt.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,W.Updated),a.push(e),await r.tick()}}rn.autoGenerateLayout(s.project,p,a)}async function $1i(s,p,i={}){const r=Y.YieldTracker.from(i),a=[],c=new Set;yKe(p,{shallowMissingActivesError:!0,excludeAffected:!0}).forEach(m=>{var b;if((!m.x||!m.y)&&!c.has(m.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(m.id)&&(a.push(m),c.add(m.id)),co(m,s)){const A=yt(m);A&&!c.has(A.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(A.id)&&(a.push(A),c.add(A.id))}if(Qi.includes(m.type)){const A=m;[A,...pt(A)].forEach(P=>{const V=yt(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))})}m.type===d.DefinitionEntity&&m.methods.forEach(A=>{pt(A).forEach(P=>{const V=yt(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))})}),((b=m.parent)==null?void 0:b.type)===d.Project&&(a.push(m),c.add(m.id),Qi.includes(m.type)&&pt(m).forEach(P=>{const V=yt(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))}))});let f=[];for(const m of a)s.diggestedBuiltInBaseEntitiesIds.has(m.id)||(m.x=0,m.y=0,p==null||p.add(m,W.Updated),f.push(m),await r.tick());f=C(f),rn.autoGenerateLayout(s,p,f);const h=C([...f,...s.variableDeclarations,...s.variableInstances,...s.loops,...s.conditions,...s.operations,...s.searches]).filter(m=>m.x===0||m.y===0);rn.autoGenerateLayout(s,p,h)}var $T=(s=>(s.Amazon="amazon",s.Google="google",s.Microsoft="microsoft",s))($T||{}),br=(s=>(s.RelationalDatabase="relational-database",s.CompiledLocalCodebase="compiled-local-codebase",s.CloudHostedCodebase="cloud-hosted-codebase",s.HttpApi="http-api",s.HttpEndpoint="http-endpoint",s.ServerlessFunction="serverless-function",s.CronJob="cron-job",s.AWSTenantAccount="aws-tenant-account",s))(br||{}),S_=(s=>(s.Post="post",s.Get="get",s.Acknowledgement="acknowledgment",s.Progress="progress",s.Error="error",s.Complete="complete",s))(S_||{}),yf=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanedUp="cleaned-up",s.Skipped="skipped",s.AbortedByUser="aborted-by-user",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(yf||{}),Z_=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanedUp="cleaned-up",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(Z_||{}),qt=(s=>(s.ProjectNotFound="project-not-found",s.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",s.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",s.DeploymentCompleted="deployment-completed",s.DeploymentStarted="deployment-started",s.DeploymentFailed="deployment-failed",s.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",s.RequestPayloadValidationFailed="request-payload-validation-failed",s.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",s.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",s.ProjectAlreadyBeingPublished="project-already-being-published",s.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",s.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",s.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",s.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",s.CreatingNewRelationalDatabase="creating-new-relational-database",s.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",s.RelationalDatabaseAlreadyExists="relational-database-already-exists",s.RelationalDatabaseDeletionStarted="relational-database-deletion-started",s.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",s.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",s.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",s.HttpApiDeploymentStarted="http-api-deployment-started",s.HttpApiDeploymentCompleted="http-api-deployment-completed",s.HttpApiDeploymentFailed="http-api-deployment-failed",s.CreatingNewHttpApi="creating-new-http-api",s.HttpApiAlreadyExists="http-api-already-exists",s.HttpApiDeletionStarted="http-api-deletion-started",s.HttpApiDeletionCompleted="http-api-deletion-completed",s.HttpApiDeletionFailed="http-api-deletion-failed",s.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",s.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",s.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",s.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",s.BundlingCodebaseForDownload="bundling-codebase-for-download",s.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",s.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",s.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",s.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",s.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",s.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",s.CodeCompilationStarted="code-compilation-started",s.CodeCompilationCompleted="code-compilation-completed",s.CodeCompilationFailed="code-compilation-failed",s.BundleCodebaseStarted="bundle-codebase-started",s.BundleCodebaseCompleted="bundle-codebase-completed",s.BundleCodebaseFailed="bundle-codebase-failed",s.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",s.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",s.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",s.MigrateRelationalDatabaseStarted="migrate-relational-database-started",s.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",s.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",s.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",s.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",s.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",s.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",s.AWSTenantAccountProvisioningStarted="aws-tenant-account-provisioning-started",s.AWSTenantAccountProvisioningCompleted="aws-tenant-account-provisioning-completed",s.AWSTenantAccountProvisioningFailed="aws-tenant-account-provisioning-failed",s))(qt||{}),Ql=(s=>(s.CodeCompilation="code-compilation",s.RelationalDatabaseDeployment="relational-database-deployment",s.RelationalDatabaseDeletion="relational-database-deletion",s.HttpApiDeployment="http-api-deployment",s.HttpApiDeletion="http-api-deletion",s.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",s.BundleCodebase="bundle-codebase",s.MigrateRelationalDatabase="migrate-relational-database",s.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",s.ExecutePublicationCompletedEvent="execute-publication-completed-event",s.CodebaseCleanup="codebase-cleanup",s.AWSTenantAccountProvisioning="aws-tenant-account-provisioning",s))(Ql||{});br.CloudHostedCodebase,br.HttpApi,br.RelationalDatabase,br.CloudHostedCodebase,br.CloudHostedCodebase,br.RelationalDatabase,br.CloudHostedCodebase,br.CloudHostedCodebase;function AMe(s){return`project-${s}-http-api`}function _1(s){return`entity-${s}-database`}class gMe{constructor(p,i,r,a,c,e,f,h,m){R(this,"stepType");R(this,"id");R(this,"resourceType");R(this,"index");R(this,"dependency",[]);R(this,"lastEvent",null);R(this,"lastEventTimestamp",null);R(this,"status",yf.Queued);R(this,"publicationRun");R(this,"resource");this.stepType=p,this.id=i,this.resourceType=r,this.status=a,this.dependency=c,this.index=e,this.lastEventTimestamp=f,this.publicationRun=h,this.resource=m}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,r;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,(r=this.resource)==null||r.setDetails((i=p.resource)==null?void 0:i.details)}}var IMe=(s=>(s.Ready="ready",s.Provisioning="provisioning",s.Queued="queued",s.ProvisioningFailed="provisioning-failed",s.Deleting="deleting",s.DeletingFailed="deleting-failed",s.Deleted="deleted",s))(IMe||{});class Lc{constructor(p,i,r){R(this,"provisionedBy");R(this,"publicationRun");R(this,"resourceType");R(this,"provider");R(this,"resourceId");R(this,"details",null);R(this,"name",null);R(this,"status","queued");this.publicationRun=p,this.resourceType=i,this.provider=r}setDetails(p){this.details=p}setStatus(p){this.status=p}setProvisionedBy(p){this.provisionedBy=p}}class L1i extends Lc{constructor(i,r,a){super(i,br.HttpEndpoint,a);R(this,"resourceType",br.HttpEndpoint);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=_1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class B1i extends Lc{constructor(i,r,a){super(i,br.ServerlessFunction,a);R(this,"resourceType",br.ServerlessFunction);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=_1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class RMe extends Lc{constructor(i,r,a){super(i,br.HttpApi,a);R(this,"resourceType",br.HttpApi);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=AMe(this.publicationRun.project.id),this.resourceId}}class DMe extends Lc{constructor(i,r,a){super(i,br.RelationalDatabase,a);R(this,"resourceType",br.RelationalDatabase);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=_1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class wMe extends Lc{constructor(i,r){super(i,br.CloudHostedCodebase,r);R(this,"resourceType",br.CloudHostedCodebase);R(this,"details",null);R(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class CMe extends Lc{constructor(i,r){super(i,br.CompiledLocalCodebase,r);R(this,"resourceType",br.CompiledLocalCodebase);R(this,"details",null);R(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 M1i extends Lc{constructor(i,r){super(i,br.AWSTenantAccount,r);R(this,"resourceType",br.AWSTenantAccount);R(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`aws-tenant-account--${this.publicationRun.project.id}`,this.resourceId}}class G1i{constructor(p,i){R(this,"id");R(this,"projectAutoIncrementPublicationCount");R(this,"projectPublishedSemanticVersion");R(this,"envIdentifier");R(this,"projectVersion");R(this,"projectBranchId");R(this,"projectId");R(this,"triggeredBy");R(this,"createdAt");R(this,"updatedAt");R(this,"status");R(this,"steps",[]);R(this,"editor");R(this,"explicitResources",new Map);R(this,"implicitGlobalResources",new Map);R(this,"finalGlobalEvent",null);R(this,"finalStatus",null);R(this,"contextType",ae.PublicationRun);R(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.envIdentifier=p.envIdentifier,this.projectVersion=p.projectVersion,this.projectBranchId=p.projectBranchId,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(r=>r.owners.has(p.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(br.CompiledLocalCodebase,new CMe(this,$T.Amazon)),this.implicitGlobalResources.set(br.CloudHostedCodebase,new wMe(this,$T.Amazon));const p=this.project.entities.filter(r=>si(r,Ae.HTTP_ENDPOINT)),i=this.project.entities.filter(r=>si(r,Ae.RELATIONAL_DATABASE));if(i.length&&i.forEach(r=>{const a=new DMe(this,[r],$T.Amazon);this.explicitResources.set(a.resourceId,a)}),p.length){const r=new RMe(this,p,$T.Amazon);this.explicitResources.set(r.resourceId,r)}}setSteps(p,i){p.forEach(r=>{this.addStep(r,i)}),this.editor.events.emit(qt.ProjectPublishRequestAcknowledged,{})}addStep(p,i){const r=p.dependency||[];if(r.length){const c=r.filter(e=>!this.steps.find(f=>f.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===p.id)){const c=new gMe(p.stepType,p.id,p.resourceType,p.status,r,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(Y.Logger.log("onUpdate",p),(i=p.payload)!=null&&i.stepType){const r=this.steps.find(a=>{var c;return a.id===((c=p.payload)==null?void 0:c.id)});r&&B(p.emittedAt).isAfter(B(r.lastEventTimestamp))&&r.update(p.payload)}this.editor.events.emit("publication-updated",{}),p.type===S_.Error?(this.finalStatus=Z_.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===S_.Complete&&(this.finalStatus=Z_.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 p$(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(ae.PublicationRun),this.extensionsRegistry}}function j1i(s){switch(s){case Ql.CodeCompilation:return"Code generation";case Ql.RelationalDatabaseDeployment:return"Database creation";case Ql.HttpApiDeployment:return"HTTP gateway creation";case Ql.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Ql.BundleCodebase:return"Bundle code";case Ql.MigrateRelationalDatabase:return"Database structure migration";case Ql.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Ql.CodebaseCleanup:return"Code cleanup";case Ql.HttpApiDeletion:return"HTTP gateway deletion";case Ql.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function k1i(s){switch(s){case qt.DeploymentCompleted:return"Successfully published";case qt.DeploymentStarted:return"Publication started";case qt.DeploymentFailed:return"Publication failed";case qt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case qt.RequestPayloadValidationFailed:return"Request payload validation failed";case qt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case qt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case qt.RelationalDatabaseDeploymentStarted:return"Database creation started";case qt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case qt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case qt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case qt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case qt.RelationalDatabaseAlreadyExists:return"Database already exists";case qt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case qt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case qt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case qt.CreatingNewHttpApi:return"Creating new HTTP gateway";case qt.HttpApiAlreadyExists:return"HTTP gateway already exists";case qt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case qt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case qt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case qt.BundlingCodebaseForDownload:return"Bundling code for download";case qt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case qt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case qt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case qt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case qt.CodeCompilationStarted:return"Code generation started";case qt.CodeCompilationCompleted:return"Code generation completed";case qt.CodeCompilationFailed:return"Code generation failed";case qt.BundleCodebaseStarted:return"Code bundling started";case qt.BundleCodebaseCompleted:return"Code bundling completed";case qt.BundleCodebaseFailed:return"Code bundling failed";case qt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case qt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case qt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case qt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case qt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case qt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case qt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case qt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case qt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case qt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case qt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case qt.ProjectNotFound:return"Project not found";case qt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case qt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case qt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case qt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case qt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case qt.RelationalDatabaseDeletionStarted:return"Database deletion started";case qt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case qt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case qt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var OMe=(s=>(s.NO_LOGIC="NO_LOGIC",s.NO_NAME="NO_NAME",s.NO_CHANGES="NO_CHANGES",s.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",s))(OMe||{});function U1i(s){switch(s){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 F1i(s){switch(s){case br.RelationalDatabase:return"Relational database";case br.HttpEndpoint:case br.HttpApi:return"HTTP endpoints";case br.ServerlessFunction:case br.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function K1i(s){switch(s){case yf.Running:return"In progress";case yf.Failed:return"Failed";case yf.Success:return"Succeeded";case yf.Skipped:return"Skipped";case yf.Queued:default:return"Queued"}}function _Me(s){var r;if(!si(s,Ae.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=re["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(s.type===d.BuiltInBaseEntity?si(s,Ae.EXTERNAL_INTEGRATION_CONNECTION)&&(p=H_(s.name)):s.type===d.DefinitionEntity&&s.implements.forEach(a=>{if(si(a,Ae.EXTERNAL_INTEGRATION_CONNECTION)){const c=H_(a==null?void 0:a.name);if(c)return p=c,!0}}),!p){const a=s.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var f;return((f=e.extends)==null?void 0:f.id)===i}));p=(r=a==null?void 0:a.getDefaultValue())==null?void 0:r.value}return p}function q1i(s){return pTe[s]}function H_(s){return s.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?s.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function VMe(s){if(s.type!==d.ActionDescriptor&&s.type!==d.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(s.type===d.ActionDescriptor){const p=s;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(s.type===d.Operation){const p=s.declaration;if(Object.values(hi).includes(p.id))return p.id.split("--")[1]||null}return null}function S1i(s){if(!s)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(Ae).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===s.toLowerCase()))||null}function Z1i(s){return s.type===d.BuiltInBaseEntity||s.type===d.DefinitionEntity?_Me(s):s.type===d.ActionDescriptor||s.type===d.Operation?VMe(s):null}function PMe(s){var a,c,e;if(!si(s,Ae.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=nKe(s,Ae.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const r=re["built-in-base-entity"][i.id].properties.connectionId.id;if(s.type===d.BuiltInBaseEntity){if(si(s,Ae.EXTERNAL_INTEGRATION_CONNECTION)){const f=s.properties.find(h=>{var m;return((m=h.extends)==null?void 0:m.id)===r});f&&(p=(a=f.getDefaultValue())==null?void 0:a.value)}}else if(s.type===d.DefinitionEntity){const f=s.properties.find(h=>!!h.implements.find(m=>m.id===r)||!!h.implements.find(m=>{var E;return((E=m.extends)==null?void 0:E.id)===r}));if(!f&&((c=s.extends)==null?void 0:c.type)===d.DefinitionEntity)return PMe(s.extends);p=(e=f==null?void 0:f.getDefaultValue())==null?void 0:e.value}return p}async function NMe(s,p={}){var f;const i=Y.YieldTracker.from(p),a=[...Aa(s),...In(s),...b$(s),...ga(s),...A$(s)],c=WE(s);a.push(...c);const e=St(s.errors,a);await i.tick();for(const h of s.inputs)await h.validateAsync({tracker:i});for(const h of s.outputs)await h.validateAsync({tracker:i});for(const h of s.internalCalls)await h.validateAsync({tracker:i});return await((f=s.dataType)==null?void 0:f.validateAsync({tracker:i})),e}function xMe(s){var a;(a=s.dataType)==null||a.validate(),s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),s.internalCalls.forEach(c=>c.validate());const i=[...Aa(s),...In(s),...b$(s),...ga(s),...A$(s)],r=WE(s);return i.push(...r),St(s.errors,i)}function b$(s,p){const r=[...s.project.getVariableDeclarations()].filter(a=>a.id!==s.id);return YE(s,[Xi],r,p)}function A$(s){const p=[];if(s.parent!==s.project)return p;if(s.catchesError){const i=gt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotCatchError}`,message:`${ds[s.type].singular} "${de(s,s.project)}" with id "${s.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotCatchError,entity:s});p.push(i.error)}if(s.errorCalls.length){const i=gt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotCallOnError}`,message:`${ds[s.type].singular} "${de(s,s.project)}" with id "${s.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotCallOnError,entity:s});p.push(i.error)}if(s.calledBy.length){const i=gt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotBeCalled}`,message:`${ds[s.type].singular} "${de(s,s.project)}" with id "${s.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotBeCalled,entity:s});p.push(i.error)}return[]}const H1i=Object.freeze(Object.defineProperty({__proto__:null,validate:xMe,validateAsync:NMe,validateGlobalVariableDeclaration:A$,validateVariableDeclarationName:b$},Symbol.toStringTag,{value:"Module"}));async function $Me(s,p={}){const i=Y.YieldTracker.from(p),a=[...Aa(s),...In(s),...ga(s),...ad(s),...BMe(s)],c=WE(s);a.push(...c);const e=St(s.errors,a);await i.tick();for(const f of s.inputs)await f.validateAsync({tracker:i});for(const f of s.outputs)await f.validateAsync({tracker:i});for(const f of s.internalCalls)await f.validateAsync({tracker:i});return e}function LMe(s){s.inputs.forEach(a=>a.validate()),s.outputs.forEach(a=>a.validate()),s.internalCalls.forEach(a=>a.validate());const i=[...Aa(s),...In(s),...ga(s)],r=WE(s);return i.push(...r),St(s.errors,i)}function BMe(s){const p=[],i=s.declaration.constant;if(i&&s.readsValue){const r=gt({id:`${s.id}--${be.ValueReadingOverridesConstantVariable}`,message:`The '${s.type}' entity "${de(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:Te.Error,code:be.ValueReadingOverridesConstantVariable,entity:s});p.push(r.error)}if(i&&s.defaultValue){const r=gt({id:`${s.id}--${be.DefaultValueOverridesConstantVariable}`,message:`The '${s.type}' entity "${de(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:Te.Error,code:be.DefaultValueOverridesConstantVariable,entity:s});p.push(r.error)}return p}function ad(s){var h;const p=[],i=s.declaration;if((i==null?void 0:i.id)===((h=s.parent)==null?void 0:h.id)||!s.calledBy.length&&!s.successCalls.length&&!s.errorCalls.length&&s.usedInternalCalls.length)return p;const r=pt(s),a=pt(i);!!r.find(m=>m.id===i.id)&&p.push(gt({id:`${s.id}--${be.CalledBeforeDeclaration}`,code:be.CalledBeforeDeclaration,severity:Te.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
54
+ `+c):r.stack=c}catch{}}throw r}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=Df(this.defaults,i);const{transitional:r,paramsSerializer:a,headers:c}=i;r!==void 0&&cg.assertOptions(r,{silentJSONParsing:yl.transitional(yl.boolean),forcedJSONParsing:yl.transitional(yl.boolean),clarifyTimeoutError:yl.transitional(yl.boolean),legacyInterceptorReqResOrdering:yl.transitional(yl.boolean)},!1),a!=null&&(qe.isFunction(a)?i.paramsSerializer={serialize:a}:cg.assertOptions(a,{encode:yl.function,serialize:yl.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),cg.assertOptions(i,{baseUrl:yl.spelling("baseURL"),withXsrfToken:yl.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&qe.merge(c.common,c[i.method]);c&&qe.forEach(["delete","get","head","post","put","patch","common"],P=>{delete c[P]}),i.headers=ao.concat(e,c);const f=[];let h=!0;this.interceptors.request.forEach(function(V){if(typeof V.runWhen=="function"&&V.runWhen(i)===!1)return;h=h&&V.synchronous;const j=i.transitional||n$;j&&j.legacyInterceptorReqResOrdering?f.unshift(V.fulfilled,V.rejected):f.push(V.fulfilled,V.rejected)});const m=[];this.interceptors.response.forEach(function(V){m.push(V.fulfilled,V.rejected)});let E,b=0,A;if(!h){const P=[aU.bind(this),void 0];for(P.unshift(...f),P.push(...m),A=P.length,E=Promise.resolve(i);b<A;)E=E.then(P[b++],P[b++]);return E}A=f.length;let _=i;for(;b<A;){const P=f[b++],V=f[b++];try{_=P(_)}catch(j){V.call(this,j);break}}try{E=aU.call(this,_)}catch(P){return Promise.reject(P)}for(b=0,A=m.length;b<A;)E=E.then(m[b++],m[b++]);return E}getUri(p){p=Df(this.defaults,p);const i=S2e(p.baseURL,p.url,p.allowAbsoluteUrls);return U2e(i,p.params,p.paramsSerializer)}}qe.forEach(["delete","get","head","options"],function(p){$g.prototype[p]=function(i,r){return this.request(Df(r||{},{method:p,url:i,data:(r||{}).data}))}});qe.forEach(["post","put","patch"],function(p){function i(r){return function(c,e,f){return this.request(Df(f||{},{method:p,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}$g.prototype[p]=i(),$g.prototype[p+"Form"]=i(!0)});const fg=$g;class d${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 r=this;this.promise.then(a=>{if(!r._listeners)return;let c=r._listeners.length;for(;c-- >0;)r._listeners[c](a);r._listeners=null}),this.promise.then=a=>{let c;const e=new Promise(f=>{r.subscribe(f),c=f}).then(a);return e.cancel=function(){r.unsubscribe(c)},e},p(function(c,e,f){r.reason||(r.reason=new wE(c,e,f),i(r.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=r=>{p.abort(r)};return this.subscribe(i),p.signal.unsubscribe=()=>this.unsubscribe(i),p.signal}static source(){let p;return{token:new d$(function(a){p=a}),cancel:p}}}const p1i=d$;function c1i(s){return function(i){return s.apply(null,i)}}function f1i(s){return qe.isObject(s)&&s.isAxiosError===!0}const F_={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(F_).forEach(([s,p])=>{F_[p]=s});const y1i=F_;function Y2e(s){const p=new fg(s),i=P2e(fg.prototype.request,p);return qe.extend(i,fg.prototype,p,{allOwnKeys:!0}),qe.extend(i,p,null,{allOwnKeys:!0}),i.create=function(a){return Y2e(Df(s,a))},i}const Fn=Y2e(l$);Fn.Axios=fg;Fn.CanceledError=wE;Fn.CancelToken=p1i;Fn.isCancel=K2e;Fn.VERSION=z2e;Fn.toFormData=g1;Fn.AxiosError=ir;Fn.Cancel=Fn.CanceledError;Fn.all=function(p){return Promise.all(p)};Fn.spread=c1i;Fn.isAxiosError=f1i;Fn.mergeConfig=Df;Fn.AxiosHeaders=ao;Fn.formToJSON=s=>F2e(qe.isHTMLForm(s)?new FormData(s):s);Fn.getAdapter=W2e.getAdapter;Fn.HttpStatusCode=y1i;Fn.default=Fn;const J2e=Fn;class Q2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Tn.HttpRequest);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e,f,h;try{const m=r.find(ee=>{var oe,ie;return((ie=(oe=ee.valueOwner)==null?void 0:oe.declaration)==null?void 0:ie.id)===re.operation[Tn.HttpRequest].inputs.method.id}),E=((a=m==null?void 0:m.value)==null?void 0:a.value)||"",b=r.find(ee=>{var oe,ie;return((ie=(oe=ee.valueOwner)==null?void 0:oe.declaration)==null?void 0:ie.id)===re.operation[Tn.HttpRequest].inputs.url.id}),A=((c=b==null?void 0:b.value)==null?void 0:c.value)||"",_=r.find(ee=>{var oe,ie;return((ie=(oe=ee.valueOwner)==null?void 0:oe.declaration)==null?void 0:ie.id)===re.operation[Tn.HttpRequest].inputs.query.id}),P=((e=_==null?void 0:_.value)==null?void 0:e.value)||"",V=r.find(ee=>{var oe,ie;return((ie=(oe=ee.valueOwner)==null?void 0:oe.declaration)==null?void 0:ie.id)===re.operation[Tn.HttpRequest].inputs.body.id}),j=((f=V==null?void 0:V.value)==null?void 0:f.value)||"",M=r.find(ee=>{var oe,ie;return((ie=(oe=ee.valueOwner)==null?void 0:oe.declaration)==null?void 0:ie.id)===re.operation[Tn.HttpRequest].inputs.headers.id}),G=((h=M==null?void 0:M.value)==null?void 0:h.value)||"",K={method:E,url:A,params:P,headers:G,data:j};Y.Logger.log("Axios request config: ",K);const ne=await J2e(K);return{value:U.Success,error:null,result:{status:ne.status,headers:ne.headers,data:ne.data}}}catch(m){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:m,result:null}}}})}}class X2e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SQL,version:"1.0.0",description:"Execute SQL operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(no.ExecuteSQL);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e;try{const f=r.find(_=>{var P,V;return((V=(P=_.valueOwner)==null?void 0:P.declaration)==null?void 0:V.id)===re.operation[no.ExecuteSQL].inputs.connectionConfig.id}),h=((a=f==null?void 0:f.value)==null?void 0:a.value)||"",m=r.find(_=>{var P,V;return((V=(P=_.valueOwner)==null?void 0:P.declaration)==null?void 0:V.id)===re.operation[no.ExecuteSQL].inputs.query.id}),E=((c=m==null?void 0:m.value)==null?void 0:c.value)||"",b=this.extensionsRegistry.requestContexts(this,[ae.Editor])[0],A=await J2e.post(((e=b.env)==null?void 0:e.API_BASE_URL)+"/editor-runtime/v1/execute-sql",{connectionConfig:h,query:E},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${await b.getAccessToken()}`}});return{value:U.Success,error:null,result:{results:A.data.results||[]}}}catch(f){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:f,result:null}}}})}}class eBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.Validate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)});Y.Logger.log("Inputs for entity validation: ",a);const e=hD(a[1]).safeParse(a[0]);return e.success?{value:U.Success,error:null,result:{data:a[0]}}:{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:e.error.errors,result:null}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}const Ya=s=>s.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class tBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.ReadKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ya(r),e=wVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class iBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=CVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class rBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.DeleteKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ya(r),e=OVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class nBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.ReadNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=_Ve(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class aBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.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:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=VVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class sBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.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:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.WriteSafeNestedKeyRecursively);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=PVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class lBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Le.DeleteNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ya(r),e=NVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class oBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.HasKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ya(r),e=xVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class dBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.KeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=$Ve(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class uBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.HasNestedKey);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ya(r),e=LVe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class pBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.NestedKeyValueEquals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ya(r),f=BVe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class cBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Le.IsInstanceOfType);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m,E,b,A,_;try{const P=((c=(a=r[0])==null?void 0:a.value)==null?void 0:c.parent)||((f=(e=r[0])==null?void 0:e.value)==null?void 0:f.standaloneParent),V=(m=(h=r[0])==null?void 0:h.value)==null?void 0:m.value,j=(b=(E=r[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!V)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!j)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!P)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 M=P.getDataType(null);if(((A=M==null?void 0:M.entity)==null?void 0:A.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let G=!1;return((_=M==null?void 0:M.entity)==null?void 0:_.id)!==(j==null?void 0:j.id)?G=!1:hD(M==null?void 0:M.entity).safeParse(V).success?G=!0:G=!1,{value:U.Success,error:null,result:G}}catch(P){return{value:U.UnhandledError,error:P,result:null}}}})}}class fBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Merge);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ya(r),c=MVe(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class yBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Keys);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ya(r),c=GVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class hBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Values);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ya(r),c=jVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class mBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Le.Entries);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ya(r),c=kVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}let js=null;try{js=require("crypto")}catch{}const qT=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:js&&js.webcrypto?js.webcrypto:null,Ep=qT?qT.subtle:null;function iv(s){const p=new ArrayBuffer(s.byteLength);return new Uint8Array(p).set(s),p}function fn(s,p="utf8"){if(s instanceof Uint8Array)return s;const i=String(s);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 r=i.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(r,"base64"));const a=typeof atob=="function"?atob(r):"",c=new Uint8Array(a.length);for(let e=0;e<a.length;e++)c[e]=a.charCodeAt(e);return c}throw new Error(`Unsupported environment/encoding combo for toBytes(${p})`)}function ko(s,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(s);if(typeof Buffer<"u")return Buffer.from(s).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(s).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(s).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(s).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const TBe=s=>fn(s,"base64"),vBe=(s,p)=>{const i=s instanceof Uint8Array?s:fn(String(s),p||"utf8");return ko(i,"base64")},wh=(s,p)=>{const i=s instanceof Uint8Array?s:fn(String(s),p||"utf8");return ko(i,"base64url")},wf=s=>fn(s,"base64url"),EBe=(s,p)=>{const i=s instanceof Uint8Array?s:fn(String(s),p||"utf8");return ko(i,"hex")},bBe=s=>fn(s,"hex");function u$(s){if(qT&&qT.getRandomValues){const p=new Uint8Array(s);return qT.getRandomValues(p),p}if(js&&js.randomBytes)return new Uint8Array(js.randomBytes(s));throw new Error("Secure random not available")}function D1(s,p){if(!(s instanceof Uint8Array)||!(p instanceof Uint8Array)||s.length!==p.length)return!1;let i=0;for(let r=0;r<s.length;r++)i|=s[r]^p[r];return i===0}function ABe(s,p,i,r){if((typeof s!="string"||typeof p!="string")&&typeof s!="string"&&typeof p!="string")throw new Error("Invalid input types");const a=i??"utf8",c=r??"utf8",e=fn(s??"",a),f=fn(p??"",c);return D1(e,f)}async function gBe(s,p){if(Ep){const i=await Ep.digest({name:s},iv(p));return new Uint8Array(i)}if(js){const i=s.replace("SHA-","sha"),r=js.createHash(i);return r.update(Buffer.from(p)),new Uint8Array(r.digest())}throw new Error("Hash not available")}async function IBe(s,p,i,r){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const a=String(s??"SHA-256"),c=i??"utf8",e=r??"base64url",f=fn(p??"",c),h=await gBe(a,f);return ko(h,e)}async function w1(s,p,i){if(Ep){const r=await Ep.importKey("raw",iv(p),{name:"HMAC",hash:{name:s}},!1,["sign"]),a=await Ep.sign("HMAC",r,iv(i));return new Uint8Array(a)}if(js){const r=`sha${s.split("-")[1]}`,a=js.createHmac(r,Buffer.from(p));return a.update(Buffer.from(i)),new Uint8Array(a.digest())}throw new Error("HMAC not available")}async function RBe(s,p,i,r,a,c){if(typeof s!="string"||typeof p!="string")throw new Error("Invalid input types for key or data; expected strings");const e=String(i??"SHA-256"),f=r??"utf8",h=a??"utf8",m=c??"base64url",E=fn(s??"",f),b=fn(p??"",h),A=await w1(e,E,b);return ko(A,m)}async function C1(s,p,{iterations:i,length:r,hashAlg:a="SHA-256"}){if(Ep){const c=await Ep.importKey("raw",iv(s),"PBKDF2",!1,["deriveBits"]),e=await Ep.deriveBits({name:"PBKDF2",salt:iv(p),iterations:i,hash:a},c,r*8);return new Uint8Array(e)}if(js){const c=a==="SHA-512"?"sha512":"sha256";return await new Promise((e,f)=>{js.pbkdf2(Buffer.from(s),Buffer.from(p),i,r,c,(h,m)=>{h?f(h):e(new Uint8Array(m))})})}throw new Error("PBKDF2 not available")}async function DBe(s,p,i,r,a,c,e,f){if(typeof s!="string"||typeof p!="string")throw new Error("Invalid input types for password or salt; expected strings");const h=c??"utf8",m=e??"utf8",E=f??"base64url",b=Math.max(1,Number(i)||21e4),A=Math.max(1,Number(r)||32),_=a??"SHA-256",P=fn(s??"",h),V=fn(p??"",m),j=await C1(P,V,{iterations:b,length:A,hashAlg:_});return ko(j,E)}async function wBe(s,p=u$(16),i=21e4,r=32,a="SHA-256"){const c=fn(s,"utf8"),e=await C1(c,p,{iterations:i,length:r,hashAlg:a}),f=wh(p),h=wh(e);return`pbkdf2$${a.toLowerCase()}$${i}$${f}$${h}`}async function CBe(s,p){const i=String(p).split("$");if(i.length!==5||i[0]!=="pbkdf2")return!1;const r=i[1].toLowerCase(),a=parseInt(i[2],10),c=wf(i[3]),e=wf(i[4]),f=r.includes("512")?"SHA-512":"SHA-256",h=await C1(fn(s,"utf8"),c,{iterations:a,length:e.length,hashAlg:f});return D1(h,e)}async function OBe(s,p,i,r,a,c){const e=p!=null?Math.max(1,Number(p)||0):void 0,f=i!=null?Math.max(1,Number(i)||0):void 0,h=r??void 0,m=c??"base64url",E=a!=null?fn(a,m):void 0;return await wBe(String(s??""),E,e,f,h)}function lU(s){return wh(fn(JSON.stringify(s),"utf8"))}function Lg(s){try{return JSON.parse(ko(wf(s),"utf8"))}catch{return null}}async function _Be(s,p,{alg:i="HS256",includeIat:r=!0,expiresInSeconds:a,notBeforeSeconds:c,issuer:e,subject:f,audience:h,jwtid:m,header:E={}}={}){const b={alg:i,typ:"JWT",...E},A=Math.floor(Date.now()/1e3),_={...s||{}};r&&(_.iat=A),typeof a=="number"&&(_.exp=A+a),typeof c=="number"&&(_.nbf=A+c),e&&(_.iss=e),f&&(_.sub=f),h&&(_.aud=h),m&&(_.jti=m);const P=lU(b),V=lU(_),j=fn(`${P}.${V}`,"utf8"),G=await w1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,j),K=wh(G);return`${P}.${V}.${K}`}async function VBe(s,p,i,r,a,c,e,f,h,m,E,b){if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(s!=null&&typeof s!="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(m!=null&&typeof m!="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(f!=null&&typeof f!="string")throw new Error("Invalid input type for subject; expected string");if(h!=null&&typeof h!="string"&&!Array.isArray(h))throw new Error("Invalid input type for audience; expected string or string[]");const _=fn(p??"",b??"utf8");return await _Be(s??{},_,{alg:i??"HS256",includeIat:r==null?!0:!!r,expiresInSeconds:a!=null?Number(a):void 0,notBeforeSeconds:c!=null?Number(c):void 0,issuer:e??void 0,subject:f??void 0,audience:h??void 0,jwtid:m??void 0,header:E??void 0})}async function PBe(s,p,{alg:i="HS256",issuer:r,audience:a,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[f,h,m]=String(s).split(".");if(!f||!h||!m)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=Lg(f),b=Lg(h);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 A=fn(`${f}.${h}`,"utf8"),P=await w1(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,A),V=wf(m);if(!D1(P,V))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const j=Math.floor(Date.now()/1e3),M=Math.max(0,Number(e)||0);if(b.nbf!=null&&j+M<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&j-M>=Number(b.exp))return{valid:!1,header:E,payload:b,reason:"Expired"};if(r&&b.iss!==r)return{valid:!1,header:E,payload:b,reason:"Issuer mismatch"};if(a){const G=b.aud;if(!(Array.isArray(G)?G.includes(a):G===a))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&j-Number(b.iat)>Number(c)+M?{valid:!1,header:E,payload:b,reason:"MaxAge exceeded"}:{valid:!0,header:E,payload:b}}catch(f){return{valid:!1,header:null,payload:null,reason:String((f==null?void 0:f.message)??f)}}}async function NBe(s,p,i,r,a,c,e,f){if(typeof s!="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 r!="string")throw new Error("Invalid input type for issuer; expected string");if(a!=null&&typeof a!="string")throw new Error("Invalid input type for audience; expected string");const m=fn(p??"",f??"utf8");return await PBe(String(s??""),m,{alg:i??"HS256",issuer:r??void 0,audience:a??void 0,maxAgeSeconds:c!=null?Number(c):void 0,clockSkewSeconds:e!=null?Number(e):void 0})}function xBe(s){const[p,i,r]=String(s).split(".");return{header:p?Lg(p):null,payload:i?Lg(i):null,signature:r?wf(r):new Uint8Array}}function $Be(s,p){if(!s)throw new Error("Token is required for decoding");if(typeof s!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:r,payload:a,signature:c}=xBe(String(s??"")),e=ko(c,i);return{header:r,payload:a,signature:e}}class LBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(nt.GenerateRandomBytes);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)}),e=Math.max(0,Number(a)||0),f=c??"base64url",h=u$(e),m=ko(h,f);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class BBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomInteger);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=oVe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class MBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomFloat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=c1();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class GBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomHexadecimal);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=kx(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class jBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomBase62);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=Ux(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class kBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=uVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class UBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomAlphanumeric);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=Fx(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class FBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateIdentifier);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=Kx(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class KBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateRandomUUIDv4);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=vp();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class qBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{Y.Logger.log("Initializing Random Generate Short Identifier Module");const r=i.find(a=>a.contextType===ae.Logic);if(r){Y.Logger.log("Project state found, setting up operation");const a=r.get(nt.GenerateShortIdentifier);a?(Y.Logger.log("Operation found, setting autoexecutable and implementation"),a.autoexecutable=!0,a.implementation=this.module.main):Y.Logger.warn("Operation generate-short-identifier not found in project state")}else Y.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,r)=>{try{const a=pVe();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class SBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(nt.GenerateHexadecimalToken);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=cVe();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}function h1i(s){let p;if(s===null?p="null":Array.isArray(s)?p="array":p=typeof s,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class ZBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(Xe.GetTypeOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)})[0];return{value:U.Success,error:null,result:h1i(c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class HBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.ToString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=String(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class WBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.ToNumber);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=Number(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class zBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.ToBytes);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=fn(a,c||"utf8");return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class YBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.FromBytesToString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=ko(a,c||"utf8");return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class JBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.EncodeBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)});return{value:U.Success,error:null,result:vBe(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class QBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.DecodeBase64);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=TBe(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class XBe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.EncodeBase64Url);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=wh(a,c||"utf8");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.DecodeBase64Url);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=wf(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class tMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.EncodeHex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=EBe(a,c||"utf8");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class iMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(Xe.DecodeHex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=bBe(String(a));return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class rMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(xi.Hash);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});return{value:U.Success,error:null,result:IBe(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(xi.Hmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m]=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)});return{value:U.Success,error:null,result:RBe(c,e,a,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(xi.ConstantTimeEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});return{value:U.Success,error:null,result:ABe(a,c,e,f)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(xi.DeriveKeyPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b]=r.map(A=>{var _,P;return((_=A.value)==null?void 0:_.valueAsType)??((P=A.value)==null?void 0:P.value)});return{value:U.Success,error:null,result:DBe(a,c,e,f,h,m,E,b)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class lMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(vn.Parse);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a;try{const c=(a=r[0].value)==null?void 0:a.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:U.Success,error:null,result:e}}catch(c){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:c,result:null}}}})}}class oMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(vn.Stringify);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a,c;try{const e=(a=r[0].value)==null?void 0:a.value,f=(c=r[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(!f&&f!==0){const m=JSON.stringify(e);return{value:U.Success,error:null,result:m}}const h=JSON.stringify(e,null,f);return{value:U.Success,error:null,result:h}}catch(e){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:e,result:null}}}})}}class dMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(cr.BuildJwtHmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b,A,_,P,V]=r.map(j=>{var M,G;return((M=j.value)==null?void 0:M.valueAsType)??((G=j.value)==null?void 0:G.value)});return{value:U.Success,error:null,result:await VBe(a,c,e,f,h,m,E,b,A,_,P,V)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class uMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(cr.VerifyJwtHmac);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m,E,b]=r.map(A=>{var _,P;return((_=A.value)==null?void 0:_.valueAsType)??((P=A.value)==null?void 0:P.value)});return{value:U.Success,error:null,result:await NBe(a,c,e,f,h,m,E,b)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class pMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(cr.DecodeJwt);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)});return{value:U.Success,error:null,result:$Be(a,c)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(En.HashPasswordPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h,m]=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)});return{value:U.Success,error:null,result:await OBe(a,c,e,f,h,m)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fMe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(En.VerifyPasswordPBKDF2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=await CBe(String(a??""),String(c??""));return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class K_ extends v1{constructor(p,i,r=i.projectId){super(p,ae.Editor),this._editor=i,this.id=r}get ready(){return this._editor.ready}get env(){return this._editor.env}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 branchHead(){return this._editor.branchHead}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 activeWorkspace(){return this._editor.activeWorkspace}get branches(){return this._editor.branches}get roles(){return this._editor.roles}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}getRefreshToken(){return this._editor.getRefreshToken()}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,r){return this._editor.resolveInitialChildrenPositions(p,i,r)}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)}implementFeature(p){return this._editor.implementFeature(p)}getProjectRoles(){return this._editor.getProjectRoles()}}function m1i(s,p){return p instanceof K_?p:new K_(s,p)}class q_ extends v1{constructor(p,i){super(p,ae.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get envIdentifier(){return this._publicationRun.envIdentifier}get projectVersion(){return this._publicationRun.projectVersion}get projectBranchId(){return this._publicationRun.projectBranchId}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 T1i(s,p){return p instanceof q_?p:new q_(s,p)}function v1i(s){s.register(new dPe(s)),s.register(new oPe(s)),s.register(new nPe(s)),s.register(new sPe(s)),s.register(new lPe(s)),s.register(new aPe(s)),s.register(new qLe(s)),s.register(new SLe(s)),s.register(new ZLe(s)),s.register(new WLe(s)),s.register(new HLe(s)),s.register(new zLe(s)),s.register(new BBe(s)),s.register(new MBe(s)),s.register(new GBe(s)),s.register(new jBe(s)),s.register(new kBe(s)),s.register(new UBe(s)),s.register(new FBe(s)),s.register(new KBe(s)),s.register(new qBe(s)),s.register(new SBe(s)),s.register(new K$e(s)),s.register(new q$e(s)),s.register(new S$e(s)),s.register(new Z$e(s)),s.register(new H$e(s)),s.register(new W$e(s)),s.register(new z$e(s)),s.register(new Y$e(s)),s.register(new J$e(s)),s.register(new Q$e(s)),s.register(new X$e(s)),s.register(new eLe(s)),s.register(new tLe(s)),s.register(new iLe(s)),s.register(new rLe(s)),s.register(new nLe(s)),s.register(new aLe(s)),s.register(new sLe(s)),s.register(new lLe(s)),s.register(new uLe(s)),s.register(new pLe(s)),s.register(new cLe(s)),s.register(new d$e(s)),s.register(new u$e(s)),s.register(new p$e(s)),s.register(new c$e(s)),s.register(new f$e(s)),s.register(new y$e(s)),s.register(new h$e(s)),s.register(new m$e(s)),s.register(new T$e(s)),s.register(new E$e(s)),s.register(new b$e(s)),s.register(new A$e(s)),s.register(new g$e(s)),s.register(new I$e(s)),s.register(new Oxe(s)),s.register(new eBe(s)),s.register(new Q2e(s)),s.register(new X2e(s)),s.register(new CNe(s)),s.register(new ONe(s)),s.register(new _Ne(s)),s.register(new VNe(s)),s.register(new PNe(s)),s.register(new NNe(s)),s.register(new xNe(s)),s.register(new $Ne(s)),s.register(new LNe(s)),s.register(new WNe(s)),s.register(new Dxe(s)),s.register(new wxe(s)),s.register(new Cxe(s)),s.register(new BNe(s)),s.register(new MNe(s)),s.register(new GNe(s)),s.register(new jNe(s)),s.register(new kNe(s)),s.register(new UNe(s)),s.register(new FNe(s)),s.register(new KNe(s)),s.register(new qNe(s)),s.register(new SNe(s)),s.register(new ZNe(s)),s.register(new HNe(s)),s.register(new zNe(s)),s.register(new YNe(s)),s.register(new JNe(s)),s.register(new QNe(s)),s.register(new XNe(s)),s.register(new exe(s)),s.register(new txe(s)),s.register(new ixe(s)),s.register(new rxe(s)),s.register(new nxe(s)),s.register(new axe(s)),s.register(new sxe(s)),s.register(new hxe(s)),s.register(new mxe(s)),s.register(new Txe(s)),s.register(new lxe(s)),s.register(new oxe(s)),s.register(new dxe(s)),s.register(new uxe(s)),s.register(new pxe(s)),s.register(new cxe(s)),s.register(new fxe(s)),s.register(new yxe(s)),s.register(new nBe(s)),s.register(new aBe(s)),s.register(new sBe(s)),s.register(new lBe(s)),s.register(new tBe(s)),s.register(new iBe(s)),s.register(new rBe(s)),s.register(new oBe(s)),s.register(new uBe(s)),s.register(new cBe(s)),s.register(new dBe(s)),s.register(new pBe(s)),s.register(new fBe(s)),s.register(new mBe(s)),s.register(new yBe(s)),s.register(new hBe(s)),s.register(new R$e(s)),s.register(new O$e(s)),s.register(new _$e(s)),s.register(new N$e(s)),s.register(new x$e(s)),s.register(new $$e(s)),s.register(new L$e(s)),s.register(new B$e(s)),s.register(new M$e(s)),s.register(new G$e(s)),s.register(new j$e(s)),s.register(new V$e(s)),s.register(new P$e(s)),s.register(new w$e(s)),s.register(new C$e(s)),s.register(new D$e(s)),s.register(new v$e(s)),s.register(new U$e(s)),s.register(new F$e(s)),s.register(new k$e(s)),s.register(new JLe(s)),s.register(new A2e(s)),s.register(new b2e(s)),s.register(new g2e(s)),s.register(new I2e(s)),s.register(new e2e(s)),s.register(new t2e(s)),s.register(new l2e(s)),s.register(new a2e(s)),s.register(new v2e(s)),s.register(new c2e(s)),s.register(new y2e(s)),s.register(new m2e(s)),s.register(new h2e(s)),s.register(new s2e(s)),s.register(new d2e(s)),s.register(new u2e(s)),s.register(new o2e(s)),s.register(new YLe(s)),s.register(new i2e(s)),s.register(new f2e(s)),s.register(new w2e(s)),s.register(new G_(s)),s.register(new XLe(s)),s.register(new r2e(s)),s.register(new QLe(s)),s.register(new T2e(s)),s.register(new n2e(s)),s.register(new p2e(s)),s.register(new E2e(s)),s.register(new D2e(s)),s.register(new R2e(s)),s.register(new C2e(s)),s.register(new G_(s)),s.register(new _2e(s)),s.register(new O2e(s)),s.register(new V2e(s)),s.register(new CLe(s)),s.register(new OLe(s)),s.register(new _Le(s)),s.register(new yLe(s)),s.register(new dLe(s)),s.register(new vLe(s)),s.register(new gLe(s)),s.register(new oLe(s)),s.register(new ILe(s)),s.register(new wLe(s)),s.register(new bLe(s)),s.register(new ELe(s)),s.register(new Ng(s)),s.register(new VLe(s)),s.register(new PLe(s)),s.register(new ALe(s)),s.register(new DLe(s)),s.register(new RLe(s)),s.register(new TLe(s)),s.register(new mLe(s)),s.register(new hLe(s)),s.register(new fLe(s)),s.register(new $Le(s)),s.register(new xLe(s)),s.register(new LLe(s)),s.register(new NLe(s)),s.register(new Axe(s)),s.register(new vxe(s)),s.register(new bxe(s)),s.register(new gxe(s)),s.register(new Ixe(s)),s.register(new Exe(s)),s.register(new Rxe(s)),s.register(new ZBe(s)),s.register(new QBe(s)),s.register(new eMe(s)),s.register(new iMe(s)),s.register(new JBe(s)),s.register(new XBe(s)),s.register(new tMe(s)),s.register(new YBe(s)),s.register(new zBe(s)),s.register(new WBe(s)),s.register(new HBe(s)),s.register(new lMe(s)),s.register(new oMe(s)),s.register(new aMe(s)),s.register(new sMe(s)),s.register(new LBe(s)),s.register(new rMe(s)),s.register(new nMe(s)),s.register(new uMe(s)),s.register(new dMe(s)),s.register(new pMe(s)),s.register(new cMe(s)),s.register(new fMe(s)),s.register(new pPe(s)),s.register(new cPe(s)),s.register(new Vg(s)),s.register(new Pg(s))}class p${constructor(p=new Y.Events("extensions-registry-fallback-events")){R(this,"extensionsRegistry",new Map);R(this,"initialized",new Set);R(this,"initializedContexts",new Set);R(this,"onResolveEditorContextCallback",()=>null);R(this,"onResolveProjectLogicContextCallback",()=>null);R(this,"onResolveEditorGUIContextCallback",()=>null);R(this,"onResolveGUIContextCallback",()=>null);R(this,"onResolveCompileContextCallback",()=>null);R(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||Oe.Normal)-(i.manifest.initPriority||Oe.Normal))}async setup(){v1i(this),Y.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case ae.Editor:return this.onResolveEditorContextCallback();case ae.Logic:return this.onResolveProjectLogicContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();case ae.Compile:return this.onResolveCompileContextCallback();case ae.PublicationRun:return this.onResolvePublicationRunContextCallback();case ae.GUI:return this.onResolveGUIContextCallback();case ae.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,i=[]){const r=[];i.length===0&&(i=p.manifest.contexts);for(const a of i){const c=this.requestContext(a);c&&r.push(c)}return r}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 r of this.extensionInOrder)if(r.module.init&&!this.initialized.has(r.manifest.id)){const a=r.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);a.length&&(await((i=(p=r.module).init)==null?void 0:i.call(p,a)),this.initialized.add(r.manifest.id))}else!r.module.init&&!this.initialized.has(r.manifest.id)&&this.initialized.add(r.manifest.id)}async initForReady(){Y.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){Y.Logger.log("Initializing "+p.manifest.id+" extension...");const i=this.requestContexts(p);p.manifest.contexts.every(a=>!!i.find(c=>c.contextType===a))?(await p.module.init(i),this.initialized.add(p.manifest.id)):Y.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(a=>a.contextType).join(", ")}`)}else!p.module.init&&!this.initialized.has(p.manifest.id)?(Y.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):Y.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)){Y.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case ae.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case ae.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}Y.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 rg=null;const c$={requestExtension:s=>(rg||(rg=new p$,rg.setup()),rg.requestExtension(s))};function E1i(s){return!(s instanceof Error)&&typeof s=="object"&&s!==null?s:s instanceof Error?{name:s.name,message:s.message,stack:s.stack,...s}:s}const ap={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var f$=(s=>(s.FinishedSuccess="finished-success",s.FinishedError="finished-error",s.Running="running",s.Paused="paused",s.Stopped="stopped",s.NotStarted="not-started",s))(f$||{});const yMe={...c$,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class ph extends Y.Events{constructor(i,r,a,c=null,e=yMe){super();R(this,"project");R(this,"entryPoint");R(this,"state","not-started");R(this,"events",new Y.Events("fe-exec-inst-events"));R(this,"entities",[]);R(this,"parentExecution",null);R(this,"executing",[]);R(this,"executed",[]);R(this,"skipped",[]);R(this,"scheduled",[]);R(this,"localTestValues");R(this,"resolvedValues");R(this,"persistedExecutionResults");R(this,"lastExecutionResults");R(this,"onAddToSkippedListCallback",null);R(this,"onRemoveFromSkippedListCallback",null);R(this,"onAddEntityCallback",null);R(this,"onRemoveEntityCallback",null);R(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=r,this.entryPoint=a,this.project=i,this.parentExecution=c,this.localTestValues=new NT(x.UUID.uuid(),this.project),this.resolvedValues=new NT(x.UUID.uuid(),this.project),this.persistedExecutionResults=new NT(x.UUID.uuid(),this.project),this.lastExecutionResults=new NT(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),Qi.includes(i.type)&&pt(i).forEach(r=>this.skip(r))))}async schedule(i,r,a){if(this.hasExecuted(i))return null;if(Gt.includes(i.type))return this.executeBranch(i,a,r);if(rr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,a,r);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,r){const a=[];return[...wt,...Gt].includes(r.type)?a.push(...r.inputs):At.includes(r.type)&&a.push(...r.outputs),a.map(e=>{var h;let f=i.find(m=>m.valueOwner.id===e.id);if(f)return f;if(!f&&Gt.includes(r.type)&&(f=i.find(m=>{var E;return((E=m.valueOwner.declaration)==null?void 0:E.id)===e.id})),f){const m=(h=f.value)==null?void 0:h.clone(null);return m==null||m.setStandaloneParent(e,null),{...f,valueOwner:e,value:m||null,inheritanceLink:{sources:[f],target:e}}}return Wr.includes(e.type)?Xl(e,this.valueResolutionContext):Rf(e,this.valueResolutionContext)}).reduce((e,f)=>{const h=ud(f==null?void 0:f.valueOwner,this.project),m=f?[f]:[];return h.forEach(E=>{var _,P,V;if(E.id===(f==null?void 0:f.valueOwner.id))return;const b=Ht(E.getDataType(null),E,this.project);b==null||b.metaSync({value:(_=f==null?void 0:f.value)==null?void 0:_.value},null),b==null||b.setValueAsTypeList(((P=f==null?void 0:f.value)==null?void 0:P.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((V=f==null?void 0:f.value)==null?void 0:V.valueAsTypeSingle)||null);const A={...f,valueOwner:E,value:b};m.push(A)}),[...e,...m]},[]).sort((e,f)=>e.valueOwner.index-f.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,r,a,c={}){var f,h;const e={...ap,...c};try{let m={value:U.Success,error:null,result:null};if(r.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Lr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(uh+i.declaration.id).module.main;E?m=await E(i,r):Y.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{m=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let E=null;if(m.error){Y.Logger.warn("Raw error executing entity: ",m.error);const b=(f=i.error)==null?void 0:f.getDataType(null),A=Ht(b||null,i.error,a);b!=null&&b.asType?A==null||A.setValueAsTypeSingle(m.error):A==null||A.metaSync({value:m.error},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:A}}return{value:m.value,entity:i,error:E,result:{value:m.result||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}return{...m,entity:i}}catch(m){Y.Logger.warn("Internal call execution error: ",m);let E=null;if(i.error){const b=(h=i.error)==null?void 0:h.getDataType(null),A=Ht(b,i.error,a);b!=null&&b.asType?A==null||A.setValueAsTypeSingle(m):A==null||A.metaSync({value:m},null),E={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:A}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:E,result:null}}}static async executeOperation(i,r,a){var c,e;try{let f={value:U.Success,error:null,result:null};r.sort((b,A)=>b.valueOwner.index-A.valueOwner.index),i.declaration.implementation&&(f=await i.declaration.implementation(i,r.sort((b,A)=>b.valueOwner.index-A.valueOwner.index)));let h=null;if(f.error&&i.error){const b=E1i(f.error),A=((c=i.error)==null?void 0:c.getDataType(null))||null,_=Ht(A,i.error,a);if(A!=null&&A.asType)_==null||_.setValueAsTypeSingle(f.error);else{const P=an(b)?JSON.stringify(b,null,2):b;_==null||_.metaSync({value:P},null)}h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:_}}const m=i==null?void 0:i.getDataType(null),E=Ht(m,i,a);return m!=null&&m.asType?E==null||E.setValueAsTypeSingle(f.result):E==null||E.metaSync({value:f.result},null),{value:f.value,entity:i,error:h,result:{value:E||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(f){console.warn("Operation execution error: ",f);let h=null;if(i.error){const m=(e=i.error)==null?void 0:e.getDataType(null),E=Ht(m,i.error,a);m!=null&&m.asType?E==null||E.setValueAsTypeSingle(f):E==null||E.metaSync({value:f},null),h={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:h,result:null}}}async executeSearch(i,r,a){var c;try{let e={value:U.Success,error:null,result:null};const f=await(await this.parentContext.requestExtension(Ve.SEARCH_NODE_IMPLEMENTATION)).module.main(i,r),h=i==null?void 0:i.getDataType(null),m=Ht(h,i,a);return m==null||m.metaSync({value:f},null),f.error?{value:U.UnhandledError,entity:i,error:{valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:m},result:null}:{value:e.value,entity:i,error:null,result:{value:m,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(e){if(Y.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const f=(c=i.error)==null?void 0:c.getDataType(null),h=Ht(f,i.error,a);return h==null||h.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:h},result:null}}}async executeLoop(i,r,a,c={}){var f,h,m,E,b,A;const e={...ap,...c};try{let _={value:U.Success,error:null,result:null};const P=r.map(ne=>{var ee,oe;return((ee=ne==null?void 0:ne.value)==null?void 0:ee.valueAsType)||((oe=ne==null?void 0:ne.value)==null?void 0:oe.value)});let V={};i.getUniqueInputMaps().forEach(ne=>{const ee=i.body.inputs.find(ue=>de(ue,a)===de(ne,a)),oe=ne==null?void 0:ne.getDataType(null),ie=Ht(oe,ee,a);oe!=null&&oe.asType?ie==null||ie.setValueAsTypeList([]):ie==null||ie.metaSync({value:[]},null),this.lastExecutionResults.writeValue(ee,ie);const se={value:ie,valueOwner:ee,type:Me.ExecutionResult,inheritanceLink:null};V[ee.id]=se});let M={value:U.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case re.loop["counted-loop"].id:{const ne=P[0];let ee=1;for(;ee<=ne&&ee<=50;){const oe=i.body.inputs.map(ie=>{if(ie===i.currentIterationNumberArgumentDeclaration){const se=i.currentIterationNumberArgumentDeclaration.getDataType(null),ue=ff(se),z=this.lastExecutionResults.readValue(ie.id);if(z){z.metaSync({value:ee},null),this.lastExecutionResults.writeValue(ie,z);const me={value:z,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return V[ie.id]=me,me}const X={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:ue,standaloneParent:ie.toReference()},pe=nr(X,a);this.lastExecutionResults.writeValue(ie,pe);const le={value:pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null};return V[ie.id]=le,le}else return V[ie.id]}).filter(ie=>!!ie);if(M=await this.executeFullFunctionDeclarationLogic(i.body,oe,e),(M.results||[]).forEach(ie=>{var X,pe,le,me;if(ie.valueOwner.type!==d.InputMap||At.includes(ie.valueOwner.parent.type))return;const se=i.body.inputs.find(ve=>de(ve,a)===de(ie.valueOwner,a)),z=[...((pe=(X=V==null?void 0:V[se.id])==null?void 0:X.value)==null?void 0:pe.value)||[],((le=ie==null?void 0:ie.value)==null?void 0:le.value)||null];(me=V[se.id].value)==null||me.metaSync({value:z},null),this.lastExecutionResults.writeValue(se,V[se.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case re.loop["manual-flow-loop"].id:{let ne=1;for(;ne<=50;){const ee=i.body.inputs.map(oe=>{if(oe===i.currentIterationNumberArgumentDeclaration){const ie=this.lastExecutionResults.readValue(oe.id);if(ie){ie.metaSync({value:ne},null),this.lastExecutionResults.writeValue(oe,ie);const X={value:ie,valueOwner:oe,type:Me.ExecutionResult,inheritanceLink:null};return V[oe.id]=X,X}const se=i.currentIterationNumberArgumentDeclaration.getDataType(null),ue=Ht(se,oe,a);return ue==null||ue.metaSync({value:ne},null),this.lastExecutionResults.writeValue(oe,ue),{value:ue,valueOwner:oe,type:Me.ExecutionResult,inheritanceLink:null}}else return V[oe.id]}).filter(oe=>!!oe);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ee,e),(M.results||[]).forEach(oe=>{var z,X,pe;if(oe.valueOwner.type!==d.InputMap||At.includes(oe.valueOwner.parent.type))return;const ie=i.body.inputs.find(le=>de(le,a)===de(oe.valueOwner,a)),ue=[...(z=V[ie.id].value)==null?void 0:z.value,((X=oe.value)==null?void 0:X.value)||null];(pe=V[ie.id].value)==null||pe.metaSync({value:ue},null),this.lastExecutionResults.writeValue(ie,V[ie.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ne++}break}case re.loop["list-loop"].id:{const ne=P[0];let ee=1;const oe=ne;for(let ie=0;ie<oe.length;ie++){const se=oe[ie],ue=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const pe=i.currentIterationNumberArgumentDeclaration.getDataType(null),le=Ht(pe,z,a);return le==null||le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),pe=ff(X),le=this.lastExecutionResults.readValue(z.id);if(le)return le.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={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:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:z.toReference()},ve=nr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>de(Re,a)===de(z.valueOwner,a)),le=[...(me=V[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=V[X.id].value)==null||we.metaSync({value:le},null),this.lastExecutionResults.writeValue(X,V[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case re.loop["object-keys-loop"].id:{const ne=P[0];let ee=1;const oe=ne?Object.keys(ne):[];for(let ie=0;ie<oe.length;ie++){const se=oe[ie],ue=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const pe=i.currentIterationNumberArgumentDeclaration.getDataType(null),le=Ht(pe,z,a);return le==null||le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),pe=ff(X),le=this.lastExecutionResults.readValue(z.id);if(le)return le.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={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:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:z.toReference()},ve=nr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>de(Re,a)===de(z.valueOwner,a)),le=[...(me=V[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=V[X.id].value)==null||we.metaSync({value:le},null),this.lastExecutionResults.writeValue(X,V[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case re.loop["object-values-loop"].id:{const ne=P[0];let ee=1;const oe=ne?Object.values(ne):[];for(let ie=0;ie<oe.length;ie++){const se=oe[ie],ue=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const pe=i.currentIterationNumberArgumentDeclaration.getDataType(null),le=Ht(pe,z,a);return le==null||le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),pe=ff(X),le=this.lastExecutionResults.readValue(z.id);if(le)return le.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={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:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:z.toReference()},ve=nr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>de(Re,a)===de(z.valueOwner,a)),le=[...(me=V[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=V[X.id].value)==null||we.metaSync({value:le},null),this.lastExecutionResults.writeValue(X,V[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}case re.loop["string-loop"].id:{const ne=P[0];let ee=1;const oe=ne.split("");for(let ie=0;ie<oe.length;ie++){const se=oe[ie],ue=i.body.inputs.map(z=>{if(z===i.currentIterationNumberArgumentDeclaration){const X=this.lastExecutionResults.readValue(z.id);if(X)return X.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,X),{value:X,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const pe=i.currentIterationNumberArgumentDeclaration.getDataType(null),le=Ht(pe,z,a);return le==null||le.metaSync({value:ee},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else if(z===i.currentValueArgumentDeclaration){const X=i.currentValueArgumentDeclaration.getDataType(null),pe=ff(X),le=this.lastExecutionResults.readValue(z.id);if(le)return le.metaSync({value:se},null),this.lastExecutionResults.writeValue(z,le),{value:le,valueOwner:z,type:Me.ExecutionResult,inheritanceLink:null};const me={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:se,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:pe,standaloneParent:z.toReference()},ve=nr(me,a);return this.lastExecutionResults.writeValue(z,ve),{value:ve,valueOwner:i.currentValueArgumentDeclaration,type:Me.ExecutionResult,inheritanceLink:null}}else return V[z.id]}).filter(z=>!!z);if(M=await this.executeFullFunctionDeclarationLogic(i.body,ue,e),(M.results||[]).forEach(z=>{var me,ve,we;if(z.valueOwner.type!==d.InputMap||At.includes(z.valueOwner.parent.type))return;const X=i.body.inputs.find(Re=>de(Re,a)===de(z.valueOwner,a)),le=[...(me=V[X.id].value)==null?void 0:me.value,((ve=z.value)==null?void 0:ve.value)||null];(we=V[X.id].value)==null||we.metaSync({value:le},null),this.lastExecutionResults.writeValue(X,V[X.id].value)}),[U.CaughtError,U.Break,U.Return].includes(M.value))break;ee++}break}}if(_={value:[U.CaughtError,U.Return].includes(M.value)?M.value:U.Success,error:((h=(f=M.error)==null?void 0:f.value)==null?void 0:h.value)||null,result:((E=(m=M==null?void 0:M.result)==null?void 0:m.value)==null?void 0:E.value)||null},_.error&&i.error){const ne=(b=i.error)==null?void 0:b.getDataType(null),ee=Ht(ne||null,i.error,a);ne!=null&&ne.asType?ee==null||ee.setValueAsTypeSingle(_.error):ee==null||ee.metaSync({value:_.error},null);const oe={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:ee};return{value:_.value,entity:i,error:oe,result:null}}const G=i==null?void 0:i.getDataType(null),K=Ht(G,i,a);return G!=null&&G.asType?K==null||K.setValueAsTypeSingle(_.result):K==null||K.metaSync({value:_.result},null),{value:_.value,entity:i,error:null,result:{value:K||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(_){if(Y.Logger.warn("Error executing loop: ",_),i.error){const P=(A=i.error)==null?void 0:A.getDataType(null),V=Ht(P,i.error,a);return P!=null&&P.asType?V==null||V.setValueAsTypeSingle(_):V==null||V.metaSync({value:_},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:V},result:null}}else return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,r,a,c={}){var f,h,m,E,b,A,_,P,V,j,M,G,K,ne,ee,oe,ie,se,ue,z,X,pe,le,me,ve,we;const e={...ap,...c};try{const Re=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,r,a,e);let xe=null;if(Re.error&&i.error){Y.Logger.warn("Raw error executing entity: ",Re.error);const Ze=(f=i.error)==null?void 0:f.getDataType(null),et=Ht(Ze||null,i.error,a);Ze!=null&&Ze.asType?(m=(h=Re.error)==null?void 0:h.value)!=null&&m.valueAsTypeSingle?et==null||et.setValueAsTypeSingle((b=(E=Re.error)==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle):(_=(A=Re.error)==null?void 0:A.value)!=null&&_.valueAsTypeList&&Array.isArray((V=(P=Re.error)==null?void 0:P.value)==null?void 0:V.valueAsTypeList)&&(et==null||et.setValueAsTypeList((M=(j=Re.error)==null?void 0:j.value)==null?void 0:M.valueAsTypeList)):et==null||et.metaSync({value:(K=(G=Re.error)==null?void 0:G.value)==null?void 0:K.value},null),xe={valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:et}}let je=U.Success;Re.value===U.UnhandledError&&(i.catchesError||i.errorCalls.length?je=U.CaughtError:je=U.UnhandledError);const Se=i==null?void 0:i.getDataType(null),Je=Ht(Se,i,a);return Se!=null&&Se.asType?(ee=(ne=Re.result)==null?void 0:ne.value)!=null&&ee.valueAsTypeSingle?Je==null||Je.setValueAsTypeSingle((ie=(oe=Re.result)==null?void 0:oe.value)==null?void 0:ie.valueAsTypeSingle):(ue=(se=Re.result)==null?void 0:se.value)!=null&&ue.valueAsTypeList&&Array.isArray((X=(z=Re.result)==null?void 0:z.value)==null?void 0:X.valueAsTypeList)&&(Je==null||Je.setValueAsTypeList((le=(pe=Re.result)==null?void 0:pe.value)==null?void 0:le.valueAsTypeList)):Je==null||Je.metaSync({value:((ve=(me=Re.result)==null?void 0:me.value)==null?void 0:ve.value)||null},null),{value:je,entity:i,error:xe,result:{value:Je||null,valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null}}}catch(Re){if(!i.error)return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null};const xe=(we=i.error)==null?void 0:we.getDataType(null),je=Ht(xe,i.error,a);return xe!=null&&xe.asType?je==null||je.setValueAsTypeSingle(Re):je==null||je.metaSync({value:Re},null),{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:{valueOwner:i.error,type:Me.ExecutionResult,inheritanceLink:null,value:je},result:null}}}async executeCondition(i,r){var c,e,f,h;let a=!1;switch(i.declaration.id){case bn.BooleanIsTrue:{const m=(e=(c=r[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof m!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");a=m===!0;break}case bn.BooleanIsFalse:{const m=(h=(f=r[0])==null?void 0:f.value)==null?void 0:h.value;if(typeof m!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");a=m===!1;break}case wr.And:{a=(await Promise.all(i.andChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(r,E);return(await this.executeCondition(E,b)).value===U.Success}))).every(E=>E);break}case wr.Or:{a=(await Promise.all(i.orChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(r,E);return(await this.executeCondition(E,b)).value===U.Success}))).some(E=>E);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:a?U.Success:U.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,r,a,c={}){const e={...ap,...c,onBeforeEntityExecution:(m,E,b)=>{var A;return((A=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:A.call(c,m,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(m,E,b)=>{var A;return((A=c==null?void 0:c.onEntityExecuted)==null?void 0:A.call(c,m,E,{...b,detached:!0}))||Promise.resolve()}},f=new ph(a,[i,...Qg(i)],i,this,this.parentContext);return f.inheritValuesFromContext(this),await f.execute(e,r)}async executeFullFunctionDeclarationLogic(i,r,a={}){const c={...ap,...a},e=Qg(i);e.forEach(m=>{this.addEntity(m)}),e.reduce((m,E)=>At.includes(E.type)?[...m,...E.outputs]:wt.includes(E.type)&&E.type!==d.Condition?[...m,...E.outputs,...E.inputs]:E.type===d.Condition?[...m,...E.inputs]:m,[]).forEach(m=>{this.lastExecutionResults.removeValue(m.id)});const h=await this.executeBranch(i,c,r);return{...h||{},value:(h==null?void 0:h.value)||U.Success,entity:i,error:(h==null?void 0:h.error)||null,result:(h==null?void 0:h.result)||null}}static async executeEntryPointEntity(i,r){return{value:U.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,r){var f,h,m,E,b,A,_;if((f=i.throws)!=null&&f.readsValue){const P=Xl(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=Xl(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)an((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Ht(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var j,M;if(((j=V.declaration)==null?void 0:j.type)===d.Property&&V.declaration.static){const G=this.lastExecutionResults.readValue(V.declaration.id),K=de(V,this.project),ne=V.codeName||((M=V.declaration)==null?void 0:M.codeName)||Xi(K);if(G)G.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,G);else{const ee=Ht(V.getDataType(null),V,this.project);ee==null||ee.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&an((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var G;const V=P.codeName||((G=P.declaration)==null?void 0:G.codeName)||Xi(de(P,this.project)),j=e[V],M=Ht(P.getDataType(null),P,this.project);M==null||M.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Return,entity:i,error:null,result:a}}async executeContinueStatement(i,r){var f,h,m,E,b,A,_;if((f=i.throws)!=null&&f.readsValue){const P=Xl(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=Xl(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)an((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Ht(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var j,M;if(((j=V.declaration)==null?void 0:j.type)===d.Property&&V.declaration.static){const G=this.lastExecutionResults.readValue(V.declaration.id),K=de(V,this.project),ne=V.codeName||((M=V.declaration)==null?void 0:M.codeName)||Xi(K);if(G)G.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,G);else{const ee=Ht(V.getDataType(null),V,this.project);ee==null||ee.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&an((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var G;const V=P.codeName||((G=P.declaration)==null?void 0:G.codeName)||Xi(de(P,this.project)),j=e[V],M=Ht(P.getDataType(null),P,this.project);M==null||M.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Continue,entity:i,error:null,result:a}}async executeBreakStatement(i,r){var f,h,m,E,b,A,_;if((f=i.throws)!=null&&f.readsValue){const P=Xl(i.throws,this.valueResolutionContext);return{value:U.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Me.ExecutionResult,inheritanceLink:null,value:(P==null?void 0:P.value)||null},result:null}}let a=Xl(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let P={};if(((h=c==null?void 0:c.entity)==null?void 0:h.type)===d.DefinitionEntity&&(P={...P,...c.entity.getActiveRawDefaultValue()}),a!=null&&a.value)an((m=a==null?void 0:a.value)==null?void 0:m.value)&&(P={...P,...(E=a==null?void 0:a.value)==null?void 0:E.value}),a==null||a.value.metaSync({value:P},null);else{const V=Ht(c,i,this.project);V==null||V.metaSync({value:P},null),a={valueOwner:i,type:Me.ExecutionResult,inheritanceLink:null,value:V}}this.lastExecutionResults.writeValue(i,a.value),i.outputs.forEach(V=>{var j,M;if(((j=V.declaration)==null?void 0:j.type)===d.Property&&V.declaration.static){const G=this.lastExecutionResults.readValue(V.declaration.id),K=de(V,this.project),ne=V.codeName||((M=V.declaration)==null?void 0:M.codeName)||Xi(K);if(G)G.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,G);else{const ee=Ht(V.getDataType(null),V,this.project);ee==null||ee.metaSync({value:P[ne]},null),this.lastExecutionResults.writeValue(V.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,a==null?void 0:a.value);const e=(b=a==null?void 0:a.value)!=null&&b.value&&an((A=a.value)==null?void 0:A.value)?((_=a.value)==null?void 0:_.value)||{}:{};return i.outputs.map(P=>{var G;const V=P.codeName||((G=P.declaration)==null?void 0:G.codeName)||Xi(de(P,this.project)),j=e[V],M=Ht(P.getDataType(null),P,this.project);M==null||M.metaSync({value:j},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Break,entity:i,error:null,result:a}}async executeVariable(i,r){var h,m,E,b,A,_,P;let a=Xl(i,this.valueResolutionContext);const c=Er(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let V={};if(((h=e==null?void 0:e.entity)==null?void 0:h.type)===d.DefinitionEntity?V={...V,...e.entity.getActiveRawDefaultValue()}:((m=e==null?void 0:e.entity)==null?void 0:m.type)===d.BuiltInBaseEntity&&(V={...V,...e.entity.getRawDefaultValue()}),a!=null&&a.value)an((E=a==null?void 0:a.value)==null?void 0:E.value)&&(V={...V,...(b=a==null?void 0:a.value)==null?void 0:b.value}),a==null||a.value.metaSync({value:V},null);else{const j=Ht(e,i,this.project);j==null||j.metaSync({value:V},null),a={valueOwner:c,type:Me.ExecutionResult,inheritanceLink:null,value:j}}i.inputs.forEach(j=>{var K,ne,ee,oe,ie,se;const M=Xl(j,this.valueResolutionContext),G=c.inputs.find(ue=>{var z,X;return((z=ue.declaration)==null?void 0:z.id)===((X=j.declaration)==null?void 0:X.id)});if(((K=G==null?void 0:G.declaration)==null?void 0:K.type)===d.Property&&((ne=G==null?void 0:G.declaration)!=null&&ne.static))M!=null&&M.value?this.lastExecutionResults.writeValue(G==null?void 0:G.declaration,M==null?void 0:M.value):this.lastExecutionResults.removeValue(G==null?void 0:G.declaration.id);else if(M!=null&&M.value){const ue=de(j,this.project),z=j.codeName||((ee=j.declaration)==null?void 0:ee.codeName)||Xi(ue);(se=a==null?void 0:a.value)==null||se.metaSync({value:{...(oe=a.value)==null?void 0:oe.value,[z]:(ie=M==null?void 0:M.value)==null?void 0:ie.value}},null)}}),this.lastExecutionResults.writeValue(c,a.value)}else this.lastExecutionResults.writeValue(c,a==null?void 0:a.value);const f=(A=a==null?void 0:a.value)!=null&&A.value&&an((_=a.value)==null?void 0:_.value)?((P=a.value)==null?void 0:P.value)||{}:{};return i.outputs.map(V=>{var K;const j=V.codeName||((K=V.declaration)==null?void 0:K.codeName)||Xi(de(V,this.project)),M=f[j],G=Ht(V.getDataType(null),V,this.project);G==null||G.metaSync({value:M},null),Me.ExecutionResult}),a.type=Me.ExecutionResult,{value:U.Success,entity:i,error:null,result:a}}mergeValues(i,r){const a=[];for(let c=0;c<r.length;c++)i!=null&&i[c]?a.push(i[c]):a.push(r[c]);return a}async executeEntity(i,r=[],a={}){var f,h,m,E,b,A,_,P,V,j,M,G;const c={...ap,...a},e={detached:!1};switch(i.type){case d.Condition:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((f=c.onBeforeEntityExecution)==null?void 0:f.call(c,i,K,e)),this.executeCondition(i,K)}case d.InternalCall:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((h=c.onBeforeEntityExecution)==null?void 0:h.call(c,i,K,e)),this.executeInternalCall(i,K,this.project)}case d.Operation:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((m=c.onBeforeEntityExecution)==null?void 0:m.call(c,i,K,e)),ph.executeOperation(i,K,this.project)}case d.VariableInstance:case d.VariableDeclaration:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,K,e)),this.executeVariable(i,K)}case d.FunctionCall:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,K,e)),this.executeFunctionCall(i,K,this.project)}case d.FunctionDeclaration:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((A=c.onBeforeEntityExecution)==null?void 0:A.call(c,i,K,e)),ph.executeEntryPointEntity(i,K)}case d.Search:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((_=c.onBeforeEntityExecution)==null?void 0:_.call(c,i,K,e)),this.executeSearch(i,K,this.project)}case d.Loop:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((P=c.onBeforeEntityExecution)==null?void 0:P.call(c,i,K,e)),this.executeLoop(i,K,this.project,c)}case d.ReturnStatement:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((V=c.onBeforeEntityExecution)==null?void 0:V.call(c,i,K,e)),this.executeReturnStatement(i,K)}case d.ContinueStatement:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((j=c.onBeforeEntityExecution)==null?void 0:j.call(c,i,K,e)),this.executeContinueStatement(i,K)}case d.BreakStatement:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((M=c.onBeforeEntityExecution)==null?void 0:M.call(c,i,K,e)),this.executeBreakStatement(i,K)}case d.GlobalEvent:{const K=this.mergeExernalValuesWithInternalInputs(r,i);return await((G=c.onBeforeEntityExecution)==null?void 0:G.call(c,i,K,e)),ph.executeEntryPointEntity(i,K)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var a,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((a=i.result)!=null&&a.valueOwner))return;const r=ud((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?r.forEach(f=>{var h;this.lastExecutionResults.writeValue(f,(h=i.result)==null?void 0:h.value)}):r.forEach(f=>{this.lastExecutionResults.removeValue(f.id)})}async executeBranch(i,r={},a=[]){var m;const c={...ap,...r},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const h=await this.executeEntity(i,a,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(h),await((m=c.onEntityExecuted)==null?void 0:m.call(c,i,h,e)),h.value===U.Success){const E=(i.successCalls||i.calls||[]).filter(V=>this.hasEntity(V));(i.errorCalls||[]).forEach(V=>{this.skip(V)});let A=[];const _=(await Promise.all(E.map(V=>this.schedule(V,[],c)))).filter(V=>!!V),P=_.filter(V=>!!V).find(V=>V.value===U.CaughtError||V.value===U.Return||V.value===U.Break||V.value===U.Continue);return P||(A=[...A,..._],h)}else if(h.value===U.CaughtError||h.value===U.ConditionNotMet){const E=(i.errorCalls||[]).filter(V=>this.hasEntity(V));(i.successCalls||i.calls||[]).forEach(V=>{this.skip(V)});let A=[];const _=(await Promise.all(E.map(V=>this.schedule(V,[],c)))).filter(V=>!!V),P=_.filter(V=>!!V).find(V=>V.value===U.CaughtError||V.value===U.UnhandledError||V.value===U.Return||V.value===U.Break||V.value===U.Continue);return P||(A=[...A,..._],h)}else{if(h.value===U.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),Qi.includes(h.entity.type)&&pt(h.entity).forEach(E=>{this.skip(E)}),h;if(h.value===U.Return)return h;if(h.value===U.Break)return h;if(h.value===U.Continue)return h}return h}async execute(i={},r=[]){const a={...ap,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,a,r);return this.state="finished-success",c}addEntity(i){var r;this.entities.includes(i)||(this.entities.push(i),(r=this.onAddEntityCallback)==null||r.call(this,i,{}))}async addEntityAsync(i,r={}){var a;this.entities.includes(i)||(this.entities.push(i),await((a=this.onAddEntityCallback)==null?void 0:a.call(this,i,r)))}addEntities(i){i.forEach(r=>this.addEntity(r))}async addEntitiesAsync(i,r={}){const a=Y.YieldTracker.from(r),c=[];for(const e of i)c.push(this.addEntityAsync(e,r)),await a.tick();await Promise.all(c)}removeEntity(i){var r;if(i!==this.entryPoint){const a=this.entities.indexOf(i);a>-1&&(this.entities.splice(a,1),(r=this.onRemoveEntityCallback)==null||r.call(this,i,{}))}}hasEntity(i){var c,e,f;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===d.FunctionDeclaration&&((f=(e=i.parent)==null?void 0:e.parent)==null?void 0:f.type)===d.DefinitionEntity)return this.entities.includes(i.parent);const r=yt(i);if(!r)return!1;const a=r.type===d.Loop&&i.parent===r.body?r.body:null;return a?this.entities.includes(a)||this.entities.includes(r):this.entities.includes(r)}removeScheduled(i){const r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,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 r=this.project.get(i);return r?this.hasEntity(r):!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 r=this.scheduled.indexOf(i);r>-1&&this.scheduled.splice(r,1)}removeFromExecutingList(i){var a;const r=this.executing.indexOf(i);r>-1&&(this.executing.splice(r,1),(a=this.onAbortExecutionCallback)==null||a.call(this,i,{}))}removeFromAlreadyExecutedList(i){const r=this.executed.indexOf(i);r>-1&&this.executed.splice(r,1)}removeFromSkippedList(i){var a;const r=this.skipped.indexOf(i);r>-1&&(this.skipped.splice(r,1),(a=this.onRemoveFromSkippedListCallback)==null||a.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var r;this.skipped.includes(i)||(this.skipped.push(i),(r=this.onAddToSkippedListCallback)==null||r.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,r){this.parentContext.setValueTypePreference(i,r),this.emit(i,{})}}function b1i(s){var p,i;if(s.isList)return"list";if(((p=s.entity)==null?void 0:p.type)===d.DefinitionEntity)return"definition-entity";switch((i=s.entity)==null?void 0:i.name){case fe.Number:return"number";case fe.String:return"text";case fe.Boolean:return"boolean";case fe.UUID:return"uuid";case fe.Date:return"date-time";default:return"definition-entity"}}const ds={[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 y$(s){const p=pD(s);if(!p){const r=xh(s);if(r.includes(Ae.HTTP_ENDPOINT))return"HTTP endpoint";if(r.includes(Ae.PERSISTED_ENTITY))return"Persisted entity";if(r.includes(Ae.CRON_JOB))return"Scheduled execution";if(r.includes(Ae.RELATIONAL_DATABASE))return"Relational database"}if(p){let r="Extension of "+de(p,p.project)+" entity",a=ps(r);const c=xh(s);return c.includes(Ae.HTTP_ENDPOINT)?"HTTP endpoint"+(a?", "+a:""):c.includes(Ae.PERSISTED_ENTITY)?"Persisted entity"+(a?", "+a:""):c.includes(Ae.CRON_JOB)?"Scheduled execution"+(a?", "+a:""):c.includes(Ae.RELATIONAL_DATABASE)?"Relational database"+(a?", "+a:""):r}let i="";return s.abstract&&(i="Template "),s.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function hMe(s){return s.parent.type===d.DefinitionEntity||s.parent.type===d.InstalledProject?"Internal action of "+de(s.parent,s.project):s.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function h$(s){return BL(s)?hMe(s):"Custom trigger"}function A1i(s){var p;switch(s.type){case d.DefinitionEntity:return y$(s);case d.FunctionDeclaration:return h$(s)}return(p=ds[s.type])==null?void 0:p.singular}function g1i(s){var p;switch(s.type){case d.DefinitionEntity:return y$(s);case d.FunctionDeclaration:return h$(s)}return(p=ds[s.type])==null?void 0:p.singular}const m$=4e4,T$=280,I1i=300,v$=65,Tf=32,yh=39,rv=26,mMe=49,nv=44,R1i=35,yg=52,O1=10,ka=O1*2,yp=38,hg=90,Bg=270,TMe=m$/2+120,vMe=m$/2+180;function E$(s){let i=Tf+nv+yp+O1;const r=[...s.inputs];return r.length&&(i+=ka,r.forEach(()=>{i+=rv})),{height:i,width:280}}function av(s){var a,c;let i=Tf+nv+yp+O1;const r=[...s.inputs];return r.length&&(i+=ka,r.forEach(()=>{i+=rv})),s.andChildrenGroup&&(i+=ka,s.andChildrenGroup.forEach(e=>{i+=av(e).height})),s.orChildrenGroup&&(i+=ka,s.orChildrenGroup.forEach(e=>{i+=av(e).height})),(((a=s.declaration)==null?void 0:a.id)===re.condition["condition-group-and"].id||((c=s.declaration)==null?void 0:c.id)===re.condition["condition-group-or"].id)&&(i+=yp),{height:i,width:280}}function EMe(s){var h,m;let i=v$;const r=[];if([d.DefinitionEntity].includes(s.type)){const E=[...s.suggestedProperties||[],...s.properties||[]];E.length&&(i+=ka,E.forEach(b=>{i+=b.static?mMe:yh}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(s.type)){const E=[...(s==null?void 0:s.suggestedMethods)||[],...s.methods||[],...s.functions||[],...s.body?[s.body]:[]];E.length&&(i+=ka,E.forEach(b=>{const A=E$(b);i+=A.height}))}wt.includes(s.type)?(r.push(...(s.inputs||[]).flatMap(E=>[E])||[]),i+=ka,i+=nv,s.error&&(i+=yg)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)?(r.push(...s.outputs||[]),s.throws&&(i+=yg)):s.type===d.Condition&&(r.push(s.inputs[0]),s.inputs[1]&&r.push(s.inputs[1]),(((h=s.declaration)==null?void 0:h.id)===re.condition["condition-group-and"].id||((m=s.declaration)==null?void 0:m.id)===re.condition["condition-group-or"].id)&&(i+=yp),s.andChildrenGroup&&(i+=ka,s.andChildrenGroup.forEach(E=>{i+=av(E).height})),s.orChildrenGroup&&(i+=ka,s.orChildrenGroup.forEach(E=>{i+=av(E).height})));const a=r.length;a&&(i+=a*yh,i+=ka);const c=[];if(s.type===d.FunctionDeclaration||s.type===d.GlobalEvent?c.push(...s.inputs||[]):wt.includes(s.type)&&c.push(...s.outputs||[]),Lt.includes(s.type)){i+=ka,i+=nv,s.usedInternalCalls.length&&s.usedInternalCalls.forEach(b=>{i+=yg+ka,i+=b.inputs.length*rv,i+=b.outputs.length*rv});const E=s.getDataType(null);(!E||E.canModifyObjectStructure())&&(i+=yp)}s.type===d.Search&&(i+=yp);const e=c.length;return e&&(i+=e*yh,i+=ka),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(s.type)&&(i+=yp),{height:i,width:280}}function bMe(s){let p=0;if(s.parent.type!==d.DefinitionEntity)return{offset:p};const i=s.parent,r=i.methods.findIndex(c=>c.id===s.id);return i.methods.slice(0,r).forEach(c=>{const e=E$(c);p+=e.height}),(i.properties.length||i.suggestedProperties.length)&&(p+=ka,i.suggestedProperties.forEach(()=>{p+=yh}),i.properties.forEach(()=>{p+=yh})),{offset:p}}function CE(s){return`${s.split("-").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r.toLowerCase()).join(" ")}.`}function D1i(s){switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case be.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case be.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case be.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case be.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case be.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case be.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Ce.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ce.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case be.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case be.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Ce.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case be.NoProperties:return"This entity has no properties, so it doesn't do anything";case be.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case be.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case be.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case be.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case be.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case be.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case be.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case be.PropertyImplementsNonAbstact:return"This property implements a non-template property";case be.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case be.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case be.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case be.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case be.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Ce.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ce.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ce.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ce.UnreachableEntity:return"This entity is unreachable";case be.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case be.AbstractEntityImplements:return"This template entity implements a non-template entity";case be.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case be.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case be.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case be.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case be.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case be.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case be.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case be.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case be.MissingRequiredValue:return"This action is missing a required value";case be.NoPrimaryKeyProperty:return"This entity has no primary key property";case be.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case be.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case be.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case be.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case be.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case be.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case be.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ce.EmptyName:return"This entity has no name";case Ce.InvalidObjectStructure:return"This entity has an invalid structure";case Ce.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ce.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ce.MissingCaller:return"This action is missing a caller";case Ce.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ce.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ce.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ce.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Td.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Td.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case cs.UUIDMustBeString:return`UUID must be a string, eg: "${vp()}"`;case cs.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${vp()}"`;case cs.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${vp()}"`;case Nn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Nn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Nn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";case Nn.ValueMustBeString:return"This value must be a string";case KT.DayOfMonthAndWeekConflict:return"Cron expression cannot have both day of month and day of week";case KT.InvalidCharacters:return"Cron expression has invalid characters";case KT.MustHaveSixFields:return"Cron expression must have six fields";default:return CE(s.code)}}function w1i(s){switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case be.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case be.IncorrectEntityImplementation:return"Incorrect implementation";case be.IncorrectMethodImplementation:return"Incorrect action implementation";case be.IncorrectPropertyImplementation:return"Incorrect property implementation";case be.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case be.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Ce.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ce.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case be.MissingMethodImplementation:return"Missing action";case be.MissingPropertyImplementation:return"Missing property";case Ce.NameNotUniqueInScope:return"Duplicate name";case be.NoProperties:return"No properties";case be.NonStaticPropertyInStaticEntity:return"Non-static property";case be.StaticEntityWithNonStaticProperties:return"Non-static properties";case be.ReadingFromIncompatibleType:return"Read from different type";case be.WritingToIncompatibleType:return"Write to different type";case be.ScopeWithoutLogic:return"No logic";case be.NonStaticPropertyImplementsStatic:return"Invalid static property";case be.PropertyImplementsIncompatibleType:return"Incompatible data type";case be.PropertyImplementsNonAbstact:return"Non-template property";case be.StaticPropertyImplementsNonStatic:return"Non-static property";case be.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case be.VariableHasInputsAndInternalCall:return"Bad internal call";case be.VariableHasOutputsAndInternalCall:return"Bad internal call";case be.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Ce.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ce.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ce.InternalCallParentMissingDataType:return"Parent has no data type";case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ce.UnreachableEntity:return"Unreachable entity";case be.DisconnectedCallableEntity:return"Disconnected entity";case be.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case be.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case be.InvalidPropertiesCombination:return"Invalid properties combination";case be.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case be.ExtendsIncompatibleEntities:return"Extends incompatible entities";case be.ImplementingNonAbstractEntity:return"Implementing non-template entity";case be.ImplementsIncompatibleEntities:return"Implements incompatible entities";case be.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case be.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case be.MissingRequiredValue:return"Missing required value";case be.NoPrimaryKeyProperty:return"No primary key property";case be.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case be.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case be.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case be.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case be.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case be.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case be.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Ce.EmptyName:return"Empty name";case Ce.InvalidObjectStructure:return"Invalid object structure";case Ce.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ce.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ce.MissingCaller:return"Missing caller";case Ce.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ce.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ce.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ce.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Td.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Td.StatusCodeMustBeNumber:return"HTTP status code must be a number";case cs.UUIDMustBeString:return"UUID must be a string";case cs.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case cs.UUIDMustBeValidFormat:return"UUID must be in a valid format";case Nn.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case Nn.StringValueMustNotHaveDashes:return"This value must not contain dashes";case Nn.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return CE(s.code)}}function C1i(s){switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return`${de(s.entity,s.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${de(s.entity,s.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements template`;case be.IncorrectMethodImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements the template`;case be.IncorrectPropertyImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements the template`;case be.AbstractMethodInNonAbstractEntity:return`${de(s.entity,s.entity.project)} can't be a template`;case be.AbstractPropertyInNonAbstractEntity:return`${de(s.entity,s.entity.project)} can't be a template`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${de(s.entity,s.entity.project)} overwrites action`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${de(s.entity,s.entity.project)} overwrites property`;case be.MissingMethodImplementation:return`${de(s.entity,s.entity.project)} is missing action`;case be.MissingPropertyImplementation:return`${de(s.entity,s.entity.project)} is missing property`;case Ce.NameNotUniqueInScope:return`${de(s.entity,s.entity.project)} name is not unique`;case be.NoProperties:return`${de(s.entity,s.entity.project)} has no properties`;case be.NonStaticPropertyInStaticEntity:return`${de(s.entity,s.entity.project)} has non-static property`;case be.StaticEntityWithNonStaticProperties:return`${de(s.entity,s.entity.project)} has non-static properties`;case be.ReadingFromIncompatibleType:return`${de(s.entity,s.entity.project)} reads from different type`;case be.WritingToIncompatibleType:return`${de(s.entity,s.entity.project)} writes to different type`;case be.ScopeWithoutLogic:return`${de(s.entity,s.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${de(s.entity,s.entity.project)} has invalid static property`;case be.PropertyImplementsIncompatibleType:return`${de(s.entity,s.entity.project)} has incompatible data type`;case be.PropertyImplementsNonAbstact:return`${de(s.entity,s.entity.project)} has non-template property`;case be.StaticPropertyImplementsNonStatic:return`${de(s.entity,s.entity.project)} has non-static property`;case be.VariableCallsOthersAndHasInternalCall:return`${de(s.entity,s.entity.project)} has bad internal call`;case be.VariableHasInputsAndInternalCall:return`${de(s.entity,s.entity.project)} has bad internal call`;case be.VariableHasOutputsAndInternalCall:return`${de(s.entity,s.entity.project)} has bad internal call`;case be.VariableIsCalledAndHasInternalCall:return`${de(s.entity,s.entity.project)} has bad internal call`;case Ce.InternalCallDeclarationIsInvalidType:return`${de(s.entity,s.entity.project)} has declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${de(s.entity,s.entity.project)} has declaration that is not found in parent`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${de(s.entity,s.entity.project)} has invalid parent declaration type`;case Ce.InternalCallParentMissingDataType:return`${de(s.entity,s.entity.project)}'s parent has no data type`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${de(s.entity,s.entity.project)} has declaration that is not in parent`;case Ce.UnreachableEntity:return`${de(s.entity,s.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${de(s.entity,s.entity.project)} is not executed by any entity`;case be.AbstractEntityImplements:return`${de(s.entity,s.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${de(s.entity,s.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${de(s.entity,s.entity.project)} has invalid properties combination`;case be.ExtendingNonInteractiveEntity:return`${de(s.entity,s.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${de(s.entity,s.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${de(s.entity,s.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${de(s.entity,s.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${de(s.entity,s.entity.project)} is missing termination on some branches`;case be.LastCalledEntityMustBeReturnEntity:return`${de(s.entity,s.entity.project)}'s last called entity must be a termination node`;case be.MissingRequiredValue:return`${de(s.entity,s.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${de(s.entity,s.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${de(s.entity,s.entity.project)} extends a template entity`;case be.NonStaticExtendingStaticEntity:return`${de(s.entity,s.entity.project)} extends a static entity`;case be.NonStaticImplementingStaticEntity:return`${de(s.entity,s.entity.project)} implements a static entity`;case be.StaticExtendingNonStaticEntity:return`${de(s.entity,s.entity.project)} extends a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${de(s.entity,s.entity.project)} implements a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${de(s.entity,s.entity.project)} reads a value and has internal call`;case be.VariableWritesValuesAndInternalCall:return`${de(s.entity,s.entity.project)} writes values and has internal call`;case Ce.EmptyName:return`${ds[s.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${de(s.entity,s.entity.project)} has invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${de(s.entity,s.entity.project)}'s loop body action overwrites an action`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites base action`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${de(s.entity,s.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${de(s.entity,s.entity.project)} has a name not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${de(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${de(s.entity,s.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${de(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites base property`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${de(s.entity,s.entity.project)} has reader/writer with incompatible data type`;case Td.StatusCodeMustBeBetween100And599:return`${de(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case Td.StatusCodeMustBeNumber:return`${de(s.entity,s.entity.project)} HTTP status code must be a number`;case cs.UUIDMustBeString:return`${de(s.entity,s.entity.project)} UUID must be a string`;case cs.UUIDMustNotContainSpaces:return`${de(s.entity,s.entity.project)} UUID must not contain spaces`;case cs.UUIDMustBeValidFormat:return`${de(s.entity,s.entity.project)} UUID must be in a valid format`;case Nn.MustBeUniqueAmongSameEntities:return`${de(s.entity,s.entity.project)} value must be unique among the same kind`;case Nn.StringValueMustNotHaveDashes:return`${de(s.entity,s.entity.project)} value must not contain dashes`;case Nn.StringValueMustNotHaveSpaces:return`${de(s.entity,s.entity.project)} value must not contain spaces`;default:return`${de(s.entity,s.entity.project)} Error: ${CE(s.code)}`}}function O1i(s){var p,i,r,a;switch(s.code){case be.AbstractEntityWithNonAbstractMethods:return`${de(s.entity,s.entity.project)} has non-template actions`;case be.AbstractEntityWithNonAbstractProperties:return`${de(s.entity,s.entity.project)} has non-template properties`;case be.IncorrectEntityImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements the template entity`;case be.IncorrectMethodImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements the template action it's based on`;case be.IncorrectPropertyImplementation:return`${de(s.entity,s.entity.project)} incorrectly implements the template property it's based on`;case be.AbstractMethodInNonAbstractEntity:return`${de(s.entity,s.entity.project)} is a template action in a non-template entity`;case be.AbstractPropertyInNonAbstractEntity:return`${de(s.entity,s.entity.project)} is a template property in a non-template entity`;case Ce.MethodOverwritesOtherSiblingWithSameName:return`${de(s.entity,s.entity.project)} overwrites an action in the template entity`;case Ce.PropertyOverwritesOtherSiblingWithSameName:return`${de(s.entity,s.entity.project)} overwrites a property in the template entity`;case be.MissingMethodImplementation:return`${de(s.entity,s.entity.project)} is missing an action implementation from the template entity`;case be.MissingPropertyImplementation:return`${de(s.entity,s.entity.project)} is missing a property implementation from the template entity`;case Ce.NameNotUniqueInScope:return`${de(s.entity,s.entity.project)} has a duplicate name in the same scope`;case be.NoProperties:return`${de(s.entity,s.entity.project)} has no properties, so it doesn't do anything`;case be.NonStaticPropertyInStaticEntity:return`${de(s.entity,s.entity.project)} has a non-static property in a static entity`;case be.StaticEntityWithNonStaticProperties:return`${de(s.entity,s.entity.project)} has non-static properties in a static entity`;case be.ReadingFromIncompatibleType:return`${de(s.entity,s.entity.project)} reads data from a value of a different data type`;case be.WritingToIncompatibleType:return`${de(s.entity,s.entity.project)} writes data to a value of a different data type`;case be.ScopeWithoutLogic:return`${de(s.entity,s.entity.project)} has no logic`;case be.NonStaticPropertyImplementsStatic:return`${de(s.entity,s.entity.project)} has a static property in a non-static entity`;case be.PropertyImplementsIncompatibleType:return`${de(s.entity,s.entity.project)} implements a property of a different data type`;case be.PropertyImplementsNonAbstact:return`${de(s.entity,s.entity.project)} implements a non-template property`;case be.StaticPropertyImplementsNonStatic:return`${de(s.entity,s.entity.project)} has a static property in a non-static entity`;case be.VariableCallsOthersAndHasInternalCall:return`${de(s.entity,s.entity.project)} calls other entities while being used to execute internal logic`;case be.VariableHasInputsAndInternalCall:return`${de(s.entity,s.entity.project)} has inputs while being used to execute internal logic`;case be.VariableHasOutputsAndInternalCall:return`${de(s.entity,s.entity.project)} has outputs while being used to execute internal logic`;case be.VariableIsCalledAndHasInternalCall:return`${de(s.entity,s.entity.project)} is called while being used to execute internal logic`;case Ce.InternalCallDeclarationIsInvalidType:return`${de(s.entity,s.entity.project)} has a declaration that is not an action`;case Ce.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${de(s.entity,s.entity.project)} has a declaration that is not found in ${(p=s.entity.parent.getDataType(null))!=null&&p.entity?de((i=s.entity.parent.getDataType(null))==null?void 0:i.entity,s.entity.project):"the variable's data-type entity"}`;case Ce.InternalCallParentDeclarationEntityInvalidType:return`${de(s.entity,s.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ce.InternalCallParentMissingDataType:return`${de(s.entity,s.entity.project)} is part of a variable with no data-type entity`;case Ce.InternalCallDeclarationNotInParentDatatypeEntity:return`${de(s.entity,s.entity.project)} has a declaration doesn't belong to ${(r=s.entity.parent.getDataType(null))!=null&&r.entity?de((a=s.entity.parent.getDataType(null))==null?void 0:a.entity,s.entity.project):"the variable's data-type entity"}`;case Ce.UnreachableEntity:return`${de(s.entity,s.entity.project)} is unreachable`;case be.DisconnectedCallableEntity:return`${de(s.entity,s.entity.project)} is disconnected and won't be executed by anything after publishing`;case be.AbstractEntityImplements:return`${de(s.entity,s.entity.project)} implements a non-template entity`;case be.AbstractExtendingNonAbstractEntity:return`${de(s.entity,s.entity.project)} extends a non-template entity`;case be.InvalidPropertiesCombination:return`${de(s.entity,s.entity.project)} has an invalid combination of properties`;case be.ExtendingNonInteractiveEntity:return`${de(s.entity,s.entity.project)} extends a non-interactive entity`;case be.ExtendsIncompatibleEntities:return`${de(s.entity,s.entity.project)} extends incompatible entities`;case be.ImplementingNonAbstractEntity:return`${de(s.entity,s.entity.project)} implements a non-template entity`;case be.ImplementsIncompatibleEntities:return`${de(s.entity,s.entity.project)} implements incompatible entities`;case be.LackingReturnStatementOnSomeBranches:return`${de(s.entity,s.entity.project)} has branches that don't terminate`;case be.LastCalledEntityMustBeReturnEntity:return`${de(s.entity,s.entity.project)} must end with a termination node`;case be.MissingRequiredValue:return`${de(s.entity,s.entity.project)} is missing a required value`;case be.NoPrimaryKeyProperty:return`${de(s.entity,s.entity.project)} has no primary key property`;case be.NonAbstractExtendingAbstractEntity:return`${de(s.entity,s.entity.project)} is a non-template entity extending a template entity`;case be.NonStaticExtendingStaticEntity:return`${de(s.entity,s.entity.project)} is a non-static entity extending a static entity`;case be.NonStaticImplementingStaticEntity:return`${de(s.entity,s.entity.project)} is a non-static entity implementing a static entity`;case be.StaticExtendingNonStaticEntity:return`${de(s.entity,s.entity.project)} is a static entity extending a non-static entity`;case be.StaticImplementingNonStaticEntity:return`${de(s.entity,s.entity.project)} is a static entity implementing a non-static entity`;case be.VariableReadsValueAndInternalCall:return`${de(s.entity,s.entity.project)} reads a value and has an internal call`;case be.VariableWritesValuesAndInternalCall:return`${de(s.entity,s.entity.project)} writes values and has an internal call`;case Ce.EmptyName:return`${ds[s.entity.type]} has no name`;case Ce.InvalidObjectStructure:return`${de(s.entity,s.entity.project)} has an invalid structure`;case Ce.LoopBodyFunctionOverwrite:return`${de(s.entity,s.entity.project)}'s loop body action overwrites`;case Ce.MethodOverwritesBaseMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites a base action with same implementation`;case Ce.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another action with same implementation`;case Ce.MissingCaller:return`${de(s.entity,s.entity.project)} is missing a caller`;case Ce.NameAsResolvedCodeNameNotUniqueInScope:return`${de(s.entity,s.entity.project)} has a name that is not unique in the scope`;case Ce.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${de(s.entity,s.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ce.NameMustStartWithLetterOrUnderscore:return`${de(s.entity,s.entity.project)} name must start with letter or underscore`;case Ce.NoOverlapWithImplementedSignature:return`${de(s.entity,s.entity.project)} has no overlap with implemented signature`;case Ce.PropertyOverwritesBasePropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites a base property with same implementation`;case Ce.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${de(s.entity,s.entity.project)} overwrites another property with same implementation`;case Ce.ReaderWriterIncompatibleDataType:return`${de(s.entity,s.entity.project)} has a reader/writer with incompatible data type`;case Td.StatusCodeMustBeBetween100And599:return`${de(s.entity,s.entity.project)} HTTP status code must be between 100 and 599`;case Td.StatusCodeMustBeNumber:return`${de(s.entity,s.entity.project)} HTTP status code must be a number, between 100 and 599`;case cs.UUIDMustBeString:return`${de(s.entity,s.entity.project)} UUID must be a string, eg: "${vp()}"`;case cs.UUIDMustNotContainSpaces:return`${de(s.entity,s.entity.project)} UUID must not contain spaces, eg: "${vp()}"`;case cs.UUIDMustBeValidFormat:return`${de(s.entity,s.entity.project)} UUID must be in a valid format. Eg: "${vp()}"`;case Nn.MustBeUniqueAmongSameEntities:return`${de(s.entity,s.entity.project)} value must be unique among the same kind`;case Nn.StringValueMustNotHaveDashes:return`${de(s.entity,s.entity.project)} value must not contain dashes`;case Nn.StringValueMustNotHaveSpaces:return`${de(s.entity,s.entity.project)} value must not contain spaces`;default:return`${de(s.entity,s.entity.project)} Error: ${CE(s.code)}`}}function OE(s){const p=(s||"").startsWith("error-caller-only--");switch(p?s.replace("error-caller-only--",""):s){case Yt.CallIsInHigherScope:return"In a higher scope";case Yt.CallIsInLowerScope:return"In a lower scope";case Yt.CallerIsInHigherScope:return"Caller is in a higher scope";case Yt.CallerIsInLowerScope:return"Caller is in a lower scope";case Yt.CannotBeCalledByChildren:return"Cannot be called by children";case Yt.CannotCallAncestor:return"Cannot call ancestor";case Yt.CannotConnectToItself:return"Cannot connect to itself";case Yt.CannotReadMoreThanOneValue:return"Cannot read more than one value";case Yt.CannotReadValueFromChildren:return"Cannot read value from entities executed after itself";case Yt.CannotWriteValueToAncestor:return"Cannot write value to ancestor";case hv.Suggestion:return"Suggestion";case Yt.ContinueOrBreakStatementCalledFromOutsideLoop:return"Cannot be called from outside loop";case Yt.DataTypesNotCompatible:return"Data types not compatible";case Yt.ElementInLoopBodyCallingOutsideLoop:return"Cannot call outside loop";case Yt.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees:return"Error cannot be connected to success branch";case Yt.ExecutionsAlreadyConnected:return"Executions already connected";case Yt.IsNotValueReadingEntity:return"Is not a value reading entity";case Yt.IsNotValueWritingEntity:return"Is not a value writing entity";case Yt.NotInScope:return"Not in a compatible scope";case Yt.OtherIncompatibleScopeReason:return"Incompatible scope";case Yt.SiblingInternalCallAlreadyUsedInParentVariable:return"Internal call already used in parent variable";case Yt.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees:return"Success cannot be connected to error branch";case Yt.ValuesAlreadyConnected:return"Values already connected";case Yt.CannotInteractWithInputInVariableWithInternalCalls:return"Cannot interact with input in variable with internal calls";case Yt.CannotInteractWithOutputInVariableWithInternalCalls:return"Cannot interact with output in variable with internal calls";case hv.CanvasGloballyDisabled:return"Canvas is globally disabled";case Yt.PropertyIsConstantItsValueCantBeReset:return"Property is constant, its value can't be reset";case Yt.CannotWriteValueOfGlobalVariableDeclaration:return"Cannot write value of global variable declaration";case Yt.CannotReSetValueOfConstantVariable:return"Cannot re-set value of constant variable";case Yt.CannotConnectToOwnNode:return"It is part of the same node";case Yt.CalledByErrorMustBePassThroughCallable:return"Called by error must be pass-through callable";case Yt.CannotChangeScopeBecauseItCallsOtherEntities:return"Cannot change scope because it calls other entities in its current scope";case Yt.CannotChangeScopeBecauseItIsAlreadyCalledByOtherEntitiesInDifferentScope:return"Cannot change scope because it is already called by other entities in different scope";case Yt.VariableDeclarationCannotBeMovedToLowerScopeBecauseInstancesUsage:return"Variable declaration cannot be moved to lower scope because its instances are used in the current or different incompatible lower scope";case Yt.CalledBySourceMustBeCallerEntity:return"Not a caller type";case Yt.CalledByErrorCannotBeConnectedToEntitiesCalledByOwnSuccessBranch:return"Already connected to the success branch from a common origin caller";case Yt.CalledBySuccessCannotBeConnectedToEntitiesCalledByOwnErrorBranch:return"Already connected to the error branch from a common origin caller";case Yt.RedundantCall:return"Redundant call. Already connected further down the execution path";case Yt.CannotBeCalledBeforeDeclaration:return"Cannot be called before declaration";case Yt.CannotBeCalledInParallelBranchToDeclaration:return"Cannot be called in parallel branch to declaration";case Yt.CannotBeHigherScopeThanDeclaration:return"Cannot be in a higher scope than declaration";case Yt.CannotCallGlobalVariableDeclaration:return"Cannot call global variable declaration";case Yt.EntityAlreadyCalledBySuccessCannotBeConnectedToUnrelatedErrorBranch:return p?"Cannot connect error: Already connected to a success branch from a common origin caller":"Already connected to a success branch from a common origin caller";case Yt.CannotInteractWithInputInGlobalVariableDeclaration:return"Cannot interact with input in global variable declaration";case Yt.IsNotCallableEntity:return"Is not a callable node type";case Yt.IsNotCallerEntity:return"Is not a caller node type";case Yt.IsNotPassThroughCallableEntity:return"Is not a pass-through callable node type that has an error branch";case Yt.NotAConnectableEntityType:return"Not a connectable node type";case Yt.WouldMakeAnEarlierNodeBeCalledBeforeItsDeclaration:return"Would make an earlier node be called before its declaration";default:return $c(s||"")}}function _1i(s,p){const i=[...s,...p],r=Array.from(new Set(i));return{hasChanged:r.length!==s.length,reasons:r}}function V1i(s,p){const i=s.filter(a=>!p.includes(a));return{hasChanged:i.length!==s.length,reasons:i}}function P1i(s,p){return s.find(i=>i.entity.id===p)||null}function oU(s){return s.filter((p,i)=>s.indexOf(p)===i)}class rn{constructor(p,i,r=null,a){R(this,"ids",[]);R(this,"entity");R(this,"entityCardHeight");R(this,"entityCardWidth");R(this,"index");R(this,"childEntities",[]);R(this,"children",[]);R(this,"parents",[]);R(this,"calculationEntryPoint");R(this,"_onlyEntities",null);R(this,"_changeSet",null);if(this.index=i,this.entity=p,this.calculationEntryPoint=r||this,this._changeSet=a||null,this===this.calculationEntryPoint&&!a)throw new Error("Change-set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(p,i,r){const a=TMe-Bg-T$,c=vMe-hg-v$;p.type===d.Project?(p.x=a,p.y=c):p.metaSync({x:p.x||a,y:p.y||c},i);const e=new rn(p,0,null,i);e.calculationEntryPoint=e,e._onlyEntities=r||[],e.ids=["0"];const f=[];e.next(m=>{f.push(...m)}),rn.recursivelyAssembleChildrenAreas(f),e.resolveChildrenOverlaps();const h=e.flattenChildEntities();return e._onlyEntities?h.filter(m=>{var E;return(E=e._onlyEntities)==null?void 0:E.includes(m)}):h}static recursivelyAssembleChildrenAreas(p){const i=[];p.forEach(r=>{r.next(a=>{i.push(...a)})}),i.length>0&&rn.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(a=>a.entity===p);return i||this.children.reduce((a,c)=>a||c.findAreaInChildrenFromEntity(p),null)}findAreaFromEntity(p){if(this.entity===p)return this;const i=this.calculationEntryPoint.children,r=i.find(c=>c.entity===p);return r||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(p),null)}addParent(p){if(!this.parents.includes(p)){const i=rn.resolveIds(p,this.index);this.ids.push(...i),this.parents.push(p)}}static resolveIds(p,i){return p?p.ids.map(r=>`${r}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const p=oo(this.entity,!0);if(this.entity.type===d.Project){const i=[],r=[],a=[];p.forEach(e=>{if(d.DefinitionEntity===e.type){r.push(e);return}else if(Gt.includes(e.type)){a.push(e);return}i.push(e)});const c=i.sort((e,f)=>{const h=!!Wg(e,f).length,m=oo(e),E=oo(f);return h?0:m.length&&!E.length?-1:!m.length&&E.length?1:0}).filter(e=>!jc(e).length);this.childEntities=[...r,...a,...c]}else{const i=[],r=[],a=[],c=[],e=[];Qi.includes(this.entity.type)&&oD(this.entity).forEach(m=>{if(Lt.includes(m.type)){a.push(m);return}const E=yt(m);i.push(E)}),gr.includes(this.entity.type)&&r.push(...this.entity.detachedChildren);const f=p.filter(h=>{const m=i.includes(h);return m||a.includes(h)||r.includes(h)?!1:Lt.includes(h.type)?(a.push(h),!1):rr.includes(h.type)&&!m?(c.push(h),!1):h.type===d.DefinitionEntity?(e.push(h),!1):!0});i.sort((h,m)=>ro(h,m)?-1:0),c.sort((h,m)=>ro(h,m)?-1:0),a.sort((h,m)=>vV(h,m)?1:vV(m,h)?-1:0),this.childEntities=[...e,...i,...c,...f,...a,...r]}}calculateCardSize(){const p=EMe(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 r=p.filter(c=>!i.includes(c));return r.reduce((c,e)=>i.includes(e)?c:rn.getBoundriesOfTwoAreas(c,e.fullBranchArea),r[0].fullBranchArea)}getFullAreaUntilAny(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!p.includes(e)).map(e=>e.getFullAreaUntilAny(p)).reduce((e,f)=>rn.getBoundriesOfTwoAreas(e,f),i)}getFullAreaUntilAreaOrAnyChildren(p){const i=[p,...p.flattenChildren()],r=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(p)).reduce((e,f)=>rn.getBoundriesOfTwoAreas(e,f),r)}getFullAreaUntil(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==p).map(c=>c.getFullAreaUntil(p)).reduce((c,e)=>rn.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(a=>a.fullBranchArea).reduce((a,c)=>rn.getBoundriesOfTwoAreas(a,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+hg,right:p.right+Bg}}static filterOutRepeatedAreas(p){return p.filter((i,r)=>p.indexOf(i)===r)}getEarliestId(p,i){const r=p.split("-"),a=i.split("-");return r.length<a.length?p:r.length>a.length?i:r.reduce((e,f,h)=>f<a[h]?p:i,p)}getEarliestLevel(){return this.ids.reduce((r,a)=>this.getEarliestId(r,a),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const r=this.parents.reduce((a,c)=>c.getEarliestLevel()>a.getEarliestLevel()?c:a,this.parents[0]).countColumns();return p+=r,p}getLatestId(p,i){if(p===i)return p;const r=p.split("-"),a=i.split("-");return r.length<a.length?i:r.length>a.length?p:r.reduce((e,f,h)=>f>a[h]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((r,a)=>this.getLatestId(r,a),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(r=>{r!==this.calculationEntryPoint&&r.shiftDownAlone(i)})}else if([...Gt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(r=>!this.parents.includes(r));i.length?i.every(a=>{const c=this.countColumns(),e=a.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 r=[...p,this];return this.children.forEach(a=>{if(rn.getEarliestParentInChain(a)!==this)return;const e=P1i(r,a.entity.id);r=rn.filterOutRepeatedAreas([...r]),e||(r=r.filter(h=>h!==a));const f=a.shiftDownUntilAny(r,i);r.push(...f)}),r}shiftRightUntilAny(p,i){p.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(r=>{const a=rn.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);rn.getEarliestParentInChain(r)===this&&r.shiftRightUntilAny(a,i)}))}shiftRight(p){this.move(this.entity,{x:this.entity.x+p}),this.children.forEach(i=>{const a=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(a,p)})}shiftDownAlone(p){this.move(this.entity,{y:this.entity.y+p})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const p=this.parents.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+Tf,h={top:f,left:e.left,bottom:f,right:e.right};return rn.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-Tf;this.shiftDownAlone(r)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((a,c)=>{const e=c.ownEntityArea,f=e.top+Tf,h={top:f,left:e.left,bottom:f,right:e.right};return rn.getBoundriesOfTwoAreas(a,h)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),r=(p.bottom-p.top)/2-Tf;return this.shiftDownAlone(r),r}resolveChildrenOverlaps(){const p=this.flattenChildren();let i=[];p.forEach(r=>{const a=r.adjustVerticallyToAvoidOverlaps();i.push(...a)}),p.forEach(r=>{r.smoothPosition()})}static getEarliestParentInChain(p){let i=p.parents[0];return p.parents.length&&(i=p.parents.sort((r,a)=>{if(!r.ids.length)return-1;if(!a.ids.length)return 1;const c=r.ids.sort((f,h)=>f.length<h.length?-1:0),e=a.ids.sort((f,h)=>f.length<h.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((r,a)=>{if(p.has(a.entity.id))return r;p.add(a.entity.id);const e=a.children.slice(0,a.children.indexOf(this)).reduce((f,h)=>[...f,h,...h.flattenChildren(p)],[]);return[...r,...e]},[])}flattenSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((r,a)=>{if(p.has(a.entity.id))return r;p.add(a.entity.id);const e=a.children.filter(f=>f!==this).reduce((f,h)=>[...f,h,...h.flattenChildren(p)],[]);return[...r,...e]},[])}flattenChildren(p=new Set){return this.children.reduce((i,r)=>p.has(r.entity.id)?i:(p.add(r.entity.id),[...i,r,...r.flattenChildren(p)]),[])}flattenParents(p=new Set){return this.parents.reduce((r,a)=>p.has(a.entity.id)?r:(p.add(a.entity.id),[...r,a,...a.flattenParents(p)]),[])}getAreaIfRendered(p){return this.calculationEntryPoint.flattenChildren().find(a=>a.entity.id===p.id)||null}getLowerSiblings(){const p=this.parents.reduce((i,r)=>{const a=r.children.indexOf(this),c=r.children.slice(a+1);return[...i,...c]},[]);return oU(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((r,a)=>[...r,...a.getLowerAreas()],[]);return oU([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const r=rn.getEarliestParentInChain(this).children[this.index-1];if(!r)return p;const a=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...a,...c,r],m=C(e.flatMap(_=>Wg(this.entity,_.entity))).filter(_=>_.id!==this.entity.id).map(_=>this.findAreaFromEntity(_)).filter(_=>!!_),E=this.getFullAreaUntilAny(m),b=r.getFullAreaUntilAny(m),A=e.reduce((_,P)=>P===this||P.fullBranchArea.left!==E.left?_:Math.max(_,P.fullBranchArea.bottom),b.bottom);if(E.top<A){const _=A-E.top+hg;return this.shiftDownUntilAny(p,_)}return p}move(p,i){if(this.onlyEntities.includes(p)){if(!this.changeSet)throw new Error("Change set is not defined for this area, cannot move entity");p.metaSync(i,this.changeSet)}}addChild(p){const i=this.childEntities[p];let r=null;i.x&&i.y?r=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),r||(r=new rn(i,p,this.calculationEntryPoint));const a=this.ownEntityPlusBufferArea;this.children.includes(r)||(this.children.push(r),r.addParent(this));const c=r.fullBranchArea;if(c.left<a.right){const e=a.right-c.left;r.shiftRight(e)}return r}flattenChildEntities(p=new Set){return this.children.reduce((i,r)=>p.has(r.entity.id)?i:(p.add(r.entity.id),[...i,r.entity,...r.flattenChildEntities(p)]),[])}next(p){const i=[];this.childEntities.forEach((r,a)=>{const c=this.addChild(a);c&&i.push(c)}),p(i)}}async function N1i(s,p,i={}){var c;const r=Y.YieldTracker.from(i),a=[];console.log("Generating layout for project...");for(const e of s.instancesList){if(s.diggestedBuiltInBaseEntitiesIds.has(e.id)||!Pf.includes(e.type)||((c=yt(e))==null?void 0:c.id)!==e.id)continue;let f=kt(e,s);if(!f){console.log("No top scope owner for instance: ",e," in project: ",s);continue}if(!(Gt.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s;)f=f.parent,Gt.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,W.Updated),a.push(e),await r.tick()}}rn.autoGenerateLayout(s,p,a)}async function x1i(s,p,i={}){const r=Y.YieldTracker.from(i),a=[],c=[s,...pt(s)].map(e=>yt(e)).filter(Boolean);for(const e of c){if(s.project.diggestedBuiltInBaseEntitiesIds.has(e.id))continue;let f=kt(e,s.project);if(f&&!(Gt.includes(f.type)&&f.collapsed&&f.id!==e.id)){for(;f.parent&&f.parent!==s.project;)f=f.parent,Gt.includes(f.type)&&f.collapsed&&(f.id,e.id);e.x=0,e.y=0,p==null||p.add(e,W.Updated),a.push(e),await r.tick()}}rn.autoGenerateLayout(s.project,p,a)}async function $1i(s,p,i={}){const r=Y.YieldTracker.from(i),a=[],c=new Set;yKe(p,{shallowMissingActivesError:!0,excludeAffected:!0}).forEach(m=>{var b;if((!m.x||!m.y)&&!c.has(m.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(m.id)&&(a.push(m),c.add(m.id)),co(m,s)){const A=yt(m);A&&!c.has(A.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(A.id)&&(a.push(A),c.add(A.id))}if(Qi.includes(m.type)){const A=m;[A,...pt(A)].forEach(P=>{const V=yt(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))})}m.type===d.DefinitionEntity&&m.methods.forEach(A=>{pt(A).forEach(P=>{const V=yt(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))})}),((b=m.parent)==null?void 0:b.type)===d.Project&&(a.push(m),c.add(m.id),Qi.includes(m.type)&&pt(m).forEach(P=>{const V=yt(P);V&&!c.has(V.id)&&!s.diggestedBuiltInBaseEntitiesIds.has(V.id)&&(a.push(V),c.add(V.id))}))});let f=[];for(const m of a)s.diggestedBuiltInBaseEntitiesIds.has(m.id)||(m.x=0,m.y=0,p==null||p.add(m,W.Updated),f.push(m),await r.tick());f=C(f),rn.autoGenerateLayout(s,p,f);const h=C([...f,...s.variableDeclarations,...s.variableInstances,...s.loops,...s.conditions,...s.operations,...s.searches]).filter(m=>m.x===0||m.y===0);rn.autoGenerateLayout(s,p,h)}var $T=(s=>(s.Amazon="amazon",s.Google="google",s.Microsoft="microsoft",s))($T||{}),br=(s=>(s.RelationalDatabase="relational-database",s.CompiledLocalCodebase="compiled-local-codebase",s.CloudHostedCodebase="cloud-hosted-codebase",s.HttpApi="http-api",s.HttpEndpoint="http-endpoint",s.ServerlessFunction="serverless-function",s.CronJob="cron-job",s.AWSTenantAccount="aws-tenant-account",s))(br||{}),S_=(s=>(s.Post="post",s.Get="get",s.Acknowledgement="acknowledgment",s.Progress="progress",s.Error="error",s.Complete="complete",s))(S_||{}),yf=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanedUp="cleaned-up",s.Skipped="skipped",s.AbortedByUser="aborted-by-user",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(yf||{}),Z_=(s=>(s.Queued="queued",s.Running="running",s.Success="success",s.Failed="failed",s.CleanedUp="cleaned-up",s.UnrecoverableFailure="unrecoverable-failure",s.Reverted="reverted",s.UnpublishingStarted="unpublishing-started",s.Unpublished="unpublished",s))(Z_||{}),qt=(s=>(s.ProjectNotFound="project-not-found",s.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",s.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",s.DeploymentCompleted="deployment-completed",s.DeploymentStarted="deployment-started",s.DeploymentFailed="deployment-failed",s.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",s.RequestPayloadValidationFailed="request-payload-validation-failed",s.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",s.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",s.ProjectAlreadyBeingPublished="project-already-being-published",s.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",s.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",s.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",s.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",s.CreatingNewRelationalDatabase="creating-new-relational-database",s.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",s.RelationalDatabaseAlreadyExists="relational-database-already-exists",s.RelationalDatabaseDeletionStarted="relational-database-deletion-started",s.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",s.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",s.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",s.HttpApiDeploymentStarted="http-api-deployment-started",s.HttpApiDeploymentCompleted="http-api-deployment-completed",s.HttpApiDeploymentFailed="http-api-deployment-failed",s.CreatingNewHttpApi="creating-new-http-api",s.HttpApiAlreadyExists="http-api-already-exists",s.HttpApiDeletionStarted="http-api-deletion-started",s.HttpApiDeletionCompleted="http-api-deletion-completed",s.HttpApiDeletionFailed="http-api-deletion-failed",s.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",s.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",s.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",s.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",s.BundlingCodebaseForDownload="bundling-codebase-for-download",s.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",s.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",s.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",s.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",s.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",s.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",s.CodeCompilationStarted="code-compilation-started",s.CodeCompilationCompleted="code-compilation-completed",s.CodeCompilationFailed="code-compilation-failed",s.BundleCodebaseStarted="bundle-codebase-started",s.BundleCodebaseCompleted="bundle-codebase-completed",s.BundleCodebaseFailed="bundle-codebase-failed",s.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",s.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",s.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",s.MigrateRelationalDatabaseStarted="migrate-relational-database-started",s.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",s.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",s.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",s.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",s.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",s.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",s.AWSTenantAccountProvisioningStarted="aws-tenant-account-provisioning-started",s.AWSTenantAccountProvisioningCompleted="aws-tenant-account-provisioning-completed",s.AWSTenantAccountProvisioningFailed="aws-tenant-account-provisioning-failed",s))(qt||{}),Ql=(s=>(s.CodeCompilation="code-compilation",s.RelationalDatabaseDeployment="relational-database-deployment",s.RelationalDatabaseDeletion="relational-database-deletion",s.HttpApiDeployment="http-api-deployment",s.HttpApiDeletion="http-api-deletion",s.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",s.BundleCodebase="bundle-codebase",s.MigrateRelationalDatabase="migrate-relational-database",s.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",s.ExecutePublicationCompletedEvent="execute-publication-completed-event",s.CodebaseCleanup="codebase-cleanup",s.AWSTenantAccountProvisioning="aws-tenant-account-provisioning",s))(Ql||{});br.CloudHostedCodebase,br.HttpApi,br.RelationalDatabase,br.CloudHostedCodebase,br.CloudHostedCodebase,br.RelationalDatabase,br.CloudHostedCodebase,br.CloudHostedCodebase;function AMe(s){return`project-${s}-http-api`}function _1(s){return`entity-${s}-database`}class gMe{constructor(p,i,r,a,c,e,f,h,m){R(this,"stepType");R(this,"id");R(this,"resourceType");R(this,"index");R(this,"dependency",[]);R(this,"lastEvent",null);R(this,"lastEventTimestamp",null);R(this,"status",yf.Queued);R(this,"publicationRun");R(this,"resource");this.stepType=p,this.id=i,this.resourceType=r,this.status=a,this.dependency=c,this.index=e,this.lastEventTimestamp=f,this.publicationRun=h,this.resource=m}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,r;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,(r=this.resource)==null||r.setDetails((i=p.resource)==null?void 0:i.details)}}var IMe=(s=>(s.Ready="ready",s.Provisioning="provisioning",s.Queued="queued",s.ProvisioningFailed="provisioning-failed",s.Deleting="deleting",s.DeletingFailed="deleting-failed",s.Deleted="deleted",s))(IMe||{});class Lc{constructor(p,i,r){R(this,"provisionedBy");R(this,"publicationRun");R(this,"resourceType");R(this,"provider");R(this,"resourceId");R(this,"details",null);R(this,"name",null);R(this,"status","queued");this.publicationRun=p,this.resourceType=i,this.provider=r}setDetails(p){this.details=p}setStatus(p){this.status=p}setProvisionedBy(p){this.provisionedBy=p}}class L1i extends Lc{constructor(i,r,a){super(i,br.HttpEndpoint,a);R(this,"resourceType",br.HttpEndpoint);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=_1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class B1i extends Lc{constructor(i,r,a){super(i,br.ServerlessFunction,a);R(this,"resourceType",br.ServerlessFunction);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=_1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class RMe extends Lc{constructor(i,r,a){super(i,br.HttpApi,a);R(this,"resourceType",br.HttpApi);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=AMe(this.publicationRun.project.id),this.resourceId}}class DMe extends Lc{constructor(i,r,a){super(i,br.RelationalDatabase,a);R(this,"resourceType",br.RelationalDatabase);R(this,"owners",new Map);R(this,"details",null);R(this,"status","queued");r.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,r;return this.resourceId=_1((r=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:r.id),this.resourceId}}class wMe extends Lc{constructor(i,r){super(i,br.CloudHostedCodebase,r);R(this,"resourceType",br.CloudHostedCodebase);R(this,"details",null);R(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class CMe extends Lc{constructor(i,r){super(i,br.CompiledLocalCodebase,r);R(this,"resourceType",br.CompiledLocalCodebase);R(this,"details",null);R(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 M1i extends Lc{constructor(i,r){super(i,br.AWSTenantAccount,r);R(this,"resourceType",br.AWSTenantAccount);R(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`aws-tenant-account--${this.publicationRun.project.id}`,this.resourceId}}class G1i{constructor(p,i){R(this,"id");R(this,"projectAutoIncrementPublicationCount");R(this,"projectPublishedSemanticVersion");R(this,"envIdentifier");R(this,"projectVersion");R(this,"projectBranchId");R(this,"projectId");R(this,"triggeredBy");R(this,"createdAt");R(this,"updatedAt");R(this,"status");R(this,"steps",[]);R(this,"editor");R(this,"explicitResources",new Map);R(this,"implicitGlobalResources",new Map);R(this,"finalGlobalEvent",null);R(this,"finalStatus",null);R(this,"contextType",ae.PublicationRun);R(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.envIdentifier=p.envIdentifier,this.projectVersion=p.projectVersion,this.projectBranchId=p.projectBranchId,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(r=>r.owners.has(p.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(br.CompiledLocalCodebase,new CMe(this,$T.Amazon)),this.implicitGlobalResources.set(br.CloudHostedCodebase,new wMe(this,$T.Amazon));const p=this.project.entities.filter(r=>si(r,Ae.HTTP_ENDPOINT)),i=this.project.entities.filter(r=>si(r,Ae.RELATIONAL_DATABASE));if(i.length&&i.forEach(r=>{const a=new DMe(this,[r],$T.Amazon);this.explicitResources.set(a.resourceId,a)}),p.length){const r=new RMe(this,p,$T.Amazon);this.explicitResources.set(r.resourceId,r)}}setSteps(p,i){p.forEach(r=>{this.addStep(r,i)}),this.editor.events.emit(qt.ProjectPublishRequestAcknowledged,{})}addStep(p,i){const r=p.dependency||[];if(r.length){const c=r.filter(e=>!this.steps.find(f=>f.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===p.id)){const c=new gMe(p.stepType,p.id,p.resourceType,p.status,r,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(Y.Logger.log("onUpdate",p),(i=p.payload)!=null&&i.stepType){const r=this.steps.find(a=>{var c;return a.id===((c=p.payload)==null?void 0:c.id)});r&&B(p.emittedAt).isAfter(B(r.lastEventTimestamp))&&r.update(p.payload)}this.editor.events.emit("publication-updated",{}),p.type===S_.Error?(this.finalStatus=Z_.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===S_.Complete&&(this.finalStatus=Z_.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 p$(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(ae.PublicationRun),this.extensionsRegistry}}function j1i(s){switch(s){case Ql.CodeCompilation:return"Code generation";case Ql.RelationalDatabaseDeployment:return"Database creation";case Ql.HttpApiDeployment:return"HTTP gateway creation";case Ql.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case Ql.BundleCodebase:return"Bundle code";case Ql.MigrateRelationalDatabase:return"Database structure migration";case Ql.BusinessLogicCodebaseDeployment:return"Update servers with new code";case Ql.CodebaseCleanup:return"Code cleanup";case Ql.HttpApiDeletion:return"HTTP gateway deletion";case Ql.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function k1i(s){switch(s){case qt.DeploymentCompleted:return"Successfully published";case qt.DeploymentStarted:return"Publication started";case qt.DeploymentFailed:return"Publication failed";case qt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case qt.RequestPayloadValidationFailed:return"Request payload validation failed";case qt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case qt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case qt.RelationalDatabaseDeploymentStarted:return"Database creation started";case qt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case qt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case qt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case qt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case qt.RelationalDatabaseAlreadyExists:return"Database already exists";case qt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case qt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case qt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case qt.CreatingNewHttpApi:return"Creating new HTTP gateway";case qt.HttpApiAlreadyExists:return"HTTP gateway already exists";case qt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case qt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case qt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case qt.BundlingCodebaseForDownload:return"Bundling code for download";case qt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case qt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case qt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case qt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case qt.CodeCompilationStarted:return"Code generation started";case qt.CodeCompilationCompleted:return"Code generation completed";case qt.CodeCompilationFailed:return"Code generation failed";case qt.BundleCodebaseStarted:return"Code bundling started";case qt.BundleCodebaseCompleted:return"Code bundling completed";case qt.BundleCodebaseFailed:return"Code bundling failed";case qt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case qt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case qt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case qt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case qt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case qt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case qt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case qt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case qt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case qt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case qt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case qt.ProjectNotFound:return"Project not found";case qt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case qt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case qt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case qt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case qt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case qt.RelationalDatabaseDeletionStarted:return"Database deletion started";case qt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case qt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case qt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var OMe=(s=>(s.NO_LOGIC="NO_LOGIC",s.NO_NAME="NO_NAME",s.NO_CHANGES="NO_CHANGES",s.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",s))(OMe||{});function U1i(s){switch(s){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 F1i(s){switch(s){case br.RelationalDatabase:return"Relational database";case br.HttpEndpoint:case br.HttpApi:return"HTTP endpoints";case br.ServerlessFunction:case br.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function K1i(s){switch(s){case yf.Running:return"In progress";case yf.Failed:return"Failed";case yf.Success:return"Succeeded";case yf.Skipped:return"Skipped";case yf.Queued:default:return"Queued"}}function _Me(s){var r;if(!si(s,Ae.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=re["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(s.type===d.BuiltInBaseEntity?si(s,Ae.EXTERNAL_INTEGRATION_CONNECTION)&&(p=H_(s.name)):s.type===d.DefinitionEntity&&s.implements.forEach(a=>{if(si(a,Ae.EXTERNAL_INTEGRATION_CONNECTION)){const c=H_(a==null?void 0:a.name);if(c)return p=c,!0}}),!p){const a=s.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var f;return((f=e.extends)==null?void 0:f.id)===i}));p=(r=a==null?void 0:a.getDefaultValue())==null?void 0:r.value}return p}function q1i(s){return pTe[s]}function H_(s){return s.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?s.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function VMe(s){if(s.type!==d.ActionDescriptor&&s.type!==d.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(s.type===d.ActionDescriptor){const p=s;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(s.type===d.Operation){const p=s.declaration;if(Object.values(hi).includes(p.id))return p.id.split("--")[1]||null}return null}function S1i(s){if(!s)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(Ae).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===s.toLowerCase()))||null}function Z1i(s){return s.type===d.BuiltInBaseEntity||s.type===d.DefinitionEntity?_Me(s):s.type===d.ActionDescriptor||s.type===d.Operation?VMe(s):null}function PMe(s){var a,c,e;if(!si(s,Ae.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=nKe(s,Ae.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const r=re["built-in-base-entity"][i.id].properties.connectionId.id;if(s.type===d.BuiltInBaseEntity){if(si(s,Ae.EXTERNAL_INTEGRATION_CONNECTION)){const f=s.properties.find(h=>{var m;return((m=h.extends)==null?void 0:m.id)===r});f&&(p=(a=f.getDefaultValue())==null?void 0:a.value)}}else if(s.type===d.DefinitionEntity){const f=s.properties.find(h=>!!h.implements.find(m=>m.id===r)||!!h.implements.find(m=>{var E;return((E=m.extends)==null?void 0:E.id)===r}));if(!f&&((c=s.extends)==null?void 0:c.type)===d.DefinitionEntity)return PMe(s.extends);p=(e=f==null?void 0:f.getDefaultValue())==null?void 0:e.value}return p}async function NMe(s,p={}){var f;const i=Y.YieldTracker.from(p),a=[...Aa(s),...In(s),...b$(s),...ga(s),...A$(s)],c=WE(s);a.push(...c);const e=St(s.errors,a);await i.tick();for(const h of s.inputs)await h.validateAsync({tracker:i});for(const h of s.outputs)await h.validateAsync({tracker:i});for(const h of s.internalCalls)await h.validateAsync({tracker:i});return await((f=s.dataType)==null?void 0:f.validateAsync({tracker:i})),e}function xMe(s){var a;(a=s.dataType)==null||a.validate(),s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),s.internalCalls.forEach(c=>c.validate());const i=[...Aa(s),...In(s),...b$(s),...ga(s),...A$(s)],r=WE(s);return i.push(...r),St(s.errors,i)}function b$(s,p){const r=[...s.project.getVariableDeclarations()].filter(a=>a.id!==s.id);return YE(s,[Xi],r,p)}function A$(s){const p=[];if(s.parent!==s.project)return p;if(s.catchesError){const i=gt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotCatchError}`,message:`${ds[s.type].singular} "${de(s,s.project)}" with id "${s.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotCatchError,entity:s});p.push(i.error)}if(s.errorCalls.length){const i=gt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotCallOnError}`,message:`${ds[s.type].singular} "${de(s,s.project)}" with id "${s.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotCallOnError,entity:s});p.push(i.error)}if(s.calledBy.length){const i=gt({id:`${s.id}--${Ce.GlobalVariableDeclarationCannotBeCalled}`,message:`${ds[s.type].singular} "${de(s,s.project)}" with id "${s.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:Te.Error,code:Ce.GlobalVariableDeclarationCannotBeCalled,entity:s});p.push(i.error)}return[]}const H1i=Object.freeze(Object.defineProperty({__proto__:null,validate:xMe,validateAsync:NMe,validateGlobalVariableDeclaration:A$,validateVariableDeclarationName:b$},Symbol.toStringTag,{value:"Module"}));async function $Me(s,p={}){const i=Y.YieldTracker.from(p),a=[...Aa(s),...In(s),...ga(s),...ad(s),...BMe(s)],c=WE(s);a.push(...c);const e=St(s.errors,a);await i.tick();for(const f of s.inputs)await f.validateAsync({tracker:i});for(const f of s.outputs)await f.validateAsync({tracker:i});for(const f of s.internalCalls)await f.validateAsync({tracker:i});return e}function LMe(s){s.inputs.forEach(a=>a.validate()),s.outputs.forEach(a=>a.validate()),s.internalCalls.forEach(a=>a.validate());const i=[...Aa(s),...In(s),...ga(s)],r=WE(s);return i.push(...r),St(s.errors,i)}function BMe(s){const p=[],i=s.declaration.constant;if(i&&s.readsValue){const r=gt({id:`${s.id}--${be.ValueReadingOverridesConstantVariable}`,message:`The '${s.type}' entity "${de(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overriden, but reads a value.`,severity:Te.Error,code:be.ValueReadingOverridesConstantVariable,entity:s});p.push(r.error)}if(i&&s.defaultValue){const r=gt({id:`${s.id}--${be.DefaultValueOverridesConstantVariable}`,message:`The '${s.type}' entity "${de(s,s.project)}" with id "${s.id}" is a constant variable whose value cannot be overridden, but has a 'defaultValue'.`,severity:Te.Error,code:be.DefaultValueOverridesConstantVariable,entity:s});p.push(r.error)}return p}function ad(s){var h;const p=[],i=s.declaration;if((i==null?void 0:i.id)===((h=s.parent)==null?void 0:h.id)||!s.calledBy.length&&!s.successCalls.length&&!s.errorCalls.length&&s.usedInternalCalls.length)return p;const r=pt(s),a=pt(i);!!r.find(m=>m.id===i.id)&&p.push(gt({id:`${s.id}--${be.CalledBeforeDeclaration}`,code:be.CalledBeforeDeclaration,severity:Te.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
55
55
  The 'variable-declaration' must be called before any internal call that references it can be called.`,entity:s}).error);const e=kt(i,s.project),f=kt(s,s.project);if((e==null?void 0:e.type)!==d.Project&&e&&f){const m=!!a.find(E=>E.id===s.id);if((e==null?void 0:e.id)===(f==null?void 0:f.id))m||p.push(gt({id:`${s.id}--${be.CalledInParallelBranchToDeclaration}`,code:be.CalledInParallelBranchToDeclaration,severity:Te.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called in a parallel branch to its 'variable-declaration' '${i.name}' with id "${i.id}".
56
56
  The 'variable-declaration' must be called in a different branch that executes before any internal call that references it can be called.`,entity:s}).error);else if(Ua(f,e,s.project))p.push(gt({id:`${s.id}--${be.HigherScopeThanDeclaration}`,code:be.HigherScopeThanDeclaration,severity:Te.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called in a higher scope than its 'variable-declaration' '${i.name}' with id "${i.id}".
57
57
  The 'variable-declaration' must be called in the same scope or in a higher scope than any internal call that references it.`,entity:s}).error);else if(Ua(e,f,s.project)){let E=f;for(;E.id!==e.id&&E.id!==s.project.id;){const A=kt(E,s.project);if(A.id===e.id)break;E=A}const b=Hm(E);if(b){const _=!!pt(b).find(V=>V.id===i.id),P=!!a.find(V=>V.id===b.id);_?p.push(gt({id:`${s.id}--${be.CalledBeforeDeclaration}`,code:be.CalledBeforeDeclaration,severity:Te.Error,message:`Entity of type "${s.type}" with id "${s.id}" is called before its 'variable-declaration' '${i.name}' with id "${i.id}".
package/dist/index.d.ts CHANGED
@@ -29,6 +29,7 @@ import { InfrastructureResourceType } from '@elyx-code/definitions';
29
29
  import { IPublication } from '@elyx-code/definitions';
30
30
  import { IRelationalDatabaseDetails } from '@elyx-code/definitions';
31
31
  import { IRelationalDatabaseInfrastructureResource } from '@elyx-code/definitions';
32
+ import { IRichProjectRoleDTO } from '@elyx-code/definitions';
32
33
  import { IServerlessFunctionDetails } from '@elyx-code/definitions';
33
34
  import { IServerlessFunctionInfrastructureResource } from '@elyx-code/definitions';
34
35
  import { IWebsocketsClient } from '@elyx-code/common-ts-utils';
@@ -11899,7 +11900,7 @@ export declare enum BaseValueDescriptorIds {
11899
11900
  get logicLoadingPromise(): Promise<void> | null;
11900
11901
  get logic(): ProjectState | null;
11901
11902
  get lastPublishedProjectState(): ProjectState | null;
11902
- get branch(): IActiveBranchHeadResult | null;
11903
+ get branchHead(): IActiveBranchHeadResult | null;
11903
11904
  get projectId(): EntityId;
11904
11905
  get sessionId(): string | null;
11905
11906
  get userAuthorId(): string;
@@ -11918,6 +11919,8 @@ export declare enum BaseValueDescriptorIds {
11918
11919
  get undoableStackValueIndex(): number;
11919
11920
  set undoableStackValueIndex(value: number);
11920
11921
  get activeWorkspace(): IWorkspace;
11922
+ get branches(): IBranch[];
11923
+ get roles(): IRichProjectRoleDTO[];
11921
11924
  get PROJECT_NOTIFICATIONS_CHANNEL(): string;
11922
11925
  getAccessToken(): Promise<string | null>;
11923
11926
  getRefreshToken(): Promise<string | null>;
@@ -11940,6 +11943,7 @@ export declare enum BaseValueDescriptorIds {
11940
11943
  getValueTypePreference(valueOwnerId: EntityId): DynamicValueTypes.DefaultValue | DynamicValueTypes.Testing | null;
11941
11944
  setValueTypePreference(valueOwnerId: EntityId, valueTypePreference: DynamicValueTypes.DefaultValue | DynamicValueTypes.Testing | null): void;
11942
11945
  implementFeature(featureId: string): Promise<PersistChangeSetEntityActionRequestPayload>;
11946
+ getProjectRoles(): Promise<IRichProjectRoleDTO[]>;
11943
11947
  }
11944
11948
 
11945
11949
  export declare type DefaultExtensionContext = DefaultEditorContext | DefaultProjectLogicContext | DefaultPublicationRunContext;
@@ -21255,7 +21259,7 @@ export declare enum BaseValueDescriptorIds {
21255
21259
  }
21256
21260
 
21257
21261
  export declare interface IActiveBranchHeadResult {
21258
- id: string;
21262
+ branchId: string;
21259
21263
  headVersion: string;
21260
21264
  userAuthor: string;
21261
21265
  timestamp: string;
@@ -22113,7 +22117,7 @@ export declare enum BaseValueDescriptorIds {
22113
22117
  env: IEnvConfig;
22114
22118
  logic: ProjectState | null;
22115
22119
  lastPublishedProjectState: ProjectState | null;
22116
- branch: IActiveBranchHeadResult | null;
22120
+ branchHead: IActiveBranchHeadResult | null;
22117
22121
  projectId: EntityId;
22118
22122
  id: string;
22119
22123
  sessionId: string | null;
@@ -22132,6 +22136,8 @@ export declare enum BaseValueDescriptorIds {
22132
22136
  publications: PublicationRun[];
22133
22137
  liveResources: InfrastructureResource_2[] | null;
22134
22138
  activeWorkspace: IWorkspace;
22139
+ branches: IBranch[];
22140
+ roles: IRichProjectRoleDTO[];
22135
22141
  onProjectHeadLoadedCallback: null | ((projectState: ProjectState) => void);
22136
22142
  onLogicLoadingCompleteCallback: null | ((chunk: any) => void);
22137
22143
  onProjectSetupErrorCallback: null | ((error: any) => void);
@@ -22184,6 +22190,7 @@ export declare enum BaseValueDescriptorIds {
22184
22190
  requestExtension<T = any>(moduleId: string): IRegisteredExtension<T>;
22185
22191
  initRegistry(): Promise<ExtensionsRegistry<any>>;
22186
22192
  implementFeature(featureId: string): Promise<PersistChangeSetEntityActionRequestPayload>;
22193
+ getProjectRoles(): Promise<IRichProjectRoleDTO[]>;
22187
22194
  }
22188
22195
 
22189
22196
  export declare interface IEditorContext extends ExtensionContextBase<ExtensionContextType.Editor>, Omit<IEditor, 'onLogicLoadingComplete' | 'onLogicLoadingCompleteCallback' | 'onProjectHeadLoaded' | 'onProjectHeadLoadedCallback' | 'onProjectSetupError' | 'onProjectSetupErrorCallback' | 'onRenderedCallback' | 'handleIncommingWebsocketMessage' | 'handleNotificationChannelsMessage' | 'handlePersistChangeSetMessage' | 'handleReconnectingWebsocket' | 'handleChunkedChangeSetMessage' | 'getLogic' | 'injectLocalImplementationOfSearchExecution' | 'setup' | 'destroy' | 'requestExtension' | 'socket' | 'events' | 'initRegistry' | 'extensionsRegistry' | 'on' | 'emit' | 'off' | 'contextType' | 'registerNonDefaultLocalImplementationsOfModules'> {
package/dist/index.js CHANGED
@@ -122287,8 +122287,8 @@ class dB extends eV {
122287
122287
  get lastPublishedProjectState() {
122288
122288
  return this._editor.lastPublishedProjectState;
122289
122289
  }
122290
- get branch() {
122291
- return this._editor.branch;
122290
+ get branchHead() {
122291
+ return this._editor.branchHead;
122292
122292
  }
122293
122293
  get projectId() {
122294
122294
  return this._editor.projectId;
@@ -122344,6 +122344,12 @@ class dB extends eV {
122344
122344
  get activeWorkspace() {
122345
122345
  return this._editor.activeWorkspace;
122346
122346
  }
122347
+ get branches() {
122348
+ return this._editor.branches;
122349
+ }
122350
+ get roles() {
122351
+ return this._editor.roles;
122352
+ }
122347
122353
  get PROJECT_NOTIFICATIONS_CHANNEL() {
122348
122354
  return this._editor.PROJECT_NOTIFICATIONS_CHANNEL;
122349
122355
  }
@@ -122405,6 +122411,9 @@ class dB extends eV {
122405
122411
  implementFeature(p) {
122406
122412
  return this._editor.implementFeature(p);
122407
122413
  }
122414
+ getProjectRoles() {
122415
+ return this._editor.getProjectRoles();
122416
+ }
122408
122417
  }
122409
122418
  function Qqi(s, p) {
122410
122419
  return p instanceof dB ? p : new dB(s, p);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6906",
3
+ "version": "0.0.6908",
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",