@elyx-code/project-logic-tree 0.0.6730 → 0.0.6731
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -89,7 +89,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
|
|
|
89
89
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(p){return p instanceof this?p:new this(p)}static concat(p,...i){const n=new this(p);return i.forEach(s=>n.set(s)),n}static accessor(p){const n=(this[A4]=this[A4]={accessors:{}}).accessors,s=this.prototype;function c(e){const y=j0(e);n[y]||(YEi(s,e),n[y]=!0)}return Ue.isArray(p)?p.forEach(c):c(p),this}}HI.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ue.reduceDescriptors(HI.prototype,({value:o},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>o,set(n){this[i]=n}}});Ue.freezeMethods(HI);const El=HI;function hO(o,p){const i=this||tN,n=p||i,s=El.from(n.headers);let c=n.data;return Ue.forEach(o,function(y){c=y.call(i,c,s.normalize(),p?p.status:void 0)}),s.normalize(),c}function $xe(o){return!!(o&&o.__CANCEL__)}function Lh(o,p,i){ni.call(this,o??"canceled",ni.ERR_CANCELED,p,i),this.name="CanceledError"}Ue.inherits(Lh,ni,{__CANCEL__:!0});function Lxe(o,p,i){const n=i.config.validateStatus;!i.status||!n||n(i.status)?o(i):p(new ni("Request failed with status code "+i.status,[ni.ERR_BAD_REQUEST,ni.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function XEi(o){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return p&&p[1]||""}function QEi(o,p){o=o||10;const i=new Array(o),n=new Array(o);let s=0,c=0,e;return p=p!==void 0?p:1e3,function(m){const v=Date.now(),E=n[c];e||(e=v),i[s]=m,n[s]=v;let b=c,w=0;for(;b!==s;)w+=i[b++],b=b%o;if(s=(s+1)%o,s===c&&(c=(c+1)%o),v-e<p)return;const P=E&&v-E;return P?Math.round(w*1e3/P):void 0}}function ebi(o,p){let i=0,n=1e3/p,s,c;const e=(v,E=Date.now())=>{i=E,s=null,c&&(clearTimeout(c),c=null),o(...v)};return[(...v)=>{const E=Date.now(),b=E-i;b>=n?e(v,E):(s=v,c||(c=setTimeout(()=>{c=null,e(s)},n-b)))},()=>s&&e(s)]}const fA=(o,p,i=3)=>{let n=0;const s=QEi(50,250);return ebi(c=>{const e=c.loaded,y=c.lengthComputable?c.total:void 0,m=e-n,v=s(m),E=e<=y;n=e;const b={loaded:e,total:y,progress:y?e/y:void 0,bytes:m,rate:v||void 0,estimated:v&&y&&E?(y-e)/v:void 0,event:c,lengthComputable:y!=null,[p?"download":"upload"]:!0};o(b)},i)},g4=(o,p)=>{const i=o!=null;return[n=>p[0]({lengthComputable:i,total:o,loaded:n}),p[1]]},I4=o=>(...p)=>Ue.asap(()=>o(...p)),tbi=na.hasStandardBrowserEnv?((o,p)=>i=>(i=new URL(i,na.origin),o.protocol===i.protocol&&o.host===i.host&&(p||o.port===i.port)))(new URL(na.origin),na.navigator&&/(msie|trident)/i.test(na.navigator.userAgent)):()=>!0,ibi=na.hasStandardBrowserEnv?{write(o,p,i,n,s,c,e){if(typeof document>"u")return;const y=[`${o}=${encodeURIComponent(p)}`];Ue.isNumber(i)&&y.push(`expires=${new Date(i).toUTCString()}`),Ue.isString(n)&&y.push(`path=${n}`),Ue.isString(s)&&y.push(`domain=${s}`),c===!0&&y.push("secure"),Ue.isString(e)&&y.push(`SameSite=${e}`),document.cookie=y.join("; ")},read(o){if(typeof document>"u")return null;const p=document.cookie.match(new RegExp("(?:^|; )"+o+"=([^;]*)"));return p?decodeURIComponent(p[1]):null},remove(o){this.write(o,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function rbi(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function nbi(o,p){return p?o.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):o}function Mxe(o,p,i){let n=!rbi(p);return o&&(n||i==!1)?nbi(o,p):p}const R4=o=>o instanceof El?{...o}:o;function wc(o,p){p=p||{};const i={};function n(v,E,b,w){return Ue.isPlainObject(v)&&Ue.isPlainObject(E)?Ue.merge.call({caseless:w},v,E):Ue.isPlainObject(E)?Ue.merge({},E):Ue.isArray(E)?E.slice():E}function s(v,E,b,w){if(Ue.isUndefined(E)){if(!Ue.isUndefined(v))return n(void 0,v,b,w)}else return n(v,E,b,w)}function c(v,E){if(!Ue.isUndefined(E))return n(void 0,E)}function e(v,E){if(Ue.isUndefined(E)){if(!Ue.isUndefined(v))return n(void 0,v)}else return n(void 0,E)}function y(v,E,b){if(b in p)return n(v,E);if(b in o)return n(void 0,v)}const m={url:c,method:c,data:c,baseURL:e,transformRequest:e,transformResponse:e,paramsSerializer:e,timeout:e,timeoutMessage:e,withCredentials:e,withXSRFToken:e,adapter:e,responseType:e,xsrfCookieName:e,xsrfHeaderName:e,onUploadProgress:e,onDownloadProgress:e,decompress:e,maxContentLength:e,maxBodyLength:e,beforeRedirect:e,transport:e,httpAgent:e,httpsAgent:e,cancelToken:e,socketPath:e,responseEncoding:e,validateStatus:y,headers:(v,E,b)=>s(R4(v),R4(E),b,!0)};return Ue.forEach(Object.keys({...o,...p}),function(E){const b=m[E]||s,w=b(o[E],p[E],E);Ue.isUndefined(w)&&b!==y||(i[E]=w)}),i}const Bxe=o=>{const p=wc({},o);let{data:i,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:c,headers:e,auth:y}=p;if(p.headers=e=El.from(e),p.url=Vxe(Mxe(p.baseURL,p.url,p.allowAbsoluteUrls),o.params,o.paramsSerializer),y&&e.set("Authorization","Basic "+btoa((y.username||"")+":"+(y.password?unescape(encodeURIComponent(y.password)):""))),Ue.isFormData(i)){if(na.hasStandardBrowserEnv||na.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if(Ue.isFunction(i.getHeaders)){const m=i.getHeaders(),v=["content-type","content-length"];Object.entries(m).forEach(([E,b])=>{v.includes(E.toLowerCase())&&e.set(E,b)})}}if(na.hasStandardBrowserEnv&&(n&&Ue.isFunction(n)&&(n=n(p)),n||n!==!1&&tbi(p.url))){const m=s&&c&&ibi.read(c);m&&e.set(s,m)}return p},abi=typeof XMLHttpRequest<"u",sbi=abi&&function(o){return new Promise(function(i,n){const s=Bxe(o);let c=s.data;const e=El.from(s.headers).normalize();let{responseType:y,onUploadProgress:m,onDownloadProgress:v}=s,E,b,w,P,$;function L(){P&&P(),$&&$(),s.cancelToken&&s.cancelToken.unsubscribe(E),s.signal&&s.signal.removeEventListener("abort",E)}let j=new XMLHttpRequest;j.open(s.method.toUpperCase(),s.url,!0),j.timeout=s.timeout;function F(){if(!j)return;const X=El.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),ee={data:!y||y==="text"||y==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:X,config:o,request:j};Lxe(function(oe){i(oe),L()},function(oe){n(oe),L()},ee),j=null}"onloadend"in j?j.onloadend=F:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(F)},j.onabort=function(){j&&(n(new ni("Request aborted",ni.ECONNABORTED,o,j)),j=null)},j.onerror=function(ne){const ee=ne&&ne.message?ne.message:"Network Error",pe=new ni(ee,ni.ERR_NETWORK,o,j);pe.event=ne||null,n(pe),j=null},j.ontimeout=function(){let ne=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const ee=s.transitional||Nxe;s.timeoutErrorMessage&&(ne=s.timeoutErrorMessage),n(new ni(ne,ee.clarifyTimeoutError?ni.ETIMEDOUT:ni.ECONNABORTED,o,j)),j=null},c===void 0&&e.setContentType(null),"setRequestHeader"in j&&Ue.forEach(e.toJSON(),function(ne,ee){j.setRequestHeader(ee,ne)}),Ue.isUndefined(s.withCredentials)||(j.withCredentials=!!s.withCredentials),y&&y!=="json"&&(j.responseType=s.responseType),v&&([w,$]=fA(v,!0),j.addEventListener("progress",w)),m&&j.upload&&([b,P]=fA(m),j.upload.addEventListener("progress",b),j.upload.addEventListener("loadend",P)),(s.cancelToken||s.signal)&&(E=X=>{j&&(n(!X||X.type?new Lh(null,o,j):X),j.abort(),j=null)},s.cancelToken&&s.cancelToken.subscribe(E),s.signal&&(s.signal.aborted?E():s.signal.addEventListener("abort",E)));const q=XEi(s.url);if(q&&na.protocols.indexOf(q)===-1){n(new ni("Unsupported protocol "+q+":",ni.ERR_BAD_REQUEST,o));return}j.send(c||null)})},lbi=(o,p)=>{const{length:i}=o=o?o.filter(Boolean):[];if(p||i){let n=new AbortController,s;const c=function(v){if(!s){s=!0,y();const E=v instanceof Error?v:this.reason;n.abort(E instanceof ni?E:new Lh(E instanceof Error?E.message:E))}};let e=p&&setTimeout(()=>{e=null,c(new ni(`timeout ${p} of ms exceeded`,ni.ETIMEDOUT))},p);const y=()=>{o&&(e&&clearTimeout(e),e=null,o.forEach(v=>{v.unsubscribe?v.unsubscribe(c):v.removeEventListener("abort",c)}),o=null)};o.forEach(v=>v.addEventListener("abort",c));const{signal:m}=n;return m.unsubscribe=()=>Ue.asap(y),m}},obi=lbi,dbi=function*(o,p){let i=o.byteLength;if(!p||i<p){yield o;return}let n=0,s;for(;n<i;)s=n+p,yield o.slice(n,s),n=s},ubi=async function*(o,p){for await(const i of pbi(o))yield*dbi(i,p)},pbi=async function*(o){if(o[Symbol.asyncIterator]){yield*o;return}const p=o.getReader();try{for(;;){const{done:i,value:n}=await p.read();if(i)break;yield n}}finally{await p.cancel()}},D4=(o,p,i,n)=>{const s=ubi(o,p);let c=0,e,y=m=>{e||(e=!0,n&&n(m))};return new ReadableStream({async pull(m){try{const{done:v,value:E}=await s.next();if(v){y(),m.close();return}let b=E.byteLength;if(i){let w=c+=b;i(w)}m.enqueue(new Uint8Array(E))}catch(v){throw y(v),v}},cancel(m){return y(m),s.return()}},{highWaterMark:2})},w4=64*1024,{isFunction:Nb}=Ue,cbi=(({Request:o,Response:p})=>({Request:o,Response:p}))(Ue.global),{ReadableStream:O4,TextEncoder:C4}=Ue.global,_4=(o,...p)=>{try{return!!o(...p)}catch{return!1}},fbi=o=>{o=Ue.merge.call({skipUndefined:!0},cbi,o);const{fetch:p,Request:i,Response:n}=o,s=p?Nb(p):typeof fetch=="function",c=Nb(i),e=Nb(n);if(!s)return!1;const y=s&&Nb(O4),m=s&&(typeof C4=="function"?($=>L=>$.encode(L))(new C4):async $=>new Uint8Array(await new i($).arrayBuffer())),v=c&&y&&_4(()=>{let $=!1;const L=new i(na.origin,{body:new O4,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type");return $&&!L}),E=e&&y&&_4(()=>Ue.isReadableStream(new n("").body)),b={stream:E&&($=>$.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach($=>{!b[$]&&(b[$]=(L,j)=>{let F=L&&L[$];if(F)return F.call(L);throw new ni(`Response type '${$}' is not supported`,ni.ERR_NOT_SUPPORT,j)})});const w=async $=>{if($==null)return 0;if(Ue.isBlob($))return $.size;if(Ue.isSpecCompliantForm($))return(await new i(na.origin,{method:"POST",body:$}).arrayBuffer()).byteLength;if(Ue.isArrayBufferView($)||Ue.isArrayBuffer($))return $.byteLength;if(Ue.isURLSearchParams($)&&($=$+""),Ue.isString($))return(await m($)).byteLength},P=async($,L)=>{const j=Ue.toFiniteNumber($.getContentLength());return j??w(L)};return async $=>{let{url:L,method:j,data:F,signal:q,cancelToken:X,timeout:ne,onDownloadProgress:ee,onUploadProgress:pe,responseType:oe,headers:ce,withCredentials:Te="same-origin",fetchOptions:de}=Bxe($),ye=p||fetch;oe=oe?(oe+"").toLowerCase():"text";let _e=obi([q,X&&X.toAbortSignal()],ne),Pe=null;const Ge=_e&&_e.unsubscribe&&(()=>{_e.unsubscribe()});let xe;try{if(pe&&v&&j!=="get"&&j!=="head"&&(xe=await P(ce,F))!==0){let lt=new i(L,{method:"POST",body:F,duplex:"half"}),ot;if(Ue.isFormData(F)&&(ot=lt.headers.get("content-type"))&&ce.setContentType(ot),lt.body){const[Rt,Pt]=g4(xe,fA(I4(pe)));F=D4(lt.body,w4,Rt,Pt)}}Ue.isString(Te)||(Te=Te?"include":"omit");const Me=c&&"credentials"in i.prototype,Se={...de,signal:_e,method:j.toUpperCase(),headers:ce.normalize().toJSON(),body:F,duplex:"half",credentials:Me?Te:void 0};Pe=c&&new i(L,Se);let je=await(c?ye(Pe,de):ye(L,Se));const Ze=E&&(oe==="stream"||oe==="response");if(E&&(ee||Ze&&Ge)){const lt={};["status","statusText","headers"].forEach(Ri=>{lt[Ri]=je[Ri]});const ot=Ue.toFiniteNumber(je.headers.get("content-length")),[Rt,Pt]=ee&&g4(ot,fA(I4(ee),!0))||[];je=new n(D4(je.body,w4,Rt,()=>{Pt&&Pt(),Ge&&Ge()}),lt)}oe=oe||"text";let Ye=await b[Ue.findKey(b,oe)||"text"](je,$);return!Ze&&Ge&&Ge(),await new Promise((lt,ot)=>{Lxe(lt,ot,{data:Ye,headers:El.from(je.headers),status:je.status,statusText:je.statusText,config:$,request:Pe})})}catch(Me){throw Ge&&Ge(),Me&&Me.name==="TypeError"&&/Load failed|fetch/i.test(Me.message)?Object.assign(new ni("Network Error",ni.ERR_NETWORK,$,Pe),{cause:Me.cause||Me}):ni.from(Me,Me&&Me.code,$,Pe)}}},ybi=new Map,Gxe=o=>{let p=o&&o.env||{};const{fetch:i,Request:n,Response:s}=p,c=[n,s,i];let e=c.length,y=e,m,v,E=ybi;for(;y--;)m=c[y],v=E.get(m),v===void 0&&E.set(m,v=y?new Map:fbi(p)),E=v;return v};Gxe();const iN={http:_Ei,xhr:sbi,fetch:{get:Gxe}};Ue.forEach(iN,(o,p)=>{if(o){try{Object.defineProperty(o,"name",{value:p})}catch{}Object.defineProperty(o,"adapterName",{value:p})}});const P4=o=>`- ${o}`,hbi=o=>Ue.isFunction(o)||o===null||o===!1;function mbi(o,p){o=Ue.isArray(o)?o:[o];const{length:i}=o;let n,s;const c={};for(let e=0;e<i;e++){n=o[e];let y;if(s=n,!hbi(n)&&(s=iN[(y=String(n)).toLowerCase()],s===void 0))throw new ni(`Unknown adapter '${y}'`);if(s&&(Ue.isFunction(s)||(s=s.get(p))))break;c[y||"#"+e]=s}if(!s){const e=Object.entries(c).map(([m,v])=>`adapter ${m} `+(v===!1?"is not supported by the environment":"is not available in the build"));let y=i?e.length>1?`since :
|
|
90
90
|
`+e.map(P4).join(`
|
|
91
91
|
`):" "+P4(e[0]):"as no adapter specified";throw new ni("There is no suitable adapter to dispatch the request "+y,"ERR_NOT_SUPPORT")}return s}const kxe={getAdapter:mbi,adapters:iN};function mO(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new Lh(null,o)}function V4(o){return mO(o),o.headers=El.from(o.headers),o.data=hO.call(o,o.transformRequest),["post","put","patch"].indexOf(o.method)!==-1&&o.headers.setContentType("application/x-www-form-urlencoded",!1),kxe.getAdapter(o.adapter||tN.adapter,o)(o).then(function(n){return mO(o),n.data=hO.call(o,o.transformResponse,n),n.headers=El.from(n.headers),n},function(n){return $xe(n)||(mO(o),n&&n.response&&(n.response.data=hO.call(o,o.transformResponse,n.response),n.response.headers=El.from(n.response.headers))),Promise.reject(n)})}const jxe="1.13.2",WI={};["object","boolean","number","function","string","symbol"].forEach((o,p)=>{WI[o]=function(n){return typeof n===o||"a"+(p<1?"n ":" ")+o}});const N4={};WI.transitional=function(p,i,n){function s(c,e){return"[Axios v"+jxe+"] Transitional option '"+c+"'"+e+(n?". "+n:"")}return(c,e,y)=>{if(p===!1)throw new ni(s(e," has been removed"+(i?" in "+i:"")),ni.ERR_DEPRECATED);return i&&!N4[e]&&(N4[e]=!0,console.warn(s(e," has been deprecated since v"+i+" and will be removed in the near future"))),p?p(c,e,y):!0}};WI.spelling=function(p){return(i,n)=>(console.warn(`${n} is likely a misspelling of ${p}`),!0)};function Tbi(o,p,i){if(typeof o!="object")throw new ni("options must be an object",ni.ERR_BAD_OPTION_VALUE);const n=Object.keys(o);let s=n.length;for(;s-- >0;){const c=n[s],e=p[c];if(e){const y=o[c],m=y===void 0||e(y,c,o);if(m!==!0)throw new ni("option "+c+" must be "+m,ni.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new ni("Unknown option "+c,ni.ERR_BAD_OPTION)}}const Kb={assertOptions:Tbi,validators:WI},Eo=Kb.validators;class yA{constructor(p){this.defaults=p||{},this.interceptors={request:new b4,response:new b4}}async request(p,i){try{return await this._request(p,i)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const c=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?c&&!String(n.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
92
|
-
`+c):n.stack=c}catch{}}throw n}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=wc(this.defaults,i);const{transitional:n,paramsSerializer:s,headers:c}=i;n!==void 0&&Kb.assertOptions(n,{silentJSONParsing:Eo.transitional(Eo.boolean),forcedJSONParsing:Eo.transitional(Eo.boolean),clarifyTimeoutError:Eo.transitional(Eo.boolean)},!1),s!=null&&(Ue.isFunction(s)?i.paramsSerializer={serialize:s}:Kb.assertOptions(s,{encode:Eo.function,serialize:Eo.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Kb.assertOptions(i,{baseUrl:Eo.spelling("baseURL"),withXsrfToken:Eo.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&Ue.merge(c.common,c[i.method]);c&&Ue.forEach(["delete","get","head","post","put","patch","common"],$=>{delete c[$]}),i.headers=El.concat(e,c);const y=[];let m=!0;this.interceptors.request.forEach(function(L){typeof L.runWhen=="function"&&L.runWhen(i)===!1||(m=m&&L.synchronous,y.unshift(L.fulfilled,L.rejected))});const v=[];this.interceptors.response.forEach(function(L){v.push(L.fulfilled,L.rejected)});let E,b=0,w;if(!m){const $=[V4.bind(this),void 0];for($.unshift(...y),$.push(...v),w=$.length,E=Promise.resolve(i);b<w;)E=E.then($[b++],$[b++]);return E}w=y.length;let P=i;for(;b<w;){const $=y[b++],L=y[b++];try{P=$(P)}catch(j){L.call(this,j);break}}try{E=V4.call(this,P)}catch($){return Promise.reject($)}for(b=0,w=v.length;b<w;)E=E.then(v[b++],v[b++]);return E}getUri(p){p=wc(this.defaults,p);const i=Mxe(p.baseURL,p.url,p.allowAbsoluteUrls);return Vxe(i,p.params,p.paramsSerializer)}}Ue.forEach(["delete","get","head","options"],function(p){yA.prototype[p]=function(i,n){return this.request(wc(n||{},{method:p,url:i,data:(n||{}).data}))}});Ue.forEach(["post","put","patch"],function(p){function i(n){return function(c,e,y){return this.request(wc(y||{},{method:p,headers:n?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}yA.prototype[p]=i(),yA.prototype[p+"Form"]=i(!0)});const Fb=yA;class rN{constructor(p){if(typeof p!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const n=this;this.promise.then(s=>{if(!n._listeners)return;let c=n._listeners.length;for(;c-- >0;)n._listeners[c](s);n._listeners=null}),this.promise.then=s=>{let c;const e=new Promise(y=>{n.subscribe(y),c=y}).then(s);return e.cancel=function(){n.unsubscribe(c)},e},p(function(c,e,y){n.reason||(n.reason=new Lh(c,e,y),i(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(p){if(this.reason){p(this.reason);return}this._listeners?this._listeners.push(p):this._listeners=[p]}unsubscribe(p){if(!this._listeners)return;const i=this._listeners.indexOf(p);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const p=new AbortController,i=n=>{p.abort(n)};return this.subscribe(i),p.signal.unsubscribe=()=>this.unsubscribe(i),p.signal}static source(){let p;return{token:new rN(function(s){p=s}),cancel:p}}}const vbi=rN;function Ebi(o){return function(i){return o.apply(null,i)}}function bbi(o){return Ue.isObject(o)&&o.isAxiosError===!0}const YO={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(YO).forEach(([o,p])=>{YO[p]=o});const Abi=YO;function Uxe(o){const p=new Fb(o),i=Exe(Fb.prototype.request,p);return Ue.extend(i,Fb.prototype,p,{allOwnKeys:!0}),Ue.extend(i,p,null,{allOwnKeys:!0}),i.create=function(s){return Uxe(wc(o,s))},i}const En=Uxe(tN);En.Axios=Fb;En.CanceledError=Lh;En.CancelToken=vbi;En.isCancel=$xe;En.VERSION=jxe;En.toFormData=ZI;En.AxiosError=ni;En.Cancel=En.CanceledError;En.all=function(p){return Promise.all(p)};En.spread=Ebi;En.isAxiosError=bbi;En.mergeConfig=wc;En.AxiosHeaders=El;En.formToJSON=o=>xxe(Ue.isHTMLForm(o)?new FormData(o):o);En.getAdapter=kxe.getAdapter;En.HttpStatusCode=Abi;En.default=En;const gbi=En;class Kxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(zn.HttpRequest);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[3]||{},e={method:s[0],url:s[1],params:s[2],headers:c,data:s[4]};J.Logger.log("Axios request config: ",e);const y=await gbi(e);return{value:G.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}const x4=Symbol("missing"),Ibi=o=>o!=null&&typeof o=="object";function dv(o,p){if(typeof o!="string")throw new TypeError(`${p} expects the key to be a string.`);return o}function Mh(o,p){if(typeof o!="string"&&!Array.isArray(o))throw new TypeError(`${p} expects the path to be string or array.`);return o}function Qc(o,p){if(!vr(o))throw new TypeError(`${p} expects the first argument to be an object.`);return o??{}}function Fxe(o,p){const i=dv(p,"ReadKey");return(o??{})[i]}function Sxe(o,p,i){const n=dv(p,"WriteKey"),s=rv(o??{});return s[n]=i,s}function qxe(o,p){const i=dv(p,"DeleteKey"),n=rv(o??{});return delete n[i],n}function Zxe(o,p,i){const n=Qc(o,"ReadNestedKey"),s=Mh(p,"ReadNestedKey");return UV(n,s,i)}function Hxe(o,p,i){const n=Qc(o,"WriteNestedKey"),s=Mh(p,"WriteNestedKey"),c=rv(n);return KV(c,s,!1),wOe(c,s,i,{createMissing:!1})}function Wxe(o,p,i){const n=Qc(o,"WriteSafeNestedKeyRecursively"),s=Mh(p,"WriteSafeNestedKeyRecursively"),c=rv(n);return KV(c,s,!0),wOe(c,s,i,{createMissing:!0})}function zxe(o,p){const i=Qc(o,"DeleteNestedKey"),n=Mh(p,"DeleteNestedKey"),s=rv(i),{target:c,lastKey:e}=KV(s,n,!1);return delete c[e],s}function Jxe(o,p){const i=dv(p,"HasKey"),n=o;return n!=null&&Ibi(n)&&Object.prototype.hasOwnProperty.call(n,i)}function Yxe(o,p,i){const n=dv(p,"KeyValueEquals");return o==null||typeof o!="object"?!1:o[n]===i}function Xxe(o,p){const i=o,n=Mh(p,"HasNestedKey");return UV(i,n,x4)!==x4}function Qxe(o,p,i){const n=Mh(p,"NestedKeyValueEquals");return UV(o,n)===i}function e$e(...o){const p={};for(let i=0;i<o.length;i++){const n=o[i];if(n!=null){if(!vr(n))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,n)}}return p}function t$e(o){const p=Qc(o,"ObjectKeys");return Object.keys(p)}function i$e(o){const p=Qc(o,"ObjectValues");return Object.values(p)}function r$e(o){const p=Qc(o,"ObjectEntries");return Object.entries(p)}class n$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.Validate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)});J.Logger.log("Inputs for entity validation: ",s);const e=NR(s[1]).safeParse(s[0]);return e.success?{value:G.Success,error:null,result:{data:s[0]}}:{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e.error.errors,result:null}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}const Ia=o=>o.map(p=>{var i,n;return((i=p.value)==null?void 0:i.valueAsType)??((n=p.value)==null?void 0:n.value)});class a$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.ReadKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=Fxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class s$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.WriteKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Sxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class l$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.DeleteKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=qxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class o$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.ReadNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Zxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class d$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY,version:"1.0.0",description:"Entity write-nested-key operation implementation module (immutable, no auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.WriteNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Hxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class u$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY,version:"1.0.0",description:"Entity write-safe-nested-key-recursively operation implementation module (immutable, auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.WriteSafeNestedKeyRecursively);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Wxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class p$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.DeleteNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=zxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class c$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Ce.HasKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=Ia(n),e=Jxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class f$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Ce.KeyValueEquals);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Yxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Ce.HasNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=Ia(n),e=Xxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class h$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Ce.NestedKeyValueEquals);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Qxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class m$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Ce.IsInstanceOfType);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,y,m,v,E,b,w,P;try{const $=((c=(s=n[0])==null?void 0:s.value)==null?void 0:c.parent)||((y=(e=n[0])==null?void 0:e.value)==null?void 0:y.standaloneParent),L=(v=(m=n[0])==null?void 0:m.value)==null?void 0:v.value,j=(b=(E=n[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!L)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!j)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!$)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(j.type!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType expects expectedType to be a DefinitionEntity.");const F=$.getDataType(null);if(((w=F==null?void 0:F.entity)==null?void 0:w.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let q=!1;return((P=F==null?void 0:F.entity)==null?void 0:P.id)!==(j==null?void 0:j.id)?q=!1:NR(F==null?void 0:F.entity).safeParse(L).success?q=!0:q=!1,{value:G.Success,error:null,result:q}}catch($){return{value:G.UnhandledError,error:$,result:null}}}})}}class T$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic);if(!n)return;const s=n.get(Ce.Merge);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const s=Ia(n),c=e$e(...s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class v$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic);if(!n)return;const s=n.get(Ce.Keys);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=t$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class E$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic);if(!n)return;const s=n.get(Ce.Values);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=i$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class b$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic);if(!n)return;const s=n.get(Ce.Entries);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=r$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}let ss=null;try{ss=require("crypto")}catch{}const Lm=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:ss&&ss.webcrypto?ss.webcrypto:null,Ru=Lm?Lm.subtle:null;function qm(o){const p=new ArrayBuffer(o.byteLength);return new Uint8Array(p).set(o),p}function Hr(o,p="utf8"){if(o instanceof Uint8Array)return o;const i=String(o);if(p==="utf8"){if(typeof TextEncoder<"u")return new TextEncoder().encode(i);if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"utf8"))}else if(p==="hex"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"hex"))}else if(p==="base64"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"base64"))}else if(p==="base64url"){const n=i.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(n,"base64"));const s=typeof atob=="function"?atob(n):"",c=new Uint8Array(s.length);for(let e=0;e<s.length;e++)c[e]=s.charCodeAt(e);return c}throw new Error(`Unsupported environment/encoding combo for toBytes(${p})`)}function Ql(o,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(o);if(typeof Buffer<"u")return Buffer.from(o).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(o).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(o).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(o).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const A$e=o=>Hr(o,"base64"),g$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64")},Dy=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64url")},Oc=o=>Hr(o,"base64url"),I$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"hex")},R$e=o=>Hr(o,"hex");function nN(o){if(Lm&&Lm.getRandomValues){const p=new Uint8Array(o);return Lm.getRandomValues(p),p}if(ss&&ss.randomBytes)return new Uint8Array(ss.randomBytes(o));throw new Error("Secure random not available")}function zI(o,p){if(!(o instanceof Uint8Array)||!(p instanceof Uint8Array)||o.length!==p.length)return!1;let i=0;for(let n=0;n<o.length;n++)i|=o[n]^p[n];return i===0}function D$e(o,p,i,n){if((typeof o!="string"||typeof p!="string")&&typeof o!="string"&&typeof p!="string")throw new Error("Invalid input types");const s=i??"utf8",c=n??"utf8",e=Hr(o??"",s),y=Hr(p??"",c);return zI(e,y)}async function w$e(o,p){if(Ru){const i=await Ru.digest({name:o},qm(p));return new Uint8Array(i)}if(ss){const i=o.replace("SHA-","sha"),n=ss.createHash(i);return n.update(Buffer.from(p)),new Uint8Array(n.digest())}throw new Error("Hash not available")}async function O$e(o,p,i,n){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const s=String(o??"SHA-256"),c=i??"utf8",e=n??"base64url",y=Hr(p??"",c),m=await w$e(s,y);return Ql(m,e)}async function JI(o,p,i){if(Ru){const n=await Ru.importKey("raw",qm(p),{name:"HMAC",hash:{name:o}},!1,["sign"]),s=await Ru.sign("HMAC",n,qm(i));return new Uint8Array(s)}if(ss){const n=`sha${o.split("-")[1]}`,s=ss.createHmac(n,Buffer.from(p));return s.update(Buffer.from(i)),new Uint8Array(s.digest())}throw new Error("HMAC not available")}async function C$e(o,p,i,n,s,c){if(typeof o!="string"||typeof p!="string")throw new Error("Invalid input types for key or data; expected strings");const e=String(i??"SHA-256"),y=n??"utf8",m=s??"utf8",v=c??"base64url",E=Hr(o??"",y),b=Hr(p??"",m),w=await JI(e,E,b);return Ql(w,v)}async function YI(o,p,{iterations:i,length:n,hashAlg:s="SHA-256"}){if(Ru){const c=await Ru.importKey("raw",qm(o),"PBKDF2",!1,["deriveBits"]),e=await Ru.deriveBits({name:"PBKDF2",salt:qm(p),iterations:i,hash:s},c,n*8);return new Uint8Array(e)}if(ss){const c=s==="SHA-512"?"sha512":"sha256";return await new Promise((e,y)=>{ss.pbkdf2(Buffer.from(o),Buffer.from(p),i,n,c,(m,v)=>{m?y(m):e(new Uint8Array(v))})})}throw new Error("PBKDF2 not available")}async function _$e(o,p,i,n,s,c,e,y){if(typeof o!="string"||typeof p!="string")throw new Error("Invalid input types for password or salt; expected strings");const m=c??"utf8",v=e??"utf8",E=y??"base64url",b=Math.max(1,Number(i)||21e4),w=Math.max(1,Number(n)||32),P=s??"SHA-256",$=Hr(o??"",m),L=Hr(p??"",v),j=await YI($,L,{iterations:b,length:w,hashAlg:P});return Ql(j,E)}async function P$e(o,p=nN(16),i=21e4,n=32,s="SHA-256"){const c=Hr(o,"utf8"),e=await YI(c,p,{iterations:i,length:n,hashAlg:s}),y=Dy(p),m=Dy(e);return`pbkdf2$${s.toLowerCase()}$${i}$${y}$${m}`}async function V$e(o,p){const i=String(p).split("$");if(i.length!==5||i[0]!=="pbkdf2")return!1;const n=i[1].toLowerCase(),s=parseInt(i[2],10),c=Oc(i[3]),e=Oc(i[4]),y=n.includes("512")?"SHA-512":"SHA-256",m=await YI(Hr(o,"utf8"),c,{iterations:s,length:e.length,hashAlg:y});return zI(m,e)}async function N$e(o,p,i,n,s,c){const e=p!=null?Math.max(1,Number(p)||0):void 0,y=i!=null?Math.max(1,Number(i)||0):void 0,m=n??void 0,v=c??"base64url",E=s!=null?Hr(s,v):void 0;return await P$e(String(o??""),E,e,y,m)}function $4(o){return Dy(Hr(JSON.stringify(o),"utf8"))}function hA(o){try{return JSON.parse(Ql(Oc(o),"utf8"))}catch{return null}}async function x$e(o,p,{alg:i="HS256",includeIat:n=!0,expiresInSeconds:s,notBeforeSeconds:c,issuer:e,subject:y,audience:m,jwtid:v,header:E={}}={}){const b={alg:i,typ:"JWT",...E},w=Math.floor(Date.now()/1e3),P={...o||{}};n&&(P.iat=w),typeof s=="number"&&(P.exp=w+s),typeof c=="number"&&(P.nbf=w+c),e&&(P.iss=e),y&&(P.sub=y),m&&(P.aud=m),v&&(P.jti=v);const $=$4(b),L=$4(P),j=Hr(`${$}.${L}`,"utf8"),q=await JI(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,j),X=Dy(q);return`${$}.${L}.${X}`}async function $$e(o,p,i,n,s,c,e,y,m,v,E,b){if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(o!=null&&typeof o!="object")throw new Error("Invalid input type for payload; expected object");if(E!=null&&typeof E!="object")throw new Error("Invalid input type for header; expected object");if(v!=null&&typeof v!="string")throw new Error("Invalid input type for jwtid; expected string");if(e!=null&&typeof e!="string")throw new Error("Invalid input type for issuer; expected string");if(y!=null&&typeof y!="string")throw new Error("Invalid input type for subject; expected string");if(m!=null&&typeof m!="string"&&!Array.isArray(m))throw new Error("Invalid input type for audience; expected string or string[]");const P=Hr(p??"",b??"utf8");return await x$e(o??{},P,{alg:i??"HS256",includeIat:n==null?!0:!!n,expiresInSeconds:s!=null?Number(s):void 0,notBeforeSeconds:c!=null?Number(c):void 0,issuer:e??void 0,subject:y??void 0,audience:m??void 0,jwtid:v??void 0,header:E??void 0})}async function L$e(o,p,{alg:i="HS256",issuer:n,audience:s,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[y,m,v]=String(o).split(".");if(!y||!m||!v)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=hA(y),b=hA(m);if(!E||!b)return{valid:!1,header:E,payload:b,reason:"Bad base64/json"};if(E.alg!==i)return{valid:!1,header:E,payload:b,reason:"Alg mismatch"};const w=Hr(`${y}.${m}`,"utf8"),$=await JI(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,w),L=Oc(v);if(!zI($,L))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const j=Math.floor(Date.now()/1e3),F=Math.max(0,Number(e)||0);if(b.nbf!=null&&j+F<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&j-F>=Number(b.exp))return{valid:!1,header:E,payload:b,reason:"Expired"};if(n&&b.iss!==n)return{valid:!1,header:E,payload:b,reason:"Issuer mismatch"};if(s){const q=b.aud;if(!(Array.isArray(q)?q.includes(s):q===s))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&j-Number(b.iat)>Number(c)+F?{valid:!1,header:E,payload:b,reason:"MaxAge exceeded"}:{valid:!0,header:E,payload:b}}catch(y){return{valid:!1,header:null,payload:null,reason:String((y==null?void 0:y.message)??y)}}}async function M$e(o,p,i,n,s,c,e,y){if(typeof o!="string")throw new Error("Invalid input type for token; expected string");if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(typeof n!="string")throw new Error("Invalid input type for issuer; expected string");if(s!=null&&typeof s!="string")throw new Error("Invalid input type for audience; expected string");const v=Hr(p??"",y??"utf8");return await L$e(String(o??""),v,{alg:i??"HS256",issuer:n??void 0,audience:s??void 0,maxAgeSeconds:c!=null?Number(c):void 0,clockSkewSeconds:e!=null?Number(e):void 0})}function B$e(o){const[p,i,n]=String(o).split(".");return{header:p?hA(p):null,payload:i?hA(i):null,signature:n?Oc(n):new Uint8Array}}function G$e(o,p){if(!o)throw new Error("Token is required for decoding");if(typeof o!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:n,payload:s,signature:c}=B$e(String(o??"")),e=Ql(c,i);return{header:n,payload:s,signature:e}}class k$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(et.GenerateRandomBytes);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)}),e=Math.max(0,Number(s)||0),y=c??"base64url",m=nN(e),v=Ql(m,y);return{value:G.Success,error:null,result:v}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class j$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomInteger);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[0],e=s[1],y=dOe(c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class U$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomFloat);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=jI();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class K$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomHexadecimal);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=$V(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class F$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomBase62);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=LV(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class S$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=pOe(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomAlphanumeric);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=MV(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateIdentifier);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[0],e=s[1],y=BV(c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class H$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomUUIDv4);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=Iu();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class W$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{J.Logger.log("Initializing Random Generate Short Identifier Module");const n=i.find(s=>s.contextType===Y.Logic);if(n){J.Logger.log("Project state found, setting up operation");const s=n.get(et.GenerateShortIdentifier);s?(J.Logger.log("Operation found, setting autoexecutable and implementation"),s.autoexecutable=!0,s.implementation=this.module.main):J.Logger.warn("Operation generate-short-identifier not found in project state")}else J.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,n)=>{try{const s=cOe();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateHexadecimalToken);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=fOe();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}function Rbi(o){let p;if(o===null?p="null":Array.isArray(o)?p="array":p=typeof o,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class J$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(ze.GetTypeOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)||((m=e.value)==null?void 0:m.value)})[0];return{value:G.Success,error:null,result:Rbi(c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.ToString);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=String(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class X$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.ToNumber);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=Number(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.ToBytes);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)}),y=Hr(s,c||"utf8");return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class eLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.FromBytesToString);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)}),y=Ql(s,c||"utf8");return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class tLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.EncodeBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)});return{value:G.Success,error:null,result:g$e(s,c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class iLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.DecodeBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=A$e(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class rLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.EncodeBase64Url);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Dy(s,c||"utf8");return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class nLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.DecodeBase64Url);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=Oc(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class aLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.EncodeHex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=I$e(s,c||"utf8");return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class sLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.DecodeHex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=R$e(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class lLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ai.Hash);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:O$e(s,c,e,y)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class oLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ai.Hmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)});return{value:G.Success,error:null,result:C$e(c,e,s,y,m,v)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class dLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ai.ConstantTimeEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:D$e(s,c,e,y)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class uLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ai.DeriveKeyPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b]=n.map(w=>{var P,$;return((P=w.value)==null?void 0:P.valueAsType)??(($=w.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:_$e(s,c,e,y,m,v,E,b)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class pLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Qr.Parse);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{var s;try{const c=(s=n[0].value)==null?void 0:s.value;if(typeof c!="string")throw new Error(`Invalid input type for JSON.parse operation: expected string, got ${typeof c}`);const e=JSON.parse(c);return{value:G.Success,error:null,result:e}}catch(c){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:c,result:null}}}})}}class cLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Qr.Stringify);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{var s,c;try{const e=(s=n[0].value)==null?void 0:s.value,y=(c=n[1].value)==null?void 0:c.value;if(!e||typeof e!="object"&&!Array.isArray(e))throw new Error(`Invalid input type for JSON.stringify operation: expected object or array, got ${typeof e}`);if(!y&&y!==0){const v=JSON.stringify(e);return{value:G.Success,error:null,result:v}}const m=JSON.stringify(e,null,y);return{value:G.Success,error:null,result:m}}catch(e){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e,result:null}}}})}}class fLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Xi.BuildJwtHmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b,w,P,$,L]=n.map(j=>{var F,q;return((F=j.value)==null?void 0:F.valueAsType)??((q=j.value)==null?void 0:q.value)});return{value:G.Success,error:null,result:await $$e(s,c,e,y,m,v,E,b,w,P,$,L)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class yLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Xi.VerifyJwtHmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b]=n.map(w=>{var P,$;return((P=w.value)==null?void 0:P.valueAsType)??(($=w.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:await M$e(s,c,e,y,m,v,E,b)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class hLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Xi.DecodeJwt);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)});return{value:G.Success,error:null,result:G$e(s,c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class mLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(en.HashPasswordPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)});return{value:G.Success,error:null,result:await N$e(s,c,e,y,m,v)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class TLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(en.VerifyPasswordPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=await V$e(String(s??""),String(c??""));return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class XO extends KI{constructor(p,i,n=i.projectId){super(p,Y.Editor),this._editor=i,this.id=n}get ready(){return this._editor.ready}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branch(){return this._editor.branch}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,i){return this._editor.initTest(p,i)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p){return this._editor.copyEntities(p)}resolveInitialChildrenPositions(p,i,n){return this._editor.resolveInitialChildrenPositions(p,i,n)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,i=!1){return this._editor.requestActiveDynamicValue(p,i)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,i){return this._editor.setValueTypePreference(p,i)}}function Dbi(o,p){return p instanceof XO?p:new XO(o,p)}class QO extends KI{constructor(p,i){super(p,Y.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get projectVersion(){return this._publicationRun.projectVersion}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function wbi(o,p){return p instanceof QO?p:new QO(o,p)}function Obi(o){o.register(new zOe(o)),o.register(new WOe(o)),o.register(new SOe(o)),o.register(new ZOe(o)),o.register(new HOe(o)),o.register(new qOe(o)),o.register(new NNe(o)),o.register(new xNe(o)),o.register(new $Ne(o)),o.register(new MNe(o)),o.register(new LNe(o)),o.register(new BNe(o)),o.register(new j$e(o)),o.register(new U$e(o)),o.register(new K$e(o)),o.register(new F$e(o)),o.register(new S$e(o)),o.register(new q$e(o)),o.register(new Z$e(o)),o.register(new H$e(o)),o.register(new W$e(o)),o.register(new z$e(o)),o.register(new VVe(o)),o.register(new NVe(o)),o.register(new xVe(o)),o.register(new $Ve(o)),o.register(new LVe(o)),o.register(new MVe(o)),o.register(new BVe(o)),o.register(new GVe(o)),o.register(new kVe(o)),o.register(new jVe(o)),o.register(new UVe(o)),o.register(new KVe(o)),o.register(new FVe(o)),o.register(new SVe(o)),o.register(new qVe(o)),o.register(new ZVe(o)),o.register(new HVe(o)),o.register(new WVe(o)),o.register(new zVe(o)),o.register(new XVe(o)),o.register(new QVe(o)),o.register(new eNe(o)),o.register(new YPe(o)),o.register(new XPe(o)),o.register(new QPe(o)),o.register(new eVe(o)),o.register(new tVe(o)),o.register(new iVe(o)),o.register(new rVe(o)),o.register(new nVe(o)),o.register(new aVe(o)),o.register(new lVe(o)),o.register(new oVe(o)),o.register(new dVe(o)),o.register(new uVe(o)),o.register(new pVe(o)),o.register(new yPe(o)),o.register(new hPe(o)),o.register(new mPe(o)),o.register(new n$e(o)),o.register(new Kxe(o)),o.register(new f_e(o)),o.register(new y_e(o)),o.register(new h_e(o)),o.register(new m_e(o)),o.register(new T_e(o)),o.register(new v_e(o)),o.register(new E_e(o)),o.register(new b_e(o)),o.register(new A_e(o)),o.register(new $_e(o)),o.register(new pPe(o)),o.register(new cPe(o)),o.register(new fPe(o)),o.register(new g_e(o)),o.register(new I_e(o)),o.register(new R_e(o)),o.register(new D_e(o)),o.register(new w_e(o)),o.register(new O_e(o)),o.register(new C_e(o)),o.register(new __e(o)),o.register(new P_e(o)),o.register(new V_e(o)),o.register(new N_e(o)),o.register(new x_e(o)),o.register(new L_e(o)),o.register(new M_e(o)),o.register(new B_e(o)),o.register(new G_e(o)),o.register(new k_e(o)),o.register(new j_e(o)),o.register(new U_e(o)),o.register(new K_e(o)),o.register(new F_e(o)),o.register(new S_e(o)),o.register(new q_e(o)),o.register(new Z_e(o)),o.register(new tPe(o)),o.register(new iPe(o)),o.register(new rPe(o)),o.register(new H_e(o)),o.register(new W_e(o)),o.register(new z_e(o)),o.register(new J_e(o)),o.register(new Y_e(o)),o.register(new X_e(o)),o.register(new Q_e(o)),o.register(new ePe(o)),o.register(new o$e(o)),o.register(new d$e(o)),o.register(new u$e(o)),o.register(new p$e(o)),o.register(new a$e(o)),o.register(new s$e(o)),o.register(new l$e(o)),o.register(new c$e(o)),o.register(new y$e(o)),o.register(new m$e(o)),o.register(new f$e(o)),o.register(new h$e(o)),o.register(new T$e(o)),o.register(new b$e(o)),o.register(new v$e(o)),o.register(new E$e(o)),o.register(new cVe(o)),o.register(new mVe(o)),o.register(new TVe(o)),o.register(new bVe(o)),o.register(new AVe(o)),o.register(new gVe(o)),o.register(new IVe(o)),o.register(new RVe(o)),o.register(new DVe(o)),o.register(new wVe(o)),o.register(new OVe(o)),o.register(new vVe(o)),o.register(new EVe(o)),o.register(new yVe(o)),o.register(new hVe(o)),o.register(new fVe(o)),o.register(new sVe(o)),o.register(new _Ve(o)),o.register(new PVe(o)),o.register(new CVe(o)),o.register(new kNe(o)),o.register(new dxe(o)),o.register(new oxe(o)),o.register(new uxe(o)),o.register(new pxe(o)),o.register(new KNe(o)),o.register(new FNe(o)),o.register(new zNe(o)),o.register(new HNe(o)),o.register(new sxe(o)),o.register(new exe(o)),o.register(new ixe(o)),o.register(new nxe(o)),o.register(new rxe(o)),o.register(new WNe(o)),o.register(new YNe(o)),o.register(new XNe(o)),o.register(new JNe(o)),o.register(new GNe(o)),o.register(new SNe(o)),o.register(new txe(o)),o.register(new yxe(o)),o.register(new HO(o)),o.register(new UNe(o)),o.register(new qNe(o)),o.register(new jNe(o)),o.register(new axe(o)),o.register(new ZNe(o)),o.register(new QNe(o)),o.register(new lxe(o)),o.register(new fxe(o)),o.register(new cxe(o)),o.register(new hxe(o)),o.register(new HO(o)),o.register(new Txe(o)),o.register(new mxe(o)),o.register(new vxe(o)),o.register(new hNe(o)),o.register(new mNe(o)),o.register(new TNe(o)),o.register(new iNe(o)),o.register(new YVe(o)),o.register(new sNe(o)),o.register(new uNe(o)),o.register(new JVe(o)),o.register(new pNe(o)),o.register(new yNe(o)),o.register(new oNe(o)),o.register(new lNe(o)),o.register(new cA(o)),o.register(new vNe(o)),o.register(new ENe(o)),o.register(new dNe(o)),o.register(new fNe(o)),o.register(new cNe(o)),o.register(new aNe(o)),o.register(new nNe(o)),o.register(new rNe(o)),o.register(new tNe(o)),o.register(new gNe(o)),o.register(new ANe(o)),o.register(new INe(o)),o.register(new bNe(o)),o.register(new lPe(o)),o.register(new nPe(o)),o.register(new sPe(o)),o.register(new oPe(o)),o.register(new dPe(o)),o.register(new aPe(o)),o.register(new uPe(o)),o.register(new J$e(o)),o.register(new iLe(o)),o.register(new nLe(o)),o.register(new sLe(o)),o.register(new tLe(o)),o.register(new rLe(o)),o.register(new aLe(o)),o.register(new eLe(o)),o.register(new Q$e(o)),o.register(new X$e(o)),o.register(new Y$e(o)),o.register(new pLe(o)),o.register(new cLe(o)),o.register(new dLe(o)),o.register(new uLe(o)),o.register(new k$e(o)),o.register(new lLe(o)),o.register(new oLe(o)),o.register(new yLe(o)),o.register(new fLe(o)),o.register(new hLe(o)),o.register(new mLe(o)),o.register(new TLe(o)),o.register(new YOe(o)),o.register(new XOe(o)),o.register(new uA(o)),o.register(new pA(o))}class aN{constructor(p=new J.Events("extensions-registry-fallback-events")){I(this,"extensionsRegistry",new Map);I(this,"initialized",new Set);I(this,"initializedContexts",new Set);I(this,"onResolveEditorContextCallback",()=>null);I(this,"onResolveProjectLogicContextCallback",()=>null);I(this,"onResolveEditorGUIContextCallback",()=>null);I(this,"onResolveGUIContextCallback",()=>null);I(this,"onResolveCompileContextCallback",()=>null);I(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,i)=>(p.manifest.initPriority||Ee.Normal)-(i.manifest.initPriority||Ee.Normal))}async setup(){Obi(this),J.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case Y.Editor:return this.onResolveEditorContextCallback();case Y.Logic:return this.onResolveProjectLogicContextCallback();case Y.EditorGUI:return this.onResolveEditorGUIContextCallback();case Y.Compile:return this.onResolveCompileContextCallback();case Y.PublicationRun:return this.onResolvePublicationRunContextCallback();case Y.GUI:return this.onResolveGUIContextCallback();case Y.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,i=[]){const n=[];i.length===0&&(i=p.manifest.contexts);for(const s of i){const c=this.requestContext(s);c&&n.push(c)}return n}requestExtension(p){const i=this.extensionsRegistry.get(p);if(i)return i;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){var p,i;for(const n of this.extensionInOrder)if(n.module.init&&!this.initialized.has(n.manifest.id)){const s=n.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);s.length&&(await((i=(p=n.module).init)==null?void 0:i.call(p,s)),this.initialized.add(n.manifest.id))}else!n.module.init&&!this.initialized.has(n.manifest.id)&&this.initialized.add(n.manifest.id)}async initForReady(){J.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){J.Logger.log("Initializing "+p.manifest.id+" extension...");const i=this.requestContexts(p);p.manifest.contexts.every(s=>!!i.find(c=>c.contextType===s))?(await p.module.init(i),this.initialized.add(p.manifest.id)):J.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(s=>s.contextType).join(", ")}`)}else!p.module.init&&!this.initialized.has(p.manifest.id)?(J.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):J.Logger.log(`Skipping initialization of ${p.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,i){this.events.on(p,i)}emit(p,...i){this.events.emit(p,...i)}off(p,i){this.events.off(p,i)}emitAsync(p,...i){return this.events.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.events.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.events.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.events.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.events.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.events.emitAsyncSequentiallyAllSettled(p,...i)}async contextAvailable(p){if(this.initializedContexts.has(p)){J.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case Y.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case Y.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}J.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,i){window.localStorage.setItem("dynamic-value-type-preference--"+p,(i==null?void 0:i.toString())||""),this.emit(p,{})}}let xb=null;const sN={requestExtension:o=>(xb||(xb=new aN,xb.setup()),xb.requestExtension(o))},Tu={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var lN=(o=>(o.FinishedSuccess="finished-success",o.FinishedError="finished-error",o.Running="running",o.Paused="paused",o.Stopped="stopped",o.NotStarted="not-started",o))(lN||{});const vLe={...sN,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class Au extends J.Events{constructor(i,n,s,c=null,e=vLe){super();I(this,"project");I(this,"entryPoint");I(this,"state","not-started");I(this,"events",new J.Events("fe-exec-inst-events"));I(this,"entities",[]);I(this,"parentExecution",null);I(this,"executing",[]);I(this,"executed",[]);I(this,"skipped",[]);I(this,"scheduled",[]);I(this,"localTestValues");I(this,"resolvedValues");I(this,"persistedExecutionResults");I(this,"lastExecutionResults");I(this,"onAddToSkippedListCallback",null);I(this,"onRemoveFromSkippedListCallback",null);I(this,"onAddEntityCallback",null);I(this,"onRemoveEntityCallback",null);I(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=i,this.parentExecution=c,this.localTestValues=new _m(x.UUID.uuid(),this.project),this.resolvedValues=new _m(x.UUID.uuid(),this.project),this.persistedExecutionResults=new _m(x.UUID.uuid(),this.project),this.lastExecutionResults=new _m(x.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Zr.includes(i.type)&&wt(i).forEach(n=>this.skip(n))))}async schedule(i,n,s){if(this.hasExecuted(i))return null;if(Yt.includes(i.type))return this.executeBranch(i,s,n);if(qr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,s,n);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,n){const s=[];return[...Qt,...Yt].includes(n.type)?s.push(...n.inputs):qt.includes(n.type)&&s.push(...n.outputs),s.map(e=>{var m;let y=i.find(v=>v.valueOwner.id===e.id);if(y)return y;if(!y&&Yt.includes(n.type)&&(y=i.find(v=>{var E;return((E=v.valueOwner.declaration)==null?void 0:E.id)===e.id})),y){const v=(m=y.value)==null?void 0:m.clone(null);return v==null||v.setStandaloneParent(e,null),{...y,valueOwner:e,value:v||null,inheritanceLink:{sources:[y],target:e}}}return Ma.includes(e.type)?Ao(e,this.valueResolutionContext):$u(e,this.valueResolutionContext)}).reduce((e,y)=>{const m=Oo(y==null?void 0:y.valueOwner,this.project),v=y?[y]:[];return m.forEach(E=>{var P,$,L;if(E.id===(y==null?void 0:y.valueOwner.id))return;const b=vt(E.getDataType(null),E,this.project);b==null||b.metaSync({value:(P=y==null?void 0:y.value)==null?void 0:P.value},null),b==null||b.setValueAsTypeList((($=y==null?void 0:y.value)==null?void 0:$.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((L=y==null?void 0:y.value)==null?void 0:L.valueAsTypeSingle)||null);const w={...y,valueOwner:E,value:b};v.push(w)}),[...e,...v]},[]).sort((e,y)=>e.valueOwner.index-y.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,n,s,c={}){var y,m;const e={...Tu,...c};try{let v={value:G.Success,error:null,result:null};if(n.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Er).includes(i.declaration.id)){const E=this.parentContext.requestExtension(oy+i.declaration.id).module.main;E?v=await E(i,n):J.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{v=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);let E=null;if(v.error){J.Logger.warn("Raw error executing entity: ",v.error);const b=(y=i.error)==null?void 0:y.getDataType(null),w=vt(b||null,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(v.error):w==null||w.metaSync({value:v.error},null),E={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:w}}return{value:v.value,entity:i,error:E,result:{value:v.result||null,valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null}}}return{...v,entity:i}}catch(v){J.Logger.warn("Internal call execution error: ",v);let E=null;if(i.error){const b=(m=i.error)==null?void 0:m.getDataType(null),w=vt(b,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(v):w==null||w.metaSync({value:v},null),E={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:w}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:E,result:null}}}static async executeOperation(i,n,s){var c,e;try{let y={value:G.Success,error:null,result:null};n.sort((b,w)=>b.valueOwner.index-w.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,n));let m=null;if(y.error&&i.error){J.Logger.warn("Raw error executing entity: ",y.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,w=vt(b,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(y.error):w==null||w.metaSync({value:y.error},null),m={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:w}}const v=i==null?void 0:i.getDataType(null),E=vt(v,i,s);return v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y.result):E==null||E.metaSync({value:y.result},null),{value:y.value,entity:i,error:m,result:{value:E||null,valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null}}}catch(y){J.Logger.warn("Operation execution error: ",y);let m=null;if(i.error){const v=(e=i.error)==null?void 0:e.getDataType(null),E=vt(v,i.error,s);v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y):E==null||E.metaSync({value:y},null),m={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:m,result:null}}}async executeSearch(i,n,s){var c;try{let e={value:G.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(Ae.SEARCH_NODE_IMPLEMENTATION)).module.main(i,n),m=i==null?void 0:i.getDataType(null),v=vt(m,i,s);return v==null||v.metaSync({value:{data:y.data}},null),y.error?{value:G.UnhandledError,entity:i,error:{valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null,value:v},result:null}:{value:e.value,entity:i,error:null,result:{value:v,valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null}}}catch(e){if(J.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const y=(c=i.error)==null?void 0:c.getDataType(null),m=vt(y,i.error,s);return m==null||m.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:m},result:null}}}async executeLoop(i,n,s,c={}){var y,m,v,E,b,w;const e={...Tu,...c};try{let P={value:G.Success,error:null,result:null};const $=n.map(ne=>{var ee,pe;return((ee=ne==null?void 0:ne.value)==null?void 0:ee.valueAsType)||((pe=ne==null?void 0:ne.value)==null?void 0:pe.value)});let L={};i.getUniqueInputMaps().forEach(ne=>{const ee=i.body.inputs.find(Te=>se(Te,s)===se(ne,s)),pe=ne==null?void 0:ne.getDataType(null),oe=vt(pe,ee,s);pe!=null&&pe.asType?oe==null||oe.setValueAsTypeList([]):oe==null||oe.metaSync({value:[]},null),this.lastExecutionResults.writeValue(ee,oe);const ce={value:oe,valueOwner:ee,type:Ve.ExecutionResult,inheritanceLink:null};L[ee.id]=ce});let F={value:G.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case Q.loop["counted-loop"].id:{const ne=$[0];let ee=1;for(;ee<=ne&&ee<=50;){const pe=i.body.inputs.map(oe=>{if(oe===i.currentIterationNumberArgumentDeclaration){const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Te=yc(ce),de=this.lastExecutionResults.readValue(oe.id);if(de){de.metaSync({value:ee},null),this.lastExecutionResults.writeValue(oe,de);const Ge={value:de,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null};return L[oe.id]=Ge,Ge}const ye={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ee,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Te,standaloneParent:oe.toReference()},_e=Ki(ye,s);this.lastExecutionResults.writeValue(oe,_e);const Pe={value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null};return L[oe.id]=Pe,Pe}else return L[oe.id]}).filter(oe=>!!oe);if(F=await this.executeFullFunctionDeclarationLogic(i.body,pe,e),(F.results||[]).forEach(oe=>{var ye,_e,Pe,Ge;if(oe.valueOwner.type!==d.InputMap||qt.includes(oe.valueOwner.parent.type))return;const ce=i.body.inputs.find(xe=>se(xe,s)===se(oe.valueOwner,s)),de=[...((_e=(ye=L==null?void 0:L[ce.id])==null?void 0:ye.value)==null?void 0:_e.value)||[],((Pe=oe==null?void 0:oe.value)==null?void 0:Pe.value)||null];(Ge=L[ce.id].value)==null||Ge.metaSync({value:de},null),this.lastExecutionResults.writeValue(ce,L[ce.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["manual-flow-loop"].id:{let ne=1;for(;ne<=50;){const ee=i.body.inputs.map(pe=>{if(pe===i.currentIterationNumberArgumentDeclaration){const oe=this.lastExecutionResults.readValue(pe.id);if(oe){oe.metaSync({value:ne},null),this.lastExecutionResults.writeValue(pe,oe);const ye={value:oe,valueOwner:pe,type:Ve.ExecutionResult,inheritanceLink:null};return L[pe.id]=ye,ye}const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Te=vt(ce,pe,s);return Te==null||Te.metaSync({value:ne},null),this.lastExecutionResults.writeValue(pe,Te),{value:Te,valueOwner:pe,type:Ve.ExecutionResult,inheritanceLink:null}}else return L[pe.id]}).filter(pe=>!!pe);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ee,e),(F.results||[]).forEach(pe=>{var de,ye,_e;if(pe.valueOwner.type!==d.InputMap||qt.includes(pe.valueOwner.parent.type))return;const oe=i.body.inputs.find(Pe=>se(Pe,s)===se(pe.valueOwner,s)),Te=[...(de=L[oe.id].value)==null?void 0:de.value,((ye=pe.value)==null?void 0:ye.value)||null];(_e=L[oe.id].value)==null||_e.metaSync({value:Te},null),this.lastExecutionResults.writeValue(oe,L[oe.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ne++}break}case Q.loop["list-loop"].id:{const ne=$[0];let ee=1;const pe=ne;for(let oe=0;oe<pe.length;oe++){const ce=pe[oe],Te=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(de.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,ye),{value:ye,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Pe=vt(_e,de,s);return Pe==null||Pe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else if(de===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=yc(ye),Pe=this.lastExecutionResults.readValue(de.id);if(Pe)return Pe.metaSync({value:ce},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const Ge={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:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:de.toReference()},xe=Ki(Ge,s);return this.lastExecutionResults.writeValue(de,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else return L[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,Te,e),(F.results||[]).forEach(de=>{var Ge,xe,Me;if(de.valueOwner.type!==d.InputMap||qt.includes(de.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>se(Se,s)===se(de.valueOwner,s)),Pe=[...(Ge=L[ye.id].value)==null?void 0:Ge.value,((xe=de.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Pe},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["object-keys-loop"].id:{const ne=$[0];let ee=1;const pe=ne?Object.keys(ne):[];for(let oe=0;oe<pe.length;oe++){const ce=pe[oe],Te=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(de.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,ye),{value:ye,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Pe=vt(_e,de,s);return Pe==null||Pe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else if(de===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=yc(ye),Pe=this.lastExecutionResults.readValue(de.id);if(Pe)return Pe.metaSync({value:ce},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const Ge={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:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:de.toReference()},xe=Ki(Ge,s);return this.lastExecutionResults.writeValue(de,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else return L[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,Te,e),(F.results||[]).forEach(de=>{var Ge,xe,Me;if(de.valueOwner.type!==d.InputMap||qt.includes(de.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>se(Se,s)===se(de.valueOwner,s)),Pe=[...(Ge=L[ye.id].value)==null?void 0:Ge.value,((xe=de.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Pe},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["object-values-loop"].id:{const ne=$[0];let ee=1;const pe=ne?Object.values(ne):[];for(let oe=0;oe<pe.length;oe++){const ce=pe[oe],Te=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(de.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,ye),{value:ye,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Pe=vt(_e,de,s);return Pe==null||Pe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else if(de===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=yc(ye),Pe=this.lastExecutionResults.readValue(de.id);if(Pe)return Pe.metaSync({value:ce},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const Ge={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:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:de.toReference()},xe=Ki(Ge,s);return this.lastExecutionResults.writeValue(de,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else return L[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,Te,e),(F.results||[]).forEach(de=>{var Ge,xe,Me;if(de.valueOwner.type!==d.InputMap||qt.includes(de.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>se(Se,s)===se(de.valueOwner,s)),Pe=[...(Ge=L[ye.id].value)==null?void 0:Ge.value,((xe=de.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Pe},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["string-loop"].id:{const ne=$[0];let ee=1;const pe=ne.split("");for(let oe=0;oe<pe.length;oe++){const ce=pe[oe],Te=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(de.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,ye),{value:ye,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Pe=vt(_e,de,s);return Pe==null||Pe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else if(de===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=yc(ye),Pe=this.lastExecutionResults.readValue(de.id);if(Pe)return Pe.metaSync({value:ce},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const Ge={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:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:de.toReference()},xe=Ki(Ge,s);return this.lastExecutionResults.writeValue(de,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else return L[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,Te,e),(F.results||[]).forEach(de=>{var Ge,xe,Me;if(de.valueOwner.type!==d.InputMap||qt.includes(de.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>se(Se,s)===se(de.valueOwner,s)),Pe=[...(Ge=L[ye.id].value)==null?void 0:Ge.value,((xe=de.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Pe},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}}if(P={value:[G.CaughtError,G.Return].includes(F.value)?F.value:G.Success,error:((m=(y=F.error)==null?void 0:y.value)==null?void 0:m.value)||null,result:((E=(v=F==null?void 0:F.result)==null?void 0:v.value)==null?void 0:E.value)||null},P.error&&i.error){const ne=(b=i.error)==null?void 0:b.getDataType(null),ee=vt(ne||null,i.error,s);ne!=null&&ne.asType?ee==null||ee.setValueAsTypeSingle(P.error):ee==null||ee.metaSync({value:P.error},null);const pe={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:ee};return{value:P.value,entity:i,error:pe,result:null}}const q=i==null?void 0:i.getDataType(null),X=vt(q,i,s);return q!=null&&q.asType?X==null||X.setValueAsTypeSingle(P.result):X==null||X.metaSync({value:P.result},null),{value:P.value,entity:i,error:null,result:{value:X||null,valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null}}}catch(P){if(J.Logger.warn("Error executing loop: ",P),i.error){const $=(w=i.error)==null?void 0:w.getDataType(null),L=vt($,i.error,s);return $!=null&&$.asType?L==null||L.setValueAsTypeSingle(P):L==null||L.metaSync({value:P},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:L},result:null}}else return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,n,s,c={}){var y,m,v,E,b,w,P,$,L,j,F,q,X,ne,ee,pe,oe,ce,Te,de,ye,_e,Pe,Ge,xe,Me;const e={...Tu,...c};try{const Se=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);let je=null;if(Se.error&&i.error){J.Logger.warn("Raw error executing entity: ",Se.error);const ot=(y=i.error)==null?void 0:y.getDataType(null),Rt=vt(ot||null,i.error,s);ot!=null&&ot.asType?(v=(m=Se.error)==null?void 0:m.value)!=null&&v.valueAsTypeSingle?Rt==null||Rt.setValueAsTypeSingle((b=(E=Se.error)==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle):(P=(w=Se.error)==null?void 0:w.value)!=null&&P.valueAsTypeList&&Array.isArray((L=($=Se.error)==null?void 0:$.value)==null?void 0:L.valueAsTypeList)&&(Rt==null||Rt.setValueAsTypeList((F=(j=Se.error)==null?void 0:j.value)==null?void 0:F.valueAsTypeList)):Rt==null||Rt.metaSync({value:(X=(q=Se.error)==null?void 0:q.value)==null?void 0:X.value},null),je={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:Rt}}let Ze=G.Success;Se.value===G.UnhandledError&&(i.catchesError||i.errorCalls.length?Ze=G.CaughtError:Ze=G.UnhandledError);const Ye=i==null?void 0:i.getDataType(null),lt=vt(Ye,i,s);return Ye!=null&&Ye.asType?(ee=(ne=Se.result)==null?void 0:ne.value)!=null&&ee.valueAsTypeSingle?lt==null||lt.setValueAsTypeSingle((oe=(pe=Se.result)==null?void 0:pe.value)==null?void 0:oe.valueAsTypeSingle):(Te=(ce=Se.result)==null?void 0:ce.value)!=null&&Te.valueAsTypeList&&Array.isArray((ye=(de=Se.result)==null?void 0:de.value)==null?void 0:ye.valueAsTypeList)&&(lt==null||lt.setValueAsTypeList((Pe=(_e=Se.result)==null?void 0:_e.value)==null?void 0:Pe.valueAsTypeList)):lt==null||lt.metaSync({value:((xe=(Ge=Se.result)==null?void 0:Ge.value)==null?void 0:xe.value)||null},null),{value:Ze,entity:i,error:je,result:{value:lt||null,valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null}}}catch(Se){if(!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const je=(Me=i.error)==null?void 0:Me.getDataType(null),Ze=vt(je,i.error,s);return je!=null&&je.asType?Ze==null||Ze.setValueAsTypeSingle(Se):Ze==null||Ze.metaSync({value:Se},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:Ze},result:null}}}async executeCondition(i,n){var c,e,y,m;let s=!1;switch(i.declaration.id){case tn.BooleanIsTrue:{const v=(e=(c=n[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof v!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");s=v===!0;break}case tn.BooleanIsFalse:{const v=(m=(y=n[0])==null?void 0:y.value)==null?void 0:m.value;if(typeof v!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");s=v===!1;break}case dr.And:{s=(await Promise.all(i.andChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).every(E=>E);break}case dr.Or:{s=(await Promise.all(i.orChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).some(E=>E);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:s?G.Success:G.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,n,s,c={}){const e={...Tu,...c,onBeforeEntityExecution:(v,E,b)=>{var w;return((w=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:w.call(c,v,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(v,E,b)=>{var w;return((w=c==null?void 0:c.onEntityExecuted)==null?void 0:w.call(c,v,E,{...b,detached:!0}))||Promise.resolve()}},y=new Au(s,[i,...CA(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,n)}async executeFullFunctionDeclarationLogic(i,n,s={}){const c={...Tu,...s},e=CA(i);e.forEach(v=>{this.addEntity(v)}),e.reduce((v,E)=>qt.includes(E.type)?[...v,...E.outputs]:Qt.includes(E.type)&&E.type!==d.Condition?[...v,...E.outputs,...E.inputs]:E.type===d.Condition?[...v,...E.inputs]:v,[]).forEach(v=>{this.lastExecutionResults.removeValue(v.id)});const m=await this.executeBranch(i,c,n);return{...m||{},value:(m==null?void 0:m.value)||G.Success,entity:i,error:(m==null?void 0:m.error)||null,result:(m==null?void 0:m.result)||null}}static async executeEntryPointEntity(i,n){return{value:G.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,n){var y,m,v,E,b,w,P;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ve.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)vr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const L=vt(c,i,this.project);L==null||L.metaSync({value:$},null),s={valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(L=>{var j,F;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const q=this.lastExecutionResults.readValue(L.declaration.id),X=se(L,this.project),ne=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||qi(X);if(q)q.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,q);else{const ee=vt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&vr((w=s.value)==null?void 0:w.value)?((P=s.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var q;const L=$.codeName||((q=$.declaration)==null?void 0:q.codeName)||qi(se($,this.project)),j=e[L],F=vt($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ve.ExecutionResult}),s.type=Ve.ExecutionResult,{value:G.Return,entity:i,error:null,result:s}}async executeContinueStatement(i,n){var y,m,v,E,b,w,P;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ve.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)vr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const L=vt(c,i,this.project);L==null||L.metaSync({value:$},null),s={valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(L=>{var j,F;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const q=this.lastExecutionResults.readValue(L.declaration.id),X=se(L,this.project),ne=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||qi(X);if(q)q.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,q);else{const ee=vt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&vr((w=s.value)==null?void 0:w.value)?((P=s.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var q;const L=$.codeName||((q=$.declaration)==null?void 0:q.codeName)||qi(se($,this.project)),j=e[L],F=vt($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ve.ExecutionResult}),s.type=Ve.ExecutionResult,{value:G.Continue,entity:i,error:null,result:s}}async executeBreakStatement(i,n){var y,m,v,E,b,w,P;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ve.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)vr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const L=vt(c,i,this.project);L==null||L.metaSync({value:$},null),s={valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(L=>{var j,F;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const q=this.lastExecutionResults.readValue(L.declaration.id),X=se(L,this.project),ne=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||qi(X);if(q)q.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,q);else{const ee=vt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&vr((w=s.value)==null?void 0:w.value)?((P=s.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var q;const L=$.codeName||((q=$.declaration)==null?void 0:q.codeName)||qi(se($,this.project)),j=e[L],F=vt($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ve.ExecutionResult}),s.type=Ve.ExecutionResult,{value:G.Break,entity:i,error:null,result:s}}async executeVariable(i,n){var m,v,E,b,w,P;let s=Ao(i,this.valueResolutionContext);const c=Wn(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let $={};if(((m=e==null?void 0:e.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...e.entity.getActiveRawDefaultValue()}),s!=null&&s.value)vr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const L=vt(e,i,this.project);L==null||L.metaSync({value:$},null),s={valueOwner:c,type:Ve.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(c,s.value),c.inputs.forEach(L=>{var j,F;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const q=this.lastExecutionResults.readValue(L.declaration.id),X=se(L,this.project),ne=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||qi(X);if(q)q.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,q);else{const ee=vt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(c,s==null?void 0:s.value);const y=(b=s==null?void 0:s.value)!=null&&b.value&&vr((w=s.value)==null?void 0:w.value)?((P=s.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var q;const L=$.codeName||((q=$.declaration)==null?void 0:q.codeName)||qi(se($,this.project)),j=y[L],F=vt($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ve.ExecutionResult}),s.type=Ve.ExecutionResult,{value:G.Success,entity:i,error:null,result:s}}mergeValues(i,n){const s=[];for(let c=0;c<n.length;c++)i!=null&&i[c]?s.push(i[c]):s.push(n[c]);return s}async executeEntity(i,n=[],s={}){var y,m,v,E,b,w,P,$,L,j,F;const c={...Tu,...s},e={detached:!1};switch(i.type){case d.Condition:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((y=c.onBeforeEntityExecution)==null?void 0:y.call(c,i,q,e)),this.executeCondition(i,q)}case d.InternalCall:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((m=c.onBeforeEntityExecution)==null?void 0:m.call(c,i,q,e)),this.executeInternalCall(i,q,this.project)}case d.Operation:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((v=c.onBeforeEntityExecution)==null?void 0:v.call(c,i,q,e)),Au.executeOperation(i,q,this.project)}case d.VariableInstance:case d.VariableDeclaration:return this.executeVariable(i,n);case d.FunctionCall:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,q,e)),this.executeFunctionCall(i,q,this.project)}case d.FunctionDeclaration:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,q,e)),Au.executeEntryPointEntity(i,q)}case d.Search:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((w=c.onBeforeEntityExecution)==null?void 0:w.call(c,i,q,e)),this.executeSearch(i,q,this.project)}case d.Loop:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((P=c.onBeforeEntityExecution)==null?void 0:P.call(c,i,q,e)),this.executeLoop(i,q,this.project,c)}case d.ReturnStatement:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await(($=c.onBeforeEntityExecution)==null?void 0:$.call(c,i,q,e)),this.executeReturnStatement(i,q)}case d.ContinueStatement:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((L=c.onBeforeEntityExecution)==null?void 0:L.call(c,i,q,e)),this.executeContinueStatement(i,q)}case d.BreakStatement:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((j=c.onBeforeEntityExecution)==null?void 0:j.call(c,i,q,e)),this.executeBreakStatement(i,q)}case d.GlobalEvent:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((F=c.onBeforeEntityExecution)==null?void 0:F.call(c,i,q,e)),Au.executeEntryPointEntity(i,q)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var s,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((s=i.result)!=null&&s.valueOwner))return;const n=Oo((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?n.forEach(y=>{var m;this.lastExecutionResults.writeValue(y,(m=i.result)==null?void 0:m.value)}):n.forEach(y=>{this.lastExecutionResults.removeValue(y.id)})}async executeBranch(i,n={},s=[]){var v;const c={...Tu,...n},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const m=await this.executeEntity(i,s,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(m),await((v=c.onEntityExecuted)==null?void 0:v.call(c,i,m,e)),m.value===G.Success){const E=(i.successCalls||i.calls||[]).filter(L=>this.hasEntity(L));(i.errorCalls||[]).forEach(L=>{this.skip(L)});let w=[];const P=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=P.filter(L=>!!L).find(L=>L.value===G.CaughtError||L.value===G.Return||L.value===G.Break||L.value===G.Continue);return $||(w=[...w,...P],m)}else if(m.value===G.CaughtError||m.value===G.ConditionNotMet){const E=(i.errorCalls||[]).filter(L=>this.hasEntity(L));(i.successCalls||i.calls||[]).forEach(L=>{this.skip(L)});let w=[];const P=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=P.filter(L=>!!L).find(L=>L.value===G.CaughtError||L.value===G.UnhandledError||L.value===G.Return||L.value===G.Break||L.value===G.Continue);return $||(w=[...w,...P],m)}else{if(m.value===G.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),Zr.includes(m.entity.type)&&wt(m.entity).forEach(E=>{this.skip(E)}),m;if(m.value===G.Return)return m;if(m.value===G.Break)return m;if(m.value===G.Continue)return m}return m}async execute(i={},n=[]){const s={...Tu,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,s,n);return this.state="finished-success",c}addEntity(i){var n;this.entities.includes(i)||(this.entities.push(i),(n=this.onAddEntityCallback)==null||n.call(this,i,{}))}async addEntityAsync(i,n={}){var s;this.entities.includes(i)||(this.entities.push(i),await((s=this.onAddEntityCallback)==null?void 0:s.call(this,i,n)))}addEntities(i){i.forEach(n=>this.addEntity(n))}async addEntitiesAsync(i,n={}){const s=J.YieldTracker.from(n),c=[];for(const e of i)c.push(this.addEntityAsync(e,n)),await s.tick();await Promise.all(c)}removeEntity(i){var n;if(i!==this.entryPoint){const s=this.entities.indexOf(i);s>-1&&(this.entities.splice(s,1),(n=this.onRemoveEntityCallback)==null||n.call(this,i,{}))}}hasEntity(i){var c,e,y;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===d.FunctionDeclaration&&((y=(e=i.parent)==null?void 0:e.parent)==null?void 0:y.type)===d.DefinitionEntity)return this.entities.includes(i.parent);const n=si(i);if(!n)return!1;const s=n.type===d.Loop&&i.parent===n.body?n.body:null;return s?this.entities.includes(s)||this.entities.includes(n):this.entities.includes(n)}removeScheduled(i){const n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const n=this.project.get(i);return n?this.hasEntity(n):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,1)}removeFromExecutingList(i){var s;const n=this.executing.indexOf(i);n>-1&&(this.executing.splice(n,1),(s=this.onAbortExecutionCallback)==null||s.call(this,i,{}))}removeFromAlreadyExecutedList(i){const n=this.executed.indexOf(i);n>-1&&this.executed.splice(n,1)}removeFromSkippedList(i){var s;const n=this.skipped.indexOf(i);n>-1&&(this.skipped.splice(n,1),(s=this.onRemoveFromSkippedListCallback)==null||s.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var n;this.skipped.includes(i)||(this.skipped.push(i),(n=this.onAddToSkippedListCallback)==null||n.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,n){this.parentContext.setValueTypePreference(i,n),this.emit(i,{})}}function Cbi(o){var p,i;if(o.isList)return"list";if(((p=o.entity)==null?void 0:p.type)===d.DefinitionEntity)return"definition-entity";switch((i=o.entity)==null?void 0:i.name){case le.Number:return"number";case le.String:return"text";case le.Boolean:return"boolean";case le.UUID:return"uuid";case le.Date:return"date-time";default:return"definition-entity"}}const as={[d.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[d.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[d.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[d.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[d.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[d.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[d.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[d.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[d.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[d.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[d.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[d.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[d.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[d.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[d.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[d.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[d.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[d.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[d.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[d.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[d.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[d.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function oN(o){const p=_R(o);if(!p){const n=Ny(o);if(n.includes(Re.HTTP_ENDPOINT))return"HTTP endpoint";if(n.includes(Re.PERSISTED_ENTITY))return"Persisted entity";if(n.includes(Re.CRON_JOB))return"Scheduled execution";if(n.includes(Re.RELATIONAL_DATABASE))return"Relational database"}if(p){let n="Extension of "+se(p,p.project)+" entity",s=wo(n);const c=Ny(o);return c.includes(Re.HTTP_ENDPOINT)?"HTTP endpoint"+(s?", "+s:""):c.includes(Re.PERSISTED_ENTITY)?"Persisted entity"+(s?", "+s:""):c.includes(Re.CRON_JOB)?"Scheduled execution"+(s?", "+s:""):c.includes(Re.RELATIONAL_DATABASE)?"Relational database"+(s?", "+s:""):n}let i="";return o.abstract&&(i="Template "),o.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function ELe(o){return o.parent.type===d.DefinitionEntity||o.parent.type===d.InstalledProject?"Internal action of "+se(o.parent,o.project):o.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function dN(o){return lx(o)?ELe(o):"Custom trigger"}function _bi(o){var p;switch(o.type){case d.DefinitionEntity:return oN(o);case d.FunctionDeclaration:return dN(o)}return(p=as[o.type])==null?void 0:p.singular}function Pbi(o){var p;switch(o.type){case d.DefinitionEntity:return oN(o);case d.FunctionDeclaration:return dN(o)}return(p=as[o.type])==null?void 0:p.singular}const uN=4e4,bLe=280,Vbi=300,pN=65,dy=32,Sb=39,ALe=26,gLe=49,mA=44,Nbi=35,qb=52,cN=10,dd=cN*2,TA=38,Zb=90,eC=270,ILe=uN/2+120,RLe=uN/2+180;function DLe(o){let i=dy+mA+TA+cN;const n=[...o.inputs];return n.length&&(i+=dd,n.forEach(()=>{i+=ALe})),{height:i,width:280}}function wLe(o){let i=pN;const n=[];if([d.DefinitionEntity].includes(o.type)){const m=[...o.suggestedProperties||[],...o.properties||[]];m.length&&(i+=dd,m.forEach(v=>{i+=v.static?gLe:Sb}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(o.type)){const m=[...(o==null?void 0:o.suggestedMethods)||[],...o.methods||[],...o.functions||[],...o.body?[o.body]:[]];m.length&&(i+=dd,m.forEach(v=>{const E=DLe(v);i+=E.height}))}Qt.includes(o.type)?(Gt.includes(o.type)?n.push(...(o.usedInputs||[]).flatMap(m=>[m])||[]):n.push(...(o.inputs||[]).flatMap(m=>[m])||[]),o.error&&(i+=qb)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)?(n.push(...o.outputs||[]),o.throws&&(i+=qb)):o.type===d.Condition&&(n.push(o.inputs[0]),o.inputs[1]&&n.push(o.inputs[1]));const s=n.length;s&&(i+=s*Sb,i+=dd);const c=[];if(o.type===d.FunctionDeclaration||o.type===d.GlobalEvent?c.push(...o.inputs||[]):Qt.includes(o.type)&&(Gt.includes(o.type)?c.push(...o.usedOutputs||[]):c.push(...o.outputs||[])),Gt.includes(o.type)){o.readsValue&&(i+=dd,i+=mA),o.writesValues.length&&(i+=dd,i+=mA),o.internalCalls.length&&o.usedInternalCalls.forEach(()=>i+=qb+dd);const m=o.getDataType(null);(!m||m.inferred)&&(i+=TA)}const e=c.length;return e&&(i+=e*Sb,i+=dd),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)&&(i+=TA),{height:i,width:280}}function uv(o){return`${o.split("-").map((n,s)=>s===0?n.charAt(0).toUpperCase()+n.slice(1):n.toLowerCase()).join(" ")}.`}function xbi(o){switch(o.code){case me.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case me.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case me.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case me.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case me.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case me.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case me.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case me.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case me.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Ie.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case me.NoProperties:return"This entity has no properties, so it doesn't do anything";case me.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case me.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case me.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case me.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case me.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case me.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case me.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case me.PropertyImplementsNonAbstact:return"This property implements a non-template property";case me.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case me.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case me.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case me.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case me.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Ie.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ie.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ie.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ie.UnreachableEntity:return"This entity is unreachable";case me.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case me.AbstractEntityImplements:return"This template entity implements a non-template entity";case me.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case me.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case me.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case me.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case me.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case me.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case me.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case me.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case me.MissingRequiredValue:return"This action is missing a required value";case me.NoPrimaryKeyProperty:return"This entity has no primary key property";case me.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case me.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case me.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case me.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case me.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case me.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case me.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ie.EmptyName:return"This entity has no name";case Ie.InvalidObjectStructure:return"This entity has an invalid structure";case Ie.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ie.MissingCaller:return"This action is missing a caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ie.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ie.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case xo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case xo.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case Ba.UUIDMustBeString:return`UUID must be a string, eg: "${Iu()}"`;case Ba.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Iu()}"`;case Ba.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${Iu()}"`;case sa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case sa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case sa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return uv(o.code)}}function $bi(o){switch(o.code){case me.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case me.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case me.IncorrectEntityImplementation:return"Incorrect implementation";case me.IncorrectMethodImplementation:return"Incorrect action implementation";case me.IncorrectPropertyImplementation:return"Incorrect property implementation";case me.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case me.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case me.MissingMethodImplementation:return"Missing action";case me.MissingPropertyImplementation:return"Missing property";case Ie.NameNotUniqueInScope:return"Duplicate name";case me.NoProperties:return"No properties";case me.NonStaticPropertyInStaticEntity:return"Non-static property";case me.StaticEntityWithNonStaticProperties:return"Non-static properties";case me.ReadingFromIncompatibleType:return"Read from different type";case me.WritingToIncompatibleType:return"Write to different type";case me.ScopeWithoutLogic:return"No logic";case me.NonStaticPropertyImplementsStatic:return"Invalid static property";case me.PropertyImplementsIncompatibleType:return"Incompatible data type";case me.PropertyImplementsNonAbstact:return"Non-template property";case me.StaticPropertyImplementsNonStatic:return"Non-static property";case me.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case me.VariableHasInputsAndInternalCall:return"Bad internal call";case me.VariableHasOutputsAndInternalCall:return"Bad internal call";case me.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Ie.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ie.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ie.InternalCallParentMissingDataType:return"Parent has no data type";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ie.UnreachableEntity:return"Unreachable entity";case me.DisconnectedCallableEntity:return"Disconnected entity";case me.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case me.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case me.InvalidPropertiesCombination:return"Invalid properties combination";case me.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case me.ExtendsIncompatibleEntities:return"Extends incompatible entities";case me.ImplementingNonAbstractEntity:return"Implementing non-template entity";case me.ImplementsIncompatibleEntities:return"Implements incompatible entities";case me.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case me.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case me.MissingRequiredValue:return"Missing required value";case me.NoPrimaryKeyProperty:return"No primary key property";case me.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case me.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case me.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case me.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case me.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case me.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case me.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Ie.EmptyName:return"Empty name";case Ie.InvalidObjectStructure:return"Invalid object structure";case Ie.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MissingCaller:return"Missing caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ie.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case xo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case xo.StatusCodeMustBeNumber:return"HTTP status code must be a number";case Ba.UUIDMustBeString:return"UUID must be a string";case Ba.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case Ba.UUIDMustBeValidFormat:return"UUID must be in a valid format";case sa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case sa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case sa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return uv(o.code)}}function Lbi(o){switch(o.code){case me.AbstractEntityWithNonAbstractMethods:return`${se(o.entity,o.entity.project)} has non-template actions`;case me.AbstractEntityWithNonAbstractProperties:return`${se(o.entity,o.entity.project)} has non-template properties`;case me.IncorrectEntityImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements template`;case me.IncorrectMethodImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements the template`;case me.IncorrectPropertyImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements the template`;case me.AbstractMethodInNonAbstractEntity:return`${se(o.entity,o.entity.project)} can't be a template`;case me.AbstractPropertyInNonAbstractEntity:return`${se(o.entity,o.entity.project)} can't be a template`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${se(o.entity,o.entity.project)} overwrites action`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${se(o.entity,o.entity.project)} overwrites property`;case me.MissingMethodImplementation:return`${se(o.entity,o.entity.project)} is missing action`;case me.MissingPropertyImplementation:return`${se(o.entity,o.entity.project)} is missing property`;case Ie.NameNotUniqueInScope:return`${se(o.entity,o.entity.project)} name is not unique`;case me.NoProperties:return`${se(o.entity,o.entity.project)} has no properties`;case me.NonStaticPropertyInStaticEntity:return`${se(o.entity,o.entity.project)} has non-static property`;case me.StaticEntityWithNonStaticProperties:return`${se(o.entity,o.entity.project)} has non-static properties`;case me.ReadingFromIncompatibleType:return`${se(o.entity,o.entity.project)} reads from different type`;case me.WritingToIncompatibleType:return`${se(o.entity,o.entity.project)} writes to different type`;case me.ScopeWithoutLogic:return`${se(o.entity,o.entity.project)} has no logic`;case me.NonStaticPropertyImplementsStatic:return`${se(o.entity,o.entity.project)} has invalid static property`;case me.PropertyImplementsIncompatibleType:return`${se(o.entity,o.entity.project)} has incompatible data type`;case me.PropertyImplementsNonAbstact:return`${se(o.entity,o.entity.project)} has non-template property`;case me.StaticPropertyImplementsNonStatic:return`${se(o.entity,o.entity.project)} has non-static property`;case me.VariableCallsOthersAndHasInternalCall:return`${se(o.entity,o.entity.project)} has bad internal call`;case me.VariableHasInputsAndInternalCall:return`${se(o.entity,o.entity.project)} has bad internal call`;case me.VariableHasOutputsAndInternalCall:return`${se(o.entity,o.entity.project)} has bad internal call`;case me.VariableIsCalledAndHasInternalCall:return`${se(o.entity,o.entity.project)} has bad internal call`;case Ie.InternalCallDeclarationIsInvalidType:return`${se(o.entity,o.entity.project)} has declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${se(o.entity,o.entity.project)} has declaration that is not found in parent`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${se(o.entity,o.entity.project)} has invalid parent declaration type`;case Ie.InternalCallParentMissingDataType:return`${se(o.entity,o.entity.project)}'s parent has no data type`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${se(o.entity,o.entity.project)} has declaration that is not in parent`;case Ie.UnreachableEntity:return`${se(o.entity,o.entity.project)} is unreachable`;case me.DisconnectedCallableEntity:return`${se(o.entity,o.entity.project)} is not executed by any entity`;case me.AbstractEntityImplements:return`${se(o.entity,o.entity.project)} implements a non-template entity`;case me.AbstractExtendingNonAbstractEntity:return`${se(o.entity,o.entity.project)} extends a non-template entity`;case me.InvalidPropertiesCombination:return`${se(o.entity,o.entity.project)} has invalid properties combination`;case me.ExtendingNonInteractiveEntity:return`${se(o.entity,o.entity.project)} extends a non-interactive entity`;case me.ExtendsIncompatibleEntities:return`${se(o.entity,o.entity.project)} extends incompatible entities`;case me.ImplementingNonAbstractEntity:return`${se(o.entity,o.entity.project)} implements a non-template entity`;case me.ImplementsIncompatibleEntities:return`${se(o.entity,o.entity.project)} implements incompatible entities`;case me.LackingReturnStatementOnSomeBranches:return`${se(o.entity,o.entity.project)} is missing termination on some branches`;case me.LastCalledEntityMustBeReturnEntity:return`${se(o.entity,o.entity.project)}'s last called entity must be a termination node`;case me.MissingRequiredValue:return`${se(o.entity,o.entity.project)} is missing a required value`;case me.NoPrimaryKeyProperty:return`${se(o.entity,o.entity.project)} has no primary key property`;case me.NonAbstractExtendingAbstractEntity:return`${se(o.entity,o.entity.project)} extends a template entity`;case me.NonStaticExtendingStaticEntity:return`${se(o.entity,o.entity.project)} extends a static entity`;case me.NonStaticImplementingStaticEntity:return`${se(o.entity,o.entity.project)} implements a static entity`;case me.StaticExtendingNonStaticEntity:return`${se(o.entity,o.entity.project)} extends a non-static entity`;case me.StaticImplementingNonStaticEntity:return`${se(o.entity,o.entity.project)} implements a non-static entity`;case me.VariableReadsValueAndInternalCall:return`${se(o.entity,o.entity.project)} reads a value and has internal call`;case me.VariableWritesValuesAndInternalCall:return`${se(o.entity,o.entity.project)} writes values and has internal call`;case Ie.EmptyName:return`${as[o.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${se(o.entity,o.entity.project)} has invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${se(o.entity,o.entity.project)}'s loop body action overwrites an action`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites base action`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${se(o.entity,o.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${se(o.entity,o.entity.project)} has a name not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${se(o.entity,o.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${se(o.entity,o.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${se(o.entity,o.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites base property`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${se(o.entity,o.entity.project)} has reader/writer with incompatible data type`;case xo.StatusCodeMustBeBetween100And599:return`${se(o.entity,o.entity.project)} HTTP status code must be between 100 and 599`;case xo.StatusCodeMustBeNumber:return`${se(o.entity,o.entity.project)} HTTP status code must be a number`;case Ba.UUIDMustBeString:return`${se(o.entity,o.entity.project)} UUID must be a string`;case Ba.UUIDMustNotContainSpaces:return`${se(o.entity,o.entity.project)} UUID must not contain spaces`;case Ba.UUIDMustBeValidFormat:return`${se(o.entity,o.entity.project)} UUID must be in a valid format`;case sa.MustBeUniqueAmongSameEntities:return`${se(o.entity,o.entity.project)} value must be unique among the same kind`;case sa.StringValueMustNotHaveDashes:return`${se(o.entity,o.entity.project)} value must not contain dashes`;case sa.StringValueMustNotHaveSpaces:return`${se(o.entity,o.entity.project)} value must not contain spaces`;default:return`${se(o.entity,o.entity.project)} Error: ${uv(o.code)}`}}function Mbi(o){var p,i,n,s;switch(o.code){case me.AbstractEntityWithNonAbstractMethods:return`${se(o.entity,o.entity.project)} has non-template actions`;case me.AbstractEntityWithNonAbstractProperties:return`${se(o.entity,o.entity.project)} has non-template properties`;case me.IncorrectEntityImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements the template entity`;case me.IncorrectMethodImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements the template action it's based on`;case me.IncorrectPropertyImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements the template property it's based on`;case me.AbstractMethodInNonAbstractEntity:return`${se(o.entity,o.entity.project)} is a template action in a non-template entity`;case me.AbstractPropertyInNonAbstractEntity:return`${se(o.entity,o.entity.project)} is a template property in a non-template entity`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${se(o.entity,o.entity.project)} overwrites an action in the template entity`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${se(o.entity,o.entity.project)} overwrites a property in the template entity`;case me.MissingMethodImplementation:return`${se(o.entity,o.entity.project)} is missing an action implementation from the template entity`;case me.MissingPropertyImplementation:return`${se(o.entity,o.entity.project)} is missing a property implementation from the template entity`;case Ie.NameNotUniqueInScope:return`${se(o.entity,o.entity.project)} has a duplicate name in the same scope`;case me.NoProperties:return`${se(o.entity,o.entity.project)} has no properties, so it doesn't do anything`;case me.NonStaticPropertyInStaticEntity:return`${se(o.entity,o.entity.project)} has a non-static property in a static entity`;case me.StaticEntityWithNonStaticProperties:return`${se(o.entity,o.entity.project)} has non-static properties in a static entity`;case me.ReadingFromIncompatibleType:return`${se(o.entity,o.entity.project)} reads data from a value of a different data type`;case me.WritingToIncompatibleType:return`${se(o.entity,o.entity.project)} writes data to a value of a different data type`;case me.ScopeWithoutLogic:return`${se(o.entity,o.entity.project)} has no logic`;case me.NonStaticPropertyImplementsStatic:return`${se(o.entity,o.entity.project)} has a static property in a non-static entity`;case me.PropertyImplementsIncompatibleType:return`${se(o.entity,o.entity.project)} implements a property of a different data type`;case me.PropertyImplementsNonAbstact:return`${se(o.entity,o.entity.project)} implements a non-template property`;case me.StaticPropertyImplementsNonStatic:return`${se(o.entity,o.entity.project)} has a static property in a non-static entity`;case me.VariableCallsOthersAndHasInternalCall:return`${se(o.entity,o.entity.project)} calls other entities while being used to execute internal logic`;case me.VariableHasInputsAndInternalCall:return`${se(o.entity,o.entity.project)} has inputs while being used to execute internal logic`;case me.VariableHasOutputsAndInternalCall:return`${se(o.entity,o.entity.project)} has outputs while being used to execute internal logic`;case me.VariableIsCalledAndHasInternalCall:return`${se(o.entity,o.entity.project)} is called while being used to execute internal logic`;case Ie.InternalCallDeclarationIsInvalidType:return`${se(o.entity,o.entity.project)} has a declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${se(o.entity,o.entity.project)} has a declaration that is not found in ${(p=o.entity.parent.getDataType(null))!=null&&p.entity?se((i=o.entity.parent.getDataType(null))==null?void 0:i.entity,o.entity.project):"the variable's data-type entity"}`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${se(o.entity,o.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ie.InternalCallParentMissingDataType:return`${se(o.entity,o.entity.project)} is part of a variable with no data-type entity`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${se(o.entity,o.entity.project)} has a declaration doesn't belong to ${(n=o.entity.parent.getDataType(null))!=null&&n.entity?se((s=o.entity.parent.getDataType(null))==null?void 0:s.entity,o.entity.project):"the variable's data-type entity"}`;case Ie.UnreachableEntity:return`${se(o.entity,o.entity.project)} is unreachable`;case me.DisconnectedCallableEntity:return`${se(o.entity,o.entity.project)} is disconnected and won't be executed by anything after publishing`;case me.AbstractEntityImplements:return`${se(o.entity,o.entity.project)} implements a non-template entity`;case me.AbstractExtendingNonAbstractEntity:return`${se(o.entity,o.entity.project)} extends a non-template entity`;case me.InvalidPropertiesCombination:return`${se(o.entity,o.entity.project)} has an invalid combination of properties`;case me.ExtendingNonInteractiveEntity:return`${se(o.entity,o.entity.project)} extends a non-interactive entity`;case me.ExtendsIncompatibleEntities:return`${se(o.entity,o.entity.project)} extends incompatible entities`;case me.ImplementingNonAbstractEntity:return`${se(o.entity,o.entity.project)} implements a non-template entity`;case me.ImplementsIncompatibleEntities:return`${se(o.entity,o.entity.project)} implements incompatible entities`;case me.LackingReturnStatementOnSomeBranches:return`${se(o.entity,o.entity.project)} has branches that don't terminate`;case me.LastCalledEntityMustBeReturnEntity:return`${se(o.entity,o.entity.project)} must end with a termination node`;case me.MissingRequiredValue:return`${se(o.entity,o.entity.project)} is missing a required value`;case me.NoPrimaryKeyProperty:return`${se(o.entity,o.entity.project)} has no primary key property`;case me.NonAbstractExtendingAbstractEntity:return`${se(o.entity,o.entity.project)} is a non-template entity extending a template entity`;case me.NonStaticExtendingStaticEntity:return`${se(o.entity,o.entity.project)} is a non-static entity extending a static entity`;case me.NonStaticImplementingStaticEntity:return`${se(o.entity,o.entity.project)} is a non-static entity implementing a static entity`;case me.StaticExtendingNonStaticEntity:return`${se(o.entity,o.entity.project)} is a static entity extending a non-static entity`;case me.StaticImplementingNonStaticEntity:return`${se(o.entity,o.entity.project)} is a static entity implementing a non-static entity`;case me.VariableReadsValueAndInternalCall:return`${se(o.entity,o.entity.project)} reads a value and has an internal call`;case me.VariableWritesValuesAndInternalCall:return`${se(o.entity,o.entity.project)} writes values and has an internal call`;case Ie.EmptyName:return`${as[o.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${se(o.entity,o.entity.project)} has an invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${se(o.entity,o.entity.project)}'s loop body action overwrites`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites a base action with same implementation`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${se(o.entity,o.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${se(o.entity,o.entity.project)} has a name that is not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${se(o.entity,o.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${se(o.entity,o.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${se(o.entity,o.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites a base property with same implementation`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${se(o.entity,o.entity.project)} has a reader/writer with incompatible data type`;case xo.StatusCodeMustBeBetween100And599:return`${se(o.entity,o.entity.project)} HTTP status code must be between 100 and 599`;case xo.StatusCodeMustBeNumber:return`${se(o.entity,o.entity.project)} HTTP status code must be a number, between 100 and 599`;case Ba.UUIDMustBeString:return`${se(o.entity,o.entity.project)} UUID must be a string, eg: "${Iu()}"`;case Ba.UUIDMustNotContainSpaces:return`${se(o.entity,o.entity.project)} UUID must not contain spaces, eg: "${Iu()}"`;case Ba.UUIDMustBeValidFormat:return`${se(o.entity,o.entity.project)} UUID must be in a valid format. Eg: "${Iu()}"`;case sa.MustBeUniqueAmongSameEntities:return`${se(o.entity,o.entity.project)} value must be unique among the same kind`;case sa.StringValueMustNotHaveDashes:return`${se(o.entity,o.entity.project)} value must not contain dashes`;case sa.StringValueMustNotHaveSpaces:return`${se(o.entity,o.entity.project)} value must not contain spaces`;default:return`${se(o.entity,o.entity.project)} Error: ${uv(o.code)}`}}var fN=(o=>(o.ValuesAlreadyConnected="values-already-connected",o.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",o.CannotReadValueFromChildren="cannot-read-value-from-children",o.CannotWriteValueToChildren="cannot-write-value-to-children",o.CannotBeCalledByChildren="cannot-be-called-by-children",o.ExecutionsAlreadyConnected="executions-already-connected",o.DataTypesNotCompatible="data-types-not-compatible",o.CannotCallAncestor="cannot-call-ancestor",o.CannotConnectToItself="cannot-connect-to-itself",o.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",o.NotInScope="not-in-scope",o.IsNotValueWrittingEntity="is-not-value-writting-entity",o.IsNotValueReadingEntity="is-not-value-reading-entity",o.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",o.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",o.CallerIsInHigherScope="caller-is-in-higher-scope",o.CallerIsInLowerScope="caller-is-in-lower-scope",o.CallIsInHigherScope="call-is-in-higher-scope",o.CallIsInLowerScope="call-is-in-lower-scope",o.OtherIncompatibleScopeReason="other-incompatible-scope-reason",o.SiblingInternalCallAlreadyUsedInParentVariable="sibling-internal-call-already-used-in-parent-variable",o.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees="error-output-map-cannot-be-connected-to-parent-success-branch-callees",o.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees="success-output-map-cannot-be-connected-to-parent-error-branch-callees",o))(fN||{});const Bbi=Object.values(fN);var yN=(o=>(o.NotPartOfOngoingTest="not-part-of-ongoing-test",o.CannotBeAddedToTest="cannot-be-added-to-test",o))(yN||{});const Gbi=Object.values(yN);var hN=(o=>(o.Suggestion="suggestion",o.CanvasGloballyDisabled="canvas-globally-disabled",o.CannotInteractWithInputInVariableWithInternalCalls="cannot-interact-with-input-in-variable-with-internal-calls",o.CannotInteractWithOutputInVariableWithInternalCalls="cannot-interact-with-output-in-variable-with-internal-calls",o))(hN||{});const kbi=Object.values(hN);function jbi(o,p){const i=[...o,...p];return Array.from(new Set(i))}function Ubi(o,p){const i=[...o,...p],n=Array.from(new Set(i));return{hasChanged:n.length!==o.length,reasons:n}}function Kbi(o,p){const i=o.filter(s=>!p.includes(s));return{hasChanged:i.length!==o.length,reasons:i}}function Fbi(o,p){return o.find(i=>i.entity.id===p)||null}function L4(o){return o.filter((p,i)=>o.indexOf(p)===i)}class gn{constructor(p,i,n=null,s){I(this,"ids",[]);I(this,"entity");I(this,"entityCardHeight");I(this,"entityCardWidth");I(this,"index");I(this,"childEntities",[]);I(this,"children",[]);I(this,"parents",[]);I(this,"calculationEntryPoint");I(this,"_onlyEntities",null);I(this,"_changeSet",null);if(this.index=i,this.entity=p,this.calculationEntryPoint=n||this,this===this.calculationEntryPoint&&!s)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(p,i,n){const s=ILe-eC-bLe,c=RLe-Zb-pN;p.metaSync({x:p.x||s,y:p.y||c},i);const e=new gn(p,0,null,i);e._onlyEntities=n||[],e.ids=["0"];const y=[];e.next(v=>{y.push(...v)}),gn.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const m=e.flattenChildEntities();return e._onlyEntities?m.filter(v=>(e._onlyEntities||[]).includes(v)):m}static recursivelyAssembleChildrenAreas(p){const i=[];p.forEach(n=>{n.next(s=>{i.push(...s)})}),i.length>0&&gn.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(p){this.calculationEntryPoint._changeSet=p}findAreaInChildrenFromEntity(p){if(this.entity===p)return this;const i=this.children.find(s=>s.entity===p);return i||this.children.reduce((s,c)=>s||c.findAreaInChildrenFromEntity(p),null)}findAreaFromEntity(p){if(this.entity===p)return this;const i=this.calculationEntryPoint.children,n=i.find(c=>c.entity===p);return n||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(p),null)}addParent(p){if(!this.parents.includes(p)){const i=gn.resolveIds(p,this.index);this.ids.push(...i),this.parents.push(p)}}static resolveIds(p,i){return p?p.ids.map(n=>`${n}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const p=Al(this.entity,!0);if(this.entity.type===d.Project){const i=[],n=[],s=[];p.forEach(e=>{if(d.DefinitionEntity===e.type){n.push(e);return}else if(Yt.includes(e.type)){s.push(e);return}i.push(e)});const c=i.sort((e,y)=>{const m=!!RA(e,y).length,v=Al(e),E=Al(y);return m?0:v.length&&!E.length?-1:!v.length&&E.length?1:0}).filter(e=>!Up(e).length);this.childEntities=[...n,...s,...c]}else{const i=[],n=[],s=[],c=[],e=[];Zr.includes(this.entity.type)&&OR(this.entity).forEach(v=>{if(Gt.includes(v.type)){s.push(v);return}const E=si(v);i.push(E)}),nr.includes(this.entity.type)&&n.push(...this.entity.detachedChildren);const y=p.filter(m=>{const v=i.includes(m);return v||s.includes(m)||n.includes(m)?!1:Gt.includes(m.type)?(s.push(m),!1):qr.includes(m.type)&&!v?(c.push(m),!1):m.type===d.DefinitionEntity?(e.push(m),!1):!0});i.sort((m,v)=>Cc(m,v)?-1:0),c.sort((m,v)=>Cc(m,v)?-1:0),s.sort((m,v)=>hC(m,v)?1:hC(v,m)?-1:0),this.childEntities=[...e,...i,...c,...y,...s,...n]}}calculateCardSize(){const p=wLe(this.entity);this.entityCardWidth=p.width,this.entityCardHeight=p.height}static getBoundriesOfTwoAreas(p,i){return{top:Math.min(p.top,i.top),left:Math.min(p.left,i.left),bottom:Math.max(p.bottom,i.bottom),right:Math.max(p.right,i.right)}}static getBoundriedOfCombinedAreas(p,i){const n=p.filter(c=>!i.includes(c));return n.reduce((c,e)=>i.includes(e)?c:gn.getBoundriesOfTwoAreas(c,e.fullBranchArea),n[0].fullBranchArea)}getFullAreaUntilAny(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!p.includes(e)).map(e=>e.getFullAreaUntilAny(p)).reduce((e,y)=>gn.getBoundriesOfTwoAreas(e,y),i)}getFullAreaUntilAreaOrAnyChildren(p){const i=[p,...p.flattenChildren()],n=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(p)).reduce((e,y)=>gn.getBoundriesOfTwoAreas(e,y),n)}getFullAreaUntil(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==p).map(c=>c.getFullAreaUntil(p)).reduce((c,e)=>gn.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(s=>s.fullBranchArea).reduce((s,c)=>gn.getBoundriesOfTwoAreas(s,c),p)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const p=this.ownEntityArea;return{top:p.top,left:p.left,bottom:p.bottom+Zb,right:p.right+eC}}static filterOutRepeatedAreas(p){return p.filter((i,n)=>p.indexOf(i)===n)}getEarliestId(p,i){const n=p.split("-"),s=i.split("-");return n.length<s.length?p:n.length>s.length?i:n.reduce((e,y,m)=>y<s[m]?p:i,p)}getEarliestLevel(){return this.ids.reduce((n,s)=>this.getEarliestId(n,s),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const n=this.parents.reduce((s,c)=>c.getEarliestLevel()>s.getEarliestLevel()?c:s,this.parents[0]).countColumns();return p+=n,p}getLatestId(p,i){if(p===i)return p;const n=p.split("-"),s=i.split("-");return n.length<s.length?i:n.length>s.length?p:n.reduce((e,y,m)=>y>s[m]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((n,s)=>this.getLatestId(n,s),this.ids[0]).split("-").length}smoothPosition(){const p=this.flattenSiblings();if(!p.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(n=>{n!==this.calculationEntryPoint&&n.shiftDownAlone(i)})}else if([...Yt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(n=>!this.parents.includes(n));i.length?i.every(s=>{const c=this.countColumns(),e=s.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(p,i){if(p.includes(this))return p;this.move(this.entity,{y:this.entity.y+i});let n=[...p,this];return this.children.forEach(s=>{if(gn.getEarliestParentInChain(s)!==this)return;const e=Fbi(n,s.entity.id);n=gn.filterOutRepeatedAreas([...n]),e||(n=n.filter(m=>m!==s));const y=s.shiftDownUntilAny(n,i);n.push(...y)}),n}shiftRightUntilAny(p,i){p.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(n=>{const s=gn.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);gn.getEarliestParentInChain(n)===this&&n.shiftRightUntilAny(s,i)}))}shiftRight(p){this.move(this.entity,{x:this.entity.x+p}),this.children.forEach(i=>{const s=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(s,p)})}shiftDownAlone(p){this.move(this.entity,{y:this.entity.y+p})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const p=this.parents.reduce((s,c)=>{const e=c.ownEntityArea,y=e.top+dy,m={top:y,left:e.left,bottom:y,right:e.right};return gn.getBoundriesOfTwoAreas(s,m)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-dy;this.shiftDownAlone(n)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((s,c)=>{const e=c.ownEntityArea,y=e.top+dy,m={top:y,left:e.left,bottom:y,right:e.right};return gn.getBoundriesOfTwoAreas(s,m)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-dy;return this.shiftDownAlone(n),n}resolveChildrenOverlaps(){const p=this.flattenChildren();let i=[];p.forEach(n=>{const s=n.adjustVerticallyToAvoidOverlaps();i.push(...s)}),p.forEach(n=>{n.smoothPosition()})}static getEarliestParentInChain(p){let i=p.parents[0];return p.parents.length&&(i=p.parents.sort((n,s)=>{if(!n.ids.length)return-1;if(!s.ids.length)return 1;const c=n.ids.sort((y,m)=>y.length<m.length?-1:0),e=s.ids.sort((y,m)=>y.length<m.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,s)=>{if(p.has(s.entity.id))return n;p.add(s.entity.id);const e=s.children.slice(0,s.children.indexOf(this)).reduce((y,m)=>[...y,m,...m.flattenChildren(p)],[]);return[...n,...e]},[])}flattenSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,s)=>{if(p.has(s.entity.id))return n;p.add(s.entity.id);const e=s.children.filter(y=>y!==this).reduce((y,m)=>[...y,m,...m.flattenChildren(p)],[]);return[...n,...e]},[])}flattenChildren(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n,...n.flattenChildren(p)]),[])}flattenParents(p=new Set){return this.parents.reduce((n,s)=>p.has(s.entity.id)?n:(p.add(s.entity.id),[...n,s,...s.flattenParents(p)]),[])}getAreaIfRendered(p){return this.calculationEntryPoint.flattenChildren().find(s=>s.entity.id===p.id)||null}getLowerSiblings(){const p=this.parents.reduce((i,n)=>{const s=n.children.indexOf(this),c=n.children.slice(s+1);return[...i,...c]},[]);return L4(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((n,s)=>[...n,...s.getLowerAreas()],[]);return L4([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const n=gn.getEarliestParentInChain(this).children[this.index-1];if(!n)return p;const s=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...s,...c,n],v=D(e.flatMap(P=>RA(this.entity,P.entity))).filter(P=>P.id!==this.entity.id).map(P=>this.findAreaFromEntity(P)).filter(P=>!!P),E=this.getFullAreaUntilAny(v),b=n.getFullAreaUntilAny(v),w=e.reduce((P,$)=>$===this||$.fullBranchArea.left!==E.left?P:Math.max(P,$.fullBranchArea.bottom),b.bottom);if(E.top<w){const P=w-E.top+Zb;return this.shiftDownUntilAny(p,P)}return p}move(p,i){(this.onlyEntities||[]).includes(p)&&p.metaSync(i,this.changeSet)}addChild(p){const i=this.childEntities[p];let n=null;i.x&&i.y?n=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),n||(n=new gn(i,p,this.calculationEntryPoint));const s=this.ownEntityPlusBufferArea;this.children.includes(n)||(this.children.push(n),n.addParent(this));const c=n.fullBranchArea;if(c.left<s.right){const e=s.right-c.left;n.shiftRight(e)}return n}flattenChildEntities(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n.entity,...n.flattenChildEntities(p)]),[])}next(p){const i=[];this.childEntities.forEach((n,s)=>{const c=this.addChild(s);c&&i.push(c)}),p(i)}}var Vm=(o=>(o.Amazon="amazon",o.Google="google",o.Microsoft="microsoft",o))(Vm||{}),yr=(o=>(o.RelationalDatabase="relational-database",o.CompiledLocalCodebase="compiled-local-codebase",o.CloudHostedCodebase="cloud-hosted-codebase",o.HttpApi="http-api",o.HttpEndpoint="http-endpoint",o.ServerlessFunction="serverless-function",o))(yr||{}),tC=(o=>(o.Post="post",o.Get="get",o.Acknowledgement="acknowledgment",o.Progress="progress",o.Error="error",o.Complete="complete",o))(tC||{}),hc=(o=>(o.Queued="queued",o.Running="running",o.Success="success",o.Failed="failed",o.CleanedUp="cleaned-up",o.Skipped="skipped",o.AbortedByUser="aborted-by-user",o.UnrecoverableFailure="unrecoverable-failure",o.Reverted="reverted",o.UnpublishingStarted="unpublishing-started",o.Unpublished="unpublished",o))(hc||{}),iC=(o=>(o.Queued="queued",o.Running="running",o.Success="success",o.Failed="failed",o.CleanedUp="cleaned-up",o.UnrecoverableFailure="unrecoverable-failure",o.Reverted="reverted",o.UnpublishingStarted="unpublishing-started",o.Unpublished="unpublished",o))(iC||{}),$t=(o=>(o.ProjectNotFound="project-not-found",o.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",o.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",o.DeploymentCompleted="deployment-completed",o.DeploymentStarted="deployment-started",o.DeploymentFailed="deployment-failed",o.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",o.RequestPayloadValidationFailed="request-payload-validation-failed",o.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",o.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",o.ProjectAlreadyBeingPublished="project-already-being-published",o.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",o.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",o.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",o.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",o.CreatingNewRelationalDatabase="creating-new-relational-database",o.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",o.RelationalDatabaseAlreadyExists="relational-database-already-exists",o.RelationalDatabaseDeletionStarted="relational-database-deletion-started",o.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",o.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",o.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",o.HttpApiDeploymentStarted="http-api-deployment-started",o.HttpApiDeploymentCompleted="http-api-deployment-completed",o.HttpApiDeploymentFailed="http-api-deployment-failed",o.CreatingNewHttpApi="creating-new-http-api",o.HttpApiAlreadyExists="http-api-already-exists",o.HttpApiDeletionStarted="http-api-deletion-started",o.HttpApiDeletionCompleted="http-api-deletion-completed",o.HttpApiDeletionFailed="http-api-deletion-failed",o.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",o.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",o.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",o.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",o.BundlingCodebaseForDownload="bundling-codebase-for-download",o.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",o.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",o.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",o.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",o.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",o.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",o.CodeCompilationStarted="code-compilation-started",o.CodeCompilationCompleted="code-compilation-completed",o.CodeCompilationFailed="code-compilation-failed",o.BundleCodebaseStarted="bundle-codebase-started",o.BundleCodebaseCompleted="bundle-codebase-completed",o.BundleCodebaseFailed="bundle-codebase-failed",o.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",o.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",o.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",o.MigrateRelationalDatabaseStarted="migrate-relational-database-started",o.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",o.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",o.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",o.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",o.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",o.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",o))($t||{}),ml=(o=>(o.CodeCompilation="code-compilation",o.RelationalDatabaseDeployment="relational-database-deployment",o.RelationalDatabaseDeletion="relational-database-deletion",o.HttpApiDeployment="http-api-deployment",o.HttpApiDeletion="http-api-deletion",o.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",o.BundleCodebase="bundle-codebase",o.MigrateRelationalDatabase="migrate-relational-database",o.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",o.ExecutePublicationCompletedEvent="execute-publication-completed-event",o.CodebaseCleanup="codebase-cleanup",o))(ml||{});yr.CloudHostedCodebase,yr.HttpApi,yr.RelationalDatabase,yr.CloudHostedCodebase,yr.CloudHostedCodebase,yr.RelationalDatabase,yr.CloudHostedCodebase,yr.CloudHostedCodebase;function OLe(o){return`project-${o}-http-api`}function XI(o){return`entity-${o}-database`}class CLe{constructor(p,i,n,s,c,e,y,m,v){I(this,"stepType");I(this,"id");I(this,"resourceType");I(this,"index");I(this,"dependency",[]);I(this,"lastEvent",null);I(this,"lastEventTimestamp",null);I(this,"status",hc.Queued);I(this,"publicationRun");I(this,"resource");this.stepType=p,this.id=i,this.resourceType=n,this.status=s,this.dependency=c,this.index=e,this.lastEventTimestamp=y,this.publicationRun=m,this.resource=v}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(p){var i,n;this.status=p.status,this.dependency=p.dependency,this.index=p.index,this.stepType=p.stepType,this.resourceType=p.resourceType,this.lastEvent=p.lastEvent,this.id=p.id,(n=this.resource)==null||n.setDetails((i=p.resource)==null?void 0:i.details)}}var _Le=(o=>(o.Ready="ready",o.Provisioning="provisioning",o.Queued="queued",o.ProvisioningFailed="provisioning-failed",o.Deleting="deleting",o.DeletingFailed="deleting-failed",o.Deleted="deleted",o))(_Le||{});class ef{constructor(p,i,n){I(this,"provisionedBy");I(this,"publicationRun");I(this,"resourceType");I(this,"provider");I(this,"resourceId");I(this,"details",null);I(this,"name",null);I(this,"status","queued");this.publicationRun=p,this.resourceType=i,this.provider=n}setDetails(p){this.details=p}setStatus(p){this.status=p}setProvisionedBy(p){this.provisionedBy=p}}class Sbi extends ef{constructor(i,n,s){super(i,yr.HttpEndpoint,s);I(this,"resourceType",yr.HttpEndpoint);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=XI((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class qbi extends ef{constructor(i,n,s){super(i,yr.ServerlessFunction,s);I(this,"resourceType",yr.ServerlessFunction);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=XI((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class PLe extends ef{constructor(i,n,s){super(i,yr.HttpApi,s);I(this,"resourceType",yr.HttpApi);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=OLe(this.publicationRun.project.id),this.resourceId}}class VLe extends ef{constructor(i,n,s){super(i,yr.RelationalDatabase,s);I(this,"resourceType",yr.RelationalDatabase);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=XI((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class NLe extends ef{constructor(i,n){super(i,yr.CloudHostedCodebase,n);I(this,"resourceType",yr.CloudHostedCodebase);I(this,"details",null);I(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class xLe extends ef{constructor(i,n){super(i,yr.CompiledLocalCodebase,n);I(this,"resourceType",yr.CompiledLocalCodebase);I(this,"details",null);I(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class Zbi{constructor(p,i){I(this,"id");I(this,"projectAutoIncrementPublicationCount");I(this,"projectPublishedSemanticVersion");I(this,"projectVersion");I(this,"projectId");I(this,"triggeredBy");I(this,"createdAt");I(this,"updatedAt");I(this,"status");I(this,"steps",[]);I(this,"editor");I(this,"explicitResources",new Map);I(this,"implicitGlobalResources",new Map);I(this,"finalGlobalEvent",null);I(this,"finalStatus",null);I(this,"contextType",Y.PublicationRun);I(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.projectVersion=p.projectVersion,this.projectId=p.projectId,this.triggeredBy=p.triggeredBy,this.createdAt=p.createdAt,this.updatedAt=p.updatedAt,this.status=p.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(p){return this.steps.filter(i=>p.includes(i.resourceType))}getStepsTypes(p){return this.steps.filter(i=>p.includes(i.stepType))}toIds(p){return p.map(i=>i.id)}getResourceForEntity(p){const i=Array.from(this.explicitResources.values()).find(n=>n.owners.has(p.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(yr.CompiledLocalCodebase,new xLe(this,Vm.Amazon)),this.implicitGlobalResources.set(yr.CloudHostedCodebase,new NLe(this,Vm.Amazon));const p=this.project.entities.filter(n=>Zi(n,Re.HTTP_ENDPOINT)),i=this.project.entities.filter(n=>Zi(n,Re.RELATIONAL_DATABASE));if(i.length&&i.forEach(n=>{const s=new VLe(this,[n],Vm.Amazon);this.explicitResources.set(s.resourceId,s)}),p.length){const n=new PLe(this,p,Vm.Amazon);this.explicitResources.set(n.resourceId,n)}}setSteps(p,i){p.forEach(n=>{this.addStep(n,i)}),this.editor.events.emit($t.ProjectPublishRequestAcknowledged,{})}addStep(p,i){const n=p.dependency||[];if(n.length){const c=n.filter(e=>!this.steps.find(y=>y.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===p.id)){const c=new CLe(p.stepType,p.id,p.resourceType,p.status,n,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(J.Logger.log("onUpdate",p),(i=p.payload)!=null&&i.stepType){const n=this.steps.find(s=>{var c;return s.id===((c=p.payload)==null?void 0:c.id)});n&&M(p.emittedAt).isAfter(M(n.lastEventTimestamp))&&n.update(p.payload)}this.editor.events.emit("publication-updated",{}),p.type===tC.Error?(this.finalStatus=iC.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===tC.Complete&&(this.finalStatus=iC.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 aN(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(Y.PublicationRun),this.extensionsRegistry}}function Hbi(o){switch(o){case ml.CodeCompilation:return"Code generation";case ml.RelationalDatabaseDeployment:return"Database creation";case ml.HttpApiDeployment:return"HTTP gateway creation";case ml.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case ml.BundleCodebase:return"Bundle code";case ml.MigrateRelationalDatabase:return"Database structure migration";case ml.BusinessLogicCodebaseDeployment:return"Update servers with new code";case ml.CodebaseCleanup:return"Code cleanup";case ml.HttpApiDeletion:return"HTTP gateway deletion";case ml.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function Wbi(o){switch(o){case $t.DeploymentCompleted:return"Successfully published";case $t.DeploymentStarted:return"Publication started";case $t.DeploymentFailed:return"Publication failed";case $t.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case $t.RequestPayloadValidationFailed:return"Request payload validation failed";case $t.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case $t.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case $t.RelationalDatabaseDeploymentStarted:return"Database creation started";case $t.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case $t.RelationalDatabaseDeploymentFailed:return"Database creation failed";case $t.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case $t.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case $t.RelationalDatabaseAlreadyExists:return"Database already exists";case $t.HttpApiDeploymentStarted:return"HTTP gateway creation started";case $t.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case $t.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case $t.CreatingNewHttpApi:return"Creating new HTTP gateway";case $t.HttpApiAlreadyExists:return"HTTP gateway already exists";case $t.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case $t.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case $t.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case $t.BundlingCodebaseForDownload:return"Bundling code for download";case $t.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case $t.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case $t.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case $t.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case $t.CodeCompilationStarted:return"Code generation started";case $t.CodeCompilationCompleted:return"Code generation completed";case $t.CodeCompilationFailed:return"Code generation failed";case $t.BundleCodebaseStarted:return"Code bundling started";case $t.BundleCodebaseCompleted:return"Code bundling completed";case $t.BundleCodebaseFailed:return"Code bundling failed";case $t.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case $t.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case $t.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case $t.MigrateRelationalDatabaseStarted:return"Database structure migration started";case $t.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case $t.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case $t.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case $t.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case $t.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case $t.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case $t.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case $t.ProjectNotFound:return"Project not found";case $t.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case $t.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case $t.HttpApiDeletionStarted:return"HTTP gateway deletion started";case $t.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case $t.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case $t.RelationalDatabaseDeletionStarted:return"Database deletion started";case $t.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case $t.RelationalDatabaseDeletionFailed:return"Database deletion failed";case $t.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var $Le=(o=>(o.NO_LOGIC="NO_LOGIC",o.NO_NAME="NO_NAME",o.NO_CHANGES="NO_CHANGES",o.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",o))($Le||{});function zbi(o){switch(o){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function Jbi(o){switch(o){case yr.RelationalDatabase:return"Relational database";case yr.HttpEndpoint:case yr.HttpApi:return"HTTP endpoints";case yr.ServerlessFunction:case yr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function Ybi(o){switch(o){case hc.Running:return"In progress";case hc.Failed:return"Failed";case hc.Success:return"Succeeded";case hc.Skipped:return"Skipped";case hc.Queued:default:return"Queued"}}function LLe(o){var n;if(!Zi(o,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=Q["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(o.type===d.BuiltInBaseEntity?Zi(o,Re.EXTERNAL_INTEGRATION_CONNECTION)&&(p=rC(o.name)):o.type===d.DefinitionEntity&&o.implements.forEach(s=>{if(Zi(s,Re.EXTERNAL_INTEGRATION_CONNECTION)){const c=rC(s==null?void 0:s.name);if(c)return p=c,!0}}),!p){const s=o.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var y;return((y=e.extends)==null?void 0:y.id)===i}));p=(n=s==null?void 0:s.getDefaultValue())==null?void 0:n.value}return p}function Xbi(o){return che[o]}function rC(o){return o.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?o.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function MLe(o){if(o.type!==d.ActionDescriptor&&o.type!==d.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(o.type===d.ActionDescriptor){const p=o;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(o.type===d.Operation){const p=o.declaration;if(Object.values(ei).includes(p.id))return p.id.split("--")[1]||null}return null}function Qbi(o){if(!o)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(Re).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===o.toLowerCase()))||null}function eAi(o){return o.type===d.BuiltInBaseEntity||o.type===d.DefinitionEntity?LLe(o):o.type===d.ActionDescriptor||o.type===d.Operation?MLe(o):null}function BLe(o){var s,c,e;if(!Zi(o,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=Z4e(o,Re.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const n=Q["built-in-base-entity"][i.id].properties.connectionId.id;if(o.type===d.BuiltInBaseEntity){if(Zi(o,Re.EXTERNAL_INTEGRATION_CONNECTION)){const y=o.properties.find(m=>{var v;return((v=m.extends)==null?void 0:v.id)===n});y&&(p=(s=y.getDefaultValue())==null?void 0:s.value)}}else if(o.type===d.DefinitionEntity){const y=o.properties.find(m=>!!m.implements.find(v=>v.id===n)||!!m.implements.find(v=>{var E;return((E=v.extends)==null?void 0:E.id)===n}));if(!y&&((c=o.extends)==null?void 0:c.type)===d.DefinitionEntity)return BLe(o.extends);p=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return p}async function GLe(o,p={}){var y;const i=J.YieldTracker.from(p),s=[...ta(o),...Rs(o),...mN(o),...ia(o),...TN(o)],c=Ov(o);s.push(...c);const e=Mt(o.errors,s);await i.tick();for(const m of o.inputs)await m.validateAsync({tracker:i});for(const m of o.outputs)await m.validateAsync({tracker:i});for(const m of o.internalCalls)await m.validateAsync({tracker:i});return await((y=o.dataType)==null?void 0:y.validateAsync({tracker:i})),e}function kLe(o){var s;(s=o.dataType)==null||s.validate(),o.inputs.forEach(c=>c.validate()),o.outputs.forEach(c=>c.validate()),o.internalCalls.forEach(c=>c.validate());const i=[...ta(o),...Rs(o),...mN(o),...ia(o),...TN(o)],n=Ov(o);return i.push(...n),Mt(o.errors,i)}function mN(o,p){const n=[...o.project.getVariableDeclarations()].filter(s=>s.id!==o.id);return _v(o,[qi],n,p)}function TN(o){const p=[];if(o.parent!==o.project)return p;if(o.catchesError){const i=Lt({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotCatchError}`,message:`${as[o.type].singular} "${se(o,o.project)}" with id "${o.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:fe.Error,code:Ie.GlobalVariableDeclarationCannotCatchError,entity:o});p.push(i.error)}if(o.errorCalls.length){const i=Lt({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotCallOnError}`,message:`${as[o.type].singular} "${se(o,o.project)}" with id "${o.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:fe.Error,code:Ie.GlobalVariableDeclarationCannotCallOnError,entity:o});p.push(i.error)}if(o.calledBy.length){const i=Lt({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotBeCalled}`,message:`${as[o.type].singular} "${se(o,o.project)}" with id "${o.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:fe.Error,code:Ie.GlobalVariableDeclarationCannotBeCalled,entity:o});p.push(i.error)}return[]}const tAi=Object.freeze(Object.defineProperty({__proto__:null,validate:kLe,validateAsync:GLe,validateGlobalVariableDeclaration:TN,validateVariableDeclarationName:mN},Symbol.toStringTag,{value:"Module"}));async function jLe(o,p={}){const i=J.YieldTracker.from(p),s=[...ta(o),...Rs(o),...ia(o)],c=Ov(o);s.push(...c);const e=Mt(o.errors,s);await i.tick();for(const y of o.inputs)await y.validateAsync({tracker:i});for(const y of o.outputs)await y.validateAsync({tracker:i});for(const y of o.internalCalls)await y.validateAsync({tracker:i});return e}function ULe(o){o.inputs.forEach(s=>s.validate()),o.outputs.forEach(s=>s.validate()),o.internalCalls.forEach(s=>s.validate());const i=[...ta(o),...Rs(o),...ia(o)],n=Ov(o);return i.push(...n),Mt(o.errors,i)}const iAi=Object.freeze(Object.defineProperty({__proto__:null,validate:ULe,validateAsync:jLe},Symbol.toStringTag,{value:"Module"}));var vN=(o=>(o.Parent="parent",o.DataTypeEntity="data-type-entity",o.VarDeclaration="var-declaration",o))(vN||{});const yi=class yi extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"x");I(this,"y");I(this,"type",d.VariableInstance);I(this,"catchesError",!1);I(this,"defaultValue",null);I(this,"writesValues",[]);I(this,"readsValue",null);I(this,"declaration");I(this,"inputs",[]);I(this,"outputs",[]);I(this,"error",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"successCalls",[]);I(this,"errorCalls",[]);I(this,"internalCalls",[]);I(this,"project");I(this,"errors",[]);I(this,"parent");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableInstance,catchesError:!1,declaration:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,n){let s=n;if(i.parent){const P=re(i.parent);s=n.get(P)}const c=re(i.declaration),e=n.get(c),y=i.calledByEntry.map(P=>{const $=re(P);return n.get($)}),m=i.calledBySuccess.map(P=>{const $=re(P);return n.get($)}),v=i.calledByError.map(P=>{const $=re(P);return n.get($)});let E=null;if(i.readsValue){const P=re(i.readsValue);E=n.get(P)}const b={id:i.id,version:x.UUID.uuid(),createdAt:M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableInstance,catchesError:i.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:m,calledByError:v,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:E,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:s},w=he(b,n);return w.setParent(s,null),w}static validateGenerationTarget(i,n){let s=JSON.parse(JSON.stringify(i));const c=[],e=bn(s,{parent:{list:!1,types:[...nr,d.Project],optional:!0},declaration:{list:!1,types:[d.VariableDeclaration]}},n);return s=e.modifiedData,c.push(...e.errors,...$r(s)),{errors:c,modifiedData:s}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const n=[];let s=JSON.parse(JSON.stringify(i));const c=nf(s,this);return s=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${ae.InvalidParentUpdate}`,code:ae.InvalidParentUpdate,severity:fe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
|
92
|
+
`+c):n.stack=c}catch{}}throw n}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=wc(this.defaults,i);const{transitional:n,paramsSerializer:s,headers:c}=i;n!==void 0&&Kb.assertOptions(n,{silentJSONParsing:Eo.transitional(Eo.boolean),forcedJSONParsing:Eo.transitional(Eo.boolean),clarifyTimeoutError:Eo.transitional(Eo.boolean)},!1),s!=null&&(Ue.isFunction(s)?i.paramsSerializer={serialize:s}:Kb.assertOptions(s,{encode:Eo.function,serialize:Eo.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Kb.assertOptions(i,{baseUrl:Eo.spelling("baseURL"),withXsrfToken:Eo.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&Ue.merge(c.common,c[i.method]);c&&Ue.forEach(["delete","get","head","post","put","patch","common"],$=>{delete c[$]}),i.headers=El.concat(e,c);const y=[];let m=!0;this.interceptors.request.forEach(function(L){typeof L.runWhen=="function"&&L.runWhen(i)===!1||(m=m&&L.synchronous,y.unshift(L.fulfilled,L.rejected))});const v=[];this.interceptors.response.forEach(function(L){v.push(L.fulfilled,L.rejected)});let E,b=0,w;if(!m){const $=[V4.bind(this),void 0];for($.unshift(...y),$.push(...v),w=$.length,E=Promise.resolve(i);b<w;)E=E.then($[b++],$[b++]);return E}w=y.length;let P=i;for(;b<w;){const $=y[b++],L=y[b++];try{P=$(P)}catch(j){L.call(this,j);break}}try{E=V4.call(this,P)}catch($){return Promise.reject($)}for(b=0,w=v.length;b<w;)E=E.then(v[b++],v[b++]);return E}getUri(p){p=wc(this.defaults,p);const i=Mxe(p.baseURL,p.url,p.allowAbsoluteUrls);return Vxe(i,p.params,p.paramsSerializer)}}Ue.forEach(["delete","get","head","options"],function(p){yA.prototype[p]=function(i,n){return this.request(wc(n||{},{method:p,url:i,data:(n||{}).data}))}});Ue.forEach(["post","put","patch"],function(p){function i(n){return function(c,e,y){return this.request(wc(y||{},{method:p,headers:n?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}yA.prototype[p]=i(),yA.prototype[p+"Form"]=i(!0)});const Fb=yA;class rN{constructor(p){if(typeof p!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const n=this;this.promise.then(s=>{if(!n._listeners)return;let c=n._listeners.length;for(;c-- >0;)n._listeners[c](s);n._listeners=null}),this.promise.then=s=>{let c;const e=new Promise(y=>{n.subscribe(y),c=y}).then(s);return e.cancel=function(){n.unsubscribe(c)},e},p(function(c,e,y){n.reason||(n.reason=new Lh(c,e,y),i(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(p){if(this.reason){p(this.reason);return}this._listeners?this._listeners.push(p):this._listeners=[p]}unsubscribe(p){if(!this._listeners)return;const i=this._listeners.indexOf(p);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const p=new AbortController,i=n=>{p.abort(n)};return this.subscribe(i),p.signal.unsubscribe=()=>this.unsubscribe(i),p.signal}static source(){let p;return{token:new rN(function(s){p=s}),cancel:p}}}const vbi=rN;function Ebi(o){return function(i){return o.apply(null,i)}}function bbi(o){return Ue.isObject(o)&&o.isAxiosError===!0}const YO={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(YO).forEach(([o,p])=>{YO[p]=o});const Abi=YO;function Uxe(o){const p=new Fb(o),i=Exe(Fb.prototype.request,p);return Ue.extend(i,Fb.prototype,p,{allOwnKeys:!0}),Ue.extend(i,p,null,{allOwnKeys:!0}),i.create=function(s){return Uxe(wc(o,s))},i}const En=Uxe(tN);En.Axios=Fb;En.CanceledError=Lh;En.CancelToken=vbi;En.isCancel=$xe;En.VERSION=jxe;En.toFormData=ZI;En.AxiosError=ni;En.Cancel=En.CanceledError;En.all=function(p){return Promise.all(p)};En.spread=Ebi;En.isAxiosError=bbi;En.mergeConfig=wc;En.AxiosHeaders=El;En.formToJSON=o=>xxe(Ue.isHTMLForm(o)?new FormData(o):o);En.getAdapter=kxe.getAdapter;En.HttpStatusCode=Abi;En.default=En;const gbi=En;class Kxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(zn.HttpRequest);s&&(s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[3]||{},e={method:s[0],url:s[1],params:s[2],headers:c,data:s[4]};J.Logger.log("Axios request config: ",e);const y=await gbi(e);return{value:G.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}const x4=Symbol("missing"),Ibi=o=>o!=null&&typeof o=="object";function dv(o,p){if(typeof o!="string")throw new TypeError(`${p} expects the key to be a string.`);return o}function Mh(o,p){if(typeof o!="string"&&!Array.isArray(o))throw new TypeError(`${p} expects the path to be string or array.`);return o}function Qc(o,p){if(!vr(o))throw new TypeError(`${p} expects the first argument to be an object.`);return o??{}}function Fxe(o,p){const i=dv(p,"ReadKey");return(o??{})[i]}function Sxe(o,p,i){const n=dv(p,"WriteKey"),s=rv(o??{});return s[n]=i,s}function qxe(o,p){const i=dv(p,"DeleteKey"),n=rv(o??{});return delete n[i],n}function Zxe(o,p,i){const n=Qc(o,"ReadNestedKey"),s=Mh(p,"ReadNestedKey");return UV(n,s,i)}function Hxe(o,p,i){const n=Qc(o,"WriteNestedKey"),s=Mh(p,"WriteNestedKey"),c=rv(n);return KV(c,s,!1),wOe(c,s,i,{createMissing:!1})}function Wxe(o,p,i){const n=Qc(o,"WriteSafeNestedKeyRecursively"),s=Mh(p,"WriteSafeNestedKeyRecursively"),c=rv(n);return KV(c,s,!0),wOe(c,s,i,{createMissing:!0})}function zxe(o,p){const i=Qc(o,"DeleteNestedKey"),n=Mh(p,"DeleteNestedKey"),s=rv(i),{target:c,lastKey:e}=KV(s,n,!1);return delete c[e],s}function Jxe(o,p){const i=dv(p,"HasKey"),n=o;return n!=null&&Ibi(n)&&Object.prototype.hasOwnProperty.call(n,i)}function Yxe(o,p,i){const n=dv(p,"KeyValueEquals");return o==null||typeof o!="object"?!1:o[n]===i}function Xxe(o,p){const i=o,n=Mh(p,"HasNestedKey");return UV(i,n,x4)!==x4}function Qxe(o,p,i){const n=Mh(p,"NestedKeyValueEquals");return UV(o,n)===i}function e$e(...o){const p={};for(let i=0;i<o.length;i++){const n=o[i];if(n!=null){if(!vr(n))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,n)}}return p}function t$e(o){const p=Qc(o,"ObjectKeys");return Object.keys(p)}function i$e(o){const p=Qc(o,"ObjectValues");return Object.values(p)}function r$e(o){const p=Qc(o,"ObjectEntries");return Object.entries(p)}class n$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.Validate);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)});J.Logger.log("Inputs for entity validation: ",s);const e=NR(s[1]).safeParse(s[0]);return e.success?{value:G.Success,error:null,result:{data:s[0]}}:{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e.error.errors,result:null}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}const Ia=o=>o.map(p=>{var i,n;return((i=p.value)==null?void 0:i.valueAsType)??((n=p.value)==null?void 0:n.value)});class a$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.ReadKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=Fxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class s$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.WriteKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Sxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class l$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.DeleteKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=qxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class o$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.ReadNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Zxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class d$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY,version:"1.0.0",description:"Entity write-nested-key operation implementation module (immutable, no auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.WriteNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Hxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class u$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY,version:"1.0.0",description:"Entity write-safe-nested-key-recursively operation implementation module (immutable, auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.WriteSafeNestedKeyRecursively);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Wxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class p$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Ce.DeleteNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const[s,c]=Ia(n),e=zxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class c$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Ce.HasKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=Ia(n),e=Jxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class f$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Ce.KeyValueEquals);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Yxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Ce.HasNestedKey);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=Ia(n),e=Xxe(s,c);return{value:G.Success,error:null,result:e}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class h$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Ce.NestedKeyValueEquals);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e]=Ia(n),y=Qxe(s,c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class m$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Ce.IsInstanceOfType);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{var s,c,e,y,m,v,E,b,w,P;try{const $=((c=(s=n[0])==null?void 0:s.value)==null?void 0:c.parent)||((y=(e=n[0])==null?void 0:e.value)==null?void 0:y.standaloneParent),L=(v=(m=n[0])==null?void 0:m.value)==null?void 0:v.value,j=(b=(E=n[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!L)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!j)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!$)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(j.type!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType expects expectedType to be a DefinitionEntity.");const F=$.getDataType(null);if(((w=F==null?void 0:F.entity)==null?void 0:w.type)!==d.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let q=!1;return((P=F==null?void 0:F.entity)==null?void 0:P.id)!==(j==null?void 0:j.id)?q=!1:NR(F==null?void 0:F.entity).safeParse(L).success?q=!0:q=!1,{value:G.Success,error:null,result:q}}catch($){return{value:G.UnhandledError,error:$,result:null}}}})}}class T$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic);if(!n)return;const s=n.get(Ce.Merge);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const s=Ia(n),c=e$e(...s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class v$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic);if(!n)return;const s=n.get(Ce.Keys);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=t$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class E$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic);if(!n)return;const s=n.get(Ce.Values);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=i$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}class b$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic);if(!n)return;const s=n.get(Ce.Entries);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=Ia(n),c=r$e(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:G.UnhandledError,error:s,result:null}}}})}}let ss=null;try{ss=require("crypto")}catch{}const Lm=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:ss&&ss.webcrypto?ss.webcrypto:null,Ru=Lm?Lm.subtle:null;function qm(o){const p=new ArrayBuffer(o.byteLength);return new Uint8Array(p).set(o),p}function Hr(o,p="utf8"){if(o instanceof Uint8Array)return o;const i=String(o);if(p==="utf8"){if(typeof TextEncoder<"u")return new TextEncoder().encode(i);if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"utf8"))}else if(p==="hex"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"hex"))}else if(p==="base64"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"base64"))}else if(p==="base64url"){const n=i.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(n,"base64"));const s=typeof atob=="function"?atob(n):"",c=new Uint8Array(s.length);for(let e=0;e<s.length;e++)c[e]=s.charCodeAt(e);return c}throw new Error(`Unsupported environment/encoding combo for toBytes(${p})`)}function Ql(o,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(o);if(typeof Buffer<"u")return Buffer.from(o).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(o).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(o).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(o).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const A$e=o=>Hr(o,"base64"),g$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64")},Dy=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"base64url")},Oc=o=>Hr(o,"base64url"),I$e=(o,p)=>{const i=o instanceof Uint8Array?o:Hr(String(o),p||"utf8");return Ql(i,"hex")},R$e=o=>Hr(o,"hex");function nN(o){if(Lm&&Lm.getRandomValues){const p=new Uint8Array(o);return Lm.getRandomValues(p),p}if(ss&&ss.randomBytes)return new Uint8Array(ss.randomBytes(o));throw new Error("Secure random not available")}function zI(o,p){if(!(o instanceof Uint8Array)||!(p instanceof Uint8Array)||o.length!==p.length)return!1;let i=0;for(let n=0;n<o.length;n++)i|=o[n]^p[n];return i===0}function D$e(o,p,i,n){if((typeof o!="string"||typeof p!="string")&&typeof o!="string"&&typeof p!="string")throw new Error("Invalid input types");const s=i??"utf8",c=n??"utf8",e=Hr(o??"",s),y=Hr(p??"",c);return zI(e,y)}async function w$e(o,p){if(Ru){const i=await Ru.digest({name:o},qm(p));return new Uint8Array(i)}if(ss){const i=o.replace("SHA-","sha"),n=ss.createHash(i);return n.update(Buffer.from(p)),new Uint8Array(n.digest())}throw new Error("Hash not available")}async function O$e(o,p,i,n){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const s=String(o??"SHA-256"),c=i??"utf8",e=n??"base64url",y=Hr(p??"",c),m=await w$e(s,y);return Ql(m,e)}async function JI(o,p,i){if(Ru){const n=await Ru.importKey("raw",qm(p),{name:"HMAC",hash:{name:o}},!1,["sign"]),s=await Ru.sign("HMAC",n,qm(i));return new Uint8Array(s)}if(ss){const n=`sha${o.split("-")[1]}`,s=ss.createHmac(n,Buffer.from(p));return s.update(Buffer.from(i)),new Uint8Array(s.digest())}throw new Error("HMAC not available")}async function C$e(o,p,i,n,s,c){if(typeof o!="string"||typeof p!="string")throw new Error("Invalid input types for key or data; expected strings");const e=String(i??"SHA-256"),y=n??"utf8",m=s??"utf8",v=c??"base64url",E=Hr(o??"",y),b=Hr(p??"",m),w=await JI(e,E,b);return Ql(w,v)}async function YI(o,p,{iterations:i,length:n,hashAlg:s="SHA-256"}){if(Ru){const c=await Ru.importKey("raw",qm(o),"PBKDF2",!1,["deriveBits"]),e=await Ru.deriveBits({name:"PBKDF2",salt:qm(p),iterations:i,hash:s},c,n*8);return new Uint8Array(e)}if(ss){const c=s==="SHA-512"?"sha512":"sha256";return await new Promise((e,y)=>{ss.pbkdf2(Buffer.from(o),Buffer.from(p),i,n,c,(m,v)=>{m?y(m):e(new Uint8Array(v))})})}throw new Error("PBKDF2 not available")}async function _$e(o,p,i,n,s,c,e,y){if(typeof o!="string"||typeof p!="string")throw new Error("Invalid input types for password or salt; expected strings");const m=c??"utf8",v=e??"utf8",E=y??"base64url",b=Math.max(1,Number(i)||21e4),w=Math.max(1,Number(n)||32),P=s??"SHA-256",$=Hr(o??"",m),L=Hr(p??"",v),j=await YI($,L,{iterations:b,length:w,hashAlg:P});return Ql(j,E)}async function P$e(o,p=nN(16),i=21e4,n=32,s="SHA-256"){const c=Hr(o,"utf8"),e=await YI(c,p,{iterations:i,length:n,hashAlg:s}),y=Dy(p),m=Dy(e);return`pbkdf2$${s.toLowerCase()}$${i}$${y}$${m}`}async function V$e(o,p){const i=String(p).split("$");if(i.length!==5||i[0]!=="pbkdf2")return!1;const n=i[1].toLowerCase(),s=parseInt(i[2],10),c=Oc(i[3]),e=Oc(i[4]),y=n.includes("512")?"SHA-512":"SHA-256",m=await YI(Hr(o,"utf8"),c,{iterations:s,length:e.length,hashAlg:y});return zI(m,e)}async function N$e(o,p,i,n,s,c){const e=p!=null?Math.max(1,Number(p)||0):void 0,y=i!=null?Math.max(1,Number(i)||0):void 0,m=n??void 0,v=c??"base64url",E=s!=null?Hr(s,v):void 0;return await P$e(String(o??""),E,e,y,m)}function $4(o){return Dy(Hr(JSON.stringify(o),"utf8"))}function hA(o){try{return JSON.parse(Ql(Oc(o),"utf8"))}catch{return null}}async function x$e(o,p,{alg:i="HS256",includeIat:n=!0,expiresInSeconds:s,notBeforeSeconds:c,issuer:e,subject:y,audience:m,jwtid:v,header:E={}}={}){const b={alg:i,typ:"JWT",...E},w=Math.floor(Date.now()/1e3),P={...o||{}};n&&(P.iat=w),typeof s=="number"&&(P.exp=w+s),typeof c=="number"&&(P.nbf=w+c),e&&(P.iss=e),y&&(P.sub=y),m&&(P.aud=m),v&&(P.jti=v);const $=$4(b),L=$4(P),j=Hr(`${$}.${L}`,"utf8"),q=await JI(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,j),X=Dy(q);return`${$}.${L}.${X}`}async function $$e(o,p,i,n,s,c,e,y,m,v,E,b){if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(o!=null&&typeof o!="object")throw new Error("Invalid input type for payload; expected object");if(E!=null&&typeof E!="object")throw new Error("Invalid input type for header; expected object");if(v!=null&&typeof v!="string")throw new Error("Invalid input type for jwtid; expected string");if(e!=null&&typeof e!="string")throw new Error("Invalid input type for issuer; expected string");if(y!=null&&typeof y!="string")throw new Error("Invalid input type for subject; expected string");if(m!=null&&typeof m!="string"&&!Array.isArray(m))throw new Error("Invalid input type for audience; expected string or string[]");const P=Hr(p??"",b??"utf8");return await x$e(o??{},P,{alg:i??"HS256",includeIat:n==null?!0:!!n,expiresInSeconds:s!=null?Number(s):void 0,notBeforeSeconds:c!=null?Number(c):void 0,issuer:e??void 0,subject:y??void 0,audience:m??void 0,jwtid:v??void 0,header:E??void 0})}async function L$e(o,p,{alg:i="HS256",issuer:n,audience:s,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[y,m,v]=String(o).split(".");if(!y||!m||!v)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=hA(y),b=hA(m);if(!E||!b)return{valid:!1,header:E,payload:b,reason:"Bad base64/json"};if(E.alg!==i)return{valid:!1,header:E,payload:b,reason:"Alg mismatch"};const w=Hr(`${y}.${m}`,"utf8"),$=await JI(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,w),L=Oc(v);if(!zI($,L))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const j=Math.floor(Date.now()/1e3),F=Math.max(0,Number(e)||0);if(b.nbf!=null&&j+F<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&j-F>=Number(b.exp))return{valid:!1,header:E,payload:b,reason:"Expired"};if(n&&b.iss!==n)return{valid:!1,header:E,payload:b,reason:"Issuer mismatch"};if(s){const q=b.aud;if(!(Array.isArray(q)?q.includes(s):q===s))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&j-Number(b.iat)>Number(c)+F?{valid:!1,header:E,payload:b,reason:"MaxAge exceeded"}:{valid:!0,header:E,payload:b}}catch(y){return{valid:!1,header:null,payload:null,reason:String((y==null?void 0:y.message)??y)}}}async function M$e(o,p,i,n,s,c,e,y){if(typeof o!="string")throw new Error("Invalid input type for token; expected string");if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(typeof n!="string")throw new Error("Invalid input type for issuer; expected string");if(s!=null&&typeof s!="string")throw new Error("Invalid input type for audience; expected string");const v=Hr(p??"",y??"utf8");return await L$e(String(o??""),v,{alg:i??"HS256",issuer:n??void 0,audience:s??void 0,maxAgeSeconds:c!=null?Number(c):void 0,clockSkewSeconds:e!=null?Number(e):void 0})}function B$e(o){const[p,i,n]=String(o).split(".");return{header:p?hA(p):null,payload:i?hA(i):null,signature:n?Oc(n):new Uint8Array}}function G$e(o,p){if(!o)throw new Error("Token is required for decoding");if(typeof o!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:n,payload:s,signature:c}=B$e(String(o??"")),e=Ql(c,i);return{header:n,payload:s,signature:e}}class k$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(et.GenerateRandomBytes);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)}),e=Math.max(0,Number(s)||0),y=c??"base64url",m=nN(e),v=Ql(m,y);return{value:G.Success,error:null,result:v}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class j$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomInteger);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[0],e=s[1],y=dOe(c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class U$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomFloat);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=jI();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class K$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomHexadecimal);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=$V(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class F$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomBase62);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=LV(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class S$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=pOe(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomAlphanumeric);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=MV(c);return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateIdentifier);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)||((E=m.value)==null?void 0:E.value)}),c=s[0],e=s[1],y=BV(c,e);return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class H$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateRandomUUIDv4);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=Iu();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class W$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{J.Logger.log("Initializing Random Generate Short Identifier Module");const n=i.find(s=>s.contextType===Y.Logic);if(n){J.Logger.log("Project state found, setting up operation");const s=n.get(et.GenerateShortIdentifier);s?(J.Logger.log("Operation found, setting autoexecutable and implementation"),s.autoexecutable=!0,s.implementation=this.module.main):J.Logger.warn("Operation generate-short-identifier not found in project state")}else J.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,n)=>{try{const s=cOe();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(et.GenerateHexadecimalToken);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const s=fOe();return{value:G.Success,error:null,result:s}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}function Rbi(o){let p;if(o===null?p="null":Array.isArray(o)?p="array":p=typeof o,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class J$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(ze.GetTypeOf);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)||((m=e.value)==null?void 0:m.value)})[0];return{value:G.Success,error:null,result:Rbi(c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.ToString);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=String(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class X$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.ToNumber);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=Number(s);return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class Q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.ToBytes);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)}),y=Hr(s,c||"utf8");return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class eLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.FromBytesToString);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)}),y=Ql(s,c||"utf8");return{value:G.Success,error:null,result:y}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class tLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.EncodeBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)});return{value:G.Success,error:null,result:g$e(s,c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class iLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.DecodeBase64);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=A$e(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class rLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.EncodeBase64Url);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Dy(s,c||"utf8");return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class nLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.DecodeBase64Url);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=Oc(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class aLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.EncodeHex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=I$e(s,c||"utf8");return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class sLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ze.DecodeHex);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)}),c=R$e(String(s));return{value:G.Success,error:null,result:c}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class lLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ai.Hash);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:O$e(s,c,e,y)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class oLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ai.Hmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)});return{value:G.Success,error:null,result:C$e(c,e,s,y,m,v)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class dLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ai.ConstantTimeEqual);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y]=n.map(m=>{var v,E;return((v=m.value)==null?void 0:v.valueAsType)??((E=m.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:D$e(s,c,e,y)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class uLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(ai.DeriveKeyPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b]=n.map(w=>{var P,$;return((P=w.value)==null?void 0:P.valueAsType)??(($=w.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:_$e(s,c,e,y,m,v,E,b)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class pLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Qr.Parse);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{var s;try{const c=(s=n[0].value)==null?void 0:s.value;if(typeof c!="string")throw new Error(`Invalid input type for JSON.parse operation: expected string, got ${typeof c}`);const e=JSON.parse(c);return{value:G.Success,error:null,result:e}}catch(c){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:c,result:null}}}})}}class cLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(s=>s.contextType===Y.Logic);if(n){const s=n.get(Qr.Stringify);s&&(s.autoexecutable=!0,s.implementation=this.module.main)}},main:async(i,n)=>{var s,c;try{const e=(s=n[0].value)==null?void 0:s.value,y=(c=n[1].value)==null?void 0:c.value;if(!e||typeof e!="object"&&!Array.isArray(e))throw new Error(`Invalid input type for JSON.stringify operation: expected object or array, got ${typeof e}`);if(!y&&y!==0){const v=JSON.stringify(e);return{value:G.Success,error:null,result:v}}const m=JSON.stringify(e,null,y);return{value:G.Success,error:null,result:m}}catch(e){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e,result:null}}}})}}class fLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Xi.BuildJwtHmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b,w,P,$,L]=n.map(j=>{var F,q;return((F=j.value)==null?void 0:F.valueAsType)??((q=j.value)==null?void 0:q.value)});return{value:G.Success,error:null,result:await $$e(s,c,e,y,m,v,E,b,w,P,$,L)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class yLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Xi.VerifyJwtHmac);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v,E,b]=n.map(w=>{var P,$;return((P=w.value)==null?void 0:P.valueAsType)??(($=w.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:await M$e(s,c,e,y,m,v,E,b)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class hLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(Xi.DecodeJwt);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(e=>{var y,m;return((y=e.value)==null?void 0:y.valueAsType)??((m=e.value)==null?void 0:m.value)});return{value:G.Success,error:null,result:G$e(s,c)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class mLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(en.HashPasswordPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c,e,y,m,v]=n.map(E=>{var b,w;return((b=E.value)==null?void 0:b.valueAsType)??((w=E.value)==null?void 0:w.value)});return{value:G.Success,error:null,result:await N$e(s,c,e,y,m,v)}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class TLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[Y.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===Y.Logic),s=n==null?void 0:n.get(en.VerifyPasswordPBKDF2);s&&(s.autoexecutable=!0,s.implementation=this.module.main)},main:async(i,n)=>{try{const[s,c]=n.map(y=>{var m,v;return((m=y.value)==null?void 0:m.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=await V$e(String(s??""),String(c??""));return{value:G.Success,error:null,result:e}}catch(s){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:s,result:null}}}})}}class XO extends KI{constructor(p,i,n=i.projectId){super(p,Y.Editor),this._editor=i,this.id=n}get ready(){return this._editor.ready}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branch(){return this._editor.branch}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,i){return this._editor.initTest(p,i)}removeTest(p){return this._editor.removeTest(p)}async copyEntities(p){return this._editor.copyEntities(p)}resolveInitialChildrenPositions(p,i,n){return this._editor.resolveInitialChildrenPositions(p,i,n)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}validateProjectState(p){return this._editor.validateProjectState(p)}requestActiveDynamicValue(p,i=!1){return this._editor.requestActiveDynamicValue(p,i)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,i){return this._editor.setValueTypePreference(p,i)}}function Dbi(o,p){return p instanceof XO?p:new XO(o,p)}class QO extends KI{constructor(p,i){super(p,Y.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get projectVersion(){return this._publicationRun.projectVersion}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function wbi(o,p){return p instanceof QO?p:new QO(o,p)}function Obi(o){o.register(new zOe(o)),o.register(new WOe(o)),o.register(new SOe(o)),o.register(new ZOe(o)),o.register(new HOe(o)),o.register(new qOe(o)),o.register(new NNe(o)),o.register(new xNe(o)),o.register(new $Ne(o)),o.register(new MNe(o)),o.register(new LNe(o)),o.register(new BNe(o)),o.register(new j$e(o)),o.register(new U$e(o)),o.register(new K$e(o)),o.register(new F$e(o)),o.register(new S$e(o)),o.register(new q$e(o)),o.register(new Z$e(o)),o.register(new H$e(o)),o.register(new W$e(o)),o.register(new z$e(o)),o.register(new VVe(o)),o.register(new NVe(o)),o.register(new xVe(o)),o.register(new $Ve(o)),o.register(new LVe(o)),o.register(new MVe(o)),o.register(new BVe(o)),o.register(new GVe(o)),o.register(new kVe(o)),o.register(new jVe(o)),o.register(new UVe(o)),o.register(new KVe(o)),o.register(new FVe(o)),o.register(new SVe(o)),o.register(new qVe(o)),o.register(new ZVe(o)),o.register(new HVe(o)),o.register(new WVe(o)),o.register(new zVe(o)),o.register(new XVe(o)),o.register(new QVe(o)),o.register(new eNe(o)),o.register(new YPe(o)),o.register(new XPe(o)),o.register(new QPe(o)),o.register(new eVe(o)),o.register(new tVe(o)),o.register(new iVe(o)),o.register(new rVe(o)),o.register(new nVe(o)),o.register(new aVe(o)),o.register(new lVe(o)),o.register(new oVe(o)),o.register(new dVe(o)),o.register(new uVe(o)),o.register(new pVe(o)),o.register(new yPe(o)),o.register(new hPe(o)),o.register(new mPe(o)),o.register(new n$e(o)),o.register(new Kxe(o)),o.register(new f_e(o)),o.register(new y_e(o)),o.register(new h_e(o)),o.register(new m_e(o)),o.register(new T_e(o)),o.register(new v_e(o)),o.register(new E_e(o)),o.register(new b_e(o)),o.register(new A_e(o)),o.register(new $_e(o)),o.register(new pPe(o)),o.register(new cPe(o)),o.register(new fPe(o)),o.register(new g_e(o)),o.register(new I_e(o)),o.register(new R_e(o)),o.register(new D_e(o)),o.register(new w_e(o)),o.register(new O_e(o)),o.register(new C_e(o)),o.register(new __e(o)),o.register(new P_e(o)),o.register(new V_e(o)),o.register(new N_e(o)),o.register(new x_e(o)),o.register(new L_e(o)),o.register(new M_e(o)),o.register(new B_e(o)),o.register(new G_e(o)),o.register(new k_e(o)),o.register(new j_e(o)),o.register(new U_e(o)),o.register(new K_e(o)),o.register(new F_e(o)),o.register(new S_e(o)),o.register(new q_e(o)),o.register(new Z_e(o)),o.register(new tPe(o)),o.register(new iPe(o)),o.register(new rPe(o)),o.register(new H_e(o)),o.register(new W_e(o)),o.register(new z_e(o)),o.register(new J_e(o)),o.register(new Y_e(o)),o.register(new X_e(o)),o.register(new Q_e(o)),o.register(new ePe(o)),o.register(new o$e(o)),o.register(new d$e(o)),o.register(new u$e(o)),o.register(new p$e(o)),o.register(new a$e(o)),o.register(new s$e(o)),o.register(new l$e(o)),o.register(new c$e(o)),o.register(new y$e(o)),o.register(new m$e(o)),o.register(new f$e(o)),o.register(new h$e(o)),o.register(new T$e(o)),o.register(new b$e(o)),o.register(new v$e(o)),o.register(new E$e(o)),o.register(new cVe(o)),o.register(new mVe(o)),o.register(new TVe(o)),o.register(new bVe(o)),o.register(new AVe(o)),o.register(new gVe(o)),o.register(new IVe(o)),o.register(new RVe(o)),o.register(new DVe(o)),o.register(new wVe(o)),o.register(new OVe(o)),o.register(new vVe(o)),o.register(new EVe(o)),o.register(new yVe(o)),o.register(new hVe(o)),o.register(new fVe(o)),o.register(new sVe(o)),o.register(new _Ve(o)),o.register(new PVe(o)),o.register(new CVe(o)),o.register(new kNe(o)),o.register(new dxe(o)),o.register(new oxe(o)),o.register(new uxe(o)),o.register(new pxe(o)),o.register(new KNe(o)),o.register(new FNe(o)),o.register(new zNe(o)),o.register(new HNe(o)),o.register(new sxe(o)),o.register(new exe(o)),o.register(new ixe(o)),o.register(new nxe(o)),o.register(new rxe(o)),o.register(new WNe(o)),o.register(new YNe(o)),o.register(new XNe(o)),o.register(new JNe(o)),o.register(new GNe(o)),o.register(new SNe(o)),o.register(new txe(o)),o.register(new yxe(o)),o.register(new HO(o)),o.register(new UNe(o)),o.register(new qNe(o)),o.register(new jNe(o)),o.register(new axe(o)),o.register(new ZNe(o)),o.register(new QNe(o)),o.register(new lxe(o)),o.register(new fxe(o)),o.register(new cxe(o)),o.register(new hxe(o)),o.register(new HO(o)),o.register(new Txe(o)),o.register(new mxe(o)),o.register(new vxe(o)),o.register(new hNe(o)),o.register(new mNe(o)),o.register(new TNe(o)),o.register(new iNe(o)),o.register(new YVe(o)),o.register(new sNe(o)),o.register(new uNe(o)),o.register(new JVe(o)),o.register(new pNe(o)),o.register(new yNe(o)),o.register(new oNe(o)),o.register(new lNe(o)),o.register(new cA(o)),o.register(new vNe(o)),o.register(new ENe(o)),o.register(new dNe(o)),o.register(new fNe(o)),o.register(new cNe(o)),o.register(new aNe(o)),o.register(new nNe(o)),o.register(new rNe(o)),o.register(new tNe(o)),o.register(new gNe(o)),o.register(new ANe(o)),o.register(new INe(o)),o.register(new bNe(o)),o.register(new lPe(o)),o.register(new nPe(o)),o.register(new sPe(o)),o.register(new oPe(o)),o.register(new dPe(o)),o.register(new aPe(o)),o.register(new uPe(o)),o.register(new J$e(o)),o.register(new iLe(o)),o.register(new nLe(o)),o.register(new sLe(o)),o.register(new tLe(o)),o.register(new rLe(o)),o.register(new aLe(o)),o.register(new eLe(o)),o.register(new Q$e(o)),o.register(new X$e(o)),o.register(new Y$e(o)),o.register(new pLe(o)),o.register(new cLe(o)),o.register(new dLe(o)),o.register(new uLe(o)),o.register(new k$e(o)),o.register(new lLe(o)),o.register(new oLe(o)),o.register(new yLe(o)),o.register(new fLe(o)),o.register(new hLe(o)),o.register(new mLe(o)),o.register(new TLe(o)),o.register(new YOe(o)),o.register(new XOe(o)),o.register(new uA(o)),o.register(new pA(o))}class aN{constructor(p=new J.Events("extensions-registry-fallback-events")){I(this,"extensionsRegistry",new Map);I(this,"initialized",new Set);I(this,"initializedContexts",new Set);I(this,"onResolveEditorContextCallback",()=>null);I(this,"onResolveProjectLogicContextCallback",()=>null);I(this,"onResolveEditorGUIContextCallback",()=>null);I(this,"onResolveGUIContextCallback",()=>null);I(this,"onResolveCompileContextCallback",()=>null);I(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,i)=>(p.manifest.initPriority||Ee.Normal)-(i.manifest.initPriority||Ee.Normal))}async setup(){Obi(this),J.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case Y.Editor:return this.onResolveEditorContextCallback();case Y.Logic:return this.onResolveProjectLogicContextCallback();case Y.EditorGUI:return this.onResolveEditorGUIContextCallback();case Y.Compile:return this.onResolveCompileContextCallback();case Y.PublicationRun:return this.onResolvePublicationRunContextCallback();case Y.GUI:return this.onResolveGUIContextCallback();case Y.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,i=[]){const n=[];i.length===0&&(i=p.manifest.contexts);for(const s of i){const c=this.requestContext(s);c&&n.push(c)}return n}requestExtension(p){const i=this.extensionsRegistry.get(p);if(i)return i;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){var p,i;for(const n of this.extensionInOrder)if(n.module.init&&!this.initialized.has(n.manifest.id)){const s=n.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);s.length&&(await((i=(p=n.module).init)==null?void 0:i.call(p,s)),this.initialized.add(n.manifest.id))}else!n.module.init&&!this.initialized.has(n.manifest.id)&&this.initialized.add(n.manifest.id)}async initForReady(){J.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){J.Logger.log("Initializing "+p.manifest.id+" extension...");const i=this.requestContexts(p);p.manifest.contexts.every(s=>!!i.find(c=>c.contextType===s))?(await p.module.init(i),this.initialized.add(p.manifest.id)):J.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(s=>s.contextType).join(", ")}`)}else!p.module.init&&!this.initialized.has(p.manifest.id)?(J.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):J.Logger.log(`Skipping initialization of ${p.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,i){this.events.on(p,i)}emit(p,...i){this.events.emit(p,...i)}off(p,i){this.events.off(p,i)}emitAsync(p,...i){return this.events.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.events.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.events.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.events.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.events.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.events.emitAsyncSequentiallyAllSettled(p,...i)}async contextAvailable(p){if(this.initializedContexts.has(p)){J.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case Y.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case Y.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}J.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,i){window.localStorage.setItem("dynamic-value-type-preference--"+p,(i==null?void 0:i.toString())||""),this.emit(p,{})}}let xb=null;const sN={requestExtension:o=>(xb||(xb=new aN,xb.setup()),xb.requestExtension(o))},Tu={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var lN=(o=>(o.FinishedSuccess="finished-success",o.FinishedError="finished-error",o.Running="running",o.Paused="paused",o.Stopped="stopped",o.NotStarted="not-started",o))(lN||{});const vLe={...sN,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class Au extends J.Events{constructor(i,n,s,c=null,e=vLe){super();I(this,"project");I(this,"entryPoint");I(this,"state","not-started");I(this,"events",new J.Events("fe-exec-inst-events"));I(this,"entities",[]);I(this,"parentExecution",null);I(this,"executing",[]);I(this,"executed",[]);I(this,"skipped",[]);I(this,"scheduled",[]);I(this,"localTestValues");I(this,"resolvedValues");I(this,"persistedExecutionResults");I(this,"lastExecutionResults");I(this,"onAddToSkippedListCallback",null);I(this,"onRemoveFromSkippedListCallback",null);I(this,"onAddEntityCallback",null);I(this,"onRemoveEntityCallback",null);I(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=s,this.project=i,this.parentExecution=c,this.localTestValues=new _m(x.UUID.uuid(),this.project),this.resolvedValues=new _m(x.UUID.uuid(),this.project),this.persistedExecutionResults=new _m(x.UUID.uuid(),this.project),this.lastExecutionResults=new _m(x.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Zr.includes(i.type)&&wt(i).forEach(n=>this.skip(n))))}async schedule(i,n,s){if(this.hasExecuted(i))return null;if(Yt.includes(i.type))return this.executeBranch(i,s,n);if(qr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,s,n);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,n){const s=[];return[...Qt,...Yt].includes(n.type)?s.push(...n.inputs):qt.includes(n.type)&&s.push(...n.outputs),s.map(e=>{var m;let y=i.find(v=>v.valueOwner.id===e.id);if(y)return y;if(!y&&Yt.includes(n.type)&&(y=i.find(v=>{var E;return((E=v.valueOwner.declaration)==null?void 0:E.id)===e.id})),y){const v=(m=y.value)==null?void 0:m.clone(null);return v==null||v.setStandaloneParent(e,null),{...y,valueOwner:e,value:v||null,inheritanceLink:{sources:[y],target:e}}}return Ma.includes(e.type)?Ao(e,this.valueResolutionContext):$u(e,this.valueResolutionContext)}).reduce((e,y)=>{const m=Oo(y==null?void 0:y.valueOwner,this.project),v=y?[y]:[];return m.forEach(E=>{var P,$,L;if(E.id===(y==null?void 0:y.valueOwner.id))return;const b=vt(E.getDataType(null),E,this.project);b==null||b.metaSync({value:(P=y==null?void 0:y.value)==null?void 0:P.value},null),b==null||b.setValueAsTypeList((($=y==null?void 0:y.value)==null?void 0:$.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((L=y==null?void 0:y.value)==null?void 0:L.valueAsTypeSingle)||null);const w={...y,valueOwner:E,value:b};v.push(w)}),[...e,...v]},[]).sort((e,y)=>e.valueOwner.index-y.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,n,s,c={}){var y,m;const e={...Tu,...c};try{let v={value:G.Success,error:null,result:null};if(n.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Er).includes(i.declaration.id)){const E=this.parentContext.requestExtension(oy+i.declaration.id).module.main;E?v=await E(i,n):J.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{v=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);let E=null;if(v.error){J.Logger.warn("Raw error executing entity: ",v.error);const b=(y=i.error)==null?void 0:y.getDataType(null),w=vt(b||null,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(v.error):w==null||w.metaSync({value:v.error},null),E={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:w}}return{value:v.value,entity:i,error:E,result:{value:v.result||null,valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null}}}return{...v,entity:i}}catch(v){J.Logger.warn("Internal call execution error: ",v);let E=null;if(i.error){const b=(m=i.error)==null?void 0:m.getDataType(null),w=vt(b,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(v):w==null||w.metaSync({value:v},null),E={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:w}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:E,result:null}}}static async executeOperation(i,n,s){var c,e;try{let y={value:G.Success,error:null,result:null};n.sort((b,w)=>b.valueOwner.index-w.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,n));let m=null;if(y.error&&i.error){J.Logger.warn("Raw error executing entity: ",y.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,w=vt(b,i.error,s);b!=null&&b.asType?w==null||w.setValueAsTypeSingle(y.error):w==null||w.metaSync({value:y.error},null),m={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:w}}const v=i==null?void 0:i.getDataType(null),E=vt(v,i,s);return v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y.result):E==null||E.metaSync({value:y.result},null),{value:y.value,entity:i,error:m,result:{value:E||null,valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null}}}catch(y){J.Logger.warn("Operation execution error: ",y);let m=null;if(i.error){const v=(e=i.error)==null?void 0:e.getDataType(null),E=vt(v,i.error,s);v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y):E==null||E.metaSync({value:y},null),m={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:m,result:null}}}async executeSearch(i,n,s){var c;try{let e={value:G.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(Ae.SEARCH_NODE_IMPLEMENTATION)).module.main(i,n),m=i==null?void 0:i.getDataType(null),v=vt(m,i,s);return v==null||v.metaSync({value:{data:y.data}},null),y.error?{value:G.UnhandledError,entity:i,error:{valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null,value:v},result:null}:{value:e.value,entity:i,error:null,result:{value:v,valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null}}}catch(e){if(J.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const y=(c=i.error)==null?void 0:c.getDataType(null),m=vt(y,i.error,s);return m==null||m.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:m},result:null}}}async executeLoop(i,n,s,c={}){var y,m,v,E,b,w;const e={...Tu,...c};try{let P={value:G.Success,error:null,result:null};const $=n.map(ne=>{var ee,pe;return((ee=ne==null?void 0:ne.value)==null?void 0:ee.valueAsType)||((pe=ne==null?void 0:ne.value)==null?void 0:pe.value)});let L={};i.getUniqueInputMaps().forEach(ne=>{const ee=i.body.inputs.find(Te=>se(Te,s)===se(ne,s)),pe=ne==null?void 0:ne.getDataType(null),oe=vt(pe,ee,s);pe!=null&&pe.asType?oe==null||oe.setValueAsTypeList([]):oe==null||oe.metaSync({value:[]},null),this.lastExecutionResults.writeValue(ee,oe);const ce={value:oe,valueOwner:ee,type:Ve.ExecutionResult,inheritanceLink:null};L[ee.id]=ce});let F={value:G.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case Q.loop["counted-loop"].id:{const ne=$[0];let ee=1;for(;ee<=ne&&ee<=50;){const pe=i.body.inputs.map(oe=>{if(oe===i.currentIterationNumberArgumentDeclaration){const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Te=yc(ce),de=this.lastExecutionResults.readValue(oe.id);if(de){de.metaSync({value:ee},null),this.lastExecutionResults.writeValue(oe,de);const Ge={value:de,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null};return L[oe.id]=Ge,Ge}const ye={id:x.UUID.uuid(),deletable:!0,editable:!0,type:d.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ee,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:Te,standaloneParent:oe.toReference()},_e=Ki(ye,s);this.lastExecutionResults.writeValue(oe,_e);const Pe={value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null};return L[oe.id]=Pe,Pe}else return L[oe.id]}).filter(oe=>!!oe);if(F=await this.executeFullFunctionDeclarationLogic(i.body,pe,e),(F.results||[]).forEach(oe=>{var ye,_e,Pe,Ge;if(oe.valueOwner.type!==d.InputMap||qt.includes(oe.valueOwner.parent.type))return;const ce=i.body.inputs.find(xe=>se(xe,s)===se(oe.valueOwner,s)),de=[...((_e=(ye=L==null?void 0:L[ce.id])==null?void 0:ye.value)==null?void 0:_e.value)||[],((Pe=oe==null?void 0:oe.value)==null?void 0:Pe.value)||null];(Ge=L[ce.id].value)==null||Ge.metaSync({value:de},null),this.lastExecutionResults.writeValue(ce,L[ce.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["manual-flow-loop"].id:{let ne=1;for(;ne<=50;){const ee=i.body.inputs.map(pe=>{if(pe===i.currentIterationNumberArgumentDeclaration){const oe=this.lastExecutionResults.readValue(pe.id);if(oe){oe.metaSync({value:ne},null),this.lastExecutionResults.writeValue(pe,oe);const ye={value:oe,valueOwner:pe,type:Ve.ExecutionResult,inheritanceLink:null};return L[pe.id]=ye,ye}const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),Te=vt(ce,pe,s);return Te==null||Te.metaSync({value:ne},null),this.lastExecutionResults.writeValue(pe,Te),{value:Te,valueOwner:pe,type:Ve.ExecutionResult,inheritanceLink:null}}else return L[pe.id]}).filter(pe=>!!pe);if(F=await this.executeFullFunctionDeclarationLogic(i.body,ee,e),(F.results||[]).forEach(pe=>{var de,ye,_e;if(pe.valueOwner.type!==d.InputMap||qt.includes(pe.valueOwner.parent.type))return;const oe=i.body.inputs.find(Pe=>se(Pe,s)===se(pe.valueOwner,s)),Te=[...(de=L[oe.id].value)==null?void 0:de.value,((ye=pe.value)==null?void 0:ye.value)||null];(_e=L[oe.id].value)==null||_e.metaSync({value:Te},null),this.lastExecutionResults.writeValue(oe,L[oe.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ne++}break}case Q.loop["list-loop"].id:{const ne=$[0];let ee=1;const pe=ne;for(let oe=0;oe<pe.length;oe++){const ce=pe[oe],Te=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(de.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,ye),{value:ye,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Pe=vt(_e,de,s);return Pe==null||Pe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else if(de===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=yc(ye),Pe=this.lastExecutionResults.readValue(de.id);if(Pe)return Pe.metaSync({value:ce},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const Ge={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:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:de.toReference()},xe=Ki(Ge,s);return this.lastExecutionResults.writeValue(de,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else return L[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,Te,e),(F.results||[]).forEach(de=>{var Ge,xe,Me;if(de.valueOwner.type!==d.InputMap||qt.includes(de.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>se(Se,s)===se(de.valueOwner,s)),Pe=[...(Ge=L[ye.id].value)==null?void 0:Ge.value,((xe=de.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Pe},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["object-keys-loop"].id:{const ne=$[0];let ee=1;const pe=ne?Object.keys(ne):[];for(let oe=0;oe<pe.length;oe++){const ce=pe[oe],Te=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(de.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,ye),{value:ye,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Pe=vt(_e,de,s);return Pe==null||Pe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else if(de===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=yc(ye),Pe=this.lastExecutionResults.readValue(de.id);if(Pe)return Pe.metaSync({value:ce},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const Ge={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:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:de.toReference()},xe=Ki(Ge,s);return this.lastExecutionResults.writeValue(de,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else return L[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,Te,e),(F.results||[]).forEach(de=>{var Ge,xe,Me;if(de.valueOwner.type!==d.InputMap||qt.includes(de.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>se(Se,s)===se(de.valueOwner,s)),Pe=[...(Ge=L[ye.id].value)==null?void 0:Ge.value,((xe=de.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Pe},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["object-values-loop"].id:{const ne=$[0];let ee=1;const pe=ne?Object.values(ne):[];for(let oe=0;oe<pe.length;oe++){const ce=pe[oe],Te=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(de.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,ye),{value:ye,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Pe=vt(_e,de,s);return Pe==null||Pe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else if(de===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=yc(ye),Pe=this.lastExecutionResults.readValue(de.id);if(Pe)return Pe.metaSync({value:ce},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const Ge={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:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:de.toReference()},xe=Ki(Ge,s);return this.lastExecutionResults.writeValue(de,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else return L[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,Te,e),(F.results||[]).forEach(de=>{var Ge,xe,Me;if(de.valueOwner.type!==d.InputMap||qt.includes(de.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>se(Se,s)===se(de.valueOwner,s)),Pe=[...(Ge=L[ye.id].value)==null?void 0:Ge.value,((xe=de.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Pe},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}case Q.loop["string-loop"].id:{const ne=$[0];let ee=1;const pe=ne.split("");for(let oe=0;oe<pe.length;oe++){const ce=pe[oe],Te=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(de.id);if(ye)return ye.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,ye),{value:ye,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Pe=vt(_e,de,s);return Pe==null||Pe.metaSync({value:ee},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:i.currentIterationNumberArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else if(de===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=yc(ye),Pe=this.lastExecutionResults.readValue(de.id);if(Pe)return Pe.metaSync({value:ce},null),this.lastExecutionResults.writeValue(de,Pe),{value:Pe,valueOwner:de,type:Ve.ExecutionResult,inheritanceLink:null};const Ge={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:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:de.toReference()},xe=Ki(Ge,s);return this.lastExecutionResults.writeValue(de,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:Ve.ExecutionResult,inheritanceLink:null}}else return L[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,Te,e),(F.results||[]).forEach(de=>{var Ge,xe,Me;if(de.valueOwner.type!==d.InputMap||qt.includes(de.valueOwner.parent.type))return;const ye=i.body.inputs.find(Se=>se(Se,s)===se(de.valueOwner,s)),Pe=[...(Ge=L[ye.id].value)==null?void 0:Ge.value,((xe=de.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Pe},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;ee++}break}}if(P={value:[G.CaughtError,G.Return].includes(F.value)?F.value:G.Success,error:((m=(y=F.error)==null?void 0:y.value)==null?void 0:m.value)||null,result:((E=(v=F==null?void 0:F.result)==null?void 0:v.value)==null?void 0:E.value)||null},P.error&&i.error){const ne=(b=i.error)==null?void 0:b.getDataType(null),ee=vt(ne||null,i.error,s);ne!=null&&ne.asType?ee==null||ee.setValueAsTypeSingle(P.error):ee==null||ee.metaSync({value:P.error},null);const pe={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:ee};return{value:P.value,entity:i,error:pe,result:null}}const q=i==null?void 0:i.getDataType(null),X=vt(q,i,s);return q!=null&&q.asType?X==null||X.setValueAsTypeSingle(P.result):X==null||X.metaSync({value:P.result},null),{value:P.value,entity:i,error:null,result:{value:X||null,valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null}}}catch(P){if(J.Logger.warn("Error executing loop: ",P),i.error){const $=(w=i.error)==null?void 0:w.getDataType(null),L=vt($,i.error,s);return $!=null&&$.asType?L==null||L.setValueAsTypeSingle(P):L==null||L.metaSync({value:P},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:L},result:null}}else return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,n,s,c={}){var y,m,v,E,b,w,P,$,L,j,F,q,X,ne,ee,pe,oe,ce,Te,de,ye,_e,Pe,Ge,xe,Me;const e={...Tu,...c};try{const Se=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,s,e);let je=null;if(Se.error&&i.error){J.Logger.warn("Raw error executing entity: ",Se.error);const ot=(y=i.error)==null?void 0:y.getDataType(null),Rt=vt(ot||null,i.error,s);ot!=null&&ot.asType?(v=(m=Se.error)==null?void 0:m.value)!=null&&v.valueAsTypeSingle?Rt==null||Rt.setValueAsTypeSingle((b=(E=Se.error)==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle):(P=(w=Se.error)==null?void 0:w.value)!=null&&P.valueAsTypeList&&Array.isArray((L=($=Se.error)==null?void 0:$.value)==null?void 0:L.valueAsTypeList)&&(Rt==null||Rt.setValueAsTypeList((F=(j=Se.error)==null?void 0:j.value)==null?void 0:F.valueAsTypeList)):Rt==null||Rt.metaSync({value:(X=(q=Se.error)==null?void 0:q.value)==null?void 0:X.value},null),je={valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:Rt}}let Ze=G.Success;Se.value===G.UnhandledError&&(i.catchesError||i.errorCalls.length?Ze=G.CaughtError:Ze=G.UnhandledError);const Ye=i==null?void 0:i.getDataType(null),lt=vt(Ye,i,s);return Ye!=null&&Ye.asType?(ee=(ne=Se.result)==null?void 0:ne.value)!=null&&ee.valueAsTypeSingle?lt==null||lt.setValueAsTypeSingle((oe=(pe=Se.result)==null?void 0:pe.value)==null?void 0:oe.valueAsTypeSingle):(Te=(ce=Se.result)==null?void 0:ce.value)!=null&&Te.valueAsTypeList&&Array.isArray((ye=(de=Se.result)==null?void 0:de.value)==null?void 0:ye.valueAsTypeList)&&(lt==null||lt.setValueAsTypeList((Pe=(_e=Se.result)==null?void 0:_e.value)==null?void 0:Pe.valueAsTypeList)):lt==null||lt.metaSync({value:((xe=(Ge=Se.result)==null?void 0:Ge.value)==null?void 0:xe.value)||null},null),{value:Ze,entity:i,error:je,result:{value:lt||null,valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null}}}catch(Se){if(!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const je=(Me=i.error)==null?void 0:Me.getDataType(null),Ze=vt(je,i.error,s);return je!=null&&je.asType?Ze==null||Ze.setValueAsTypeSingle(Se):Ze==null||Ze.metaSync({value:Se},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:Ve.ExecutionResult,inheritanceLink:null,value:Ze},result:null}}}async executeCondition(i,n){var c,e,y,m;let s=!1;switch(i.declaration.id){case tn.BooleanIsTrue:{const v=(e=(c=n[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof v!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");s=v===!0;break}case tn.BooleanIsFalse:{const v=(m=(y=n[0])==null?void 0:y.value)==null?void 0:m.value;if(typeof v!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");s=v===!1;break}case dr.And:{s=(await Promise.all(i.andChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).every(E=>E);break}case dr.Or:{s=(await Promise.all(i.orChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).some(E=>E);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:s?G.Success:G.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,n,s,c={}){const e={...Tu,...c,onBeforeEntityExecution:(v,E,b)=>{var w;return((w=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:w.call(c,v,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(v,E,b)=>{var w;return((w=c==null?void 0:c.onEntityExecuted)==null?void 0:w.call(c,v,E,{...b,detached:!0}))||Promise.resolve()}},y=new Au(s,[i,...CA(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,n)}async executeFullFunctionDeclarationLogic(i,n,s={}){const c={...Tu,...s},e=CA(i);e.forEach(v=>{this.addEntity(v)}),e.reduce((v,E)=>qt.includes(E.type)?[...v,...E.outputs]:Qt.includes(E.type)&&E.type!==d.Condition?[...v,...E.outputs,...E.inputs]:E.type===d.Condition?[...v,...E.inputs]:v,[]).forEach(v=>{this.lastExecutionResults.removeValue(v.id)});const m=await this.executeBranch(i,c,n);return{...m||{},value:(m==null?void 0:m.value)||G.Success,entity:i,error:(m==null?void 0:m.error)||null,result:(m==null?void 0:m.result)||null}}static async executeEntryPointEntity(i,n){return{value:G.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,n){var y,m,v,E,b,w,P;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ve.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)vr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const L=vt(c,i,this.project);L==null||L.metaSync({value:$},null),s={valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(L=>{var j,F;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const q=this.lastExecutionResults.readValue(L.declaration.id),X=se(L,this.project),ne=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||qi(X);if(q)q.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,q);else{const ee=vt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&vr((w=s.value)==null?void 0:w.value)?((P=s.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var q;const L=$.codeName||((q=$.declaration)==null?void 0:q.codeName)||qi(se($,this.project)),j=e[L],F=vt($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ve.ExecutionResult}),s.type=Ve.ExecutionResult,{value:G.Return,entity:i,error:null,result:s}}async executeContinueStatement(i,n){var y,m,v,E,b,w,P;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ve.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)vr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const L=vt(c,i,this.project);L==null||L.metaSync({value:$},null),s={valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(L=>{var j,F;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const q=this.lastExecutionResults.readValue(L.declaration.id),X=se(L,this.project),ne=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||qi(X);if(q)q.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,q);else{const ee=vt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&vr((w=s.value)==null?void 0:w.value)?((P=s.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var q;const L=$.codeName||((q=$.declaration)==null?void 0:q.codeName)||qi(se($,this.project)),j=e[L],F=vt($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ve.ExecutionResult}),s.type=Ve.ExecutionResult,{value:G.Continue,entity:i,error:null,result:s}}async executeBreakStatement(i,n){var y,m,v,E,b,w,P;if((y=i.throws)!=null&&y.readsValue){const $=Ao(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:Ve.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let s=Ao(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((m=c==null?void 0:c.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),s!=null&&s.value)vr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const L=vt(c,i,this.project);L==null||L.metaSync({value:$},null),s={valueOwner:i,type:Ve.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,s.value),i.outputs.forEach(L=>{var j,F;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const q=this.lastExecutionResults.readValue(L.declaration.id),X=se(L,this.project),ne=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||qi(X);if(q)q.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,q);else{const ee=vt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(i,s==null?void 0:s.value);const e=(b=s==null?void 0:s.value)!=null&&b.value&&vr((w=s.value)==null?void 0:w.value)?((P=s.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var q;const L=$.codeName||((q=$.declaration)==null?void 0:q.codeName)||qi(se($,this.project)),j=e[L],F=vt($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ve.ExecutionResult}),s.type=Ve.ExecutionResult,{value:G.Break,entity:i,error:null,result:s}}async executeVariable(i,n){var m,v,E,b,w,P;let s=Ao(i,this.valueResolutionContext);const c=Wn(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let $={};if(((m=e==null?void 0:e.entity)==null?void 0:m.type)===d.DefinitionEntity&&($={...$,...e.entity.getActiveRawDefaultValue()}),s!=null&&s.value)vr((v=s==null?void 0:s.value)==null?void 0:v.value)&&($={...$,...(E=s==null?void 0:s.value)==null?void 0:E.value}),s==null||s.value.metaSync({value:$},null);else{const L=vt(e,i,this.project);L==null||L.metaSync({value:$},null),s={valueOwner:c,type:Ve.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(c,s.value),c.inputs.forEach(L=>{var j,F;if(((j=L.declaration)==null?void 0:j.type)===d.Property&&L.declaration.static){const q=this.lastExecutionResults.readValue(L.declaration.id),X=se(L,this.project),ne=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||qi(X);if(q)q.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,q);else{const ee=vt(L.getDataType(null),L,this.project);ee==null||ee.metaSync({value:$[ne]},null),this.lastExecutionResults.writeValue(L.declaration,ee)}}})}else this.lastExecutionResults.writeValue(c,s==null?void 0:s.value);const y=(b=s==null?void 0:s.value)!=null&&b.value&&vr((w=s.value)==null?void 0:w.value)?((P=s.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var q;const L=$.codeName||((q=$.declaration)==null?void 0:q.codeName)||qi(se($,this.project)),j=y[L],F=vt($.getDataType(null),$,this.project);F==null||F.metaSync({value:j},null),Ve.ExecutionResult}),s.type=Ve.ExecutionResult,{value:G.Success,entity:i,error:null,result:s}}mergeValues(i,n){const s=[];for(let c=0;c<n.length;c++)i!=null&&i[c]?s.push(i[c]):s.push(n[c]);return s}async executeEntity(i,n=[],s={}){var y,m,v,E,b,w,P,$,L,j,F;const c={...Tu,...s},e={detached:!1};switch(i.type){case d.Condition:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((y=c.onBeforeEntityExecution)==null?void 0:y.call(c,i,q,e)),this.executeCondition(i,q)}case d.InternalCall:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((m=c.onBeforeEntityExecution)==null?void 0:m.call(c,i,q,e)),this.executeInternalCall(i,q,this.project)}case d.Operation:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((v=c.onBeforeEntityExecution)==null?void 0:v.call(c,i,q,e)),Au.executeOperation(i,q,this.project)}case d.VariableInstance:case d.VariableDeclaration:return this.executeVariable(i,n);case d.FunctionCall:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,q,e)),this.executeFunctionCall(i,q,this.project)}case d.FunctionDeclaration:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,q,e)),Au.executeEntryPointEntity(i,q)}case d.Search:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((w=c.onBeforeEntityExecution)==null?void 0:w.call(c,i,q,e)),this.executeSearch(i,q,this.project)}case d.Loop:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((P=c.onBeforeEntityExecution)==null?void 0:P.call(c,i,q,e)),this.executeLoop(i,q,this.project,c)}case d.ReturnStatement:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await(($=c.onBeforeEntityExecution)==null?void 0:$.call(c,i,q,e)),this.executeReturnStatement(i,q)}case d.ContinueStatement:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((L=c.onBeforeEntityExecution)==null?void 0:L.call(c,i,q,e)),this.executeContinueStatement(i,q)}case d.BreakStatement:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((j=c.onBeforeEntityExecution)==null?void 0:j.call(c,i,q,e)),this.executeBreakStatement(i,q)}case d.GlobalEvent:{const q=this.mergeExernalValuesWithInternalInputs(n,i);return await((F=c.onBeforeEntityExecution)==null?void 0:F.call(c,i,q,e)),Au.executeEntryPointEntity(i,q)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var s,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((s=i.result)!=null&&s.valueOwner))return;const n=Oo((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?n.forEach(y=>{var m;this.lastExecutionResults.writeValue(y,(m=i.result)==null?void 0:m.value)}):n.forEach(y=>{this.lastExecutionResults.removeValue(y.id)})}async executeBranch(i,n={},s=[]){var v;const c={...Tu,...n},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const m=await this.executeEntity(i,s,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(m),await((v=c.onEntityExecuted)==null?void 0:v.call(c,i,m,e)),m.value===G.Success){const E=(i.successCalls||i.calls||[]).filter(L=>this.hasEntity(L));(i.errorCalls||[]).forEach(L=>{this.skip(L)});let w=[];const P=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=P.filter(L=>!!L).find(L=>L.value===G.CaughtError||L.value===G.Return||L.value===G.Break||L.value===G.Continue);return $||(w=[...w,...P],m)}else if(m.value===G.CaughtError||m.value===G.ConditionNotMet){const E=(i.errorCalls||[]).filter(L=>this.hasEntity(L));(i.successCalls||i.calls||[]).forEach(L=>{this.skip(L)});let w=[];const P=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=P.filter(L=>!!L).find(L=>L.value===G.CaughtError||L.value===G.UnhandledError||L.value===G.Return||L.value===G.Break||L.value===G.Continue);return $||(w=[...w,...P],m)}else{if(m.value===G.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),Zr.includes(m.entity.type)&&wt(m.entity).forEach(E=>{this.skip(E)}),m;if(m.value===G.Return)return m;if(m.value===G.Break)return m;if(m.value===G.Continue)return m}return m}async execute(i={},n=[]){const s={...Tu,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,s,n);return this.state="finished-success",c}addEntity(i){var n;this.entities.includes(i)||(this.entities.push(i),(n=this.onAddEntityCallback)==null||n.call(this,i,{}))}async addEntityAsync(i,n={}){var s;this.entities.includes(i)||(this.entities.push(i),await((s=this.onAddEntityCallback)==null?void 0:s.call(this,i,n)))}addEntities(i){i.forEach(n=>this.addEntity(n))}async addEntitiesAsync(i,n={}){const s=J.YieldTracker.from(n),c=[];for(const e of i)c.push(this.addEntityAsync(e,n)),await s.tick();await Promise.all(c)}removeEntity(i){var n;if(i!==this.entryPoint){const s=this.entities.indexOf(i);s>-1&&(this.entities.splice(s,1),(n=this.onRemoveEntityCallback)==null||n.call(this,i,{}))}}hasEntity(i){var c,e,y;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===d.FunctionDeclaration&&((y=(e=i.parent)==null?void 0:e.parent)==null?void 0:y.type)===d.DefinitionEntity)return this.entities.includes(i.parent);const n=si(i);if(!n)return!1;const s=n.type===d.Loop&&i.parent===n.body?n.body:null;return s?this.entities.includes(s)||this.entities.includes(n):this.entities.includes(n)}removeScheduled(i){const n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const n=this.project.get(i);return n?this.hasEntity(n):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,1)}removeFromExecutingList(i){var s;const n=this.executing.indexOf(i);n>-1&&(this.executing.splice(n,1),(s=this.onAbortExecutionCallback)==null||s.call(this,i,{}))}removeFromAlreadyExecutedList(i){const n=this.executed.indexOf(i);n>-1&&this.executed.splice(n,1)}removeFromSkippedList(i){var s;const n=this.skipped.indexOf(i);n>-1&&(this.skipped.splice(n,1),(s=this.onRemoveFromSkippedListCallback)==null||s.call(this,i,{}))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var n;this.skipped.includes(i)||(this.skipped.push(i),(n=this.onAddToSkippedListCallback)==null||n.call(this,i,{}))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,n){this.parentContext.setValueTypePreference(i,n),this.emit(i,{})}}function Cbi(o){var p,i;if(o.isList)return"list";if(((p=o.entity)==null?void 0:p.type)===d.DefinitionEntity)return"definition-entity";switch((i=o.entity)==null?void 0:i.name){case le.Number:return"number";case le.String:return"text";case le.Boolean:return"boolean";case le.UUID:return"uuid";case le.Date:return"date-time";default:return"definition-entity"}}const as={[d.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[d.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[d.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[d.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[d.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[d.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[d.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[d.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[d.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[d.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[d.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[d.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[d.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[d.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[d.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[d.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[d.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[d.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[d.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[d.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[d.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[d.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[d.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[d.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function oN(o){const p=_R(o);if(!p){const n=Ny(o);if(n.includes(Re.HTTP_ENDPOINT))return"HTTP endpoint";if(n.includes(Re.PERSISTED_ENTITY))return"Persisted entity";if(n.includes(Re.CRON_JOB))return"Scheduled execution";if(n.includes(Re.RELATIONAL_DATABASE))return"Relational database"}if(p){let n="Extension of "+se(p,p.project)+" entity",s=wo(n);const c=Ny(o);return c.includes(Re.HTTP_ENDPOINT)?"HTTP endpoint"+(s?", "+s:""):c.includes(Re.PERSISTED_ENTITY)?"Persisted entity"+(s?", "+s:""):c.includes(Re.CRON_JOB)?"Scheduled execution"+(s?", "+s:""):c.includes(Re.RELATIONAL_DATABASE)?"Relational database"+(s?", "+s:""):n}let i="";return o.abstract&&(i="Template "),o.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function ELe(o){return o.parent.type===d.DefinitionEntity||o.parent.type===d.InstalledProject?"Internal action of "+se(o.parent,o.project):o.parent.type===d.Loop?"Action repeated on every iteration":"Internal action of entity"}function dN(o){return lx(o)?ELe(o):"Custom trigger"}function _bi(o){var p;switch(o.type){case d.DefinitionEntity:return oN(o);case d.FunctionDeclaration:return dN(o)}return(p=as[o.type])==null?void 0:p.singular}function Pbi(o){var p;switch(o.type){case d.DefinitionEntity:return oN(o);case d.FunctionDeclaration:return dN(o)}return(p=as[o.type])==null?void 0:p.singular}const uN=4e4,bLe=280,Vbi=300,pN=65,dy=32,Sb=39,ALe=26,gLe=49,mA=44,Nbi=35,qb=52,cN=10,dd=cN*2,TA=38,Zb=90,eC=270,ILe=uN/2+120,RLe=uN/2+180;function DLe(o){let i=dy+mA+TA+cN;const n=[...o.inputs];return n.length&&(i+=dd,n.forEach(()=>{i+=ALe})),{height:i,width:280}}function wLe(o){let i=pN;const n=[];if([d.DefinitionEntity].includes(o.type)){const m=[...o.suggestedProperties||[],...o.properties||[]];m.length&&(i+=dd,m.forEach(v=>{i+=v.static?gLe:Sb}))}if([d.DefinitionEntity,d.InstalledProject,d.Loop].includes(o.type)){const m=[...(o==null?void 0:o.suggestedMethods)||[],...o.methods||[],...o.functions||[],...o.body?[o.body]:[]];m.length&&(i+=dd,m.forEach(v=>{const E=DLe(v);i+=E.height}))}Qt.includes(o.type)?(Gt.includes(o.type)?n.push(...(o.usedInputs||[]).flatMap(m=>[m])||[]):n.push(...(o.inputs||[]).flatMap(m=>[m])||[]),o.error&&(i+=qb)):[d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)?(n.push(...o.outputs||[]),o.throws&&(i+=qb)):o.type===d.Condition&&(n.push(o.inputs[0]),o.inputs[1]&&n.push(o.inputs[1]));const s=n.length;s&&(i+=s*Sb,i+=dd);const c=[];if(o.type===d.FunctionDeclaration||o.type===d.GlobalEvent?c.push(...o.inputs||[]):Qt.includes(o.type)&&(Gt.includes(o.type)?c.push(...o.usedOutputs||[]):c.push(...o.outputs||[])),Gt.includes(o.type)){o.readsValue&&(i+=dd,i+=mA),o.writesValues.length&&(i+=dd,i+=mA),o.internalCalls.length&&o.usedInternalCalls.forEach(()=>i+=qb+dd);const m=o.getDataType(null);(!m||m.inferred)&&(i+=TA)}const e=c.length;return e&&(i+=e*Sb,i+=dd),[d.DefinitionEntity,d.FunctionDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement].includes(o.type)&&(i+=TA),{height:i,width:280}}function uv(o){return`${o.split("-").map((n,s)=>s===0?n.charAt(0).toUpperCase()+n.slice(1):n.toLowerCase()).join(" ")}.`}function xbi(o){switch(o.code){case me.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case me.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case me.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case me.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case me.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case me.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case me.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case me.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case me.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Ie.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case me.NoProperties:return"This entity has no properties, so it doesn't do anything";case me.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case me.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case me.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case me.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case me.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case me.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case me.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case me.PropertyImplementsNonAbstact:return"This property implements a non-template property";case me.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case me.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case me.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case me.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case me.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Ie.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ie.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ie.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ie.UnreachableEntity:return"This entity is unreachable";case me.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case me.AbstractEntityImplements:return"This template entity implements a non-template entity";case me.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case me.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case me.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case me.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case me.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case me.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case me.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case me.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case me.MissingRequiredValue:return"This action is missing a required value";case me.NoPrimaryKeyProperty:return"This entity has no primary key property";case me.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case me.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case me.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case me.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case me.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case me.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case me.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ie.EmptyName:return"This entity has no name";case Ie.InvalidObjectStructure:return"This entity has an invalid structure";case Ie.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ie.MissingCaller:return"This action is missing a caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ie.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ie.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case xo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case xo.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case Ba.UUIDMustBeString:return`UUID must be a string, eg: "${Iu()}"`;case Ba.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${Iu()}"`;case Ba.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${Iu()}"`;case sa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case sa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case sa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return uv(o.code)}}function $bi(o){switch(o.code){case me.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case me.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case me.IncorrectEntityImplementation:return"Incorrect implementation";case me.IncorrectMethodImplementation:return"Incorrect action implementation";case me.IncorrectPropertyImplementation:return"Incorrect property implementation";case me.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case me.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case me.MissingMethodImplementation:return"Missing action";case me.MissingPropertyImplementation:return"Missing property";case Ie.NameNotUniqueInScope:return"Duplicate name";case me.NoProperties:return"No properties";case me.NonStaticPropertyInStaticEntity:return"Non-static property";case me.StaticEntityWithNonStaticProperties:return"Non-static properties";case me.ReadingFromIncompatibleType:return"Read from different type";case me.WritingToIncompatibleType:return"Write to different type";case me.ScopeWithoutLogic:return"No logic";case me.NonStaticPropertyImplementsStatic:return"Invalid static property";case me.PropertyImplementsIncompatibleType:return"Incompatible data type";case me.PropertyImplementsNonAbstact:return"Non-template property";case me.StaticPropertyImplementsNonStatic:return"Non-static property";case me.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case me.VariableHasInputsAndInternalCall:return"Bad internal call";case me.VariableHasOutputsAndInternalCall:return"Bad internal call";case me.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Ie.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ie.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ie.InternalCallParentMissingDataType:return"Parent has no data type";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ie.UnreachableEntity:return"Unreachable entity";case me.DisconnectedCallableEntity:return"Disconnected entity";case me.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case me.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case me.InvalidPropertiesCombination:return"Invalid properties combination";case me.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case me.ExtendsIncompatibleEntities:return"Extends incompatible entities";case me.ImplementingNonAbstractEntity:return"Implementing non-template entity";case me.ImplementsIncompatibleEntities:return"Implements incompatible entities";case me.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case me.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case me.MissingRequiredValue:return"Missing required value";case me.NoPrimaryKeyProperty:return"No primary key property";case me.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case me.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case me.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case me.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case me.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case me.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case me.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Ie.EmptyName:return"Empty name";case Ie.InvalidObjectStructure:return"Invalid object structure";case Ie.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MissingCaller:return"Missing caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ie.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case xo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case xo.StatusCodeMustBeNumber:return"HTTP status code must be a number";case Ba.UUIDMustBeString:return"UUID must be a string";case Ba.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case Ba.UUIDMustBeValidFormat:return"UUID must be in a valid format";case sa.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case sa.StringValueMustNotHaveDashes:return"This value must not contain dashes";case sa.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return uv(o.code)}}function Lbi(o){switch(o.code){case me.AbstractEntityWithNonAbstractMethods:return`${se(o.entity,o.entity.project)} has non-template actions`;case me.AbstractEntityWithNonAbstractProperties:return`${se(o.entity,o.entity.project)} has non-template properties`;case me.IncorrectEntityImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements template`;case me.IncorrectMethodImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements the template`;case me.IncorrectPropertyImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements the template`;case me.AbstractMethodInNonAbstractEntity:return`${se(o.entity,o.entity.project)} can't be a template`;case me.AbstractPropertyInNonAbstractEntity:return`${se(o.entity,o.entity.project)} can't be a template`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${se(o.entity,o.entity.project)} overwrites action`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${se(o.entity,o.entity.project)} overwrites property`;case me.MissingMethodImplementation:return`${se(o.entity,o.entity.project)} is missing action`;case me.MissingPropertyImplementation:return`${se(o.entity,o.entity.project)} is missing property`;case Ie.NameNotUniqueInScope:return`${se(o.entity,o.entity.project)} name is not unique`;case me.NoProperties:return`${se(o.entity,o.entity.project)} has no properties`;case me.NonStaticPropertyInStaticEntity:return`${se(o.entity,o.entity.project)} has non-static property`;case me.StaticEntityWithNonStaticProperties:return`${se(o.entity,o.entity.project)} has non-static properties`;case me.ReadingFromIncompatibleType:return`${se(o.entity,o.entity.project)} reads from different type`;case me.WritingToIncompatibleType:return`${se(o.entity,o.entity.project)} writes to different type`;case me.ScopeWithoutLogic:return`${se(o.entity,o.entity.project)} has no logic`;case me.NonStaticPropertyImplementsStatic:return`${se(o.entity,o.entity.project)} has invalid static property`;case me.PropertyImplementsIncompatibleType:return`${se(o.entity,o.entity.project)} has incompatible data type`;case me.PropertyImplementsNonAbstact:return`${se(o.entity,o.entity.project)} has non-template property`;case me.StaticPropertyImplementsNonStatic:return`${se(o.entity,o.entity.project)} has non-static property`;case me.VariableCallsOthersAndHasInternalCall:return`${se(o.entity,o.entity.project)} has bad internal call`;case me.VariableHasInputsAndInternalCall:return`${se(o.entity,o.entity.project)} has bad internal call`;case me.VariableHasOutputsAndInternalCall:return`${se(o.entity,o.entity.project)} has bad internal call`;case me.VariableIsCalledAndHasInternalCall:return`${se(o.entity,o.entity.project)} has bad internal call`;case Ie.InternalCallDeclarationIsInvalidType:return`${se(o.entity,o.entity.project)} has declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${se(o.entity,o.entity.project)} has declaration that is not found in parent`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${se(o.entity,o.entity.project)} has invalid parent declaration type`;case Ie.InternalCallParentMissingDataType:return`${se(o.entity,o.entity.project)}'s parent has no data type`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${se(o.entity,o.entity.project)} has declaration that is not in parent`;case Ie.UnreachableEntity:return`${se(o.entity,o.entity.project)} is unreachable`;case me.DisconnectedCallableEntity:return`${se(o.entity,o.entity.project)} is not executed by any entity`;case me.AbstractEntityImplements:return`${se(o.entity,o.entity.project)} implements a non-template entity`;case me.AbstractExtendingNonAbstractEntity:return`${se(o.entity,o.entity.project)} extends a non-template entity`;case me.InvalidPropertiesCombination:return`${se(o.entity,o.entity.project)} has invalid properties combination`;case me.ExtendingNonInteractiveEntity:return`${se(o.entity,o.entity.project)} extends a non-interactive entity`;case me.ExtendsIncompatibleEntities:return`${se(o.entity,o.entity.project)} extends incompatible entities`;case me.ImplementingNonAbstractEntity:return`${se(o.entity,o.entity.project)} implements a non-template entity`;case me.ImplementsIncompatibleEntities:return`${se(o.entity,o.entity.project)} implements incompatible entities`;case me.LackingReturnStatementOnSomeBranches:return`${se(o.entity,o.entity.project)} is missing termination on some branches`;case me.LastCalledEntityMustBeReturnEntity:return`${se(o.entity,o.entity.project)}'s last called entity must be a termination node`;case me.MissingRequiredValue:return`${se(o.entity,o.entity.project)} is missing a required value`;case me.NoPrimaryKeyProperty:return`${se(o.entity,o.entity.project)} has no primary key property`;case me.NonAbstractExtendingAbstractEntity:return`${se(o.entity,o.entity.project)} extends a template entity`;case me.NonStaticExtendingStaticEntity:return`${se(o.entity,o.entity.project)} extends a static entity`;case me.NonStaticImplementingStaticEntity:return`${se(o.entity,o.entity.project)} implements a static entity`;case me.StaticExtendingNonStaticEntity:return`${se(o.entity,o.entity.project)} extends a non-static entity`;case me.StaticImplementingNonStaticEntity:return`${se(o.entity,o.entity.project)} implements a non-static entity`;case me.VariableReadsValueAndInternalCall:return`${se(o.entity,o.entity.project)} reads a value and has internal call`;case me.VariableWritesValuesAndInternalCall:return`${se(o.entity,o.entity.project)} writes values and has internal call`;case Ie.EmptyName:return`${as[o.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${se(o.entity,o.entity.project)} has invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${se(o.entity,o.entity.project)}'s loop body action overwrites an action`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites base action`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${se(o.entity,o.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${se(o.entity,o.entity.project)} has a name not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${se(o.entity,o.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${se(o.entity,o.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${se(o.entity,o.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites base property`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${se(o.entity,o.entity.project)} has reader/writer with incompatible data type`;case xo.StatusCodeMustBeBetween100And599:return`${se(o.entity,o.entity.project)} HTTP status code must be between 100 and 599`;case xo.StatusCodeMustBeNumber:return`${se(o.entity,o.entity.project)} HTTP status code must be a number`;case Ba.UUIDMustBeString:return`${se(o.entity,o.entity.project)} UUID must be a string`;case Ba.UUIDMustNotContainSpaces:return`${se(o.entity,o.entity.project)} UUID must not contain spaces`;case Ba.UUIDMustBeValidFormat:return`${se(o.entity,o.entity.project)} UUID must be in a valid format`;case sa.MustBeUniqueAmongSameEntities:return`${se(o.entity,o.entity.project)} value must be unique among the same kind`;case sa.StringValueMustNotHaveDashes:return`${se(o.entity,o.entity.project)} value must not contain dashes`;case sa.StringValueMustNotHaveSpaces:return`${se(o.entity,o.entity.project)} value must not contain spaces`;default:return`${se(o.entity,o.entity.project)} Error: ${uv(o.code)}`}}function Mbi(o){var p,i,n,s;switch(o.code){case me.AbstractEntityWithNonAbstractMethods:return`${se(o.entity,o.entity.project)} has non-template actions`;case me.AbstractEntityWithNonAbstractProperties:return`${se(o.entity,o.entity.project)} has non-template properties`;case me.IncorrectEntityImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements the template entity`;case me.IncorrectMethodImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements the template action it's based on`;case me.IncorrectPropertyImplementation:return`${se(o.entity,o.entity.project)} incorrectly implements the template property it's based on`;case me.AbstractMethodInNonAbstractEntity:return`${se(o.entity,o.entity.project)} is a template action in a non-template entity`;case me.AbstractPropertyInNonAbstractEntity:return`${se(o.entity,o.entity.project)} is a template property in a non-template entity`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${se(o.entity,o.entity.project)} overwrites an action in the template entity`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${se(o.entity,o.entity.project)} overwrites a property in the template entity`;case me.MissingMethodImplementation:return`${se(o.entity,o.entity.project)} is missing an action implementation from the template entity`;case me.MissingPropertyImplementation:return`${se(o.entity,o.entity.project)} is missing a property implementation from the template entity`;case Ie.NameNotUniqueInScope:return`${se(o.entity,o.entity.project)} has a duplicate name in the same scope`;case me.NoProperties:return`${se(o.entity,o.entity.project)} has no properties, so it doesn't do anything`;case me.NonStaticPropertyInStaticEntity:return`${se(o.entity,o.entity.project)} has a non-static property in a static entity`;case me.StaticEntityWithNonStaticProperties:return`${se(o.entity,o.entity.project)} has non-static properties in a static entity`;case me.ReadingFromIncompatibleType:return`${se(o.entity,o.entity.project)} reads data from a value of a different data type`;case me.WritingToIncompatibleType:return`${se(o.entity,o.entity.project)} writes data to a value of a different data type`;case me.ScopeWithoutLogic:return`${se(o.entity,o.entity.project)} has no logic`;case me.NonStaticPropertyImplementsStatic:return`${se(o.entity,o.entity.project)} has a static property in a non-static entity`;case me.PropertyImplementsIncompatibleType:return`${se(o.entity,o.entity.project)} implements a property of a different data type`;case me.PropertyImplementsNonAbstact:return`${se(o.entity,o.entity.project)} implements a non-template property`;case me.StaticPropertyImplementsNonStatic:return`${se(o.entity,o.entity.project)} has a static property in a non-static entity`;case me.VariableCallsOthersAndHasInternalCall:return`${se(o.entity,o.entity.project)} calls other entities while being used to execute internal logic`;case me.VariableHasInputsAndInternalCall:return`${se(o.entity,o.entity.project)} has inputs while being used to execute internal logic`;case me.VariableHasOutputsAndInternalCall:return`${se(o.entity,o.entity.project)} has outputs while being used to execute internal logic`;case me.VariableIsCalledAndHasInternalCall:return`${se(o.entity,o.entity.project)} is called while being used to execute internal logic`;case Ie.InternalCallDeclarationIsInvalidType:return`${se(o.entity,o.entity.project)} has a declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${se(o.entity,o.entity.project)} has a declaration that is not found in ${(p=o.entity.parent.getDataType(null))!=null&&p.entity?se((i=o.entity.parent.getDataType(null))==null?void 0:i.entity,o.entity.project):"the variable's data-type entity"}`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${se(o.entity,o.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ie.InternalCallParentMissingDataType:return`${se(o.entity,o.entity.project)} is part of a variable with no data-type entity`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${se(o.entity,o.entity.project)} has a declaration doesn't belong to ${(n=o.entity.parent.getDataType(null))!=null&&n.entity?se((s=o.entity.parent.getDataType(null))==null?void 0:s.entity,o.entity.project):"the variable's data-type entity"}`;case Ie.UnreachableEntity:return`${se(o.entity,o.entity.project)} is unreachable`;case me.DisconnectedCallableEntity:return`${se(o.entity,o.entity.project)} is disconnected and won't be executed by anything after publishing`;case me.AbstractEntityImplements:return`${se(o.entity,o.entity.project)} implements a non-template entity`;case me.AbstractExtendingNonAbstractEntity:return`${se(o.entity,o.entity.project)} extends a non-template entity`;case me.InvalidPropertiesCombination:return`${se(o.entity,o.entity.project)} has an invalid combination of properties`;case me.ExtendingNonInteractiveEntity:return`${se(o.entity,o.entity.project)} extends a non-interactive entity`;case me.ExtendsIncompatibleEntities:return`${se(o.entity,o.entity.project)} extends incompatible entities`;case me.ImplementingNonAbstractEntity:return`${se(o.entity,o.entity.project)} implements a non-template entity`;case me.ImplementsIncompatibleEntities:return`${se(o.entity,o.entity.project)} implements incompatible entities`;case me.LackingReturnStatementOnSomeBranches:return`${se(o.entity,o.entity.project)} has branches that don't terminate`;case me.LastCalledEntityMustBeReturnEntity:return`${se(o.entity,o.entity.project)} must end with a termination node`;case me.MissingRequiredValue:return`${se(o.entity,o.entity.project)} is missing a required value`;case me.NoPrimaryKeyProperty:return`${se(o.entity,o.entity.project)} has no primary key property`;case me.NonAbstractExtendingAbstractEntity:return`${se(o.entity,o.entity.project)} is a non-template entity extending a template entity`;case me.NonStaticExtendingStaticEntity:return`${se(o.entity,o.entity.project)} is a non-static entity extending a static entity`;case me.NonStaticImplementingStaticEntity:return`${se(o.entity,o.entity.project)} is a non-static entity implementing a static entity`;case me.StaticExtendingNonStaticEntity:return`${se(o.entity,o.entity.project)} is a static entity extending a non-static entity`;case me.StaticImplementingNonStaticEntity:return`${se(o.entity,o.entity.project)} is a static entity implementing a non-static entity`;case me.VariableReadsValueAndInternalCall:return`${se(o.entity,o.entity.project)} reads a value and has an internal call`;case me.VariableWritesValuesAndInternalCall:return`${se(o.entity,o.entity.project)} writes values and has an internal call`;case Ie.EmptyName:return`${as[o.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${se(o.entity,o.entity.project)} has an invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${se(o.entity,o.entity.project)}'s loop body action overwrites`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites a base action with same implementation`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${se(o.entity,o.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${se(o.entity,o.entity.project)} has a name that is not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${se(o.entity,o.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${se(o.entity,o.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${se(o.entity,o.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites a base property with same implementation`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${se(o.entity,o.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${se(o.entity,o.entity.project)} has a reader/writer with incompatible data type`;case xo.StatusCodeMustBeBetween100And599:return`${se(o.entity,o.entity.project)} HTTP status code must be between 100 and 599`;case xo.StatusCodeMustBeNumber:return`${se(o.entity,o.entity.project)} HTTP status code must be a number, between 100 and 599`;case Ba.UUIDMustBeString:return`${se(o.entity,o.entity.project)} UUID must be a string, eg: "${Iu()}"`;case Ba.UUIDMustNotContainSpaces:return`${se(o.entity,o.entity.project)} UUID must not contain spaces, eg: "${Iu()}"`;case Ba.UUIDMustBeValidFormat:return`${se(o.entity,o.entity.project)} UUID must be in a valid format. Eg: "${Iu()}"`;case sa.MustBeUniqueAmongSameEntities:return`${se(o.entity,o.entity.project)} value must be unique among the same kind`;case sa.StringValueMustNotHaveDashes:return`${se(o.entity,o.entity.project)} value must not contain dashes`;case sa.StringValueMustNotHaveSpaces:return`${se(o.entity,o.entity.project)} value must not contain spaces`;default:return`${se(o.entity,o.entity.project)} Error: ${uv(o.code)}`}}var fN=(o=>(o.ValuesAlreadyConnected="values-already-connected",o.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",o.CannotReadValueFromChildren="cannot-read-value-from-children",o.CannotWriteValueToChildren="cannot-write-value-to-children",o.CannotBeCalledByChildren="cannot-be-called-by-children",o.ExecutionsAlreadyConnected="executions-already-connected",o.DataTypesNotCompatible="data-types-not-compatible",o.CannotCallAncestor="cannot-call-ancestor",o.CannotConnectToItself="cannot-connect-to-itself",o.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",o.NotInScope="not-in-scope",o.IsNotValueWrittingEntity="is-not-value-writting-entity",o.IsNotValueReadingEntity="is-not-value-reading-entity",o.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",o.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",o.CallerIsInHigherScope="caller-is-in-higher-scope",o.CallerIsInLowerScope="caller-is-in-lower-scope",o.CallIsInHigherScope="call-is-in-higher-scope",o.CallIsInLowerScope="call-is-in-lower-scope",o.OtherIncompatibleScopeReason="other-incompatible-scope-reason",o.SiblingInternalCallAlreadyUsedInParentVariable="sibling-internal-call-already-used-in-parent-variable",o.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees="error-output-map-cannot-be-connected-to-parent-success-branch-callees",o.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees="success-output-map-cannot-be-connected-to-parent-error-branch-callees",o))(fN||{});const Bbi=Object.values(fN);var yN=(o=>(o.NotPartOfOngoingTest="not-part-of-ongoing-test",o.CannotBeAddedToTest="cannot-be-added-to-test",o))(yN||{});const Gbi=Object.values(yN);var hN=(o=>(o.Suggestion="suggestion",o.CanvasGloballyDisabled="canvas-globally-disabled",o.CannotInteractWithInputInVariableWithInternalCalls="cannot-interact-with-input-in-variable-with-internal-calls",o.CannotInteractWithOutputInVariableWithInternalCalls="cannot-interact-with-output-in-variable-with-internal-calls",o.PropertyIsConstantItsValueCantBeReset="property-is-constant-its-value-cant-be-reset",o.CannotWriteValueOfGlobalVariableDeclaration="cannot-write-value-of-global-variable-declaration",o.CannotReSetValueOfConstantVariable="cannot-reset-value-of-constant-variable",o))(hN||{});const kbi=Object.values(hN);function jbi(o,p){const i=[...o,...p];return Array.from(new Set(i))}function Ubi(o,p){const i=[...o,...p],n=Array.from(new Set(i));return{hasChanged:n.length!==o.length,reasons:n}}function Kbi(o,p){const i=o.filter(s=>!p.includes(s));return{hasChanged:i.length!==o.length,reasons:i}}function Fbi(o,p){return o.find(i=>i.entity.id===p)||null}function L4(o){return o.filter((p,i)=>o.indexOf(p)===i)}class gn{constructor(p,i,n=null,s){I(this,"ids",[]);I(this,"entity");I(this,"entityCardHeight");I(this,"entityCardWidth");I(this,"index");I(this,"childEntities",[]);I(this,"children",[]);I(this,"parents",[]);I(this,"calculationEntryPoint");I(this,"_onlyEntities",null);I(this,"_changeSet",null);if(this.index=i,this.entity=p,this.calculationEntryPoint=n||this,this===this.calculationEntryPoint&&!s)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(p,i,n){const s=ILe-eC-bLe,c=RLe-Zb-pN;p.metaSync({x:p.x||s,y:p.y||c},i);const e=new gn(p,0,null,i);e._onlyEntities=n||[],e.ids=["0"];const y=[];e.next(v=>{y.push(...v)}),gn.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const m=e.flattenChildEntities();return e._onlyEntities?m.filter(v=>(e._onlyEntities||[]).includes(v)):m}static recursivelyAssembleChildrenAreas(p){const i=[];p.forEach(n=>{n.next(s=>{i.push(...s)})}),i.length>0&&gn.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(p){this.calculationEntryPoint._changeSet=p}findAreaInChildrenFromEntity(p){if(this.entity===p)return this;const i=this.children.find(s=>s.entity===p);return i||this.children.reduce((s,c)=>s||c.findAreaInChildrenFromEntity(p),null)}findAreaFromEntity(p){if(this.entity===p)return this;const i=this.calculationEntryPoint.children,n=i.find(c=>c.entity===p);return n||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(p),null)}addParent(p){if(!this.parents.includes(p)){const i=gn.resolveIds(p,this.index);this.ids.push(...i),this.parents.push(p)}}static resolveIds(p,i){return p?p.ids.map(n=>`${n}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const p=Al(this.entity,!0);if(this.entity.type===d.Project){const i=[],n=[],s=[];p.forEach(e=>{if(d.DefinitionEntity===e.type){n.push(e);return}else if(Yt.includes(e.type)){s.push(e);return}i.push(e)});const c=i.sort((e,y)=>{const m=!!RA(e,y).length,v=Al(e),E=Al(y);return m?0:v.length&&!E.length?-1:!v.length&&E.length?1:0}).filter(e=>!Up(e).length);this.childEntities=[...n,...s,...c]}else{const i=[],n=[],s=[],c=[],e=[];Zr.includes(this.entity.type)&&OR(this.entity).forEach(v=>{if(Gt.includes(v.type)){s.push(v);return}const E=si(v);i.push(E)}),nr.includes(this.entity.type)&&n.push(...this.entity.detachedChildren);const y=p.filter(m=>{const v=i.includes(m);return v||s.includes(m)||n.includes(m)?!1:Gt.includes(m.type)?(s.push(m),!1):qr.includes(m.type)&&!v?(c.push(m),!1):m.type===d.DefinitionEntity?(e.push(m),!1):!0});i.sort((m,v)=>Cc(m,v)?-1:0),c.sort((m,v)=>Cc(m,v)?-1:0),s.sort((m,v)=>hC(m,v)?1:hC(v,m)?-1:0),this.childEntities=[...e,...i,...c,...y,...s,...n]}}calculateCardSize(){const p=wLe(this.entity);this.entityCardWidth=p.width,this.entityCardHeight=p.height}static getBoundriesOfTwoAreas(p,i){return{top:Math.min(p.top,i.top),left:Math.min(p.left,i.left),bottom:Math.max(p.bottom,i.bottom),right:Math.max(p.right,i.right)}}static getBoundriedOfCombinedAreas(p,i){const n=p.filter(c=>!i.includes(c));return n.reduce((c,e)=>i.includes(e)?c:gn.getBoundriesOfTwoAreas(c,e.fullBranchArea),n[0].fullBranchArea)}getFullAreaUntilAny(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!p.includes(e)).map(e=>e.getFullAreaUntilAny(p)).reduce((e,y)=>gn.getBoundriesOfTwoAreas(e,y),i)}getFullAreaUntilAreaOrAnyChildren(p){const i=[p,...p.flattenChildren()],n=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(p)).reduce((e,y)=>gn.getBoundriesOfTwoAreas(e,y),n)}getFullAreaUntil(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==p).map(c=>c.getFullAreaUntil(p)).reduce((c,e)=>gn.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(s=>s.fullBranchArea).reduce((s,c)=>gn.getBoundriesOfTwoAreas(s,c),p)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const p=this.ownEntityArea;return{top:p.top,left:p.left,bottom:p.bottom+Zb,right:p.right+eC}}static filterOutRepeatedAreas(p){return p.filter((i,n)=>p.indexOf(i)===n)}getEarliestId(p,i){const n=p.split("-"),s=i.split("-");return n.length<s.length?p:n.length>s.length?i:n.reduce((e,y,m)=>y<s[m]?p:i,p)}getEarliestLevel(){return this.ids.reduce((n,s)=>this.getEarliestId(n,s),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const n=this.parents.reduce((s,c)=>c.getEarliestLevel()>s.getEarliestLevel()?c:s,this.parents[0]).countColumns();return p+=n,p}getLatestId(p,i){if(p===i)return p;const n=p.split("-"),s=i.split("-");return n.length<s.length?i:n.length>s.length?p:n.reduce((e,y,m)=>y>s[m]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((n,s)=>this.getLatestId(n,s),this.ids[0]).split("-").length}smoothPosition(){const p=this.flattenSiblings();if(!p.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(n=>{n!==this.calculationEntryPoint&&n.shiftDownAlone(i)})}else if([...Yt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(n=>!this.parents.includes(n));i.length?i.every(s=>{const c=this.countColumns(),e=s.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(p,i){if(p.includes(this))return p;this.move(this.entity,{y:this.entity.y+i});let n=[...p,this];return this.children.forEach(s=>{if(gn.getEarliestParentInChain(s)!==this)return;const e=Fbi(n,s.entity.id);n=gn.filterOutRepeatedAreas([...n]),e||(n=n.filter(m=>m!==s));const y=s.shiftDownUntilAny(n,i);n.push(...y)}),n}shiftRightUntilAny(p,i){p.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(n=>{const s=gn.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);gn.getEarliestParentInChain(n)===this&&n.shiftRightUntilAny(s,i)}))}shiftRight(p){this.move(this.entity,{x:this.entity.x+p}),this.children.forEach(i=>{const s=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(s,p)})}shiftDownAlone(p){this.move(this.entity,{y:this.entity.y+p})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const p=this.parents.reduce((s,c)=>{const e=c.ownEntityArea,y=e.top+dy,m={top:y,left:e.left,bottom:y,right:e.right};return gn.getBoundriesOfTwoAreas(s,m)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-dy;this.shiftDownAlone(n)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((s,c)=>{const e=c.ownEntityArea,y=e.top+dy,m={top:y,left:e.left,bottom:y,right:e.right};return gn.getBoundriesOfTwoAreas(s,m)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-dy;return this.shiftDownAlone(n),n}resolveChildrenOverlaps(){const p=this.flattenChildren();let i=[];p.forEach(n=>{const s=n.adjustVerticallyToAvoidOverlaps();i.push(...s)}),p.forEach(n=>{n.smoothPosition()})}static getEarliestParentInChain(p){let i=p.parents[0];return p.parents.length&&(i=p.parents.sort((n,s)=>{if(!n.ids.length)return-1;if(!s.ids.length)return 1;const c=n.ids.sort((y,m)=>y.length<m.length?-1:0),e=s.ids.sort((y,m)=>y.length<m.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,s)=>{if(p.has(s.entity.id))return n;p.add(s.entity.id);const e=s.children.slice(0,s.children.indexOf(this)).reduce((y,m)=>[...y,m,...m.flattenChildren(p)],[]);return[...n,...e]},[])}flattenSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,s)=>{if(p.has(s.entity.id))return n;p.add(s.entity.id);const e=s.children.filter(y=>y!==this).reduce((y,m)=>[...y,m,...m.flattenChildren(p)],[]);return[...n,...e]},[])}flattenChildren(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n,...n.flattenChildren(p)]),[])}flattenParents(p=new Set){return this.parents.reduce((n,s)=>p.has(s.entity.id)?n:(p.add(s.entity.id),[...n,s,...s.flattenParents(p)]),[])}getAreaIfRendered(p){return this.calculationEntryPoint.flattenChildren().find(s=>s.entity.id===p.id)||null}getLowerSiblings(){const p=this.parents.reduce((i,n)=>{const s=n.children.indexOf(this),c=n.children.slice(s+1);return[...i,...c]},[]);return L4(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((n,s)=>[...n,...s.getLowerAreas()],[]);return L4([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const n=gn.getEarliestParentInChain(this).children[this.index-1];if(!n)return p;const s=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...s,...c,n],v=D(e.flatMap(P=>RA(this.entity,P.entity))).filter(P=>P.id!==this.entity.id).map(P=>this.findAreaFromEntity(P)).filter(P=>!!P),E=this.getFullAreaUntilAny(v),b=n.getFullAreaUntilAny(v),w=e.reduce((P,$)=>$===this||$.fullBranchArea.left!==E.left?P:Math.max(P,$.fullBranchArea.bottom),b.bottom);if(E.top<w){const P=w-E.top+Zb;return this.shiftDownUntilAny(p,P)}return p}move(p,i){(this.onlyEntities||[]).includes(p)&&p.metaSync(i,this.changeSet)}addChild(p){const i=this.childEntities[p];let n=null;i.x&&i.y?n=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),n||(n=new gn(i,p,this.calculationEntryPoint));const s=this.ownEntityPlusBufferArea;this.children.includes(n)||(this.children.push(n),n.addParent(this));const c=n.fullBranchArea;if(c.left<s.right){const e=s.right-c.left;n.shiftRight(e)}return n}flattenChildEntities(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n.entity,...n.flattenChildEntities(p)]),[])}next(p){const i=[];this.childEntities.forEach((n,s)=>{const c=this.addChild(s);c&&i.push(c)}),p(i)}}var Vm=(o=>(o.Amazon="amazon",o.Google="google",o.Microsoft="microsoft",o))(Vm||{}),yr=(o=>(o.RelationalDatabase="relational-database",o.CompiledLocalCodebase="compiled-local-codebase",o.CloudHostedCodebase="cloud-hosted-codebase",o.HttpApi="http-api",o.HttpEndpoint="http-endpoint",o.ServerlessFunction="serverless-function",o))(yr||{}),tC=(o=>(o.Post="post",o.Get="get",o.Acknowledgement="acknowledgment",o.Progress="progress",o.Error="error",o.Complete="complete",o))(tC||{}),hc=(o=>(o.Queued="queued",o.Running="running",o.Success="success",o.Failed="failed",o.CleanedUp="cleaned-up",o.Skipped="skipped",o.AbortedByUser="aborted-by-user",o.UnrecoverableFailure="unrecoverable-failure",o.Reverted="reverted",o.UnpublishingStarted="unpublishing-started",o.Unpublished="unpublished",o))(hc||{}),iC=(o=>(o.Queued="queued",o.Running="running",o.Success="success",o.Failed="failed",o.CleanedUp="cleaned-up",o.UnrecoverableFailure="unrecoverable-failure",o.Reverted="reverted",o.UnpublishingStarted="unpublishing-started",o.Unpublished="unpublished",o))(iC||{}),$t=(o=>(o.ProjectNotFound="project-not-found",o.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",o.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",o.DeploymentCompleted="deployment-completed",o.DeploymentStarted="deployment-started",o.DeploymentFailed="deployment-failed",o.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",o.RequestPayloadValidationFailed="request-payload-validation-failed",o.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",o.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",o.ProjectAlreadyBeingPublished="project-already-being-published",o.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",o.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",o.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",o.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",o.CreatingNewRelationalDatabase="creating-new-relational-database",o.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",o.RelationalDatabaseAlreadyExists="relational-database-already-exists",o.RelationalDatabaseDeletionStarted="relational-database-deletion-started",o.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",o.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",o.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",o.HttpApiDeploymentStarted="http-api-deployment-started",o.HttpApiDeploymentCompleted="http-api-deployment-completed",o.HttpApiDeploymentFailed="http-api-deployment-failed",o.CreatingNewHttpApi="creating-new-http-api",o.HttpApiAlreadyExists="http-api-already-exists",o.HttpApiDeletionStarted="http-api-deletion-started",o.HttpApiDeletionCompleted="http-api-deletion-completed",o.HttpApiDeletionFailed="http-api-deletion-failed",o.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",o.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",o.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",o.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",o.BundlingCodebaseForDownload="bundling-codebase-for-download",o.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",o.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",o.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",o.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",o.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",o.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",o.CodeCompilationStarted="code-compilation-started",o.CodeCompilationCompleted="code-compilation-completed",o.CodeCompilationFailed="code-compilation-failed",o.BundleCodebaseStarted="bundle-codebase-started",o.BundleCodebaseCompleted="bundle-codebase-completed",o.BundleCodebaseFailed="bundle-codebase-failed",o.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",o.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",o.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",o.MigrateRelationalDatabaseStarted="migrate-relational-database-started",o.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",o.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",o.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",o.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",o.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",o.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",o))($t||{}),ml=(o=>(o.CodeCompilation="code-compilation",o.RelationalDatabaseDeployment="relational-database-deployment",o.RelationalDatabaseDeletion="relational-database-deletion",o.HttpApiDeployment="http-api-deployment",o.HttpApiDeletion="http-api-deletion",o.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",o.BundleCodebase="bundle-codebase",o.MigrateRelationalDatabase="migrate-relational-database",o.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",o.ExecutePublicationCompletedEvent="execute-publication-completed-event",o.CodebaseCleanup="codebase-cleanup",o))(ml||{});yr.CloudHostedCodebase,yr.HttpApi,yr.RelationalDatabase,yr.CloudHostedCodebase,yr.CloudHostedCodebase,yr.RelationalDatabase,yr.CloudHostedCodebase,yr.CloudHostedCodebase;function OLe(o){return`project-${o}-http-api`}function XI(o){return`entity-${o}-database`}class CLe{constructor(p,i,n,s,c,e,y,m,v){I(this,"stepType");I(this,"id");I(this,"resourceType");I(this,"index");I(this,"dependency",[]);I(this,"lastEvent",null);I(this,"lastEventTimestamp",null);I(this,"status",hc.Queued);I(this,"publicationRun");I(this,"resource");this.stepType=p,this.id=i,this.resourceType=n,this.status=s,this.dependency=c,this.index=e,this.lastEventTimestamp=y,this.publicationRun=m,this.resource=v}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(p){var i,n;this.status=p.status,this.dependency=p.dependency,this.index=p.index,this.stepType=p.stepType,this.resourceType=p.resourceType,this.lastEvent=p.lastEvent,this.id=p.id,(n=this.resource)==null||n.setDetails((i=p.resource)==null?void 0:i.details)}}var _Le=(o=>(o.Ready="ready",o.Provisioning="provisioning",o.Queued="queued",o.ProvisioningFailed="provisioning-failed",o.Deleting="deleting",o.DeletingFailed="deleting-failed",o.Deleted="deleted",o))(_Le||{});class ef{constructor(p,i,n){I(this,"provisionedBy");I(this,"publicationRun");I(this,"resourceType");I(this,"provider");I(this,"resourceId");I(this,"details",null);I(this,"name",null);I(this,"status","queued");this.publicationRun=p,this.resourceType=i,this.provider=n}setDetails(p){this.details=p}setStatus(p){this.status=p}setProvisionedBy(p){this.provisionedBy=p}}class Sbi extends ef{constructor(i,n,s){super(i,yr.HttpEndpoint,s);I(this,"resourceType",yr.HttpEndpoint);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=XI((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class qbi extends ef{constructor(i,n,s){super(i,yr.ServerlessFunction,s);I(this,"resourceType",yr.ServerlessFunction);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=XI((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class PLe extends ef{constructor(i,n,s){super(i,yr.HttpApi,s);I(this,"resourceType",yr.HttpApi);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=OLe(this.publicationRun.project.id),this.resourceId}}class VLe extends ef{constructor(i,n,s){super(i,yr.RelationalDatabase,s);I(this,"resourceType",yr.RelationalDatabase);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=XI((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class NLe extends ef{constructor(i,n){super(i,yr.CloudHostedCodebase,n);I(this,"resourceType",yr.CloudHostedCodebase);I(this,"details",null);I(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class xLe extends ef{constructor(i,n){super(i,yr.CompiledLocalCodebase,n);I(this,"resourceType",yr.CompiledLocalCodebase);I(this,"details",null);I(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class Zbi{constructor(p,i){I(this,"id");I(this,"projectAutoIncrementPublicationCount");I(this,"projectPublishedSemanticVersion");I(this,"projectVersion");I(this,"projectId");I(this,"triggeredBy");I(this,"createdAt");I(this,"updatedAt");I(this,"status");I(this,"steps",[]);I(this,"editor");I(this,"explicitResources",new Map);I(this,"implicitGlobalResources",new Map);I(this,"finalGlobalEvent",null);I(this,"finalStatus",null);I(this,"contextType",Y.PublicationRun);I(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.projectVersion=p.projectVersion,this.projectId=p.projectId,this.triggeredBy=p.triggeredBy,this.createdAt=p.createdAt,this.updatedAt=p.updatedAt,this.status=p.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(p){return this.steps.filter(i=>p.includes(i.resourceType))}getStepsTypes(p){return this.steps.filter(i=>p.includes(i.stepType))}toIds(p){return p.map(i=>i.id)}getResourceForEntity(p){const i=Array.from(this.explicitResources.values()).find(n=>n.owners.has(p.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(yr.CompiledLocalCodebase,new xLe(this,Vm.Amazon)),this.implicitGlobalResources.set(yr.CloudHostedCodebase,new NLe(this,Vm.Amazon));const p=this.project.entities.filter(n=>Zi(n,Re.HTTP_ENDPOINT)),i=this.project.entities.filter(n=>Zi(n,Re.RELATIONAL_DATABASE));if(i.length&&i.forEach(n=>{const s=new VLe(this,[n],Vm.Amazon);this.explicitResources.set(s.resourceId,s)}),p.length){const n=new PLe(this,p,Vm.Amazon);this.explicitResources.set(n.resourceId,n)}}setSteps(p,i){p.forEach(n=>{this.addStep(n,i)}),this.editor.events.emit($t.ProjectPublishRequestAcknowledged,{})}addStep(p,i){const n=p.dependency||[];if(n.length){const c=n.filter(e=>!this.steps.find(y=>y.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===p.id)){const c=new CLe(p.stepType,p.id,p.resourceType,p.status,n,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(J.Logger.log("onUpdate",p),(i=p.payload)!=null&&i.stepType){const n=this.steps.find(s=>{var c;return s.id===((c=p.payload)==null?void 0:c.id)});n&&M(p.emittedAt).isAfter(M(n.lastEventTimestamp))&&n.update(p.payload)}this.editor.events.emit("publication-updated",{}),p.type===tC.Error?(this.finalStatus=iC.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===tC.Complete&&(this.finalStatus=iC.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 aN(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(Y.PublicationRun),this.extensionsRegistry}}function Hbi(o){switch(o){case ml.CodeCompilation:return"Code generation";case ml.RelationalDatabaseDeployment:return"Database creation";case ml.HttpApiDeployment:return"HTTP gateway creation";case ml.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case ml.BundleCodebase:return"Bundle code";case ml.MigrateRelationalDatabase:return"Database structure migration";case ml.BusinessLogicCodebaseDeployment:return"Update servers with new code";case ml.CodebaseCleanup:return"Code cleanup";case ml.HttpApiDeletion:return"HTTP gateway deletion";case ml.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function Wbi(o){switch(o){case $t.DeploymentCompleted:return"Successfully published";case $t.DeploymentStarted:return"Publication started";case $t.DeploymentFailed:return"Publication failed";case $t.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case $t.RequestPayloadValidationFailed:return"Request payload validation failed";case $t.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case $t.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case $t.RelationalDatabaseDeploymentStarted:return"Database creation started";case $t.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case $t.RelationalDatabaseDeploymentFailed:return"Database creation failed";case $t.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case $t.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case $t.RelationalDatabaseAlreadyExists:return"Database already exists";case $t.HttpApiDeploymentStarted:return"HTTP gateway creation started";case $t.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case $t.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case $t.CreatingNewHttpApi:return"Creating new HTTP gateway";case $t.HttpApiAlreadyExists:return"HTTP gateway already exists";case $t.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case $t.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case $t.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case $t.BundlingCodebaseForDownload:return"Bundling code for download";case $t.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case $t.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case $t.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case $t.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case $t.CodeCompilationStarted:return"Code generation started";case $t.CodeCompilationCompleted:return"Code generation completed";case $t.CodeCompilationFailed:return"Code generation failed";case $t.BundleCodebaseStarted:return"Code bundling started";case $t.BundleCodebaseCompleted:return"Code bundling completed";case $t.BundleCodebaseFailed:return"Code bundling failed";case $t.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case $t.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case $t.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case $t.MigrateRelationalDatabaseStarted:return"Database structure migration started";case $t.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case $t.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case $t.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case $t.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case $t.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case $t.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case $t.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case $t.ProjectNotFound:return"Project not found";case $t.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case $t.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case $t.HttpApiDeletionStarted:return"HTTP gateway deletion started";case $t.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case $t.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case $t.RelationalDatabaseDeletionStarted:return"Database deletion started";case $t.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case $t.RelationalDatabaseDeletionFailed:return"Database deletion failed";case $t.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var $Le=(o=>(o.NO_LOGIC="NO_LOGIC",o.NO_NAME="NO_NAME",o.NO_CHANGES="NO_CHANGES",o.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",o))($Le||{});function zbi(o){switch(o){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function Jbi(o){switch(o){case yr.RelationalDatabase:return"Relational database";case yr.HttpEndpoint:case yr.HttpApi:return"HTTP endpoints";case yr.ServerlessFunction:case yr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function Ybi(o){switch(o){case hc.Running:return"In progress";case hc.Failed:return"Failed";case hc.Success:return"Succeeded";case hc.Skipped:return"Skipped";case hc.Queued:default:return"Queued"}}function LLe(o){var n;if(!Zi(o,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=Q["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(o.type===d.BuiltInBaseEntity?Zi(o,Re.EXTERNAL_INTEGRATION_CONNECTION)&&(p=rC(o.name)):o.type===d.DefinitionEntity&&o.implements.forEach(s=>{if(Zi(s,Re.EXTERNAL_INTEGRATION_CONNECTION)){const c=rC(s==null?void 0:s.name);if(c)return p=c,!0}}),!p){const s=o.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var y;return((y=e.extends)==null?void 0:y.id)===i}));p=(n=s==null?void 0:s.getDefaultValue())==null?void 0:n.value}return p}function Xbi(o){return che[o]}function rC(o){return o.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?o.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function MLe(o){if(o.type!==d.ActionDescriptor&&o.type!==d.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(o.type===d.ActionDescriptor){const p=o;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(o.type===d.Operation){const p=o.declaration;if(Object.values(ei).includes(p.id))return p.id.split("--")[1]||null}return null}function Qbi(o){if(!o)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(Re).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===o.toLowerCase()))||null}function eAi(o){return o.type===d.BuiltInBaseEntity||o.type===d.DefinitionEntity?LLe(o):o.type===d.ActionDescriptor||o.type===d.Operation?MLe(o):null}function BLe(o){var s,c,e;if(!Zi(o,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=Z4e(o,Re.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const n=Q["built-in-base-entity"][i.id].properties.connectionId.id;if(o.type===d.BuiltInBaseEntity){if(Zi(o,Re.EXTERNAL_INTEGRATION_CONNECTION)){const y=o.properties.find(m=>{var v;return((v=m.extends)==null?void 0:v.id)===n});y&&(p=(s=y.getDefaultValue())==null?void 0:s.value)}}else if(o.type===d.DefinitionEntity){const y=o.properties.find(m=>!!m.implements.find(v=>v.id===n)||!!m.implements.find(v=>{var E;return((E=v.extends)==null?void 0:E.id)===n}));if(!y&&((c=o.extends)==null?void 0:c.type)===d.DefinitionEntity)return BLe(o.extends);p=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return p}async function GLe(o,p={}){var y;const i=J.YieldTracker.from(p),s=[...ta(o),...Rs(o),...mN(o),...ia(o),...TN(o)],c=Ov(o);s.push(...c);const e=Mt(o.errors,s);await i.tick();for(const m of o.inputs)await m.validateAsync({tracker:i});for(const m of o.outputs)await m.validateAsync({tracker:i});for(const m of o.internalCalls)await m.validateAsync({tracker:i});return await((y=o.dataType)==null?void 0:y.validateAsync({tracker:i})),e}function kLe(o){var s;(s=o.dataType)==null||s.validate(),o.inputs.forEach(c=>c.validate()),o.outputs.forEach(c=>c.validate()),o.internalCalls.forEach(c=>c.validate());const i=[...ta(o),...Rs(o),...mN(o),...ia(o),...TN(o)],n=Ov(o);return i.push(...n),Mt(o.errors,i)}function mN(o,p){const n=[...o.project.getVariableDeclarations()].filter(s=>s.id!==o.id);return _v(o,[qi],n,p)}function TN(o){const p=[];if(o.parent!==o.project)return p;if(o.catchesError){const i=Lt({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotCatchError}`,message:`${as[o.type].singular} "${se(o,o.project)}" with id "${o.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:fe.Error,code:Ie.GlobalVariableDeclarationCannotCatchError,entity:o});p.push(i.error)}if(o.errorCalls.length){const i=Lt({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotCallOnError}`,message:`${as[o.type].singular} "${se(o,o.project)}" with id "${o.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:fe.Error,code:Ie.GlobalVariableDeclarationCannotCallOnError,entity:o});p.push(i.error)}if(o.calledBy.length){const i=Lt({id:`${o.id}--${Ie.GlobalVariableDeclarationCannotBeCalled}`,message:`${as[o.type].singular} "${se(o,o.project)}" with id "${o.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:fe.Error,code:Ie.GlobalVariableDeclarationCannotBeCalled,entity:o});p.push(i.error)}return[]}const tAi=Object.freeze(Object.defineProperty({__proto__:null,validate:kLe,validateAsync:GLe,validateGlobalVariableDeclaration:TN,validateVariableDeclarationName:mN},Symbol.toStringTag,{value:"Module"}));async function jLe(o,p={}){const i=J.YieldTracker.from(p),s=[...ta(o),...Rs(o),...ia(o)],c=Ov(o);s.push(...c);const e=Mt(o.errors,s);await i.tick();for(const y of o.inputs)await y.validateAsync({tracker:i});for(const y of o.outputs)await y.validateAsync({tracker:i});for(const y of o.internalCalls)await y.validateAsync({tracker:i});return e}function ULe(o){o.inputs.forEach(s=>s.validate()),o.outputs.forEach(s=>s.validate()),o.internalCalls.forEach(s=>s.validate());const i=[...ta(o),...Rs(o),...ia(o)],n=Ov(o);return i.push(...n),Mt(o.errors,i)}const iAi=Object.freeze(Object.defineProperty({__proto__:null,validate:ULe,validateAsync:jLe},Symbol.toStringTag,{value:"Module"}));var vN=(o=>(o.Parent="parent",o.DataTypeEntity="data-type-entity",o.VarDeclaration="var-declaration",o))(vN||{});const yi=class yi extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"x");I(this,"y");I(this,"type",d.VariableInstance);I(this,"catchesError",!1);I(this,"defaultValue",null);I(this,"writesValues",[]);I(this,"readsValue",null);I(this,"declaration");I(this,"inputs",[]);I(this,"outputs",[]);I(this,"error",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"successCalls",[]);I(this,"errorCalls",[]);I(this,"internalCalls",[]);I(this,"project");I(this,"errors",[]);I(this,"parent");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableInstance,catchesError:!1,declaration:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,n){let s=n;if(i.parent){const P=re(i.parent);s=n.get(P)}const c=re(i.declaration),e=n.get(c),y=i.calledByEntry.map(P=>{const $=re(P);return n.get($)}),m=i.calledBySuccess.map(P=>{const $=re(P);return n.get($)}),v=i.calledByError.map(P=>{const $=re(P);return n.get($)});let E=null;if(i.readsValue){const P=re(i.readsValue);E=n.get(P)}const b={id:i.id,version:x.UUID.uuid(),createdAt:M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableInstance,catchesError:i.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:m,calledByError:v,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:E,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:s},w=he(b,n);return w.setParent(s,null),w}static validateGenerationTarget(i,n){let s=JSON.parse(JSON.stringify(i));const c=[],e=bn(s,{parent:{list:!1,types:[...nr,d.Project],optional:!0},declaration:{list:!1,types:[d.VariableDeclaration]}},n);return s=e.modifiedData,c.push(...e.errors,...$r(s)),{errors:c,modifiedData:s}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const n=[];let s=JSON.parse(JSON.stringify(i));const c=nf(s,this);return s=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${ae.InvalidParentUpdate}`,code:ae.InvalidParentUpdate,severity:fe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
|
93
93
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
94
94
|
Specifically for variables, their scope is also calculated from their value readers and value writters.
|
|
95
95
|
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its value readers, value writters, or callers.`})),{errors:n,modifiedData:s}}subscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"sync-dependents"))){const n=[],s=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const m=y.entity.afterAllChildrenInitialized(i);n.push(...m.updated),s.push(...m.added),c.push(...m.removed),e.push(...m.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}onDetachedDependencyRemoved(i,n,s){const c=[],e=[],y=[],m=[];if(n==="parent"){const{updated:v,added:E,removed:b}=this.remove({ignoreUpstream:!1},s);c.push(...v),e.push(...E),y.push(...b)}if(n==="var-declaration"){const{updated:v,added:E,removed:b}=this.remove({ignoreUpstream:!1},s);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(m),self:this}}onDetachedDependencyRestored(i,n,s){const c=[],e=[],y=[],m=[];if(n==="parent"){const{updated:v,added:E,removed:b}=this.restore({},s);c.push(...v),e.push(...E),y.push(...b)}if(n==="var-declaration"){const{updated:v,added:E,removed:b}=this.restore({},s);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(m),self:this}}unsubscribeFromDependencies(){var i,n,s,c,e,y,m;return(n=(i=this.parent)==null?void 0:i.unsubscribeDependents)==null||n.call(i,[{entity:this,field:"parent"}]),(e=(c=(s=this.declaration.dataType)==null?void 0:s.entity)==null?void 0:c.unsubscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),(m=(y=this.declaration)==null?void 0:y.unsubscribeDependents)==null||m.call(y,[{entity:this,field:"var-declaration"}]),this}subscribeToDependencies(){var i,n,s,c;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),(c=(s=(n=this.declaration.dataType)==null?void 0:n.entity)==null?void 0:s.subscribeDependents)==null||c.call(s,[{entity:this,field:"data-type-entity"}]),this.declaration.subscribeDependents([{entity:this,field:"var-declaration"}]),this}increaseVersion(i){if(i&&!M(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&M(i).isSame(M(this.createdAt))?this:(this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=M(i).toISOString()||M().toISOString(),this)}captureVersion(){var n;const i=((n=this.knownVersions)==null?void 0:n.get(this.version))||new yi(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.outputs=[...this.outputs],i.internalCalls=[...this.internalCalls],i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.writesValues=[...this.writesValues],i.readsValue=this.readsValue,i.defaultValue=this.defaultValue,i.declaration=this.declaration,i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.error=this.error,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const n=[],s=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);n.push(this.parent,...y.updated),s.push(...y.added),c.push(...y.removed)}return{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}async restoreVersion(i){var m;const n=[],s=[],c=[],e=[];if(this.version===i)return{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this};if(!this.knownVersions){const v=new Map;for(const[E,b]of this.knownVersions||new Map){if(v.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[w,P]of b.knownVersions)v.set(w,P);b.knownVersions=null}}let y=(m=this.knownVersions)==null?void 0:m.get(i);if(!y){const v=await this.APILoadVersion({},i);if(!v)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new yi(v,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.outputs=y.outputs,this.internalCalls=y.internalCalls,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.writesValues=y.writesValues,this.readsValue=y.readsValue,this.defaultValue=y.defaultValue,this.declaration=y.declaration,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.calledByEntry=y.calledByEntry,this.error=y.error,this.parent=y.parent,{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}updateWithShallowTransfer(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,n))return J.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,n),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const s=re(i.parent),c=this.project.get(s),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(n),c)this.setParent(c,n),this.addSelfToProject(n);else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${s}' that isn't found in the project`)}else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.readsValue){const s=re(i.readsValue),c=this.project.get(s),e=this.readsValue;e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(n),c&&this.setValueWriter(c,n)}else this.removeValueWriter(n);if(i.declaration){const s=re(i.declaration),c=this.project.get(s);c&&this.setDeclaration(c)}if(i.calledByEntry.forEach(s=>{const c=re(s),e=this.project.get(c);e&&(this.addEntryCaller(e,n),e.addCall(this,n))}),[...this.calledByEntry].forEach(s=>{i.calledByEntry.find(e=>re(e)===s.id)||(this.removeCaller(s,n),s.removeCall(this,n))}),i.calledBySuccess.forEach(s=>{const c=re(s),e=this.project.get(c);e&&(this.addSuccessCaller(e,n),e.addSuccessCall(this,n))}),[...this.calledBySuccess].forEach(s=>{i.calledBySuccess.find(e=>re(e)===s.id)||(this.removeCaller(s,n),s.removeCall(this,n))}),i.calledByError.forEach(s=>{const c=re(s),e=this.project.get(c);e&&(this.addErrorCaller(e,n),e.addErrorCall(this,n))}),[...this.calledByError].forEach(s=>{i.calledByError.find(e=>re(e)===s.id)||(this.removeCaller(s,n),s.removeCall(this,n))}),i.outputs.forEach(s=>{const c=re(s),e=this.project.get(c);e&&(this.addOutput(e,n),e.setParent(this,n))}),[...this.outputs].forEach(s=>{i.outputs.find(e=>re(e)===s.id)||(this.removeOutput(s,n),s.removeFromParent(n))}),i.inputs.forEach(s=>{const c=re(s),e=this.project.get(c);e&&(this.addInput(e,n),e.setParent(this,n))}),[...this.inputs].forEach(s=>{i.inputs.find(e=>re(e)===s.id)||(this.removeInput(s,n),s.removeFromParent(n))}),i.defaultValue){const s=re(i.defaultValue),c=this.project.get(s);c&&this.setDefaultValue(c,n)}else this.setDefaultValue(null,n);return i.writesValues.forEach(s=>{const c=re(s),e=this.project.get(c);e&&(this.addValueReader(e,n),e.setValueWriter(this,n))}),[...this.writesValues].forEach(s=>{i.writesValues.find(e=>re(e)===s.id)||(this.removeValueReader(s,n),s.setValueWriter(null,n))}),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this}hydrateAncestors(){const i=[],n=[],s=[],c=[];if(this.initialData.parent){const e=re(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.readsValue){const e=re(this.initialData.readsValue),y=this.project.get(e);y&&(this.setValueWriter(y,null),i.push(y))}if(this.initialData.declaration){const e=re(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=re(e),m=this.project.get(y);m&&this.addEntryCaller(m,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=re(e),m=this.project.get(y);m&&this.addSuccessCaller(m,null)}),this.initialData.calledByError.forEach(e=>{const y=re(e),m=this.project.get(y);m&&this.addErrorCaller(m,null)}),{updated:D(i),added:D(n),removed:D(s),affected:D(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AfterAllChildrenInitialized))){var xe;if(!this.checkCanEdit(this,i))return J.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];if(this.initialized=!0,!this.declaration.dataType||(xe=this.declaration.dataType)!=null&&xe.inferred){const{added:Me,updated:Se,removed:je,affected:Ze}=this.declaration.inferDataTypeAndSyncInstancesInputsAndOutputs(i);s.push(...Me),n.push(...Se),c.push(...je),e.push(...Ze)}const{added:y,updated:m,removed:v,affected:E}=this.syncInputs(i);s.push(...y),n.push(...m),c.push(...v),e.push(...E);const{added:b,updated:w,removed:P,affected:$}=this.syncOutputs(i);s.push(...b),n.push(...w),c.push(...P),e.push(...$);const{added:L,updated:j,removed:F,affected:q}=this.generateUnusedInternalCalls(i);s.push(...L),n.push(...j),c.push(...F),e.push(...q);const{added:X,updated:ne,removed:ee,affected:pe}=this.removeUnrecognizedInputs(i);s.push(...X),n.push(...ne),c.push(...ee),e.push(...pe);const{added:oe,updated:ce,removed:Te,affected:de}=this.removeUnrecognizedOutputs(i);s.push(...oe),n.push(...ce),c.push(...Te),e.push(...de);const{added:ye,updated:_e,removed:Pe,affected:Ge}=this.removeUnrecognizedInternalCalls(i);return s.push(...ye),n.push(..._e),c.push(...Pe),e.push(...Ge),this.inputs.sort((Me,Se)=>{var je,Ze;return(Me.index??((je=Me.declaration)==null?void 0:je.index))-(Se.index??((Ze=Se.declaration)==null?void 0:Ze.index))}),this.outputs.sort((Me,Se)=>{var je,Ze;return(Me.index??((je=Me.declaration)==null?void 0:je.index))-(Se.index??((Ze=Se.declaration)==null?void 0:Ze.index))}),this.captureVersion(),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"add-self-to-project"))){const n=[this],s=[],c=[],e=[];return this.parent===this.project&&this.project.addVariableInstance(this),this.readsValue&&(this.readsValue.addValueReader(this,i),n.push(this.readsValue)),this.writesValues.forEach(y=>{y.setValueWriter(this,i),n.push(y)}),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),n.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),n.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),n.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),n.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),n.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}get usedInputs(){return this.inputs.filter(i=>i.readsValue||i.defaultValue)}get unusedInputs(){return this.inputs.filter(i=>!i.readsValue&&!i.defaultValue)}get usedOutputs(){return this.outputs.filter(i=>i.writesValues.length)}get unusedOutputs(){return this.outputs.filter(i=>!i.writesValues.length)}get usedInternalCalls(){return this.internalCalls.filter(i=>!!i.calledBy.length||!!i.writesValues.length||!!i.successCalls.length||!!i.errorCalls.length)}get unusedInternalCalls(){const i=this.usedInternalCalls;return this.internalCalls.filter(s=>!(i.find(y=>y.id===s.id)||i.find(y=>y.declaration===s.declaration)))}removeInternalCall(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-variable-instance-internal-call"))){const s=this.internalCalls.findIndex(c=>c.id===i.id);return s>-1&&(this.internalCalls.splice(s,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose("remove-variable-instance-internal-call",this.id),this}removeInput(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveInput))){if(!this.checkCanEdit(this,n))return J.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.RemoveInput,this.id),this;const s=this.inputs.findIndex(c=>c.id===i.id);return s>-1&&(this.inputs.splice(s,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose(_.RemoveInput,this.id),this}addInput(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddInput))){return this.checkCanEdit(this,n)?this.inputs.includes(i)?(n==null||n.attemptAutoclose(_.AddInput,this.id),this):(this.inputs.push(i),n==null||n.add(this,H.Affected),n==null||n.attemptAutoclose(_.AddInput,this.id),this):(J.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.AddInput,this.id),this)}addOutput(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"add-output"))){return this.checkCanEdit(this,n)?this.outputs.includes(i)?(n==null||n.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),n==null||n.add(this,H.Affected),n==null||n.attemptAutoclose("add-output",this.id),this):(J.Logger.warn(`[addOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("add-output",this.id),this)}removeOutput(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this,n))return J.Logger.warn(`[removeOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("remove-output",this.id),this;const s=this.outputs.findIndex(c=>c.id===i.id);return s>-1&&(this.outputs.splice(s,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose("remove-output",this.id),this}addSuccessCaller(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddSuccessCaller)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCaller,n)?(this.calledBySuccess.find(c=>c.id===i.id)||(this.calledBySuccess.push(i),n==null||n.add(this,H.Updated),s&&mt(this,n)),n==null||n.attemptAutoclose(_.AddSuccessCaller,this.id),this):this}addErrorCaller(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddErrorCaller)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCaller,n)?(this.calledByError.find(c=>c.id===i.id)||(this.calledByError.push(i),n==null||n.add(this,H.Updated),s&&mt(this,n)),n==null||n.attemptAutoclose(_.AddErrorCaller,this.id),this):this}addEntryCaller(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddEntryCaller)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddEntryCaller,n)?(this.calledByEntry.find(c=>c.id===i.id)||(this.calledByEntry.push(i),n==null||n.add(this,H.Updated),s&&mt(this,n)),n==null||n.attemptAutoclose(_.AddEntryCaller,this.id),this):this}addErrorCall(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddErrorCall)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCall,n)?(this.errorCalls.find(c=>c.id===i.id)||(this.errorCalls.push(i),s&&mt(this,n),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.AddErrorCall,this.id),this):this}addSuccessCall(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddSuccessCall)),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCall,n)?(this.successCalls.find(c=>c.id===i.id)||(this.successCalls.push(i),s&&mt(this,n),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.AddSuccessCall,this.id),this):this}removeCall(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveCall)),s=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCall,n))return this;const c=this.successCalls.findIndex(y=>y.id===i.id);c>-1&&(this.successCalls.splice(c,1),n==null||n.add(this,H.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),n==null||n.add(this,H.Affected)),s&&mt(this,n),n==null||n.attemptAutoclose(_.RemoveCall,this.id),this}removeCaller(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-caller")),s=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCaller,n)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),s&&mt(this,n),n==null||n.attemptAutoclose(_.RemoveCaller,this.id),this):this}addValueReader(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,_.AddValueReader,n)?this.writesValues.includes(i)?(n==null||n.attemptAutoclose(_.AddValueReader,this.id),this):(this.writesValues.push(i),n==null||n.add(this,H.Affected),this):this}setError(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetErrorEntity))){if(!this.checkCanEdit(this,n))return J.Logger.warn(`[setError] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.SetErrorEntity,this.id),this;const s=this.error;return(s==null?void 0:s.id)!==(i==null?void 0:i.id)&&(s==null||s.remove({ignoreUpstream:!0},n),this.error=i,this.subscribeToDependencies(),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.SetErrorEntity,this.id),this}setParent(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetParent))){var s;return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.SetParent,n)?(((s=this.parent)==null?void 0:s.id)!==(i==null?void 0:i.id)&&(this.parent=i,n&&(n==null||n.add(this,H.Updated))),n==null||n.attemptAutoclose(_.SetParent,this.id),this):this}initChildren(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=he(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.declaration.type===d.GenericReference){const n=this.project.findSubscribedInstanceFromReference(this.initialData.declaration);if(!n)return this;this.declaration=n}else this.declaration=he(this.initialData.declaration,this.project),this.declaration.initChildren(i);return Pv.initWritesValues(this,this.parent),af.initReadsValue(this),this.initialData.inputs.forEach(n=>{const s=he(n,this.project);return s.setParent(this,null),s.initChildren(i),this.addInput(s,null),s}),this.initialData.outputs.forEach(n=>{const s=he(n,this.project);return s.setParent(this,null),s.initChildren(i),this.addOutput(s,i),s}),this.successCalls=this.initialData.successCalls.map(n=>{const s=he(n,this.project);if(s.addSuccessCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(s.type))s.setParent(this.parent.parent,null),s.initChildren(i);else if(s.type===d.ReturnStatement){const c=rn(this,this.project);s.setParent(c,null),s.initChildren(i)}else s.type!==d.InternalCall&&(s.setParent(this.parent,null),s.initChildren(i));return s}),this.errorCalls=this.initialData.errorCalls.map(n=>{const s=he(n,this.project);if(s.addErrorCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(s.type))s.setParent(this.parent.parent,null),s.initChildren(i);else if(s.type===d.ReturnStatement){const c=rn(this,this.project);s.setParent(c,null),s.initChildren(i)}else s.type!==d.InternalCall&&(s.setParent(this.parent,null),s.initChildren(i));return s}),this.internalCalls=this.initialData.internalCalls.reduce((n,s)=>{if(s.type===d.GenericReference){const c=this.project.findSubscribedInstanceFromReference(s);if(!c)return n;const e=c;return e.setParent(this,null),[...n,e]}else{const c=he(s,this.project);return c.setParent(this,null),c.initChildren(i),[...n,c]}},[]),this.initialData.error&&(this.error=he(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(i)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}setValueWriter(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetValueWriter))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,_.SetValueWriter,n)?(this.readsValue!==i&&(this.readsValue=i,n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose(_.SetValueWriter,this.id),this):this}removeValueWriter(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveValueWriter))){return this.readsValue&&!this.checkCanEditWithCounterpartAndSideEffects(this,this.readsValue,_.RemoveValueWriter,i)?this:(this.readsValue&&(this.readsValue=null,i==null||i.add(this,H.Updated)),i==null||i.attemptAutoclose(_.RemoveValueWriter,this.id),this)}removeValueReader(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,_.RemoveValueReader,n)?this.writesValues.includes(i)?(this.writesValues=this.writesValues.filter(s=>s.id!==i.id),n==null||n.add(this,H.Affected),this):(n==null||n.attemptAutoclose(_.RemoveValueReader,this.id),this):this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"meta-sync"))){const s=Mr(this,i,n),c=Lr(this,s),e=this.toMeta();return this.x=s.x||e.x,this.y=s.y||e.y,this.catchesError=s.catchesError!==void 0?s.catchesError:this.catchesError,super.baseMetaSync(s,this,n),s.deleted===!0&&!e.deleted?n==null||n.add(this,H.Removed):s.deleted===!1&&e.deleted?n==null||n.add(this,H.Added):c&&(n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ke,...n){return await yi.repository.APILoad(this.id,...n),this}async APICreate(i=ke,...n){return await yi.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(i=ke,...n){return await yi.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(i=ke,...n){return await yi.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(i=ke,...n){return await yi.repository.APIClone(this.id,...n),this}async APILoadVersion(i=ke,n,...s){return await yi.repository.APILoadVersion(this.id,n,...s)}removeFromParent(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveFromParent))){if(!this.checkCanEdit(this,i))return J.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];return this.parent.type===d.Project?(this.parent.removeVariableInstance(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:D(c),updated:D(n),removed:D(s),affected:D(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveEntity))){var m;if(!this.checkCanDelete(this,n))return J.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${_.RemoveEntity}-${this.id}`,action:_.RemoveEntity,owner:this,errorReason:rr.ActionOwnerEntityNonDeletable,rootAction:((m=n==null?void 0:n.self)==null?void 0:m.id)===this.id&&(n==null?void 0:n.autoCloseActionName)===_.RemoveEntity}),n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const s=[],c=[],e=[],y=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:w}=v.entity.onDetachedDependencyRemoved(this,v.field,n);s.push(...E),c.push(...b),e.push(...w)}),this.defaultValue){const{updated:v,removed:E}=this.defaultValue.remove({ignoreUpstream:!0},n);s.push(...v),c.push(...E)}if(this.readsValue&&(s.push(this.readsValue),this.readsValue.removeValueReader(this,n)),this.writesValues.forEach(v=>{s.push(v),v.setValueWriter(null,n)}),this.inputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);s.push(...E),c.push(...b)}),this.outputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);s.push(...E),c.push(...b)}),this.successCalls.forEach(v=>{s.push(v),v.removeCaller(this,n)}),this.errorCalls.forEach(v=>{s.push(v),v.removeCaller(this,n)}),this.internalCalls.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);s.push(...E),c.push(...b)}),!i){const v=this.removeFromParent(n);e.push(...v.added),s.push(...v.updated),c.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{s.push(E),E.removeCall(this,n)})}return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:D(e),updated:D(s),removed:D(c),affected:D(y),self:this}}restore({}={},i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RestoreEntity))){if(!this.checkCanEdit(this,i))return J.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:m,removed:v,added:E}=y.entity.onDetachedDependencyRestored(this,y.field,i);s.push(...m),c.push(...v),n.push(...E)}),this.defaultValue){const{updated:y}=this.defaultValue.restore({},i);s.push(...y)}return this.readsValue&&(s.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.writesValues.forEach(y=>{s.push(y),y.setValueWriter(this,i)}),this.inputs.forEach(y=>{const{updated:m}=y.restore({},i);s.push(...m)}),this.outputs.forEach(y=>{const{updated:m}=y.restore({},i);s.push(...m)}),this.successCalls.forEach(y=>{s.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{s.push(y),y.addErrorCaller(this,i)}),this.internalCalls.forEach(y=>{const{updated:m}=y.restore({},i);s.push(...m)}),this.calledBySuccess.forEach(y=>{s.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{s.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{s.push(y),y.addCall(this,i)}),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:D(n),updated:D(s),removed:D(c),affected:D(e),self:this}}toFlat(i=new Set){var s,c;return i.has(this.id)?[]:(i.add(this.id),[this,...((s=this.defaultValue)==null?void 0:s.toFlat(i))||[],...this.writesValues.flatMap(e=>e.toFlat(i)),...((c=this.readsValue)==null?void 0:c.toFlat(i))||[],...this.successCalls.flatMap(e=>e.toFlat(i)),...this.errorCalls.flatMap(e=>e.toFlat(i)),...this.inputs.flatMap(e=>e.toFlat(i)),...this.outputs.flatMap(e=>e.toFlat(i)),...this.internalCalls.flatMap(e=>e.toFlat(i))])}toFlatIds(i=new Set){var s;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((s=this.defaultValue)==null?void 0:s.toFlatIds(i))||[],...this.writesValues.flatMap(c=>c.toFlatIds(i)),...this.successCalls.flatMap(c=>c.toFlatIds(i)),...this.errorCalls.flatMap(c=>c.toFlatIds(i)),...this.inputs.flatMap(c=>c.toFlatIds(i)),...this.outputs.flatMap(c=>c.toFlatIds(i)),...this.internalCalls.flatMap(c=>c.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,catchesError:this.catchesError,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,x:this.x,y:this.y,type:this.type,editable:this.editable,deletable:this.deletable}}toJSON(i=new Set){var n,s,c;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,declaration:this.declaration.toJSON(i),defaultValue:((n=this.defaultValue)==null?void 0:n.toJSON(i))||null,readsValue:((s=this.readsValue)==null?void 0:s.toReference())||null,writesValues:this.writesValues.map(e=>e.toJSON(i)),inputs:this.inputs.map(e=>e.toJSON(i)),outputs:this.outputs.map(e=>e.toJSON(i)),successCalls:this.successCalls.map(e=>e.toJSON(i)),errorCalls:this.errorCalls.map(e=>e.toJSON(i)),internalCalls:this.internalCalls.map(e=>e.toJSON(i)),calledBySuccess:this.calledBySuccess.map(e=>e.toReference()),calledByError:this.calledByError.map(e=>e.toReference()),calledByEntry:this.calledByEntry.map(e=>e.toReference()),parent:this.parent.toReference(),error:((c=this.error)==null?void 0:c.toJSON(i))||null,x:this.x,y:this.y})}toJSONClone(i=ct){var s,c,e,y,m,v,E,b;let n;return(s=i.seenEntityMaps)!=null&&s.has(this.id)?n=i.seenEntityMaps.get(this.id):(n=i.newId||jr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,n)),(c=i.seenEntities)!=null&&c.has(n)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(n),(m=i.seenEntities)==null||m.add(this.id),{id:n,version:x.UUID.uuid(),createdAt:i.timestamp||M().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,defaultValue:((v=this.defaultValue)==null?void 0:v.toJSONClone({...i,newId:null}))||null,declaration:this.declaration.toReference({seenEntityMaps:i.seenEntityMaps}),readsValue:((E=this.readsValue)==null?void 0:E.toReference({seenEntityMaps:i.seenEntityMaps}))||null,writesValues:this.writesValues.map(w=>w.toJSONClone({...i,newId:null})),inputs:this.inputs.map(w=>w.toJSONClone({...i,newId:null})),outputs:this.outputs.map(w=>w.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(w=>w.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(w=>w.toJSONClone({...i,newId:null})),internalCalls:this.internalCalls.map(w=>this.calledBy.length||this.readsValue?w.toJSONClone({...i,newId:null}):w.toReference({seenEntityMaps:i.seenEntityMaps})),calledBySuccess:this.calledBySuccess.map(w=>w.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(w=>w.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(w=>w.toReference({seenEntityMaps:i.seenEntityMaps})),error:((b=this.error)==null?void 0:b.toJSONClone({...i,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps}),x:this.x,y:this.y})}toReference(i=ct){var s;let n=this.id;return(s=i.seenEntityMaps)!=null&&s.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(i=ct){var s,c,e,y,m;let n=this.id;return(s=i.seenEntityMaps)!=null&&s.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,x:this.x,y:this.y,defaultValue:((c=this.defaultValue)==null?void 0:c.toReference(i))||null,declaration:((e=this.declaration)==null?void 0:e.toReference(i))||null,readsValue:((y=this.readsValue)==null?void 0:y.toReference(i))||null,writesValues:this.writesValues.map(v=>v.toReference(i)),inputs:this.inputs.map(v=>v.toReference(i)),outputs:this.outputs.map(v=>v.toReference(i)),successCalls:this.successCalls.map(v=>v.toReference(i)),errorCalls:this.errorCalls.map(v=>v.toReference(i)),calledBySuccess:this.calledBySuccess.map(v=>v.toReference(i)),calledByError:this.calledByError.map(v=>v.toReference(i)),calledByEntry:this.calledByEntry.map(v=>v.toReference(i)),internalCalls:this.internalCalls.map(v=>v.toReference(i)),error:((m=this.error)==null?void 0:m.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var s,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((s=this.defaultValue)==null?void 0:s.toFlatJSON(i))||[],...((c=this.declaration)==null?void 0:c.toFlatJSON(i))||[],...this.writesValues.flatMap(e=>e.toFlatJSON(i)),...this.successCalls.flatMap(e=>e.toFlatJSON(i)),...this.errorCalls.flatMap(e=>e.toFlatJSON(i)),...this.inputs.flatMap(e=>e.toFlatJSON(i)),...this.outputs.flatMap(e=>e.toFlatJSON(i)),...this.internalCalls.flatMap(e=>e.toFlatJSON(i)),...this.calledBy.flatMap(e=>e.toFlatJSON(i))])}toGenerationTarget(){const i=this.parent.type===d.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(n=>n.id),calledBySuccess:this.calledBySuccess.map(n=>n.id),calledByError:this.calledByError.map(n=>n.id),parent:i}}toFlatGenerationTarget(i=new Set){var s,c,e;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((s=this.defaultValue)==null?void 0:s.toFlatGenerationTarget(i))||[],...((c=this.declaration)==null?void 0:c.toFlatGenerationTarget(i))||[],...((e=this.readsValue)==null?void 0:e.toFlatGenerationTarget(i))||[],...this.writesValues.flatMap(y=>y.toFlatGenerationTarget(i)),...this.successCalls.flatMap(y=>y.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(y=>y.toFlatGenerationTarget(i)),...this.inputs.flatMap(y=>y.toFlatGenerationTarget(i)),...this.outputs.flatMap(y=>y.toFlatGenerationTarget(i)),...this.internalCalls.flatMap(y=>y.toFlatGenerationTarget(i))])}clearErrors(){var i;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),this.inputs.forEach(n=>n.clearErrors()),this.outputs.forEach(n=>n.clearErrors()),this.successCalls.forEach(n=>n.clearErrors()),this.errorCalls.forEach(n=>n.clearErrors()),this.internalCalls.forEach(n=>n.clearErrors()),this}validate(){return this.errors=ULe(this),{success:!0}}async validateAsync(i={}){const n=J.YieldTracker.from(i);return this.errors=await jLe(this,{tracker:n}),{success:!0}}getErrors(){var n;return[...this.errors,...((n=this.defaultValue)==null?void 0:n.getErrors())||[],...this.inputs.flatMap(s=>s.getErrors()),...this.internalCalls.flatMap(s=>s.getErrors()),...this.outputs.flatMap(s=>s.getErrors())]}async getErrorsAsync(i={}){var e;const n=J.YieldTracker.from(i),s=[...this.errors];await n.tick();const c=await((e=this.defaultValue)==null?void 0:e.getErrorsAsync({tracker:n}));c&&s.push(...c);for(const y of this.inputs){const m=await y.getErrorsAsync({tracker:n});s.push(...m)}for(const y of this.internalCalls){const m=await y.getErrorsAsync({tracker:n});s.push(...m)}for(const y of this.outputs){const m=await y.getErrorsAsync({tracker:n});s.push(...m)}return s}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.defaultValue)||null}setDefaultValue(i,n=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this,n))return J.Logger.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("set-default-value",this.id),this;const s=this.defaultValue;return(s==null?void 0:s.id)!==(i==null?void 0:i.id)&&(s==null||s.remove({ignoreUpstream:!0},n),this.defaultValue=i,n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.CloneEntity)),n=null,s=null,c=!0){var $,L,j,F;const e=Nr(n,this),y=this.toJSON(),m=s||x.UUID.uuid();y.inputs=[],y.id=m,y.version=x.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||M().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1,y.deletable=!0,y.editable=!0;const v=Ki(y,e);n?v.setParent(n,i):v.setParent(this.parent,null),c&&v.subscribe(),v.initChildren(i),i==null||i.add(v,H.Added);const E=($=this.defaultValue)==null?void 0:$.clone(i,v,x.UUID.uuid(),c);v.defaultValue=E||null;const b=(L=this.inputs)==null?void 0:L.map(q=>q.clone(i,v,x.UUID.uuid(),c));v.inputs=b;const w=(j=this.outputs)==null?void 0:j.map(q=>q.clone(i,v,x.UUID.uuid(),c));v.outputs=w;const P=(F=this.internalCalls)==null?void 0:F.map(q=>q.clone(i,v,x.UUID.uuid(),c));return v.internalCalls=P,i==null||i.attemptAutoclose(_.CloneEntity,this.id),v}addInternalCall(i){return this.internalCalls.find(n=>n===i)||this.internalCalls.push(i),this}setDeclaration(i){return this.declaration!==i&&(this.declaration=i),this}removeUnrecognizedInputs(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return J.Logger.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.inputs].forEach(y=>{const m=y.remove({ignoreUpstream:!1},i);c.push(...m.removed),n.push(...m.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.inputs].forEach(y=>{var v;if(!y.declaration){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated);return}if(![...((v=this.declaration.dataType)==null?void 0:v.entity).allProperties].find(E=>y.declaration===E)){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated)}}),i==null||i.attemptAutoclose(_.RemoveUnrecognizedInputs,this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}removeUnrecognizedOutputs(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-unrecognized-variable-instance-outputs"))){if(!this.checkCanEdit(this,i))return J.Logger.warn(`[removeUnrecognizedOutputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveUnrecognizedOutputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.outputs].forEach(y=>{const m=y.remove({ignoreUpstream:!1},i);c.push(...m.removed),n.push(...m.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.outputs].forEach(y=>{var v;if(!y.declaration){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated);return}if(![...((v=this.declaration.dataType)==null?void 0:v.entity).allProperties].find(E=>y.declaration===E)){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated)}}),i==null||i.attemptAutoclose("remove-unrecognized-variable-instance-outputs",this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}removeUnrecognizedInternalCalls(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-unrecognized-variable-declaration-internal-calls"))){const n=[],s=[],c=[],e=[];if(!this.declaration.dataType||!this.declaration.dataType.entity||![d.DefinitionEntity,d.PrimitiveEntity,d.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))[...this.internalCalls].forEach(m=>{const v=m.remove({ignoreUpstream:!1},i);c.push(...v.removed),n.push(...v.updated)});else if(this.declaration.dataType&&this.declaration.dataType.entity&&[d.DefinitionEntity,d.PrimitiveEntity,d.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)){const m=[...this.declaration.dataType.entity.getAllInteractiveMethods()],v=[...m].filter(E=>!m.some(b=>{var w,P;return b.id!==E.id&&(((w=b.implements)==null?void 0:w.id)===E.id||((P=b.extends)==null?void 0:P.id)===E.id)})&&!E.deleted);[...this.internalCalls].forEach(E=>{if(!E.declaration){const w=E.remove({ignoreUpstream:!1},i);c.push(...w.removed),n.push(...w.updated);return}if(!v.find(w=>E.declaration===w)){const w=E.remove({ignoreUpstream:!1},i);c.push(...w.removed),n.push(...w.updated);return}})}return this.internalCalls.filter((m,v)=>{const E=this.internalCalls.findIndex(w=>w.declaration===m.declaration&&w!==m);if(E===-1)return!1;const b=this.internalCalls[E];return M(b==null?void 0:b.createdAt).isSame(M(m.createdAt))?v>E:!!M(b==null?void 0:b.createdAt).isAfter(m.createdAt)}).forEach(m=>{const v=m.remove({ignoreUpstream:!1},i);c.push(...v.removed),n.push(...v.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-variable-declaration-internal-calls",this.id),{updated:D(n),added:D(s),removed:D(c),affected:D(e),self:this}}syncInputs(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"sync-variable-instance-inputs"))){const n=[],s=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([d.DefinitionEntity,d.PrimitiveEntity,d.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.properties];y.filter(b=>!b.getDataType(i)).forEach(b=>{const w=this.inputs.find(L=>se(L,this.project)===se(b,this.project));if(!w)return;const P=this.declaration.getMasterInputWithValueWritterFromAllInstances(w);if(!P)return;const $=hd(P);b.setDataType($,i),w.setDeclaration(b,i)}),y.filter(b=>!this.inputs.find(w=>{var P;return((P=w.declaration)==null?void 0:P.id)===b.id})).forEach(b=>{const w={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,parent:this.toReference(),name:null,description:null,codeName:null,declaration:b,defaultValue:null,index:b.index,readsValue:null},P=he(w,this.project);return P.setParent(this,i),P.initChildren(i),i==null||i.add(P,H.Added),this.addInput(P,i),P}),this.inputs.filter(b=>!b.declaration).forEach(b=>{const w=y.find(P=>se(P,this.project)===se(b,this.project));w&&b.setDeclaration(w,i)})}}else return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:D(n),updated:D(s),removed:D(c),affected:D(e),self:this}}syncOutputs(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SyncOutputs))){if(!this.checkCanEdit(this,i))return J.Logger.warn(`[syncOutputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],s=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity)[d.DefinitionEntity,d.PrimitiveEntity,d.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList&&[...this.declaration.dataType.entity.properties].filter(v=>!this.outputs.find(E=>E.declaration===v)).map(v=>{const E={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.OutputMap,parent:this.toReference(),declaration:v,index:v.index,writesValues:[]},b=he(E,this.project);return b.setParent(this,i),b.initChildren(i),i==null||i.add(b,H.Added),this.addOutput(b,i),b});else return i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{added:D(n),updated:D(s),removed:D(c),affected:D(e),self:this}}generateUnusedInternalCalls(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"generate-unused-internal-calls"))){const n=[],s=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([d.DefinitionEntity,d.PrimitiveEntity,d.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.getAllInteractiveMethods()];[...y].filter(E=>!y.some(b=>{var w,P;return b.id!==E.id&&(((w=b.implements)==null?void 0:w.id)===E.id||((P=b.extends)==null?void 0:P.id)===E.id)})&&!E.deleted).filter(E=>!this.internalCalls.find(w=>{var $,L,j,F,q;return((($=w.declaration)==null?void 0:$.id)||((j=(L=w.initialData)==null?void 0:L.declaration)==null?void 0:j.entityId)||((q=(F=w.initialData)==null?void 0:F.declaration)==null?void 0:q.id))===E.id})).forEach(E=>{const b=this.internalCalls.find(w=>{const P=_c(w.declaration),$=_c(E);return P.id===$.id});if(b)b.setDeclaration(E),b.subscribeToDependencies();else{const w=E.createInternalCall(i,this);i==null||i.add(w,H.Added),this.addInternalCall(w)}})}}else return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:D(n),updated:D(s),removed:D(c),affected:D(e),self:this}}getDataType(i=this.project.addChangeSet(new Z(this.project,x.sessionAuthor,M().toISOString(),this,!0,"get-data-type"))){var s;const n=((s=this.declaration)==null?void 0:s.getDataType(i))||null;return i==null||i.attemptAutoclose("get-data-type",this.id),n}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return this.outputs.filter(i=>i.suggestion||!i.writesValues.length)}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return this.outputs.filter(i=>!i.suggestion&&i.writesValues.length)}};I(yi,"repository",{APICreate:async(i,...n)=>i,APIUpdate:async(i,...n)=>i,APIDelete:async(i,...n)=>i,APIClone:async(i,...n)=>{},APILoad:async(i,...n)=>null,APILoadVersion:async(i,n,...s)=>null}),I(yi,"type",d.VariableInstance),I(yi,"USER_MANAGED_PARENT_TYPES",[...nr,d.Project]),I(yi,"PARENT_TYPES",[...yi.USER_MANAGED_PARENT_TYPES]),I(yi,"MUTABLE_BASE_PROPERTIES",["catchesError"]),I(yi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),I(yi,"BASE_PROPERTIES",[...yi.MUTABLE_BASE_PROPERTIES,...yi.INMUTABLE_BASE_PROPERTIES]),I(yi,"MUTABLE_META_PROPERTIES",[...yi.MUTABLE_BASE_PROPERTIES,"x","y"]),I(yi,"INMUTABLE_META_PROPERTIES",[...yi.INMUTABLE_BASE_PROPERTIES]),I(yi,"META_PROPERTIES",[...yi.MUTABLE_META_PROPERTIES,...yi.INMUTABLE_META_PROPERTIES]),I(yi,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),I(yi,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),I(yi,"UPSTREAM_PROPERTIES",[...yi.MUTABLE_UPSTREAM_PROPERTIES,...yi.INMUTABLE_UPSTREAM_PROPERTIES]),I(yi,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),I(yi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),I(yi,"DOWNSTREAM_PROPERTIES",[...yi.MUTABLE_DOWNSTREAM_PROPERTIES,...yi.INMUTABLE_DOWNSTREAM_PROPERTIES]),I(yi,"PROPERTIES",[...yi.META_PROPERTIES,...yi.UPSTREAM_PROPERTIES,...yi.DOWNSTREAM_PROPERTIES]);let Lu=yi;var KLe=(o=>(o.Parent="variable-declaration-parent",o.DataTypeEntity="variable-declaration-data-type-entity",o.DataType="variable-declaration-data-type",o))(KLe||{});const hi=class hi extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"name");I(this,"codeName",null);I(this,"description",null);I(this,"required",!1);I(this,"constant",!1);I(this,"x");I(this,"y");I(this,"type",d.VariableDeclaration);I(this,"catchesError",!1);I(this,"defaultValue",null);I(this,"dataType",null);I(this,"writesValues",[]);I(this,"readsValue",null);I(this,"inputs",[]);I(this,"outputs",[]);I(this,"error",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"successCalls",[]);I(this,"errorCalls",[]);I(this,"internalCalls",[]);I(this,"parent");I(this,"errors",[]);I(this,"project");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.name=i.name,this.description=i.description,this.constant=i.constant,this.codeName=i.codeName,this.required=i.required,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableDeclaration,catchesError:!1,name:"",codeName:null,description:"",dataType:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,constant:!1,required:!1,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,n){let s=n;if(i.parent){const b=re(i.parent);s=n.get(b)}const c=i.calledByEntry.map(b=>{const w=re(b);return n.get(w)}),e=i.calledBySuccess.map(b=>{const w=re(b);return n.get(w)}),y=i.calledByError.map(b=>{const w=re(b);return n.get(w)});let m=null;if(i.readsValue){const b=re(i.readsValue);m=n.get(b)}const v={id:i.id,version:x.UUID.uuid(),createdAt:M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.VariableDeclaration,catchesError:i.catchesError||!1,name:i.name,defaultValue:null,codeName:i.codeName||null,description:i.description||null,constant:i.constant||!1,required:i.required||!1,calledByEntry:c,calledBySuccess:e,calledByError:y,dataType:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:m,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:s},E=he(v,n);return E.setParent(s,null),E}static validateGenerationTarget(i,n){let s=JSON.parse(JSON.stringify(i));const c=[],e=bn(s,{parent:{list:!1,types:[...nr,d.Project],optional:!0}},n);s=e.modifiedData;const y=RV(s,n);return c.push(...e.errors,...y,...$r(s)),{errors:c,modifiedData:s}}get variableInstances(){const i=[];return Object.values(this.detachedDependents).forEach(n=>{n.field===vN.VarDeclaration&&!i.includes(n.entity)&&i.push(n.entity)}),i}validateGeneratedUpdate(i){const n=[];let s=JSON.parse(JSON.stringify(i));const c=nf(s,this);return s=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${ae.InvalidParentUpdate}`,code:ae.InvalidParentUpdate,severity:fe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
package/dist/index.d.ts
CHANGED
|
@@ -9493,7 +9493,10 @@ export declare enum CanvasEntityOtherDisabledReason {
|
|
|
9493
9493
|
Suggestion = "suggestion",
|
|
9494
9494
|
CanvasGloballyDisabled = "canvas-globally-disabled",
|
|
9495
9495
|
CannotInteractWithInputInVariableWithInternalCalls = "cannot-interact-with-input-in-variable-with-internal-calls",
|
|
9496
|
-
CannotInteractWithOutputInVariableWithInternalCalls = "cannot-interact-with-output-in-variable-with-internal-calls"
|
|
9496
|
+
CannotInteractWithOutputInVariableWithInternalCalls = "cannot-interact-with-output-in-variable-with-internal-calls",
|
|
9497
|
+
PropertyIsConstantItsValueCantBeReset = "property-is-constant-its-value-cant-be-reset",
|
|
9498
|
+
CannotWriteValueOfGlobalVariableDeclaration = "cannot-write-value-of-global-variable-declaration",
|
|
9499
|
+
CannotReSetValueOfConstantVariable = "cannot-reset-value-of-constant-variable"
|
|
9497
9500
|
}
|
|
9498
9501
|
|
|
9499
9502
|
export declare type CanvasEntityState = InstalledProjectState | DefinitionEntityState | FunctionDeclarationState | GlobalEventState | VariableState | ConditionState | OperationState | FunctionCallState | ReturnStatementState | ContinueStatementState | BreakStatementState | LoopState | SearchState;
|
package/dist/index.js
CHANGED
|
@@ -123856,7 +123856,7 @@ var Bj = /* @__PURE__ */ ((o) => (o.NotPartOfOngoingTest = "not-part-of-ongoing-
|
|
|
123856
123856
|
const jki = Object.values(
|
|
123857
123857
|
Bj
|
|
123858
123858
|
);
|
|
123859
|
-
var kj = /* @__PURE__ */ ((o) => (o.Suggestion = "suggestion", o.CanvasGloballyDisabled = "canvas-globally-disabled", o.CannotInteractWithInputInVariableWithInternalCalls = "cannot-interact-with-input-in-variable-with-internal-calls", o.CannotInteractWithOutputInVariableWithInternalCalls = "cannot-interact-with-output-in-variable-with-internal-calls", o))(kj || {});
|
|
123859
|
+
var kj = /* @__PURE__ */ ((o) => (o.Suggestion = "suggestion", o.CanvasGloballyDisabled = "canvas-globally-disabled", o.CannotInteractWithInputInVariableWithInternalCalls = "cannot-interact-with-input-in-variable-with-internal-calls", o.CannotInteractWithOutputInVariableWithInternalCalls = "cannot-interact-with-output-in-variable-with-internal-calls", o.PropertyIsConstantItsValueCantBeReset = "property-is-constant-its-value-cant-be-reset", o.CannotWriteValueOfGlobalVariableDeclaration = "cannot-write-value-of-global-variable-declaration", o.CannotReSetValueOfConstantVariable = "cannot-reset-value-of-constant-variable", o))(kj || {});
|
|
123860
123860
|
const Kki = Object.values(
|
|
123861
123861
|
kj
|
|
123862
123862
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyx-code/project-logic-tree",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6731",
|
|
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",
|