@elyx-code/project-logic-tree 0.0.6983 → 0.0.6984
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +538 -154
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -118,7 +118,7 @@ The parent ${h.type} has a data-type that references an entity with `;le.length?
|
|
|
118
118
|
The entity is ${si(k,{nested:!1}).lines[0].text}.`,ne+=`Technically, an implemented ${V.type} will be generated with all `,e.push(new we({id:`${a.id}--${Ce.NoOverlapWithImplementedSignature}`,code:Ce.NoOverlapWithImplementedSignature,severity:ve.Error,message:`Entity of type '${d.InputMap}' with id '${a.id}' cannot be added to the parent entity of type '${h.type}' with id '${h.id}'. The 'declaration' with '${m.id}' of the 'input-map' does not exist in 'entity' field implemented the parent ${h.type}'s 'data-type'.${ne}`}))}}else if(_t.filter(V=>Mt.includes(V)).includes(h.type)){const M=ML(h),G=M.find(K=>K.id===a.declaration),k=`The parent entity has the following argument declarations that can be referenced by input-maps, ids: '${At(M.map(K=>K.id),"', '","' and '")}'`;G||e.push(new we({id:`${a.id}--${Ce.NoOverlapWithImplementedSignature}`,code:Ce.NoOverlapWithImplementedSignature,severity:ve.Error,message:`Entity of type '${d.InputMap}' with id '${a.id}' cannot be added to the parent entity of type '${h.type}' with id '${h.id}'. The parent entity does not have an 'argument-declaration' with id '${a.declaration}'.
|
|
119
119
|
You can't add an input-map to an entity that doesn't have a matching 'argument-declaration'.
|
|
120
120
|
${k}`}))}}const b=tn(a);return e.push(...f.errors,...b.errors),c.push(...b.explanations),{errors:e,explanations:c,modifiedData:a}}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const r=[],a=[];let c=JSON.parse(JSON.stringify(i));const e=dy(c,this);return c=e.modifiedData,r.push(...e.errors),c.parent&&r.push(new we({id:`${this.id}--${Te.InvalidParentUpdate}`,code:Te.InvalidParentUpdate,severity:ve.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
|
|
121
|
-
This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`})),{errors:r,explanations:a,modifiedData:c}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];if(r==="declaration"){const{updated:m,added:E,removed:b}=this.remove({ignoreUpstream:!1},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];if(r==="declaration"){const{updated:m,added:E,removed:b}=this.restore({},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}unsubscribeFromDependencies(){var i,r,a,c,e;return(r=(i=this.declaration)==null?void 0:i.unsubscribeDependents)==null||r.call(i,[{entity:this,field:"declaration"}]),(e=(c=(a=this.dataType)==null?void 0:a.entity)==null?void 0:c.unsubscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),this}subscribeToDependencies(){var i,r,a,c,e;return(r=(i=this.declaration)==null?void 0:i.subscribeDependents)==null||r.call(i,[{entity:this,field:"declaration"}]),(e=(c=(a=this.dataType)==null?void 0:a.entity)==null?void 0:c.subscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new Ci(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new Ci(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.declaration=this.declaration,i.defaultValue=this.defaultValue,i.readsValue=this.readsValue,i.dataType=this.dataType,i.parent=this.parent,i}recursiveCaptureUpstreamVersions(i){const r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,P]of A.knownVersions)E.set(_,P);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new Ci(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.declaration=h.declaration,this.defaultValue=h.defaultValue,this.readsValue=h.readsValue,this.dataType=h.dataType,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),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 a=ie(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.readsValue){const a=ie(i.readsValue),c=this.project.get(a),e=this.readsValue;e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(r),c&&this.setValueWriter(c,r)}else this.removeValueWriter(r);if(i.declaration){const a=ie(i.declaration),c=this.project.get(a);c&&this.setDeclaration(c,r)}else this.setDeclaration(null,r);if(i.dataType){const a=ie(i.dataType),c=this.project.get(a);c&&this.setDataType(c,r)}else this.setDataType(null,r);if(i.defaultValue){const a=ie(i.defaultValue),c=this.project.get(a);c&&this.setDefaultValue(c,r)}else this.setDefaultValue(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent){const a=ie(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}if(i.readsValue){const a=ie(i.readsValue),c=this.project.get(a),e=this.readsValue;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(r),c)this.setValueWriter(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'readsValue' reference '${a}' that isn't found in the project`)}else i.readsValue===null&&this.removeValueWriter(r);if(i.declaration){const a=ie(i.declaration),c=this.project.get(a);if(c)this.setDeclaration(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${a}' that isn't found in the project`)}else i.declaration===null&&this.setDeclaration(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent){const e=ie(this.initialData.parent),f=this.project.get(e);if(f)this.setParent(f,null),i.push(f);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.readsValue){const e=ie(this.initialData.readsValue),f=this.project.get(e);f&&(this.setValueWriter(f,null),i.push(f))}if(this.initialData.declaration){const e=ie(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f,null),i.push(f))}return{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){var b,A,_,P;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(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];this.initialized=!0;let f=((b=this.declaration)==null?void 0:b.index)??this.index??0;const h=(Dt.includes(this.parent.type)?this.parent.outputs:this.parent.inputs).filter(V=>!V.deleted&&V.id!==this.id);h.length&&(f>h.length+1?f=h.length:f<0&&(f=0)),h.find(V=>(V.index||0)===f&&!V.deleted)&&h.filter(V=>(V.index||0)>=f&&!V.deleted).forEach(V=>{V.metaSync({index:(V.index||0)+1},i),i==null||i.add(V,H.Updated),r.push(V)});const E=this.parent.type===d.VariableInstance&&((A=this.declaration)==null?void 0:A.type)===d.Property&&((_=this.declaration)==null?void 0:_.constant);if(E&&this.readsValue&&(this.readsValue.removeValueReader(this,i),this.removeValueWriter(i)),E&&this.defaultValue&&this.defaultValue.remove({ignoreUpstream:!1},i),this.readsValue&&this.defaultValue&&(this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)||this.defaultValue.remove({ignoreUpstream:!1},i),this.setDefaultValue(null,i)),this.defaultValue&&!this.readsValue&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.id)&&this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)){const V=this.defaultValue.clone(i,this);this.setDefaultValue(V,i)}return this.readsValue&&this.parent.type===d.VariableDeclaration&&((P=this.parent.parent)==null?void 0:P.type)===d.Project&&(i==null||i.event({id:`${w.RemoveValueWriter}-${this.id}--${Me.InputsInGlobalVariableDeclarationsCannotReadValues}`,action:w.RemoveValueWriter,owner:this,errorReason:Me.InputsInGlobalVariableDeclarationsCannotReadValues,rootAction:!1}),this.readsValue.removeValueReader(this,i),this.removeValueWriter(i)),this.metaSync({index:f},i),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){var f;const r=[this],a=[],c=[],e=[];return Dt.includes(this.parent.type)?this.parentRelationType===od.Error?this.parent.setThrows(this,i):this.parent.addOutput(this,i):this.parent.addInput(this,i),e.push(this.parent),(f=this.readsValue)==null||f.addValueReader(this,i),this.readsValue&&r.push(this.readsValue),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}setParent(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,H.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setDataType(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetDataType))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[setDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetDataType,this.id),this;const a=this.dataType;return(a==null?void 0:a.id)!==(i==null?void 0:i.id)&&(a==null||a.remove({ignoreUpstream:!0},r),this.dataType=i,this.subscribeToDependencies(),r==null||r.add(this,H.Affected)),r==null||r.attemptAutoclose(w.SetDataType,this.id),this}removeDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveDataType))){return this.checkCanEdit(this,i)?(this.dataType&&(this.dataType.remove({ignoreUpstream:!0},i),i==null||i.add(this,H.Affected),this.dataType=null),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this):(J.Logger.warn(`[removeDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this)}setDeclaration(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"set-declaration"))){var a;return((a=this.declaration)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.declaration=i,this.subscribeToDependencies(),r&&(r==null||r.add(this,H.Updated))),r==null||r.attemptAutoclose("set-declaration",this.id),this}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=Ie(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.declaration&&(this.declaration=Ie(this.initialData.declaration,this.project)),uy.initReadsValue(this),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}setValueWriter(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueWriter))){var c,e,f,h,m,E,b;return this.checkCanEditFromScopeOwnerWithSideEffects(this,w.SetValueWriter,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.SetValueWriter}-${this.id}`,action:w.SetValueWriter,owner:this,errorReason:Me.CannotValueWriteItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.SetValueWriter})),this.parent.type===d.VariableInstance&&((e=this.declaration)==null?void 0:e.type)===d.Property&&((f=this.declaration)==null?void 0:f.constant)&&i?(r==null||r.event({id:`${w.SetValueWriter}-${this.id}--${i.id}`,action:w.SetValueWriter,owner:this,counterpart:i,errorReason:Me.ValueReadingOverridesConstantVariable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===w.SetValueWriter}),r==null||r.attemptAutoclose(w.SetValueWriter,this.id),this):(((m=this.readsValue)==null?void 0:m.id)!==(i==null?void 0:i.id)&&(this.readsValue=i,this.readsValue&&((E=this.defaultValue)==null||E.remove({ignoreUpstream:!1},r),this.parent.type===d.Search&&((b=this.declaration)==null||b.setDefaultValue(null,r))),r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.SetValueWriter,this.id),this)):this}removeValueWriter(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveValueWriter))){return this.readsValue&&!this.checkCanEditFromScopeOwnerWithSideEffects(this,w.RemoveValueWriter,i)?this:(this.readsValue&&(this.readsValue=null,i==null||i.add(this,H.Updated)),i==null||i.attemptAutoclose(w.RemoveValueWriter,this.id),this)}subscribe(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=nn(this,i,r),c=rn(this,a),e=this.toMeta();return this.index=a.index||(a.index!==0?e.index:0),this.name=a.name!==void 0?a.name:e.name,this.codeName=a.codeName!==void 0?a.codeName:e.codeName,this.description=a.description!==void 0?a.description:e.description,this.parentRelationType=a.parentRelationType!==void 0?a.parentRelationType:this.parentRelationType,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,H.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,H.Added):c&&(r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ze,...r){return await Ci.repository.APILoad(this.id,...r),this}async APICreate(i=Ze,...r){return await Ci.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ze,...r){return await Ci.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ze,...r){return await Ci.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ze,...r){return await Ci.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ze,r,...a){return await Ci.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){var f;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(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return Dt.includes((f=this.parent)==null?void 0:f.type)?this.parentRelationType===od.Error?(this.parent.setThrows(null,i),e.push(this.parent)):(this.parent.removeOutput(this,i),e.push(this.parent)):(this.parent.removeInput(this,i),e.push(this.parent)),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h,m,E,b,A;if(this.deleted)return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(!this.checkCanDelete(this,r))return J.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Me.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Me.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.metaSync({deleted:!0},r),r!=null&&r.hasAdded(this.id)||this.project.subscribeDeletedInstance(this),Object.values(this.detachedDependents).forEach(_=>{const{updated:P,removed:V,added:M}=_.entity.onDetachedDependencyRemoved(this,_.field,r);a.push(...P),c.push(...V),e.push(...M)}),this.defaultValue){const{updated:_,removed:P}=this.defaultValue.remove({ignoreUpstream:!0},r);a.push(..._),c.push(...P)}if(this.readsValue&&(a.push(this.readsValue),this.readsValue.removeValueReader(this,r)),this.defaultValue&&(a.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0},r)),this.declaration){if(this.declaration.type===d.Property&&((m=this.declaration.parent)==null?void 0:m.type)===d.DefinitionEntity&&((b=(E=this.declaration.parent)==null?void 0:E.parent)==null?void 0:b.type)===d.DataType&&!(r!=null&&r.hasRemoved(this.declaration.id))&&!this.declaration.deleted){const{updated:_,removed:P}=this.declaration.remove({ignoreUpstream:!1},r);a.push(..._),c.push(...P)}else if(this.declaration.type===d.ValueDescriptor&&((A=this.declaration.parent)==null?void 0:A.type)===d.Search&&!(r!=null&&r.hasRemoved(this.declaration.id))&&!this.declaration.deleted){const{updated:_,removed:P}=this.declaration.remove({ignoreUpstream:!1},r);a.push(..._),c.push(...P)}}if(!i){const _=this.removeFromParent(r);e.push(..._.added),a.push(..._.updated),c.push(..._.removed),f.push(..._.affected)}if(!i&&this.parent&&[d.BreakStatement,d.ContinueStatement].includes(this.parent.type)&&this.parent.parent&&this.parent.parent.type===d.Loop&&this.parent.initialized&&this.parent.parent.syncFromDataType(r),this.parentRelationType===od.Error&&this.parent.type===d.ReturnStatement){const{updated:_,added:P,removed:V,affected:M}=this.parent.syncInputs(r);a.push(..._),e.push(...P),c.push(...V),f.push(...M)}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.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(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(w.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(f=>{const{updated:h,removed:m,added:E}=f.entity.onDetachedDependencyRestored(this,f.field,i);a.push(...h),c.push(...m),r.push(...E)}),this.defaultValue){const{updated:f}=this.defaultValue.restore({},i);a.push(...f)}return this.readsValue&&(a.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.defaultValue&&(a.push(this.defaultValue),this.defaultValue.restore({},i)),e.push(this.parent),this.parent.addInput(this,i),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this}}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.defaultValue?this.defaultValue.toFlat(i):[],...this.dataType?this.dataType.toFlat(i):[],...this.declaration?this.declaration.toFlat(i):[],...this.readsValue?this.readsValue.toFlat(i):[]])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.defaultValue?this.defaultValue.toFlatIds(i):[],...this.dataType?this.dataType.toFlatIds(i):[],...this.declaration?this.declaration.toFlatIds(i):[],...this.readsValue?this.readsValue.toFlatIds(i):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,index:this.index,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(i=new Set){var r,a,c,e;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,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,defaultValue:((r=this.defaultValue)==null?void 0:r.toJSON(i))||null,dataType:((a=this.dataType)==null?void 0:a.toJSON(i))||null,declaration:((c=this.declaration)==null?void 0:c.toJSON(i))||null,readsValue:((e=this.readsValue)==null?void 0:e.toReference())||null,parent:this.parent.toReference()})}toJSONClone(i=at){var a,c,e,f,h,m,E,b,A,_,P,V;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||un(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:x.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,defaultValue:((m=this.defaultValue)==null?void 0:m.toJSONClone({...i,newId:null}))||null,dataType:((E=this.dataType)==null?void 0:E.toJSONClone({...i,newId:null}))||null,declaration:(b=this.declaration)!=null&&b.id&&this.project.getBuiltIn((A=this.declaration)==null?void 0:A.id)?(_=this.declaration)==null?void 0:_.toJSON(i.seenEntities):((P=this.declaration)==null?void 0:P.toJSONClone({...i,newId:null}))||null,readsValue:((V=this.readsValue)==null?void 0:V.toReference({seenEntityMaps:i.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){var a,c,e,f,h;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,index:this.index,dataType:((c=this.dataType)==null?void 0:c.toReference(i))||null,defaultValue:((e=this.defaultValue)==null?void 0:e.toReference(i))||null,declaration:((f=this.declaration)==null?void 0:f.toReference(i))||null,readsValue:((h=this.readsValue)==null?void 0:h.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.defaultValue?this.defaultValue.toFlatJSON(i):[],...this.dataType?this.dataType.toFlatJSON(i):[],...this.declaration?this.declaration.toFlatJSON(i):[],...this.readsValue?this.readsValue.toFlatJSON(i):[]])}toGenerationTarget(i=at){var a,c;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,name:this.name||void 0,description:this.description||void 0,type:this.type,declaration:((c=this.declaration)==null?void 0:c.id)||null,parent:this.parent.id}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.defaultValue?this.defaultValue.toFlatGenerationTarget(i):[],...this.dataType?this.dataType.toFlatGenerationTarget(i):[],...this.readsValue?this.readsValue.toFlatGenerationTarget(i):[],...this.declaration?this.declaration.toFlatGenerationTarget(i):[]])}clearErrors(){var i;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),this}validate(){return this.errors=QMe(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await JMe(this,{tracker:r}),{success:!0}}getErrors(){var r;return[...this.errors,...((r=this.defaultValue)==null?void 0:r.getErrors())||[]]}async getErrorsAsync(i={}){var e;const r=J.YieldTracker.from(i),a=[...this.errors];await r.tick();const c=await((e=this.defaultValue)==null?void 0:e.getErrorsAsync({tracker:r}));return c&&a.push(...c),a}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.getDefaultValue())||null}setDefaultValue(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose("set-default-value",this.id),this;const a=this.defaultValue;if((a==null?void 0:a.id)!==(i==null?void 0:i.id)){if(a==null||a.remove({ignoreUpstream:!0},r),this.defaultValue=i,this.defaultValue){const c=this.readsValue;this.removeValueWriter(r),c==null||c.removeValueReader(this,r)}r==null||r.add(this,H.Affected)}return r==null||r.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var b;const e=Kr(r,this),f=this.toJSON(),h=a||x.UUID.uuid();f.defaultValue=null,f.id=h,f.version=x.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.deletable=!0,f.editable=!0;const m=lr(f,e);m.hydrateAncestors(),r&&m.setParent(r,i),c&&(m.subscribe(),m.addSelfToProject(i)),m.initChildren(i),i==null||i.add(m,H.Added);const E=(b=this.defaultValue)==null?void 0:b.clone(i,m,x.UUID.uuid(),c);return m.defaultValue=E||null,i||m.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}getDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var c;if(this.parent.type===d.Operation){const e=this.parent.declaration.inferInputMapDataType(this,i);return i==null||i.attemptAutoclose("get-data-type",this.id),e.self}else Mt.includes(this.parent.type)&&Er(this.parent).getDataType(i);const r=(c=this.declaration)==null?void 0:c.getDataType(i);if(!r||!r.entity&&!r.orChildrenGroup&&!r.andChildrenGroup&&!r.foreignKeyRef&&!r.foreignKeyAllowed){const e=tu(this,i);if(e)return i==null||i.attemptAutoclose("get-data-type",this.id),e}return i==null||i.attemptAutoclose("get-data-type",this.id),r||null}getCounterparts(){let i=[];if([d.BreakStatement,d.ContinueStatement].includes(this.parent.type)){const r=this.parent.parent;i=[...r.breakStatements,...r.continueStatements].flatMap(e=>e.outputs).filter(e=>pe(e,this.project)===pe(this,this.project)&&e.id!==this.id)}else if(this.parent.type===d.ReturnStatement&&[d.FunctionDeclaration,d.GlobalEvent].includes(this.parent.parent.type)&&this.parent.parent.implements){const a=this.parent.parent.returnStatements.flatMap(c=>c.outputs);this.declaration?i=a.filter(e=>{var f;return this.declaration.id===((f=e.declaration)==null?void 0:f.id)&&e.id!==this.id}):i=a.filter(e=>pe(e,this.project)===pe(this,this.project)&&e.id!==this.id)}return i}};R(Ci,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(Ci,"type",d.InputMap),R(Ci,"USER_MANAGED_PARENT_TYPES",[..._t,...Dt]),R(Ci,"PARENT_TYPES",[...Ci.USER_MANAGED_PARENT_TYPES]),R(Ci,"MUTABLE_BASE_PROPERTIES",["name","codeName","description"]),R(Ci,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","parentRelationType"]),R(Ci,"BASE_PROPERTIES",[...Ci.MUTABLE_BASE_PROPERTIES,...Ci.INMUTABLE_BASE_PROPERTIES]),R(Ci,"MUTABLE_META_PROPERTIES",[...Ci.MUTABLE_BASE_PROPERTIES,"index"]),R(Ci,"INMUTABLE_META_PROPERTIES",[...Ci.INMUTABLE_BASE_PROPERTIES]),R(Ci,"META_PROPERTIES",[...Ci.MUTABLE_META_PROPERTIES,...Ci.INMUTABLE_META_PROPERTIES]),R(Ci,"MUTABLE_UPSTREAM_PROPERTIES",["readsValue"]),R(Ci,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),R(Ci,"UPSTREAM_PROPERTIES",[...Ci.MUTABLE_UPSTREAM_PROPERTIES,...Ci.INMUTABLE_UPSTREAM_PROPERTIES]),R(Ci,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),R(Ci,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(Ci,"DOWNSTREAM_PROPERTIES",[...Ci.MUTABLE_DOWNSTREAM_PROPERTIES,...Ci.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(Ci,"PROPERTIES",[...Ci.META_PROPERTIES,...Ci.UPSTREAM_PROPERTIES,...Ci.DOWNSTREAM_PROPERTIES]);let Es=Ci;class pDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}class cDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}class fDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"name",null);R(this,"description",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}async function iGe(s,p={}){var f,h;const i=J.YieldTracker.from(p),r=Aa(s),a=ga(s),c=[...r,...a],e=qt(s.errors,c);await i.tick();for(const m of s.inputsDeclarations)await m.validateAsync({tracker:i});for(const m of s.inputs)await m.validateAsync({tracker:i});for(const m of s.outputs)await m.validateAsync({tracker:i});return await((f=s.error)==null?void 0:f.validateAsync({tracker:i})),await((h=s.dataType)==null?void 0:h.validateAsync({tracker:i})),e}function rGe(s){var r,a;s.inputsDeclarations.forEach(c=>c.validate()),s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),(r=s.error)==null||r.validate(),(a=s.dataType)==null||a.validate();const i=[...Aa(s),...ga(s)];return qt(s.errors,i)}const yDi=Object.freeze(Object.defineProperty({__proto__:null,validate:rGe,validateAsync:iGe},Symbol.toStringTag,{value:"Module"}));async function nGe(s,p={}){var a;const i=J.YieldTracker.from(p),r=[...Dn(s),...es(s)];return await i.tick(),await((a=s.dataType)==null?void 0:a.validateAsync({tracker:i})),qt(s.errors,r)}function aGe(s){var i;(i=s.dataType)==null||i.validate();const p=[...Dn(s),...es(s)];return qt(s.errors,p)}const hDi=Object.freeze(Object.defineProperty({__proto__:null,validate:aGe,validateAsync:nGe},Symbol.toStringTag,{value:"Module"}));var sGe=(s=>(s.DataTypeEntity="data-type-entity",s))(sGe||{});const hi=class hi extends pn{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"name");R(this,"codeName",null);R(this,"description",null);R(this,"index");R(this,"required");R(this,"parentRelationType");R(this,"type",d.ValueDescriptor);R(this,"defaultValue",null);R(this,"dataType",null);R(this,"project");R(this,"errors",[]);R(this,"parent");R(this,"detachedDependents",{});R(this,"knownVersions",null);R(this,"activeVersion",!1);R(this,"initialized",!1);R(this,"startedInitialization",!1);R(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=r,this.id=i.id,this.name=i.name,this.description=i.description,this.index=i.index,this.codeName=i.codeName,this.required=i.required,this.parentRelationType=i.parentRelationType}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ValueDescriptor,name:"",codeName:null,description:"",dataType:null,index:0,required:!1,parentRelationType:j.FixedArguments,defaultValue:null,parent:null}}static fromGenerationTarget(i,r,a){const c=a===void 0?r.addChangeSet(new S(r,x.sessionAuthor,B().toISOString(),r,!0,w.CreateFromGenerationTarget)):a,e=i.parent?ie(i.parent):null,f=e?r.get(e):null,h=i.parentRelationType===j.FixedArguments?f==null?void 0:f.inputs.length:null,m={id:i.id,version:x.UUID.uuid(),createdAt:(c==null?void 0:c.timestamp)||B().toISOString(),author:(c==null?void 0:c.author)||x.sessionAuthor,previousVersion:null,deleted:!1,name:i.name,deletable:!0,editable:!0,type:d.ValueDescriptor,index:h||0,codeName:i.codeName,description:i.description,required:i.required,defaultValue:null,parentRelationType:i.parentRelationType,dataType:null,parent:(f==null?void 0:f.toReference())||null},E=Ie(m,r);return E.hydrateAncestors(),f&&E.setParent(f,null),E.addSelfToProject(c),c==null||c.add(E,H.Added),E.initChildren(c),c||E.captureVersion(),E}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));const c=[],e=[],f=Mn(a,{parent:{list:!1,types:hi.USER_MANAGED_PARENT_TYPES}},r);c.push(...f.explanations),a=f.modifiedData;const h=tn(a);e.push(...f.errors,...h.errors),c.push(...h.explanations);const m=a.parent&&r.get(a.parent),E=m&&cu(m);return E&&E.type===d.ActionDescriptor&&e.push(new we({id:`${i.id}--${Te.BuiltInEntityParent}`,code:Te.BuiltInEntityParent,severity:ve.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a parent that is a built-in entity "${E.name}" of type '${E.type}' with id '${E.id}'.
|
|
121
|
+
This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`})),{errors:r,explanations:a,modifiedData:c}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];if(r==="declaration"){const{updated:m,added:E,removed:b}=this.remove({ignoreUpstream:!1},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];if(r==="declaration"){const{updated:m,added:E,removed:b}=this.restore({},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}unsubscribeFromDependencies(){var i,r,a,c,e;return(r=(i=this.declaration)==null?void 0:i.unsubscribeDependents)==null||r.call(i,[{entity:this,field:"declaration"}]),(e=(c=(a=this.dataType)==null?void 0:a.entity)==null?void 0:c.unsubscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),this}subscribeToDependencies(){var i,r,a,c,e;return(r=(i=this.declaration)==null?void 0:i.subscribeDependents)==null||r.call(i,[{entity:this,field:"declaration"}]),(e=(c=(a=this.dataType)==null?void 0:a.entity)==null?void 0:c.subscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new Ci(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new Ci(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.declaration=this.declaration,i.defaultValue=this.defaultValue,i.readsValue=this.readsValue,i.dataType=this.dataType,i.parent=this.parent,i}recursiveCaptureUpstreamVersions(i){const r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,P]of A.knownVersions)E.set(_,P);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new Ci(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.declaration=h.declaration,this.defaultValue=h.defaultValue,this.readsValue=h.readsValue,this.dataType=h.dataType,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),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 a=ie(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.readsValue){const a=ie(i.readsValue),c=this.project.get(a),e=this.readsValue;e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(r),c&&this.setValueWriter(c,r)}else this.removeValueWriter(r);if(i.declaration){const a=ie(i.declaration),c=this.project.get(a);c&&this.setDeclaration(c,r)}else this.setDeclaration(null,r);if(i.dataType){const a=ie(i.dataType),c=this.project.get(a);c&&this.setDataType(c,r)}else this.setDataType(null,r);if(i.defaultValue){const a=ie(i.defaultValue),c=this.project.get(a);c&&this.setDefaultValue(c,r)}else this.setDefaultValue(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent){const a=ie(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}if(i.readsValue){const a=ie(i.readsValue),c=this.project.get(a),e=this.readsValue;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(r),c)this.setValueWriter(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'readsValue' reference '${a}' that isn't found in the project`)}else i.readsValue===null&&this.removeValueWriter(r);if(i.declaration){const a=ie(i.declaration),c=this.project.get(a);if(c)this.setDeclaration(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${a}' that isn't found in the project`)}else i.declaration===null&&this.setDeclaration(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent){const e=ie(this.initialData.parent),f=this.project.get(e);if(f)this.setParent(f,null),i.push(f);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.readsValue){const e=ie(this.initialData.readsValue),f=this.project.get(e);f&&(this.setValueWriter(f,null),i.push(f))}if(this.initialData.declaration){const e=ie(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f,null),i.push(f))}return{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){var b,A,_,P;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(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];this.initialized=!0;let f=((b=this.declaration)==null?void 0:b.index)??this.index??0;const h=(Dt.includes(this.parent.type)?this.parent.outputs:this.parent.inputs).filter(V=>!V.deleted&&V.id!==this.id);h.length&&(f>h.length+1?f=h.length:f<0&&(f=0)),h.find(V=>(V.index||0)===f&&!V.deleted)&&h.filter(V=>(V.index||0)>=f&&!V.deleted).forEach(V=>{V.metaSync({index:(V.index||0)+1},i),i==null||i.add(V,H.Updated),r.push(V)});const E=this.parent.type===d.VariableInstance&&((A=this.declaration)==null?void 0:A.type)===d.Property&&((_=this.declaration)==null?void 0:_.constant);if(E&&this.readsValue&&(this.readsValue.removeValueReader(this,i),this.removeValueWriter(i)),E&&this.defaultValue&&this.defaultValue.remove({ignoreUpstream:!1},i),this.readsValue&&this.defaultValue&&(this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)||this.defaultValue.remove({ignoreUpstream:!1},i),this.setDefaultValue(null,i)),this.defaultValue&&!this.readsValue&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.id)&&this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)){const V=this.defaultValue.clone(i,this);this.setDefaultValue(V,i)}return this.readsValue&&this.parent.type===d.VariableDeclaration&&((P=this.parent.parent)==null?void 0:P.type)===d.Project&&(i==null||i.event({id:`${w.RemoveValueWriter}-${this.id}--${Me.InputsInGlobalVariableDeclarationsCannotReadValues}`,action:w.RemoveValueWriter,owner:this,errorReason:Me.InputsInGlobalVariableDeclarationsCannotReadValues,rootAction:!1}),this.readsValue.removeValueReader(this,i),this.removeValueWriter(i)),this.metaSync({index:f},i),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){var f;const r=[this],a=[],c=[],e=[];return Dt.includes(this.parent.type)?this.parentRelationType===od.Error?this.parent.setThrows(this,i):this.parent.addOutput(this,i):this.parent.addInput(this,i),e.push(this.parent),(f=this.readsValue)==null||f.addValueReader(this,i),this.readsValue&&r.push(this.readsValue),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}setParent(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,H.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setDataType(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetDataType))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[setDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetDataType,this.id),this;const a=this.dataType;return(a==null?void 0:a.id)!==(i==null?void 0:i.id)&&(a==null||a.remove({ignoreUpstream:!0},r),this.dataType=i,this.subscribeToDependencies(),r==null||r.add(this,H.Affected)),r==null||r.attemptAutoclose(w.SetDataType,this.id),this}removeDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveDataType))){return this.checkCanEdit(this,i)?(this.dataType&&(this.dataType.remove({ignoreUpstream:!0},i),i==null||i.add(this,H.Affected),this.dataType=null),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this):(J.Logger.warn(`[removeDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this)}setDeclaration(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"set-declaration"))){var a;return((a=this.declaration)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.declaration=i,this.subscribeToDependencies(),r&&(r==null||r.add(this,H.Updated))),r==null||r.attemptAutoclose("set-declaration",this.id),this}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=Ie(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.declaration&&(this.declaration=Ie(this.initialData.declaration,this.project)),uy.initReadsValue(this),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}setValueWriter(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueWriter))){var c,e,f,h,m,E,b;return this.checkCanEditFromScopeOwnerWithSideEffects(this,w.SetValueWriter,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.SetValueWriter}-${this.id}`,action:w.SetValueWriter,owner:this,errorReason:Me.CannotValueWriteItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.actionName)===w.SetValueWriter})),this.parent.type===d.VariableInstance&&((e=this.declaration)==null?void 0:e.type)===d.Property&&((f=this.declaration)==null?void 0:f.constant)&&i?(r==null||r.event({id:`${w.SetValueWriter}-${this.id}--${i.id}`,action:w.SetValueWriter,owner:this,counterpart:i,errorReason:Me.ValueReadingOverridesConstantVariable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===w.SetValueWriter}),r==null||r.attemptAutoclose(w.SetValueWriter,this.id),this):(((m=this.readsValue)==null?void 0:m.id)!==(i==null?void 0:i.id)&&(this.readsValue=i,this.readsValue&&((E=this.defaultValue)==null||E.remove({ignoreUpstream:!1},r),this.parent.type===d.Search&&((b=this.declaration)==null||b.setDefaultValue(null,r))),r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose(w.SetValueWriter,this.id),this)):this}removeValueWriter(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveValueWriter))){return this.readsValue&&!this.checkCanEditFromScopeOwnerWithSideEffects(this,w.RemoveValueWriter,i)?this:(this.readsValue&&(this.readsValue=null,i==null||i.add(this,H.Updated)),i==null||i.attemptAutoclose(w.RemoveValueWriter,this.id),this)}subscribe(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=nn(this,i,r),c=rn(this,a),e=this.toMeta();return this.index=a.index||(a.index!==0?e.index:0),this.name=a.name!==void 0?a.name:e.name,this.codeName=a.codeName!==void 0?a.codeName:e.codeName,this.description=a.description!==void 0?a.description:e.description,this.parentRelationType=a.parentRelationType!==void 0?a.parentRelationType:this.parentRelationType,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,H.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,H.Added):c&&(r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ze,...r){return await Ci.repository.APILoad(this.id,...r),this}async APICreate(i=Ze,...r){return await Ci.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ze,...r){return await Ci.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ze,...r){return await Ci.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ze,...r){return await Ci.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ze,r,...a){return await Ci.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){var f;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(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return Dt.includes((f=this.parent)==null?void 0:f.type)?this.parentRelationType===od.Error?(this.parent.setThrows(null,i),e.push(this.parent)):(this.parent.removeOutput(this,i),e.push(this.parent)):(this.parent.removeInput(this,i),e.push(this.parent)),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h,m,E,b,A;if(this.deleted)return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(!this.checkCanDelete(this,r))return J.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Me.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Me.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.metaSync({deleted:!0},r),r!=null&&r.hasAdded(this.id)||this.project.subscribeDeletedInstance(this),Object.values(this.detachedDependents).forEach(_=>{const{updated:P,removed:V,added:M}=_.entity.onDetachedDependencyRemoved(this,_.field,r);a.push(...P),c.push(...V),e.push(...M)}),this.defaultValue){const{updated:_,removed:P}=this.defaultValue.remove({ignoreUpstream:!0},r);a.push(..._),c.push(...P)}if(this.readsValue&&(a.push(this.readsValue),this.readsValue.removeValueReader(this,r)),this.defaultValue&&(a.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0},r)),this.declaration){if(this.declaration.type===d.Property&&((m=this.declaration.parent)==null?void 0:m.type)===d.DefinitionEntity&&((b=(E=this.declaration.parent)==null?void 0:E.parent)==null?void 0:b.type)===d.DataType&&!(r!=null&&r.hasRemoved(this.declaration.id))&&!this.declaration.deleted&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.declaration.id)){const{updated:_,removed:P}=this.declaration.remove({ignoreUpstream:!1},r);a.push(..._),c.push(...P)}else if(this.declaration.type===d.ValueDescriptor&&((A=this.declaration.parent)==null?void 0:A.type)===d.Search&&!(r!=null&&r.hasRemoved(this.declaration.id))&&!this.declaration.deleted&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.declaration.id)){const{updated:_,removed:P}=this.declaration.remove({ignoreUpstream:!1},r);a.push(..._),c.push(...P)}}if(!i){const _=this.removeFromParent(r);e.push(..._.added),a.push(..._.updated),c.push(..._.removed),f.push(..._.affected)}if(!i&&this.parent&&[d.BreakStatement,d.ContinueStatement].includes(this.parent.type)&&this.parent.parent&&this.parent.parent.type===d.Loop&&this.parent.initialized&&this.parent.parent.syncFromDataType(r),this.parentRelationType===od.Error&&this.parent.type===d.ReturnStatement){const{updated:_,added:P,removed:V,affected:M}=this.parent.syncInputs(r);a.push(..._),e.push(...P),c.push(...V),f.push(...M)}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.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(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(w.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(f=>{const{updated:h,removed:m,added:E}=f.entity.onDetachedDependencyRestored(this,f.field,i);a.push(...h),c.push(...m),r.push(...E)}),this.defaultValue){const{updated:f}=this.defaultValue.restore({},i);a.push(...f)}return this.readsValue&&(a.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.defaultValue&&(a.push(this.defaultValue),this.defaultValue.restore({},i)),e.push(this.parent),this.parent.addInput(this,i),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this}}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.defaultValue?this.defaultValue.toFlat(i):[],...this.dataType?this.dataType.toFlat(i):[],...this.declaration?this.declaration.toFlat(i):[],...this.readsValue?this.readsValue.toFlat(i):[]])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.defaultValue?this.defaultValue.toFlatIds(i):[],...this.dataType?this.dataType.toFlatIds(i):[],...this.declaration?this.declaration.toFlatIds(i):[],...this.readsValue?this.readsValue.toFlatIds(i):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,index:this.index,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(i=new Set){var r,a,c,e;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,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,defaultValue:((r=this.defaultValue)==null?void 0:r.toJSON(i))||null,dataType:((a=this.dataType)==null?void 0:a.toJSON(i))||null,declaration:((c=this.declaration)==null?void 0:c.toJSON(i))||null,readsValue:((e=this.readsValue)==null?void 0:e.toReference())||null,parent:this.parent.toReference()})}toJSONClone(i=at){var a,c,e,f,h,m,E,b,A,_,P,V;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||un(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:x.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,defaultValue:((m=this.defaultValue)==null?void 0:m.toJSONClone({...i,newId:null}))||null,dataType:((E=this.dataType)==null?void 0:E.toJSONClone({...i,newId:null}))||null,declaration:(b=this.declaration)!=null&&b.id&&this.project.getBuiltIn((A=this.declaration)==null?void 0:A.id)?(_=this.declaration)==null?void 0:_.toJSON(i.seenEntities):((P=this.declaration)==null?void 0:P.toJSONClone({...i,newId:null}))||null,readsValue:((V=this.readsValue)==null?void 0:V.toReference({seenEntityMaps:i.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){var a,c,e,f,h;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,codeName:this.codeName,description:this.description,parentRelationType:this.parentRelationType,index:this.index,dataType:((c=this.dataType)==null?void 0:c.toReference(i))||null,defaultValue:((e=this.defaultValue)==null?void 0:e.toReference(i))||null,declaration:((f=this.declaration)==null?void 0:f.toReference(i))||null,readsValue:((h=this.readsValue)==null?void 0:h.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.defaultValue?this.defaultValue.toFlatJSON(i):[],...this.dataType?this.dataType.toFlatJSON(i):[],...this.declaration?this.declaration.toFlatJSON(i):[],...this.readsValue?this.readsValue.toFlatJSON(i):[]])}toGenerationTarget(i=at){var a,c;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,name:this.name||void 0,description:this.description||void 0,type:this.type,declaration:((c=this.declaration)==null?void 0:c.id)||null,parent:this.parent.id}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.defaultValue?this.defaultValue.toFlatGenerationTarget(i):[],...this.dataType?this.dataType.toFlatGenerationTarget(i):[],...this.readsValue?this.readsValue.toFlatGenerationTarget(i):[],...this.declaration?this.declaration.toFlatGenerationTarget(i):[]])}clearErrors(){var i;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),this}validate(){return this.errors=QMe(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await JMe(this,{tracker:r}),{success:!0}}getErrors(){var r;return[...this.errors,...((r=this.defaultValue)==null?void 0:r.getErrors())||[]]}async getErrorsAsync(i={}){var e;const r=J.YieldTracker.from(i),a=[...this.errors];await r.tick();const c=await((e=this.defaultValue)==null?void 0:e.getErrorsAsync({tracker:r}));return c&&a.push(...c),a}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.getDefaultValue())||null}setDefaultValue(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose("set-default-value",this.id),this;const a=this.defaultValue;if((a==null?void 0:a.id)!==(i==null?void 0:i.id)){if(a==null||a.remove({ignoreUpstream:!0},r),this.defaultValue=i,this.defaultValue){const c=this.readsValue;this.removeValueWriter(r),c==null||c.removeValueReader(this,r)}r==null||r.add(this,H.Affected)}return r==null||r.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var b;const e=Kr(r,this),f=this.toJSON(),h=a||x.UUID.uuid();f.defaultValue=null,f.id=h,f.version=x.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.deletable=!0,f.editable=!0;const m=lr(f,e);m.hydrateAncestors(),r&&m.setParent(r,i),c&&(m.subscribe(),m.addSelfToProject(i)),m.initChildren(i),i==null||i.add(m,H.Added);const E=(b=this.defaultValue)==null?void 0:b.clone(i,m,x.UUID.uuid(),c);return m.defaultValue=E||null,i||m.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}getDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var c;if(this.parent.type===d.Operation){const e=this.parent.declaration.inferInputMapDataType(this,i);return i==null||i.attemptAutoclose("get-data-type",this.id),e.self}else Mt.includes(this.parent.type)&&Er(this.parent).getDataType(i);const r=(c=this.declaration)==null?void 0:c.getDataType(i);if(!r||!r.entity&&!r.orChildrenGroup&&!r.andChildrenGroup&&!r.foreignKeyRef&&!r.foreignKeyAllowed){const e=tu(this,i);if(e)return i==null||i.attemptAutoclose("get-data-type",this.id),e}return i==null||i.attemptAutoclose("get-data-type",this.id),r||null}getCounterparts(){let i=[];if([d.BreakStatement,d.ContinueStatement].includes(this.parent.type)){const r=this.parent.parent;i=[...r.breakStatements,...r.continueStatements].flatMap(e=>e.outputs).filter(e=>pe(e,this.project)===pe(this,this.project)&&e.id!==this.id)}else if(this.parent.type===d.ReturnStatement&&[d.FunctionDeclaration,d.GlobalEvent].includes(this.parent.parent.type)&&this.parent.parent.implements){const a=this.parent.parent.returnStatements.flatMap(c=>c.outputs);this.declaration?i=a.filter(e=>{var f;return this.declaration.id===((f=e.declaration)==null?void 0:f.id)&&e.id!==this.id}):i=a.filter(e=>pe(e,this.project)===pe(this,this.project)&&e.id!==this.id)}return i}};R(Ci,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(Ci,"type",d.InputMap),R(Ci,"USER_MANAGED_PARENT_TYPES",[..._t,...Dt]),R(Ci,"PARENT_TYPES",[...Ci.USER_MANAGED_PARENT_TYPES]),R(Ci,"MUTABLE_BASE_PROPERTIES",["name","codeName","description"]),R(Ci,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","parentRelationType"]),R(Ci,"BASE_PROPERTIES",[...Ci.MUTABLE_BASE_PROPERTIES,...Ci.INMUTABLE_BASE_PROPERTIES]),R(Ci,"MUTABLE_META_PROPERTIES",[...Ci.MUTABLE_BASE_PROPERTIES,"index"]),R(Ci,"INMUTABLE_META_PROPERTIES",[...Ci.INMUTABLE_BASE_PROPERTIES]),R(Ci,"META_PROPERTIES",[...Ci.MUTABLE_META_PROPERTIES,...Ci.INMUTABLE_META_PROPERTIES]),R(Ci,"MUTABLE_UPSTREAM_PROPERTIES",["readsValue"]),R(Ci,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),R(Ci,"UPSTREAM_PROPERTIES",[...Ci.MUTABLE_UPSTREAM_PROPERTIES,...Ci.INMUTABLE_UPSTREAM_PROPERTIES]),R(Ci,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),R(Ci,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(Ci,"DOWNSTREAM_PROPERTIES",[...Ci.MUTABLE_DOWNSTREAM_PROPERTIES,...Ci.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(Ci,"PROPERTIES",[...Ci.META_PROPERTIES,...Ci.UPSTREAM_PROPERTIES,...Ci.DOWNSTREAM_PROPERTIES]);let Es=Ci;class pDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}class cDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}class fDi extends Es{constructor(i,r){super(i,r);R(this,"parentRelationType",null);R(this,"name",null);R(this,"description",null);R(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}async function iGe(s,p={}){var f,h;const i=J.YieldTracker.from(p),r=Aa(s),a=ga(s),c=[...r,...a],e=qt(s.errors,c);await i.tick();for(const m of s.inputsDeclarations)await m.validateAsync({tracker:i});for(const m of s.inputs)await m.validateAsync({tracker:i});for(const m of s.outputs)await m.validateAsync({tracker:i});return await((f=s.error)==null?void 0:f.validateAsync({tracker:i})),await((h=s.dataType)==null?void 0:h.validateAsync({tracker:i})),e}function rGe(s){var r,a;s.inputsDeclarations.forEach(c=>c.validate()),s.inputs.forEach(c=>c.validate()),s.outputs.forEach(c=>c.validate()),(r=s.error)==null||r.validate(),(a=s.dataType)==null||a.validate();const i=[...Aa(s),...ga(s)];return qt(s.errors,i)}const yDi=Object.freeze(Object.defineProperty({__proto__:null,validate:rGe,validateAsync:iGe},Symbol.toStringTag,{value:"Module"}));async function nGe(s,p={}){var a;const i=J.YieldTracker.from(p),r=[...Dn(s),...es(s)];return await i.tick(),await((a=s.dataType)==null?void 0:a.validateAsync({tracker:i})),qt(s.errors,r)}function aGe(s){var i;(i=s.dataType)==null||i.validate();const p=[...Dn(s),...es(s)];return qt(s.errors,p)}const hDi=Object.freeze(Object.defineProperty({__proto__:null,validate:aGe,validateAsync:nGe},Symbol.toStringTag,{value:"Module"}));var sGe=(s=>(s.DataTypeEntity="data-type-entity",s))(sGe||{});const hi=class hi extends pn{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"name");R(this,"codeName",null);R(this,"description",null);R(this,"index");R(this,"required");R(this,"parentRelationType");R(this,"type",d.ValueDescriptor);R(this,"defaultValue",null);R(this,"dataType",null);R(this,"project");R(this,"errors",[]);R(this,"parent");R(this,"detachedDependents",{});R(this,"knownVersions",null);R(this,"activeVersion",!1);R(this,"initialized",!1);R(this,"startedInitialization",!1);R(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=r,this.id=i.id,this.name=i.name,this.description=i.description,this.index=i.index,this.codeName=i.codeName,this.required=i.required,this.parentRelationType=i.parentRelationType}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ValueDescriptor,name:"",codeName:null,description:"",dataType:null,index:0,required:!1,parentRelationType:j.FixedArguments,defaultValue:null,parent:null}}static fromGenerationTarget(i,r,a){const c=a===void 0?r.addChangeSet(new S(r,x.sessionAuthor,B().toISOString(),r,!0,w.CreateFromGenerationTarget)):a,e=i.parent?ie(i.parent):null,f=e?r.get(e):null,h=i.parentRelationType===j.FixedArguments?f==null?void 0:f.inputs.length:null,m={id:i.id,version:x.UUID.uuid(),createdAt:(c==null?void 0:c.timestamp)||B().toISOString(),author:(c==null?void 0:c.author)||x.sessionAuthor,previousVersion:null,deleted:!1,name:i.name,deletable:!0,editable:!0,type:d.ValueDescriptor,index:h||0,codeName:i.codeName,description:i.description,required:i.required,defaultValue:null,parentRelationType:i.parentRelationType,dataType:null,parent:(f==null?void 0:f.toReference())||null},E=Ie(m,r);return E.hydrateAncestors(),f&&E.setParent(f,null),E.addSelfToProject(c),c==null||c.add(E,H.Added),E.initChildren(c),c||E.captureVersion(),E}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));const c=[],e=[],f=Mn(a,{parent:{list:!1,types:hi.USER_MANAGED_PARENT_TYPES}},r);c.push(...f.explanations),a=f.modifiedData;const h=tn(a);e.push(...f.errors,...h.errors),c.push(...h.explanations);const m=a.parent&&r.get(a.parent),E=m&&cu(m);return E&&E.type===d.ActionDescriptor&&e.push(new we({id:`${i.id}--${Te.BuiltInEntityParent}`,code:Te.BuiltInEntityParent,severity:ve.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a parent that is a built-in entity "${E.name}" of type '${E.type}' with id '${E.id}'.
|
|
122
122
|
You can't modify system entities that are built-in.`})),m&&m.type===d.ActionDescriptor&&(!a.parentRelationType||!(a.parentRelationType===j.FixedArguments||a.parentRelationType===j.ReturnedError||a.parentRelationType===j.DynamicArgument))&&e.push(new we({id:`${i.id}--${Te.InvalidParentRelationType}`,code:Te.InvalidParentRelationType,severity:ve.Error,message:`The entity with id '${i.id}' and type '${i.type}', must have a 'parentRelationType' property set to either '${j.FixedArguments}' or '${j.ReturnedError}' when being added as a child to an entity of type 'action-descriptor'.`})),{errors:e,explanations:c,modifiedData:a}}get codeNativeValueValidation(){return this._codeNativeValueValidation||null}validateGeneratedUpdate(i){return{errors:[],explanations:[],modifiedData:i}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}unsubscribeFromDependencies(){var i,r,a;return(a=(r=(i=this.dataType)==null?void 0:i.entity)==null?void 0:r.unsubscribeDependents)==null||a.call(r,[{entity:this,field:"data-type-entity"}]),this}subscribeToDependencies(){var i,r,a;return(a=(r=(i=this.dataType)==null?void 0:i.entity)==null?void 0:r.subscribeDependents)==null||a.call(r,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new hi(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new hi(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.defaultValue=this.defaultValue,i.dataType=this.dataType,i.parent=this.parent,i}recursiveCaptureUpstreamVersions(i){const r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,P]of A.knownVersions)E.set(_,P);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new hi(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.defaultValue=h.defaultValue,this.dataType=h.dataType,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),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 a=ie(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.dataType){const a=ie(i.dataType),c=this.project.get(a);c&&this.setDataType(c,r)}else this.setDataType(null,r);if(i.defaultValue){const a=ie(i.defaultValue),c=this.project.get(a);c&&this.setDefaultValue(c,r)}else this.setDefaultValue(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent){const a=ie(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent){const e=ie(this.initialData.parent),f=this.project.get(e);if(f)this.setParent(f,null),i.push(f);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'`);return{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){var f;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(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(this.defaultValue&&!this.project.diggestedBuiltInBaseEntitiesIds.has(this.id)&&this.project.diggestedBuiltInBaseEntitiesIds.has(this.defaultValue.id)){const h=this.defaultValue.clone(i,this);this.setDefaultValue(h,i)}if(((f=this.parent)==null?void 0:f.type)===d.Search){const h=this.parent.inputs.find(m=>{var E;return((E=m.declaration)==null?void 0:E.id)===this.id});h!=null&&h.readsValue&&this.setDefaultValue(null,i)}return this.initialized=!0,i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){var f,h,m;const r=[this],a=[],c=[],e=[];return this.parentRelationType===j.FixedArguments||this.parentRelationType===j.DynamicArgument?((f=this.parent)==null?void 0:f.type)===d.Search?(this.parent.addInputDeclaration(this,i),e.push(this.parent)):((m=(h=this.parent)==null?void 0:h.addInput)==null||m.call(h,this,i),r.push(this.parent)):this.parentRelationType===j.ReturnedError&&this.parent&&(this.parent.error=this,e.push(this.parent)),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}setParent(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,H.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=Ie(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.dataType&&(this.dataType=Ie(this.initialData.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(i)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=nn(this,i,r),c=rn(this,a),e=this.toMeta();return this.name=a.name!==void 0?a.name:e.name,this.codeName=a.codeName!==void 0?a.codeName:e.codeName,this.description=a.description!==void 0?a.description:e.description,this.index=a.index||(a.index!==0?e.index:0),this.required=a.required!==void 0?a.required:this.required,this.parentRelationType=a.parentRelationType!==void 0?a.parentRelationType:this.parentRelationType,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,H.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,H.Added):c&&(r==null||r.add(this,H.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ze,...r){return await hi.repository.APILoad(this.id,...r),this}async APICreate(i=Ze,...r){return await hi.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ze,...r){return await hi.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ze,...r){return await hi.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ze,...r){return await hi.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ze,r,...a){return await hi.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){var f,h,m;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(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.parent&&(((f=this.parent)==null?void 0:f.type)===d.Search?this.parentRelationType===j.FixedArguments||this.parentRelationType===j.DynamicArgument?((h=this.parent)==null||h.removeInputDeclaration(this,i),e.push(this.parent)):this.parentRelationType===j.ReturnedError&&(this.parent.error=null,e.push(this.parent)):(this.parentRelationType===j.FixedArguments||this.parentRelationType===j.DynamicArgument)&&((m=this.parent)==null||m.removeInput(this,i),e.push(this.parent))),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return J.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Me.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Me.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.actionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.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},r),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:b,added:A}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...A)}),this.defaultValue){const{updated:m,removed:E}=this.defaultValue.remove({ignoreUpstream:!0},r);a.push(...m),c.push(...E)}if(this.dataType){const{updated:m,removed:E}=this.dataType.remove({ignoreUpstream:!0},r);a.push(...m),c.push(...E)}if(!i){const m=this.removeFromParent(r);e.push(...m.added),a.push(...m.updated),c.push(...m.removed),f.push(...m.affected)}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){var f,h,m;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(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(w.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(E=>{const{updated:b,removed:A,added:_}=E.entity.onDetachedDependencyRestored(this,E.field,i);a.push(...b),c.push(...A),r.push(..._)}),this.defaultValue){const{updated:E}=this.defaultValue.restore({},i);a.push(...E)}if(this.dataType){const{updated:E}=this.dataType.restore({},i);a.push(...E)}return((f=this.parent)==null?void 0:f.type)===d.Search?(this.parentRelationType===j.FixedArguments||this.parentRelationType===j.DynamicArgument)&&((h=this.parent)==null||h.addInputDeclaration(this,i)):(this.parentRelationType===j.FixedArguments||this.parentRelationType===j.DynamicArgument)&&((m=this.parent)==null||m.addInput(this,i)),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this}}toFlat(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this,...((a=this.defaultValue)==null?void 0:a.toFlat(i))||[],...this.dataType?this.dataType.toFlat(i):[]])}toFlatIds(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((a=this.defaultValue)==null?void 0:a.toFlatIds(i))||[],...this.dataType?this.dataType.toFlatIds(i):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,codeName:this.codeName,description:this.description,index:this.index,required:this.required,parentRelationType:this.parentRelationType,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(i=new Set){var r,a,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,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,codeName:this.codeName,description:this.description,index:this.index,required:this.required,defaultValue:((r=this.defaultValue)==null?void 0:r.toJSON(i))||null,parentRelationType:this.parentRelationType,dataType:((a=this.dataType)==null?void 0:a.toJSON(i))||null,parent:((c=this.parent)==null?void 0:c.toReference())||null})}toJSONClone(i=at){var a,c,e,f,h,m,E,b;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||un(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:x.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,codeName:this.codeName,description:this.description,index:this.index,required:this.required,defaultValue:((m=this.defaultValue)==null?void 0:m.toJSONClone({...i,newId:null}))||null,parentRelationType:this.parentRelationType,dataType:((E=this.dataType)==null?void 0:E.toJSONClone({...i,newId:null}))||null,parent:((b=this.parent)==null?void 0:b.toReference({seenEntityMaps:i.seenEntityMaps}))||null})}toReference(i=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){var a,c,e,f;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,codeName:this.codeName,description:this.description,index:this.index,required:this.required,parentRelationType:this.parentRelationType,defaultValue:((c=this.defaultValue)==null?void 0:c.toReference(i))||null,dataType:((e=this.dataType)==null?void 0:e.toReference(i))||null,parent:((f=this.parent)==null?void 0:f.toReference(i))||null}}toFlatJSON(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((a=this.defaultValue)==null?void 0:a.toFlatJSON(i))||[],...this.dataType?this.dataType.toFlatJSON(i):[]])}toGenerationTarget(i=at){var a,c;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,name:this.name,codeName:this.codeName,description:this.description,type:this.type,required:this.required,parentRelationType:this.parentRelationType,parent:(c=this.parent)==null?void 0:c.id}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.defaultValue?this.defaultValue.toFlatGenerationTarget(i):[],...this.dataType?this.dataType.toFlatGenerationTarget(i):[]])}clearErrors(){var i,r;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),(r=this.dataType)==null||r.clearErrors(),this}validate(){return this.errors=aGe(this),{success:!0}}async validateAsync(i={}){const r=J.YieldTracker.from(i);return this.errors=await nGe(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors,...this.dataType?this.dataType.getErrors():[]]}async getErrorsAsync(i={}){const r=J.YieldTracker.from(i),a=[...this.errors];if(await r.tick(),this.dataType){const c=await this.dataType.getErrorsAsync({tracker:r});a.push(...c)}return a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var A,_;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;const e=Kr(r,this),f=a||x.UUID.uuid(),h=this.toJSON();h.id=f,h.version=x.UUID.uuid(),h.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),h.author=(i==null?void 0:i.author)||"1",h.previousVersion=null,h.deleted=!1,h.deletable=!0,h.editable=!0;const m=lr(h,e);r&&m.setParent(r,i),i==null||i.add(m,H.Added),c&&m.subscribe();const E=((A=this.dataType)==null?void 0:A.clone(i,m,x.UUID.uuid(),c))||null;E&&m.setDataType(E,i);const b=(_=this.defaultValue)==null?void 0:_.clone(i,m,x.UUID.uuid(),c);return m.defaultValue=b||null,i||m.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}getDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){return i==null||i.attemptAutoclose("get-data-type",this.id),this.dataType||null}setDataType(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetDataType))){if(!this.checkCanEdit(this,r))return J.Logger.warn(`[setDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetDataType,this.id),this;const a=this.dataType;return(a==null?void 0:a.id)!==(i==null?void 0:i.id)&&(a==null||a.remove({ignoreUpstream:!0},r),this.dataType=i,this.subscribeToDependencies(),r==null||r.add(this,H.Affected)),r==null||r.attemptAutoclose(w.SetDataType,this.id),this}getDefaultValue(){return this.defaultValue||null}setDefaultValue(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"set-default-value"))){var c;if(!this.checkCanEdit(this,r))return J.Logger.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose("set-default-value",this.id),this;const a=this.defaultValue;if((a==null?void 0:a.id)!==(i==null?void 0:i.id)){if(a==null||a.remove({ignoreUpstream:!0},r),this.defaultValue=i,this.defaultValue&&((c=this.parent)==null?void 0:c.type)===d.Search){const e=this.parent.inputs.find(f=>f.declaration.id===this.id);if(e!=null&&e.readsValue){const f=e.readsValue;e.removeValueWriter(r),f==null||f.removeValueReader(e,r)}}r==null||r.add(this,H.Affected)}return r==null||r.attemptAutoclose("set-default-value",this.id),this}removeDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveDataType))){return this.checkCanEdit(this,i)?(this.dataType&&(this.dataType.remove({ignoreUpstream:!0},i),i==null||i.add(this,H.Affected),this.dataType=null),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this):(J.Logger.warn(`[removeDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this)}implementAsInputMap(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"implement-as-input-map")),r,a){const c=Es.new(i);c.id=a||c.id,c.name=this.name,c.description=this.description,c.parent=r.toReference(),c.declaration=this.toJSON(),c.parentRelationType=this.parentRelationType===j.ReturnedError?od.Error:null;const e=lr(c,this.project);if(e.hydrateAncestors(),e.addSelfToProject(i),i==null||i.add(e,H.Added),e.initChildren(i),this.dataType){const f=this.dataType.clone(i,e);e.setDataType(f,i)}if(this.defaultValue){const f=this.defaultValue.clone(i,e);e.setDefaultValue(f,i)}return i||e.captureVersion(),i==null||i.attemptAutoclose("implement-as-input-map",this.id),e}implementAsArgumentDeclaration(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"implement-as-argument-declaration")),r,a){const c=Ha.new(i);c.id=a||c.id,c.name=this.name,c.description=this.description,c.parent=r.toReference(),c.implements=[this.toJSON()];const e=lr(c,this.project);if(e.hydrateAncestors(),e.addSelfToProject(i),i==null||i.add(e,H.Added),e.initChildren(i),this.dataType){const f=this.dataType.clone(i,e);e.setDataType(f,i)}if(this.defaultValue){const f=this.defaultValue.clone(i,e);e.setDefaultValue(f,i)}return i||e.captureVersion(),i==null||i.attemptAutoclose("implement-as-argument-declaration",this.id),e}};R(hi,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(hi,"type",d.ValueDescriptor),R(hi,"USER_MANAGED_PARENT_TYPES",[d.ActionDescriptor,d.Search]),R(hi,"PARENT_TYPES",[...hi.USER_MANAGED_PARENT_TYPES]),R(hi,"MUTABLE_BASE_PROPERTIES",["name","codeName","description","required"]),R(hi,"INMUTABLE_BASE_PROPERTIES",["id","version","type","parentRelationType","createdAt","author","previousVersion"]),R(hi,"BASE_PROPERTIES",[...hi.MUTABLE_BASE_PROPERTIES,...hi.INMUTABLE_BASE_PROPERTIES]),R(hi,"MUTABLE_META_PROPERTIES",[...hi.MUTABLE_BASE_PROPERTIES,"index"]),R(hi,"INMUTABLE_META_PROPERTIES",[...hi.INMUTABLE_BASE_PROPERTIES]),R(hi,"META_PROPERTIES",[...hi.MUTABLE_META_PROPERTIES,...hi.INMUTABLE_META_PROPERTIES]),R(hi,"MUTABLE_UPSTREAM_PROPERTIES",[]),R(hi,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),R(hi,"UPSTREAM_PROPERTIES",[...hi.MUTABLE_UPSTREAM_PROPERTIES,...hi.INMUTABLE_UPSTREAM_PROPERTIES]),R(hi,"MUTABLE_DOWNSTREAM_PROPERTIES",["dataType","defaultValue"]),R(hi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(hi,"DOWNSTREAM_PROPERTIES",[...hi.MUTABLE_DOWNSTREAM_PROPERTIES,...hi.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(hi,"PROPERTIES",[...hi.META_PROPERTIES,...hi.UPSTREAM_PROPERTIES,...hi.DOWNSTREAM_PROPERTIES]);let vd=hi;var Ep={},lGe={},oGe={};Object.defineProperty(oGe,"__esModule",{value:!0});var dGe={};Object.defineProperty(dGe,"__esModule",{value:!0});var uGe={};Object.defineProperty(uGe,"__esModule",{value:!0});var pGe={};Object.defineProperty(pGe,"__esModule",{value:!0});var cGe={};Object.defineProperty(cGe,"__esModule",{value:!0});var fGe={};Object.defineProperty(fGe,"__esModule",{value:!0});var yGe={};Object.defineProperty(yGe,"__esModule",{value:!0});var hGe={};Object.defineProperty(hGe,"__esModule",{value:!0});var mGe={};Object.defineProperty(mGe,"__esModule",{value:!0});var TGe={};Object.defineProperty(TGe,"__esModule",{value:!0});var vGe={};Object.defineProperty(vGe,"__esModule",{value:!0});var EGe={};Object.defineProperty(EGe,"__esModule",{value:!0});var bGe={};Object.defineProperty(bGe,"__esModule",{value:!0});var AGe={};Object.defineProperty(AGe,"__esModule",{value:!0});var gGe={};Object.defineProperty(gGe,"__esModule",{value:!0});var IGe={};Object.defineProperty(IGe,"__esModule",{value:!0});var RGe={};Object.defineProperty(RGe,"__esModule",{value:!0});var DGe={};Object.defineProperty(DGe,"__esModule",{value:!0});var wGe={};Object.defineProperty(wGe,"__esModule",{value:!0});var CGe={};Object.defineProperty(CGe,"__esModule",{value:!0});var OGe={};Object.defineProperty(OGe,"__esModule",{value:!0});var _Ge={};Object.defineProperty(_Ge,"__esModule",{value:!0});var VGe={};Object.defineProperty(VGe,"__esModule",{value:!0});var PGe={};Object.defineProperty(PGe,"__esModule",{value:!0});var NGe={};Object.defineProperty(NGe,"__esModule",{value:!0});var xGe={};Object.defineProperty(xGe,"__esModule",{value:!0});var $Ge={};Object.defineProperty($Ge,"__esModule",{value:!0});var LGe={};Object.defineProperty(LGe,"__esModule",{value:!0});var BGe={};Object.defineProperty(BGe,"__esModule",{value:!0});var MGe={};Object.defineProperty(MGe,"__esModule",{value:!0});var GGe={};Object.defineProperty(GGe,"__esModule",{value:!0});var kGe={};Object.defineProperty(kGe,"__esModule",{value:!0});var jGe={};Object.defineProperty(jGe,"__esModule",{value:!0});var UGe={};Object.defineProperty(UGe,"__esModule",{value:!0});var FGe={};Object.defineProperty(FGe,"__esModule",{value:!0});var KGe={};Object.defineProperty(KGe,"__esModule",{value:!0});var qGe={};Object.defineProperty(qGe,"__esModule",{value:!0});var SGe={};Object.defineProperty(SGe,"__esModule",{value:!0});var ZGe={};Object.defineProperty(ZGe,"__esModule",{value:!0});var HGe={};Object.defineProperty(HGe,"__esModule",{value:!0});var WGe={};Object.defineProperty(WGe,"__esModule",{value:!0});var zGe={};Object.defineProperty(zGe,"__esModule",{value:!0});var YGe={};Object.defineProperty(YGe,"__esModule",{value:!0});(function(s){var p=Xr&&Xr.__createBinding||(Object.create?function(r,a,c,e){e===void 0&&(e=c);var f=Object.getOwnPropertyDescriptor(a,c);(!f||("get"in f?!a.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return a[c]}}),Object.defineProperty(r,e,f)}:function(r,a,c,e){e===void 0&&(e=c),r[e]=a[c]}),i=Xr&&Xr.__exportStar||function(r,a){for(var c in r)c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c)&&p(a,r,c)};Object.defineProperty(s,"__esModule",{value:!0}),i(oGe,s),i(dGe,s),i(uGe,s),i(pGe,s),i(cGe,s),i(fGe,s),i(yGe,s),i(hGe,s),i(mGe,s),i(TGe,s),i(vGe,s),i(EGe,s),i(bGe,s),i(AGe,s),i(gGe,s),i(IGe,s),i(RGe,s),i(DGe,s),i(wGe,s),i(CGe,s),i(OGe,s),i(_Ge,s),i(VGe,s),i(PGe,s),i(NGe,s),i(xGe,s),i($Ge,s),i(LGe,s),i(BGe,s),i(MGe,s),i(GGe,s),i(kGe,s),i(jGe,s),i(UGe,s),i(FGe,s),i(KGe,s),i(qGe,s),i(SGe,s),i(ZGe,s),i(HGe,s),i(WGe,s),i(zGe,s),i(YGe,s)})(lGe);var JGe={},wa={};Object.defineProperty(wa,"__esModule",{value:!0});wa.isObject=wa.isString=wa.isDefined=wa.last=wa.identity=void 0;const mDi=s=>s;wa.identity=mDi;const TDi=s=>s[s.length-1];wa.last=TDi;const vDi=s=>s!==void 0;wa.isDefined=vDi;const EDi=s=>typeof s=="string";wa.isString=EDi;const bDi=s=>typeof s=="object"&&s!==null&&!(s instanceof Array);wa.isObject=bDi;(function(s){Object.defineProperty(s,"__esModule",{value:!0}),s.cstVisitor=s.VisitorAction=void 0;const p=wa;var i;(function(c){c[c.SKIP=1]="SKIP"})(i=s.VisitorAction||(s.VisitorAction={}));function r(c){const e=f=>{const h=c[f.type];if((h==null?void 0:h(f))!==i.SKIP)for(const E of Object.values(f))a(E)?e(E):E instanceof Array&&E.filter(a).forEach(b=>e(b))};return e}s.cstVisitor=r;const a=c=>(0,p.isObject)(c)&&(0,p.isString)(c.type)})(JGe);var xE={};Object.defineProperty(xE,"__esModule",{value:!0});xE.cstTransformer=void 0;function ADi(s){return p=>{const i=s[p.type];if(!i)throw p.type?new Error(`No transform map entry for ${p.type}`):new Error(`No type field on node: ${JSON.stringify(p)}`);return i(p)}}xE.cstTransformer=ADi;var QGe={},$E={};Object.defineProperty($E,"__esModule",{value:!0});$E.bigqueryKeywords=void 0;$E.bigqueryKeywords={ALL:!0,AND:!0,ANY:!0,ARRAY:!0,AS:!0,ASC:!0,ASSERT_ROWS_MODIFIED:!0,AT:!0,BETWEEN:!0,BY:!0,CASE:!0,CAST:!0,COLLATE:!0,CONTAINS:!0,CREATE:!0,CROSS:!0,CUBE:!0,CURRENT:!0,DEFAULT:!0,DEFINE:!0,DESC:!0,DISTINCT:!0,ELSE:!0,END:!0,ENUM:!0,ESCAPE:!0,EXCEPT:!0,EXCLUDE:!0,EXISTS:!0,EXTRACT:!0,FALSE:!0,FETCH:!0,FOLLOWING:!0,FOR:!0,FROM:!0,FULL:!0,GROUP:!0,GROUPING:!0,GROUPS:!0,HASH:!0,HAVING:!0,IF:!0,IGNORE:!0,IN:!0,INNER:!0,INTERSECT:!0,INTERVAL:!0,INTO:!0,IS:!0,JOIN:!0,LATERAL:!0,LEFT:!0,LIKE:!0,LIMIT:!0,LOOKUP:!0,MERGE:!0,NATURAL:!0,NEW:!0,NO:!0,NOT:!0,NULL:!0,NULLS:!0,OF:!0,ON:!0,OR:!0,ORDER:!0,OUTER:!0,OVER:!0,PARTITION:!0,PRECEDING:!0,PROTO:!0,QUALIFY:!0,RANGE:!0,RECURSIVE:!0,RESPECT:!0,RIGHT:!0,ROLLUP:!0,ROWS:!0,SELECT:!0,SET:!0,SOME:!0,STRUCT:!0,TABLESAMPLE:!0,THEN:!0,TO:!0,TREAT:!0,TRUE:!0,UNBOUNDED:!0,UNION:!0,UNNEST:!0,USING:!0,WHEN:!0,WHERE:!0,WINDOW:!0,WITH:!0,WITHIN:!0};var LE={};Object.defineProperty(LE,"__esModule",{value:!0});LE.mariadbKeywords=void 0;LE.mariadbKeywords={ACCESSIBLE:!0,ADD:!0,ALL:!0,ALTER:!0,ANALYZE:!0,AND:!0,AS:!0,ASC:!0,ASENSITIVE:!0,BEFORE:!0,BETWEEN:!0,BIGINT:!0,BINARY:!0,BLOB:!0,BOTH:!0,BY:!0,CALL:!0,CASCADE:!0,CASE:!0,CHANGE:!0,CHAR:!0,CHARACTER:!0,CHECK:!0,COLLATE:!0,COLUMN:!0,CONDITION:!0,CONSTRAINT:!0,CONTINUE:!0,CONVERT:!0,CREATE:!0,CROSS:!0,CURRENT_DATE:!0,CURRENT_ROLE:!0,CURRENT_TIME:!0,CURRENT_TIMESTAMP:!0,CURRENT_USER:!0,CURSOR:!0,DATABASE:!0,DATABASES:!0,DAY_HOUR:!0,DAY_MICROSECOND:!0,DAY_MINUTE:!0,DAY_SECOND:!0,DEC:!0,DECIMAL:!0,DECLARE:!0,DEFAULT:!0,DELAYED:!0,DELETE:!0,DELETE_DOMAIN_ID:!0,DESC:!0,DESCRIBE:!0,DETERMINISTIC:!0,DISTINCT:!0,DISTINCTROW:!0,DIV:!0,DO_DOMAIN_IDS:!0,DOUBLE:!0,DROP:!0,DUAL:!0,EACH:!0,ELSE:!0,ELSEIF:!0,ENCLOSED:!0,ESCAPED:!0,EXCEPT:!0,EXISTS:!0,EXIT:!0,EXPLAIN:!0,FALSE:!0,FETCH:!0,FLOAT:!0,FLOAT4:!0,FLOAT8:!0,FOR:!0,FORCE:!0,FOREIGN:!0,FROM:!0,FULLTEXT:!0,GENERAL:!0,GRANT:!0,GROUP:!0,HAVING:!0,HIGH_PRIORITY:!0,HOUR_MICROSECOND:!0,HOUR_MINUTE:!0,HOUR_SECOND:!0,IF:!0,IGNORE:!0,IGNORE_DOMAIN_IDS:!0,IGNORE_SERVER_IDS:!0,IN:!0,INDEX:!0,INFILE:!0,INNER:!0,INOUT:!0,INSENSITIVE:!0,INSERT:!0,INT:!0,INT1:!0,INT2:!0,INT3:!0,INT4:!0,INT8:!0,INTEGER:!0,INTERSECT:!0,INTERVAL:!0,INTO:!0,IS:!0,ITERATE:!0,JOIN:!0,KEY:!0,KEYS:!0,KILL:!0,LEADING:!0,LEAVE:!0,LEFT:!0,LIKE:!0,LIMIT:!0,LINEAR:!0,LINES:!0,LOAD:!0,LOCALTIME:!0,LOCALTIMESTAMP:!0,LOCK:!0,LONG:!0,LONGBLOB:!0,LONGTEXT:!0,LOOP:!0,LOW_PRIORITY:!0,MASTER_HEARTBEAT_PERIOD:!0,MASTER_SSL_VERIFY_SERVER_CERT:!0,MATCH:!0,MAXVALUE:!0,MEDIUMBLOB:!0,MEDIUMINT:!0,MEDIUMTEXT:!0,MIDDLEINT:!0,MINUTE_MICROSECOND:!0,MINUTE_SECOND:!0,MOD:!0,MODIFIES:!0,NATURAL:!0,NOT:!0,NO_WRITE_TO_BINLOG:!0,NULL:!0,NUMERIC:!0,OFFSET:!0,ON:!0,OPTIMIZE:!0,OPTION:!0,OPTIONALLY:!0,OR:!0,ORDER:!0,OUT:!0,OUTER:!0,OUTFILE:!0,OVER:!0,PAGE_CHECKSUM:!0,PARSE_VCOL_EXPR:!0,PARTITION:!0,POSITION:!0,PRECISION:!0,PRIMARY:!0,PROCEDURE:!0,PURGE:!0,RANGE:!0,READ:!0,READS:!0,READ_WRITE:!0,REAL:!0,RECURSIVE:!0,REF_SYSTEM_ID:!0,REFERENCES:!0,REGEXP:!0,RELEASE:!0,RENAME:!0,REPEAT:!0,REPLACE:!0,REQUIRE:!0,RESIGNAL:!0,RESTRICT:!0,RETURN:!0,RETURNING:!0,REVOKE:!0,RIGHT:!0,RLIKE:!0,ROWS:!0,SCHEMA:!0,SCHEMAS:!0,SECOND_MICROSECOND:!0,SELECT:!0,SENSITIVE:!0,SEPARATOR:!0,SET:!0,SHOW:!0,SIGNAL:!0,SLOW:!0,SMALLINT:!0,SPATIAL:!0,SPECIFIC:!0,SQL:!0,SQLEXCEPTION:!0,SQLSTATE:!0,SQLWARNING:!0,SQL_BIG_RESULT:!0,SQL_CALC_FOUND_ROWS:!0,SQL_SMALL_RESULT:!0,SSL:!0,STARTING:!0,STATS_AUTO_RECALC:!0,STATS_PERSISTENT:!0,STATS_SAMPLE_PAGES:!0,STRAIGHT_JOIN:!0,TABLE:!0,TERMINATED:!0,THEN:!0,TINYBLOB:!0,TINYINT:!0,TINYTEXT:!0,TO:!0,TRAILING:!0,TRIGGER:!0,TRUE:!0,UNDO:!0,UNION:!0,UNIQUE:!0,UNLOCK:!0,UNSIGNED:!0,UPDATE:!0,USAGE:!0,USE:!0,USING:!0,UTC_DATE:!0,UTC_TIME:!0,UTC_TIMESTAMP:!0,VALUES:!0,VARBINARY:!0,VARCHAR:!0,VARCHARACTER:!0,VARYING:!0,WHEN:!0,WHERE:!0,WHILE:!0,WINDOW:!0,WITH:!0,WRITE:!0,XOR:!0,YEAR_MONTH:!0,ZEROFILL:!0};var BE={};Object.defineProperty(BE,"__esModule",{value:!0});BE.mysqlKeywords=void 0;BE.mysqlKeywords={ACCESSIBLE:!0,ADD:!0,ALL:!0,ALTER:!0,ANALYZE:!0,AND:!0,AS:!0,ASC:!0,ASENSITIVE:!0,BEFORE:!0,BETWEEN:!0,BIGINT:!0,BINARY:!0,BLOB:!0,BOTH:!0,BY:!0,CALL:!0,CASCADE:!0,CASE:!0,CHANGE:!0,CHAR:!0,CHARACTER:!0,CHECK:!0,COLLATE:!0,COLUMN:!0,CONDITION:!0,CONSTRAINT:!0,CONTINUE:!0,CONVERT:!0,CREATE:!0,CROSS:!0,CUBE:!0,CUME_DIST:!0,CURRENT_DATE:!0,CURRENT_TIME:!0,CURRENT_TIMESTAMP:!0,CURRENT_USER:!0,CURSOR:!0,DATABASE:!0,DATABASES:!0,DAY_HOUR:!0,DAY_MICROSECOND:!0,DAY_MINUTE:!0,DAY_SECOND:!0,DEC:!0,DECIMAL:!0,DECLARE:!0,DEFAULT:!0,DELAYED:!0,DELETE:!0,DENSE_RANK:!0,DESC:!0,DESCRIBE:!0,DETERMINISTIC:!0,DISTINCT:!0,DISTINCTROW:!0,DIV:!0,DOUBLE:!0,DROP:!0,DUAL:!0,EACH:!0,ELSE:!0,ELSEIF:!0,EMPTY:!0,ENCLOSED:!0,ESCAPED:!0,EXCEPT:!0,EXISTS:!0,EXIT:!0,EXPLAIN:!0,FALSE:!0,FETCH:!0,FIRST_VALUE:!0,FLOAT:!0,FLOAT4:!0,FLOAT8:!0,FOR:!0,FORCE:!0,FOREIGN:!0,FROM:!0,FULLTEXT:!0,FUNCTION:!0,GENERATED:!0,GET:!0,GRANT:!0,GROUP:!0,GROUPING:!0,GROUPS:!0,HAVING:!0,HIGH_PRIORITY:!0,HOUR_MICROSECOND:!0,HOUR_MINUTE:!0,HOUR_SECOND:!0,IF:!0,IGNORE:!0,IN:!0,INDEX:!0,INFILE:!0,INNER:!0,INOUT:!0,INSENSITIVE:!0,INSERT:!0,INT:!0,INT1:!0,INT2:!0,INT3:!0,INT4:!0,INT8:!0,INTEGER:!0,INTERSECT:!0,INTERVAL:!0,INTO:!0,IO_AFTER_GTIDS:!0,IO_BEFORE_GTIDS:!0,IS:!0,ITERATE:!0,JOIN:!0,JSON_TABLE:!0,KEY:!0,KEYS:!0,KILL:!0,LAG:!0,LAST_VALUE:!0,LATERAL:!0,LEAD:!0,LEADING:!0,LEAVE:!0,LEFT:!0,LIKE:!0,LIMIT:!0,LINEAR:!0,LINES:!0,LOAD:!0,LOCALTIME:!0,LOCALTIMESTAMP:!0,LOCK:!0,LONG:!0,LONGBLOB:!0,LONGTEXT:!0,LOOP:!0,LOW_PRIORITY:!0,MASTER_BIND:!0,MASTER_SSL_VERIFY_SERVER_CERT:!0,MATCH:!0,MAXVALUE:!0,MEDIUMBLOB:!0,MEDIUMINT:!0,MEDIUMTEXT:!0,MIDDLEINT:!0,MINUTE_MICROSECOND:!0,MINUTE_SECOND:!0,MOD:!0,MODIFIES:!0,NATURAL:!0,NOT:!0,NO_WRITE_TO_BINLOG:!0,NTH_VALUE:!0,NTILE:!0,NULL:!0,NUMERIC:!0,OF:!0,ON:!0,OPTIMIZE:!0,OPTIMIZER_COSTS:!0,OPTION:!0,OPTIONALLY:!0,OR:!0,ORDER:!0,OUT:!0,OUTER:!0,OUTFILE:!0,OVER:!0,PARTITION:!0,PERCENT_RANK:!0,PRECISION:!0,PRIMARY:!0,PROCEDURE:!0,PURGE:!0,RANGE:!0,RANK:!0,READ:!0,READS:!0,READ_WRITE:!0,REAL:!0,RECURSIVE:!0,REFERENCES:!0,REGEXP:!0,RELEASE:!0,RENAME:!0,REPEAT:!0,REPLACE:!0,REQUIRE:!0,RESIGNAL:!0,RESTRICT:!0,RETURN:!0,REVOKE:!0,RIGHT:!0,RLIKE:!0,ROW:!0,ROWS:!0,ROW_NUMBER:!0,SCHEMA:!0,SCHEMAS:!0,SECOND_MICROSECOND:!0,SELECT:!0,SENSITIVE:!0,SEPARATOR:!0,SET:!0,SHOW:!0,SIGNAL:!0,SMALLINT:!0,SPATIAL:!0,SPECIFIC:!0,SQL:!0,SQLEXCEPTION:!0,SQLSTATE:!0,SQLWARNING:!0,SQL_BIG_RESULT:!0,SQL_CALC_FOUND_ROWS:!0,SQL_SMALL_RESULT:!0,SSL:!0,STARTING:!0,STORED:!0,STRAIGHT_JOIN:!0,SYSTEM:!0,TABLE:!0,TERMINATED:!0,THEN:!0,TINYBLOB:!0,TINYINT:!0,TINYTEXT:!0,TO:!0,TRAILING:!0,TRIGGER:!0,TRUE:!0,UNDO:!0,UNION:!0,UNIQUE:!0,UNLOCK:!0,UNSIGNED:!0,UPDATE:!0,USAGE:!0,USE:!0,USING:!0,UTC_DATE:!0,UTC_TIME:!0,UTC_TIMESTAMP:!0,VALUES:!0,VARBINARY:!0,VARCHAR:!0,VARCHARACTER:!0,VARYING:!0,VIRTUAL:!0,WHEN:!0,WHERE:!0,WHILE:!0,WINDOW:!0,WITH:!0,WRITE:!0,XOR:!0,YEAR_MONTH:!0,ZEROFILL:!0};var ME={};Object.defineProperty(ME,"__esModule",{value:!0});ME.sqliteKeywords=void 0;ME.sqliteKeywords={ABORT:!0,ACTION:!0,ADD:!0,AFTER:!0,ALL:!0,ALTER:!0,ALWAYS:!0,ANALYZE:!0,AND:!0,AS:!0,ASC:!0,ATTACH:!0,AUTOINCREMENT:!0,BEFORE:!0,BEGIN:!0,BETWEEN:!0,BY:!0,CASCADE:!0,CASE:!0,CAST:!0,CHECK:!0,COLLATE:!0,COMMIT:!0,CONFLICT:!0,CONSTRAINT:!0,CREATE:!0,CROSS:!0,CURRENT:!0,CURRENT_DATE:!0,CURRENT_TIME:!0,CURRENT_TIMESTAMP:!0,DATABASE:!0,DEFAULT:!0,DEFERRABLE:!0,DEFERRED:!0,DELETE:!0,DESC:!0,DETACH:!0,DISTINCT:!0,DO:!0,DROP:!0,EACH:!0,ELSE:!0,END:!0,ESCAPE:!0,EXCEPT:!0,EXCLUDE:!0,EXCLUSIVE:!0,EXISTS:!0,EXPLAIN:!0,FAIL:!0,FILTER:!0,FIRST:!0,FOLLOWING:!0,FOR:!0,FOREIGN:!0,FROM:!0,FULL:!0,GENERATED:!0,GLOB:!0,GROUP:!0,GROUPS:!0,HAVING:!0,IF:!0,IGNORE:!0,IMMEDIATE:!0,IN:!0,INDEX:!0,INDEXED:!0,INITIALLY:!0,INNER:!0,INSERT:!0,INSTEAD:!0,INTERSECT:!0,INTO:!0,IS:!0,ISNULL:!0,JOIN:!0,LAST:!0,LEFT:!0,LIKE:!0,LIMIT:!0,MATCH:!0,MATERIALIZED:!0,NATURAL:!0,NO:!0,NOT:!0,NOTHING:!0,NOTNULL:!0,NULL:!0,NULLS:!0,OF:!0,OFFSET:!0,ON:!0,OR:!0,ORDER:!0,OTHERS:!0,OUTER:!0,OVER:!0,PARTITION:!0,PLAN:!0,PRAGMA:!0,PRECEDING:!0,PRIMARY:!0,QUERY:!0,RAISE:!0,RANGE:!0,RECURSIVE:!0,REFERENCES:!0,REGEXP:!0,REINDEX:!0,RELEASE:!0,RENAME:!0,REPLACE:!0,RESTRICT:!0,RETURNING:!0,RIGHT:!0,ROLLBACK:!0,ROW:!0,ROWS:!0,SAVEPOINT:!0,SELECT:!0,SET:!0,TABLE:!0,TEMP:!0,TEMPORARY:!0,THEN:!0,TIES:!0,TO:!0,TRANSACTION:!0,TRIGGER:!0,UNBOUNDED:!0,UNION:!0,UNIQUE:!0,UPDATE:!0,USING:!0,VACUUM:!0,VALUES:!0,VIEW:!0,VIRTUAL:!0,WHEN:!0,WHERE:!0,WINDOW:!0,WITH:!0,WITHOUT:!0};var GE={};Object.defineProperty(GE,"__esModule",{value:!0});GE.postgresqlKeywords=void 0;GE.postgresqlKeywords={ALL:!0,ANALYSE:!0,ANALYZE:!0,AND:!0,ANY:!0,ARRAY:!0,AS:!0,ASC:!0,ASYMMETRIC:!0,AUTHORIZATION:!0,BOTH:!0,CASE:!0,CAST:!0,CHECK:!0,COLLATE:!0,COLUMN:!0,CONSTRAINT:!0,CREATE:!0,CROSS:!0,CURRENT_CATALOG:!0,CURRENT_DATE:!0,CURRENT_ROLE:!0,CURRENT_SCHEMA:!0,CURRENT_TIME:!0,CURRENT_TIMESTAMP:!0,CURRENT_USER:!0,DAY:!0,DEFAULT:!0,DEFERRABLE:!0,DESC:!0,DISTINCT:!0,DO:!0,ELSE:!0,END:!0,EXCEPT:!0,FALSE:!0,FETCH:!0,FILTER:!0,FOR:!0,FOREIGN:!0,FREEZE:!0,FROM:!0,FULL:!0,GRANT:!0,GROUP:!0,HAVING:!0,HOUR:!0,ILIKE:!0,IN:!0,INITIALLY:!0,INNER:!0,INTERSECT:!0,INTO:!0,IS:!0,ISNULL:!0,JOIN:!0,LATERAL:!0,LEADING:!0,LEFT:!0,LIKE:!0,LIMIT:!0,LOCALTIME:!0,LOCALTIMESTAMP:!0,MINUTE:!0,MONTH:!0,NATURAL:!0,NOT:!0,NOTNULL:!0,NULL:!0,OFFSET:!0,ON:!0,ONLY:!0,OR:!0,ORDER:!0,OUTER:!0,OVER:!0,OVERLAPS:!0,PLACING:!0,PRECISION:!0,PRIMARY:!0,REFERENCES:!0,RETURNING:!0,RIGHT:!0,SECOND:!0,SELECT:!0,SESSION_USER:!0,SIMILAR:!0,SOME:!0,SYMMETRIC:!0,SYSTEM_USER:!0,TABLE:!0,TABLESAMPLE:!0,THEN:!0,TO:!0,TRAILING:!0,TRUE:!0,UNION:!0,UNIQUE:!0,USER:!0,USING:!0,VARIADIC:!0,VARYING:!0,VERBOSE:!0,WHEN:!0,WHERE:!0,WINDOW:!0,WITH:!0,WITHIN:!0,WITHOUT:!0,YEAR:!0,SET:!0};(function(s){var p=Xr&&Xr.__createBinding||(Object.create?function(r,a,c,e){e===void 0&&(e=c);var f=Object.getOwnPropertyDescriptor(a,c);(!f||("get"in f?!a.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return a[c]}}),Object.defineProperty(r,e,f)}:function(r,a,c,e){e===void 0&&(e=c),r[e]=a[c]}),i=Xr&&Xr.__exportStar||function(r,a){for(var c in r)c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c)&&p(a,r,c)};Object.defineProperty(s,"__esModule",{value:!0}),i($E,s),i(LE,s),i(BE,s),i(ME,s),i(GE,s)})(QGe);var uv={};Object.defineProperty(uv,"__esModule",{value:!0});uv.FormattedSyntaxError=void 0;class gDi extends Error{constructor(p,i,r){super(IDi(p,i,r))}}uv.FormattedSyntaxError=gDi;function IDi(s,p,i){const r=s.location.start.line,a=s.location.start.column,c=p.split(/\r\n|\n|\r/)[r-1],e="".padStart(String(r).length),f=DDi(RDi(s.found,a,c)),h=wDi(s.expected);return`Syntax Error: Unexpected ${f}
|
|
123
123
|
Was expecting to see: ${h}
|
|
124
124
|
--> ${i||"undefined"}:${r}:${a}
|