@g1cloud/entity-modeler-next 5.0.6 → 5.0.7

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.
@@ -24,7 +24,7 @@ ${u}
24
24
  `)+`
25
25
  `}}function Ky(e,n,o){const i=[`${n}.${e}`,Qe.jpaRepository,Qe.querydslExecutor].sort(),a=[`package ${n};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${o}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
26
26
  `)+`
27
- `}}const Qi="com.example",Gy="command.domain";function Wo(e,n,o={}){const i=Gi(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??Gy,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const Yy="CustomMoneyType",qy="Money";function Wy(e){return!(e.type!==Yy||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Jy(e){const n=e.dbAttrs[0]??{modelId:Be(),physicalName:"",dataType:""},o={modelId:Be(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:qy,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function Xy(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Wy(l)?(a=!0,n=!0,Jy(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function Zy(e,n){const o=new Map,i=[],a=new Map;for(const y of e.entities){const b=new Map,f=new Map,g=new Map,k=(_,N,I)=>{if(!_)return;o.get(_)||o.set(_,[{entityId:N,assignedId:_}]),i.push({id:_,entityId:N,sink:I}),I(_)};for(const _ of y.attributes){k(_.modelId,y.modelId,N=>b.set(_,N));for(const N of _.dbAttrs)k(N.modelId,y.modelId,I=>f.set(N,I))}for(const _ of y.indexes??[])k(_.modelId,y.modelId,N=>g.set(_,N));a.set(y,{attrs:b,cols:f,idx:g})}const r=new Set(o.keys()),l=new Map;for(const y of i){const b=(l.get(y.id)??0)+1;if(l.set(y.id,b),b===1)continue;const f=Qy(y.id,b-1,r);r.add(f),o.get(y.id).push({entityId:y.entityId,assignedId:f}),y.sink(f)}const s=[...o.values()].reduce((y,b)=>y+Math.max(0,b.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,b)=>{var g;if(!b||!y)return b;const f=o.get(b);return!f||f.length<2?b:((g=f.find(k=>k.entityId===y))==null?void 0:g.assignedId)??b},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,b)=>{const f=d.get(y);if(f)return f.end1.entityRef===b?f.end2.entityRef:f.end1.entityRef},m=e.entities.map(y=>{var _;const b=a.get(y),f=y.attributes.map(N=>{const I=b.attrs.get(N),A=N.dbAttrs.map(T=>{const V=b.cols.get(T);return V===T.modelId?T:{...T,modelId:V}});let x=N.derivedFrom;if(x){const T=u(x.associationRef,y.modelId),V=c(T,x.sourceAttributeRef);V!==x.sourceAttributeRef&&(x={...x,sourceAttributeRef:V})}return I!==N.modelId||x!==N.derivedFrom||A.some((T,V)=>T!==N.dbAttrs[V])?{...N,modelId:I,dbAttrs:A,derivedFrom:x}:N}),g=(_=y.indexes)==null?void 0:_.map(N=>{const I=b.idx.get(N),A=N.columns.map($=>{const T=c(y.modelId,$.columnRef);return T===$.columnRef?$:{...$,columnRef:T}});return I!==N.modelId||A.some(($,T)=>$!==N.columns[T])?{...N,modelId:I,columns:A}:N});return f.some((N,I)=>N!==y.attributes[I])||g&&y.indexes&&g.some((N,I)=>N!==y.indexes[I])?{...y,attributes:f,...g?{indexes:g}:{}}:y}),h=e.associations.map(y=>{const b=c(y.end1.entityRef,y.end1.attributeRef),f=c(y.end2.entityRef,y.end2.attributeRef);return b===y.end1.attributeRef&&f===y.end2.attributeRef?y:{...y,end1:b===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:b},end2:f===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:f}}}),p=n.associationLayouts.map(y=>{const b=d.get(y.associationRef);if(!b)return y;const f=c(b.end1.entityRef,y.sourceColumnRef),g=c(b.end2.entityRef,y.targetColumnRef);return f===y.sourceColumnRef&&g===y.targetColumnRef?y:{...y,sourceColumnRef:f,targetColumnRef:g}});return{logical:{...e,entities:m,associations:h},layout:p.some((y,b)=>y!==n.associationLayouts[b])?{...n,associationLayouts:p}:n,reissued:s}}function Qy(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function $t(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function Fr(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function xc(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Cc(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(xc);if(!i.length)continue;const a=o.filter(s=>!xc(s));let r=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(r=c+1)});const l=[...a.slice(0,r),...i,...a.slice(r)];l.forEach((s,c)=>s.order=c),n.attributes=l}}function _o(e){return JSON.parse(JSON.stringify(e))}function Sc(e,n,o){var $;const i=o.idFactory??Be,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const T=new Set(n);for(const V of r.associations){const R=T.has(V.end1.entityRef),C=T.has(V.end2.entityRef);R!==C&&s.add(R?V.end2.entityRef:V.end1.entityRef)}}const c=r.entities.filter(T=>s.has(T.modelId)),d=new Set(c.map(T=>T.modelId)),u=r.associations.filter(T=>d.has(T.end1.entityRef)&&d.has(T.end2.entityRef)),m=new Set(u.map(T=>T.modelId)),h=new Map,p=T=>{let V=h.get(T);return V||(V=i(),h.set(T,V)),V};for(const T of c){p(T.modelId);for(const V of T.attributes){p(V.modelId);for(const R of V.dbAttrs)p(R.modelId)}for(const V of T.indexes??[])p(V.modelId);for(const V of T.operations??[])p(V.modelId)}for(const T of u)p(T.modelId);const y=T=>h.get(T),b=c.map(T=>{const V=_o(T);V.modelId=y(T.modelId),V.attributes=V.attributes.map(R=>eg(R,y,m,d));for(const R of V.indexes??[])R.modelId=y(R.modelId),R.columns=R.columns.map(C=>Vn(C.columnRef)?C:{...C,columnRef:y(C.columnRef)}).filter(C=>C.columnRef!==void 0);for(const R of V.operations??[])R.modelId=y(R.modelId);return V});Cc(b);const f=u.map(T=>{const V=_o(T);return V.modelId=y(T.modelId),V.end1=Rc(V.end1,y),V.end2=Rc(V.end2,y),V}),g=[];for(const T of r.groups){const V=T.memberEntityRefs.filter(C=>d.has(C));if(V.length===0)continue;const R=_o(T);R.modelId=p(T.modelId),R.memberEntityRefs=V.map(C=>y(C)),g.push(R)}const k=o.collisionSuffix??"_imported",_=new Set(o.existing.entities.map(T=>T.name)),N=new Set(o.existing.entities.map(T=>{var V;return(V=T.table)==null?void 0:V.physicalName}).filter(T=>!!T));for(const T of b)_.has(T.name)&&(T.name=`${T.name}${k}`),($=T.table)!=null&&$.physicalName&&N.has(T.table.physicalName)&&(T.table.physicalName=`${T.table.physicalName}${k}`);const I=[];for(const T of l.entityLayouts){const V=y(T.entityRef);if(!V)continue;const R=_o(T);R.entityRef=V,R.geo={...R.geo,location:Ur(R.geo.location,a)},R.attributeStyles&&(R.attributeStyles=ea(R.attributeStyles,y)),R.operationStyles&&(R.operationStyles=ea(R.operationStyles,y)),I.push(R)}const A=[];for(const T of l.associationLayouts){const V=y(T.associationRef);if(!V)continue;const R=_o(T);R.associationRef=V,R.sourceColumnRef=T.sourceColumnRef?y(T.sourceColumnRef):void 0,R.targetColumnRef=T.targetColumnRef?y(T.targetColumnRef):void 0,R.waypoints=R.waypoints.map(C=>Ur(C,a)),A.push(R)}const x=[];for(const T of l.groupLayouts){const V=y(T.groupRef);if(!V)continue;const R=_o(T);R.groupRef=V,R.geo={...R.geo,location:Ur(R.geo.location,a)},delete R.memberNoteRefs,x.push(R)}return{logical:{entities:b,associations:f,groups:g},layout:{entityLayouts:I,associationLayouts:A,groupLayouts:x},idMap:h}}function Ur(e,n){return{x:e.x+n.x,y:e.y+n.y}}function eg(e,n,o,i){e.modelId=n(e.modelId);for(const a of e.dbAttrs)if(a.modelId=n(a.modelId),a.sharedColumnRef!==void 0){const r=n(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:n(e.derivedFrom.associationRef),sourceAttributeRef:n(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:n(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:n(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function Rc(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function ea(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function Hr(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function On(e,n){if(e===n||e==null&&n==null)return!0;if(e==null||n==null)return!1;if(Array.isArray(e)||Array.isArray(n))return!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length?!1:e.every((o,i)=>On(o,n[i]));if(typeof e=="object"&&typeof n=="object"){const o=new Set([...Object.keys(e),...Object.keys(n)]);for(const i of o)if(!On(e[i],n[i]))return!1;return!0}return!1}function Pn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||On(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function zn(e,n,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(n.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,u]of a){const m=i.get(d);m?s.push({cur:m,tgt:u}):r.push(u)}for(const[d,u]of i)a.has(d)||l.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return r.sort(c),l.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:r,removed:l,common:s}}function tg(e,n){const o=new Set(e),i=new Set(n),a=n.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const ng=new Set(["attributes","operations","indexes","rev"]),og=new Set(["end1","end2","rev"]),ig=new Set(["memberEntityRefs","rev"]),$c=new Set(["modelId"]),ag=new Set(["modelId","columns"]),rg=new Set([]);function lg(e,n,o,i){const a=zn(n.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=Pn(s,c,$c);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=zn(n.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=Pn(s,c,$c);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=zn(n.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!On(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=Pn(s,c,ag);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function sg(e,n,o){const i=zn(e.entities??[],n.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:Hr(l)});for(const{cur:l,tgt:s}of i.common){const c=Pn(l,s,ng);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),lg(l.modelId,l,s,o)}const a=zn(e.associations??[],n.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:Hr(l)});for(const{cur:l,tgt:s}of a.common){const c=Pn(l,s,og);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=Pn(l[d]??{},s[d]??{},rg);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=zn(e.groups??[],n.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:Hr(l)});for(const{cur:l,tgt:s}of r.common){const c=Pn(l,s,ig);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=tg(l.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u})}}function ta(e,n,o,i,a,r,l){const s=zn(e,n,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)On(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function cg(e,n,o){ta(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),ta(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),ta(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),ta(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function dg(e,n){const o=[];return sg(e.logical,n.logical,o),cg(e.layout,n.layout,o),o}function ug(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const mg={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class fg{constructor(n){Ze(this,"out",[]);Ze(this,"last",new Map);this.fieldFilter=n}set(n,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...Jo(n),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(n,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...Jo(n),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...Jo(n),field:a,value:void 0,removed:!0});continue}this.out.push({...Jo(n),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(n,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...Jo(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Jo(e){const n={seq:e.seq};return e.ts!==void 0&&(n.ts=e.ts),e.origin!==void 0&&(n.origin=e.origin),e.author!==void 0&&(n.author=e.author),e.kind!==void 0&&(n.kind=e.kind),e.restoredFromSeq!==void 0&&(n.restoredFromSeq=e.restoredFromSeq),n}function Ut(e,n,o,i){if(o==null||typeof o!="object")return;const a=mg[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Fn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function jr(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Nn(e,n){var r,l,s,c,d,u,m,h;const o=ug(n),i=new fg(n.field),a=[...e].sort((p,y)=>p.seq-y.seq);for(const p of a)for(const y of p.ops)switch(o){case"entity":if(y.entityRef!==n.entityRef)break;y.kind==="entity.add"?Ut(i,p,y.value,"entity"):y.kind==="entity.update"?Fn(i,p,y.patch):y.kind==="entity.remove"&&i.remove(p);break;case"attribute":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const b=jr((r=y.value)==null?void 0:r.attributes,n.attributeRef);b&&Ut(i,p,b,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===n.attributeRef?Ut(i,p,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===n.attributeRef?Fn(i,p,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===n.attributeRef||y.kind==="entity.remove")&&i.remove(p);break;case"operation":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const b=jr((s=y.value)==null?void 0:s.operations,n.operationRef);b&&Ut(i,p,b,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===n.operationRef?Ut(i,p,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===n.operationRef?Fn(i,p,y.patch):(y.kind==="operation.remove"&&y.operationRef===n.operationRef||y.kind==="entity.remove")&&i.remove(p);break;case"index":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const b=jr((d=y.value)==null?void 0:d.indexes,n.indexRef);b&&Ut(i,p,b,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===n.indexRef?Ut(i,p,y.value,"index"):y.kind==="index.update"&&y.indexRef===n.indexRef?Fn(i,p,y.patch):(y.kind==="index.remove"&&y.indexRef===n.indexRef||y.kind==="entity.remove")&&i.remove(p);break;case"association":if(y.associationRef!==n.associationRef)break;y.kind==="association.add"?Ut(i,p,y.value,"association"):y.kind==="association.update"?Fn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"associationEnd":if(y.associationRef!==n.associationRef)break;if(y.kind==="association.add"){const b=(m=y.value)==null?void 0:m[n.end];Ut(i,p,b,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===n.end?Fn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"group":if(y.groupRef!==n.groupRef)break;if(y.kind==="group.add"){Ut(i,p,y.value,"group");const b=(h=y.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(b))for(const f of b)i.member(p,f,!1)}else y.kind==="group.update"?Fn(i,p,y.patch):y.kind==="group.remove"?i.remove(p):y.kind==="group.addMember"&&y.entityRef!=null?i.member(p,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(p,y.entityRef,!0);break}return i.result()}const We={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},pg={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":We,"entityLayout.remove":We,"entityLayout.move":We,"entityLayout.resize":We,"entityLayout.setCollapsed":We,"entityLayout.setLocked":We,"entityLayout.setStyle":We,"entityLayout.setAttrStyle":We,"entityLayout.setOpStyle":We,"groupLayout.add":We,"groupLayout.remove":We,"groupLayout.move":We,"groupLayout.resize":We,"groupLayout.setLocked":We,"groupLayout.setStyle":We,"groupLayout.addNoteMember":We,"groupLayout.removeNoteMember":We,"associationLayout.add":We,"associationLayout.remove":We,"associationLayout.setWaypoints":We,"note.add":We,"note.remove":We,"note.move":We,"note.resize":We,"note.setMemo":We,"note.setStyle":We,"noteConnection.add":We,"noteConnection.remove":We,"noteConnection.setWaypoints":We},At=e=>typeof e=="string"?e:void 0,hg=e=>{var n;return At((n=e.value)==null?void 0:n.modelId)};function Ac(e){return At(e.containerRef)??At(e.entityRef)}function Kr(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=At(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function Gr(e){const n=pg[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=At(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Kr(o,"attributes","attribute",a),...Kr(o,"operations","operation",a),...Kr(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Ac(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?hg(o):At(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=At(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=At(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function yg(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=At(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Ac(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=At(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=At(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function gg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function bg(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of Gr(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function na(e,n){return e.map(o=>({...o,subject:n}))}function Tc(e,n){const o=e.filter(s=>s.ops.some(c=>gg(c,n))),{attributes:i,operations:a,indexes:r}=bg(o,n),l=[...na(Nn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...na(Nn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...na(Nn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...na(Nn(o,{entityRef:n,indexRef:s}),{kind:"index",ref:s}));return l.map((s,c)=>({e:s,i:c})).sort((s,c)=>s.e.seq-c.e.seq||s.i-c.i).map(({e:s})=>s)}function Yr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function _g(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of Gr(i))a.existence==="add"&&n.add(Yr(a.subject));return n}function kg(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=yg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Eg(e){const{entities:n,associations:o,groups:i}=kg(e),a=[];for(const r of n)for(const l of Tc(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Nn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Nn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Nn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function qr(e){const n=Eg(e),o=_g(e),i=new Map;for(const l of n){const s=Yr(l.subject),c=i.get(s);(c===void 0||l.seq<c)&&i.set(s,l.seq)}const a=new Map;for(const l of n){let s=a.get(l.seq);s||(s={meta:l,subjects:new Map},a.set(l.seq,s));const c=Yr(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return r.sort((l,s)=>s.seq-l.seq)}function Mc(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Ng(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of Gr(r)){if(!l.existence||l.inline)continue;const s=l.subject;wg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const wg=new Set(["attribute","operation","index"]);function Wr(e,n){const{fromSeq:o}=n,i=qr(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const h=Mc(m.subject);let p=s.get(h);p||(p={subject:m.subject,evs:[]},s.set(h,p)),p.evs.push(m)};for(const m of l)for(const h of m.actions)c({seq:m.seq,subject:h.subject,verb:h.verb,fields:h.fields});for(const m of Ng(e,o,r)){const h=s.get(Mc(m.subject));h!=null&&h.evs.some(p=>p.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((p,y)=>p.seq-y.seq);const h=m.evs[m.evs.length-1];m.subject.kind==="entity"&&h.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const h=m.evs[0].verb==="add",p=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||h&&p)continue;const y=new Map;let b=null;for(const g of m.evs){g.verb==="add"&&b!==null&&b!=="add"&&y.clear(),b=g.verb;for(const k of g.fields){const _=y.get(k.field);_?_.lastValue=k.value:y.set(k.field,{firstOld:k.oldValue,hasOld:k.oldValue!==void 0,lastValue:k.value})}}if(p){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(h){const g=[];for(const[k,_]of y)g.push({field:k,value:_.lastValue});d.push({subject:m.subject,verb:"added",fields:g});continue}const f=[];for(const[g,k]of y)k.hasOld&&On(k.firstOld,k.lastValue)||f.push({field:g,value:k.lastValue,...k.hasOld?{oldValue:k.firstOld}:{}});f.length!==0&&d.push({subject:m.subject,verb:"modified",fields:f})}return{fromSeq:o,toSeq:r,entries:d}}function Vc(e){const n=new Map,o=i=>{let a=n.get(i);return a||(a={verb:"modified",changedAttributeIds:new Set,changedOperationIds:new Set},n.set(i,a)),a};for(const i of e.entries){const a=i.subject;if(a.kind==="entity"){if(i.verb==="removed")continue;o(a.ref).verb=i.verb}else if((a.kind==="attribute"||a.kind==="operation"||a.kind==="index")&&a.entityRef){const r=o(a.entityRef);i.verb!=="removed"&&(a.kind==="attribute"?r.changedAttributeIds.add(a.ref):a.kind==="operation"&&r.changedOperationIds.add(a.ref))}}return n}class Jr{constructor(n){Ze(this,"undoStack",[]);Ze(this,"redoStack",[]);Ze(this,"savePoint",null);Ze(this,"listeners",new Set);Ze(this,"commandListeners",new Set);Ze(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.sealCoalesce(),this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function wt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function Bc(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function dt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function Tt(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function tt(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function nn(e,n,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===n))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function oa(e,n,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:n,...o})},invert(i){const a=Bc(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=dt(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Dc(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Bc(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=dt(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(h=>h.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function Lc(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=tt(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(tt(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:wt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:wt(o)}]}}}}function Oc(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=tt(i,e);o=a.name,a.name=n},invert(i){tt(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:n}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function ko(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...n}},invert(i){const a=dt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Pc(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...n}},invert(i){const a=dt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Xo(e,n){const o={...(e==null?void 0:e.properties)??{}};return n?o.swatch=n:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function zc(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=Xo(r.style,n)},invert(i){const a=dt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=dt(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function Fc(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=n},invert(i){const a=dt(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Uc(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=n},invert(i){const a=dt(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Xr(e){let n=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){n=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=n[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((r,l)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:n[l]}})}),{forward:i,invert:a}}}}function ia(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=dt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=Xo(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=dt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=dt(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function aa(e,n,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:n,...o})},invert(i){const a=i.logical.groups.findIndex(l=>l.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const r=i.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);r>=0&&i.layout.groupLayouts.splice(r,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Hc(e,n){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:wt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:wt(o)}]}}}}function jc(e){let n=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);n={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){n&&(o.logical.groups.splice(n.group.index,0,n.group.item),n.layout&&o.layout.groupLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:n.group.item}),{forward:o,invert:i.reverse()}}}}function Kc(e,n){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(n)&&(r.memberEntityRefs.push(n),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}:{forward:[],invert:[]}}}}function ra(e,n){let o=-1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에서 제외",apply(a){const r=i(a);o=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.memberEntityRefs.splice(o,0,n)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}}}}function Gc(e,n){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Yc(e,n){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function qc(e,n){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=Xo(a.style,n)},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e),r=l=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function Wc(e,n){let o;return{label:n?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=n},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Ht(e,n){return{label:`속성 추가: ${n.name}`,apply(o){tt(o,e).attributes.push(n)},invert(o){const i=tt(o,e),a=i.attributes.findIndex(r=>r.modelId===n.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n.modelId}]}}}}function on(e,n,o){const i={},a=r=>{const l=tt(r,e).attributes.find(s=>s.modelId===n);if(!l)throw new Error(`속성 없음: ${n}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:wt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:wt(i)}]}}}}function Jc(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=tt(i,e),r=a.attributes.findIndex(l=>l.modelId===n);if(r<0)throw new Error(`속성 없음: ${n}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&tt(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Xc(e,n,o,i,a){const r=new Map(a.map(c=>[c.modelId,c.order])),l=[],s=[];for(const c of i){const d=r.get(c.modelId);if(d===c.order)continue;const u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function Zr(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=tt(a,e);i=r.attributes.map(s=>({...s}));const l=Fr(r.attributes,n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&tt(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=tt(a,e).attributes;return Xc("attribute.update","attributeRef",e,r,i??[])}}}function Zc(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=tt(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=tt(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===n.modelId))??-1;r>=0&&a.operations.splice(r,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n.modelId}]}}}}function Qc(e,n,o){const i={},a=r=>{var s;const l=(s=tt(r,e).operations)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`메서드 없음: ${n}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:wt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:wt(i)}]}}}}function ed(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=tt(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===n))??-1;if(r<0)throw new Error(`메서드 없음: ${n}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=tt(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function td(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=tt(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=Fr(l,n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=tt(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=tt(a,e).operations??[];return Xc("operation.update","operationRef",e,r,i??[])}}}function nd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=dt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=Xo(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=dt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=dt(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function la(e,n){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(n)},invert(o){const i=o.logical.associations.findIndex(r=>r.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:n,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function od(e){let n=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);n={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){n&&(o.logical.associations.splice(n.assoc.index,0,n.assoc.item),n.layout&&o.layout.associationLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:n.assoc.item}),{forward:o,invert:i.reverse()}}}}function sa(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:wt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:wt(o)}]}}}}function Mt(e,n,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[n]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:wt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:wt(i)}]}}}}function id(e,n){return{label:"인덱스 추가",apply(o){const i=tt(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=tt(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===n.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n.modelId}]}}}}function ca(e,n,o){const i={},a=r=>{var s;const l=(s=tt(r,e).indexes)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`인덱스 없음: ${n}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:wt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:wt(i)}]}}}}function ad(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=tt(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===n))??-1;if(r<0)throw new Error(`인덱스 없음: ${n}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&tt(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const jt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),Zo=(e,n)=>{var o;return((o=Tt(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function rd(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=Tt(a,e);if(!r||!r.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);i={...r.waypoints[n]},r.waypoints.splice(n,1,{...o})},invert(a){const r=Tt(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=Zo(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[jt(e,r)],invert:[jt(e,l)]}}}}function ld(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=Tt(i,e);if(!a||!a.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);o={...a.waypoints[n]},a.waypoints.splice(n,1)},invert(i){const a=Tt(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=Zo(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[jt(e,a)],invert:[jt(e,r)]}}}}function sd(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=Tt(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+n,y:l.y+o}))},invert(a){const r=Tt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[jt(e,Zo(a,e))],invert:[jt(e,i??[])]}}}}function cd(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=Tt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=Tt(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[jt(e,Zo(o,e))],invert:[jt(e,n??[])]}}}}function dd(e,n,o){return{label:"waypoint 추가",apply(i){const a=Tt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=Tt(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=Zo(i,e),r=a.slice();return r.splice(n,1),{forward:[jt(e,a)],invert:[jt(e,r)]}}}}function ud(e){return{label:"노트 추가",apply(n){n.layout.notes.push(e)},invert(n){const o=n.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&n.layout.notes.splice(o,1)},emitOps(){return{forward:[{kind:"note.add",casUnit:"layout",noteRef:e.modelId,value:e}],invert:[{kind:"note.remove",casUnit:"layout",noteRef:e.modelId}]}}}}function md(e){let n=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);n={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){n&&o.layout.notes.splice(n.index,0,n.item)},emitOps(){return n?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:n.item}]}:{forward:[],invert:[]}}}}function Qo(e,n){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function fd(e,n){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function pd(e,n){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=n},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(n)],invert:[i(o)]}}}}function hd(e,n){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=Xo(a.style,n)},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(l=>l.modelId===e),r=l=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function yd(e,n){let o=!1,i=!1;const a=r=>r.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에 노트 편입",apply(r){const l=a(r);l&&(l.memberNoteRefs||(l.memberNoteRefs=[],i=!0),!l.memberNoteRefs.includes(n)&&(l.memberNoteRefs.push(n),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(n);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}:{forward:[],invert:[]}}}}function gd(e,n){let o=-1;const i=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var l;const r=i(a);o=((l=r==null?void 0:r.memberNoteRefs)==null?void 0:l.indexOf(n))??-1,o>=0&&r.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const r=i(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[]),r.memberNoteRefs.splice(o,0,n))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}}}}const wn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),da=(e,n,o)=>{var i;return((i=nn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function bd(e,n){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const r=a.layout.notes.find(l=>l.modelId===e);if(!r)throw new Error(`노트 없음: ${e}`);if(r.connections||(r.connections=[],i=!0),r.connections.some(l=>l.targetRef===n)){o=!1;return}r.connections.push({targetRef:n,waypoints:[]}),o=!0},invert(a){if(!o)return;const r=a.layout.notes.find(s=>s.modelId===e);if(!(r!=null&&r.connections))return;const l=r.connections.findIndex(s=>s.targetRef===n);l>=0&&r.connections.splice(l,1),i&&delete r.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:{targetRef:n,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}]}:{forward:[],invert:[]}}}}function _d(e,n){let o=null;return{label:"노트 연결 삭제",apply(i){var l;const a=i.layout.notes.find(s=>s.modelId===e),r=((l=a==null?void 0:a.connections)==null?void 0:l.findIndex(s=>s.targetRef===n))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${n}`);o={item:a.connections[r],index:r},a.connections.splice(r,1)},invert(i){if(!o)return;const a=i.layout.notes.find(r=>r.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:o.item}]}:{forward:[],invert:[]}}}}function kd(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=nn(r,e,n);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=nn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=da(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[wn(e,n,l)],invert:[wn(e,n,s)]}}}}function Ed(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=nn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=nn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=da(a,e,n),l=r.slice();return l.splice(o,1),{forward:[wn(e,n,r)],invert:[wn(e,n,l)]}}}}function Nd(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=nn(a,e,n);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=nn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=da(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[wn(e,n,r)],invert:[wn(e,n,l)]}}}}function wd(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=nn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=nn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[wn(e,n,da(i,e,n))],invert:[wn(e,n,o??[])]}}}}function Je(e,n,o){return{label:e,coalesceKey:o,apply(i){for(const a of n)a.apply(i)},invert(i){for(let a=n.length-1;a>=0;a--)n[a].invert(i)},emitOps(i){const a=n.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const Ig=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:la,addAttribute:Ht,addEntity:oa,addEntityToGroup:Kc,addGroup:aa,addIndex:id,addNote:ud,addNoteConnection:bd,addNoteConnectionWaypoint:Ed,addNoteToGroup:yd,addOperation:Zc,addWaypoint:dd,clearNoteConnectionWaypoints:wd,clearWaypoints:cd,composite:Je,moveEntity:ko,moveGroup:Gc,moveNote:Qo,moveNoteConnectionWaypoint:kd,moveWaypoint:rd,removeAssociation:od,removeAttribute:Jc,removeEntity:Dc,removeEntityFromGroup:ra,removeGroup:jc,removeIndex:ad,removeNote:md,removeNoteConnection:_d,removeNoteConnectionWaypoint:Nd,removeNoteFromGroup:gd,removeOperation:ed,removeWaypoint:ld,renameEntity:Oc,reorderAttributes:Zr,reorderOperations:td,resizeEntity:Pc,resizeGroup:Yc,resizeNote:fd,setAllEntitiesCollapsed:Xr,setAttributeSwatch:ia,setEntityCollapsed:Fc,setEntityLocked:Uc,setEntitySwatch:zc,setGroupLocked:Wc,setGroupSwatch:qc,setNoteMemo:pd,setNoteSwatch:hd,setOperationSwatch:nd,translateWaypoints:sd,updateAssociation:sa,updateAssociationEnd:Mt,updateAttribute:on,updateEntity:Lc,updateGroup:Hc,updateIndex:ca,updateOperation:Qc},Symbol.toStringTag,{value:"Module"}));class Id{constructor(){Ze(this,"revs",new Map);Ze(this,"layoutVersion",0);Ze(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}const vg=[400,1200];function xg(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function Cg(e){const n=xg(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Sg=e=>new Promise(n=>setTimeout(n,e));class vd{constructor(n){Ze(this,"cache",new Id);Ze(this,"newClientOpId");Ze(this,"debounceMs");Ze(this,"retryDelaysMs");Ze(this,"emissions",new WeakMap);Ze(this,"open",null);Ze(this,"debounceHandle",null);Ze(this,"queue",[]);Ze(this,"sending",!1);Ze(this,"_frozen",!1);Ze(this,"stack",null);Ze(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Be,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??vg}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!Cg(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Sg(c)}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(n){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(n.revs))this.cache.setRev(o,i);this.cache.layoutVersion=n.layoutVersion,this.cache.logicalVersion=n.logicalVersion}}freeze(n){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,n),this.notifySettled()}notifySettled(){if(this.hasPending)return;const n=this.settledWaiters;this.settledWaiters=[];for(const o of n)o()}}const xd=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","attribute.reorder","operation.reorder","group.add","group.update","group.remove","group.addMember","group.removeMember"],Cd=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Sd(e,n){var r;if(!n.length||!((r=e.indexes)!=null&&r.length))return[];const o=new Set(n),i=new Set;for(const l of e.attributes)if(o.has(l.modelId)){i.add(l.modelId);for(const s of l.dbAttrs)i.add(s.modelId)}if(!i.size)return[];const a=[];for(const l of e.indexes){const s=l.columns.filter(c=>!i.has(c.columnRef));s.length!==l.columns.length&&a.push({indexRef:l.modelId,columns:s})}return a}function Rg(e){return e.flatMap(n=>n.dbAttrs).length}function Rd(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function $g(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=Ko(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function Ag(e,n,o=Be){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=Rg(i.attributes);if(a===0)return[];const r=Rd(e,n),l=i.attributes.flatMap(c=>c.dbAttrs),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;$g(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function $d(e,n,o){var h;const i=e.entities.find(p=>p.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(p=>[p.modelId,p])),l=[];for(const p of o){const y=r.get(p);if(!y)return[];l.push(y)}const s=a.flatMap(p=>p.dbAttrs).map(p=>p.modelId),c=l.flatMap(p=>p.dbAttrs).map(p=>p.modelId);if(s.length!==c.length)return[];if(s.every((p,y)=>p===c[y]))return[];const d=new Map(s.map((p,y)=>[p,y])),u=Rd(e,n),m=[];for(const p of e.entities)for(const y of p.attributes){if(y.attrType!=="EMBED_OWN"||((h=y.embedded)==null?void 0:h.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const b=c.map(g=>y.dbAttrs[d.get(g)]),f=b.reduce((g,k,_)=>k===y.dbAttrs[_]?g:g+1,0);f&&m.push({entityId:p.modelId,attributeId:y.modelId,dbAttrs:b,moved:f})}return m}function Tg(e,n){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===n.ref}),i=()=>e.entities.filter(r=>r.name===n.ref);if(n.by==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Mg(e,n){const o=()=>e.attributes.filter(r=>r.name===n.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===n.ref));if(n.by==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function Ad(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function yt(e,n){const o=Tg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>Dg(i,e))}}function Vg(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Qr(e,n){const o=Vg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function el(e,n,o){return e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const Bg=new Set(["name","description","packageName","excludeDDLGeneration"]);function Dg(e,n){var a;const o=Gi(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(h=>h.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function Td(e,n){const o=Mg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Lg(e,n){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===n.ref),i=()=>e.attributes.filter(r=>r.name===n.ref).flatMap(r=>r.dbAttrs);if(n.by==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Og(e,n){const o=Lg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Md(e,n){const o=e.filter(i=>i.physicalName===n.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function tl(e){return e.by!==void 0&&e.by!=="name"}function Pg(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function zg(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function Fg(e,n){const o=Pg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Vd(e,n){const o=zg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Bd(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function Dd(e){return Bd(e)&&e.dataType==null}function Ld(e,n,o){const i=Bd(e);return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:n,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function Od(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),m=[];let h=!1;for(const p of n.fields){const y=u.get(p.name);if(y!=null&&y.sharedColumnPhysicalName){const b={ref:y.sharedColumnPhysicalName,by:"physicalName"},f=Md(En(i,a),b);if(!f.ok){s.push(f.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:b}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:b,matches:f.matches}),h=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:f.value.modelId});continue}m.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return h?null:{modelId:d,name:e.name,type:n.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:m}}const Ug=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs"]),Hg=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table"]),jg=new Set(["description","identifying"]),Kg=new Set(["multiplicity","navigable","composition"]),Gg=new Set(["name","unique","description","parameters"]),Yg=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Eo(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const nl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),qg=new Set([...nl].filter(e=>e!=="sharedColumnRef"));function Wg(e,n,o,i){if(i||o.some(l=>!qg.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))nl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function Jg(e,n,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,h)=>{const p=n.fields[h],y=p?c.get(p.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const f={ref:y.sharedColumnPhysicalName,by:"physicalName"},g=Md(En(i,a),f);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:f}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:f,matches:g.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:g.value.modelId});return}const b={...m};delete b.sharedColumnRef,d.push({...b,...y.physicalName!=null?{physicalName:y.physicalName}:{},...y.length!=null?{length:y.length}:{},...y.scale!=null?{scale:y.scale}:{},...y.insertable!=null?{insertable:y.insertable}:{},...y.updatable!=null?{updatable:y.updatable}:{}})}),u?null:d}function Pd(e,n,o){return{modelId:o(),name:e.name,order:n,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function zd(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=Og(e,c.column);if(!d.ok){a.push(d.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:c.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:c.column,matches:d.matches}),s=!0;continue}l.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:r(),name:n.name,unique:n.unique??!1,columns:l,...n.description?{description:n.description}:{},...n.parameters?{parameters:n.parameters}:{}}}function No(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function Xg(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of Sd(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function ol(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of sc(n,o,i)){for(const u of c.remove)No(e,a,s,u);for(const u of c.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:s,entityRef:s,attributeRef:u.attributeId,patch:u.patch});const d=((l=n.entities.find(u=>u.modelId===s))==null?void 0:l.attributes)??[];for(const u of c.add)e.push({kind:"attribute.add",casUnit:"logical",containerRef:s,entityRef:s,value:{...u,order:r(s,d)}})}}function Zg(e,n,o={}){const i=o.mkId??Be,a=o.embeddableCatalog??[],r=f=>a.find(g=>g.type===f),l=[],s=[],c=new Map,d=(f,g)=>{const k=c.get(f)??$t(g);return c.set(f,k+1),k},u=new Map,m=new Set,h=new Set,p={seen:new Set,pairs:[]},y=new Set;for(const f of n)f.kind==="entity.add"&&(y.add(f.spec.name),f.spec.physicalName&&y.add(f.spec.physicalName));const b=new Set;return n.forEach((f,g)=>{var k,_,N,I,A;switch(f.kind){case"entity.add":{const x=e.entities.filter(E=>E.name===f.spec.name).map(E=>E.modelId);if(x.length||b.has(f.spec.name)){s.push({code:"entity-name-conflict",opIndex:g,handle:{ref:f.spec.name},matches:x});break}b.add(f.spec.name);const $=i(),T={modelId:$,name:f.spec.name,stereotype:f.spec.stereotype??"JPA_ENTITY",attributes:[],...f.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...f.spec.physicalName?{table:{physicalName:f.spec.physicalName}}:{}},V={ref:f.spec.name};let R=!1;for(const[E,w]of(f.spec.attributes??[]).entries()){if(w.type==="GroupCodeEnum"&&!w.groupCode){s.push({code:"groupcode-required",opIndex:g,entity:V,handle:{ref:w.name}}),R=!0;continue}if(!r(w.type)&&!((k=w.embeddableOverrides)!=null&&k.length)&&Dd(w)){s.push({code:"datatype-required",opIndex:g,entity:V,handle:{ref:w.name}}),R=!0;continue}const S=r(w.type);if(S){const B=Od(w,S,E,T,e.entities,g,V,s,i);B?T.attributes.push(B):R=!0}else(_=w.embeddableOverrides)!=null&&_.length?(s.push({code:"embeddable-type-unresolved",opIndex:g,entity:V,handle:{ref:w.name}}),R=!0):T.attributes.push(Ld(w,E,i))}const C=(f.spec.operations??[]).map((E,w)=>Pd(E,w,i));C.length&&(T.operations=C);const M=[];for(const E of f.spec.indexes??[]){const w=zd(T,E,g,V,s,i);w?M.push(w):R=!0}if(M.length&&(T.indexes=M),R)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:$,value:T});break}case"entity.update":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}const $=Eo(f.patch,Hg,["jpaAttrs.","table."]);if($.length){s.push({code:"entity-patch-unknown-key",opIndex:g,entity:f.entity,keys:$});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,patch:f.patch});break}case"entity.remove":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}const $=x.value.modelId,T=e.associations.filter(M=>M.end1.entityRef===$||M.end2.entityRef===$),V=new Set(T.map(M=>M.modelId));for(const M of T)m.has(M.modelId)||(m.add(M.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:M.modelId}));for(const M of e.entities)if(M.modelId!==$)for(const E of M.attributes)E.embedded&&V.has(E.embedded.associationRef)&&No(l,p,M.modelId,E.modelId);for(const M of T){if(M.end1.entityRef===$||!M.end1.attributeRef)continue;const E=e.entities.find(S=>S.modelId===M.end1.entityRef),w=E==null?void 0:E.attributes.find(S=>S.modelId===M.end1.attributeRef&&S.attrType==="RELATION_REF");w&&No(l,p,E.modelId,w.modelId)}const R={...e,entities:e.entities.filter(M=>M.modelId!==$),associations:e.associations.filter(M=>!V.has(M.modelId))},C=new Set(T.filter(M=>M.end1.entityRef===$&&M.end2.entityRef!==$).map(M=>M.end2.entityRef));for(const M of C)ol(l,R,M,i,p,d);h.add($),l.push({kind:"entity.remove",casUnit:"logical",entityRef:$});break}case"attribute.add":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:g,entity:f.entity,handle:{ref:f.spec.name}});break}if(!r(f.spec.type)&&!((N=f.spec.embeddableOverrides)!=null&&N.length)&&Dd(f.spec)){s.push({code:"datatype-required",opIndex:g,entity:f.entity,handle:{ref:f.spec.name}});break}const $=d(x.value.modelId,x.value.attributes),T=r(f.spec.type);let V;if(T)V=Od(f.spec,T,$,x.value,e.entities,g,f.entity,s,i);else if((I=f.spec.embeddableOverrides)!=null&&I.length){s.push({code:"embeddable-type-unresolved",opIndex:g,entity:f.entity,handle:{ref:f.spec.name}});break}else V=Ld(f.spec,$,i);if(!V)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:V});break}case"attribute.update":case"attribute.remove":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}const $=Td(x.value,f.attribute);if(!$.ok){s.push($.reason==="not-found"?{code:"attribute-not-found",opIndex:g,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:g,entity:f.entity,handle:f.attribute,matches:$.matches});break}if(f.kind==="attribute.update"){const T=[],V=[];let R=!1;for(const w of Object.keys(f.patch)){if(w.includes(".")){w.startsWith("dbAttrs.")?R=!0:V.push(w);continue}nl.has(w)?T.push(w):Ug.has(w)||V.push(w)}if(V.length){s.push({code:"attribute-patch-unknown-key",opIndex:g,entity:f.entity,handle:f.attribute,keys:V});break}if("attrType"in f.patch){const w=String(f.patch.attrType),S=Cd.includes(w)?w!==$.value.attrType?"transition":void 0:"unknown-value";if(S){s.push({code:"attribute-attrtype-unsupported",opIndex:g,entity:f.entity,handle:f.attribute,reason:S,current:$.value.attrType,requested:w});break}}const C="type"in f.patch?f.patch.type:$.value.type,M="groupCode"in f.patch?f.patch.groupCode:$.value.groupCode;if(C==="GroupCodeEnum"&&!M){s.push({code:"groupcode-required",opIndex:g,entity:f.entity,handle:f.attribute});break}let E=f.patch;if(T.length){const w=Wg($.value,f.patch,T,R);if(!w){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:g,entity:f.entity,handle:f.attribute,keys:T});break}E=w}if((A=f.embeddableOverrides)!=null&&A.length){const w=r($.value.type);if(!w||$.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:g,entity:f.entity,handle:f.attribute});break}const S=Jg($.value,w,f.embeddableOverrides,x.value,e.entities,g,f.entity,s);if(!S)break;E={...E,dbAttrs:S}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:$.value.modelId,patch:E})}else{const T=Wi(e,x.value.modelId,$.value.modelId);if(T){const V=R=>{var C;return((C=e.entities.find(M=>M.modelId===R))==null?void 0:C.name)??R};s.push({code:"attribute-fk-managed",opIndex:g,entity:f.entity,handle:f.attribute,association:{from:V(T.end1.entityRef),to:V(T.end2.entityRef)}});break}No(l,p,x.value.modelId,$.value.modelId)}break}case"association.add":{const x=yt(e,f.spec.from),$=yt(e,f.spec.to);if(x.ok||s.push(gt(x.reason,g,f.spec.from,x.matches,y)),$.ok||s.push(gt($.reason,g,f.spec.to,$.matches,y)),!x.ok||!$.ok)break;if(f.spec.identifying&&x.value.modelId===$.value.modelId){s.push({code:"self-identifying",opIndex:g,handle:{from:f.spec.from,to:f.spec.to}});break}const T=i(),V={modelId:T,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:x.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:$.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},R={...e,associations:[...e.associations,V]},C=Yo(R,$.value.modelId,i);C.add[0]&&(V.end2.attributeRef=C.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:T,value:V});for(const M of C.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:$.value.modelId,entityRef:$.value.modelId,value:{...M,order:d($.value.modelId,$.value.attributes)}});break}case"association.remove":{const x=yt(e,f.association.from),$=yt(e,f.association.to);if(x.ok||s.push(gt(x.reason,g,f.association.from,x.matches,y)),$.ok||s.push(gt($.reason,g,f.association.to,$.matches,y)),!x.ok||!$.ok)break;const T=Ad(e,x.value.modelId,$.value.modelId);if(T.length!==1){s.push(T.length===0?{code:"association-not-found",opIndex:g,handle:f.association}:{code:"association-ambiguous",opIndex:g,handle:f.association,matches:T.map(M=>M.modelId)});break}const V=T[0];m.has(V.modelId)||(m.add(V.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:V.modelId}));const R=e.entities.find(M=>M.attributes.some(E=>{var w;return((w=E.embedded)==null?void 0:w.associationRef)===V.modelId}));if(R){const M=R.attributes.find(E=>{var w;return((w=E.embedded)==null?void 0:w.associationRef)===V.modelId});No(l,p,R.modelId,M.modelId);break}if(V.end1.attributeRef){const M=e.entities.find(w=>w.modelId===V.end1.entityRef),E=M==null?void 0:M.attributes.find(w=>w.modelId===V.end1.attributeRef&&w.attrType==="RELATION_REF");E&&No(l,p,M.modelId,E.modelId)}const C={...e,associations:e.associations.filter(M=>M.modelId!==V.modelId)};ol(l,C,V.end2.entityRef,i,p,d);break}case"association.update":{const x=Fd(e,f.association,g,s,y);if(!x)break;const $=f.patch.identifying,T=typeof $=="boolean"?$:void 0;if(T===!0&&x.end1.entityRef===x.end2.entityRef){s.push({code:"self-identifying",opIndex:g,handle:f.association});break}const V=Eo(f.patch,jg);if(V.length){s.push({code:"association-patch-unknown-key",opIndex:g,handle:f.association,keys:V});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,patch:f.patch}),T!==void 0&&T!==(x.identifying??!1)){const R={...e,associations:e.associations.map(C=>C.modelId===x.modelId?{...C,identifying:T}:C)};ol(l,R,x.end2.entityRef,i,p,d)}break}case"associationEnd.update":{const x=Fd(e,f.association,g,s,y);if(!x)break;const $=f.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(f.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:g,handle:f.association});break}const T=Eo(f.patch,Kg,["jpa."]);if(T.length){s.push({code:"association-end-patch-unknown-key",opIndex:g,handle:f.association,keys:T});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,end:$,patch:f.patch});break}case"index.add":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}const $=zd(x.value,f.spec,g,f.entity,s,i);if(!$)break;l.push({kind:"index.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:$.modelId,value:$});break}case"index.update":case"index.remove":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}if(tl(f.index)){s.push({code:"handle-by-unsupported",opIndex:g,entity:f.entity,handle:f.index,target:"index"});break}const $=Fg(x.value,f.index);if(!$.ok){s.push($.reason==="not-found"?{code:"index-not-found",opIndex:g,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:g,entity:f.entity,handle:f.index,matches:$.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:g,entity:f.entity,handle:f.index});break}const T=Eo(f.patch,Gg);if(T.length){s.push({code:"index-patch-unknown-key",opIndex:g,entity:f.entity,handle:f.index,keys:T});break}l.push({kind:"index.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:$.value.modelId,patch:f.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:$.value.modelId});break}case"operation.add":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}const $=u.get(x.value.modelId)??(x.value.operations?$t(x.value.operations):0);u.set(x.value.modelId,$+1);const T=Pd(f.spec,$,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:T.modelId,value:T});break}case"operation.update":case"operation.remove":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}if(tl(f.operation)){s.push({code:"handle-by-unsupported",opIndex:g,entity:f.entity,handle:f.operation,target:"operation"});break}const $=Vd(x.value,f.operation);if(!$.ok){s.push($.reason==="not-found"?{code:"operation-not-found",opIndex:g,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:g,entity:f.entity,handle:f.operation,matches:$.matches});break}if(f.kind==="operation.update"){const T=Eo(f.patch,Yg);if(T.length){s.push({code:"operation-patch-unknown-key",opIndex:g,entity:f.entity,handle:f.operation,keys:T});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:$.value.modelId,patch:f.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:$.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const x=f.kind==="attribute.reorder",$=yt(e,f.entity);if(!$.ok){s.push(gt($.reason,g,f.entity,$.matches,y));break}const T=x?f.order:f.operations,V=[],R=new Set;let C=!1;for(const S of T){if(!x&&tl(S)){s.push({code:"handle-by-unsupported",opIndex:g,entity:f.entity,handle:S,target:"operation"}),C=!0;continue}const B=x?Td($.value,S):Vd($.value,S);if(!B.ok){s.push(B.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:g,entity:f.entity,handle:S}:{code:"reorder-handle-ambiguous",opIndex:g,entity:f.entity,handle:S,matches:B.matches}),C=!0;continue}if(R.has(B.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:g,entity:f.entity,handle:S}),C=!0;continue}R.add(B.value.modelId),V.push(B.value)}if(C)break;const E=(x?$.value.attributes:$.value.operations??[]).filter(S=>!R.has(S.modelId)),w=[...V,...E];if(w.forEach((S,B)=>{S.order!==B&&l.push(x?{kind:"attribute.update",casUnit:"logical",containerRef:$.value.modelId,entityRef:$.value.modelId,attributeRef:S.modelId,patch:{order:B}}:{kind:"operation.update",casUnit:"logical",containerRef:$.value.modelId,entityRef:$.value.modelId,operationRef:S.modelId,patch:{order:B}})}),x)for(const S of $d(e,$.value.modelId,w.map(B=>B.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:S.entityId,entityRef:S.entityId,attributeRef:S.attributeId,patch:{dbAttrs:S.dbAttrs}});break}case"group.add":{const x=[];let $=!1;for(const R of f.spec.members){const C=yt(e,R);if(!C.ok){s.push(gt(C.reason,g,R,C.matches,y)),$=!0;continue}x.push(C.value.modelId)}if($)break;const T=i(),V={modelId:T,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:x,...f.spec.name?{name:f.spec.name}:{},...f.spec.packageName?{packageName:f.spec.packageName}:{},...f.spec.description?{description:f.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:T,value:V});break}case"group.update":{const x=Qr(e,f.group);if(!x.ok){s.push(el(x,g,f.group));break}const $=Eo(f.patch,Bg);if($.length){s.push({code:"group-patch-unknown-key",opIndex:g,handle:f.group,keys:$});break}l.push({kind:"group.update",casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,patch:f.patch});break}case"group.remove":{const x=Qr(e,f.group);if(!x.ok){s.push(el(x,g,f.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:x.value.modelId});break}case"group.addMember":case"group.removeMember":{const x=Qr(e,f.group);if(!x.ok){s.push(el(x,g,f.group));break}const $=yt(e,f.entity);if(!$.ok){s.push(gt($.reason,g,f.entity,$.matches,y));break}const T=x.value.memberEntityRefs.includes($.value.modelId);if(f.kind==="group.addMember"?T:!T)break;l.push({kind:f.kind,casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,entityRef:$.value.modelId});break}}}),s.length||Xg(l,e,p,h),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function gt(e,n,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:n,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:n,handle:o}:{code:"entity-ambiguous",opIndex:n,handle:o,matches:i}}function Fd(e,n,o,i,a){const r=yt(e,n.from),l=yt(e,n.to);if(r.ok||i.push(gt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(gt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Ad(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:n}:{code:"association-ambiguous",opIndex:o,handle:n,matches:s.map(c=>c.modelId)}),null):s[0]}const Ud={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},Qg={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},eb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},tb={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},In={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},nb={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...In,description:"속성 설명(다국어)."},columnLogicalName:{...In,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["name","type"],additionalProperties:!1},ob={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},Hd={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},ib={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Hd,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Hd,description:"end2 다중성(기본 ZERO_OR_MORE_INSTANCES)."},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK로 전파). self-association은 식별 불가."},composition:{type:"boolean",description:"end2 composition."}},required:["from","to"],additionalProperties:!1},ab={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Ud,description:"컬럼 핸들 — 컬럼 물리명 우선, 속성명 보조(단일 컬럼 속성만). 엔티티 내에서 dbAttr modelId로 해소."},descending:{type:"boolean",description:"내림차순(기본 false)."}},required:["column"],additionalProperties:!1}},description:{type:"string",description:"인덱스 설명(평문)."},parameters:{type:"string",description:"인덱스 파라미터(패스스루)."}},required:["name","columns"],additionalProperties:!1},rb={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...In,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},lb={type:"object",properties:{name:{...In,description:'그룹 논리명(다국어, 예: {ko:"주문"}).'},packageName:{type:"string",description:"자바 패키지명 등 그룹 물리 식별(레거시 LogicalGroup.packageName)."},description:{type:"string",description:"그룹 설명(자유 텍스트 — 도메인 경계 메모)."},excludeDDLGeneration:{type:"boolean",description:"DDL 생성 제외(기본 false)."},members:{type:"array",description:"멤버 엔티티 핸들(물리명 우선/논리명 보조). 기존 엔티티여야 함 — 같은 배치 신규 엔티티는 별도 배치 후.",items:{$ref:"#/$defs/handle"}}},required:["members"],additionalProperties:!1},sb={type:"object",description:"기존 속성 부분 patch. 논리 필드 + 스칼라 단일 컬럼의 물리 필드(physicalName·dataType·length·scale 등 — 서버가 dbAttrs[0]에 매핑). EMBED_PREDEF/Money 서브컬럼 조정은 op-레벨 embeddableOverrides로(평탄 키는 다중 컬럼서 모호해 거부).",properties:{name:{type:"string"},type:{type:"string"},customType:{type:"string"},attrType:{type:"string",enum:[...Cd],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},description:{...In,description:"속성 설명(다국어)."},attributeGroup:{type:"string"},groupCode:{type:"string"},defaultValue:{type:"string"},personalInfoAttributeType:{type:"string"},order:{type:"integer"},physicalName:{type:"string"},dataType:{type:"string"},length:{type:"integer"},scale:{type:"integer"},unique:{type:"boolean"},updatable:{type:"boolean"},insertable:{type:"boolean"},autoIncrement:{type:"boolean"},multiValue:{type:"boolean"},multiValueSeparator:{type:"string"},sequenceName:{type:"string"},logicalName:{...In,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},cb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},db={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},ub={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...In,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},mb={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·declarationOfInterfaces·table. jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경.'},fb={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function it(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const pb={"entity.add":it("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":it("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":it("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":it("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":it("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":it("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":it("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":it("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":it("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":it("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":it("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":it("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":it("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":it("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":it("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":it("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":it("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":it("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":it("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":it("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":it("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":it("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":it("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},hb={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},yb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...In,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},jd={anyOf:xd.map(e=>pb[e])},gb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Ud,nameHandle:Qg,groupHandle:hb,assocHandle:eb,entitySpec:tb,attrSpec:nb,embeddableOverrides:ob,assocSpec:ib,indexSpec:ab,operationSpec:rb,groupSpec:lb,entityUpdatePatch:mb,attrUpdatePatch:sb,assocUpdatePatch:cb,assocEndUpdatePatch:fb,indexUpdatePatch:db,operationUpdatePatch:ub,groupUpdatePatch:yb,symbolicOp:jd}};function bb(e,n,o,i={}){const a=i.mkClientOpId??Be,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=n[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const Kd={location:{x:0,y:0},size:{width:220,height:140}};function Gd(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const _b=/^[-=_*~\s]{3,}$/;function kb(e){return e.attrType&&e.attrType!=="NORMAL"||!_b.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Eb(e){return e.type===en&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Nb(e,n){if(e.attrType==="DIVIDER"||kb(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??n,dbAttrs:[]};const o=Eb(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??n,dbAttrs:e.dbAttrs.map(Gd)}}function wb(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function Ib(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(n=>({columnRef:n.targetColumn.refId,descending:n.descending}))}}function vb(e){var n,o;return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.map(Nb),operations:(n=e.operations)==null?void 0:n.map(wb),indexes:(o=e.indexes)==null?void 0:o.map(Ib),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function xb(e){const n={};for(const i of e.attributes)i.style&&(n[i.modelId]=i.style);const o={};for(const i of e.operations??[])i.style&&(o[i.modelId]=i.style);return{entityRef:e.modelId,geo:e.geo??{...Kd},style:e.style,attributeStyles:Object.keys(n).length?n:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function Yd(e){return e.jpaAttribute?{fetchType:e.jpaAttribute.fetchType,cascadeTypes:e.jpaAttribute.cascadeTypes,orphanRemoval:e.jpaAttribute.orphanRemoval,orderBy:e.jpaAttribute.orderBy,collectionType:e.jpaAttribute.collectionType,collectionTable:e.jpaAttribute.collectionTable,orderColumn:e.jpaAttribute.orderColumn}:void 0}function il(e){var n;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(n=e.attribute)==null?void 0:n.modelId,jpa:Yd(e)}}function Cb(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>al(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Sb(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:Cb(e),end1:il(e.end1),end2:il(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(a=e.end2.attribute)==null?void 0:a.modelId,style:e.style};return{assoc:n,layout:o}}function al(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function qd(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Wd(e){var o;const n=e.attribute;return(n==null?void 0:n.attrType)==="EMBED_OWN"&&(((o=n.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function Jd(e,n){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:n,dbAttrs:(e.dbAttrs??[]).map(Gd)}}function Rb(e,n,o){var N,I;const i=al(e.end1.attribute),a=al(e.end2.attribute);if(i===a)return Sb(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(I=(N=s.dbAttrs)==null?void 0:N[0])==null?void 0:I.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((A,x)=>Math.max(A,x.order),-1)+1:s.order??0,h={...Jd(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const p=n.get(r.endModel.refId),y=l.attribute;let b;if(y&&p&&r.navigable){const A=zi(l.multiplicity);b={modelId:y.modelId??crypto.randomUUID(),name:co(y.name??Ui((u==null?void 0:u.name)??l.endModel.refId,A),new Set(p.attributes.map(x=>x.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:p.attributes.reduce((x,$)=>Math.max(x,$.order),-1)+1,dbAttrs:[]},p.attributes.push(b)}const f=(A,x)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:x?b==null?void 0:b.modelId:h.modelId,jpa:Yd(A)}),g=r.endModel.refId===l.endModel.refId,k={modelId:e.modelId,description:e.description,identifying:!g&&h.identifier===!0?!0:void 0,end1:f(e.end1,i),end2:f(e.end2,a)},_={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:h.modelId,targetColumnRef:i?h.modelId:d,style:e.style};return{assoc:k,layout:_}}function $b(e,n){const o=e.targetModelId?n.get(e.targetModelId):void 0;return{modelId:e.modelId,physicalName:e.physicalName||(o==null?void 0:o.physicalName)||"",logicalName:e.logicalName??(o==null?void 0:o.logicalName),dataType:e.dataType||(o==null?void 0:o.dataType)||"",length:e.length??(o==null?void 0:o.length),scale:e.scale??(o==null?void 0:o.scale),unique:e.unique??(o==null?void 0:o.unique),autoIncrement:e.autoIncrement??(o==null?void 0:o.autoIncrement),updatable:e.updatable??(o==null?void 0:o.updatable),insertable:e.insertable??(o==null?void 0:o.insertable)}}function Ab(e,n,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((b,f)=>Math.max(b,f.order),-1)+1:l.order??0,d={...Jd(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(b=>$b(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...il(b),legacyEmbedRaw:b.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h?d.modelId:void 0,targetColumnRef:h?void 0:d.modelId,style:e.style};return{assoc:m,layout:p}}function Tb(e,n){var i,a,r,l;const o=[];for(const s of n){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(l=(r=s.end2)==null?void 0:r.endModel)==null?void 0:l.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function Xd(e,n={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:r,connections:l,ownedConnections:s,...c}=e;let d=l;if(!d&&Array.isArray(s)){const u=Tb(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+n.x,y:a.location.y+n.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function Zd(e,n,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(n.map(l=>[l.modelId,l])),r=(l,s)=>{var c;return!!s&&!!((c=i.get(l??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const l of o){const s=a.get(l.associationRef);s&&(l.sourceColumnRef&&!r(s.end1.entityRef,l.sourceColumnRef)&&(l.sourceColumnRef=void 0),l.targetColumnRef&&!r(s.end2.entityRef,l.targetColumnRef)&&(l.targetColumnRef=void 0))}}function Mb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.end1.navigable!==!0)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=i.end1.attributeRef?a.attributes.find(h=>h.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(h=>h.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=zi(i.end2.multiplicity),u=Ui(r.name,d),m=co(u,new Set(a.attributes.map(h=>h.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((h,p)=>Math.max(h,p.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function Vb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.identifying===!0||i.end1.entityRef===i.end2.entityRef)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=r.attributes.find(s=>s.modelId===i.end2.attributeRef);l&&l.attrType.startsWith("RELATION")&&l.dbAttrs.length>0&&l.identifier===!0&&(i.identifying=!0)}}function Qd(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if((l==null?void 0:l.stereotype)==="JPA_EMBEDDABLE")continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!Bs(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function eu(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?Bb(n):Db(n)}function Bb(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:h,...p}=m;return h!=null&&(o[m.modelId]=h),p},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);Mb(a,r),Vb(a,r),Qd(a,r);const{version:s,...c}=e.layout;Zd(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Db(e){var g,k;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(_,N)=>{o.push(vb(_));const I=xb(_);I.geo={location:{x:I.geo.location.x+N.x,y:I.geo.location.y+N.y},size:I.geo.size},i.push(I);for(const A of _.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const _ of e.entities??[])d(_,u);const m=[];for(const _ of e.groups??[]){const N=_.entities??[];l.push({modelId:_.modelId,name:_.name,description:_.description,packageName:_.packageName,excludeDDLGeneration:_.excludeDDLGeneration??!1,memberEntityRefs:N.map(A=>A.modelId)});const I=((g=_.geo)==null?void 0:g.location)??u;if(_.geo){const A=(_.notes??[]).map(x=>x.modelId);s.push({groupRef:_.modelId,geo:_.geo,style:_.style,locked:_.locked,memberNoteRefs:A.length?A:void 0})}for(const A of N)d(A,I);for(const A of _.notes??[])m.push(Xd(A,I))}const h=new Map(o.map(_=>[_.modelId,_])),p=new Map,y=new Map;for(const _ of o)for(const N of _.attributes)for(const I of N.dbAttrs)p.set(I.modelId,N.modelId),y.set(I.modelId,I);for(const _ of c)for(const N of[_.end1,_.end2]){const I=N.attribute;if(I&&(((k=I.dbAttrs)==null?void 0:k.length)??0)>0)for(const A of I.dbAttrs)A.modelId&&p.set(A.modelId,I.modelId)}for(const _ of c){const N=qd(_.end1.attribute),I=qd(_.end2.attribute),A=Wd(_.end1)||Wd(_.end2),{assoc:x,layout:$}=N!==I||A?Ab(_,h,y):Rb(_,h,p);a.push(x),r.push($)}Zd(o,a,r),Cc(o),Qd(o,a);const b={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(_=>Xd(_)),...m]}},f={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:f}}function tu(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function Lb(e,n){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(tu),style:n}}function Ob(e,n){var o;return{...e.legacyRaw,modelId:e.modelId,name:e.name,visibility:e.visibility,sourceCode:e.sourceCode,description:(o=e.description)==null?void 0:o.ko,order:e.order,personalInfoAttributeType:e.personalInfoAttributeType,style:n}}function Pb(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(n=>({targetColumn:{refId:n.columnRef},descending:n.descending}))}}function vn(e,n){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:n??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function zb(e,n){const o=n==null?void 0:n.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var r;return{...tu(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function Fb(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function nu(e,n){const o=l=>{if(!l.attributeRef)return;const s=n.logical.entities.find(c=>c.modelId===l.entityRef);return s==null?void 0:s.attributes.find(c=>c.modelId===l.attributeRef)},i=o(e.end1),a=o(e.end2),r=l=>(l==null?void 0:l.attrType)==="RELATION_OWN"?l:void 0;return(i==null?void 0:i.attrType)==="RELATION_REF"?{navEnd:e.end1,fkEnd:e.end2,navAttr:i,fk:r(a)}:(a==null?void 0:a.attrType)==="RELATION_REF"?{navEnd:e.end2,fkEnd:e.end1,navAttr:a,fk:r(i)}:null}function Ub(e){const n=new Set;for(const o of e.logical.associations){const i=nu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function Hb(e){const n=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&n.add(i.modelId);return n}function jb(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function Kb(e,n){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:n==null?void 0:n.modelId,physicalName:e.physicalName===((n==null?void 0:n.physicalName)??"")?"":e.physicalName,logicalName:jb(e.logicalName,n==null?void 0:n.logicalName)?void 0:e.logicalName,dataType:e.dataType===((n==null?void 0:n.dataType)??"")?"":e.dataType,length:o(e.length,n==null?void 0:n.length),scale:o(e.scale,n==null?void 0:n.scale),unique:o(e.unique,n==null?void 0:n.unique),autoIncrement:o(e.autoIncrement,n==null?void 0:n.autoIncrement),updatable:o(e.updatable,n==null?void 0:n.updatable),insertable:o(e.insertable,n==null?void 0:n.insertable)}}function Gb(e,n,o){let i;for(const m of n.logical.entities){const h=m.attributes.find(p=>{var y;return((y=p.embedded)==null?void 0:y.associationRef)===e.modelId});if(h){i=h;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((m,h)=>Kb(m,l[h]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:vn(e.end1,c?s:u),end2:vn(e.end2,c?u:s)}}function Yb(e,n,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:vn(e.end1,e.end1.legacyEmbedRaw),end2:vn(e.end2,e.end2.legacyEmbedRaw)};const a=Gb(e,n,i);if(a)return a;const r=nu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?zb(r.fk,l):void 0,c=Fb(r.navAttr);return{...i,end1:vn(e.end1,r.navEnd===e.end1?s:c),end2:vn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:vn(e.end1),end2:vn(e.end2)}}function ou(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(h=>h.entityRef===e.modelId),l=n.logical.associations.filter(h=>h.end1.entityRef===e.modelId),s=h=>n.layout.associationLayouts.find(p=>p.associationRef===h),c=(r==null?void 0:r.geo)??{...Kd},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(h=>!o.has(h.modelId)&&!i.has(h.modelId)).map(h=>{var p;return Lb(h,(p=r==null?void 0:r.attributeStyles)==null?void 0:p[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var p;return Ob(h,(p=r==null?void 0:r.operationStyles)==null?void 0:p[h.modelId])}),ownedAssociations:l.map(h=>Yb(h,n,s(h.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(Pb),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:r==null?void 0:r.style,collapsed:r==null?void 0:r.collapsed,locked:r==null?void 0:r.locked}}function qb(e,n,o,i){const a=n.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>n.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>n.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>iu(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>ou(c,n,o,i,l)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function iu(e,n={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-n.x,y:e.geo.location.y-n.y},size:e.geo.size},style:e.style,connections:e.connections}}function Wb(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=Ub(e),r=Hb(e),l=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:n.id,diagramVersion:n.diagramVersion,version:n.version,size:n.size??e.layout.canvasSize,packageName:n.packageName??e.logical.packageName,entities:i.map(s=>ou(s,e,a,r)),groups:e.logical.groups.map(s=>qb(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>iu(s))}}function Jb(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}const Xb=["notNull"];function Zb(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=eu(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(h=>[h.modelId,h]))]));for(const m of i.logical.entities){const h=c.get(m.modelId);if(h)for(const p of m.attributes){const y=h.get(p.modelId);if(!y){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:p}),s.navAdds++;continue}const b={};for(const f of Xb)p[f]===!0!=(y[f]===!0)&&(b[f]=p[f],s.attributeFieldsByName[f]=(s.attributeFieldsByName[f]??0)+1);Object.keys(b).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:p.modelId,patch:b}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const h=d.get(m.modelId);h&&(m.end1.attributeRef&&m.end1.attributeRef!==h.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&h.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function ei(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function an(e){return typeof e=="function"?e():t.unref(e)}const Qb=typeof window<"u"&&typeof document<"u",e_=e=>typeof e<"u",t_=Object.prototype.toString,n_=e=>t_.call(e)==="[object Object]",o_=()=>{};function i_(e,n){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>n.apply(this,i),{fn:n,thisArg:this,args:i})).then(a).catch(r)})}return o}const au=e=>e();function a_(e=au){const n=t.ref(!0);function o(){n.value=!1}function i(){n.value=!0}const a=(...r)=>{n.value&&e(...r)};return{isActive:t.readonly(n),pause:o,resume:i,eventFilter:a}}function ru(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function r_(e,n,o={}){const{eventFilter:i=au,...a}=o;return t.watch(e,i_(i,n),a)}function wo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=a_(i);return{stop:r_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function l_(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=t.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=an(n.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function rl(e,n=!1){function o(m,{flush:h="sync",deep:p=!1,timeout:y,throwOnTimeout:b}={}){let f=null;const k=[new Promise(_=>{f=t.watch(e,N=>{m(N)!==n&&(f==null||f(),_(N))},{flush:h,deep:p,immediate:!0})})];return y!=null&&k.push(ru(y,b).then(()=>an(e)).finally(()=>f==null?void 0:f())),Promise.race(k)}function i(m,h){if(!t.isRef(m))return o(N=>N===m,h);const{flush:p="sync",deep:y=!1,timeout:b,throwOnTimeout:f}=h??{};let g=null;const _=[new Promise(N=>{g=t.watch([e,m],([I,A])=>{n!==(I===A)&&(g==null||g(),N(I))},{flush:p,deep:y,immediate:!0})})];return b!=null&&_.push(ru(b,f).then(()=>an(e)).finally(()=>(g==null||g(),an(e)))),Promise.race(_)}function a(m){return o(h=>!!h,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,h){return o(p=>{const y=Array.from(p);return y.includes(m)||y.includes(an(m))},h)}function d(m){return u(1,m)}function u(m=1,h){let p=-1;return o(()=>(p+=1,p>=m),h)}return Array.isArray(an(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return rl(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return rl(e,!n)}}}function ll(e){return rl(e)}function s_(e){var n;const o=an(e);return(n=o==null?void 0:o.$el)!=null?n:o}const lu=Qb?window:void 0;function su(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=lu):[n,o,i,a]=e,!n)return o_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,h,p)=>(u.addEventListener(m,h,p),()=>u.removeEventListener(m,h,p)),c=t.watch(()=>[s_(n),an(a)],([u,m])=>{if(l(),!u)return;const h=n_(m)?{...m}:m;r.push(...o.flatMap(p=>i.map(y=>s(u,p,y,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return ei(d),d}function c_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function cu(...e){let n,o,i={};e.length===3?(n=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(n=!0,o=e[0],i=e[1]):(n=e[0],o=e[1]):(n=!0,o=e[0]);const{target:a=lu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=c_(n);return su(a,r,u=>{u.repeat&&an(s)||c(u)&&o(u)},l)}function d_(e){return JSON.parse(JSON.stringify(e))}function sl(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:h}=i,p=t.getCurrentInstance(),y=o||(p==null?void 0:p.emit)||((a=p==null?void 0:p.$emit)==null?void 0:a.bind(p))||((l=(r=p==null?void 0:p.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(p==null?void 0:p.proxy));let b=d;n||(n="modelValue"),b=b||`update:${n.toString()}`;const f=_=>s?typeof s=="function"?s(_):d_(_):_,g=()=>e_(e[n])?f(e[n]):m,k=_=>{h?h(_)&&y(b,_):y(b,_)};if(c){const _=g(),N=t.ref(_);let I=!1;return t.watch(()=>e[n],A=>{I||(I=!0,N.value=f(A),t.nextTick(()=>I=!1))}),t.watch(N,A=>{!I&&(A!==e[n]||u)&&k(A)},{deep:u}),N}else return t.computed({get(){return g()},set(_){k(_)}})}var u_={value:()=>{}};function ua(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new ma(o)}function ma(e){this._=e}function m_(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}ma.prototype=ua.prototype={constructor:ma,on:function(e,n){var o=this._,i=m_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=f_(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=du(o[a],e.name,n);else if(n==null)for(a in o)o[a]=du(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new ma(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function f_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function du(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=u_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var cl="http://www.w3.org/1999/xhtml";const uu={svg:"http://www.w3.org/2000/svg",xhtml:cl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function fa(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),uu.hasOwnProperty(n)?{space:uu[n],local:e}:e}function p_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===cl&&n.documentElement.namespaceURI===cl?n.createElement(e):n.createElementNS(o,e)}}function h_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mu(e){var n=fa(e);return(n.local?h_:p_)(n)}function y_(){}function dl(e){return e==null?y_:function(){return this.querySelector(e)}}function g_(e){typeof e!="function"&&(e=dl(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new St(i,this._parents)}function b_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function __(){return[]}function fu(e){return e==null?__:function(){return this.querySelectorAll(e)}}function k_(e){return function(){return b_(e.apply(this,arguments))}}function E_(e){typeof e=="function"?e=k_(e):e=fu(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new St(i,a)}function pu(e){return function(){return this.matches(e)}}function hu(e){return function(n){return n.matches(e)}}var N_=Array.prototype.find;function w_(e){return function(){return N_.call(this.children,e)}}function I_(){return this.firstElementChild}function v_(e){return this.select(e==null?I_:w_(typeof e=="function"?e:hu(e)))}var x_=Array.prototype.filter;function C_(){return Array.from(this.children)}function S_(e){return function(){return x_.call(this.children,e)}}function R_(e){return this.selectAll(e==null?C_:S_(typeof e=="function"?e:hu(e)))}function $_(e){typeof e!="function"&&(e=pu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new St(i,this._parents)}function yu(e){return new Array(e.length)}function A_(){return new St(this._enter||this._groups.map(yu),this._parents)}function pa(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}pa.prototype={constructor:pa,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function T_(e){return function(){return e}}function M_(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new pa(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function V_(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),p;for(s=0;s<u;++s)(c=n[s])&&(h[s]=p=l.call(c,c.__data__,s,n)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new pa(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function B_(e){return e.__data__}function D_(e,n){if(!arguments.length)return Array.from(this,B_);var o=n?V_:M_,i=this._parents,a=this._groups;typeof e!="function"&&(e=T_(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],h=m.length,p=L_(e.call(u,u&&u.__data__,d,i)),y=p.length,b=s[d]=new Array(y),f=l[d]=new Array(y),g=c[d]=new Array(h);o(u,m,b,f,g,p,n);for(var k=0,_=0,N,I;k<y;++k)if(N=b[k]){for(k>=_&&(_=k+1);!(I=f[_])&&++_<y;);N._next=I||null}}return l=new St(l,i),l._enter=s,l._exit=c,l}function L_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function O_(){return new St(this._exit||this._groups.map(yu),this._parents)}function P_(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function z_(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,h=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(h[y]=p);for(;c<a;++c)s[c]=o[c];return new St(s,this._parents)}function F_(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function U_(e){e||(e=H_);function n(m,h){return m&&h?e(m.__data__,h.__data__):!m-!h}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new St(a,this._parents).order()}function H_(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function j_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function K_(){return Array.from(this)}function G_(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function Y_(){let e=0;for(const n of this)++e;return e}function q_(){return!this.node()}function W_(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function J_(e){return function(){this.removeAttribute(e)}}function X_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Z_(e,n){return function(){this.setAttribute(e,n)}}function Q_(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function ek(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function tk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function nk(e,n){var o=fa(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?X_:J_:typeof n=="function"?o.local?tk:ek:o.local?Q_:Z_)(o,n))}function gu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ok(e){return function(){this.style.removeProperty(e)}}function ik(e,n,o){return function(){this.style.setProperty(e,n,o)}}function ak(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function rk(e,n,o){return arguments.length>1?this.each((n==null?ok:typeof n=="function"?ak:ik)(e,n,o??"")):Io(this.node(),e)}function Io(e,n){return e.style.getPropertyValue(n)||gu(e).getComputedStyle(e,null).getPropertyValue(n)}function lk(e){return function(){delete this[e]}}function sk(e,n){return function(){this[e]=n}}function ck(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function dk(e,n){return arguments.length>1?this.each((n==null?lk:typeof n=="function"?ck:sk)(e,n)):this.node()[e]}function bu(e){return e.trim().split(/^|\s+/)}function ul(e){return e.classList||new _u(e)}function _u(e){this._node=e,this._names=bu(e.getAttribute("class")||"")}_u.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ku(e,n){for(var o=ul(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Eu(e,n){for(var o=ul(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function uk(e){return function(){ku(this,e)}}function mk(e){return function(){Eu(this,e)}}function fk(e,n){return function(){(n.apply(this,arguments)?ku:Eu)(this,e)}}function pk(e,n){var o=bu(e+"");if(arguments.length<2){for(var i=ul(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?fk:n?uk:mk)(o,n))}function hk(){this.textContent=""}function yk(e){return function(){this.textContent=e}}function gk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function bk(e){return arguments.length?this.each(e==null?hk:(typeof e=="function"?gk:yk)(e)):this.node().textContent}function _k(){this.innerHTML=""}function kk(e){return function(){this.innerHTML=e}}function Ek(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Nk(e){return arguments.length?this.each(e==null?_k:(typeof e=="function"?Ek:kk)(e)):this.node().innerHTML}function wk(){this.nextSibling&&this.parentNode.appendChild(this)}function Ik(){return this.each(wk)}function vk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xk(){return this.each(vk)}function Ck(e){var n=typeof e=="function"?e:mu(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Sk(){return null}function Rk(e,n){var o=typeof e=="function"?e:mu(e),i=n==null?Sk:typeof n=="function"?n:dl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function $k(){var e=this.parentNode;e&&e.removeChild(this)}function Ak(){return this.each($k)}function Tk(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Mk(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Vk(e){return this.select(e?Mk:Tk)}function Bk(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Dk(e){return function(n){e.call(this,n,this.__data__)}}function Lk(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function Ok(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function Pk(e,n,o){return function(){var i=this.__on,a,r=Dk(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function zk(e,n,o){var i=Lk(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?Pk:Ok,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Nu(e,n,o){var i=gu(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function Fk(e,n){return function(){return Nu(this,e,n)}}function Uk(e,n){return function(){return Nu(this,e,n.apply(this,arguments))}}function Hk(e,n){return this.each((typeof n=="function"?Uk:Fk)(e,n))}function*jk(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var wu=[null];function St(e,n){this._groups=e,this._parents=n}function ti(){return new St([[document.documentElement]],wu)}function Kk(){return this}St.prototype=ti.prototype={constructor:St,select:g_,selectAll:E_,selectChild:v_,selectChildren:R_,filter:$_,data:D_,enter:A_,exit:O_,join:P_,merge:z_,selection:Kk,order:F_,sort:U_,call:j_,nodes:K_,node:G_,size:Y_,empty:q_,each:W_,attr:nk,style:rk,property:dk,classed:pk,text:bk,html:Nk,raise:Ik,lower:xk,append:Ck,insert:Rk,remove:Ak,clone:Vk,datum:Bk,on:zk,dispatch:Hk,[Symbol.iterator]:jk};function Vt(e){return typeof e=="string"?new St([[document.querySelector(e)]],[document.documentElement]):new St([[e]],wu)}function Gk(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Kt(e,n){if(e=Gk(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const Yk={passive:!1},ni={capture:!0,passive:!1};function ml(e){e.stopImmediatePropagation()}function vo(e){e.preventDefault(),e.stopImmediatePropagation()}function Iu(e){var n=e.document.documentElement,o=Vt(e).on("dragstart.drag",vo,ni);"onselectstart"in n?o.on("selectstart.drag",vo,ni):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function vu(e,n){var o=e.document.documentElement,i=Vt(e).on("dragstart.drag",null);n&&(i.on("click.drag",vo,ni),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const ha=e=>()=>e;function fl(e,{sourceEvent:n,subject:o,target:i,identifier:a,active:r,x:l,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}fl.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function qk(e){return!e.ctrlKey&&!e.button}function Wk(){return this.parentNode}function Jk(e,n){return n??{x:e.x,y:e.y}}function Xk(){return navigator.maxTouchPoints||"ontouchstart"in this}function Zk(){var e=qk,n=Wk,o=Jk,i=Xk,a={},r=ua("start","drag","end"),l=0,s,c,d,u,m=0;function h(N){N.on("mousedown.drag",p).filter(i).on("touchstart.drag",f).on("touchmove.drag",g,Yk).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(N,I){if(!(u||!e.call(this,N,I))){var A=_(this,n.call(this,N,I),N,I,"mouse");A&&(Vt(N.view).on("mousemove.drag",y,ni).on("mouseup.drag",b,ni),Iu(N.view),ml(N),d=!1,s=N.clientX,c=N.clientY,A("start",N))}}function y(N){if(vo(N),!d){var I=N.clientX-s,A=N.clientY-c;d=I*I+A*A>m}a.mouse("drag",N)}function b(N){Vt(N.view).on("mousemove.drag mouseup.drag",null),vu(N.view,d),vo(N),a.mouse("end",N)}function f(N,I){if(e.call(this,N,I)){var A=N.changedTouches,x=n.call(this,N,I),$=A.length,T,V;for(T=0;T<$;++T)(V=_(this,x,N,I,A[T].identifier,A[T]))&&(ml(N),V("start",N,A[T]))}}function g(N){var I=N.changedTouches,A=I.length,x,$;for(x=0;x<A;++x)($=a[I[x].identifier])&&(vo(N),$("drag",N,I[x]))}function k(N){var I=N.changedTouches,A=I.length,x,$;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),x=0;x<A;++x)($=a[I[x].identifier])&&(ml(N),$("end",N,I[x]))}function _(N,I,A,x,$,T){var V=r.copy(),R=Kt(T||A,I),C,M,E;if((E=o.call(N,new fl("beforestart",{sourceEvent:A,target:h,identifier:$,active:l,x:R[0],y:R[1],dx:0,dy:0,dispatch:V}),x))!=null)return C=E.x-R[0]||0,M=E.y-R[1]||0,function w(S,B,z){var K=R,J;switch(S){case"start":a[$]=w,J=l++;break;case"end":delete a[$],--l;case"drag":R=Kt(z||B,I),J=l;break}V.call(S,N,new fl(S,{sourceEvent:B,subject:E,target:h,identifier:$,active:J,x:R[0]+C,y:R[1]+M,dx:R[0]-K[0],dy:R[1]-K[1],dispatch:V}),x)}}return h.filter=function(N){return arguments.length?(e=typeof N=="function"?N:ha(!!N),h):e},h.container=function(N){return arguments.length?(n=typeof N=="function"?N:ha(N),h):n},h.subject=function(N){return arguments.length?(o=typeof N=="function"?N:ha(N),h):o},h.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:ha(!!N),h):i},h.on=function(){var N=r.on.apply(r,arguments);return N===r?h:N},h.clickDistance=function(N){return arguments.length?(m=(N=+N)*N,h):Math.sqrt(m)},h}function pl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function xu(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function oi(){}var ii=.7,ya=1/ii,xo="\\s*([+-]?\\d+)\\s*",ai="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Gt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qk=/^#([0-9a-f]{3,8})$/,eE=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),tE=new RegExp(`^rgb\\(${Gt},${Gt},${Gt}\\)$`),nE=new RegExp(`^rgba\\(${xo},${xo},${xo},${ai}\\)$`),oE=new RegExp(`^rgba\\(${Gt},${Gt},${Gt},${ai}\\)$`),iE=new RegExp(`^hsl\\(${ai},${Gt},${Gt}\\)$`),aE=new RegExp(`^hsla\\(${ai},${Gt},${Gt},${ai}\\)$`),Cu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};pl(oi,Un,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Su,formatHex:Su,formatHex8:rE,formatHsl:lE,formatRgb:Ru,toString:Ru});function Su(){return this.rgb().formatHex()}function rE(){return this.rgb().formatHex8()}function lE(){return Vu(this).formatHsl()}function Ru(){return this.rgb().formatRgb()}function Un(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=Qk.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?$u(n):o===3?new It(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ga(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ga(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=eE.exec(e))?new It(n[1],n[2],n[3],1):(n=tE.exec(e))?new It(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=nE.exec(e))?ga(n[1],n[2],n[3],n[4]):(n=oE.exec(e))?ga(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=iE.exec(e))?Mu(n[1],n[2]/100,n[3]/100,1):(n=aE.exec(e))?Mu(n[1],n[2]/100,n[3]/100,n[4]):Cu.hasOwnProperty(e)?$u(Cu[e]):e==="transparent"?new It(NaN,NaN,NaN,0):null}function $u(e){return new It(e>>16&255,e>>8&255,e&255,1)}function ga(e,n,o,i){return i<=0&&(e=n=o=NaN),new It(e,n,o,i)}function sE(e){return e instanceof oi||(e=Un(e)),e?(e=e.rgb(),new It(e.r,e.g,e.b,e.opacity)):new It}function hl(e,n,o,i){return arguments.length===1?sE(e):new It(e,n,o,i??1)}function It(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}pl(It,hl,xu(oi,{brighter(e){return e=e==null?ya:Math.pow(ya,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ii:Math.pow(ii,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new It(Hn(this.r),Hn(this.g),Hn(this.b),ba(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Au,formatHex:Au,formatHex8:cE,formatRgb:Tu,toString:Tu}));function Au(){return`#${jn(this.r)}${jn(this.g)}${jn(this.b)}`}function cE(){return`#${jn(this.r)}${jn(this.g)}${jn(this.b)}${jn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Tu(){const e=ba(this.opacity);return`${e===1?"rgb(":"rgba("}${Hn(this.r)}, ${Hn(this.g)}, ${Hn(this.b)}${e===1?")":`, ${e})`}`}function ba(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Hn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jn(e){return e=Hn(e),(e<16?"0":"")+e.toString(16)}function Mu(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Bt(e,n,o,i)}function Vu(e){if(e instanceof Bt)return new Bt(e.h,e.s,e.l,e.opacity);if(e instanceof oi||(e=Un(e)),!e)return new Bt;if(e instanceof Bt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Bt(l,s,c,e.opacity)}function dE(e,n,o,i){return arguments.length===1?Vu(e):new Bt(e,n,o,i??1)}function Bt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}pl(Bt,dE,xu(oi,{brighter(e){return e=e==null?ya:Math.pow(ya,e),new Bt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ii:Math.pow(ii,e),new Bt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new It(yl(e>=240?e-240:e+120,a,i),yl(e,a,i),yl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Bt(Bu(this.h),_a(this.s),_a(this.l),ba(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ba(this.opacity);return`${e===1?"hsl(":"hsla("}${Bu(this.h)}, ${_a(this.s)*100}%, ${_a(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Bu(e){return e=(e||0)%360,e<0?e+360:e}function _a(e){return Math.max(0,Math.min(1,e||0))}function yl(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const gl=e=>()=>e;function uE(e,n){return function(o){return e+o*n}}function mE(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function fE(e){return(e=+e)==1?Du:function(n,o){return o-n?mE(n,o,e):gl(isNaN(n)?o:n)}}function Du(e,n){var o=n-e;return o?uE(e,o):gl(isNaN(e)?n:e)}const ka=(function e(n){var o=fE(n);function i(a,r){var l=o((a=hl(a)).r,(r=hl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Du(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function pE(e,n){n||(n=[]);var o=e?Math.min(n.length,e.length):0,i=n.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+n[a]*r;return i}}function hE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function yE(e,n){var o=n?n.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),r=new Array(o),l;for(l=0;l<i;++l)a[l]=ri(e[l],n[l]);for(;l<o;++l)r[l]=n[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function gE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function Yt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function bE(e,n){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(a in n)a in e?o[a]=ri(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var bl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_l=new RegExp(bl.source,"g");function _E(e){return function(){return e}}function kE(e){return function(n){return e(n)+""}}function Lu(e,n){var o=bl.lastIndex=_l.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=bl.exec(e))&&(a=_l.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Yt(i,a)})),o=_l.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?kE(c[0].x):_E(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function ri(e,n){var o=typeof n,i;return n==null||o==="boolean"?gl(n):(o==="number"?Yt:o==="string"?(i=Un(n))?(n=i,ka):Lu:n instanceof Un?ka:n instanceof Date?gE:hE(n)?pE:Array.isArray(n)?yE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?bE:Yt)(e,n)}var Ou=180/Math.PI,kl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Pu(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*Ou,skewX:Math.atan(c)*Ou,scaleX:l,scaleY:s}}var Ea;function EE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?kl:Pu(n.a,n.b,n.c,n.d,n.e,n.f)}function NE(e){return e==null||(Ea||(Ea=document.createElementNS("http://www.w3.org/2000/svg","g")),Ea.setAttribute("transform",e),!(e=Ea.transform.baseVal.consolidate()))?kl:(e=e.matrix,Pu(e.a,e.b,e.c,e.d,e.e,e.f))}function zu(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push("translate(",null,n,null,o);y.push({i:b-4,x:Yt(d,m)},{i:b-2,x:Yt(u,h)})}else(m||h)&&p.push("translate("+m+n+h+o)}function l(d,u,m,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Yt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,h){d!==u?h.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Yt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push(a(p)+"scale(",null,",",null,")");y.push({i:b-4,x:Yt(d,m)},{i:b-2,x:Yt(u,h)})}else(m!==1||h!==1)&&p.push(a(p)+"scale("+m+","+h+")")}return function(d,u){var m=[],h=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,h),l(d.rotate,u.rotate,m,h),s(d.skewX,u.skewX,m,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,h),d=u=null,function(p){for(var y=-1,b=h.length,f;++y<b;)m[(f=h[y]).i]=f.x(p);return m.join("")}}}var wE=zu(EE,"px, ","px)","deg)"),IE=zu(NE,", ",")",")"),vE=1e-12;function Fu(e){return((e=Math.exp(e))+1/e)/2}function xE(e){return((e=Math.exp(e))-1/e)/2}function CE(e){return((e=Math.exp(2*e))-1)/(e+1)}const Na=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],h=l[2],p=u-s,y=m-c,b=p*p+y*y,f,g;if(b<vE)g=Math.log(h/d)/n,f=function(x){return[s+x*p,c+x*y,d*Math.exp(n*x*g)]};else{var k=Math.sqrt(b),_=(h*h-d*d+i*b)/(2*d*o*k),N=(h*h-d*d-i*b)/(2*h*o*k),I=Math.log(Math.sqrt(_*_+1)-_),A=Math.log(Math.sqrt(N*N+1)-N);g=(A-I)/n,f=function(x){var $=x*g,T=Fu(I),V=d/(o*k)*(T*CE(n*$+I)-xE(I));return[s+V*p,c+V*y,d*T/Fu(n*$+I)]}}return f.duration=g*1e3*n/Math.SQRT2,f}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Co=0,li=0,si=0,Uu=1e3,wa,ci,Ia=0,Kn=0,va=0,di=typeof performance=="object"&&performance.now?performance:Date,Hu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function El(){return Kn||(Hu(SE),Kn=di.now()+va)}function SE(){Kn=0}function xa(){this._call=this._time=this._next=null}xa.prototype=ju.prototype={constructor:xa,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?El():+o)+(n==null?0:+n),!this._next&&ci!==this&&(ci?ci._next=this:wa=this,ci=this),this._call=e,this._time=o,Nl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Nl())}};function ju(e,n,o){var i=new xa;return i.restart(e,n,o),i}function RE(){El(),++Co;for(var e=wa,n;e;)(n=Kn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Co}function Ku(){Kn=(Ia=di.now())+va,Co=li=0;try{RE()}finally{Co=0,AE(),Kn=0}}function $E(){var e=di.now(),n=e-Ia;n>Uu&&(va-=n,Ia=e)}function AE(){for(var e,n=wa,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:wa=o);ci=e,Nl(i)}function Nl(e){if(!Co){li&&(li=clearTimeout(li));var n=e-Kn;n>24?(e<1/0&&(li=setTimeout(Ku,e-di.now()-va)),si&&(si=clearInterval(si))):(si||(Ia=di.now(),si=setInterval($E,Uu)),Co=1,Hu(Ku))}}function Gu(e,n,o){var i=new xa;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var TE=ua("start","end","cancel","interrupt"),ME=[],Yu=0,qu=1,wl=2,Ca=3,Wu=4,Il=5,Sa=6;function Ra(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;VE(e,o,{name:n,index:i,group:a,on:TE,tween:ME,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Yu})}function vl(e,n){var o=Dt(e,n);if(o.state>Yu)throw new Error("too late; already scheduled");return o}function qt(e,n){var o=Dt(e,n);if(o.state>Ca)throw new Error("too late; already running");return o}function Dt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function VE(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=ju(r,0,o.time);function r(d){o.state=qu,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,p;if(o.state!==qu)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Ca)return Gu(l);p.state===Wu?(p.state=Sa,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<n&&(p.state=Sa,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Gu(function(){o.state===Ca&&(o.state=Wu,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=wl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===wl){for(o.state=Ca,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Il,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Il&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Sa,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function $a(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>wl&&i.state<Il,i.state=Sa,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function BE(e){return this.each(function(){$a(this,e)})}function DE(e,n){var o,i;return function(){var a=qt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function LE(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=qt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function OE(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Dt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?DE:LE)(o,e,n))}function xl(e,n,o){var i=e._id;return e.each(function(){var a=qt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Dt(a,i).value[n]}}function Ju(e,n){var o;return(typeof n=="number"?Yt:n instanceof Un?ka:(o=Un(n))?(n=o,ka):Lu)(e,n)}function PE(e){return function(){this.removeAttribute(e)}}function zE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function FE(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function UE(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function HE(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function jE(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function KE(e,n){var o=fa(e),i=o==="transform"?IE:Ju;return this.attrTween(e,typeof n=="function"?(o.local?jE:HE)(o,i,xl(this,"attr."+e,n)):n==null?(o.local?zE:PE)(o):(o.local?UE:FE)(o,i,n))}function GE(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function YE(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function qE(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&YE(e,r)),o}return a._value=n,a}function WE(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&GE(e,r)),o}return a._value=n,a}function JE(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=fa(e);return this.tween(o,(i.local?qE:WE)(i,n))}function XE(e,n){return function(){vl(this,e).delay=+n.apply(this,arguments)}}function ZE(e,n){return n=+n,function(){vl(this,e).delay=n}}function QE(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?XE:ZE)(n,e)):Dt(this.node(),n).delay}function e1(e,n){return function(){qt(this,e).duration=+n.apply(this,arguments)}}function t1(e,n){return n=+n,function(){qt(this,e).duration=n}}function n1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?e1:t1)(n,e)):Dt(this.node(),n).duration}function o1(e,n){if(typeof n!="function")throw new Error;return function(){qt(this,e).ease=n}}function i1(e){var n=this._id;return arguments.length?this.each(o1(n,e)):Dt(this.node(),n).ease}function a1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;qt(this,e).ease=o}}function r1(e){if(typeof e!="function")throw new Error;return this.each(a1(this._id,e))}function l1(e){typeof e!="function"&&(e=pu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new rn(i,this._parents,this._name,this._id)}function s1(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||d[p])&&(m[p]=h);for(;s<i;++s)l[s]=n[s];return new rn(l,this._parents,this._name,this._id)}function c1(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function d1(e,n,o){var i,a,r=c1(n)?vl:qt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function u1(e,n){var o=this._id;return arguments.length<2?Dt(this.node(),o).on.on(e):this.each(d1(o,e,n))}function m1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function f1(){return this.on("end.remove",m1(this._id))}function p1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=dl(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,h=0;h<c;++h)(u=s[h])&&(m=e.call(u,u.__data__,h,s))&&("__data__"in u&&(m.__data__=u.__data__),d[h]=m,Ra(d[h],n,o,h,d,Dt(u,o)));return new rn(r,this._parents,n,o)}function h1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=fu(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var h=e.call(u,u.__data__,m,c),p,y=Dt(u,o),b=0,f=h.length;b<f;++b)(p=h[b])&&Ra(p,n,o,b,h,y);r.push(h),l.push(u)}return new rn(r,l,n,o)}var y1=ti.prototype.constructor;function g1(){return new y1(this._groups,this._parents)}function b1(e,n){var o,i,a;return function(){var r=Io(this,e),l=(this.style.removeProperty(e),Io(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Xu(e){return function(){this.style.removeProperty(e)}}function _1(e,n,o){var i,a=o+"",r;return function(){var l=Io(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function k1(e,n,o){var i,a,r;return function(){var l=Io(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Io(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function E1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=qt(this,e),d=c.on,u=c.value[r]==null?s||(s=Xu(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function N1(e,n,o){var i=(e+="")=="transform"?wE:Ju;return n==null?this.styleTween(e,b1(e,i)).on("end.style."+e,Xu(e)):typeof n=="function"?this.styleTween(e,k1(e,i,xl(this,"style."+e,n))).each(E1(this._id,e)):this.styleTween(e,_1(e,i,n),o).on("end.style."+e,null)}function w1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function I1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&w1(e,l,o)),i}return r._value=n,r}function v1(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,I1(e,n,o??""))}function x1(e){return function(){this.textContent=e}}function C1(e){return function(){var n=e(this);this.textContent=n??""}}function S1(e){return this.tween("text",typeof e=="function"?C1(xl(this,"text",e)):x1(e==null?"":e+""))}function R1(e){return function(n){this.textContent=e.call(this,n)}}function $1(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&R1(a)),n}return i._value=e,i}function A1(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,$1(e))}function T1(){for(var e=this._name,n=this._id,o=Zu(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Dt(c,n);Ra(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new rn(i,this._parents,e,o)}function M1(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=qt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var V1=0;function rn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Zu(){return++V1}var ln=ti.prototype;rn.prototype={constructor:rn,select:p1,selectAll:h1,selectChild:ln.selectChild,selectChildren:ln.selectChildren,filter:l1,merge:s1,selection:g1,transition:T1,call:ln.call,nodes:ln.nodes,node:ln.node,size:ln.size,empty:ln.empty,each:ln.each,on:u1,attr:KE,attrTween:JE,style:N1,styleTween:v1,text:S1,textTween:A1,remove:f1,tween:OE,delay:QE,duration:n1,ease:i1,easeVarying:r1,end:M1,[Symbol.iterator]:ln[Symbol.iterator]};function B1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var D1={time:null,delay:0,duration:250,ease:B1};function L1(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function O1(e){var n,o;e instanceof rn?(n=e._id,e=e._name):(n=Zu(),(o=D1).time=El(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Ra(c,e,n,d,l,o||L1(c,n));return new rn(i,this._parents,e,n)}ti.prototype.interrupt=BE,ti.prototype.transition=O1;const Aa=e=>()=>e;function P1(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function sn(e,n,o){this.k=e,this.x=n,this.y=o}sn.prototype={constructor:sn,scale:function(e){return e===1?this:new sn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new sn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var So=new sn(1,0,0);sn.prototype;function Cl(e){e.stopImmediatePropagation()}function ui(e){e.preventDefault(),e.stopImmediatePropagation()}function z1(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function F1(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Qu(){return this.__zoom||So}function U1(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function H1(){return navigator.maxTouchPoints||"ontouchstart"in this}function j1(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function K1(){var e=z1,n=F1,o=j1,i=U1,a=H1,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Na,d=ua("start","zoom","end"),u,m,h,p=500,y=150,b=0,f=10;function g(E){E.property("__zoom",Qu).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",V).filter(a).on("touchstart.zoom",R).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(E,w,S,B){var z=E.selection?E.selection():E;z.property("__zoom",Qu),E!==z?I(E,w,S,B):z.interrupt().each(function(){A(this,arguments).event(B).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},g.scaleBy=function(E,w,S,B){g.scaleTo(E,function(){var z=this.__zoom.k,K=typeof w=="function"?w.apply(this,arguments):w;return z*K},S,B)},g.scaleTo=function(E,w,S,B){g.transform(E,function(){var z=n.apply(this,arguments),K=this.__zoom,J=S==null?N(z):typeof S=="function"?S.apply(this,arguments):S,re=K.invert(J),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(k(K,pe),J,re),z,l)},S,B)},g.translateBy=function(E,w,S,B){g.transform(E,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof S=="function"?S.apply(this,arguments):S),n.apply(this,arguments),l)},null,B)},g.translateTo=function(E,w,S,B,z){g.transform(E,function(){var K=n.apply(this,arguments),J=this.__zoom,re=B==null?N(K):typeof B=="function"?B.apply(this,arguments):B;return o(So.translate(re[0],re[1]).scale(J.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof S=="function"?-S.apply(this,arguments):-S),K,l)},B,z)};function k(E,w){return w=Math.max(r[0],Math.min(r[1],w)),w===E.k?E:new sn(w,E.x,E.y)}function _(E,w,S){var B=w[0]-S[0]*E.k,z=w[1]-S[1]*E.k;return B===E.x&&z===E.y?E:new sn(E.k,B,z)}function N(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function I(E,w,S,B){E.on("start.zoom",function(){A(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(B).end()}).tween("zoom",function(){var z=this,K=arguments,J=A(z,K).event(B),re=n.apply(z,K),pe=S==null?N(re):typeof S=="function"?S.apply(z,K):S,ce=Math.max(re[1][0]-re[0][0],re[1][1]-re[0][1]),Ne=z.__zoom,he=typeof w=="function"?w.apply(z,K):w,de=c(Ne.invert(pe).concat(ce/Ne.k),he.invert(pe).concat(ce/he.k));return function(_e){if(_e===1)_e=he;else{var Se=de(_e),me=ce/Se[2];_e=new sn(me,pe[0]-Se[0]*me,pe[1]-Se[1]*me)}J.zoom(null,_e)}})}function A(E,w,S){return!S&&E.__zooming||new x(E,w)}function x(E,w){this.that=E,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(E,w),this.taps=0}x.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,w){return this.mouse&&E!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var w=Vt(this.that).datum();d.call(E,this.that,new P1(E,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),w)}};function $(E,...w){if(!e.apply(this,arguments))return;var S=A(this,w).event(E),B=this.__zoom,z=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,i.apply(this,arguments)))),K=Kt(E);if(S.wheel)(S.mouse[0][0]!==K[0]||S.mouse[0][1]!==K[1])&&(S.mouse[1]=B.invert(S.mouse[0]=K)),clearTimeout(S.wheel);else{if(B.k===z)return;S.mouse=[K,B.invert(K)],$a(this),S.start()}ui(E),S.wheel=setTimeout(J,y),S.zoom("mouse",o(_(k(B,z),S.mouse[0],S.mouse[1]),S.extent,l));function J(){S.wheel=null,S.end()}}function T(E,...w){if(h||!e.apply(this,arguments))return;var S=E.currentTarget,B=A(this,w,!0).event(E),z=Vt(E.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ce,!0),K=Kt(E,S),J=E.clientX,re=E.clientY;Iu(E.view),Cl(E),B.mouse=[K,this.__zoom.invert(K)],$a(this),B.start();function pe(Ne){if(ui(Ne),!B.moved){var he=Ne.clientX-J,de=Ne.clientY-re;B.moved=he*he+de*de>b}B.event(Ne).zoom("mouse",o(_(B.that.__zoom,B.mouse[0]=Kt(Ne,S),B.mouse[1]),B.extent,l))}function ce(Ne){z.on("mousemove.zoom mouseup.zoom",null),vu(Ne.view,B.moved),ui(Ne),B.event(Ne).end()}}function V(E,...w){if(e.apply(this,arguments)){var S=this.__zoom,B=Kt(E.changedTouches?E.changedTouches[0]:E,this),z=S.invert(B),K=S.k*(E.shiftKey?.5:2),J=o(_(k(S,K),B,z),n.apply(this,w),l);ui(E),s>0?Vt(this).transition().duration(s).call(I,J,B,E):Vt(this).call(g.transform,J,B,E)}}function R(E,...w){if(e.apply(this,arguments)){var S=E.touches,B=S.length,z=A(this,w,E.changedTouches.length===B).event(E),K,J,re,pe;for(Cl(E),J=0;J<B;++J)re=S[J],pe=Kt(re,this),pe=[pe,this.__zoom.invert(pe),re.identifier],z.touch0?!z.touch1&&z.touch0[2]!==pe[2]&&(z.touch1=pe,z.taps=0):(z.touch0=pe,K=!0,z.taps=1+!!u);u&&(u=clearTimeout(u)),K&&(z.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},p)),$a(this),z.start())}}function C(E,...w){if(this.__zooming){var S=A(this,w).event(E),B=E.changedTouches,z=B.length,K,J,re,pe;for(ui(E),K=0;K<z;++K)J=B[K],re=Kt(J,this),S.touch0&&S.touch0[2]===J.identifier?S.touch0[0]=re:S.touch1&&S.touch1[2]===J.identifier&&(S.touch1[0]=re);if(J=S.that.__zoom,S.touch1){var ce=S.touch0[0],Ne=S.touch0[1],he=S.touch1[0],de=S.touch1[1],_e=(_e=he[0]-ce[0])*_e+(_e=he[1]-ce[1])*_e,Se=(Se=de[0]-Ne[0])*Se+(Se=de[1]-Ne[1])*Se;J=k(J,Math.sqrt(_e/Se)),re=[(ce[0]+he[0])/2,(ce[1]+he[1])/2],pe=[(Ne[0]+de[0])/2,(Ne[1]+de[1])/2]}else if(S.touch0)re=S.touch0[0],pe=S.touch0[1];else return;S.zoom("touch",o(_(J,re,pe),S.extent,l))}}function M(E,...w){if(this.__zooming){var S=A(this,w).event(E),B=E.changedTouches,z=B.length,K,J;for(Cl(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),K=0;K<z;++K)J=B[K],S.touch0&&S.touch0[2]===J.identifier?delete S.touch0:S.touch1&&S.touch1[2]===J.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(J=Kt(J,this),Math.hypot(m[0]-J[0],m[1]-J[1])<f)){var re=Vt(this).on("dblclick.zoom");re&&re.apply(this,arguments)}}}return g.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:Aa(+E),g):i},g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Aa(!!E),g):e},g.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:Aa(!!E),g):a},g.extent=function(E){return arguments.length?(n=typeof E=="function"?E:Aa([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),g):n},g.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],g):[r[0],r[1]]},g.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],g):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},g.constrain=function(E){return arguments.length?(o=E,g):o},g.duration=function(E){return arguments.length?(s=+E,g):s},g.interpolate=function(E){return arguments.length?(c=E,g):c},g.on=function(){var E=d.on.apply(d,arguments);return E===d?g:E},g.clickDistance=function(E){return arguments.length?(b=(E=+E)*E,g):Math.sqrt(b)},g.tapDistance=function(E){return arguments.length?(f=+E,g):f},g}var Te=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Te||{}),Sl=(e=>(e.Partial="partial",e.Full="full",e))(Sl||{}),Gn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Gn||{}),cn=(e=>(e.Strict="strict",e.Loose="loose",e))(cn||{}),Rl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Rl||{}),mi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(mi||{}),em=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(em||{});const G1=["INPUT","SELECT","TEXTAREA"],Y1=typeof document<"u"?document:null;function $l(e){var n,o;const i=((o=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,r=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return G1.includes(i==null?void 0:i.nodeName)||a||!!r}function q1(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function tm(e,n,o,i){const a=n.replace("+",`
27
+ `}}const Qi="com.example",Gy="command.domain";function Wo(e,n,o={}){const i=Gi(e,n);if(i.kind==="explicit")return i.value;const a=o.packageConfig;if(a!=null&&a.basePackage){const r=i.value?`.${i.value}`:"",l=a.layerSuffix??Gy,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const Yy="CustomMoneyType",qy="Money";function Wy(e){return!(e.type!==Yy||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function Jy(e){const n=e.dbAttrs[0]??{modelId:Be(),physicalName:"",dataType:""},o={modelId:Be(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:qy,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function Xy(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Wy(l)?(a=!0,n=!0,Jy(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function Zy(e,n){const o=new Map,i=[],a=new Map;for(const y of e.entities){const b=new Map,f=new Map,g=new Map,k=(_,N,I)=>{if(!_)return;o.get(_)||o.set(_,[{entityId:N,assignedId:_}]),i.push({id:_,entityId:N,sink:I}),I(_)};for(const _ of y.attributes){k(_.modelId,y.modelId,N=>b.set(_,N));for(const N of _.dbAttrs)k(N.modelId,y.modelId,I=>f.set(N,I))}for(const _ of y.indexes??[])k(_.modelId,y.modelId,N=>g.set(_,N));a.set(y,{attrs:b,cols:f,idx:g})}const r=new Set(o.keys()),l=new Map;for(const y of i){const b=(l.get(y.id)??0)+1;if(l.set(y.id,b),b===1)continue;const f=Qy(y.id,b-1,r);r.add(f),o.get(y.id).push({entityId:y.entityId,assignedId:f}),y.sink(f)}const s=[...o.values()].reduce((y,b)=>y+Math.max(0,b.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,b)=>{var g;if(!b||!y)return b;const f=o.get(b);return!f||f.length<2?b:((g=f.find(k=>k.entityId===y))==null?void 0:g.assignedId)??b},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,b)=>{const f=d.get(y);if(f)return f.end1.entityRef===b?f.end2.entityRef:f.end1.entityRef},m=e.entities.map(y=>{var _;const b=a.get(y),f=y.attributes.map(N=>{const I=b.attrs.get(N),A=N.dbAttrs.map(T=>{const V=b.cols.get(T);return V===T.modelId?T:{...T,modelId:V}});let x=N.derivedFrom;if(x){const T=u(x.associationRef,y.modelId),V=c(T,x.sourceAttributeRef);V!==x.sourceAttributeRef&&(x={...x,sourceAttributeRef:V})}return I!==N.modelId||x!==N.derivedFrom||A.some((T,V)=>T!==N.dbAttrs[V])?{...N,modelId:I,dbAttrs:A,derivedFrom:x}:N}),g=(_=y.indexes)==null?void 0:_.map(N=>{const I=b.idx.get(N),A=N.columns.map($=>{const T=c(y.modelId,$.columnRef);return T===$.columnRef?$:{...$,columnRef:T}});return I!==N.modelId||A.some(($,T)=>$!==N.columns[T])?{...N,modelId:I,columns:A}:N});return f.some((N,I)=>N!==y.attributes[I])||g&&y.indexes&&g.some((N,I)=>N!==y.indexes[I])?{...y,attributes:f,...g?{indexes:g}:{}}:y}),h=e.associations.map(y=>{const b=c(y.end1.entityRef,y.end1.attributeRef),f=c(y.end2.entityRef,y.end2.attributeRef);return b===y.end1.attributeRef&&f===y.end2.attributeRef?y:{...y,end1:b===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:b},end2:f===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:f}}}),p=n.associationLayouts.map(y=>{const b=d.get(y.associationRef);if(!b)return y;const f=c(b.end1.entityRef,y.sourceColumnRef),g=c(b.end2.entityRef,y.targetColumnRef);return f===y.sourceColumnRef&&g===y.targetColumnRef?y:{...y,sourceColumnRef:f,targetColumnRef:g}});return{logical:{...e,entities:m,associations:h},layout:p.some((y,b)=>y!==n.associationLayouts[b])?{...n,associationLayouts:p}:n,reissued:s}}function Qy(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function $t(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function Fr(e,n,o){const i=new Set(n),a=e.filter(s=>i.has(s.modelId)),r=e.filter(s=>!i.has(s.modelId)),l=Math.max(0,Math.min(o,r.length));return[...r.slice(0,l),...a,...r.slice(l)]}function xc(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Cc(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(xc);if(!i.length)continue;const a=o.filter(s=>!xc(s));let r=0;a.forEach((s,c)=>{s.identifier&&!s.derivedFrom&&(r=c+1)});const l=[...a.slice(0,r),...i,...a.slice(r)];l.forEach((s,c)=>s.order=c),n.attributes=l}}function _o(e){return JSON.parse(JSON.stringify(e))}function Sc(e,n,o){var $;const i=o.idFactory??Be,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const T=new Set(n);for(const V of r.associations){const R=T.has(V.end1.entityRef),C=T.has(V.end2.entityRef);R!==C&&s.add(R?V.end2.entityRef:V.end1.entityRef)}}const c=r.entities.filter(T=>s.has(T.modelId)),d=new Set(c.map(T=>T.modelId)),u=r.associations.filter(T=>d.has(T.end1.entityRef)&&d.has(T.end2.entityRef)),m=new Set(u.map(T=>T.modelId)),h=new Map,p=T=>{let V=h.get(T);return V||(V=i(),h.set(T,V)),V};for(const T of c){p(T.modelId);for(const V of T.attributes){p(V.modelId);for(const R of V.dbAttrs)p(R.modelId)}for(const V of T.indexes??[])p(V.modelId);for(const V of T.operations??[])p(V.modelId)}for(const T of u)p(T.modelId);const y=T=>h.get(T),b=c.map(T=>{const V=_o(T);V.modelId=y(T.modelId),V.attributes=V.attributes.map(R=>eg(R,y,m,d));for(const R of V.indexes??[])R.modelId=y(R.modelId),R.columns=R.columns.map(C=>Vn(C.columnRef)?C:{...C,columnRef:y(C.columnRef)}).filter(C=>C.columnRef!==void 0);for(const R of V.operations??[])R.modelId=y(R.modelId);return V});Cc(b);const f=u.map(T=>{const V=_o(T);return V.modelId=y(T.modelId),V.end1=Rc(V.end1,y),V.end2=Rc(V.end2,y),V}),g=[];for(const T of r.groups){const V=T.memberEntityRefs.filter(C=>d.has(C));if(V.length===0)continue;const R=_o(T);R.modelId=p(T.modelId),R.memberEntityRefs=V.map(C=>y(C)),g.push(R)}const k=o.collisionSuffix??"_imported",_=new Set(o.existing.entities.map(T=>T.name)),N=new Set(o.existing.entities.map(T=>{var V;return(V=T.table)==null?void 0:V.physicalName}).filter(T=>!!T));for(const T of b)_.has(T.name)&&(T.name=`${T.name}${k}`),($=T.table)!=null&&$.physicalName&&N.has(T.table.physicalName)&&(T.table.physicalName=`${T.table.physicalName}${k}`);const I=[];for(const T of l.entityLayouts){const V=y(T.entityRef);if(!V)continue;const R=_o(T);R.entityRef=V,R.geo={...R.geo,location:Ur(R.geo.location,a)},R.attributeStyles&&(R.attributeStyles=ea(R.attributeStyles,y)),R.operationStyles&&(R.operationStyles=ea(R.operationStyles,y)),I.push(R)}const A=[];for(const T of l.associationLayouts){const V=y(T.associationRef);if(!V)continue;const R=_o(T);R.associationRef=V,R.sourceColumnRef=T.sourceColumnRef?y(T.sourceColumnRef):void 0,R.targetColumnRef=T.targetColumnRef?y(T.targetColumnRef):void 0,R.waypoints=R.waypoints.map(C=>Ur(C,a)),A.push(R)}const x=[];for(const T of l.groupLayouts){const V=y(T.groupRef);if(!V)continue;const R=_o(T);R.groupRef=V,R.geo={...R.geo,location:Ur(R.geo.location,a)},delete R.memberNoteRefs,x.push(R)}return{logical:{entities:b,associations:f,groups:g},layout:{entityLayouts:I,associationLayouts:A,groupLayouts:x},idMap:h}}function Ur(e,n){return{x:e.x+n.x,y:e.y+n.y}}function eg(e,n,o,i){e.modelId=n(e.modelId);for(const a of e.dbAttrs)if(a.modelId=n(a.modelId),a.sharedColumnRef!==void 0){const r=n(a.sharedColumnRef);r?a.sharedColumnRef=r:delete a.sharedColumnRef}return e.derivedFrom&&(o.has(e.derivedFrom.associationRef)?e.derivedFrom={associationRef:n(e.derivedFrom.associationRef),sourceAttributeRef:n(e.derivedFrom.sourceAttributeRef)??e.derivedFrom.sourceAttributeRef}:(delete e.derivedFrom,(e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF")&&(e.attrType="NORMAL"))),e.embedded&&(i.has(e.embedded.embeddableRef)?e.embedded={associationRef:n(e.embedded.associationRef)??e.embedded.associationRef,embeddableRef:n(e.embedded.embeddableRef)}:(delete e.embedded,e.attrType.startsWith("EMBED")&&(e.attrType="NORMAL"))),e}function Rc(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function ea(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function Hr(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function On(e,n){if(e===n||e==null&&n==null)return!0;if(e==null||n==null)return!1;if(Array.isArray(e)||Array.isArray(n))return!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length?!1:e.every((o,i)=>On(o,n[i]));if(typeof e=="object"&&typeof n=="object"){const o=new Set([...Object.keys(e),...Object.keys(n)]);for(const i of o)if(!On(e[i],n[i]))return!1;return!0}return!1}function Pn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||On(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function zn(e,n,o){const i=new Map(e.map(d=>[o(d),d])),a=new Map(n.map(d=>[o(d),d])),r=[],l=[],s=[];for(const[d,u]of a){const m=i.get(d);m?s.push({cur:m,tgt:u}):r.push(u)}for(const[d,u]of i)a.has(d)||l.push(u);const c=(d,u)=>o(d)<o(u)?-1:o(d)>o(u)?1:0;return r.sort(c),l.sort(c),s.sort((d,u)=>c(d.tgt,u.tgt)),{added:r,removed:l,common:s}}function tg(e,n){const o=new Set(e),i=new Set(n),a=n.filter(l=>!o.has(l)).sort(),r=e.filter(l=>!i.has(l)).sort();return{added:a,removed:r}}const ng=new Set(["attributes","operations","indexes","rev"]),og=new Set(["end1","end2","rev"]),ig=new Set(["memberEntityRefs","rev"]),$c=new Set(["modelId"]),ag=new Set(["modelId","columns"]),rg=new Set([]);function lg(e,n,o,i){const a=zn(n.attributes??[],o.attributes??[],s=>s.modelId);for(const s of a.removed)i.push({kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId});for(const s of a.added)i.push({kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of a.common){const d=Pn(s,c,$c);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=zn(n.operations??[],o.operations??[],s=>s.modelId);for(const s of r.removed)i.push({kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId});for(const s of r.added)i.push({kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of r.common){const d=Pn(s,c,$c);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=zn(n.indexes??[],o.indexes??[],s=>s.modelId);for(const s of l.removed)i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId});for(const s of l.added)i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:s});for(const{cur:s,tgt:c}of l.common){if(!On(s.columns,c.columns)){i.push({kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId}),i.push({kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:c});continue}const d=Pn(s,c,ag);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function sg(e,n,o){const i=zn(e.entities??[],n.entities??[],l=>l.modelId);for(const l of i.removed)o.push({kind:"entity.remove",casUnit:"logical",entityRef:l.modelId});for(const l of i.added)o.push({kind:"entity.add",casUnit:"logical",entityRef:l.modelId,value:Hr(l)});for(const{cur:l,tgt:s}of i.common){const c=Pn(l,s,ng);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),lg(l.modelId,l,s,o)}const a=zn(e.associations??[],n.associations??[],l=>l.modelId);for(const l of a.removed)o.push({kind:"association.remove",casUnit:"logical",associationRef:l.modelId});for(const l of a.added)o.push({kind:"association.add",casUnit:"logical",associationRef:l.modelId,value:Hr(l)});for(const{cur:l,tgt:s}of a.common){const c=Pn(l,s,og);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=Pn(l[d]??{},s[d]??{},rg);u&&o.push({kind:"associationEnd.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,end:d,patch:u})}}const r=zn(e.groups??[],n.groups??[],l=>l.modelId);for(const l of r.removed)o.push({kind:"group.remove",casUnit:"logical",groupRef:l.modelId});for(const l of r.added)o.push({kind:"group.add",casUnit:"logical",groupRef:l.modelId,value:Hr(l)});for(const{cur:l,tgt:s}of r.common){const c=Pn(l,s,ig);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=tg(l.memberEntityRefs??[],s.memberEntityRefs??[]);for(const u of d.removed)o.push({kind:"group.removeMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u});for(const u of d.added)o.push({kind:"group.addMember",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,entityRef:u})}}function ta(e,n,o,i,a,r,l){const s=zn(e,n,o);for(const c of s.removed)l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0});for(const c of s.added)l.push({kind:i,casUnit:"layout",[r]:o(c),value:c});for(const{cur:c,tgt:d}of s.common)On(c,d)||(l.push({kind:a,casUnit:"layout",[r]:o(c),value:void 0}),l.push({kind:i,casUnit:"layout",[r]:o(d),value:d}))}function cg(e,n,o){ta(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),ta(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),ta(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),ta(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function dg(e,n){const o=[];return sg(e.logical,n.logical,o),cg(e.layout,n.layout,o),o}function ug(e){if(e.groupRef!=null)return"group";if(e.associationRef!=null)return e.end!=null?"associationEnd":"association";if(e.entityRef!=null&&e.attributeRef!=null)return"attribute";if(e.entityRef!=null&&e.operationRef!=null)return"operation";if(e.entityRef!=null&&e.indexRef!=null)return"index";if(e.entityRef!=null)return"entity";throw new Error("projectFieldAudit: 대상 로케이터가 비었습니다(entityRef/associationRef/groupRef 중 하나 필요).")}const mg={entity:new Set(["attributes","operations","indexes","rev","modelId"]),association:new Set(["end1","end2","rev","modelId"]),group:new Set(["memberEntityRefs","rev","modelId"]),attribute:new Set(["modelId"]),operation:new Set(["modelId"]),index:new Set(["modelId"]),associationEnd:new Set([])};class fg{constructor(n){Ze(this,"out",[]);Ze(this,"last",new Map);this.fieldFilter=n}set(n,o,i){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;const a=this.last.get(o);this.out.push({...Jo(n),field:o,value:i,...this.last.has(o)?{oldValue:a}:{}}),this.last.set(o,i)}remove(n,o){if(o!=null){if(this.fieldFilter!=null&&o!==this.fieldFilter)return;this.out.push({...Jo(n),field:o,value:void 0,removed:!0,...this.last.has(o)?{oldValue:this.last.get(o)}:{}}),this.last.delete(o);return}const i=this.fieldFilter!=null?[this.fieldFilter]:[...this.last.keys()];for(const a of i){if(!this.last.has(a)){this.out.push({...Jo(n),field:a,value:void 0,removed:!0});continue}this.out.push({...Jo(n),field:a,value:void 0,removed:!0,oldValue:this.last.get(a)}),this.last.delete(a)}}member(n,o,i){const a="memberEntityRefs";this.fieldFilter!=null&&a!==this.fieldFilter||this.out.push({...Jo(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Jo(e){const n={seq:e.seq};return e.ts!==void 0&&(n.ts=e.ts),e.origin!==void 0&&(n.origin=e.origin),e.author!==void 0&&(n.author=e.author),e.kind!==void 0&&(n.kind=e.kind),e.restoredFromSeq!==void 0&&(n.restoredFromSeq=e.restoredFromSeq),n}function Ut(e,n,o,i){if(o==null||typeof o!="object")return;const a=mg[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Fn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function jr(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Nn(e,n){var r,l,s,c,d,u,m,h;const o=ug(n),i=new fg(n.field),a=[...e].sort((p,y)=>p.seq-y.seq);for(const p of a)for(const y of p.ops)switch(o){case"entity":if(y.entityRef!==n.entityRef)break;y.kind==="entity.add"?Ut(i,p,y.value,"entity"):y.kind==="entity.update"?Fn(i,p,y.patch):y.kind==="entity.remove"&&i.remove(p);break;case"attribute":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const b=jr((r=y.value)==null?void 0:r.attributes,n.attributeRef);b&&Ut(i,p,b,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===n.attributeRef?Ut(i,p,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===n.attributeRef?Fn(i,p,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===n.attributeRef||y.kind==="entity.remove")&&i.remove(p);break;case"operation":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const b=jr((s=y.value)==null?void 0:s.operations,n.operationRef);b&&Ut(i,p,b,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===n.operationRef?Ut(i,p,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===n.operationRef?Fn(i,p,y.patch):(y.kind==="operation.remove"&&y.operationRef===n.operationRef||y.kind==="entity.remove")&&i.remove(p);break;case"index":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const b=jr((d=y.value)==null?void 0:d.indexes,n.indexRef);b&&Ut(i,p,b,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===n.indexRef?Ut(i,p,y.value,"index"):y.kind==="index.update"&&y.indexRef===n.indexRef?Fn(i,p,y.patch):(y.kind==="index.remove"&&y.indexRef===n.indexRef||y.kind==="entity.remove")&&i.remove(p);break;case"association":if(y.associationRef!==n.associationRef)break;y.kind==="association.add"?Ut(i,p,y.value,"association"):y.kind==="association.update"?Fn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"associationEnd":if(y.associationRef!==n.associationRef)break;if(y.kind==="association.add"){const b=(m=y.value)==null?void 0:m[n.end];Ut(i,p,b,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===n.end?Fn(i,p,y.patch):y.kind==="association.remove"&&i.remove(p);break;case"group":if(y.groupRef!==n.groupRef)break;if(y.kind==="group.add"){Ut(i,p,y.value,"group");const b=(h=y.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(b))for(const f of b)i.member(p,f,!1)}else y.kind==="group.update"?Fn(i,p,y.patch):y.kind==="group.remove"?i.remove(p):y.kind==="group.addMember"&&y.entityRef!=null?i.member(p,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(p,y.entityRef,!0);break}return i.result()}const We={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},pg={"entity.add":{subject:"entity",existence:"add",fieldAudit:!0},"entity.update":{subject:"entity",existence:null,fieldAudit:!0},"entity.remove":{subject:"entity",existence:"remove",fieldAudit:!0},"attribute.add":{subject:"attribute",existence:"add",fieldAudit:!0},"attribute.update":{subject:"attribute",existence:null,fieldAudit:!0},"attribute.remove":{subject:"attribute",existence:"remove",fieldAudit:!0},"operation.add":{subject:"operation",existence:"add",fieldAudit:!0},"operation.update":{subject:"operation",existence:null,fieldAudit:!0},"operation.remove":{subject:"operation",existence:"remove",fieldAudit:!0},"index.add":{subject:"index",existence:"add",fieldAudit:!0},"index.update":{subject:"index",existence:null,fieldAudit:!0},"index.remove":{subject:"index",existence:"remove",fieldAudit:!0},"attribute.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). 컬렉션 순서 축이라 subject 단위 필드 변경으로 표현 안 됨"},"operation.reorder":{subject:null,existence:null,fieldAudit:!1,note:"과거 어휘(호스트 지원·lib 미방출). attribute.reorder와 동형"},"association.add":{subject:"association",existence:"add",fieldAudit:!0},"association.update":{subject:"association",existence:null,fieldAudit:!0},"association.remove":{subject:"association",existence:"remove",fieldAudit:!0},"associationEnd.update":{subject:"associationEnd",existence:null,fieldAudit:!0},"group.add":{subject:"group",existence:"add",fieldAudit:!0},"group.update":{subject:"group",existence:null,fieldAudit:!0},"group.remove":{subject:"group",existence:"remove",fieldAudit:!0},"group.addMember":{subject:"group",existence:null,fieldAudit:!0},"group.removeMember":{subject:"group",existence:null,fieldAudit:!0},"entityLayout.add":We,"entityLayout.remove":We,"entityLayout.move":We,"entityLayout.resize":We,"entityLayout.setCollapsed":We,"entityLayout.setLocked":We,"entityLayout.setStyle":We,"entityLayout.setAttrStyle":We,"entityLayout.setOpStyle":We,"groupLayout.add":We,"groupLayout.remove":We,"groupLayout.move":We,"groupLayout.resize":We,"groupLayout.setLocked":We,"groupLayout.setStyle":We,"groupLayout.addNoteMember":We,"groupLayout.removeNoteMember":We,"associationLayout.add":We,"associationLayout.remove":We,"associationLayout.setWaypoints":We,"note.add":We,"note.remove":We,"note.move":We,"note.resize":We,"note.setMemo":We,"note.setStyle":We,"noteConnection.add":We,"noteConnection.remove":We,"noteConnection.setWaypoints":We},At=e=>typeof e=="string"?e:void 0,hg=e=>{var n;return At((n=e.value)==null?void 0:n.modelId)};function Ac(e){return At(e.containerRef)??At(e.entityRef)}function Kr(e,n,o,i){var l;const a=(l=e.value)==null?void 0:l[n];if(!Array.isArray(a))return[];const r=[];for(const s of a){const c=At(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function Gr(e){const n=pg[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=At(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...Kr(o,"attributes","attribute",a),...Kr(o,"operations","operation",a),...Kr(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Ac(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?hg(o):At(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=At(o.associationRef);if(!a)return[];const r=o.end==="end1"||o.end==="end2"?o.end:void 0;return[{subject:{kind:n.subject,ref:a,...r?{end:r}:{}},...i?{existence:i}:{}}]}case"group":{const a=At(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function yg(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=At(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=Ac(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=At(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=At(n.groupRef);return i?{kind:"group",ref:i}:null}return null}function gg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function bg(e,n){const o=new Set,i=new Set,a=new Set,r={attribute:o,operation:i,index:a};for(const l of e)for(const s of l.ops)for(const{subject:c}of Gr(s))c.kind==="entity"||c.entityRef!==n||c.kind in r&&r[c.kind].add(c.ref);return{attributes:o,operations:i,indexes:a}}function na(e,n){return e.map(o=>({...o,subject:n}))}function Tc(e,n){const o=e.filter(s=>s.ops.some(c=>gg(c,n))),{attributes:i,operations:a,indexes:r}=bg(o,n),l=[...na(Nn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...na(Nn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...na(Nn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...na(Nn(o,{entityRef:n,indexRef:s}),{kind:"index",ref:s}));return l.map((s,c)=>({e:s,i:c})).sort((s,c)=>s.e.seq-c.e.seq||s.i-c.i).map(({e:s})=>s)}function Yr(e){return`${e.kind}:${e.ref}:${e.end??""}`}function _g(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of Gr(i))a.existence==="add"&&n.add(Yr(a.subject));return n}function kg(e){const n=new Set,o=new Set,i=new Set,a={entity:n,association:o,group:i};for(const r of e)for(const l of r.ops){const s=yg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Eg(e){const{entities:n,associations:o,groups:i}=kg(e),a=[];for(const r of n)for(const l of Tc(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Nn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Nn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Nn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function qr(e){const n=Eg(e),o=_g(e),i=new Map;for(const l of n){const s=Yr(l.subject),c=i.get(s);(c===void 0||l.seq<c)&&i.set(s,l.seq)}const a=new Map;for(const l of n){let s=a.get(l.seq);s||(s={meta:l,subjects:new Map},a.set(l.seq,s));const c=Yr(l.subject);let d=s.subjects.get(c);if(!d){const u=l.removed?"remove":i.get(c)===l.seq&&o.has(c)?"add":"update";d={subject:l.subject,verb:u,fields:[]},s.subjects.set(c,d)}l.removed?d.verb="remove":d.fields.push({field:l.field,value:l.value,...l.oldValue!==void 0?{oldValue:l.oldValue}:{}})}const r=[];for(const[l,s]of a){const c=s.meta;r.push({seq:l,...c.ts!==void 0?{ts:c.ts}:{},...c.origin!==void 0?{origin:c.origin}:{},...c.author!==void 0?{author:c.author}:{},...c.kind!==void 0?{kind:c.kind}:{},...c.restoredFromSeq!==void 0?{restoredFromSeq:c.restoredFromSeq}:{},actions:[...s.subjects.values()]})}return r.sort((l,s)=>s.seq-l.seq)}function Mc(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Ng(e,n,o){const i=[];for(const a of e)if(!(a.seq<=n||a.seq>o))for(const r of a.ops)for(const l of Gr(r)){if(!l.existence||l.inline)continue;const s=l.subject;wg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const wg=new Set(["attribute","operation","index"]);function Wr(e,n){const{fromSeq:o}=n,i=qr(e);let a=o;for(const m of e)m.seq>a&&(a=m.seq);const r=n.toSeq??a,l=i.filter(m=>m.seq>o&&m.seq<=r).reverse(),s=new Map,c=m=>{const h=Mc(m.subject);let p=s.get(h);p||(p={subject:m.subject,evs:[]},s.set(h,p)),p.evs.push(m)};for(const m of l)for(const h of m.actions)c({seq:m.seq,subject:h.subject,verb:h.verb,fields:h.fields});for(const m of Ng(e,o,r)){const h=s.get(Mc(m.subject));h!=null&&h.evs.some(p=>p.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((p,y)=>p.seq-y.seq);const h=m.evs[m.evs.length-1];m.subject.kind==="entity"&&h.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const h=m.evs[0].verb==="add",p=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||h&&p)continue;const y=new Map;let b=null;for(const g of m.evs){g.verb==="add"&&b!==null&&b!=="add"&&y.clear(),b=g.verb;for(const k of g.fields){const _=y.get(k.field);_?_.lastValue=k.value:y.set(k.field,{firstOld:k.oldValue,hasOld:k.oldValue!==void 0,lastValue:k.value})}}if(p){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(h){const g=[];for(const[k,_]of y)g.push({field:k,value:_.lastValue});d.push({subject:m.subject,verb:"added",fields:g});continue}const f=[];for(const[g,k]of y)k.hasOld&&On(k.firstOld,k.lastValue)||f.push({field:g,value:k.lastValue,...k.hasOld?{oldValue:k.firstOld}:{}});f.length!==0&&d.push({subject:m.subject,verb:"modified",fields:f})}return{fromSeq:o,toSeq:r,entries:d}}function Vc(e){const n=new Map,o=i=>{let a=n.get(i);return a||(a={verb:"modified",changedAttributeIds:new Set,changedOperationIds:new Set},n.set(i,a)),a};for(const i of e.entries){const a=i.subject;if(a.kind==="entity"){if(i.verb==="removed")continue;o(a.ref).verb=i.verb}else if((a.kind==="attribute"||a.kind==="operation"||a.kind==="index")&&a.entityRef){const r=o(a.entityRef);i.verb!=="removed"&&(a.kind==="attribute"?r.changedAttributeIds.add(a.ref):a.kind==="operation"&&r.changedOperationIds.add(a.ref))}}return n}class Jr{constructor(n){Ze(this,"undoStack",[]);Ze(this,"redoStack",[]);Ze(this,"savePoint",null);Ze(this,"listeners",new Set);Ze(this,"commandListeners",new Set);Ze(this,"coalesceSealed",!1);this.state=n}execute(n){n.apply(this.state);const o=this.undoStack.at(-1),i=!this.coalesceSealed&&n.coalesceKey!=null&&!!o&&o.coalesceKey===n.coalesceKey;this.coalesceSealed=!1,i?(n.invert=o.invert,this.undoStack[this.undoStack.length-1]=n):this.undoStack.push(n),this.redoStack=[],this.emitCommand(n,"do",i),this.emit()}undo(){const n=this.undoStack.pop();n&&(n.invert(this.state),this.redoStack.push(n),this.emitCommand(n,"undo",!1),this.emit())}redo(){const n=this.redoStack.pop();n&&(n.apply(this.state),this.undoStack.push(n),this.emitCommand(n,"redo",!1),this.emit())}sealCoalesce(){this.coalesceSealed=!0}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}markSavePoint(){this.savePoint=this.undoStack.at(-1)??null,this.sealCoalesce(),this.emit()}get isDirty(){return(this.undoStack.at(-1)??null)!==this.savePoint}onChange(n){return this.listeners.add(n),()=>this.listeners.delete(n)}onCommand(n){return this.commandListeners.add(n),()=>this.commandListeners.delete(n)}emit(){for(const n of this.listeners)n()}emitCommand(n,o,i){for(const a of this.commandListeners)a(n,o,i)}}function wt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function Bc(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function dt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function Tt(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function tt(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function nn(e,n,o){var i,a;return(a=(i=e.layout.notes.find(r=>r.modelId===n))==null?void 0:i.connections)==null?void 0:a.find(r=>r.targetRef===o)}function oa(e,n,o){return{label:`엔티티 추가: ${e.name}`,apply(i){i.logical.entities.push(e),i.layout.entityLayouts.push({entityRef:e.modelId,geo:n,...o})},invert(i){const a=Bc(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=dt(i,e.modelId);r>=0&&i.layout.entityLayouts.splice(r,1)},emitOps(){const i={kind:"entity.add",casUnit:"logical",entityRef:e.modelId,value:e},a={kind:"entityLayout.add",casUnit:"layout",entityRef:e.modelId,value:{entityRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"entityLayout.remove",casUnit:"layout",entityRef:e.modelId,incidental:!0},{kind:"entity.remove",casUnit:"logical",entityRef:e.modelId}]}}}}function Dc(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Bc(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=dt(i,e),l=[];i.logical.associations.forEach((u,m)=>{o(u)&&l.push({item:u,index:m})});const s=new Set(l.map(u=>u.item.modelId)),c=[];i.layout.associationLayouts.forEach((u,m)=>{s.has(u.associationRef)&&c.push({item:u,index:m})});const d=[];i.logical.groups.forEach(u=>{const m=u.memberEntityRefs.indexOf(e);m>=0&&d.push({groupId:u.modelId,index:m})}),n={entity:{item:i.logical.entities[a],index:a},entityLayout:r>=0?{item:i.layout.entityLayouts[r],index:r}:void 0,assocs:l,assocLayouts:c,groupMemberships:d},[...c].sort((u,m)=>m.index-u.index).forEach(u=>i.layout.associationLayouts.splice(u.index,1)),[...l].sort((u,m)=>m.index-u.index).forEach(u=>i.logical.associations.splice(u.index,1));for(const u of d){const m=i.logical.groups.find(h=>h.modelId===u.groupId);m==null||m.memberEntityRefs.splice(u.index,1)}r>=0&&i.layout.entityLayouts.splice(r,1),i.logical.entities.splice(a,1)},invert(i){if(n){i.logical.entities.splice(n.entity.index,0,n.entity.item),n.entityLayout&&i.layout.entityLayouts.splice(n.entityLayout.index,0,n.entityLayout.item),[...n.assocs].sort((a,r)=>a.index-r.index).forEach(a=>i.logical.associations.splice(a.index,0,a.item)),[...n.assocLayouts].sort((a,r)=>a.index-r.index).forEach(a=>i.layout.associationLayouts.splice(a.index,0,a.item));for(const a of n.groupMemberships){const r=i.logical.groups.find(l=>l.modelId===a.groupId);r==null||r.memberEntityRefs.splice(a.index,0,e)}}},emitOps(){if(!n)return{forward:[],invert:[]};const i=[],a=[];for(const r of n.assocs)i.push({kind:"association.remove",casUnit:"logical",associationRef:r.item.modelId}),a.push({kind:"association.add",casUnit:"logical",associationRef:r.item.modelId,value:r.item});for(const r of n.assocLayouts)i.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:r.item.associationRef,incidental:!0}),a.push({kind:"associationLayout.add",casUnit:"layout",associationRef:r.item.associationRef,value:r.item,incidental:!0});for(const r of n.groupMemberships)i.push({kind:"group.removeMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e}),a.push({kind:"group.addMember",casUnit:"logical",containerRef:r.groupId,groupRef:r.groupId,entityRef:e});return n.entityLayout&&(i.push({kind:"entityLayout.remove",casUnit:"layout",entityRef:e,incidental:!0}),a.push({kind:"entityLayout.add",casUnit:"layout",entityRef:e,value:n.entityLayout.item,incidental:!0})),i.push({kind:"entity.remove",casUnit:"logical",entityRef:e}),a.push({kind:"entity.add",casUnit:"logical",entityRef:e,value:n.entity.item}),{forward:i,invert:a.reverse()}}}}function Lc(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=tt(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(tt(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:wt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:wt(o)}]}}}}function Oc(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=tt(i,e);o=a.name,a.name=n},invert(i){tt(i,e).name=o},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:n}}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:{name:o}}]}}}}function ko(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.location},r.location={...n}},invert(i){const a=dt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.location=o)},emitOps(){const i=a=>({kind:"entityLayout.move",casUnit:"layout",entityRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Pc(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a].geo;o={...r.size},r.size={...n}},invert(i){const a=dt(i,e);a>=0&&o&&(i.layout.entityLayouts[a].geo.size=o)},emitOps(){const i=a=>({kind:"entityLayout.resize",casUnit:"layout",entityRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Xo(e,n){const o={...(e==null?void 0:e.properties)??{}};return n?o.swatch=n:delete o.swatch,Object.keys(o).length?{properties:o}:void 0}function zc(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=Xo(r.style,n)},invert(i){const a=dt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=dt(i,e),r=a>=0?i.layout.entityLayouts[a].style:void 0,l=s=>({kind:"entityLayout.setStyle",casUnit:"layout",entityRef:e,value:{style:s}});return{forward:[l(r)],invert:[l(o)]}}}}function Fc(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.collapsed,r.collapsed=n},invert(i){const a=dt(i,e);a>=0&&(i.layout.entityLayouts[a].collapsed=o)},emitOps(){const i=a=>({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:e,value:{collapsed:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Uc(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=dt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.locked,r.locked=n},invert(i){const a=dt(i,e);a>=0&&(i.layout.entityLayouts[a].locked=o)},emitOps(){const i=a=>({kind:"entityLayout.setLocked",casUnit:"layout",entityRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Xr(e){let n=[];return{label:e?"모두 접기":"모두 펼치기",apply(o){n=o.layout.entityLayouts.map(i=>i.collapsed);for(const i of o.layout.entityLayouts)i.collapsed=e},invert(o){o.layout.entityLayouts.forEach((i,a)=>{i.collapsed=n[a]})},emitOps(o){const i=[],a=[];return o.layout.entityLayouts.forEach((r,l)=>{i.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:e}}),a.push({kind:"entityLayout.setCollapsed",casUnit:"layout",entityRef:r.entityRef,value:{collapsed:n[l]}})}),{forward:i,invert:a}}}}function ia(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=dt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=Xo(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=dt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=dt(a,e),l=r>=0?a.layout.entityLayouts[r].attributeStyles:void 0,s=c=>({kind:"entityLayout.setAttrStyle",casUnit:"layout",entityRef:e,value:{attributeStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function aa(e,n,o){return{label:"그룹 추가",apply(i){i.logical.groups.push(e),i.layout.groupLayouts.push({groupRef:e.modelId,geo:n,...o})},invert(i){const a=i.logical.groups.findIndex(l=>l.modelId===e.modelId);a>=0&&i.logical.groups.splice(a,1);const r=i.layout.groupLayouts.findIndex(l=>l.groupRef===e.modelId);r>=0&&i.layout.groupLayouts.splice(r,1)},emitOps(){const i={kind:"group.add",casUnit:"logical",groupRef:e.modelId,value:e},a={kind:"groupLayout.add",casUnit:"layout",groupRef:e.modelId,value:{groupRef:e.modelId,geo:n,...o},incidental:!0};return{forward:[i,a],invert:[{kind:"groupLayout.remove",casUnit:"layout",groupRef:e.modelId,incidental:!0},{kind:"group.remove",casUnit:"logical",groupRef:e.modelId}]}}}}function Hc(e,n){const o={},i=a=>{const r=a.logical.groups.find(l=>l.modelId===e);if(!r)throw new Error(`그룹 없음: ${e}`);return r};return{label:"그룹 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:wt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:wt(o)}]}}}}function jc(e){let n=null;return{label:"그룹 해제",apply(o){const i=o.logical.groups.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`그룹 없음: ${e}`);const a=o.layout.groupLayouts.findIndex(r=>r.groupRef===e);n={group:{item:o.logical.groups[i],index:i},layout:a>=0?{item:o.layout.groupLayouts[a],index:a}:void 0},a>=0&&o.layout.groupLayouts.splice(a,1),o.logical.groups.splice(i,1)},invert(o){n&&(o.logical.groups.splice(n.group.index,0,n.group.item),n.layout&&o.layout.groupLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"groupLayout.remove",casUnit:"layout",groupRef:e,incidental:!0}),i.push({kind:"groupLayout.add",casUnit:"layout",groupRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"group.remove",casUnit:"logical",groupRef:e}),i.push({kind:"group.add",casUnit:"logical",groupRef:e,value:n.group.item}),{forward:o,invert:i.reverse()}}}}function Kc(e,n){let o=!1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에 편입",apply(a){const r=i(a);r&&!r.memberEntityRefs.includes(n)&&(r.memberEntityRefs.push(n),o=!0)},invert(a){if(!o)return;const r=i(a),l=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1;l>=0&&r.memberEntityRefs.splice(l,1)},emitOps(){return o?{forward:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}:{forward:[],invert:[]}}}}function ra(e,n){let o=-1;const i=a=>a.logical.groups.find(r=>r.modelId===e);return{label:"그룹에서 제외",apply(a){const r=i(a);o=(r==null?void 0:r.memberEntityRefs.indexOf(n))??-1,o>=0&&r.memberEntityRefs.splice(o,1)},invert(a){var r;o<0||(r=i(a))==null||r.memberEntityRefs.splice(o,0,n)},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"group.removeMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}],invert:[{kind:"group.addMember",casUnit:"logical",containerRef:e,groupRef:e,entityRef:n}]}}}}function Gc(e,n){let o=null;return{label:"그룹 이동",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"groupLayout.move",casUnit:"layout",groupRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function Yc(e,n){let o=null;return{label:"그룹 크기 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"groupLayout.resize",casUnit:"layout",groupRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function qc(e,n){let o;return{label:"그룹 색상 변경",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.style,a.style=Xo(a.style,n)},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.style=o)},emitOps(i){const a=i.layout.groupLayouts.find(l=>l.groupRef===e),r=l=>({kind:"groupLayout.setStyle",casUnit:"layout",groupRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function Wc(e,n){let o;return{label:n?"그룹 잠금":"그룹 잠금 해제",apply(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);if(!a)throw new Error(`그룹 레이아웃 없음: ${e}`);o=a.locked,a.locked=n},invert(i){const a=i.layout.groupLayouts.find(r=>r.groupRef===e);a&&(a.locked=o)},emitOps(){const i=a=>({kind:"groupLayout.setLocked",casUnit:"layout",groupRef:e,value:{locked:a}});return{forward:[i(n)],invert:[i(o)]}}}}function Ht(e,n){return{label:`속성 추가: ${n.name}`,apply(o){tt(o,e).attributes.push(n)},invert(o){const i=tt(o,e),a=i.attributes.findIndex(r=>r.modelId===n.modelId);a>=0&&i.attributes.splice(a,1)},emitOps(){return{forward:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n.modelId}]}}}}function on(e,n,o){const i={},a=r=>{const l=tt(r,e).attributes.find(s=>s.modelId===n);if(!l)throw new Error(`속성 없음: ${n}`);return l};return{label:"속성 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:wt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:wt(i)}]}}}}function Jc(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=tt(i,e),r=a.attributes.findIndex(l=>l.modelId===n);if(r<0)throw new Error(`속성 없음: ${n}`);o={item:a.attributes[r],index:r},a.attributes.splice(r,1)},invert(i){o&&tt(i,e).attributes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"attribute.remove",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n}],invert:[{kind:"attribute.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function Xc(e,n,o,i,a){const r=new Map(a.map(c=>[c.modelId,c.order])),l=[],s=[];for(const c of i){const d=r.get(c.modelId);if(d===c.order)continue;const u=n==="attributeRef"?{attributeRef:c.modelId}:{operationRef:c.modelId};l.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:c.order}}),s.push({kind:e,casUnit:"logical",containerRef:o,entityRef:o,...u,patch:{order:d??c.order}})}return{forward:l,invert:s}}function Zr(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=tt(a,e);i=r.attributes.map(s=>({...s}));const l=Fr([...r.attributes].sort((s,c)=>s.order-c.order),n,o);r.attributes.splice(0,r.attributes.length,...l),r.attributes.forEach((s,c)=>s.order=c)},invert(a){i&&tt(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=tt(a,e).attributes;return Xc("attribute.update","attributeRef",e,r,i??[])}}}function Zc(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=tt(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=tt(i,e),r=((l=a.operations)==null?void 0:l.findIndex(s=>s.modelId===n.modelId))??-1;r>=0&&a.operations.splice(r,1),o&&a.operations&&a.operations.length===0&&(a.operations=void 0)},emitOps(){return{forward:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n.modelId}]}}}}function Qc(e,n,o){const i={},a=r=>{var s;const l=(s=tt(r,e).operations)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`메서드 없음: ${n}`);return l};return{label:"메서드 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:wt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:wt(i)}]}}}}function ed(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=tt(i,e),r=((s=a.operations)==null?void 0:s.findIndex(c=>c.modelId===n))??-1;if(r<0)throw new Error(`메서드 없음: ${n}`);const l=a.operations.length===1;o={item:a.operations[r],index:r,wasSole:l},a.operations.splice(r,1),l&&(a.operations=void 0)},invert(i){if(!o)return;const a=tt(i,e);a.operations||(a.operations=[]),a.operations.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"operation.remove",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n}],invert:[{kind:"operation.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}function td(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=tt(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=Fr([...l].sort((c,d)=>c.order-d.order),n,o);l.splice(0,l.length,...s),l.forEach((c,d)=>c.order=d),r.operations=l},invert(a){if(!i)return;const r=tt(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=tt(a,e).operations??[];return Xc("operation.update","operationRef",e,r,i??[])}}}function nd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=dt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=Xo(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=dt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=dt(a,e),l=r>=0?a.layout.entityLayouts[r].operationStyles:void 0,s=c=>({kind:"entityLayout.setOpStyle",casUnit:"layout",entityRef:e,value:{operationStyles:c}});return{forward:[s(l)],invert:[s(i)]}}}}function la(e,n){return{label:"관계 추가",apply(o){o.logical.associations.push(e),o.layout.associationLayouts.push(n)},invert(o){const i=o.logical.associations.findIndex(r=>r.modelId===e.modelId);i>=0&&o.logical.associations.splice(i,1);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e.modelId);a>=0&&o.layout.associationLayouts.splice(a,1)},emitOps(){const o={kind:"association.add",casUnit:"logical",associationRef:e.modelId,value:e},i={kind:"associationLayout.add",casUnit:"layout",associationRef:e.modelId,value:n,incidental:!0};return{forward:[o,i],invert:[{kind:"associationLayout.remove",casUnit:"layout",associationRef:e.modelId,incidental:!0},{kind:"association.remove",casUnit:"logical",associationRef:e.modelId}]}}}}function od(e){let n=null;return{label:"관계 삭제",apply(o){const i=o.logical.associations.findIndex(r=>r.modelId===e);if(i<0)throw new Error(`관계 없음: ${e}`);const a=o.layout.associationLayouts.findIndex(r=>r.associationRef===e);n={assoc:{item:o.logical.associations[i],index:i},layout:a>=0?{item:o.layout.associationLayouts[a],index:a}:void 0},a>=0&&o.layout.associationLayouts.splice(a,1),o.logical.associations.splice(i,1)},invert(o){n&&(o.logical.associations.splice(n.assoc.index,0,n.assoc.item),n.layout&&o.layout.associationLayouts.splice(n.layout.index,0,n.layout.item))},emitOps(){if(!n)return{forward:[],invert:[]};const o=[],i=[];return n.layout&&(o.push({kind:"associationLayout.remove",casUnit:"layout",associationRef:e,incidental:!0}),i.push({kind:"associationLayout.add",casUnit:"layout",associationRef:e,value:n.layout.item,incidental:!0})),o.push({kind:"association.remove",casUnit:"logical",associationRef:e}),i.push({kind:"association.add",casUnit:"logical",associationRef:e,value:n.assoc.item}),{forward:o,invert:i.reverse()}}}}function sa(e,n){const o={},i=a=>{const r=a.logical.associations.find(l=>l.modelId===e);if(!r)throw new Error(`관계 없음: ${e}`);return r};return{label:"관계 수정",apply(a){const r=i(a);for(const l of Object.keys(n))o[l]=r[l];Object.assign(r,n)},invert(a){Object.assign(i(a),o)},emitOps(){return{forward:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:wt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:wt(o)}]}}}}function Mt(e,n,o){const i={},a=r=>{const l=r.logical.associations.find(s=>s.modelId===e);if(!l)throw new Error(`관계 없음: ${e}`);return l[n]};return{label:"관계 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:wt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:wt(i)}]}}}}function id(e,n){return{label:"인덱스 추가",apply(o){const i=tt(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=tt(o,e),a=((r=i.indexes)==null?void 0:r.findIndex(l=>l.modelId===n.modelId))??-1;a>=0&&i.indexes.splice(a,1)},emitOps(){return{forward:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:n}],invert:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n.modelId}]}}}}function ca(e,n,o){const i={},a=r=>{var s;const l=(s=tt(r,e).indexes)==null?void 0:s.find(c=>c.modelId===n);if(!l)throw new Error(`인덱스 없음: ${n}`);return l};return{label:"인덱스 수정",apply(r){const l=a(r);for(const s of Object.keys(o))i[s]=l[s];Object.assign(l,o)},invert(r){Object.assign(a(r),i)},emitOps(){return{forward:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:wt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:wt(i)}]}}}}function ad(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=tt(i,e),r=((l=a.indexes)==null?void 0:l.findIndex(s=>s.modelId===n))??-1;if(r<0)throw new Error(`인덱스 없음: ${n}`);o={item:a.indexes[r],index:r},a.indexes.splice(r,1)},invert(i){o&&tt(i,e).indexes.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"index.remove",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n}],invert:[{kind:"index.add",casUnit:"logical",containerRef:e,entityRef:e,value:o.item}]}:{forward:[],invert:[]}}}}const jt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),Zo=(e,n)=>{var o;return((o=Tt(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function rd(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=Tt(a,e);if(!r||!r.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);i={...r.waypoints[n]},r.waypoints.splice(n,1,{...o})},invert(a){const r=Tt(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=Zo(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[jt(e,r)],invert:[jt(e,l)]}}}}function ld(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=Tt(i,e);if(!a||!a.waypoints[n])throw new Error(`waypoint 없음: ${e}[${n}]`);o={...a.waypoints[n]},a.waypoints.splice(n,1)},invert(i){const a=Tt(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=Zo(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[jt(e,a)],invert:[jt(e,r)]}}}}function sd(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=Tt(a,e);if(!r)throw new Error(`관계 레이아웃 없음: ${e}`);i=r.waypoints.map(l=>({...l})),r.waypoints=i.map(l=>({x:l.x+n,y:l.y+o}))},invert(a){const r=Tt(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[jt(e,Zo(a,e))],invert:[jt(e,i??[])]}}}}function cd(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=Tt(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=Tt(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[jt(e,Zo(o,e))],invert:[jt(e,n??[])]}}}}function dd(e,n,o){return{label:"waypoint 추가",apply(i){const a=Tt(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=Tt(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=Zo(i,e),r=a.slice();return r.splice(n,1),{forward:[jt(e,a)],invert:[jt(e,r)]}}}}function ud(e){return{label:"노트 추가",apply(n){n.layout.notes.push(e)},invert(n){const o=n.layout.notes.findIndex(i=>i.modelId===e.modelId);o>=0&&n.layout.notes.splice(o,1)},emitOps(){return{forward:[{kind:"note.add",casUnit:"layout",noteRef:e.modelId,value:e}],invert:[{kind:"note.remove",casUnit:"layout",noteRef:e.modelId}]}}}}function md(e){let n=null;return{label:"노트 삭제",apply(o){const i=o.layout.notes.findIndex(a=>a.modelId===e);if(i<0)throw new Error(`노트 없음: ${e}`);n={item:o.layout.notes[i],index:i},o.layout.notes.splice(i,1)},invert(o){n&&o.layout.notes.splice(n.index,0,n.item)},emitOps(){return n?{forward:[{kind:"note.remove",casUnit:"layout",noteRef:e}],invert:[{kind:"note.add",casUnit:"layout",noteRef:e,value:n.item}]}:{forward:[],invert:[]}}}}function Qo(e,n){let o=null;return{label:"노트 이동",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.location},a.geo.location={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.location=o)},emitOps(){const i=a=>({kind:"note.move",casUnit:"layout",noteRef:e,value:{location:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function fd(e,n){let o=null;return{label:"노트 크기 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o={...a.geo.size},a.geo.size={...n}},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&o&&(a.geo.size=o)},emitOps(){const i=a=>({kind:"note.resize",casUnit:"layout",noteRef:e,value:{size:{...a}}});return{forward:[i(n)],invert:[i(o)]}}}}function pd(e,n){let o="";return{label:"노트 내용 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.memo,a.memo=n},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.memo=o)},emitOps(){const i=a=>({kind:"note.setMemo",casUnit:"layout",noteRef:e,value:{memo:a}});return{forward:[i(n)],invert:[i(o)]}}}}function hd(e,n){let o;return{label:"노트 색상 변경",apply(i){const a=i.layout.notes.find(r=>r.modelId===e);if(!a)throw new Error(`노트 없음: ${e}`);o=a.style,a.style=Xo(a.style,n)},invert(i){const a=i.layout.notes.find(r=>r.modelId===e);a&&(a.style=o)},emitOps(i){const a=i.layout.notes.find(l=>l.modelId===e),r=l=>({kind:"note.setStyle",casUnit:"layout",noteRef:e,value:{style:l}});return{forward:[r(a==null?void 0:a.style)],invert:[r(o)]}}}}function yd(e,n){let o=!1,i=!1;const a=r=>r.layout.groupLayouts.find(l=>l.groupRef===e);return{label:"그룹에 노트 편입",apply(r){const l=a(r);l&&(l.memberNoteRefs||(l.memberNoteRefs=[],i=!0),!l.memberNoteRefs.includes(n)&&(l.memberNoteRefs.push(n),o=!0))},invert(r){if(!o)return;const l=a(r);if(!(l!=null&&l.memberNoteRefs))return;const s=l.memberNoteRefs.indexOf(n);s>=0&&l.memberNoteRefs.splice(s,1),i&&delete l.memberNoteRefs},emitOps(){return o?{forward:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}:{forward:[],invert:[]}}}}function gd(e,n){let o=-1;const i=a=>a.layout.groupLayouts.find(r=>r.groupRef===e);return{label:"그룹에서 노트 제외",apply(a){var l;const r=i(a);o=((l=r==null?void 0:r.memberNoteRefs)==null?void 0:l.indexOf(n))??-1,o>=0&&r.memberNoteRefs.splice(o,1)},invert(a){if(o<0)return;const r=i(a);r&&(r.memberNoteRefs||(r.memberNoteRefs=[]),r.memberNoteRefs.splice(o,0,n))},emitOps(){return o<0?{forward:[],invert:[]}:{forward:[{kind:"groupLayout.removeNoteMember",casUnit:"layout",groupRef:e,noteRef:n}],invert:[{kind:"groupLayout.addNoteMember",casUnit:"layout",groupRef:e,noteRef:n}]}}}}const wn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),da=(e,n,o)=>{var i;return((i=nn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function bd(e,n){let o=!1,i=!1;return{label:"노트 연결 추가",apply(a){const r=a.layout.notes.find(l=>l.modelId===e);if(!r)throw new Error(`노트 없음: ${e}`);if(r.connections||(r.connections=[],i=!0),r.connections.some(l=>l.targetRef===n)){o=!1;return}r.connections.push({targetRef:n,waypoints:[]}),o=!0},invert(a){if(!o)return;const r=a.layout.notes.find(s=>s.modelId===e);if(!(r!=null&&r.connections))return;const l=r.connections.findIndex(s=>s.targetRef===n);l>=0&&r.connections.splice(l,1),i&&delete r.connections},emitOps(){return o?{forward:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:{targetRef:n,waypoints:[]}}],invert:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}]}:{forward:[],invert:[]}}}}function _d(e,n){let o=null;return{label:"노트 연결 삭제",apply(i){var l;const a=i.layout.notes.find(s=>s.modelId===e),r=((l=a==null?void 0:a.connections)==null?void 0:l.findIndex(s=>s.targetRef===n))??-1;if(!(a!=null&&a.connections)||r<0)throw new Error(`노트 연결 없음: ${e}→${n}`);o={item:a.connections[r],index:r},a.connections.splice(r,1)},invert(i){if(!o)return;const a=i.layout.notes.find(r=>r.modelId===e);a!=null&&a.connections&&a.connections.splice(o.index,0,o.item)},emitOps(){return o?{forward:[{kind:"noteConnection.remove",casUnit:"layout",noteRef:e,targetRef:n}],invert:[{kind:"noteConnection.add",casUnit:"layout",noteRef:e,targetRef:n,value:o.item}]}:{forward:[],invert:[]}}}}function kd(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=nn(r,e,n);if(!l||!l.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);a={...l.waypoints[o]},l.waypoints.splice(o,1,{...i})},invert(r){const l=nn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=da(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[wn(e,n,l)],invert:[wn(e,n,s)]}}}}function Ed(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=nn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=nn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=da(a,e,n),l=r.slice();return l.splice(o,1),{forward:[wn(e,n,r)],invert:[wn(e,n,l)]}}}}function Nd(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=nn(a,e,n);if(!r||!r.waypoints[o])throw new Error(`waypoint 없음: ${e}→${n}[${o}]`);i={...r.waypoints[o]},r.waypoints.splice(o,1)},invert(a){const r=nn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=da(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[wn(e,n,r)],invert:[wn(e,n,l)]}}}}function wd(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=nn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=nn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[wn(e,n,da(i,e,n))],invert:[wn(e,n,o??[])]}}}}function Je(e,n,o){return{label:e,coalesceKey:o,apply(i){for(const a of n)a.apply(i)},invert(i){for(let a=n.length-1;a>=0;a--)n[a].invert(i)},emitOps(i){const a=n.map(r=>{if(!r.emitOps)throw new Error(`emitOps 미구현 command가 composite에 포함됨: ${r.label}`);return r.emitOps(i)});return{forward:a.flatMap(r=>r.forward),invert:a.slice().reverse().flatMap(r=>r.invert)}}}}const Ig=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:la,addAttribute:Ht,addEntity:oa,addEntityToGroup:Kc,addGroup:aa,addIndex:id,addNote:ud,addNoteConnection:bd,addNoteConnectionWaypoint:Ed,addNoteToGroup:yd,addOperation:Zc,addWaypoint:dd,clearNoteConnectionWaypoints:wd,clearWaypoints:cd,composite:Je,moveEntity:ko,moveGroup:Gc,moveNote:Qo,moveNoteConnectionWaypoint:kd,moveWaypoint:rd,removeAssociation:od,removeAttribute:Jc,removeEntity:Dc,removeEntityFromGroup:ra,removeGroup:jc,removeIndex:ad,removeNote:md,removeNoteConnection:_d,removeNoteConnectionWaypoint:Nd,removeNoteFromGroup:gd,removeOperation:ed,removeWaypoint:ld,renameEntity:Oc,reorderAttributes:Zr,reorderOperations:td,resizeEntity:Pc,resizeGroup:Yc,resizeNote:fd,setAllEntitiesCollapsed:Xr,setAttributeSwatch:ia,setEntityCollapsed:Fc,setEntityLocked:Uc,setEntitySwatch:zc,setGroupLocked:Wc,setGroupSwatch:qc,setNoteMemo:pd,setNoteSwatch:hd,setOperationSwatch:nd,translateWaypoints:sd,updateAssociation:sa,updateAssociationEnd:Mt,updateAttribute:on,updateEntity:Lc,updateGroup:Hc,updateIndex:ca,updateOperation:Qc},Symbol.toStringTag,{value:"Module"}));class Id{constructor(){Ze(this,"revs",new Map);Ze(this,"layoutVersion",0);Ze(this,"logicalVersion",0)}seed(n){this.revs.clear();for(const[o,i]of Object.entries(n.revs??{}))this.revs.set(o,i);this.layoutVersion=n.layoutVersion??0,this.logicalVersion=n.logicalVersion??0}rev(n){return this.revs.get(n)??0}setRev(n,o){this.revs.set(n,o)}deleteRev(n){this.revs.delete(n)}snapshot(){return{revs:Object.fromEntries(this.revs),layoutVersion:this.layoutVersion,logicalVersion:this.logicalVersion}}}const vg=[400,1200];function xg(e){var o;if(typeof e!="object"||e===null)return;const n=e;for(const i of[n.statusCode,n.status,(o=n.response)==null?void 0:o.status])if(typeof i=="number"&&Number.isFinite(i))return i}function Cg(e){const n=xg(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Sg=e=>new Promise(n=>setTimeout(n,e));class vd{constructor(n){Ze(this,"cache",new Id);Ze(this,"newClientOpId");Ze(this,"debounceMs");Ze(this,"retryDelaysMs");Ze(this,"emissions",new WeakMap);Ze(this,"open",null);Ze(this,"debounceHandle",null);Ze(this,"queue",[]);Ze(this,"sending",!1);Ze(this,"_frozen",!1);Ze(this,"stack",null);Ze(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Be,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??vg}seed(n){this.cache.seed(n)}attach(n){this.stack=n,n.sealCoalesce();const o=n.onCommand((i,a,r)=>this.handle(i,a,r));return()=>{o(),this.stack===n&&(this.stack=null)}}get frozen(){return this._frozen}get hasPending(){return this.open!==null||this.queue.length>0||this.sending}cacheSnapshot(){return this.cache.snapshot()}flush(){this.flushOpen(!0)}whenSettled(){return this.hasPending?new Promise(n=>this.settledWaiters.push(n)):Promise.resolve()}handle(n,o,i){var l,s,c;if(this._frozen)return;let a;if(o==="do"){const d=(l=n.emitOps)==null?void 0:l.call(n,this.opts.state);if(!d)throw new Error(`op-mode에서 emitOps 미구현 command 실행: ${n.label}`);a=d}else{const d=this.emissions.get(n);if(!d)throw new Error(`op-mode ${o} 대상 command의 emission 미기록: ${n.label}`);a=d}const r=o==="undo"?a.invert:a.forward;if(o==="do"&&i&&this.open&&this.open.coalesceKey===n.coalesceKey){this.open.fwd=r,this.emissions.set(n,{forward:r,invert:this.open.inv}),this.resetDebounce();return}if(i){const d=new Error(`op-mode coalesce 경계 불일치: 스택은 병합했으나 어댑터에 대응 그룹이 없음 (${n.label}, key=${String(n.coalesceKey)})`);console.error("[op-sync]",d),(c=(s=this.opts).onError)==null||c.call(s,d)}if(this.flushOpen(!1),o==="do"&&(this.emissions.set(n,a),n.coalesceKey!=null)){this.open={coalesceKey:n.coalesceKey,fwd:r,inv:a.invert},this.startDebounce();return}r.length&&this.enqueue(this.buildBatch(r))}flushOpen(n){var i;this.cancelDebounce();const o=this.open;this.open=null,o&&o.fwd.length&&this.enqueue(this.buildBatch(o.fwd)),n&&((i=this.stack)==null||i.sealCoalesce())}startDebounce(){this.cancelDebounce(),this.debounceHandle=setTimeout(()=>{this.debounceHandle=null,this.flushOpen(!0)},this.debounceMs)}resetDebounce(){this.startDebounce()}cancelDebounce(){this.debounceHandle!=null&&(clearTimeout(this.debounceHandle),this.debounceHandle=null)}buildBatch(n){const o={},i=new Set;let a=!1,r=!1;for(const l of n)if(l.casUnit==="logical")if(a=!0,l.containerRef)i.add(l.containerRef);else{const s=l.entityRef??l.associationRef??l.groupRef;s&&(l.kind.endsWith(".add")?this.cache.setRev(s,0):l.kind.endsWith(".remove")&&this.cache.deleteRev(s))}else l.incidental||(r=!0);if(i.size){o.revs={};for(const l of i){const s=this.cache.rev(l);o.revs[l]=s,this.cache.setRev(l,s+1)}}return r&&(o.layout=this.cache.layoutVersion,this.cache.layoutVersion=o.layout+1),a&&(this.cache.logicalVersion+=1),{diagramId:this.opts.diagramId,ops:n,cas:o,origin:this.opts.origin??"gui",clientOpId:this.newClientOpId()}}enqueue(n){this.queue.push(n),this.pump()}async pump(){var i,a;if(this.sending||this._frozen)return;const n=this.queue.shift();if(!n){this.notifySettled();return}this.sending=!0;let o;for(let r=0;;r++)try{o=await this.opts.transport(n);break}catch(l){const s=this.retryDelaysMs.length+1;console.error(`[op-sync] op 전송 실패 (시도 ${r+1}/${s}):`,l),(a=(i=this.opts).onError)==null||a.call(i,l);const c=this.retryDelaysMs[r];if(c==null||!Cg(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Sg(c)}this.sending=!1,o.ok?(this.reconcile(o),this.pump()):this.freeze(o.conflict)}reconcile(n){if(!(this.queue.length>0)){for(const[o,i]of Object.entries(n.revs))this.cache.setRev(o,i);this.cache.layoutVersion=n.layoutVersion,this.cache.logicalVersion=n.logicalVersion}}freeze(n){var o,i;this._frozen=!0,this.queue.length=0,this.open=null,this.cancelDebounce(),(i=(o=this.opts).onFreeze)==null||i.call(o,n),this.notifySettled()}notifySettled(){if(this.hasPending)return;const n=this.settledWaiters;this.settledWaiters=[];for(const o of n)o()}}const xd=["entity.add","entity.update","entity.remove","attribute.add","attribute.update","attribute.remove","association.add","association.remove","association.update","associationEnd.update","index.add","index.update","index.remove","operation.add","operation.update","operation.remove","attribute.reorder","operation.reorder","group.add","group.update","group.remove","group.addMember","group.removeMember"],Cd=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Sd(e,n){var r;if(!n.length||!((r=e.indexes)!=null&&r.length))return[];const o=new Set(n),i=new Set;for(const l of e.attributes)if(o.has(l.modelId)){i.add(l.modelId);for(const s of l.dbAttrs)i.add(s.modelId)}if(!i.size)return[];const a=[];for(const l of e.indexes){const s=l.columns.filter(c=>!i.has(c.columnRef));s.length!==l.columns.length&&a.push({indexRef:l.modelId,columns:s})}return a}function Rg(e){return e.flatMap(n=>n.dbAttrs).length}function Rd(e,n){return new Set(e.associations.filter(o=>{const i=o.end1.entityRef===n?o.end1:o.end2;return i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES"}).map(o=>o.modelId))}function $g(e,n,o,i){var r;const a=new Set;for(const l of e.attributes)l.dbAttrs.forEach((s,c)=>{if(s.sharedColumnRef!=null)return;const d=Ko(l,s,c,e,i);d&&a.add(d)});for(let l=n.dbAttrs.length;l<o.length;l++){const s=(r=o[l])==null?void 0:r.physicalName;if(s&&a.has(s))return!0}return!1}function Ag(e,n,o=Be){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=Rg(i.attributes);if(a===0)return[];const r=Rd(e,n),l=i.attributes.flatMap(c=>c.dbAttrs),s=[];for(const c of e.entities){const d=c.attributes.filter(u=>{var m;return u.attrType==="EMBED_OWN"&&((m=u.embedded)==null?void 0:m.embeddableRef)===n&&!r.has(u.embedded.associationRef)&&a-u.dbAttrs.length>0});if(!(d.length>1))for(const u of d){const m=a-u.dbAttrs.length;$g(c,u,l,e)||s.push({entityId:c.modelId,attributeId:u.modelId,dbAttrs:[...u.dbAttrs,...Array.from({length:m},()=>({modelId:o(),physicalName:"",dataType:""}))],added:m})}}return s}function $d(e,n,o){var h;const i=e.entities.find(p=>p.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(p=>[p.modelId,p])),l=[];for(const p of o){const y=r.get(p);if(!y)return[];l.push(y)}const s=a.flatMap(p=>p.dbAttrs).map(p=>p.modelId),c=l.flatMap(p=>p.dbAttrs).map(p=>p.modelId);if(s.length!==c.length)return[];if(s.every((p,y)=>p===c[y]))return[];const d=new Map(s.map((p,y)=>[p,y])),u=Rd(e,n),m=[];for(const p of e.entities)for(const y of p.attributes){if(y.attrType!=="EMBED_OWN"||((h=y.embedded)==null?void 0:h.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const b=c.map(g=>y.dbAttrs[d.get(g)]),f=b.reduce((g,k,_)=>k===y.dbAttrs[_]?g:g+1,0);f&&m.push({entityId:p.modelId,attributeId:y.modelId,dbAttrs:b,moved:f})}return m}function Tg(e,n){const o=()=>e.entities.filter(r=>{var l;return((l=r.table)==null?void 0:l.physicalName)===n.ref}),i=()=>e.entities.filter(r=>r.name===n.ref);if(n.by==="modelId")return e.entities.filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Mg(e,n){const o=()=>e.attributes.filter(r=>r.name===n.ref),i=()=>e.attributes.filter(r=>r.dbAttrs.some(l=>l.physicalName===n.ref));if(n.by==="modelId")return e.attributes.filter(r=>r.modelId===n.ref);if(n.by==="name")return o();if(n.by==="physicalName")return i();const a=o();return a.length?a:i()}function Ad(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function yt(e,n){const o=Tg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>Dg(i,e))}}function Vg(e,n){const o=()=>e.groups.filter(r=>r.packageName===n.ref),i=()=>e.groups.filter(r=>Object.values(r.name??{}).some(l=>l===n.ref));if(n.by==="modelId")return e.groups.filter(r=>r.modelId===n.ref);if(n.by==="packageName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Qr(e,n){const o=Vg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>({modelId:i.modelId,name:i.name??null,packageName:i.packageName??null,members:i.memberEntityRefs.length}))}}function el(e,n,o){return e.reason==="not-found"?{code:"group-not-found",opIndex:n,handle:o}:{code:"group-ambiguous",opIndex:n,handle:o,matches:e.matches}}const Bg=new Set(["name","description","packageName","excludeDDLGeneration"]);function Dg(e,n){var a;const o=Gi(e,n).value,i=n.associations.filter(r=>{var l,s;return((l=r.end1)==null?void 0:l.entityRef)===e.modelId||((s=r.end2)==null?void 0:s.entityRef)===e.modelId});return{modelId:e.modelId,stereotype:e.stereotype,packageName:o||null,table:((a=e.table)==null?void 0:a.physicalName)||null,attributes:e.attributes.length,references:i.length,referencedBy:[...new Set(i.map(r=>{var c,d,u,m;const l=((c=r.end1)==null?void 0:c.entityRef)===e.modelId?(d=r.end2)==null?void 0:d.entityRef:(u=r.end1)==null?void 0:u.entityRef,s=n.entities.find(h=>h.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function Td(e,n){const o=Mg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Lg(e,n){const o=()=>e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.physicalName===n.ref),i=()=>e.attributes.filter(r=>r.name===n.ref).flatMap(r=>r.dbAttrs);if(n.by==="modelId")return e.attributes.flatMap(r=>r.dbAttrs).filter(r=>r.modelId===n.ref);if(n.by==="physicalName")return o();if(n.by==="name")return i();const a=o();return a.length?a:i()}function Og(e,n){const o=Lg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Md(e,n){const o=e.filter(i=>i.physicalName===n.ref);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function tl(e){return e.by!==void 0&&e.by!=="name"}function Pg(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function zg(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function Fg(e,n){const o=Pg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Vd(e,n){const o=zg(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>i.modelId)}}function Bd(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function Dd(e){return Bd(e)&&e.dataType==null}function Ld(e,n,o){const i=Bd(e);return{modelId:o(),name:e.name,type:e.type,attrType:"NORMAL",identifier:e.identifier??!1,notNull:e.notNull??!1,order:n,...e.transient?{transient:!0}:{},...e.groupCode?{groupCode:e.groupCode}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:i?[{modelId:o(),physicalName:e.physicalName??e.name,dataType:e.dataType??"",...e.length?{length:e.length}:{},...e.scale?{scale:e.scale}:{},...e.columnLogicalName?{logicalName:e.columnLogicalName}:{},...e.unique!=null?{unique:e.unique}:{},...e.updatable!=null?{updatable:e.updatable}:{}}]:[]}}function Od(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(p=>[p.field,p])),m=[];let h=!1;for(const p of n.fields){const y=u.get(p.name);if(y!=null&&y.sharedColumnPhysicalName){const b={ref:y.sharedColumnPhysicalName,by:"physicalName"},f=Md(En(i,a),b);if(!f.ok){s.push(f.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:b}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:b,matches:f.matches}),h=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:f.value.modelId});continue}m.push({modelId:c(),physicalName:(y==null?void 0:y.physicalName)??"",dataType:"",...y!=null&&y.length?{length:y.length}:{},...y!=null&&y.scale?{scale:y.scale}:{},...(y==null?void 0:y.insertable)!=null?{insertable:y.insertable}:{},...(y==null?void 0:y.updatable)!=null?{updatable:y.updatable}:{}})}return h?null:{modelId:d,name:e.name,type:n.type,attrType:"EMBED_PREDEF",identifier:e.identifier??!1,notNull:e.notNull??!1,order:o,...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.attributeGroup?{attributeGroup:e.attributeGroup}:{},...e.description?{description:e.description}:{},dbAttrs:m}}const Ug=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs"]),Hg=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table"]),jg=new Set(["description","identifying"]),Kg=new Set(["multiplicity","navigable","composition"]),Gg=new Set(["name","unique","description","parameters"]),Yg=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Eo(e,n,o=[]){const i=[];for(const a of Object.keys(e)){if(a.includes(".")){o.some(r=>a.startsWith(r))||i.push(a);continue}n.has(a)||i.push(a)}return i}const nl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),qg=new Set([...nl].filter(e=>e!=="sharedColumnRef"));function Wg(e,n,o,i){if(i||o.some(l=>!qg.has(l))||e.attrType!=="NORMAL"||e.dbAttrs.length!==1)return null;const a={...e.dbAttrs[0]};for(const l of o)a[l]=n[l];const r={};for(const[l,s]of Object.entries(n))nl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function Jg(e,n,o,i,a,r,l,s){const c=new Map(o.map(m=>[m.field,m])),d=[];let u=!1;return e.dbAttrs.forEach((m,h)=>{const p=n.fields[h],y=p?c.get(p.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const f={ref:y.sharedColumnPhysicalName,by:"physicalName"},g=Md(En(i,a),f);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:f}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:f,matches:g.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:g.value.modelId});return}const b={...m};delete b.sharedColumnRef,d.push({...b,...y.physicalName!=null?{physicalName:y.physicalName}:{},...y.length!=null?{length:y.length}:{},...y.scale!=null?{scale:y.scale}:{},...y.insertable!=null?{insertable:y.insertable}:{},...y.updatable!=null?{updatable:y.updatable}:{}})}),u?null:d}function Pd(e,n,o){return{modelId:o(),name:e.name,order:n,...e.visibility?{visibility:e.visibility}:{},...e.sourceCode?{sourceCode:e.sourceCode}:{},...e.description?{description:e.description}:{},...e.personalInfoAttributeType?{personalInfoAttributeType:e.personalInfoAttributeType}:{}}}function zd(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=Og(e,c.column);if(!d.ok){a.push(d.reason==="not-found"?{code:"column-not-found",opIndex:o,entity:i,handle:c.column}:{code:"column-ambiguous",opIndex:o,entity:i,handle:c.column,matches:d.matches}),s=!0;continue}l.push({columnRef:d.value.modelId,descending:c.descending??!1})}return s?null:{modelId:r(),name:n.name,unique:n.unique??!1,columns:l,...n.description?{description:n.description}:{},...n.parameters?{parameters:n.parameters}:{}}}function No(e,n,o,i){const a=`${o}:${i}`;n.seen.has(a)||(n.seen.add(a),n.pairs.push({entityId:o,attributeId:i}),e.push({kind:"attribute.remove",casUnit:"logical",containerRef:o,entityRef:o,attributeRef:i}))}function Xg(e,n,o,i){const a=new Map;for(const{entityId:r,attributeId:l}of o.pairs){if(i.has(r))continue;const s=a.get(r)??[];s.push(l),a.set(r,s)}for(const[r,l]of a){const s=n.entities.find(c=>c.modelId===r);if(s)for(const c of Sd(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function ol(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of sc(n,o,i)){for(const u of c.remove)No(e,a,s,u);for(const u of c.update)e.push({kind:"attribute.update",casUnit:"logical",containerRef:s,entityRef:s,attributeRef:u.attributeId,patch:u.patch});const d=((l=n.entities.find(u=>u.modelId===s))==null?void 0:l.attributes)??[];for(const u of c.add)e.push({kind:"attribute.add",casUnit:"logical",containerRef:s,entityRef:s,value:{...u,order:r(s,d)}})}}function Zg(e,n,o={}){const i=o.mkId??Be,a=o.embeddableCatalog??[],r=f=>a.find(g=>g.type===f),l=[],s=[],c=new Map,d=(f,g)=>{const k=c.get(f)??$t(g);return c.set(f,k+1),k},u=new Map,m=new Set,h=new Set,p={seen:new Set,pairs:[]},y=new Set;for(const f of n)f.kind==="entity.add"&&(y.add(f.spec.name),f.spec.physicalName&&y.add(f.spec.physicalName));const b=new Set;return n.forEach((f,g)=>{var k,_,N,I,A;switch(f.kind){case"entity.add":{const x=e.entities.filter(E=>E.name===f.spec.name).map(E=>E.modelId);if(x.length||b.has(f.spec.name)){s.push({code:"entity-name-conflict",opIndex:g,handle:{ref:f.spec.name},matches:x});break}b.add(f.spec.name);const $=i(),T={modelId:$,name:f.spec.name,stereotype:f.spec.stereotype??"JPA_ENTITY",attributes:[],...f.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...f.spec.physicalName?{table:{physicalName:f.spec.physicalName}}:{}},V={ref:f.spec.name};let R=!1;for(const[E,w]of(f.spec.attributes??[]).entries()){if(w.type==="GroupCodeEnum"&&!w.groupCode){s.push({code:"groupcode-required",opIndex:g,entity:V,handle:{ref:w.name}}),R=!0;continue}if(!r(w.type)&&!((k=w.embeddableOverrides)!=null&&k.length)&&Dd(w)){s.push({code:"datatype-required",opIndex:g,entity:V,handle:{ref:w.name}}),R=!0;continue}const S=r(w.type);if(S){const B=Od(w,S,E,T,e.entities,g,V,s,i);B?T.attributes.push(B):R=!0}else(_=w.embeddableOverrides)!=null&&_.length?(s.push({code:"embeddable-type-unresolved",opIndex:g,entity:V,handle:{ref:w.name}}),R=!0):T.attributes.push(Ld(w,E,i))}const C=(f.spec.operations??[]).map((E,w)=>Pd(E,w,i));C.length&&(T.operations=C);const M=[];for(const E of f.spec.indexes??[]){const w=zd(T,E,g,V,s,i);w?M.push(w):R=!0}if(M.length&&(T.indexes=M),R)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:$,value:T});break}case"entity.update":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}const $=Eo(f.patch,Hg,["jpaAttrs.","table."]);if($.length){s.push({code:"entity-patch-unknown-key",opIndex:g,entity:f.entity,keys:$});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,patch:f.patch});break}case"entity.remove":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}const $=x.value.modelId,T=e.associations.filter(M=>M.end1.entityRef===$||M.end2.entityRef===$),V=new Set(T.map(M=>M.modelId));for(const M of T)m.has(M.modelId)||(m.add(M.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:M.modelId}));for(const M of e.entities)if(M.modelId!==$)for(const E of M.attributes)E.embedded&&V.has(E.embedded.associationRef)&&No(l,p,M.modelId,E.modelId);for(const M of T){if(M.end1.entityRef===$||!M.end1.attributeRef)continue;const E=e.entities.find(S=>S.modelId===M.end1.entityRef),w=E==null?void 0:E.attributes.find(S=>S.modelId===M.end1.attributeRef&&S.attrType==="RELATION_REF");w&&No(l,p,E.modelId,w.modelId)}const R={...e,entities:e.entities.filter(M=>M.modelId!==$),associations:e.associations.filter(M=>!V.has(M.modelId))},C=new Set(T.filter(M=>M.end1.entityRef===$&&M.end2.entityRef!==$).map(M=>M.end2.entityRef));for(const M of C)ol(l,R,M,i,p,d);h.add($),l.push({kind:"entity.remove",casUnit:"logical",entityRef:$});break}case"attribute.add":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}if(f.spec.type==="GroupCodeEnum"&&!f.spec.groupCode){s.push({code:"groupcode-required",opIndex:g,entity:f.entity,handle:{ref:f.spec.name}});break}if(!r(f.spec.type)&&!((N=f.spec.embeddableOverrides)!=null&&N.length)&&Dd(f.spec)){s.push({code:"datatype-required",opIndex:g,entity:f.entity,handle:{ref:f.spec.name}});break}const $=d(x.value.modelId,x.value.attributes),T=r(f.spec.type);let V;if(T)V=Od(f.spec,T,$,x.value,e.entities,g,f.entity,s,i);else if((I=f.spec.embeddableOverrides)!=null&&I.length){s.push({code:"embeddable-type-unresolved",opIndex:g,entity:f.entity,handle:{ref:f.spec.name}});break}else V=Ld(f.spec,$,i);if(!V)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:V});break}case"attribute.update":case"attribute.remove":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}const $=Td(x.value,f.attribute);if(!$.ok){s.push($.reason==="not-found"?{code:"attribute-not-found",opIndex:g,entity:f.entity,handle:f.attribute}:{code:"attribute-ambiguous",opIndex:g,entity:f.entity,handle:f.attribute,matches:$.matches});break}if(f.kind==="attribute.update"){const T=[],V=[];let R=!1;for(const w of Object.keys(f.patch)){if(w.includes(".")){w.startsWith("dbAttrs.")?R=!0:V.push(w);continue}nl.has(w)?T.push(w):Ug.has(w)||V.push(w)}if(V.length){s.push({code:"attribute-patch-unknown-key",opIndex:g,entity:f.entity,handle:f.attribute,keys:V});break}if("attrType"in f.patch){const w=String(f.patch.attrType),S=Cd.includes(w)?w!==$.value.attrType?"transition":void 0:"unknown-value";if(S){s.push({code:"attribute-attrtype-unsupported",opIndex:g,entity:f.entity,handle:f.attribute,reason:S,current:$.value.attrType,requested:w});break}}const C="type"in f.patch?f.patch.type:$.value.type,M="groupCode"in f.patch?f.patch.groupCode:$.value.groupCode;if(C==="GroupCodeEnum"&&!M){s.push({code:"groupcode-required",opIndex:g,entity:f.entity,handle:f.attribute});break}let E=f.patch;if(T.length){const w=Wg($.value,f.patch,T,R);if(!w){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:g,entity:f.entity,handle:f.attribute,keys:T});break}E=w}if((A=f.embeddableOverrides)!=null&&A.length){const w=r($.value.type);if(!w||$.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:g,entity:f.entity,handle:f.attribute});break}const S=Jg($.value,w,f.embeddableOverrides,x.value,e.entities,g,f.entity,s);if(!S)break;E={...E,dbAttrs:S}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:$.value.modelId,patch:E})}else{const T=Wi(e,x.value.modelId,$.value.modelId);if(T){const V=R=>{var C;return((C=e.entities.find(M=>M.modelId===R))==null?void 0:C.name)??R};s.push({code:"attribute-fk-managed",opIndex:g,entity:f.entity,handle:f.attribute,association:{from:V(T.end1.entityRef),to:V(T.end2.entityRef)}});break}No(l,p,x.value.modelId,$.value.modelId)}break}case"association.add":{const x=yt(e,f.spec.from),$=yt(e,f.spec.to);if(x.ok||s.push(gt(x.reason,g,f.spec.from,x.matches,y)),$.ok||s.push(gt($.reason,g,f.spec.to,$.matches,y)),!x.ok||!$.ok)break;if(f.spec.identifying&&x.value.modelId===$.value.modelId){s.push({code:"self-identifying",opIndex:g,handle:{from:f.spec.from,to:f.spec.to}});break}const T=i(),V={modelId:T,...f.spec.identifying!=null?{identifying:f.spec.identifying}:{},end1:{entityRef:x.value.modelId,multiplicity:f.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:$.value.modelId,multiplicity:f.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:f.spec.composition??!1}},R={...e,associations:[...e.associations,V]},C=Yo(R,$.value.modelId,i);C.add[0]&&(V.end2.attributeRef=C.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:T,value:V});for(const M of C.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:$.value.modelId,entityRef:$.value.modelId,value:{...M,order:d($.value.modelId,$.value.attributes)}});break}case"association.remove":{const x=yt(e,f.association.from),$=yt(e,f.association.to);if(x.ok||s.push(gt(x.reason,g,f.association.from,x.matches,y)),$.ok||s.push(gt($.reason,g,f.association.to,$.matches,y)),!x.ok||!$.ok)break;const T=Ad(e,x.value.modelId,$.value.modelId);if(T.length!==1){s.push(T.length===0?{code:"association-not-found",opIndex:g,handle:f.association}:{code:"association-ambiguous",opIndex:g,handle:f.association,matches:T.map(M=>M.modelId)});break}const V=T[0];m.has(V.modelId)||(m.add(V.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:V.modelId}));const R=e.entities.find(M=>M.attributes.some(E=>{var w;return((w=E.embedded)==null?void 0:w.associationRef)===V.modelId}));if(R){const M=R.attributes.find(E=>{var w;return((w=E.embedded)==null?void 0:w.associationRef)===V.modelId});No(l,p,R.modelId,M.modelId);break}if(V.end1.attributeRef){const M=e.entities.find(w=>w.modelId===V.end1.entityRef),E=M==null?void 0:M.attributes.find(w=>w.modelId===V.end1.attributeRef&&w.attrType==="RELATION_REF");E&&No(l,p,M.modelId,E.modelId)}const C={...e,associations:e.associations.filter(M=>M.modelId!==V.modelId)};ol(l,C,V.end2.entityRef,i,p,d);break}case"association.update":{const x=Fd(e,f.association,g,s,y);if(!x)break;const $=f.patch.identifying,T=typeof $=="boolean"?$:void 0;if(T===!0&&x.end1.entityRef===x.end2.entityRef){s.push({code:"self-identifying",opIndex:g,handle:f.association});break}const V=Eo(f.patch,jg);if(V.length){s.push({code:"association-patch-unknown-key",opIndex:g,handle:f.association,keys:V});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,patch:f.patch}),T!==void 0&&T!==(x.identifying??!1)){const R={...e,associations:e.associations.map(C=>C.modelId===x.modelId?{...C,identifying:T}:C)};ol(l,R,x.end2.entityRef,i,p,d)}break}case"associationEnd.update":{const x=Fd(e,f.association,g,s,y);if(!x)break;const $=f.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(f.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:g,handle:f.association});break}const T=Eo(f.patch,Kg,["jpa."]);if(T.length){s.push({code:"association-end-patch-unknown-key",opIndex:g,handle:f.association,keys:T});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:x.modelId,associationRef:x.modelId,end:$,patch:f.patch});break}case"index.add":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}const $=zd(x.value,f.spec,g,f.entity,s,i);if(!$)break;l.push({kind:"index.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:$.modelId,value:$});break}case"index.update":case"index.remove":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}if(tl(f.index)){s.push({code:"handle-by-unsupported",opIndex:g,entity:f.entity,handle:f.index,target:"index"});break}const $=Fg(x.value,f.index);if(!$.ok){s.push($.reason==="not-found"?{code:"index-not-found",opIndex:g,entity:f.entity,handle:f.index}:{code:"index-ambiguous",opIndex:g,entity:f.entity,handle:f.index,matches:$.matches});break}if(f.kind==="index.update"){if("columns"in f.patch){s.push({code:"index-columns-patch-unsupported",opIndex:g,entity:f.entity,handle:f.index});break}const T=Eo(f.patch,Gg);if(T.length){s.push({code:"index-patch-unknown-key",opIndex:g,entity:f.entity,handle:f.index,keys:T});break}l.push({kind:"index.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:$.value.modelId,patch:f.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,indexRef:$.value.modelId});break}case"operation.add":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}const $=u.get(x.value.modelId)??(x.value.operations?$t(x.value.operations):0);u.set(x.value.modelId,$+1);const T=Pd(f.spec,$,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:T.modelId,value:T});break}case"operation.update":case"operation.remove":{const x=yt(e,f.entity);if(!x.ok){s.push(gt(x.reason,g,f.entity,x.matches,y));break}if(tl(f.operation)){s.push({code:"handle-by-unsupported",opIndex:g,entity:f.entity,handle:f.operation,target:"operation"});break}const $=Vd(x.value,f.operation);if(!$.ok){s.push($.reason==="not-found"?{code:"operation-not-found",opIndex:g,entity:f.entity,handle:f.operation}:{code:"operation-ambiguous",opIndex:g,entity:f.entity,handle:f.operation,matches:$.matches});break}if(f.kind==="operation.update"){const T=Eo(f.patch,Yg);if(T.length){s.push({code:"operation-patch-unknown-key",opIndex:g,entity:f.entity,handle:f.operation,keys:T});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:$.value.modelId,patch:f.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:$.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const x=f.kind==="attribute.reorder",$=yt(e,f.entity);if(!$.ok){s.push(gt($.reason,g,f.entity,$.matches,y));break}const T=x?f.order:f.operations,V=[],R=new Set;let C=!1;for(const S of T){if(!x&&tl(S)){s.push({code:"handle-by-unsupported",opIndex:g,entity:f.entity,handle:S,target:"operation"}),C=!0;continue}const B=x?Td($.value,S):Vd($.value,S);if(!B.ok){s.push(B.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:g,entity:f.entity,handle:S}:{code:"reorder-handle-ambiguous",opIndex:g,entity:f.entity,handle:S,matches:B.matches}),C=!0;continue}if(R.has(B.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:g,entity:f.entity,handle:S}),C=!0;continue}R.add(B.value.modelId),V.push(B.value)}if(C)break;const E=[...x?$.value.attributes:$.value.operations??[]].sort((S,B)=>S.order-B.order).filter(S=>!R.has(S.modelId)),w=[...V,...E];if(w.forEach((S,B)=>{S.order!==B&&l.push(x?{kind:"attribute.update",casUnit:"logical",containerRef:$.value.modelId,entityRef:$.value.modelId,attributeRef:S.modelId,patch:{order:B}}:{kind:"operation.update",casUnit:"logical",containerRef:$.value.modelId,entityRef:$.value.modelId,operationRef:S.modelId,patch:{order:B}})}),x)for(const S of $d(e,$.value.modelId,w.map(B=>B.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:S.entityId,entityRef:S.entityId,attributeRef:S.attributeId,patch:{dbAttrs:S.dbAttrs}});break}case"group.add":{const x=[];let $=!1;for(const R of f.spec.members){const C=yt(e,R);if(!C.ok){s.push(gt(C.reason,g,R,C.matches,y)),$=!0;continue}x.push(C.value.modelId)}if($)break;const T=i(),V={modelId:T,excludeDDLGeneration:f.spec.excludeDDLGeneration??!1,memberEntityRefs:x,...f.spec.name?{name:f.spec.name}:{},...f.spec.packageName?{packageName:f.spec.packageName}:{},...f.spec.description?{description:f.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:T,value:V});break}case"group.update":{const x=Qr(e,f.group);if(!x.ok){s.push(el(x,g,f.group));break}const $=Eo(f.patch,Bg);if($.length){s.push({code:"group-patch-unknown-key",opIndex:g,handle:f.group,keys:$});break}l.push({kind:"group.update",casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,patch:f.patch});break}case"group.remove":{const x=Qr(e,f.group);if(!x.ok){s.push(el(x,g,f.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:x.value.modelId});break}case"group.addMember":case"group.removeMember":{const x=Qr(e,f.group);if(!x.ok){s.push(el(x,g,f.group));break}const $=yt(e,f.entity);if(!$.ok){s.push(gt($.reason,g,f.entity,$.matches,y));break}const T=x.value.memberEntityRefs.includes($.value.modelId);if(f.kind==="group.addMember"?T:!T)break;l.push({kind:f.kind,casUnit:"logical",containerRef:x.value.modelId,groupRef:x.value.modelId,entityRef:$.value.modelId});break}}}),s.length||Xg(l,e,p,h),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function gt(e,n,o,i,a){return e==="not-found"&&(a!=null&&a.has(o.ref))?{code:"pending-entity-ref",opIndex:n,handle:o}:e==="not-found"?{code:"entity-not-found",opIndex:n,handle:o}:{code:"entity-ambiguous",opIndex:n,handle:o,matches:i}}function Fd(e,n,o,i,a){const r=yt(e,n.from),l=yt(e,n.to);if(r.ok||i.push(gt(r.reason,o,n.from,r.matches,a)),l.ok||i.push(gt(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=Ad(e,r.value.modelId,l.value.modelId);return s.length!==1?(i.push(s.length===0?{code:"association-not-found",opIndex:o,handle:n}:{code:"association-ambiguous",opIndex:o,handle:n,matches:s.map(c=>c.modelId)}),null):s[0]}const Ud={type:"object",description:"요소 지정 핸들. 엔티티: 물리명(table.physicalName) 우선, 논리명(name) 보조. 속성: 소속 엔티티 내 속성명 또는 컬럼 물리명.",properties:{ref:{type:"string",description:"매칭할 이름/물리명. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["physicalName","name","modelId"],description:"매칭 키 고정(미지정 시 대상별 기본 순서). 'modelId'는 모호 해소 전용 탈출구 — 평시엔 쓰지 말고, entity-ambiguous 응답의 후보를 사용자에게 제시해 확인받은 뒤 그 modelId로 재전송할 때만 쓴다."}},required:["ref"],additionalProperties:!1},Qg={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},eb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},tb={type:"object",description:"신규 엔티티. 자식(속성·인덱스·operation)은 별도 attribute.add 등이 아니라 여기 inline 배열로 담아라 — 같은 배치에서 갓 추가된 엔티티에 닿는 child op은 silent no-op이 된다(서버가 pending-entity-ref로 거부). 관계는 inline 불가 → 엔티티 추가 배치 확정 후 별도 배치로 association.add.",properties:{name:{type:"string"},stereotype:{type:"string",enum:["UNDEFINED","JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY"],description:"기본 JPA_ENTITY."},physicalName:{type:"string",description:"설정 시 table.physicalName."},useVersion:{type:"boolean",description:'JPA @Version(낙관적 락) → jpaAttrs.useVersion. @Version 필드는 별도 속성이 아니라 이 엔티티 플래그로 흡수 (버전 컬럼은 코드젠 소유). 기존 엔티티는 entity.update patch의 dotted key {"jpaAttrs.useVersion":true} 사용.'},attributes:{type:"array",description:"inline 속성(배열 순서가 order). attribute.add와 동일 규칙 — GroupCodeEnum은 groupCode 동반 필수.",items:{$ref:"#/$defs/attrSpec"}},indexes:{type:"array",description:"inline 인덱스. 컬럼 핸들은 이 엔티티가 inline으로 만드는 dbAttr 내에서 해소된다(attributes 동반 전제).",items:{$ref:"#/$defs/indexSpec"}},operations:{type:"array",description:"inline 도메인 메서드(배열 순서가 order).",items:{$ref:"#/$defs/operationSpec"}}},required:["name"],additionalProperties:!1},In={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},nb={type:"object",properties:{name:{type:"string"},type:{type:"string",description:"Java 타입(예: Long, String). GroupCodeEnum은 파생 타입이라 groupCode 동반 필수(없으면 거부). 호스트 임베더블 카탈로그에 등록된 predefined 임베더블 타입(예: Money, EmbeddableAddress)이면 EMBED_PREDEF로 다중 컬럼 확장(서브컬럼 조정은 embeddableOverrides)."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean",description:"JPA @Transient(비영속) → Attribute.transient. 컬럼을 만들지 않으므로 physicalName/dataType 등 컬럼 필드는 함께 주지 않는다. 기존 속성은 attribute.update patch {transient:true}로도 가능."},physicalName:{type:"string",description:"설정 시 단일 dbAttr 컬럼 생성(미설정이면 name을 물리명으로)."},dataType:{type:"string",description:"dbAttr 물리 타입(예: BIGINT). physicalName/dataType/length/scale 중 하나라도 있으면 컬럼 생성."},length:{type:"integer",description:"dbAttr 컬럼 길이(VARCHAR(n)·DECIMAL precision)."},scale:{type:"integer",description:"dbAttr 소수 자릿수(DECIMAL/NUMERIC scale). length 동반이 일반적."},groupCode:{type:"string",description:"코드성 속성의 group code 바인딩. type=GroupCodeEnum이면 필수."},defaultValue:{type:"string",description:"속성 기본값(문자열 패스스루)."},attributeGroup:{type:"string",description:"속성 분류 그룹(예: 'code'·'amt')."},description:{...In,description:"속성 설명(다국어)."},columnLogicalName:{...In,description:'dbAttr 컬럼 논리명(다국어, 예: {ko:"체크아웃유형"}). 한글 업무명 보존 위치.'},unique:{type:"boolean",description:"dbAttr UNIQUE 제약."},updatable:{type:"boolean",description:"dbAttr 갱신 가능(JPA @Column(updatable=))."},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["name","type"],additionalProperties:!1},ob={type:"array",description:"predefined 임베더블 서브컬럼 오버라이드(속성 type이 카탈로그 엔트리이자 EMBED_PREDEF일 때만). field=카탈로그 필드명으로 매칭(@AttributeOverride 대응). 미설정 서브컬럼은 add=카탈로그 기본 상속 / update=기존값 유지. currency 등 공유 컬럼은 sharedColumnPhysicalName으로 SHARED_REF.",items:{type:"object",properties:{field:{type:"string",description:"대상 카탈로그 필드명(예: amount·currency)."},physicalName:{type:"string",description:"서브컬럼 물리명 오버라이드(@AttributeOverride column name). 미설정 시 카탈로그 기본."},length:{type:"integer",description:"서브컬럼 길이 오버라이드."},scale:{type:"integer",description:"서브컬럼 소수 자릿수 오버라이드."},insertable:{type:"boolean",description:"JPA @Column(insertable=). OWN 컬럼에만 저장."},updatable:{type:"boolean",description:"JPA @Column(updatable=). OWN 컬럼에만 저장."},sharedColumnPhysicalName:{type:"string",description:"SHARED_REF — 같은 엔터티(임베더블이면 owner 합집합) 다른 컬럼(물리명)을 공유해 read-only 투영(대표: currency). 설정 시 자체 컬럼 미보유, 타깃은 해소 시점 존재 필수."}},required:["field"],additionalProperties:!1}},Hd={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},ib={type:"object",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...Hd,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...Hd,description:"end2 다중성(기본 ZERO_OR_MORE_INSTANCES)."},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK로 전파). self-association은 식별 불가."},composition:{type:"boolean",description:"end2 composition."}},required:["from","to"],additionalProperties:!1},ab={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...Ud,description:"컬럼 핸들 — 컬럼 물리명 우선, 속성명 보조(단일 컬럼 속성만). 엔티티 내에서 dbAttr modelId로 해소."},descending:{type:"boolean",description:"내림차순(기본 false)."}},required:["column"],additionalProperties:!1}},description:{type:"string",description:"인덱스 설명(평문)."},parameters:{type:"string",description:"인덱스 파라미터(패스스루)."}},required:["name","columns"],additionalProperties:!1},rb={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...In,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},lb={type:"object",properties:{name:{...In,description:'그룹 논리명(다국어, 예: {ko:"주문"}).'},packageName:{type:"string",description:"자바 패키지명 등 그룹 물리 식별(레거시 LogicalGroup.packageName)."},description:{type:"string",description:"그룹 설명(자유 텍스트 — 도메인 경계 메모)."},excludeDDLGeneration:{type:"boolean",description:"DDL 생성 제외(기본 false)."},members:{type:"array",description:"멤버 엔티티 핸들(물리명 우선/논리명 보조). 기존 엔티티여야 함 — 같은 배치 신규 엔티티는 별도 배치 후.",items:{$ref:"#/$defs/handle"}}},required:["members"],additionalProperties:!1},sb={type:"object",description:"기존 속성 부분 patch. 논리 필드 + 스칼라 단일 컬럼의 물리 필드(physicalName·dataType·length·scale 등 — 서버가 dbAttrs[0]에 매핑). EMBED_PREDEF/Money 서브컬럼 조정은 op-레벨 embeddableOverrides로(평탄 키는 다중 컬럼서 모호해 거부).",properties:{name:{type:"string"},type:{type:"string"},customType:{type:"string"},attrType:{type:"string",enum:[...Cd],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},description:{...In,description:"속성 설명(다국어)."},attributeGroup:{type:"string"},groupCode:{type:"string"},defaultValue:{type:"string"},personalInfoAttributeType:{type:"string"},order:{type:"integer"},physicalName:{type:"string"},dataType:{type:"string"},length:{type:"integer"},scale:{type:"integer"},unique:{type:"boolean"},updatable:{type:"boolean"},insertable:{type:"boolean"},autoIncrement:{type:"boolean"},multiValue:{type:"boolean"},multiValueSeparator:{type:"string"},sequenceName:{type:"string"},logicalName:{...In,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},cb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},db={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},ub={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...In,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},mb={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·declarationOfInterfaces·table. jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경.'},fb={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function it(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const pb={"entity.add":it("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":it("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":it("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":it("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":it("attribute.update",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/attrUpdatePatch"},embeddableOverrides:{$ref:"#/$defs/embeddableOverrides"}},required:["entity","attribute","patch"]}),"attribute.remove":it("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":it("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":it("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":it("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":it("associationEnd.update",{properties:{association:{$ref:"#/$defs/assocHandle"},end:{type:"string",enum:["from","to"],description:"from=부모(end1), to=자식(end2)."},patch:{$ref:"#/$defs/assocEndUpdatePatch"}},required:["association","end","patch"]}),"index.add":it("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":it("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":it("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":it("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":it("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":it("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":it("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":it("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":it("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":it("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":it("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":it("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":it("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},hb={type:"object",description:"그룹 지정 핸들. 패키지명(packageName) 우선, 이름(name) 보조 — 이름은 다국어라 어느 로케일 값이든 일치하면 매칭. 'modelId'는 모호 해소 전용(group-ambiguous 후보를 사용자에게 확인받은 뒤).",properties:{ref:{type:"string",description:"매칭할 패키지명/이름. by:'modelId'면 modelId 원문."},by:{type:"string",enum:["packageName","name","modelId"],description:"매칭 키 고정(미지정 시 packageName → name)."}},required:["ref"],additionalProperties:!1},yb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...In,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},jd={anyOf:xd.map(e=>pb[e])},gb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:Ud,nameHandle:Qg,groupHandle:hb,assocHandle:eb,entitySpec:tb,attrSpec:nb,embeddableOverrides:ob,assocSpec:ib,indexSpec:ab,operationSpec:rb,groupSpec:lb,entityUpdatePatch:mb,attrUpdatePatch:sb,assocUpdatePatch:cb,assocEndUpdatePatch:fb,indexUpdatePatch:db,operationUpdatePatch:ub,groupUpdatePatch:yb,symbolicOp:jd}};function bb(e,n,o,i={}){const a=i.mkClientOpId??Be,r=new Set;for(const s of o)s.casUnit==="logical"&&s.containerRef&&r.add(s.containerRef);const l={};if(r.size){l.revs={};for(const s of r)l.revs[s]=n[s]??0}return{diagramId:e,ops:o,cas:l,origin:i.origin??"agent",clientOpId:a()}}const Kd={location:{x:0,y:0},size:{width:220,height:140}};function Gd(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}const _b=/^[-=_*~\s]{3,}$/;function kb(e){return e.attrType&&e.attrType!=="NORMAL"||!_b.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Eb(e){return e.type===en&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Nb(e,n){if(e.attrType==="DIVIDER"||kb(e))return{modelId:e.modelId,name:e.attrType==="DIVIDER"?e.name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:e.order??n,dbAttrs:[]};const o=Eb(e);return{modelId:e.modelId,name:e.name,type:o.type,customType:o.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order??n,dbAttrs:e.dbAttrs.map(Gd)}}function wb(e,n){const{modelId:o,name:i,visibility:a,sourceCode:r,description:l,order:s,personalInfoAttributeType:c,style:d,...u}=e;return{modelId:o,name:i,visibility:a,sourceCode:r,description:l?{ko:l}:void 0,order:s??n,personalInfoAttributeType:c,legacyRaw:Object.keys(u).length?u:void 0}}function Ib(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,columns:e.indexColumns.map(n=>({columnRef:n.targetColumn.refId,descending:n.descending}))}}function vb(e){var n,o;return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.map(Nb),operations:(n=e.operations)==null?void 0:n.map(wb),indexes:(o=e.indexes)==null?void 0:o.map(Ib),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function xb(e){const n={};for(const i of e.attributes)i.style&&(n[i.modelId]=i.style);const o={};for(const i of e.operations??[])i.style&&(o[i.modelId]=i.style);return{entityRef:e.modelId,geo:e.geo??{...Kd},style:e.style,attributeStyles:Object.keys(n).length?n:void 0,operationStyles:Object.keys(o).length?o:void 0,collapsed:e.collapsed,locked:e.locked}}function Yd(e){return e.jpaAttribute?{fetchType:e.jpaAttribute.fetchType,cascadeTypes:e.jpaAttribute.cascadeTypes,orphanRemoval:e.jpaAttribute.orphanRemoval,orderBy:e.jpaAttribute.orderBy,collectionType:e.jpaAttribute.collectionType,collectionTable:e.jpaAttribute.collectionTable,orderColumn:e.jpaAttribute.orderColumn}:void 0}function il(e){var n;return{entityRef:e.endModel.refId,multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,attributeRef:(n=e.attribute)==null?void 0:n.modelId,jpa:Yd(e)}}function Cb(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>al(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Sb(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:Cb(e),end1:il(e.end1),end2:il(e.end2)},o={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:(i=e.end1.attribute)==null?void 0:i.modelId,targetColumnRef:(a=e.end2.attribute)==null?void 0:a.modelId,style:e.style};return{assoc:n,layout:o}}function al(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function qd(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Wd(e){var o;const n=e.attribute;return(n==null?void 0:n.attrType)==="EMBED_OWN"&&(((o=n.dbAttrs)==null?void 0:o.length)??0)===0&&(e.multiplicity==="ZERO_OR_MORE_INSTANCES"||e.multiplicity==="ONE_OR_MORE_INSTANCES")}function Jd(e,n){return{modelId:e.modelId,name:e.name??"",type:e.type??"",customType:e.customType,attrType:e.attrType??"RELATION_OWN",identifier:e.identifier??!1,notNull:e.notNull??!1,transient:e.transient_,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:n,dbAttrs:(e.dbAttrs??[]).map(Gd)}}function Rb(e,n,o){var N,I;const i=al(e.end1.attribute),a=al(e.end2.attribute);if(i===a)return Sb(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(I=(N=s.dbAttrs)==null?void 0:N[0])==null?void 0:I.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((A,x)=>Math.max(A,x.order),-1)+1:s.order??0,h={...Jd(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const p=n.get(r.endModel.refId),y=l.attribute;let b;if(y&&p&&r.navigable){const A=zi(l.multiplicity);b={modelId:y.modelId??crypto.randomUUID(),name:co(y.name??Ui((u==null?void 0:u.name)??l.endModel.refId,A),new Set(p.attributes.map(x=>x.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:p.attributes.reduce((x,$)=>Math.max(x,$.order),-1)+1,dbAttrs:[]},p.attributes.push(b)}const f=(A,x)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:x?b==null?void 0:b.modelId:h.modelId,jpa:Yd(A)}),g=r.endModel.refId===l.endModel.refId,k={modelId:e.modelId,description:e.description,identifying:!g&&h.identifier===!0?!0:void 0,end1:f(e.end1,i),end2:f(e.end2,a)},_={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:h.modelId,targetColumnRef:i?h.modelId:d,style:e.style};return{assoc:k,layout:_}}function $b(e,n){const o=e.targetModelId?n.get(e.targetModelId):void 0;return{modelId:e.modelId,physicalName:e.physicalName||(o==null?void 0:o.physicalName)||"",logicalName:e.logicalName??(o==null?void 0:o.logicalName),dataType:e.dataType||(o==null?void 0:o.dataType)||"",length:e.length??(o==null?void 0:o.length),scale:e.scale??(o==null?void 0:o.scale),unique:e.unique??(o==null?void 0:o.unique),autoIncrement:e.autoIncrement??(o==null?void 0:o.autoIncrement),updatable:e.updatable??(o==null?void 0:o.updatable),insertable:e.insertable??(o==null?void 0:o.insertable)}}function Ab(e,n,o){var y;const i=((y=e.end1.attribute)==null?void 0:y.attrType)==="EMBED_OWN",a=i?e.end1:e.end2,r=i?e.end2:e.end1,l=a.attribute,s=n.get(r.endModel.refId),c=s?s.attributes.reduce((b,f)=>Math.max(b,f.order),-1)+1:l.order??0,d={...Jd(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(b=>$b(b,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=b=>({...il(b),legacyEmbedRaw:b.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:h?d.modelId:void 0,targetColumnRef:h?void 0:d.modelId,style:e.style};return{assoc:m,layout:p}}function Tb(e,n){var i,a,r,l;const o=[];for(const s of n){const c=(a=(i=s.end1)==null?void 0:i.endModel)==null?void 0:a.refId,d=(l=(r=s.end2)==null?void 0:r.endModel)==null?void 0:l.refId,u=c===e?d:c;!u||u===e||o.push({targetRef:u,waypoints:s.locations??[]})}return o}function Xd(e,n={x:0,y:0}){const{modelId:o,memo:i,geo:a,style:r,connections:l,ownedConnections:s,...c}=e;let d=l;if(!d&&Array.isArray(s)){const u=Tb(o,s);u.length&&(d=u)}return{modelId:o,memo:i,geo:{location:{x:a.location.x+n.x,y:a.location.y+n.y},size:a.size},style:r,connections:d,legacyRaw:Object.keys(c).length?c:void 0}}function Zd(e,n,o){if(!(o!=null&&o.length))return;const i=new Map(e.map(l=>[l.modelId,l])),a=new Map(n.map(l=>[l.modelId,l])),r=(l,s)=>{var c;return!!s&&!!((c=i.get(l??""))!=null&&c.attributes.some(d=>d.modelId===s))};for(const l of o){const s=a.get(l.associationRef);s&&(l.sourceColumnRef&&!r(s.end1.entityRef,l.sourceColumnRef)&&(l.sourceColumnRef=void 0),l.targetColumnRef&&!r(s.end2.entityRef,l.targetColumnRef)&&(l.targetColumnRef=void 0))}}function Mb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.end1.navigable!==!0)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=i.end1.attributeRef?a.attributes.find(h=>h.modelId===i.end1.attributeRef):void 0;if((l==null?void 0:l.attrType)==="RELATION_REF")continue;const s=`nav:${i.modelId}`,c=a.attributes.find(h=>h.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=zi(i.end2.multiplicity),u=Ui(r.name,d),m=co(u,new Set(a.attributes.map(h=>h.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((h,p)=>Math.max(h,p.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function Vb(e,n){const o=new Map(e.map(i=>[i.modelId,i]));for(const i of n){if(i.identifying===!0||i.end1.entityRef===i.end2.entityRef)continue;const a=o.get(i.end1.entityRef),r=o.get(i.end2.entityRef);if(!a||!r||a.stereotype==="JPA_EMBEDDABLE"||r.stereotype==="JPA_EMBEDDABLE")continue;const l=r.attributes.find(s=>s.modelId===i.end2.attributeRef);l&&l.attrType.startsWith("RELATION")&&l.dbAttrs.length>0&&l.identifier===!0&&(i.identifying=!0)}}function Qd(e,n){var i;const o=new Map(e.map(a=>[a.modelId,a]));for(const a of n){const r=o.get(a.end2.entityRef);if(!r)continue;const l=o.get(a.end1.entityRef);if((l==null?void 0:l.stereotype)==="JPA_EMBEDDABLE")continue;const s=a.end1.entityRef===a.end2.entityRef,c=a.identifying===!0||!s&&!Bs(a.end1.multiplicity);for(const d of r.attributes)!d.attrType.startsWith("RELATION")||d.dbAttrs.length===0||!(((i=d.derivedFrom)==null?void 0:i.associationRef)===a.modelId||!d.derivedFrom&&d.modelId===a.end2.attributeRef)||(d.notNull=c)}}function eu(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?Bb(n):Db(n)}function Bb(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:h,...p}=m;return h!=null&&(o[m.modelId]=h),p},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);Mb(a,r),Vb(a,r),Qd(a,r);const{version:s,...c}=e.layout;Zd(a,r,c.associationLayouts);const d={logical:{modelId:e.logical.modelId??n,packageName:e.logical.packageName,entities:a,associations:r,groups:l},layout:{...c,diagramId:c.diagramId??n,logicalModelRef:c.logicalModelRef??n}},u={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion,opWriteEnabled:e.opWriteEnabled,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function Db(e){var g,k;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(_,N)=>{o.push(vb(_));const I=xb(_);I.geo={location:{x:I.geo.location.x+N.x,y:I.geo.location.y+N.y},size:I.geo.size},i.push(I);for(const A of _.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const _ of e.entities??[])d(_,u);const m=[];for(const _ of e.groups??[]){const N=_.entities??[];l.push({modelId:_.modelId,name:_.name,description:_.description,packageName:_.packageName,excludeDDLGeneration:_.excludeDDLGeneration??!1,memberEntityRefs:N.map(A=>A.modelId)});const I=((g=_.geo)==null?void 0:g.location)??u;if(_.geo){const A=(_.notes??[]).map(x=>x.modelId);s.push({groupRef:_.modelId,geo:_.geo,style:_.style,locked:_.locked,memberNoteRefs:A.length?A:void 0})}for(const A of N)d(A,I);for(const A of _.notes??[])m.push(Xd(A,I))}const h=new Map(o.map(_=>[_.modelId,_])),p=new Map,y=new Map;for(const _ of o)for(const N of _.attributes)for(const I of N.dbAttrs)p.set(I.modelId,N.modelId),y.set(I.modelId,I);for(const _ of c)for(const N of[_.end1,_.end2]){const I=N.attribute;if(I&&(((k=I.dbAttrs)==null?void 0:k.length)??0)>0)for(const A of I.dbAttrs)A.modelId&&p.set(A.modelId,I.modelId)}for(const _ of c){const N=qd(_.end1.attribute),I=qd(_.end2.attribute),A=Wd(_.end1)||Wd(_.end2),{assoc:x,layout:$}=N!==I||A?Ab(_,h,y):Rb(_,h,p);a.push(x),r.push($)}Zd(o,a,r),Cc(o),Qd(o,a);const b={logical:{modelId:n,packageName:e.packageName,entities:o,associations:a,groups:l},layout:{diagramId:n,logicalModelRef:n,canvasSize:e.size,entityLayouts:i,associationLayouts:r,groupLayouts:s,notes:[...(e.notes??[]).map(_=>Xd(_)),...m]}},f={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:b,meta:f}}function tu(e){return{modelId:e.modelId,physicalName:e.physicalName,logicalName:e.logicalName,dataType:e.dataType,length:e.length,scale:e.scale,unique:e.unique,autoIncrement:e.autoIncrement,updatable:e.updatable,insertable:e.insertable,sharedColumnRef:e.sharedColumnRef,multiValue:e.multiValue,multiValueSeparator:e.multiValueSeparator,sequenceName:e.sequenceName}}function Lb(e,n){return{modelId:e.modelId,name:e.name,type:e.type,customType:e.customType,attrType:e.attrType,identifier:e.identifier,notNull:e.notNull,transient_:e.transient,naturalId:e.naturalId,naturalIdMutable:e.naturalIdMutable,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,defaultValue:e.defaultValue,personalInfoAttributeType:e.personalInfoAttributeType,order:e.order,dbAttrs:e.dbAttrs.map(tu),style:n}}function Ob(e,n){var o;return{...e.legacyRaw,modelId:e.modelId,name:e.name,visibility:e.visibility,sourceCode:e.sourceCode,description:(o=e.description)==null?void 0:o.ko,order:e.order,personalInfoAttributeType:e.personalInfoAttributeType,style:n}}function Pb(e){return{modelId:e.modelId,name:e.name,unique:e.unique,description:e.description,parameters:e.parameters,indexColumns:e.columns.map(n=>({targetColumn:{refId:n.columnRef},descending:n.descending}))}}function vn(e,n){return{endModel:{refId:e.entityRef},multiplicity:e.multiplicity,navigable:e.navigable,composition:e.composition,jpaAttribute:e.jpa,attribute:n??(e.attributeRef?{modelId:e.attributeRef}:void 0)}}function zb(e,n){const o=n==null?void 0:n.attributes.find(i=>{var a;return i.modelId===((a=e.derivedFrom)==null?void 0:a.sourceAttributeRef)});return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_REF",identifier:e.identifier,notNull:e.notNull,transient_:e.transient,description:e.description,attributeGroup:e.attributeGroup,groupCode:e.groupCode,order:e.order,dbAttrs:e.dbAttrs.map((i,a)=>{var r;return{...tu(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function Fb(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function nu(e,n){const o=l=>{if(!l.attributeRef)return;const s=n.logical.entities.find(c=>c.modelId===l.entityRef);return s==null?void 0:s.attributes.find(c=>c.modelId===l.attributeRef)},i=o(e.end1),a=o(e.end2),r=l=>(l==null?void 0:l.attrType)==="RELATION_OWN"?l:void 0;return(i==null?void 0:i.attrType)==="RELATION_REF"?{navEnd:e.end1,fkEnd:e.end2,navAttr:i,fk:r(a)}:(a==null?void 0:a.attrType)==="RELATION_REF"?{navEnd:e.end2,fkEnd:e.end1,navAttr:a,fk:r(i)}:null}function Ub(e){const n=new Set;for(const o of e.logical.associations){const i=nu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function Hb(e){const n=new Set;for(const o of e.logical.entities)for(const i of o.attributes)i.embedded&&n.add(i.modelId);return n}function jb(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function Kb(e,n){const o=(i,a)=>i===a?void 0:i;return{modelId:e.modelId,targetModelId:n==null?void 0:n.modelId,physicalName:e.physicalName===((n==null?void 0:n.physicalName)??"")?"":e.physicalName,logicalName:jb(e.logicalName,n==null?void 0:n.logicalName)?void 0:e.logicalName,dataType:e.dataType===((n==null?void 0:n.dataType)??"")?"":e.dataType,length:o(e.length,n==null?void 0:n.length),scale:o(e.scale,n==null?void 0:n.scale),unique:o(e.unique,n==null?void 0:n.unique),autoIncrement:o(e.autoIncrement,n==null?void 0:n.autoIncrement),updatable:o(e.updatable,n==null?void 0:n.updatable),insertable:o(e.insertable,n==null?void 0:n.insertable)}}function Gb(e,n,o){let i;for(const m of n.logical.entities){const h=m.attributes.find(p=>{var y;return((y=p.embedded)==null?void 0:y.associationRef)===e.modelId});if(h){i=h;break}}if(!i)return;const a=i.embedded.embeddableRef,r=n.logical.entities.find(m=>m.modelId===a);if(!r)return;const l=r.attributes.flatMap(m=>m.dbAttrs),s={modelId:i.modelId,name:i.name,type:i.type,attrType:i.attrType,identifier:i.identifier,notNull:i.notNull,transient_:i.transient,description:i.description,attributeGroup:i.attributeGroup,groupCode:i.groupCode,order:i.order,dbAttrs:i.dbAttrs.map((m,h)=>Kb(m,l[h]))},c=e.end1.entityRef===a,d=c?e.end2:e.end1,u=d.attributeRef?{modelId:d.attributeRef,attrType:"EMBED_REF",dbAttrs:[]}:void 0;return{...o,end1:vn(e.end1,c?s:u),end2:vn(e.end2,c?u:s)}}function Yb(e,n,o){const i={modelId:e.modelId,description:e.description,locations:(o==null?void 0:o.waypoints)??[],style:o==null?void 0:o.style};if(e.end1.legacyEmbedRaw||e.end2.legacyEmbedRaw)return{...i,end1:vn(e.end1,e.end1.legacyEmbedRaw),end2:vn(e.end2,e.end2.legacyEmbedRaw)};const a=Gb(e,n,i);if(a)return a;const r=nu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?zb(r.fk,l):void 0,c=Fb(r.navAttr);return{...i,end1:vn(e.end1,r.navEnd===e.end1?s:c),end2:vn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:vn(e.end1),end2:vn(e.end2)}}function ou(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(h=>h.entityRef===e.modelId),l=n.logical.associations.filter(h=>h.end1.entityRef===e.modelId),s=h=>n.layout.associationLayouts.find(p=>p.associationRef===h),c=(r==null?void 0:r.geo)??{...Kd},d={location:{x:c.location.x-a.x,y:c.location.y-a.y},size:c.size};return{modelId:e.modelId,name:e.name,stereotype:e.stereotype,packageName:e.packageName,superClass:e.superClass,schema:e.schema,description:e.description,abstractClass:e.abstractClass,hasPersonalInfo:e.hasPersonalInfo,declarationOfInterfaces:e.declarationOfInterfaces,attributes:e.attributes.filter(h=>!o.has(h.modelId)&&!i.has(h.modelId)).map(h=>{var p;return Lb(h,(p=r==null?void 0:r.attributeStyles)==null?void 0:p[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var p;return Ob(h,(p=r==null?void 0:r.operationStyles)==null?void 0:p[h.modelId])}),ownedAssociations:l.map(h=>Yb(h,n,s(h.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(Pb),jpaAttrs:e.jpaAttrs,dbAttrs:e.table?{physicalName:e.table.physicalName,logicalName:e.table.logicalName}:void 0,geo:d,style:r==null?void 0:r.style,collapsed:r==null?void 0:r.collapsed,locked:r==null?void 0:r.locked}}function qb(e,n,o,i){const a=n.layout.groupLayouts.find(c=>c.groupRef===e.modelId),r=e.memberEntityRefs.map(c=>n.logical.entities.find(d=>d.modelId===c)).filter(c=>!!c),l=(a==null?void 0:a.geo.location)??{x:0,y:0},s=((a==null?void 0:a.memberNoteRefs)??[]).map(c=>n.layout.notes.find(d=>d.modelId===c)).filter(c=>!!c).map(c=>iu(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>ou(c,n,o,i,l)),notes:s.length?s:void 0,geo:a==null?void 0:a.geo,style:a==null?void 0:a.style,locked:a==null?void 0:a.locked}}function iu(e,n={x:0,y:0}){return{...e.legacyRaw,modelId:e.modelId,memo:e.memo,geo:{location:{x:e.geo.location.x-n.x,y:e.geo.location.y-n.y},size:e.geo.size},style:e.style,connections:e.connections}}function Wb(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=Ub(e),r=Hb(e),l=new Set(e.layout.groupLayouts.flatMap(s=>s.memberNoteRefs??[]));return{id:n.id,diagramVersion:n.diagramVersion,version:n.version,size:n.size??e.layout.canvasSize,packageName:n.packageName??e.logical.packageName,entities:i.map(s=>ou(s,e,a,r)),groups:e.logical.groups.map(s=>qb(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>iu(s))}}function Jb(e,n={}){var a,r,l;const o=((a=n.revSeed)==null?void 0:a.revs)??{},i=s=>({...s,rev:o[s.modelId]??0});return{id:n.id,schemaVersion:2,opWriteEnabled:n.opWriteEnabled,version:n.version,diagramVersion:n.diagramVersion,packageName:n.packageName,size:n.size,logical:{version:((r=n.revSeed)==null?void 0:r.logicalVersion)??0,modelId:e.logical.modelId,packageName:e.logical.packageName,entities:e.logical.entities.map(i),associations:e.logical.associations.map(i),groups:e.logical.groups.map(i)},layout:{...e.layout,version:((l=n.revSeed)==null?void 0:l.layoutVersion)??0}}}const Xb=["notNull"];function Zb(e){var u;const n=()=>({navAdds:0,navRefPatches:0,identifyingPatches:0,attributeFieldPatches:0,attributeFieldsByName:{}});if((e.schemaVersion??1)<2||!("logical"in e))return{ops:[],revs:{},summary:n()};const o=e,{state:i,meta:a}=eu(e),r=((u=a.revSeed)==null?void 0:u.revs)??{},l=[],s=n(),c=new Map(o.logical.entities.map(m=>[m.modelId,new Map(m.attributes.map(h=>[h.modelId,h]))]));for(const m of i.logical.entities){const h=c.get(m.modelId);if(h)for(const p of m.attributes){const y=h.get(p.modelId);if(!y){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:p}),s.navAdds++;continue}const b={};for(const f of Xb)p[f]===!0!=(y[f]===!0)&&(b[f]=p[f],s.attributeFieldsByName[f]=(s.attributeFieldsByName[f]??0)+1);Object.keys(b).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:p.modelId,patch:b}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const h=d.get(m.modelId);h&&(m.end1.attributeRef&&m.end1.attributeRef!==h.end1.attributeRef&&(l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,end:"end1",patch:{attributeRef:m.end1.attributeRef}}),s.navRefPatches++),m.identifying===!0&&h.identifying!==!0&&(l.push({kind:"association.update",casUnit:"logical",containerRef:m.modelId,associationRef:m.modelId,patch:{identifying:!0}}),s.identifyingPatches++))}return{ops:l,revs:r,summary:s}}function ei(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function an(e){return typeof e=="function"?e():t.unref(e)}const Qb=typeof window<"u"&&typeof document<"u",e_=e=>typeof e<"u",t_=Object.prototype.toString,n_=e=>t_.call(e)==="[object Object]",o_=()=>{};function i_(e,n){function o(...i){return new Promise((a,r)=>{Promise.resolve(e(()=>n.apply(this,i),{fn:n,thisArg:this,args:i})).then(a).catch(r)})}return o}const au=e=>e();function a_(e=au){const n=t.ref(!0);function o(){n.value=!1}function i(){n.value=!0}const a=(...r)=>{n.value&&e(...r)};return{isActive:t.readonly(n),pause:o,resume:i,eventFilter:a}}function ru(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function r_(e,n,o={}){const{eventFilter:i=au,...a}=o;return t.watch(e,i_(i,n),a)}function wo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=a_(i);return{stop:r_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function l_(e,n={}){if(!t.isRef(e))return t.toRefs(e);const o=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)o[i]=t.customRef(()=>({get(){return e.value[i]},set(a){var r;if((r=an(n.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[i]=a,e.value=s}else{const s={...e.value,[i]:a};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[i]=a}}));return o}function rl(e,n=!1){function o(m,{flush:h="sync",deep:p=!1,timeout:y,throwOnTimeout:b}={}){let f=null;const k=[new Promise(_=>{f=t.watch(e,N=>{m(N)!==n&&(f==null||f(),_(N))},{flush:h,deep:p,immediate:!0})})];return y!=null&&k.push(ru(y,b).then(()=>an(e)).finally(()=>f==null?void 0:f())),Promise.race(k)}function i(m,h){if(!t.isRef(m))return o(N=>N===m,h);const{flush:p="sync",deep:y=!1,timeout:b,throwOnTimeout:f}=h??{};let g=null;const _=[new Promise(N=>{g=t.watch([e,m],([I,A])=>{n!==(I===A)&&(g==null||g(),N(I))},{flush:p,deep:y,immediate:!0})})];return b!=null&&_.push(ru(b,f).then(()=>an(e)).finally(()=>(g==null||g(),an(e)))),Promise.race(_)}function a(m){return o(h=>!!h,m)}function r(m){return i(null,m)}function l(m){return i(void 0,m)}function s(m){return o(Number.isNaN,m)}function c(m,h){return o(p=>{const y=Array.from(p);return y.includes(m)||y.includes(an(m))},h)}function d(m){return u(1,m)}function u(m=1,h){let p=-1;return o(()=>(p+=1,p>=m),h)}return Array.isArray(an(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return rl(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return rl(e,!n)}}}function ll(e){return rl(e)}function s_(e){var n;const o=an(e);return(n=o==null?void 0:o.$el)!=null?n:o}const lu=Qb?window:void 0;function su(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=lu):[n,o,i,a]=e,!n)return o_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,h,p)=>(u.addEventListener(m,h,p),()=>u.removeEventListener(m,h,p)),c=t.watch(()=>[s_(n),an(a)],([u,m])=>{if(l(),!u)return;const h=n_(m)?{...m}:m;r.push(...o.flatMap(p=>i.map(y=>s(u,p,y,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return ei(d),d}function c_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function cu(...e){let n,o,i={};e.length===3?(n=e[0],o=e[1],i=e[2]):e.length===2?typeof e[1]=="object"?(n=!0,o=e[0],i=e[1]):(n=e[0],o=e[1]):(n=!0,o=e[0]);const{target:a=lu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=c_(n);return su(a,r,u=>{u.repeat&&an(s)||c(u)&&o(u)},l)}function d_(e){return JSON.parse(JSON.stringify(e))}function sl(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:h}=i,p=t.getCurrentInstance(),y=o||(p==null?void 0:p.emit)||((a=p==null?void 0:p.$emit)==null?void 0:a.bind(p))||((l=(r=p==null?void 0:p.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(p==null?void 0:p.proxy));let b=d;n||(n="modelValue"),b=b||`update:${n.toString()}`;const f=_=>s?typeof s=="function"?s(_):d_(_):_,g=()=>e_(e[n])?f(e[n]):m,k=_=>{h?h(_)&&y(b,_):y(b,_)};if(c){const _=g(),N=t.ref(_);let I=!1;return t.watch(()=>e[n],A=>{I||(I=!0,N.value=f(A),t.nextTick(()=>I=!1))}),t.watch(N,A=>{!I&&(A!==e[n]||u)&&k(A)},{deep:u}),N}else return t.computed({get(){return g()},set(_){k(_)}})}var u_={value:()=>{}};function ua(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new ma(o)}function ma(e){this._=e}function m_(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}ma.prototype=ua.prototype={constructor:ma,on:function(e,n){var o=this._,i=m_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=f_(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=du(o[a],e.name,n);else if(n==null)for(a in o)o[a]=du(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new ma(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function f_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function du(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=u_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var cl="http://www.w3.org/1999/xhtml";const uu={svg:"http://www.w3.org/2000/svg",xhtml:cl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function fa(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),uu.hasOwnProperty(n)?{space:uu[n],local:e}:e}function p_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===cl&&n.documentElement.namespaceURI===cl?n.createElement(e):n.createElementNS(o,e)}}function h_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mu(e){var n=fa(e);return(n.local?h_:p_)(n)}function y_(){}function dl(e){return e==null?y_:function(){return this.querySelector(e)}}function g_(e){typeof e!="function"&&(e=dl(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new St(i,this._parents)}function b_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function __(){return[]}function fu(e){return e==null?__:function(){return this.querySelectorAll(e)}}function k_(e){return function(){return b_(e.apply(this,arguments))}}function E_(e){typeof e=="function"?e=k_(e):e=fu(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new St(i,a)}function pu(e){return function(){return this.matches(e)}}function hu(e){return function(n){return n.matches(e)}}var N_=Array.prototype.find;function w_(e){return function(){return N_.call(this.children,e)}}function I_(){return this.firstElementChild}function v_(e){return this.select(e==null?I_:w_(typeof e=="function"?e:hu(e)))}var x_=Array.prototype.filter;function C_(){return Array.from(this.children)}function S_(e){return function(){return x_.call(this.children,e)}}function R_(e){return this.selectAll(e==null?C_:S_(typeof e=="function"?e:hu(e)))}function $_(e){typeof e!="function"&&(e=pu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new St(i,this._parents)}function yu(e){return new Array(e.length)}function A_(){return new St(this._enter||this._groups.map(yu),this._parents)}function pa(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}pa.prototype={constructor:pa,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function T_(e){return function(){return e}}function M_(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new pa(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function V_(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),p;for(s=0;s<u;++s)(c=n[s])&&(h[s]=p=l.call(c,c.__data__,s,n)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new pa(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function B_(e){return e.__data__}function D_(e,n){if(!arguments.length)return Array.from(this,B_);var o=n?V_:M_,i=this._parents,a=this._groups;typeof e!="function"&&(e=T_(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],h=m.length,p=L_(e.call(u,u&&u.__data__,d,i)),y=p.length,b=s[d]=new Array(y),f=l[d]=new Array(y),g=c[d]=new Array(h);o(u,m,b,f,g,p,n);for(var k=0,_=0,N,I;k<y;++k)if(N=b[k]){for(k>=_&&(_=k+1);!(I=f[_])&&++_<y;);N._next=I||null}}return l=new St(l,i),l._enter=s,l._exit=c,l}function L_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function O_(){return new St(this._exit||this._groups.map(yu),this._parents)}function P_(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function z_(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,h=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(h[y]=p);for(;c<a;++c)s[c]=o[c];return new St(s,this._parents)}function F_(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function U_(e){e||(e=H_);function n(m,h){return m&&h?e(m.__data__,h.__data__):!m-!h}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new St(a,this._parents).order()}function H_(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function j_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function K_(){return Array.from(this)}function G_(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function Y_(){let e=0;for(const n of this)++e;return e}function q_(){return!this.node()}function W_(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function J_(e){return function(){this.removeAttribute(e)}}function X_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Z_(e,n){return function(){this.setAttribute(e,n)}}function Q_(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function ek(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function tk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function nk(e,n){var o=fa(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?X_:J_:typeof n=="function"?o.local?tk:ek:o.local?Q_:Z_)(o,n))}function gu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ok(e){return function(){this.style.removeProperty(e)}}function ik(e,n,o){return function(){this.style.setProperty(e,n,o)}}function ak(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function rk(e,n,o){return arguments.length>1?this.each((n==null?ok:typeof n=="function"?ak:ik)(e,n,o??"")):Io(this.node(),e)}function Io(e,n){return e.style.getPropertyValue(n)||gu(e).getComputedStyle(e,null).getPropertyValue(n)}function lk(e){return function(){delete this[e]}}function sk(e,n){return function(){this[e]=n}}function ck(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function dk(e,n){return arguments.length>1?this.each((n==null?lk:typeof n=="function"?ck:sk)(e,n)):this.node()[e]}function bu(e){return e.trim().split(/^|\s+/)}function ul(e){return e.classList||new _u(e)}function _u(e){this._node=e,this._names=bu(e.getAttribute("class")||"")}_u.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ku(e,n){for(var o=ul(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Eu(e,n){for(var o=ul(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function uk(e){return function(){ku(this,e)}}function mk(e){return function(){Eu(this,e)}}function fk(e,n){return function(){(n.apply(this,arguments)?ku:Eu)(this,e)}}function pk(e,n){var o=bu(e+"");if(arguments.length<2){for(var i=ul(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?fk:n?uk:mk)(o,n))}function hk(){this.textContent=""}function yk(e){return function(){this.textContent=e}}function gk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function bk(e){return arguments.length?this.each(e==null?hk:(typeof e=="function"?gk:yk)(e)):this.node().textContent}function _k(){this.innerHTML=""}function kk(e){return function(){this.innerHTML=e}}function Ek(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Nk(e){return arguments.length?this.each(e==null?_k:(typeof e=="function"?Ek:kk)(e)):this.node().innerHTML}function wk(){this.nextSibling&&this.parentNode.appendChild(this)}function Ik(){return this.each(wk)}function vk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xk(){return this.each(vk)}function Ck(e){var n=typeof e=="function"?e:mu(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Sk(){return null}function Rk(e,n){var o=typeof e=="function"?e:mu(e),i=n==null?Sk:typeof n=="function"?n:dl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function $k(){var e=this.parentNode;e&&e.removeChild(this)}function Ak(){return this.each($k)}function Tk(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Mk(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Vk(e){return this.select(e?Mk:Tk)}function Bk(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Dk(e){return function(n){e.call(this,n,this.__data__)}}function Lk(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function Ok(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function Pk(e,n,o){return function(){var i=this.__on,a,r=Dk(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function zk(e,n,o){var i=Lk(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?Pk:Ok,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Nu(e,n,o){var i=gu(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function Fk(e,n){return function(){return Nu(this,e,n)}}function Uk(e,n){return function(){return Nu(this,e,n.apply(this,arguments))}}function Hk(e,n){return this.each((typeof n=="function"?Uk:Fk)(e,n))}function*jk(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var wu=[null];function St(e,n){this._groups=e,this._parents=n}function ti(){return new St([[document.documentElement]],wu)}function Kk(){return this}St.prototype=ti.prototype={constructor:St,select:g_,selectAll:E_,selectChild:v_,selectChildren:R_,filter:$_,data:D_,enter:A_,exit:O_,join:P_,merge:z_,selection:Kk,order:F_,sort:U_,call:j_,nodes:K_,node:G_,size:Y_,empty:q_,each:W_,attr:nk,style:rk,property:dk,classed:pk,text:bk,html:Nk,raise:Ik,lower:xk,append:Ck,insert:Rk,remove:Ak,clone:Vk,datum:Bk,on:zk,dispatch:Hk,[Symbol.iterator]:jk};function Vt(e){return typeof e=="string"?new St([[document.querySelector(e)]],[document.documentElement]):new St([[e]],wu)}function Gk(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Kt(e,n){if(e=Gk(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const Yk={passive:!1},ni={capture:!0,passive:!1};function ml(e){e.stopImmediatePropagation()}function vo(e){e.preventDefault(),e.stopImmediatePropagation()}function Iu(e){var n=e.document.documentElement,o=Vt(e).on("dragstart.drag",vo,ni);"onselectstart"in n?o.on("selectstart.drag",vo,ni):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function vu(e,n){var o=e.document.documentElement,i=Vt(e).on("dragstart.drag",null);n&&(i.on("click.drag",vo,ni),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const ha=e=>()=>e;function fl(e,{sourceEvent:n,subject:o,target:i,identifier:a,active:r,x:l,y:s,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}fl.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function qk(e){return!e.ctrlKey&&!e.button}function Wk(){return this.parentNode}function Jk(e,n){return n??{x:e.x,y:e.y}}function Xk(){return navigator.maxTouchPoints||"ontouchstart"in this}function Zk(){var e=qk,n=Wk,o=Jk,i=Xk,a={},r=ua("start","drag","end"),l=0,s,c,d,u,m=0;function h(N){N.on("mousedown.drag",p).filter(i).on("touchstart.drag",f).on("touchmove.drag",g,Yk).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(N,I){if(!(u||!e.call(this,N,I))){var A=_(this,n.call(this,N,I),N,I,"mouse");A&&(Vt(N.view).on("mousemove.drag",y,ni).on("mouseup.drag",b,ni),Iu(N.view),ml(N),d=!1,s=N.clientX,c=N.clientY,A("start",N))}}function y(N){if(vo(N),!d){var I=N.clientX-s,A=N.clientY-c;d=I*I+A*A>m}a.mouse("drag",N)}function b(N){Vt(N.view).on("mousemove.drag mouseup.drag",null),vu(N.view,d),vo(N),a.mouse("end",N)}function f(N,I){if(e.call(this,N,I)){var A=N.changedTouches,x=n.call(this,N,I),$=A.length,T,V;for(T=0;T<$;++T)(V=_(this,x,N,I,A[T].identifier,A[T]))&&(ml(N),V("start",N,A[T]))}}function g(N){var I=N.changedTouches,A=I.length,x,$;for(x=0;x<A;++x)($=a[I[x].identifier])&&(vo(N),$("drag",N,I[x]))}function k(N){var I=N.changedTouches,A=I.length,x,$;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),x=0;x<A;++x)($=a[I[x].identifier])&&(ml(N),$("end",N,I[x]))}function _(N,I,A,x,$,T){var V=r.copy(),R=Kt(T||A,I),C,M,E;if((E=o.call(N,new fl("beforestart",{sourceEvent:A,target:h,identifier:$,active:l,x:R[0],y:R[1],dx:0,dy:0,dispatch:V}),x))!=null)return C=E.x-R[0]||0,M=E.y-R[1]||0,function w(S,B,z){var K=R,J;switch(S){case"start":a[$]=w,J=l++;break;case"end":delete a[$],--l;case"drag":R=Kt(z||B,I),J=l;break}V.call(S,N,new fl(S,{sourceEvent:B,subject:E,target:h,identifier:$,active:J,x:R[0]+C,y:R[1]+M,dx:R[0]-K[0],dy:R[1]-K[1],dispatch:V}),x)}}return h.filter=function(N){return arguments.length?(e=typeof N=="function"?N:ha(!!N),h):e},h.container=function(N){return arguments.length?(n=typeof N=="function"?N:ha(N),h):n},h.subject=function(N){return arguments.length?(o=typeof N=="function"?N:ha(N),h):o},h.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:ha(!!N),h):i},h.on=function(){var N=r.on.apply(r,arguments);return N===r?h:N},h.clickDistance=function(N){return arguments.length?(m=(N=+N)*N,h):Math.sqrt(m)},h}function pl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function xu(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function oi(){}var ii=.7,ya=1/ii,xo="\\s*([+-]?\\d+)\\s*",ai="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Gt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qk=/^#([0-9a-f]{3,8})$/,eE=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),tE=new RegExp(`^rgb\\(${Gt},${Gt},${Gt}\\)$`),nE=new RegExp(`^rgba\\(${xo},${xo},${xo},${ai}\\)$`),oE=new RegExp(`^rgba\\(${Gt},${Gt},${Gt},${ai}\\)$`),iE=new RegExp(`^hsl\\(${ai},${Gt},${Gt}\\)$`),aE=new RegExp(`^hsla\\(${ai},${Gt},${Gt},${ai}\\)$`),Cu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};pl(oi,Un,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Su,formatHex:Su,formatHex8:rE,formatHsl:lE,formatRgb:Ru,toString:Ru});function Su(){return this.rgb().formatHex()}function rE(){return this.rgb().formatHex8()}function lE(){return Vu(this).formatHsl()}function Ru(){return this.rgb().formatRgb()}function Un(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=Qk.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?$u(n):o===3?new It(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ga(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ga(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=eE.exec(e))?new It(n[1],n[2],n[3],1):(n=tE.exec(e))?new It(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=nE.exec(e))?ga(n[1],n[2],n[3],n[4]):(n=oE.exec(e))?ga(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=iE.exec(e))?Mu(n[1],n[2]/100,n[3]/100,1):(n=aE.exec(e))?Mu(n[1],n[2]/100,n[3]/100,n[4]):Cu.hasOwnProperty(e)?$u(Cu[e]):e==="transparent"?new It(NaN,NaN,NaN,0):null}function $u(e){return new It(e>>16&255,e>>8&255,e&255,1)}function ga(e,n,o,i){return i<=0&&(e=n=o=NaN),new It(e,n,o,i)}function sE(e){return e instanceof oi||(e=Un(e)),e?(e=e.rgb(),new It(e.r,e.g,e.b,e.opacity)):new It}function hl(e,n,o,i){return arguments.length===1?sE(e):new It(e,n,o,i??1)}function It(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}pl(It,hl,xu(oi,{brighter(e){return e=e==null?ya:Math.pow(ya,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ii:Math.pow(ii,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new It(Hn(this.r),Hn(this.g),Hn(this.b),ba(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Au,formatHex:Au,formatHex8:cE,formatRgb:Tu,toString:Tu}));function Au(){return`#${jn(this.r)}${jn(this.g)}${jn(this.b)}`}function cE(){return`#${jn(this.r)}${jn(this.g)}${jn(this.b)}${jn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Tu(){const e=ba(this.opacity);return`${e===1?"rgb(":"rgba("}${Hn(this.r)}, ${Hn(this.g)}, ${Hn(this.b)}${e===1?")":`, ${e})`}`}function ba(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Hn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jn(e){return e=Hn(e),(e<16?"0":"")+e.toString(16)}function Mu(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Bt(e,n,o,i)}function Vu(e){if(e instanceof Bt)return new Bt(e.h,e.s,e.l,e.opacity);if(e instanceof oi||(e=Un(e)),!e)return new Bt;if(e instanceof Bt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Bt(l,s,c,e.opacity)}function dE(e,n,o,i){return arguments.length===1?Vu(e):new Bt(e,n,o,i??1)}function Bt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}pl(Bt,dE,xu(oi,{brighter(e){return e=e==null?ya:Math.pow(ya,e),new Bt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ii:Math.pow(ii,e),new Bt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new It(yl(e>=240?e-240:e+120,a,i),yl(e,a,i),yl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Bt(Bu(this.h),_a(this.s),_a(this.l),ba(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ba(this.opacity);return`${e===1?"hsl(":"hsla("}${Bu(this.h)}, ${_a(this.s)*100}%, ${_a(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Bu(e){return e=(e||0)%360,e<0?e+360:e}function _a(e){return Math.max(0,Math.min(1,e||0))}function yl(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const gl=e=>()=>e;function uE(e,n){return function(o){return e+o*n}}function mE(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function fE(e){return(e=+e)==1?Du:function(n,o){return o-n?mE(n,o,e):gl(isNaN(n)?o:n)}}function Du(e,n){var o=n-e;return o?uE(e,o):gl(isNaN(e)?n:e)}const ka=(function e(n){var o=fE(n);function i(a,r){var l=o((a=hl(a)).r,(r=hl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Du(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function pE(e,n){n||(n=[]);var o=e?Math.min(n.length,e.length):0,i=n.slice(),a;return function(r){for(a=0;a<o;++a)i[a]=e[a]*(1-r)+n[a]*r;return i}}function hE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function yE(e,n){var o=n?n.length:0,i=e?Math.min(o,e.length):0,a=new Array(i),r=new Array(o),l;for(l=0;l<i;++l)a[l]=ri(e[l],n[l]);for(;l<o;++l)r[l]=n[l];return function(s){for(l=0;l<i;++l)r[l]=a[l](s);return r}}function gE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function Yt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function bE(e,n){var o={},i={},a;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(a in n)a in e?o[a]=ri(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var bl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_l=new RegExp(bl.source,"g");function _E(e){return function(){return e}}function kE(e){return function(n){return e(n)+""}}function Lu(e,n){var o=bl.lastIndex=_l.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=bl.exec(e))&&(a=_l.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Yt(i,a)})),o=_l.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?kE(c[0].x):_E(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}function ri(e,n){var o=typeof n,i;return n==null||o==="boolean"?gl(n):(o==="number"?Yt:o==="string"?(i=Un(n))?(n=i,ka):Lu:n instanceof Un?ka:n instanceof Date?gE:hE(n)?pE:Array.isArray(n)?yE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?bE:Yt)(e,n)}var Ou=180/Math.PI,kl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Pu(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*Ou,skewX:Math.atan(c)*Ou,scaleX:l,scaleY:s}}var Ea;function EE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?kl:Pu(n.a,n.b,n.c,n.d,n.e,n.f)}function NE(e){return e==null||(Ea||(Ea=document.createElementNS("http://www.w3.org/2000/svg","g")),Ea.setAttribute("transform",e),!(e=Ea.transform.baseVal.consolidate()))?kl:(e=e.matrix,Pu(e.a,e.b,e.c,e.d,e.e,e.f))}function zu(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push("translate(",null,n,null,o);y.push({i:b-4,x:Yt(d,m)},{i:b-2,x:Yt(u,h)})}else(m||h)&&p.push("translate("+m+n+h+o)}function l(d,u,m,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Yt(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,h){d!==u?h.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Yt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push(a(p)+"scale(",null,",",null,")");y.push({i:b-4,x:Yt(d,m)},{i:b-2,x:Yt(u,h)})}else(m!==1||h!==1)&&p.push(a(p)+"scale("+m+","+h+")")}return function(d,u){var m=[],h=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,h),l(d.rotate,u.rotate,m,h),s(d.skewX,u.skewX,m,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,h),d=u=null,function(p){for(var y=-1,b=h.length,f;++y<b;)m[(f=h[y]).i]=f.x(p);return m.join("")}}}var wE=zu(EE,"px, ","px)","deg)"),IE=zu(NE,", ",")",")"),vE=1e-12;function Fu(e){return((e=Math.exp(e))+1/e)/2}function xE(e){return((e=Math.exp(e))-1/e)/2}function CE(e){return((e=Math.exp(2*e))-1)/(e+1)}const Na=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],h=l[2],p=u-s,y=m-c,b=p*p+y*y,f,g;if(b<vE)g=Math.log(h/d)/n,f=function(x){return[s+x*p,c+x*y,d*Math.exp(n*x*g)]};else{var k=Math.sqrt(b),_=(h*h-d*d+i*b)/(2*d*o*k),N=(h*h-d*d-i*b)/(2*h*o*k),I=Math.log(Math.sqrt(_*_+1)-_),A=Math.log(Math.sqrt(N*N+1)-N);g=(A-I)/n,f=function(x){var $=x*g,T=Fu(I),V=d/(o*k)*(T*CE(n*$+I)-xE(I));return[s+V*p,c+V*y,d*T/Fu(n*$+I)]}}return f.duration=g*1e3*n/Math.SQRT2,f}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Co=0,li=0,si=0,Uu=1e3,wa,ci,Ia=0,Kn=0,va=0,di=typeof performance=="object"&&performance.now?performance:Date,Hu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function El(){return Kn||(Hu(SE),Kn=di.now()+va)}function SE(){Kn=0}function xa(){this._call=this._time=this._next=null}xa.prototype=ju.prototype={constructor:xa,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?El():+o)+(n==null?0:+n),!this._next&&ci!==this&&(ci?ci._next=this:wa=this,ci=this),this._call=e,this._time=o,Nl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Nl())}};function ju(e,n,o){var i=new xa;return i.restart(e,n,o),i}function RE(){El(),++Co;for(var e=wa,n;e;)(n=Kn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Co}function Ku(){Kn=(Ia=di.now())+va,Co=li=0;try{RE()}finally{Co=0,AE(),Kn=0}}function $E(){var e=di.now(),n=e-Ia;n>Uu&&(va-=n,Ia=e)}function AE(){for(var e,n=wa,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:wa=o);ci=e,Nl(i)}function Nl(e){if(!Co){li&&(li=clearTimeout(li));var n=e-Kn;n>24?(e<1/0&&(li=setTimeout(Ku,e-di.now()-va)),si&&(si=clearInterval(si))):(si||(Ia=di.now(),si=setInterval($E,Uu)),Co=1,Hu(Ku))}}function Gu(e,n,o){var i=new xa;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var TE=ua("start","end","cancel","interrupt"),ME=[],Yu=0,qu=1,wl=2,Ca=3,Wu=4,Il=5,Sa=6;function Ra(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;VE(e,o,{name:n,index:i,group:a,on:TE,tween:ME,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Yu})}function vl(e,n){var o=Dt(e,n);if(o.state>Yu)throw new Error("too late; already scheduled");return o}function qt(e,n){var o=Dt(e,n);if(o.state>Ca)throw new Error("too late; already running");return o}function Dt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function VE(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=ju(r,0,o.time);function r(d){o.state=qu,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,p;if(o.state!==qu)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===Ca)return Gu(l);p.state===Wu?(p.state=Sa,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<n&&(p.state=Sa,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Gu(function(){o.state===Ca&&(o.state=Wu,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=wl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===wl){for(o.state=Ca,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=Il,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Il&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Sa,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function $a(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>wl&&i.state<Il,i.state=Sa,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function BE(e){return this.each(function(){$a(this,e)})}function DE(e,n){var o,i;return function(){var a=qt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function LE(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=qt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function OE(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Dt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?DE:LE)(o,e,n))}function xl(e,n,o){var i=e._id;return e.each(function(){var a=qt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Dt(a,i).value[n]}}function Ju(e,n){var o;return(typeof n=="number"?Yt:n instanceof Un?ka:(o=Un(n))?(n=o,ka):Lu)(e,n)}function PE(e){return function(){this.removeAttribute(e)}}function zE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function FE(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function UE(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function HE(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function jE(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function KE(e,n){var o=fa(e),i=o==="transform"?IE:Ju;return this.attrTween(e,typeof n=="function"?(o.local?jE:HE)(o,i,xl(this,"attr."+e,n)):n==null?(o.local?zE:PE)(o):(o.local?UE:FE)(o,i,n))}function GE(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function YE(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function qE(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&YE(e,r)),o}return a._value=n,a}function WE(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&GE(e,r)),o}return a._value=n,a}function JE(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=fa(e);return this.tween(o,(i.local?qE:WE)(i,n))}function XE(e,n){return function(){vl(this,e).delay=+n.apply(this,arguments)}}function ZE(e,n){return n=+n,function(){vl(this,e).delay=n}}function QE(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?XE:ZE)(n,e)):Dt(this.node(),n).delay}function e1(e,n){return function(){qt(this,e).duration=+n.apply(this,arguments)}}function t1(e,n){return n=+n,function(){qt(this,e).duration=n}}function n1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?e1:t1)(n,e)):Dt(this.node(),n).duration}function o1(e,n){if(typeof n!="function")throw new Error;return function(){qt(this,e).ease=n}}function i1(e){var n=this._id;return arguments.length?this.each(o1(n,e)):Dt(this.node(),n).ease}function a1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;qt(this,e).ease=o}}function r1(e){if(typeof e!="function")throw new Error;return this.each(a1(this._id,e))}function l1(e){typeof e!="function"&&(e=pu(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new rn(i,this._parents,this._name,this._id)}function s1(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||d[p])&&(m[p]=h);for(;s<i;++s)l[s]=n[s];return new rn(l,this._parents,this._name,this._id)}function c1(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function d1(e,n,o){var i,a,r=c1(n)?vl:qt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function u1(e,n){var o=this._id;return arguments.length<2?Dt(this.node(),o).on.on(e):this.each(d1(o,e,n))}function m1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function f1(){return this.on("end.remove",m1(this._id))}function p1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=dl(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,h=0;h<c;++h)(u=s[h])&&(m=e.call(u,u.__data__,h,s))&&("__data__"in u&&(m.__data__=u.__data__),d[h]=m,Ra(d[h],n,o,h,d,Dt(u,o)));return new rn(r,this._parents,n,o)}function h1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=fu(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var h=e.call(u,u.__data__,m,c),p,y=Dt(u,o),b=0,f=h.length;b<f;++b)(p=h[b])&&Ra(p,n,o,b,h,y);r.push(h),l.push(u)}return new rn(r,l,n,o)}var y1=ti.prototype.constructor;function g1(){return new y1(this._groups,this._parents)}function b1(e,n){var o,i,a;return function(){var r=Io(this,e),l=(this.style.removeProperty(e),Io(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Xu(e){return function(){this.style.removeProperty(e)}}function _1(e,n,o){var i,a=o+"",r;return function(){var l=Io(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function k1(e,n,o){var i,a,r;return function(){var l=Io(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Io(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function E1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=qt(this,e),d=c.on,u=c.value[r]==null?s||(s=Xu(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function N1(e,n,o){var i=(e+="")=="transform"?wE:Ju;return n==null?this.styleTween(e,b1(e,i)).on("end.style."+e,Xu(e)):typeof n=="function"?this.styleTween(e,k1(e,i,xl(this,"style."+e,n))).each(E1(this._id,e)):this.styleTween(e,_1(e,i,n),o).on("end.style."+e,null)}function w1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function I1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&w1(e,l,o)),i}return r._value=n,r}function v1(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,I1(e,n,o??""))}function x1(e){return function(){this.textContent=e}}function C1(e){return function(){var n=e(this);this.textContent=n??""}}function S1(e){return this.tween("text",typeof e=="function"?C1(xl(this,"text",e)):x1(e==null?"":e+""))}function R1(e){return function(n){this.textContent=e.call(this,n)}}function $1(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&R1(a)),n}return i._value=e,i}function A1(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,$1(e))}function T1(){for(var e=this._name,n=this._id,o=Zu(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=Dt(c,n);Ra(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new rn(i,this._parents,e,o)}function M1(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=qt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var V1=0;function rn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Zu(){return++V1}var ln=ti.prototype;rn.prototype={constructor:rn,select:p1,selectAll:h1,selectChild:ln.selectChild,selectChildren:ln.selectChildren,filter:l1,merge:s1,selection:g1,transition:T1,call:ln.call,nodes:ln.nodes,node:ln.node,size:ln.size,empty:ln.empty,each:ln.each,on:u1,attr:KE,attrTween:JE,style:N1,styleTween:v1,text:S1,textTween:A1,remove:f1,tween:OE,delay:QE,duration:n1,ease:i1,easeVarying:r1,end:M1,[Symbol.iterator]:ln[Symbol.iterator]};function B1(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var D1={time:null,delay:0,duration:250,ease:B1};function L1(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function O1(e){var n,o;e instanceof rn?(n=e._id,e=e._name):(n=Zu(),(o=D1).time=El(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&Ra(c,e,n,d,l,o||L1(c,n));return new rn(i,this._parents,e,n)}ti.prototype.interrupt=BE,ti.prototype.transition=O1;const Aa=e=>()=>e;function P1(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function sn(e,n,o){this.k=e,this.x=n,this.y=o}sn.prototype={constructor:sn,scale:function(e){return e===1?this:new sn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new sn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var So=new sn(1,0,0);sn.prototype;function Cl(e){e.stopImmediatePropagation()}function ui(e){e.preventDefault(),e.stopImmediatePropagation()}function z1(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function F1(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Qu(){return this.__zoom||So}function U1(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function H1(){return navigator.maxTouchPoints||"ontouchstart"in this}function j1(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function K1(){var e=z1,n=F1,o=j1,i=U1,a=H1,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Na,d=ua("start","zoom","end"),u,m,h,p=500,y=150,b=0,f=10;function g(E){E.property("__zoom",Qu).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",V).filter(a).on("touchstart.zoom",R).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(E,w,S,B){var z=E.selection?E.selection():E;z.property("__zoom",Qu),E!==z?I(E,w,S,B):z.interrupt().each(function(){A(this,arguments).event(B).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},g.scaleBy=function(E,w,S,B){g.scaleTo(E,function(){var z=this.__zoom.k,K=typeof w=="function"?w.apply(this,arguments):w;return z*K},S,B)},g.scaleTo=function(E,w,S,B){g.transform(E,function(){var z=n.apply(this,arguments),K=this.__zoom,J=S==null?N(z):typeof S=="function"?S.apply(this,arguments):S,re=K.invert(J),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(k(K,pe),J,re),z,l)},S,B)},g.translateBy=function(E,w,S,B){g.transform(E,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof S=="function"?S.apply(this,arguments):S),n.apply(this,arguments),l)},null,B)},g.translateTo=function(E,w,S,B,z){g.transform(E,function(){var K=n.apply(this,arguments),J=this.__zoom,re=B==null?N(K):typeof B=="function"?B.apply(this,arguments):B;return o(So.translate(re[0],re[1]).scale(J.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof S=="function"?-S.apply(this,arguments):-S),K,l)},B,z)};function k(E,w){return w=Math.max(r[0],Math.min(r[1],w)),w===E.k?E:new sn(w,E.x,E.y)}function _(E,w,S){var B=w[0]-S[0]*E.k,z=w[1]-S[1]*E.k;return B===E.x&&z===E.y?E:new sn(E.k,B,z)}function N(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function I(E,w,S,B){E.on("start.zoom",function(){A(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(B).end()}).tween("zoom",function(){var z=this,K=arguments,J=A(z,K).event(B),re=n.apply(z,K),pe=S==null?N(re):typeof S=="function"?S.apply(z,K):S,ce=Math.max(re[1][0]-re[0][0],re[1][1]-re[0][1]),Ne=z.__zoom,he=typeof w=="function"?w.apply(z,K):w,de=c(Ne.invert(pe).concat(ce/Ne.k),he.invert(pe).concat(ce/he.k));return function(_e){if(_e===1)_e=he;else{var Se=de(_e),me=ce/Se[2];_e=new sn(me,pe[0]-Se[0]*me,pe[1]-Se[1]*me)}J.zoom(null,_e)}})}function A(E,w,S){return!S&&E.__zooming||new x(E,w)}function x(E,w){this.that=E,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(E,w),this.taps=0}x.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,w){return this.mouse&&E!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var w=Vt(this.that).datum();d.call(E,this.that,new P1(E,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),w)}};function $(E,...w){if(!e.apply(this,arguments))return;var S=A(this,w).event(E),B=this.__zoom,z=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,i.apply(this,arguments)))),K=Kt(E);if(S.wheel)(S.mouse[0][0]!==K[0]||S.mouse[0][1]!==K[1])&&(S.mouse[1]=B.invert(S.mouse[0]=K)),clearTimeout(S.wheel);else{if(B.k===z)return;S.mouse=[K,B.invert(K)],$a(this),S.start()}ui(E),S.wheel=setTimeout(J,y),S.zoom("mouse",o(_(k(B,z),S.mouse[0],S.mouse[1]),S.extent,l));function J(){S.wheel=null,S.end()}}function T(E,...w){if(h||!e.apply(this,arguments))return;var S=E.currentTarget,B=A(this,w,!0).event(E),z=Vt(E.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ce,!0),K=Kt(E,S),J=E.clientX,re=E.clientY;Iu(E.view),Cl(E),B.mouse=[K,this.__zoom.invert(K)],$a(this),B.start();function pe(Ne){if(ui(Ne),!B.moved){var he=Ne.clientX-J,de=Ne.clientY-re;B.moved=he*he+de*de>b}B.event(Ne).zoom("mouse",o(_(B.that.__zoom,B.mouse[0]=Kt(Ne,S),B.mouse[1]),B.extent,l))}function ce(Ne){z.on("mousemove.zoom mouseup.zoom",null),vu(Ne.view,B.moved),ui(Ne),B.event(Ne).end()}}function V(E,...w){if(e.apply(this,arguments)){var S=this.__zoom,B=Kt(E.changedTouches?E.changedTouches[0]:E,this),z=S.invert(B),K=S.k*(E.shiftKey?.5:2),J=o(_(k(S,K),B,z),n.apply(this,w),l);ui(E),s>0?Vt(this).transition().duration(s).call(I,J,B,E):Vt(this).call(g.transform,J,B,E)}}function R(E,...w){if(e.apply(this,arguments)){var S=E.touches,B=S.length,z=A(this,w,E.changedTouches.length===B).event(E),K,J,re,pe;for(Cl(E),J=0;J<B;++J)re=S[J],pe=Kt(re,this),pe=[pe,this.__zoom.invert(pe),re.identifier],z.touch0?!z.touch1&&z.touch0[2]!==pe[2]&&(z.touch1=pe,z.taps=0):(z.touch0=pe,K=!0,z.taps=1+!!u);u&&(u=clearTimeout(u)),K&&(z.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},p)),$a(this),z.start())}}function C(E,...w){if(this.__zooming){var S=A(this,w).event(E),B=E.changedTouches,z=B.length,K,J,re,pe;for(ui(E),K=0;K<z;++K)J=B[K],re=Kt(J,this),S.touch0&&S.touch0[2]===J.identifier?S.touch0[0]=re:S.touch1&&S.touch1[2]===J.identifier&&(S.touch1[0]=re);if(J=S.that.__zoom,S.touch1){var ce=S.touch0[0],Ne=S.touch0[1],he=S.touch1[0],de=S.touch1[1],_e=(_e=he[0]-ce[0])*_e+(_e=he[1]-ce[1])*_e,Se=(Se=de[0]-Ne[0])*Se+(Se=de[1]-Ne[1])*Se;J=k(J,Math.sqrt(_e/Se)),re=[(ce[0]+he[0])/2,(ce[1]+he[1])/2],pe=[(Ne[0]+de[0])/2,(Ne[1]+de[1])/2]}else if(S.touch0)re=S.touch0[0],pe=S.touch0[1];else return;S.zoom("touch",o(_(J,re,pe),S.extent,l))}}function M(E,...w){if(this.__zooming){var S=A(this,w).event(E),B=E.changedTouches,z=B.length,K,J;for(Cl(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),K=0;K<z;++K)J=B[K],S.touch0&&S.touch0[2]===J.identifier?delete S.touch0:S.touch1&&S.touch1[2]===J.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(J=Kt(J,this),Math.hypot(m[0]-J[0],m[1]-J[1])<f)){var re=Vt(this).on("dblclick.zoom");re&&re.apply(this,arguments)}}}return g.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:Aa(+E),g):i},g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Aa(!!E),g):e},g.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:Aa(!!E),g):a},g.extent=function(E){return arguments.length?(n=typeof E=="function"?E:Aa([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),g):n},g.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],g):[r[0],r[1]]},g.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],g):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},g.constrain=function(E){return arguments.length?(o=E,g):o},g.duration=function(E){return arguments.length?(s=+E,g):s},g.interpolate=function(E){return arguments.length?(c=E,g):c},g.on=function(){var E=d.on.apply(d,arguments);return E===d?g:E},g.clickDistance=function(E){return arguments.length?(b=(E=+E)*E,g):Math.sqrt(b)},g.tapDistance=function(E){return arguments.length?(f=+E,g):f},g}var Te=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Te||{}),Sl=(e=>(e.Partial="partial",e.Full="full",e))(Sl||{}),Gn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Gn||{}),cn=(e=>(e.Strict="strict",e.Loose="loose",e))(cn||{}),Rl=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Rl||{}),mi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(mi||{}),em=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(em||{});const G1=["INPUT","SELECT","TEXTAREA"],Y1=typeof document<"u"?document:null;function $l(e){var n,o;const i=((o=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:o[0])||e.target,a=typeof(i==null?void 0:i.hasAttribute)=="function"?i.hasAttribute("contenteditable"):!1,r=typeof(i==null?void 0:i.closest)=="function"?i.closest(".nokey"):null;return G1.includes(i==null?void 0:i.nodeName)||a||!!r}function q1(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function tm(e,n,o,i){const a=n.replace("+",`
28
28
  `).replace(`
29
29
 
30
30
  `,`
@@ -49,7 +49,7 @@ Edge: ${e}
49
49
  Source: ${n}
50
50
  Target: ${o}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
51
51
  Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
52
- Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class ut extends Error{constructor(n,...o){var i;super((i=vm[n])==null?void 0:i.call(vm,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Dl(e){return"clientX"in e}function f0(e){return"sourceEvent"in e}function Wt(e,n){const o=Dl(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}}const bi=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function p0(e){var n,o;return{width:((n=e.dimensions)==null?void 0:n.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function La(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const h0=()=>!0;function Ll(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function y0(e,n,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of n.values())Ma(a,Ta(r))>0&&i.push(r);return i}const g0=250;function b0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=y0(e,o,n+g0);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:h,y:p}=Ao(d,m,m.position,!0),y=Math.sqrt((h-e.x)**2+(p-e.y)**2);y>n||(y<s?(l=[{...m,x:h,y:p}],s=y):y===s&&l.push({...m,x:h,y:p}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function xm(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=h0},u,m,h,p){const y=r==="target",b=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:f,y:g}=Wt(e),k=l.elementFromPoint(f,g),_=k!=null&&k.classList.contains(`${s}-flow__handle`)?k:b,N={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const I=Cm(void 0,_),A=_.getAttribute("data-nodeid"),x=_.getAttribute("data-handleid"),$=_.classList.contains("connectable"),T=_.classList.contains("connectableend");if(!A||!I)return N;const V={source:y?A:i,sourceHandle:y?x:a,target:y?i:A,targetHandle:y?a:x};N.connection=V;const C=$&&T&&(o===cn.Strict?y&&I==="source"||!y&&I==="target":A!==i||x!==a);N.isValid=C&&d(V,{nodes:m,edges:u,sourceNode:h(V.source),targetNode:h(V.target)}),N.toHandle=Sm(A,I,x,p,o,!0)}return N}function Cm(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function _0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function k0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Sm(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===cn.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(h=>h.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...Ao(d,m,m.position,!0)}:m}const Ol={[Te.Left]:Te.Right,[Te.Right]:Te.Left,[Te.Top]:Te.Bottom,[Te.Bottom]:Te.Top},E0=["production","prod"];function _i(e,...n){Rm()&&console.warn(`[Vue Flow]: ${e}`,...n)}function Rm(){return!E0.includes(process.env.NODE_ENV||"")}function $m(e,n,o,i,a){const r=n.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Va(l)}}):null}function Pl(e,n,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&n)&&(i([e]),t.nextTick(()=>{l.blur()})):o([e])}function ct(e){return typeof t.unref(e)<"u"}function N0(e,n,o,i){if(!e||!e.source||!e.target)return o(new ut(st.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return xn(e)?a=e:a={...e,id:cm(e)},a=lm(a,void 0,i),n0(a,n)?!1:a}function w0(e,n,o,i,a){if(!n.source||!n.target)return a(new ut(st.EDGE_INVALID,e.id)),!1;if(!o)return a(new ut(st.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?cm(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Am(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!qn(l)){o(new ut(st.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=Q1(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new ut(st.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function Tm(e,n,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,n)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,n)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,n))}}function zl(e,n,o){e.clear();for(const i of o){const{source:a,target:r,sourceHandle:l=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:r,sourceHandle:l,targetHandle:s},d=`${a}-${l}--${r}-${s}`,u=`${r}-${s}--${a}-${l}`;Tm("source",c,u,e,a,l),Tm("target",c,d,e,r,s)}}function Mm(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Fl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=xn(d)?d:N0(d,s,a,r);if(!u)continue;const m=o(u.source),h=o(u.target);if(!m||!h){a(new ut(st.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new ut(st.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new ut(st.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:h})){a(new ut(st.EDGE_INVALID,u.id));continue}const p=i(u.id);c.push({...lm(u,p,r),sourceNode:m,targetNode:h})}return c}const Vm=Symbol("vueFlow"),Bm=Symbol("nodeId"),Dm=Symbol("nodeRef"),I0=Symbol("edgeId"),v0=Symbol("edgeRef"),Oa=Symbol("slots");function Lm(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:h,findNode:p,multiSelectionActive:y,nodesSelectionActive:b,selectNodesOnDrag:f,removeSelectedElements:g,addSelectedNodes:k,updateNodePositions:_,emits:N}=je(),{onStart:I,onDrag:A,onStop:x,onClick:$,el:T,disabled:V,id:R,selectable:C,dragHandle:M}=e,E=t.shallowRef(!1);let w=[],S,B=null,z={x:void 0,y:void 0},K={x:0,y:0},J=null,re=!1,pe=!1,ce=0,Ne=!1;const he=S0(),de=({x:se,y:fe})=>{z={x:se,y:fe};let O=!1;if(w=w.map(L=>{const F={x:se-L.distance.x,y:fe-L.distance.y},{computedPosition:Q}=Bl(L,o.value?La(F,i.value):F,N.error,l.value,L.parentNode?p(L.parentNode):void 0);return O=O||L.position.x!==Q.x||L.position.y!==Q.y,L.position=Q,L}),pe=pe||O,!!O&&(_(w,!0,!0),E.value=!0,J)){const[L,F]=Vl({id:R,dragItems:w,findNode:p});A({event:J,node:L,nodes:F})}},_e=()=>{if(!B)return;const[se,fe]=ym(K,B,u.value);if(se!==0||fe!==0){const O={x:(z.x??0)-se/c.value.zoom,y:(z.y??0)-fe/c.value.zoom};h({x:se,y:fe})&&de(O)}ce=requestAnimationFrame(_e)},Se=(se,fe)=>{re=!0;const O=p(R);!f.value&&!y.value&&O&&(O.selected||g()),O&&t.toValue(C)&&f.value&&Pl(O,y.value,k,g,b,!1,fe);const L=he(se.sourceEvent);if(z=L,w=l0(r.value,m.value,L,R),w.length){const[F,Q]=Vl({id:R,dragItems:w,findNode:p});I({event:se.sourceEvent,node:F,nodes:Q})}},me=(se,fe)=>{var O;se.sourceEvent.type==="touchmove"&&se.sourceEvent.touches.length>1||(pe=!1,s.value===0&&Se(se,fe),z=he(se.sourceEvent),B=((O=n.value)==null?void 0:O.getBoundingClientRect())||null,K=Wt(se.sourceEvent,B))},ye=(se,fe)=>{const O=he(se.sourceEvent);if(!Ne&&re&&d.value&&(Ne=!0,_e()),!re){const L=O.xSnapped-(z.x??0),F=O.ySnapped-(z.y??0);Math.sqrt(L*L+F*F)>s.value&&Se(se,fe)}(z.x!==O.xSnapped||z.y!==O.ySnapped)&&w.length&&re&&(J=se.sourceEvent,K=Wt(se.sourceEvent,B),de(O))},ie=se=>{let fe=!1;if(!re&&!E.value&&!y.value){const O=se.sourceEvent,L=he(O),F=L.xSnapped-(z.x??0),Q=L.ySnapped-(z.y??0),Y=Math.sqrt(F*F+Q*Q);Y!==0&&Y<=s.value&&($==null||$(O),fe=!0)}if(w.length&&!fe){pe&&(_(w,!1,!1),pe=!1);const[O,L]=Vl({id:R,dragItems:w,findNode:p});x({event:se.sourceEvent,node:O,nodes:L})}w=[],E.value=!1,Ne=!1,re=!1,z={x:void 0,y:void 0},cancelAnimationFrame(ce)};return t.watch([()=>t.toValue(V),T],([se,fe],O,L)=>{if(fe){const F=Vt(fe);se||(S=Zk().on("start",Q=>me(Q,fe)).on("drag",Q=>ye(Q,fe)).on("end",Q=>ie(Q)).filter(Q=>{const Y=Q.target,ke=t.toValue(M);return!Q.button&&(!a.value||!Nm(Y,`.${a.value}`,fe)&&(!ke||Nm(Y,ke,fe)))}),F.call(S)),L(()=>{F.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),E}function x0(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),updateStart:$e(),update:$e(),updateEnd:$e()}}function C0(e,n){const o=x0();return o.doubleClick.on(i=>{var a,r;n.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;n.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;n.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;n.edgeUpdateEnd(i),(r=(a=e.events)==null?void 0:a.updateEnd)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function S0(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=je();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=f0(a)?a.sourceEvent:a,{x:c,y:d}=Wt(s,l),u=yi({x:c,y:d},e.value),{x:m,y:h}=o.value?La(u,n.value):u;return{xSnapped:m,ySnapped:h,...u}}}function Pa(){return!0}function Om({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:h,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:b,findNode:f,panBy:g,startConnection:k,updateConnection:_,endConnection:N,emits:I,viewport:A,edges:x,nodes:$,isValidConnection:T,nodeLookup:V}=je();let R=null,C=!1,M=null;function E(S){var B;const z=t.toValue(o)==="target",K=Dl(S),J=rm(S.target),re=S.currentTarget;if(re&&(K&&S.button===0||!K)){let pe=function(ve){O=Wt(ve,ie),de=b0(yi(O,A.value,!1,[1,1]),u.value,V.value,Q),L||(F(),L=!0);const U=xm(ve,{handle:de,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:z?"target":"source",isValidConnection:he,doc:J,lib:"vue",flowId:s,nodeLookup:V.value},x.value,$.value,f,V.value);M=U.handleDomNode,R=U.connection,C=k0(!!de,U.isValid);const H={...Ce,isValid:C,to:U.toHandle&&C?hi({x:U.toHandle.x,y:U.toHandle.y},A.value):O,toHandle:U.toHandle,toPosition:C&&U.toHandle?U.toHandle.position:Ol[Q.position],toNode:U.toHandle?V.value.get(U.toHandle.nodeId):null};if(C&&de&&(Ce!=null&&Ce.toHandle)&&H.toHandle&&Ce.toHandle.type===H.toHandle.type&&Ce.toHandle.nodeId===H.toHandle.nodeId&&Ce.toHandle.id===H.toHandle.id&&Ce.to.x===H.to.x&&Ce.to.y===H.to.y)return;const q=de??U.toHandle;if(_(q&&C?hi({x:q.x,y:q.y},A.value):O,q,_0(!!q,C)),Ce=H,!de&&!C&&!M)return Ll(fe);R&&R.source!==R.target&&M&&(Ll(fe),fe=M,M.classList.add("connecting","vue-flow__handle-connecting"),M.classList.toggle("valid",!!C),M.classList.toggle("vue-flow__handle-valid",!!C))},ce=function(ve){"touches"in ve&&ve.touches.length>0||((de||M)&&R&&C&&(r?r(ve,R):I.connect(R)),I.connectEnd(ve),a&&(l==null||l(ve)),Ll(fe),cancelAnimationFrame(_e),N(ve),L=!1,C=!1,R=null,M=null,J.removeEventListener("mousemove",pe),J.removeEventListener("mouseup",ce),J.removeEventListener("touchmove",pe),J.removeEventListener("touchend",ce))};const Ne=f(t.toValue(n));let he=t.toValue(i)||T.value||Pa;!he&&Ne&&(he=(z?Ne.isValidSourcePos:Ne.isValidTargetPos)||Pa);let de,_e=0;const{x:Se,y:me}=Wt(S),ye=Cm(t.toValue(a),re),ie=(B=c.value)==null?void 0:B.getBoundingClientRect();if(!ie||!ye)return;const se=Sm(t.toValue(n),ye,t.toValue(e),V.value,d.value);if(!se)return;let fe,O=Wt(S,ie),L=!1;const F=()=>{if(!y.value)return;const[ve,U]=ym(O,ie,b.value);g({x:ve,y:U}),_e=requestAnimationFrame(F)},Q={...se,nodeId:t.toValue(n),type:ye,position:se.position},Y=V.value.get(t.toValue(n)),be={inProgress:!0,isValid:null,from:Ao(Y,Q,Te.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:Y,to:O,toHandle:null,toPosition:Ol[Q.position],toNode:null};k({nodeId:t.toValue(n),id:t.toValue(e),type:ye,position:(re==null?void 0:re.getAttribute("data-handlepos"))||Te.Top,...O},{x:Se-ie.left,y:me-ie.top}),I.connectStart({event:S,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:ye});let Ce=be;J.addEventListener("mousemove",pe),J.addEventListener("mouseup",ce),J.addEventListener("touchmove",pe),J.addEventListener("touchend",ce)}}function w(S){var B,z;if(!m.value)return;const K=t.toValue(o)==="target";if(!h.value){I.clickConnectStart({event:S,nodeId:t.toValue(n),handleId:t.toValue(e)}),k({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Te.Top,...Wt(S)},void 0,!0);return}let J=t.toValue(i)||T.value||Pa;const re=f(t.toValue(n));if(!J&&re&&(J=(K?re.isValidSourcePos:re.isValidTargetPos)||Pa),re&&(typeof re.connectable>"u"?p.value:re.connectable)===!1)return;const pe=rm(S.target),ce=xm(S,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Te.Top,...Wt(S)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:J,doc:pe,lib:"vue",flowId:s,nodeLookup:V.value},x.value,$.value,f,V.value),Ne=((B=ce.connection)==null?void 0:B.source)===((z=ce.connection)==null?void 0:z.target);ce.isValid&&ce.connection&&!Ne&&I.connect(ce.connection),I.clickConnectEnd(S),N(S,!0)}return{handlePointerDown:E,handleClick:w}}function R0(){return t.inject(Bm,"")}function Pm(e){const n=e??R0()??"",o=t.inject(Dm,t.ref(null)),{findNode:i,edges:a,emits:r}=je(),l=i(n);return l||r.error(new ut(st.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>Wn([l],a.value))}}function $0(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),dragStart:$e(),drag:$e(),dragStop:$e()}}function A0(e,n){const o=$0();return o.doubleClick.on(i=>{var a,r;n.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;n.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;n.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;n.nodeDragStop(i),(r=(a=e.events)==null?void 0:a.dragStop)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function zm(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=je();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,h=d?4:1,p=c.x*u*h,y=c.y*m*h,b=[];for(const f of e.value)if(f.draggable||l&&typeof f.draggable>"u"){const g={x:f.computedPosition.x+p,y:f.computedPosition.y+y},{position:k}=Bl(f,g,s.error,n.value,f.parentNode?i(f.parentNode):void 0);b.push({id:f.id,position:k,from:f.position,distance:{x:c.x,y:c.y},dimensions:f.dimensions})}o(b,!0,!1)}}const za=.1,T0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Rn(){return _i("Viewport not initialized yet."),Promise.resolve(!1)}const M0={zoomIn:Rn,zoomOut:Rn,zoomTo:Rn,fitView:Rn,setCenter:Rn,fitBounds:Rn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Rn,setTransform:Rn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function V0(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ri:Na).scaleBy(Ul(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)})}function o(i,a,r,l){return new Promise(s=>{var c;const{x:d,y:u}=am({x:-i,y:-a},e.translateExtent),m=So.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?ri:Na).transform(Ul(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):s(!1)})}return t.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>n(1.2,a),zoomOut:a=>n(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?ri:Na).scaleTo(Ul(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),a):l(!1)}),setViewport:(a,r)=>o(a.x,a.y,a.zoom,r),setTransform:(a,r)=>o(a.x,a.y,a.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(a={padding:za,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!h.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const c=Al(s),{x:d,y:u,zoom:m}=fm(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??za);return o(d,u,m,a)},setCenter:(a,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-r*s;return o(c,d,s,l)},fitBounds:(a,r={padding:za})=>{const{x:l,y:s,zoom:c}=fm(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??za);return o(l,s,c,r)},project:a=>yi(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-r,y:a.y-l};return yi(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+r,y:a.y+l};return hi(s,e.viewport)}return{x:0,y:0}}}:M0)}function Ul(e,n=0,o=T0,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function B0(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,f,g=!!(o.nodes.value.length||o.edges.value.length);b=wo([e.modelValue,()=>{var k,_;return(_=(k=e.modelValue)==null?void 0:k.value)==null?void 0:_.length}],([k])=>{k&&Array.isArray(k)&&(f==null||f.pause(),o.setElements(k),!f&&!g&&k.length?g=!0:f==null||f.resume())}),f=wo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([k,_])=>{var N;(N=e.modelValue)!=null&&N.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...k,..._],t.nextTick(()=>{b==null||b.resume()}))},{immediate:g}),t.onScopeDispose(()=>{b==null||b.stop(),f==null||f.stop()})})},r=()=>{i.run(()=>{let b,f,g=!!o.nodes.value.length;b=wo([e.nodes,()=>{var k,_;return(_=(k=e.nodes)==null?void 0:k.value)==null?void 0:_.length}],([k])=>{k&&Array.isArray(k)&&(f==null||f.pause(),o.setNodes(k),!f&&!g&&k.length?g=!0:f==null||f.resume())}),f=wo([o.nodes,()=>o.nodes.value.length],([k])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...k],t.nextTick(()=>{b==null||b.resume()}))},{immediate:g}),t.onScopeDispose(()=>{b==null||b.stop(),f==null||f.stop()})})},l=()=>{i.run(()=>{let b,f,g=!!o.edges.value.length;b=wo([e.edges,()=>{var k,_;return(_=(k=e.edges)==null?void 0:k.value)==null?void 0:_.length}],([k])=>{k&&Array.isArray(k)&&(f==null||f.pause(),o.setEdges(k),!f&&!g&&k.length?g=!0:f==null||f.resume())}),f=wo([o.edges,()=>o.edges.value.length],([k])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...k],t.nextTick(()=>{b==null||b.resume()}))},{immediate:g}),t.onScopeDispose(()=>{b==null||b.stop(),f==null||f.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&ct(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&ct(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&ct(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&ct(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{ct(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const b=async f=>{let g=f;typeof n.autoConnect=="function"&&(g=await n.autoConnect(f)),g!==!1&&o.addEdges([g])};t.watch(()=>n.autoConnect,()=>{ct(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(f,g,k)=>{f?o.onConnect(b):o.hooks.value.connect.off(b),k(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},p=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const f of Object.keys(n)){const g=f;if(!b.includes(g)){const k=t.toRef(()=>n[g]),_=o[g];t.isRef(_)&&i.run(()=>{t.watch(k,N=>{ct(N)&&(_.value=N)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),h(),p()})()}),()=>i.stop()}function D0(){return{edgesChange:$e(),nodesChange:$e(),nodeDoubleClick:$e(),nodeClick:$e(),nodeMouseEnter:$e(),nodeMouseMove:$e(),nodeMouseLeave:$e(),nodeContextMenu:$e(),nodeDragStart:$e(),nodeDrag:$e(),nodeDragStop:$e(),nodesInitialized:$e(),miniMapNodeClick:$e(),miniMapNodeDoubleClick:$e(),miniMapNodeMouseEnter:$e(),miniMapNodeMouseMove:$e(),miniMapNodeMouseLeave:$e(),connect:$e(),connectStart:$e(),connectEnd:$e(),clickConnectStart:$e(),clickConnectEnd:$e(),paneReady:$e(),init:$e(),move:$e(),moveStart:$e(),moveEnd:$e(),selectionDragStart:$e(),selectionDrag:$e(),selectionDragStop:$e(),selectionContextMenu:$e(),selectionStart:$e(),selectionEnd:$e(),viewportChangeStart:$e(),viewportChange:$e(),viewportChangeEnd:$e(),paneScroll:$e(),paneClick:$e(),paneContextMenu:$e(),paneMouseEnter:$e(),paneMouseMove:$e(),paneMouseLeave:$e(),edgeContextMenu:$e(),edgeMouseEnter:$e(),edgeMouseMove:$e(),edgeMouseLeave:$e(),edgeDoubleClick:$e(),edgeClick:$e(),edgeUpdateStart:$e(),edgeUpdate:$e(),edgeUpdateEnd:$e(),updateNodeInternals:$e(),error:$e(e=>_i(e.message))}}function L0(e,n){const o=t.getCurrentInstance();t.onBeforeMount(()=>{for(const[a,r]of Object.entries(n.value)){const l=s=>{e(a,s)};r.setEmitter(l),ei(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),ei(r.removeHasEmitListeners)}});function i(a){var r;const l=O0(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function O0(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Fm(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:Sl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:mi.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Gn.Bezier,style:{}},connectionMode:cn.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:bi()?"Meta":"Control",zoomActivationKeyCode:bi()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:D0(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const P0=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function z0(e,n,o){const i=V0(e),a=O=>{const L=O??[];e.hooks.updateNodeInternals.trigger(L)},r=O=>t0(O,e.nodes,e.edges),l=O=>e0(O,e.nodes,e.edges),s=O=>Wn(O,e.edges),c=({id:O,type:L,nodeId:F})=>{var Q;const Y=O?`-${L}-${O}`:`-${L}`;return Array.from(((Q=e.connectionLookup.get(`${F}${Y}`))==null?void 0:Q.values())??[])},d=O=>{if(O)return n.value.get(O)},u=O=>{if(O)return o.value.get(O)},m=(O,L,F)=>{var Q,Y;const ke=[];for(const be of O){const Ce={id:be.id,type:"position",dragging:F,from:be.from};if(L&&(Ce.position=be.position,be.parentNode)){const ve=d(be.parentNode);Ce.position={x:Ce.position.x-(((Q=ve==null?void 0:ve.computedPosition)==null?void 0:Q.x)??0),y:Ce.position.y-(((Y=ve==null?void 0:ve.computedPosition)==null?void 0:Y.y)??0)}}ke.push(Ce)}ke!=null&&ke.length&&e.hooks.nodesChange.trigger(ke)},h=O=>{if(!e.vueFlowRef)return;const L=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!L)return;const F=window.getComputedStyle(L),{m22:Q}=new window.DOMMatrixReadOnly(F.transform),Y=[];for(const ke of O){const be=ke,Ce=d(be.id);if(Ce){const ve=Va(be.nodeElement);if(!!(ve.width&&ve.height&&(Ce.dimensions.width!==ve.width||Ce.dimensions.height!==ve.height||be.forceUpdate))){const H=be.nodeElement.getBoundingClientRect();Ce.dimensions=ve,Ce.handleBounds.source=$m("source",be.nodeElement,H,Q,Ce.id),Ce.handleBounds.target=$m("target",be.nodeElement,H,Q,Ce.id),Y.push({id:Ce.id,type:"dimensions",dimensions:ve})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),Y.length&&e.hooks.nodesChange.trigger(Y)},p=(O,L)=>{const F=new Set,Q=new Set;for(const be of O)qn(be)?F.add(be.id):xn(be)&&Q.add(be.id);const Y=Sn(n.value,F,!0),ke=Sn(o.value,Q);if(e.multiSelectionActive){for(const be of F)Y.push(Cn(be,L));for(const be of Q)ke.push(Cn(be,L))}Y.length&&e.hooks.nodesChange.trigger(Y),ke.length&&e.hooks.edgesChange.trigger(ke)},y=O=>{if(e.multiSelectionActive){const L=O.map(F=>Cn(F.id,!0));e.hooks.nodesChange.trigger(L);return}e.hooks.nodesChange.trigger(Sn(n.value,new Set(O.map(L=>L.id)),!0)),e.hooks.edgesChange.trigger(Sn(o.value))},b=O=>{if(e.multiSelectionActive){const L=O.map(F=>Cn(F.id,!0));e.hooks.edgesChange.trigger(L);return}e.hooks.edgesChange.trigger(Sn(o.value,new Set(O.map(L=>L.id)))),e.hooks.nodesChange.trigger(Sn(n.value,new Set,!0))},f=O=>{p(O,!0)},g=O=>{const F=(O||e.nodes).map(Q=>(Q.selected=!1,Cn(Q.id,!1)));e.hooks.nodesChange.trigger(F)},k=O=>{const F=(O||e.edges).map(Q=>(Q.selected=!1,Cn(Q.id,!1)));e.hooks.edgesChange.trigger(F)},_=O=>{if(!O||!O.length)return p([],!1);const L=O.reduce((F,Q)=>{const Y=Cn(Q.id,!1);return qn(Q)?F.nodes.push(Y):F.edges.push(Y),F},{nodes:[],edges:[]});L.nodes.length&&e.hooks.nodesChange.trigger(L.nodes),L.edges.length&&e.hooks.edgesChange.trigger(L.edges)},N=O=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([O,e.maxZoom]),e.minZoom=O},I=O=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([e.minZoom,O]),e.maxZoom=O},A=O=>{var L;(L=e.d3Zoom)==null||L.translateExtent(O),e.translateExtent=O},x=O=>{e.nodeExtent=O,a()},$=O=>{var L;(L=e.d3Zoom)==null||L.clickDistance(O)},T=O=>{e.nodesDraggable=O,e.nodesConnectable=O,e.elementsSelectable=O},V=O=>{const L=O instanceof Function?O(e.nodes):O;!e.initialized&&!L.length||(e.nodes=Am(L,d,e.hooks.error.trigger))},R=O=>{const L=O instanceof Function?O(e.edges):O;if(!e.initialized&&!L.length)return;const F=Fl(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);zl(e.connectionLookup,o.value,F),e.edges=F},C=O=>{const L=O instanceof Function?O([...e.nodes,...e.edges]):O;!e.initialized&&!L.length||(V(L.filter(qn)),R(L.filter(xn)))},M=O=>{let L=O instanceof Function?O(e.nodes):O;L=Array.isArray(L)?L:[L];const F=Am(L,d,e.hooks.error.trigger),Q=[];for(const Y of F)Q.push(bm(Y));Q.length&&e.hooks.nodesChange.trigger(Q)},E=O=>{let L=O instanceof Function?O(e.edges):O;L=Array.isArray(L)?L:[L];const F=Fl(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const Y of F)Q.push(bm(Y));Q.length&&e.hooks.edgesChange.trigger(Q)},w=(O,L=!0,F=!1)=>{const Q=O instanceof Function?O(e.nodes):O,Y=Array.isArray(Q)?Q:[Q],ke=[],be=[];function Ce(U){const H=s(U);for(const q of H)(!ct(q.deletable)||q.deletable)&&be.push(km(q.id,q.source,q.target,q.sourceHandle,q.targetHandle))}function ve(U){const H=[];for(const q of e.nodes)q.parentNode===U&&H.push(q);if(H.length){for(const q of H)ke.push(_m(q.id));L&&Ce(H);for(const q of H)ve(q.id)}}for(const U of Y){const H=typeof U=="string"?d(U):U;H&&(ct(H.deletable)&&!H.deletable||(ke.push(_m(H.id)),L&&Ce([H]),F&&ve(H.id)))}be.length&&e.hooks.edgesChange.trigger(be),ke.length&&e.hooks.nodesChange.trigger(ke)},S=O=>{const L=O instanceof Function?O(e.edges):O,F=Array.isArray(L)?L:[L],Q=[];for(const Y of F){const ke=typeof Y=="string"?u(Y):Y;ke&&(ct(ke.deletable)&&!ke.deletable||Q.push(km(typeof Y=="string"?Y:Y.id,ke.source,ke.target,ke.sourceHandle,ke.targetHandle)))}e.hooks.edgesChange.trigger(Q)},B=(O,L,F=!0)=>{const Q=u(O.id);if(!Q)return!1;const Y=e.edges.indexOf(Q),ke=w0(O,L,Q,F,e.hooks.error.trigger);if(ke){const[be]=Fl([ke],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Ce,ve)=>ve===Y?be:Ce),zl(e.connectionLookup,o.value,[be]),be}return!1},z=(O,L,F={replace:!1})=>{const Q=u(O);if(!Q)return;const Y=typeof L=="function"?L(Q):L;Q.data=F.replace?Y:{...Q.data,...Y}},K=O=>gm(O,e.nodes),J=O=>{const L=gm(O,e.edges);return zl(e.connectionLookup,o.value,L),L},re=(O,L,F={replace:!1})=>{const Q=d(O);if(!Q)return;const Y=typeof L=="function"?L(Q):L;F.replace?e.nodes.splice(e.nodes.indexOf(Q),1,Y):Object.assign(Q,Y)},pe=(O,L,F={replace:!1})=>{const Q=d(O);if(!Q)return;const Y=typeof L=="function"?L(Q):L;Q.data=F.replace?Y:{...Q.data,...Y}},ce=(O,L,F=!1)=>{F?e.connectionClickStartHandle=O:e.connectionStartHandle=O,e.connectionEndHandle=null,e.connectionStatus=null,L&&(e.connectionPosition=L)},Ne=(O,L=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=O,e.connectionEndHandle=L,e.connectionStatus=F)},he=(O,L)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,L?e.connectionClickStartHandle=null:e.connectionStartHandle=null},de=O=>{const L=Z1(O),F=L?null:pi(O)?O:d(O.id);return!L&&!F?[null,null,L]:[L?O:Ta(F),F,L]},_e=(O,L=!0,F=e.nodes)=>{const[Q,Y,ke]=de(O);if(!Q)return[];const be=[];for(const Ce of F||e.nodes){if(!ke&&(Ce.id===Y.id||!Ce.computedPosition))continue;const ve=Ta(Ce),U=Ma(ve,Q);(L&&U>0||U>=ve.width*ve.height||U>=Number(Q.width)*Number(Q.height))&&be.push(Ce)}return be},Se=(O,L,F=!0)=>{const[Q]=de(O);if(!Q)return!1;const Y=Ma(Q,L);return F&&Y>0||Y>=Number(Q.width)*Number(Q.height)},me=O=>{const{viewport:L,dimensions:F,d3Zoom:Q,d3Selection:Y,translateExtent:ke}=e;if(!Q||!Y||!O.x&&!O.y)return!1;const be=So.translate(L.x+O.x,L.y+O.y).scale(L.zoom),Ce=[[0,0],[F.width,F.height]],ve=Q.constrain()(be,Ce,ke),U=e.viewport.x!==ve.x||e.viewport.y!==ve.y||e.viewport.zoom!==ve.k;return Q.transform(Y,ve),U},ye=O=>{const L=O instanceof Function?O(e):O,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ct(L.defaultEdgeOptions)&&(e.defaultEdgeOptions=L.defaultEdgeOptions);const Q=L.modelValue||L.nodes||L.edges?[]:void 0;Q&&(L.modelValue&&Q.push(...L.modelValue),L.nodes&&Q.push(...L.nodes),L.edges&&Q.push(...L.edges),C(Q));const Y=()=>{ct(L.maxZoom)&&I(L.maxZoom),ct(L.minZoom)&&N(L.minZoom),ct(L.translateExtent)&&A(L.translateExtent)};for(const ke of Object.keys(L)){const be=ke,Ce=L[be];![...P0,...F].includes(be)&&ct(Ce)&&(e[be]=Ce)}ll(()=>e.d3Zoom).not.toBeNull().then(Y),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:h,setElements:C,setNodes:V,setEdges:R,addNodes:M,addEdges:E,removeNodes:w,removeEdges:S,findNode:d,findEdge:u,updateEdge:B,updateEdgeData:z,updateNode:re,updateNodeData:pe,applyEdgeChanges:J,applyNodeChanges:K,addSelectedElements:f,addSelectedNodes:y,addSelectedEdges:b,setMinZoom:N,setMaxZoom:I,setTranslateExtent:A,setNodeExtent:x,setPaneClickDistance:$,removeSelectedElements:_,removeSelectedNodes:g,removeSelectedEdges:k,startConnection:ce,updateConnection:Ne,endConnection:he,setInteractive:T,setState:ye,getIntersectingNodes:_e,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Se,panBy:me,fitView:O=>i.value.fitView(O),zoomIn:O=>i.value.zoomIn(O),zoomOut:O=>i.value.zoomOut(O),zoomTo:(O,L)=>i.value.zoomTo(O,L),setViewport:(O,L)=>i.value.setViewport(O,L),setTransform:(O,L)=>i.value.setTransform(O,L),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(O,L,F)=>i.value.setCenter(O,L,F),fitBounds:(O,L)=>i.value.fitBounds(O,L),project:O=>i.value.project(O),screenToFlowCoordinate:O=>i.value.screenToFlowCoordinate(O),flowToScreenCoordinate:O=>i.value.flowToScreenCoordinate(O),toObject:()=>{const O=[],L=[];for(const F of e.nodes){const{computedPosition:Q,handleBounds:Y,selected:ke,dimensions:be,isParent:Ce,resizing:ve,dragging:U,events:H,...q}=F;O.push(q)}for(const F of e.edges){const{selected:Q,sourceNode:Y,targetNode:ke,events:be,...Ce}=F;L.push(Ce)}return JSON.parse(JSON.stringify({nodes:O,edges:L,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:O=>new Promise(L=>{const{nodes:F,edges:Q,position:Y,zoom:ke,viewport:be}=O;F&&V(F),Q&&R(Q);const[Ce,ve]=be!=null&&be.x&&(be!=null&&be.y)?[be.x,be.y]:Y??[null,null];if(Ce&&ve){const U=(be==null?void 0:be.zoom)||ke||e.viewport.zoom;return ll(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Ce,y:ve,zoom:U}).then(()=>{L(!0)})})}else L(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const O=Fm();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const L=So.translate(O.defaultViewport.x??0,O.defaultViewport.y??0).scale(Yn(O.defaultViewport.zoom??1,O.minZoom,O.maxZoom)),F=e.viewportRef.getBoundingClientRect(),Q=[[0,0],[F.width,F.height]],Y=e.d3Zoom.constrain()(L,Q,O.translateExtent);e.d3Zoom.transform(e.d3Selection,Y)}ye(O)},$destroy:()=>{}}}const F0=["data-id","data-handleid","data-nodeid","data-handlepos"],U0={name:"Handle",compatConfig:{MODE:3}},Jn=t.defineComponent({...U0,props:{id:{default:null},type:{},position:{default:()=>Te.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:h}=je(),{id:p,node:y,nodeEl:b,connectedEdges:f}=Pm(),g=t.ref(),k=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),N=t.toRef(()=>{var R,C,M,E,w,S;return((R=l.value)==null?void 0:R.nodeId)===p&&((C=l.value)==null?void 0:C.id)===e.id&&((M=l.value)==null?void 0:M.type)===i.value||((E=c.value)==null?void 0:E.nodeId)===p&&((w=c.value)==null?void 0:w.id)===e.id&&((S=c.value)==null?void 0:S.type)===i.value}),I=t.toRef(()=>{var R,C,M;return((R=s.value)==null?void 0:R.nodeId)===p&&((C=s.value)==null?void 0:C.id)===e.id&&((M=s.value)==null?void 0:M.type)===i.value}),{handlePointerDown:A,handleClick:x}=Om({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),$=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!f.value.some(R=>{const C=R[`${i.value}Handle`];return R[i.value]!==p?!1:C?C===e.id:!0}):typeof e.connectable=="number"?f.value.filter(R=>{const C=R[`${i.value}Handle`];return R[i.value]!==p?!1:C?C===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,f.value):ct(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var R;if(!y.dimensions.width||!y.dimensions.height)return;const C=(R=y.handleBounds[i.value])==null?void 0:R.find(K=>K.id===e.id);if(!d.value||C)return;const M=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!g.value||!M||!e.id)return;const E=b.value.getBoundingClientRect(),w=g.value.getBoundingClientRect(),S=window.getComputedStyle(M),{m22:B}=new window.DOMMatrixReadOnly(S.transform),z={id:e.id,position:e.position,x:(w.left-E.left)/B,y:(w.top-E.top)/B,type:i.value,nodeId:p,...Va(g.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],z]});function T(R){const C=Dl(R);$.value&&k.value&&(C&&R.button===0||!C)&&A(R)}function V(R){!p||!s.value&&!k.value||$.value&&x(R)}return n({handleClick:x,handlePointerDown:A,onClick:V,onPointerDown:T}),(R,C)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:g,"data-id":`${t.unref(r)}-${t.unref(p)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(p),"data-handlepos":R.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${R.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(h),i.value,{connectable:$.value,connecting:I.value,connectablestart:k.value,connectableend:_.value,connectionindicator:$.value&&(k.value&&!N.value||_.value&&N.value)}]]),onMousedown:T,onTouchstartPassive:T,onClick:V},[t.renderSlot(R.$slots,"default",{id:R.id})],42,F0))}}),Fa=function({sourcePosition:e=Te.Bottom,targetPosition:n=Te.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Jn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Jn,{type:"source",position:e,connectable:i,isValidConnection:r})]};Fa.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Fa.inheritAttrs=!1,Fa.compatConfig={MODE:3};const H0=Fa,Ua=function({targetPosition:e=Te.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Jn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};Ua.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ua.inheritAttrs=!1,Ua.compatConfig={MODE:3};const j0=Ua,Ha=function({sourcePosition:e=Te.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(Jn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Ha.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ha.inheritAttrs=!1,Ha.compatConfig={MODE:3};const K0=Ha,G0=["transform"],Y0=["width","height","x","y","rx","ry"],q0=["y"],W0={name:"EdgeText",compatConfig:{MODE:3}},J0=t.defineComponent({...W0,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const n=t.ref({x:0,y:0,width:0,height:0}),o=t.ref(null),i=t.computed(()=>`translate(${e.x-n.value.width/2} ${e.y-n.value.height/2})`);t.onMounted(a),t.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==n.value.width||r.height!==n.value.height)&&(n.value=r)}return(r,l)=>(t.openBlock(),t.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(t.openBlock(),t.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${n.value.width+2*r.labelBgPadding[0]}px`,height:`${n.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:t.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Y0)):t.createCommentVNode("",!0),t.createElementVNode("text",t.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:n.value.height/2,dy:"0.3em",style:r.labelStyle}),[t.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.label),{key:0})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(r.label),1)],64))])],16,q0)],8,G0))}}),X0=["id","d","marker-end","marker-start"],Z0=["d","stroke-width"],Q0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ja=t.defineComponent({...Q0,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:n}){const o=t.ref(null),i=t.ref(null),a=t.ref(null),r=t.useAttrs();return n({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",t.mergeProps(t.unref(r),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,X0),l.interactionWidth?(t.openBlock(),t.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Z0)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(J0,{key:1,ref_key:"labelEl",ref:a,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):t.createCommentVNode("",!0)],64))}});function Um({sourceX:e,sourceY:n,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-n)/2,s=i<n?i+l:i-l;return[r,s,a,l]}function Hm({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=n*.125+r*.375+s*.375+i*.125,u=Math.abs(c-e),m=Math.abs(d-n);return[c,d,u,m]}function Ka(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function jm({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Te.Left:l=n-Ka(n-i,r),s=o;break;case Te.Right:l=n+Ka(i-n,r),s=o;break;case Te.Top:l=n,s=o-Ka(o-a,r);break;case Te.Bottom:l=n,s=o+Ka(a-o,r);break}return[l,s]}function Km(e){const{sourceX:n,sourceY:o,sourcePosition:i=Te.Bottom,targetX:a,targetY:r,targetPosition:l=Te.Top,curvature:s=.25}=e,[c,d]=jm({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=jm({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[h,p,y,b]=Hm({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,h,p,y,b]}function Gm({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case Te.Left:case Te.Right:r=.5*(n+i),l=o;break;case Te.Top:case Te.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function Ym(e){const{sourceX:n,sourceY:o,sourcePosition:i=Te.Bottom,targetX:a,targetY:r,targetPosition:l=Te.Top}=e,[s,c]=Gm({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=Gm({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,h,p,y]=Hm({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,h,p,y]}const qm={[Te.Left]:{x:-1,y:0},[Te.Right]:{x:1,y:0},[Te.Top]:{x:0,y:-1},[Te.Bottom]:{x:0,y:1}};function eN({source:e,sourcePosition:n=Te.Bottom,target:o}){return n===Te.Left||n===Te.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function Wm(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function tN({source:e,sourcePosition:n=Te.Bottom,target:o,targetPosition:i=Te.Top,center:a,offset:r}){const l=qm[n],s=qm[i],c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:o.x+s.x*r,y:o.y+s.y*r},u=eN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",h=u[m];let p,y,b;const f={x:0,y:0},g={x:0,y:0},[k,_,N,I]=Um({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??k,b=a.y??_;const x=[{x:y,y:c.y},{x:y,y:d.y}],$=[{x:c.x,y:b},{x:d.x,y:b}];l[m]===h?p=m==="x"?x:$:p=m==="x"?$:x}else{const x=[{x:c.x,y:d.y}],$=[{x:d.x,y:c.y}];if(m==="x"?p=l.x===h?$:x:p=l.y===h?x:$,n===i){const M=Math.abs(e[m]-o[m]);if(M<=r){const E=Math.min(r-1,r-M);l[m]===h?f[m]=(c[m]>e[m]?-1:1)*E:g[m]=(d[m]>o[m]?-1:1)*E}}if(n!==i){const M=m==="x"?"y":"x",E=l[m]===s[M],w=c[M]>d[M],S=c[M]<d[M];(l[m]===1&&(!E&&w||E&&S)||l[m]!==1&&(!E&&S||E&&w))&&(p=m==="x"?x:$)}const T={x:c.x+f.x,y:c.y+f.y},V={x:d.x+g.x,y:d.y+g.y},R=Math.max(Math.abs(T.x-p[0].x),Math.abs(V.x-p[0].x)),C=Math.max(Math.abs(T.y-p[0].y),Math.abs(V.y-p[0].y));R>=C?(y=(T.x+V.x)/2,b=p[0].y):(y=p[0].x,b=(T.y+V.y)/2)}return[[e,{x:c.x+f.x,y:c.y+f.y},...p,{x:d.x+g.x,y:d.y+g.y},o],y,b,N,I]}function nN(e,n,o,i){const a=Math.min(Wm(e,n)/2,Wm(n,o)/2,i),{x:r,y:l}=n;if(e.x===r&&r===o.x||e.y===l&&l===o.y)return`L${r} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${r+a*d},${l}Q ${r},${l} ${r},${l+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${r},${l+a*c}Q ${r},${l} ${r+a*s},${l}`}function Hl(e){const{sourceX:n,sourceY:o,sourcePosition:i=Te.Bottom,targetX:a,targetY:r,targetPosition:l=Te.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,h,p,y,b]=tN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((g,k,_)=>{let N;return _>0&&_<m.length-1?N=nN(m[_-1],k,m[_+1],s):N=`${_===0?"M":"L"}${k.x} ${k.y}`,g+=N,g},""),h,p,y,b]}function oN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Um({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const iN=t.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=oN(e);return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),Jm=t.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Hl({...e,sourcePosition:e.sourcePosition??Te.Bottom,targetPosition:e.targetPosition??Te.Top});return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),aN=t.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:n}){return()=>t.h(Jm,{...e,...n,borderRadius:0})}}),rN=t.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Km({...e,sourcePosition:e.sourcePosition??Te.Bottom,targetPosition:e.targetPosition??Te.Top});return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),lN=t.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Ym({...e,sourcePosition:e.sourcePosition??Te.Bottom,targetPosition:e.targetPosition??Te.Top});return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),sN={input:K0,default:H0,output:j0},cN={default:rN,straight:iN,step:aN,smoothstep:Jm,simplebezier:lN};function dN(e,n,o){const i=t.computed(()=>b=>n.value.get(b)),a=t.computed(()=>b=>o.value.get(b)),r=t.computed(()=>{const b={...cN,...e.edgeTypes},f=Object.keys(b);for(const g of e.edges)g.type&&!f.includes(g.type)&&(b[g.type]=g.type);return b}),l=t.computed(()=>{const b={...sN,...e.nodeTypes},f=Object.keys(b);for(const g of e.nodes)g.type&&!f.includes(g.type)&&(b[g.type]=g.type);return b}),s=t.computed(()=>e.onlyRenderVisibleElements?mm(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const f of e.edges){const g=n.value.get(f.source),k=n.value.get(f.target);u0({sourcePos:g.computedPosition||{x:0,y:0},targetPos:k.computedPosition||{x:0,y:0},sourceWidth:g.dimensions.width,sourceHeight:g.dimensions.height,targetWidth:k.dimensions.width,targetHeight:k.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(f)}return b}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const b=[];for(const f of e.nodes)f.selected&&b.push(f);return b}),m=t.computed(()=>{const b=[];for(const f of e.edges)f.selected&&b.push(f);return b}),h=t.computed(()=>[...u.value,...m.value]),p=t.computed(()=>{const b=[];for(const f of e.nodes)f.dimensions.width&&f.dimensions.height&&f.handleBounds!==void 0&&b.push(f);return b}),y=t.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:p,areNodesInitialized:y}}class Xn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Xn.instance;return Xn.instance=i??new Xn,o&&(o.config.globalProperties.$vueFlowStorage=Xn.instance),Xn.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const i=Fm(),a=t.reactive(i),r={};for(const[h,p]of Object.entries(a.hooks)){const y=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[y]=p.on}const l={};for(const[h,p]of Object.entries(a.hooks))l[h]=p.trigger;const s=t.computed(()=>{const h=new Map;for(const p of a.nodes)h.set(p.id,p);return h}),c=t.computed(()=>{const h=new Map;for(const p of a.edges)h.set(p.id,p);return h}),d=dN(a,s,c),u=z0(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...l_(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,m),m}getId(){return`vue-flow-${this.currentId++}`}}function je(e){const n=Xn.getInstance(),o=t.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(Vm,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(m,h,p)=>{const y=f=>{d.applyNodeChanges(f)},b=f=>{d.applyEdgeChanges(f)};m?(d.onNodesChange(y),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)),p(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)})},{immediate:!0}),ei(()=>{if(s){const m=n.get(s.id);m?m.$destroy():_i(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Vm,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new ut(st.USEVUEFLOW_OPTIONS))}return s}function uN(e){const{emits:n,dimensions:o}=je();let i;t.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=Va(e.value);(s.width===0||s.height===0)&&n.error(new ut(st.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const mN={name:"UserSelection",compatConfig:{MODE:3}},fN=t.defineComponent({...mN,props:{userSelectionRect:{}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:t.normalizeStyle({width:`${n.userSelectionRect.width}px`,height:`${n.userSelectionRect.height}px`,transform:`translate(${n.userSelectionRect.x}px, ${n.userSelectionRect.y}px)`})},null,4))}}),pN=["tabIndex"],hN={name:"NodesSelection",compatConfig:{MODE:3}},yN=t.defineComponent({...hN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=je(),s=zm(),c=t.ref(null),d=Lm({el:c,onStart(y){n.selectionDragStart(y),n.nodeDragStart(y)},onDrag(y){n.selectionDrag(y),n.nodeDrag(y)},onStop(y){n.selectionDragStop(y),n.nodeDragStop(y)}});t.onMounted(()=>{var y;r.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=t.computed(()=>Al(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(y){n.selectionContextMenu({event:y,nodes:i.value})}function p(y){r.value||Ro[y.key]&&(y.preventDefault(),s({x:Ro[y.key].x,y:Ro[y.key].y},y.shiftKey))}return(y,b)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:h,onKeydown:p},null,46,pN)],6)):t.createCommentVNode("",!0)}});function gN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const bN={name:"Pane",compatConfig:{MODE:3}},_N=t.defineComponent({...bN,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:h,removeEdges:p,selectionMode:y,deleteKeyCode:b,multiSelectionKeyCode:f,multiSelectionActive:g,edgeLookup:k,nodeLookup:_,connectionLookup:N,defaultEdgeOptions:I,connectionStartHandle:A,panOnDrag:x}=je(),$=t.shallowRef(null),T=t.shallowRef(new Set),V=t.shallowRef(new Set),R=t.shallowRef(null),C=t.toRef(()=>c.value&&(e.isSelecting||r.value)),M=t.toRef(()=>A.value!==null);let E=!1,w=!1;const S=fi(b,{actInsideInputWithModifier:!1}),B=fi(f);t.watch(S,he=>{he&&(h(m.value),p(u.value),d.value=!1)}),t.watch(B,he=>{g.value=he});function z(he,de){return _e=>{_e.target===de&&(he==null||he(_e))}}function K(he){if(E||M.value){E=!1;return}a.paneClick(he),l(),d.value=!1}function J(he){var de;if(Array.isArray(x.value)&&((de=x.value)!=null&&de.includes(2))){he.preventDefault();return}a.paneContextMenu(he)}function re(he){a.paneScroll(he)}function pe(he){var de,_e,Se;if(R.value=((de=n.value)==null?void 0:de.getBoundingClientRect())??null,!c.value||!e.isSelecting||he.button!==0||he.target!==$.value||!R.value)return;(Se=(_e=he.target)==null?void 0:_e.setPointerCapture)==null||Se.call(_e,he.pointerId);const{x:me,y:ye}=gN(he,R.value);w=!0,E=!1,l(),s.value={width:0,height:0,startX:me,startY:ye,x:me,y:ye},a.selectionStart(he)}function ce(he){var de;if(!R.value||!s.value)return;E=!0;const{x:_e,y:Se}=Wt(he,R.value),{startX:me=0,startY:ye=0}=s.value,ie={startX:me,startY:ye,x:_e<me?_e:me,y:Se<ye?Se:ye,width:Math.abs(_e-me),height:Math.abs(Se-ye)},se=T.value,fe=V.value;T.value=new Set(mm(o.value,ie,i.value,y.value===Sl.Partial,!0).map(L=>L.id)),V.value=new Set;const O=((de=I.value)==null?void 0:de.selectable)??!0;for(const L of T.value){const F=N.value.get(L);if(F)for(const{edgeId:Q}of F.values()){const Y=k.value.get(Q);Y&&(Y.selectable??O)&&V.value.add(Q)}}if(!Mm(se,T.value)){const L=Sn(_.value,T.value,!0);a.nodesChange(L)}if(!Mm(fe,V.value)){const L=Sn(k.value,V.value);a.edgesChange(L)}s.value=ie,r.value=!0,d.value=!1}function Ne(he){var de;he.button!==0||!w||((de=he.target)==null||de.releasePointerCapture(he.pointerId),!r.value&&s.value&&he.target===$.value&&K(he),r.value=!1,s.value=null,d.value=T.value.size>0,a.selectionEnd(he),e.selectionKeyPressed&&(E=!1),w=!1)}return(he,de)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:$,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:he.isSelecting}]),onClick:de[0]||(de[0]=_e=>C.value?void 0:z(K,$.value)(_e)),onContextmenu:de[1]||(de[1]=_e=>z(J,$.value)(_e)),onWheelPassive:de[2]||(de[2]=_e=>z(re,$.value)(_e)),onPointerenter:de[3]||(de[3]=_e=>C.value?void 0:t.unref(a).paneMouseEnter(_e)),onPointerdown:de[4]||(de[4]=_e=>C.value?pe(_e):t.unref(a).paneMouseMove(_e)),onPointermove:de[5]||(de[5]=_e=>C.value?ce(_e):t.unref(a).paneMouseMove(_e)),onPointerup:de[6]||(de[6]=_e=>C.value?Ne(_e):void 0),onPointerleave:de[7]||(de[7]=_e=>t.unref(a).paneMouseLeave(_e))},[t.renderSlot(he.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(fN,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(m).length?(t.openBlock(),t.createBlock(yN,{key:1})):t.createCommentVNode("",!0)],34))}}),kN={name:"Transform",compatConfig:{MODE:3}},EN=t.defineComponent({...kN,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=je(),a=t.computed(()=>o.value?!i.value:!1),r=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),NN={name:"Viewport",compatConfig:{MODE:3}},wN=t.defineComponent({...NN,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:b,noWheelClassName:f,noPanClassName:g,emits:k,connectionStartHandle:_,userSelectionActive:N,paneDragging:I,d3Zoom:A,d3Selection:x,d3ZoomHandler:$,viewport:T,viewportRef:V,paneClickDistance:R}=je();uN(V);const C=t.shallowRef(!1),M=t.shallowRef(!1);let E=null,w=!1,S=0,B={x:0,y:0,zoom:0};const z=fi(s),K=fi(l),J=fi(r),re=t.toRef(()=>(!K.value||K.value&&l.value===!0)&&(z.value||m.value)),pe=t.toRef(()=>z.value||c.value),ce=t.toRef(()=>l.value===!0&&re.value!==!0),Ne=t.toRef(()=>K.value&&l.value!==!0||N.value||ce.value),he=t.toRef(()=>_.value!==null);t.onMounted(()=>{if(!V.value){_i("Viewport element is missing");return}const ye=V.value,ie=ye.getBoundingClientRect(),se=K1().clickDistance(R.value).scaleExtent([n.value,o.value]).translateExtent(a.value),fe=Vt(ye).call(se),O=fe.on("wheel.zoom"),L=So.translate(i.value.x??0,i.value.y??0).scale(Yn(i.value.zoom??1,n.value,o.value)),F=[[0,0],[ie.width,ie.height]],Q=se.constrain()(L,F,a.value);se.transform(fe,Q),se.wheelDelta(Tl),A.value=se,x.value=fe,$.value=O,T.value={x:Q.x,y:Q.y,zoom:Q.k},se.on("start",Y=>{var ke;if(!Y.sourceEvent)return null;S=Y.sourceEvent.button,C.value=!0;const be=Se(Y.transform);((ke=Y.sourceEvent)==null?void 0:ke.type)==="mousedown"&&(I.value=!0),B=be,k.viewportChangeStart(be),k.moveStart({event:Y,flowTransform:be})}),se.on("end",Y=>{if(!Y.sourceEvent)return null;if(C.value=!1,I.value=!1,de(re.value,S??0)&&!w&&k.paneContextMenu(Y.sourceEvent),w=!1,_e(B,Y.transform)){const ke=Se(Y.transform);B=ke,k.viewportChangeEnd(ke),k.moveEnd({event:Y,flowTransform:ke})}}),se.filter(Y=>{var ke;const be=J.value||y.value,Ce=p.value&&Y.ctrlKey,ve=Y.button,U=Y.type==="wheel";if(ve===1&&Y.type==="mousedown"&&(me(Y,"vue-flow__node")||me(Y,"vue-flow__edge")))return!0;if(!re.value&&!be&&!pe.value&&!h.value&&!p.value||N.value||he.value&&!U||!h.value&&Y.type==="dblclick"||me(Y,f.value)&&U||me(Y,g.value)&&(!U||pe.value&&U&&!J.value)||!p.value&&Y.ctrlKey&&U||!be&&!pe.value&&!Ce&&U)return!1;if(!p&&Y.type==="touchstart"&&((ke=Y.touches)==null?void 0:ke.length)>1)return Y.preventDefault(),!1;if(!re.value&&(Y.type==="mousedown"||Y.type==="touchstart")||ce.value&&Array.isArray(m.value)&&m.value.includes(0)&&ve===0||Array.isArray(m.value)&&!m.value.includes(ve)&&(Y.type==="mousedown"||Y.type==="touchstart"))return!1;const H=Array.isArray(m.value)&&m.value.includes(ve)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!ve||ve<=1;return(!Y.ctrlKey||z.value||U)&&H}),t.watch([N,re],()=>{N.value&&!C.value?se.on("zoom",null):N.value||se.on("zoom",Y=>{T.value={x:Y.transform.x,y:Y.transform.y,zoom:Y.transform.k};const ke=Se(Y.transform);w=de(re.value,S??0),k.viewportChange(ke),k.move({event:Y,flowTransform:ke})})},{immediate:!0}),t.watch([N,pe,d,J,p,b,f],()=>{pe.value&&!J.value&&!N.value?fe.on("wheel.zoom",Y=>{if(me(Y,f.value))return!1;const ke=J.value||y.value,be=p.value&&Y.ctrlKey;if(!(!b.value||pe.value||ke||be))return!1;Y.preventDefault(),Y.stopImmediatePropagation();const ve=fe.property("__zoom").k||1,U=bi();if(!z.value&&Y.ctrlKey&&p.value&&U){const W=Kt(Y),ne=Tl(Y),G=ve*2**ne;se.scaleTo(fe,G,W,Y);return}const H=Y.deltaMode===1?20:1;let q=d.value===mi.Vertical?0:Y.deltaX*H,xe=d.value===mi.Horizontal?0:Y.deltaY*H;!U&&Y.shiftKey&&d.value!==mi.Vertical&&!q&&xe&&(q=xe,xe=0),se.translateBy(fe,-(q/ve)*u.value,-(xe/ve)*u.value);const De=Se(fe.property("__zoom"));E&&clearTimeout(E),M.value?(k.move({event:Y,flowTransform:De}),k.viewportChange(De),E=setTimeout(()=>{k.moveEnd({event:Y,flowTransform:De}),k.viewportChangeEnd(De),M.value=!1},150)):(M.value=!0,k.moveStart({event:Y,flowTransform:De}),k.viewportChangeStart(De))},{passive:!1}):typeof O<"u"&&fe.on("wheel.zoom",function(Y,ke){const be=!b.value&&Y.type==="wheel"&&!Y.ctrlKey,Ce=J.value||y.value,ve=p.value&&Y.ctrlKey;if(!Ce&&!c.value&&!ve&&Y.type==="wheel"||be||me(Y,f.value))return null;Y.preventDefault(),O.call(this,Y,ke)},{passive:!1})},{immediate:!0})});function de(ye,ie){return ie===2&&Array.isArray(ye)&&ye.includes(2)}function _e(ye,ie){return ye.x!==ie.x&&!Number.isNaN(ie.x)||ye.y!==ie.y&&!Number.isNaN(ie.y)||ye.zoom!==ie.k&&!Number.isNaN(ie.k)}function Se(ye){return{x:ye.x,y:ye.y,zoom:ye.k}}function me(ye,ie){return ye.target.closest(`.${ie}`)}return(ye,ie)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:V,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(_N,{"is-selecting":Ne.value,"selection-key-pressed":t.unref(K),class:t.normalizeClass({connecting:he.value,dragging:t.unref(I),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(EN,null,{default:t.withCtx(()=>[t.renderSlot(ye.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),IN=["id"],vN=["id"],xN=["id"],CN={name:"A11yDescriptions",compatConfig:{MODE:3}},SN=t.defineComponent({...CN,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(nm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select a node. "+t.toDisplayString(t.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,IN),t.createElementVNode("div",{id:`${t.unref(om)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,vN),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(X1)}-${t.unref(n)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},t.toDisplayString(t.unref(i)),9,xN))],64))}});function RN(){const e=je();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function $N(e,n,o){return o===Te.Left?e-n:o===Te.Right?e+n:e}function AN(e,n,o){return o===Te.Top?e-n:o===Te.Bottom?e+n:e}const jl=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=Te.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:$N(n,e,i),cy:AN(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};jl.props=["radius","centerX","centerY","position","type"],jl.compatConfig={MODE:3};const Xm=jl,TN=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:b,edgesUpdatable:f,edgesFocusable:g,hooks:k}=je(),_=t.computed(()=>u(e.id)),{emit:N,on:I}=C0(_.value,r),A=t.inject(Oa),x=t.getCurrentInstance(),$=t.ref(!1),T=t.ref(!1),V=t.ref(""),R=t.ref(null),C=t.ref("source"),M=t.ref(null),E=t.toRef(()=>typeof _.value.selectable>"u"?b.value:_.value.selectable),w=t.toRef(()=>typeof _.value.updatable>"u"?f.value:_.value.updatable),S=t.toRef(()=>typeof _.value.focusable>"u"?g.value:_.value.focusable);t.provide(I0,e.id),t.provide(v0,M);const B=t.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),z=t.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),K=t.computed(()=>{const L=_.value.type||"default",F=A==null?void 0:A[`edge-${L}`];if(F)return F;let Q=_.value.template??c.value[L];if(typeof Q=="string"&&x){const Y=Object.keys(x.appContext.components);Y&&Y.includes(L)&&(Q=t.resolveComponent(L,!1))}return Q&&typeof Q!="string"?Q:(r.error(new ut(st.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:J}=Om({nodeId:V,handleId:R,type:C,isValidConnection:h,edgeUpdaterType:C,onEdgeUpdate:ce,onEdgeUpdateEnd:Ne});return()=>{const L=m(_.value.source),F=m(_.value.target),Q="pathOptions"in _.value?_.value.pathOptions:{};if(!L&&!F)return r.error(new ut(st.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!L)return r.error(new ut(st.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!F)return r.error(new ut(st.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||L.hidden||F.hidden)return null;let Y;i.value===cn.Strict?Y=L.handleBounds.source:Y=[...L.handleBounds.source||[],...L.handleBounds.target||[]];const ke=Im(Y,_.value.sourceHandle);let be;i.value===cn.Strict?be=F.handleBounds.target:be=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const Ce=Im(be,_.value.targetHandle),ve=(ke==null?void 0:ke.position)||Te.Bottom,U=(Ce==null?void 0:Ce.position)||Te.Top,{x:H,y:q}=Ao(L,ke,ve),{x:xe,y:De}=Ao(F,Ce,U);return _.value.sourceX=H,_.value.sourceY=q,_.value.targetX=xe,_.value.targetY=De,t.h("g",{ref:M,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${K.value===!1?"default":_.value.type||"default"}`,s.value,B.value,{updating:$.value,selected:_.value.selected,animated:_.value.animated,inactive:!E.value&&!k.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":S.value?`${om}-${n}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",..._.value.domAttributes,onClick:de,onContextmenu:_e,onDblclick:Se,onMouseenter:me,onMousemove:ye,onMouseleave:ie,onKeyDown:S.value?O:void 0},[T.value?null:t.h(K.value===!1?c.value.default:K.value,{id:e.id,sourceNode:L,targetNode:F,source:_.value.source,target:_.value.target,type:_.value.type,updatable:w.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...I},style:z.value,markerStart:`url('#${gi(_.value.markerStart,n)}')`,markerEnd:`url('#${gi(_.value.markerEnd,n)}')`,sourcePosition:ve,targetPosition:U,sourceX:H,sourceY:q,targetX:xe,targetY:De,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...Q}),[w.value==="source"||w.value===!0?[t.h("g",{onMousedown:se,onMouseenter:re,onMouseout:pe},t.h(Xm,{position:ve,centerX:H,centerY:q,radius:a.value,type:"source","data-type":"source"}))]:null,w.value==="target"||w.value===!0?[t.h("g",{onMousedown:fe,onMouseenter:re,onMouseout:pe},t.h(Xm,{position:U,centerX:xe,centerY:De,radius:a.value,type:"target","data-type":"target"}))]:null]])};function re(){$.value=!0}function pe(){$.value=!1}function ce(L,F){N.update({event:L,edge:_.value,connection:F})}function Ne(L){N.updateEnd({event:L,edge:_.value}),T.value=!1}function he(L,F){L.button===0&&(T.value=!0,V.value=F?_.value.target:_.value.source,R.value=(F?_.value.targetHandle:_.value.sourceHandle)??null,C.value=F?"target":"source",N.updateStart({event:L,edge:_.value}),J(L))}function de(L){var F;const Q={event:L,edge:_.value};E.value&&(l.value=!1,_.value.selected&&p.value?(d([_.value]),(F=M.value)==null||F.blur()):o([_.value])),N.click(Q)}function _e(L){N.contextMenu({event:L,edge:_.value})}function Se(L){N.doubleClick({event:L,edge:_.value})}function me(L){N.mouseEnter({event:L,edge:_.value})}function ye(L){N.mouseMove({event:L,edge:_.value})}function ie(L){N.mouseLeave({event:L,edge:_.value})}function se(L){he(L,!0)}function fe(L){he(L,!1)}function O(L){var F;!y.value&&im.includes(L.key)&&E.value&&(L.key==="Escape"?((F=M.value)==null||F.blur(),d([u(e.id)])):o([u(e.id)]))}}}),MN=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=je(),h=(e=t.inject(Oa))==null?void 0:e["connection-line"],p=t.computed(()=>{var k;return m((k=i.value)==null?void 0:k.nodeId)}),y=t.computed(()=>{var k;return m((k=a.value)==null?void 0:k.nodeId)??null}),b=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),f=t.computed(()=>c.value.markerStart?`url(#${gi(c.value.markerStart,n)})`:""),g=t.computed(()=>c.value.markerEnd?`url(#${gi(c.value.markerEnd,n)})`:"");return()=>{var k,_,N;if(!p.value||!i.value)return null;const I=i.value.id,A=i.value.type,x=p.value.handleBounds;let $=(x==null?void 0:x[A])??[];if(o.value===cn.Loose){const z=(x==null?void 0:x[A==="source"?"target":"source"])??[];$=[...$,...z]}if(!$)return null;const T=(I?$.find(z=>z.id===I):$[0])??null,V=(T==null?void 0:T.position)??Te.Top,{x:R,y:C}=Ao(p.value,T,V);let M=null;y.value&&(o.value===cn.Strict?M=((k=y.value.handleBounds[A==="source"?"target":"source"])==null?void 0:k.find(z=>{var K;return z.id===((K=a.value)==null?void 0:K.id)}))||null:M=((_=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:_.find(z=>{var K;return z.id===((K=a.value)==null?void 0:K.id)}))||null);const E=((N=a.value)==null?void 0:N.position)??(V?Ol[V]:null);if(!V||!E)return null;const w=l.value??c.value.type??Gn.Bezier;let S="";const B={sourceX:R,sourceY:C,sourcePosition:V,targetX:b.value.x,targetY:b.value.y,targetPosition:E};return w===Gn.Bezier?[S]=Km(B):w===Gn.Step?[S]=Hl({...B,borderRadius:0}):w===Gn.SmoothStep?[S]=Hl(B):w===Gn.SimpleBezier?[S]=Ym(B):S=`M${R},${C} ${b.value.x},${b.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},h?t.h(h,{sourceX:R,sourceY:C,sourcePosition:V,targetX:b.value.x,targetY:b.value.y,targetPosition:E,sourceNode:p.value,sourceHandle:T,targetNode:y.value,targetHandle:M,markerEnd:g.value,markerStart:f.value,connectionStatus:d.value}):t.h("path",{d:S,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":g.value,"marker-start":f.value})))}}}),VN=["id","markerWidth","markerHeight","markerUnits","orient"],BN={name:"MarkerType",compatConfig:{MODE:3}},DN=t.defineComponent({...BN,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("marker",{id:n.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${n.width}`,markerHeight:`${n.height}`,markerUnits:n.markerUnits,orient:n.orient},[n.type===t.unref(Rl).ArrowClosed?(t.openBlock(),t.createElementBlock("polyline",{key:0,style:t.normalizeStyle({stroke:n.color,fill:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):t.createCommentVNode("",!0),n.type===t.unref(Rl).Arrow?(t.openBlock(),t.createElementBlock("polyline",{key:1,style:t.normalizeStyle({stroke:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):t.createCommentVNode("",!0)],8,VN))}}),LN={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},ON={name:"MarkerDefinitions",compatConfig:{MODE:3}},PN=t.defineComponent({...ON,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=je(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=gi(d,n);l.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),l.add(u))}};for(const d of[i.value.markerEnd,i.value.markerStart])c(d);for(const d of o.value)for(const u of[d.markerStart,d.markerEnd])c(u);return s.sort((d,u)=>d.id.localeCompare(u.id))});return(l,s)=>(t.openBlock(),t.createElementBlock("svg",LN,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(DN,{id:c.id,key:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,"stroke-width":c.strokeWidth,orient:c.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),zN={name:"Edges",compatConfig:{MODE:3}},FN=t.defineComponent({...zN,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(PN),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),l=>(t.openBlock(),t.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:t.normalizeStyle({zIndex:t.unref(m0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(TN),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(MN))],64))}}),UN=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:b,snapToGrid:f,snapGrid:g,nodeDragThreshold:k,nodesDraggable:_,elementsSelectable:N,nodesConnectable:I,nodesFocusable:A,hooks:x}=je(),$=t.ref(null);t.provide(Dm,$),t.provide(Bm,e.id);const T=t.inject(Oa),V=t.getCurrentInstance(),R=zm(),{node:C,parentNode:M}=Pm(e.id),{emit:E,on:w}=A0(C,l),S=t.toRef(()=>typeof C.draggable>"u"?_.value:C.draggable),B=t.toRef(()=>typeof C.selectable>"u"?N.value:C.selectable),z=t.toRef(()=>typeof C.connectable>"u"?I.value:C.connectable),K=t.toRef(()=>typeof C.focusable>"u"?A.value:C.focusable),J=t.computed(()=>B.value||S.value||x.value.nodeClick.hasListeners()||x.value.nodeDoubleClick.hasListeners()||x.value.nodeMouseEnter.hasListeners()||x.value.nodeMouseMove.hasListeners()||x.value.nodeMouseLeave.hasListeners()),re=t.toRef(()=>!!C.dimensions.width&&!!C.dimensions.height),pe=t.computed(()=>{const F=C.type||"default",Q=T==null?void 0:T[`node-${F}`];if(Q)return Q;let Y=C.template||m.value[F];if(typeof Y=="string"&&V){const ke=Object.keys(V.appContext.components);ke&&ke.includes(F)&&(Y=t.resolveComponent(F,!1))}return Y&&typeof Y!="string"?Y:(l.error(new ut(st.NODE_TYPE_MISSING,Y)),!1)}),ce=Lm({id:e.id,el:$,disabled:()=>!S.value,selectable:B,dragHandle:()=>C.dragHandle,onStart(F){E.dragStart(F)},onDrag(F){E.drag(F)},onStop(F){E.dragStop(F)},onClick(F){O(F)}}),Ne=t.computed(()=>C.class instanceof Function?C.class(C):C.class),he=t.computed(()=>{const F=(C.style instanceof Function?C.style(C):C.style)||{},Q=C.width instanceof Function?C.width(C):C.width,Y=C.height instanceof Function?C.height(C):C.height;return!F.width&&Q&&(F.width=typeof Q=="string"?Q:`${Q}px`),!F.height&&Y&&(F.height=typeof Y=="string"?Y:`${Y}px`),F}),de=t.toRef(()=>Number(C.zIndex??he.value.zIndex??0));return u(F=>{(F.includes(e.id)||!F.length)&&Se()}),t.onMounted(()=>{t.watch(()=>C.hidden,(F=!1,Q,Y)=>{!F&&$.value&&(e.resizeObserver.observe($.value),Y(()=>{$.value&&e.resizeObserver.unobserve($.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>C.type,()=>C.sourcePosition,()=>C.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:$.value,forceUpdate:!0}])})}),t.watch([()=>C.position.x,()=>C.position.y,()=>{var F;return(F=M.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=M.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=M.value)==null?void 0:F.computedPosition.z},de,()=>C.selected,()=>C.dimensions.height,()=>C.dimensions.width,()=>{var F;return(F=M.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=M.value)==null?void 0:F.dimensions.width}],([F,Q,Y,ke,be,Ce])=>{const ve={x:F,y:Q,z:Ce+(p.value&&C.selected?1e3:0)};typeof Y<"u"&&typeof ke<"u"?C.computedPosition=r0({x:Y,y:ke,z:be},ve):C.computedPosition=ve},{flush:"post",immediate:!0}),t.watch([()=>C.extent,h],([F,Q],[Y,ke])=>{(F!==Y||Q!==ke)&&_e()}),C.extent==="parent"||typeof C.extent=="object"&&"range"in C.extent&&C.extent.range==="parent"?ll(()=>re).toBe(!0).then(_e):_e(),()=>C.hidden?null:t.h("div",{ref:$,"data-id":C.id,class:["vue-flow__node",`vue-flow__node-${pe.value===!1?"default":C.type||"default"}`,{[o.value]:S.value,dragging:ce==null?void 0:ce.value,draggable:S.value,selected:C.selected,selectable:B.value,parent:C.isParent},Ne.value],style:{visibility:re.value?"visible":"hidden",zIndex:C.computedPosition.z??de.value,transform:`translate(${C.computedPosition.x}px,${C.computedPosition.y}px)`,pointerEvents:J.value?"all":"none",...he.value},tabIndex:K.value?0:void 0,role:K.value?"group":void 0,"aria-describedby":y.value?void 0:`${nm}-${n}`,"aria-label":C.ariaLabel,"aria-roledescription":"node",...C.domAttributes,onMouseenter:me,onMousemove:ye,onMouseleave:ie,onContextmenu:se,onClick:O,onDblclick:fe,onKeydown:L},[t.h(pe.value===!1?m.value.default:pe.value,{id:C.id,type:C.type,data:C.data,events:{...C.events,...w},selected:C.selected,resizing:C.resizing,dragging:ce.value,connectable:z.value,position:C.computedPosition,dimensions:C.dimensions,isValidTargetPos:C.isValidTargetPos,isValidSourcePos:C.isValidSourcePos,parent:C.parentNode,parentNodeId:C.parentNode,zIndex:C.computedPosition.z??de.value,targetPosition:C.targetPosition,sourcePosition:C.sourcePosition,label:C.label,dragHandle:C.dragHandle,onUpdateNodeInternals:Se})]);function _e(){const F=C.computedPosition,{computedPosition:Q,position:Y}=Bl(C,f.value?La(F,g.value):F,l.error,h.value,M.value);(C.computedPosition.x!==Q.x||C.computedPosition.y!==Q.y)&&(C.computedPosition={...C.computedPosition,...Q}),(C.position.x!==Y.x||C.position.y!==Y.y)&&(C.position=Y)}function Se(){$.value&&d([{id:e.id,nodeElement:$.value,forceUpdate:!0}])}function me(F){ce!=null&&ce.value||E.mouseEnter({event:F,node:C})}function ye(F){ce!=null&&ce.value||E.mouseMove({event:F,node:C})}function ie(F){ce!=null&&ce.value||E.mouseLeave({event:F,node:C})}function se(F){return E.contextMenu({event:F,node:C})}function fe(F){return E.doubleClick({event:F,node:C})}function O(F){B.value&&(!i.value||!S.value||k.value>0)&&Pl(C,r.value,c,s,a,!1,$.value),E.click({event:F,node:C})}function L(F){if(!($l(F)||y.value))if(im.includes(F.key)&&B.value){const Q=F.key==="Escape";Pl(C,r.value,c,s,a,Q,$.value)}else S.value&&C.selected&&Ro[F.key]&&(F.preventDefault(),b.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~C.position.x}, y: ${~~C.position.y}`,R({x:Ro[F.key].x,y:Ro[F.key].y},F.shiftKey))}}});function HN(e={includeHiddenNodes:!1}){const{nodes:n}=je();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const jN={class:"vue-flow__nodes vue-flow__container"},KN={name:"Nodes",compatConfig:{MODE:3}},GN=t.defineComponent({...KN,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=je(),a=HN(),r=t.ref();return t.watch(a,l=>{l&&t.nextTick(()=>{i.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",jN,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const h=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,h))return m;const p=(t.openBlock(),t.createBlock(t.unref(UN),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=h,p},s,0),128)):t.createCommentVNode("",!0)]))}});function YN(){const{emits:e}=je();t.onMounted(()=>{if(Rm()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new ut(st.MISSING_STYLES))}})}const qN=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),WN={name:"VueFlow",compatConfig:{MODE:3}},JN=t.defineComponent({...WN,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:n,emit:o}){const i=e,a=t.useSlots(),r=sl(i,"modelValue",o),l=sl(i,"nodes",o),s=sl(i,"edges",o),c=je(i),d=B0({modelValue:r,nodes:l,edges:s},i,c);return L0(o,c.hooks),RN(),YN(),t.provide(Oa,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(wN,null,{default:t.withCtx(()=>[t.createVNode(FN),qN,t.createVNode(GN),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(SN)],512))}}),XN={name:"Panel",compatConfig:{MODE:3}},Zm=t.defineComponent({...XN,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=je(),i=t.computed(()=>`${n.position}`.split("-"));return(a,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",i.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(a.$slots,"default")],6))}}),ZN=["width","height","innerHTML"],QN=t.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const n={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(t.openBlock(),t.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:n[e.name]??""},null,8,ZN))}}),Ke=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ae=Ke(QN,[["__scopeId","data-v-05aac699"]]),Zn=["red","amber","green","teal","blue","indigo","violet","pink"],Qm={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function ew(e){return typeof e=="string"&&e in Qm}const tw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},nw=.15;function ow(e){const n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n)return null;let o=n[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,r=parseInt(o.slice(4,6),16)/255,l=Math.max(i,a,r),s=Math.min(i,a,r),c=l-s,d=(l+s)/2;let u=0,m=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),l===i?m=(a-r)/c%6:l===a?m=(r-i)/c+2:m=(i-a)/c+4,m*=60,m<0&&(m+=360)),{h:m,s:u,l:d}}function iw(e){if(typeof e!="string")return null;const n=ow(e);if(!n||n.s<nw)return null;let o=null,i=1/0;for(const a of Zn){const r=Math.abs(n.h-tw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function _t(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(ew(n))return n;const o=e==null?void 0:e.properties;return iw((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Kl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const aw={red:"var(--em-swatch-red-bar)",amber:"var(--em-swatch-amber-bar)",green:"var(--em-swatch-green-bar)",teal:"var(--em-swatch-teal-bar)",blue:"var(--em-swatch-blue-bar)",indigo:"var(--em-swatch-indigo-bar)",violet:"var(--em-swatch-violet-bar)",pink:"var(--em-swatch-pink-bar)"},rw={red:"color-mix(in srgb, var(--em-swatch-red-bar) 22%, transparent)",amber:"color-mix(in srgb, var(--em-swatch-amber-bar) 22%, transparent)",green:"color-mix(in srgb, var(--em-swatch-green-bar) 22%, transparent)",teal:"color-mix(in srgb, var(--em-swatch-teal-bar) 22%, transparent)",blue:"color-mix(in srgb, var(--em-swatch-blue-bar) 22%, transparent)",indigo:"color-mix(in srgb, var(--em-swatch-indigo-bar) 22%, transparent)",violet:"color-mix(in srgb, var(--em-swatch-violet-bar) 22%, transparent)",pink:"color-mix(in srgb, var(--em-swatch-pink-bar) 22%, transparent)"};function ef(e,n=!1){return e?n?rw[e]:aw[e]:null}function Qn(e){return Qm[e]}function To(e){return`var(--em-swatch-${e}-bar)`}function lw(e){switch(e.split("-")[1]){case"NAME":return"em.check.catName";case"JPA":return"em.check.catJpa";case"TYPE":return"em.check.catType";case"DSN":return"em.check.catDsn";default:return null}}function sw(e,n){const o=lw(n);return o?e(o):n.split("-")[1]??n}function cw(e){var o,i,a;const n=r=>e.params!=null&&r in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-TYPE-6":return"em.check.type6";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function tf(e,n){const o=cw(n);if(n.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=n.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,n.params)}function dw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const uw={class:"em-inline-issue__msgs"},eo=Ke(t.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const n=e,o=n.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=t.computed(()=>n.refId?n.controller.issuesByRef.value.get(n.refId)??[]:[]),r=t.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(t.openBlock(),t.createElementBlock("p",{key:0,class:t.normalizeClass(["em-inline-issue",`is-${r.value}`])},[t.createVNode(Ae,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",uw,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(c,d)=>(t.openBlock(),t.createElementBlock("span",{key:d},t.toDisplayString(t.unref(tf)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),mw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],fw={key:0,class:"em-mlang__dot"},pw=["id","role","aria-labelledby"],hw=["title"],dn=Ke(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const g=o.defaultLang;return g&&o.languages.includes(g)?g:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const g=o.activeLang;return g&&o.languages.includes(g)?g:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(g){var k,_;return!!((_=(k=o.modelValue)==null?void 0:k[g])!=null&&_.trim())}const d=g=>`${o.name}-tab-${g}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function h(g){var N,I;const k=o.languages,_=k[(g+k.length)%k.length];_&&(l.value=_,await t.nextTick(),(I=(N=m.value)==null?void 0:N.querySelectorAll('[role="tab"]')[k.indexOf(_)])==null||I.focus())}function p(g){h(o.languages.indexOf(s.value)+g)}const y=t.computed(()=>o.languages.filter(g=>{var k,_;return g!==s.value&&!!((_=(k=o.modelValue)==null?void 0:k[g])!=null&&_.trim())})),b=t.computed(()=>{var g;return((g=o.modelValue)==null?void 0:g[s.value])??""});function f(g){const k={...o.modelValue};g.trim()===""?delete k[s.value]:k[s.value]=g,i("update:modelValue",k)}return(g,k)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,_=>(t.openBlock(),t.createElementBlock("span",{id:d(_),key:_,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===_}]),role:"tab","aria-selected":s.value===_,"aria-controls":u.value,tabindex:s.value===_?0:-1,onClick:N=>l.value=_,onKeydown:[t.withKeys(t.withModifiers(N=>l.value=_,["prevent"]),["enter"]),t.withKeys(t.withModifiers(N=>l.value=_,["prevent"]),["space"]),k[0]||(k[0]=t.withKeys(t.withModifiers(N=>p(-1),["prevent"]),["left"])),k[1]||(k[1]=t.withKeys(t.withModifiers(N=>p(1),["prevent"]),["right"])),k[2]||(k[2]=t.withKeys(t.withModifiers(N=>h(0),["prevent"]),["home"])),k[3]||(k[3]=t.withKeys(t.withModifiers(N=>h(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(_),1),c(_)?(t.openBlock(),t.createElementBlock("span",fw,"•")):t.createCommentVNode("",!0)],42,mw))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(te.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":b.value,"onUpdate:modelValue":f},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":b.value,"onUpdate:modelValue":f},null,8,["name","placeholder","model-value"]))],8,pw),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,hw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),yw=["disabled"],gw={class:"em-panel__sub-label"},bw={class:"em-field"},_w={class:"em-field"},kw={class:"em-field"},Ew={class:"em-class"},Nw={class:"em-field"},ww={class:"em-field"},Iw={class:"em-field"},vw={class:"em-field"},xw={class:"em-multilang"},Cw={class:"em-multilang"},Sw={class:"em-jpa"},Rw={class:"em-field"},$w={class:"em-field"},Aw={class:"em-field"},Tw={class:"em-swatch"},Mw={class:"em-swatch__row"},Vw=["title"],Bw=["title","onClick"],nf=Ke(t.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(C=>C.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(C=>C.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var C;return _t(((C=l.value)==null?void 0:C.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],m=C=>C;function h(C){return C==="inherit"?a.t("em.common.inherit"):C}function p(C){r.value&&a.updateEntity(r.value.modelId,C)}function y(C,M,E){var S;const w=((S=r.value)==null?void 0:S.table)??{physicalName:""};p(C==="physicalName"?{table:{...w,physicalName:E}}:{table:{...w,logicalName:{...w.logicalName,[M]:E}}})}function b(C){p({description:Object.keys(C).length?C:void 0})}function f(C,M){var E;p({jpaAttrs:{...(E=r.value)==null?void 0:E.jpaAttrs,[C]:M}})}function g(C,M){f(C,M)}const k=t.computed(()=>{var C,M;return((M=(C=r.value)==null?void 0:C.jpaAttrs)==null?void 0:M.discriminatorType)??"inherit"}),_=t.computed(()=>{var C,M;return!((M=(C=r.value)==null?void 0:C.jpaAttrs)!=null&&M.useDiscriminator)});function N(C){f("discriminatorType",C==="inherit"?void 0:C)}function I(C){p({hasPersonalInfo:C})}function A(C){p({superClass:C.trim()||void 0})}function x(C){p({schema:C.trim()||void 0})}function $(C){p({abstractClass:C})}const T=t.computed(()=>{var C,M;return((M=(C=r.value)==null?void 0:C.declarationOfInterfaces)==null?void 0:M.join(", "))??""});function V(C){const M=C.split(",").map(E=>E.trim()).filter(Boolean);p({declarationOfInterfaces:M.length?M:void 0})}function R(C){r.value&&a.setEntitySwatch(r.value.modelId,C)}return(C,M)=>{var E,w,S;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:M[0]||(M[0]=B=>i("toggle"))},[t.createElementVNode("span",gw,[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString(e.title||r.value.name||t.unref(a).t("em.entity.fallback")),1)])])):t.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(eo,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",bw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":M[1]||(M[1]=B=>p({name:B}))},null,8,["model-value"])]),t.createElementVNode("label",_w,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":t.unref(jo),"onUpdate:modelValue":M[2]||(M[2]=B=>p({stereotype:B}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",kw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":M[3]||(M[3]=B=>p({packageName:B}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Ew,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Nw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":M[4]||(M[4]=B=>A(B))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",ww,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":T.value,"onUpdate:modelValue":M[5]||(M[5]=B=>V(B))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":M[6]||(M[6]=B=>$(B))},null,8,["label","model-value"])]),t.createElementVNode("label",Iw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-table",width:"100%","model-value":((E=r.value.table)==null?void 0:E.physicalName)??"","onUpdate:modelValue":M[7]||(M[7]=B=>y("physicalName",null,B))},null,8,["model-value"])]),t.createElementVNode("label",vw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":M[8]||(M[8]=B=>x(B))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",xw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.tableLogicalLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,B=>{var z,K;return t.openBlock(),t.createElementBlock("label",{key:B,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(B),1),t.createVNode(t.unref(te.BSTextInput),{name:`ent-logical-${B}`,width:"100%","model-value":((K=(z=r.value.table)==null?void 0:z.logicalName)==null?void 0:K[B])??"","onUpdate:modelValue":J=>y("logicalName",B,J)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",Cw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":b},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",Sw,[M[13]||(M[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,B=>{var z;return t.createVNode(t.unref(te.BSCheckbox),{key:B.key,name:`jpa-${B.key}`,class:"em-check",label:B.label,"model-value":!!((z=r.value.jpaAttrs)!=null&&z[B.key]),"onUpdate:modelValue":K=>g(B.key,K)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",Rw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(te.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:_.value,"model-value":((w=r.value.jpaAttrs)==null?void 0:w.discriminatorColumnName)??"","onUpdate:modelValue":M[9]||(M[9]=B=>f("discriminatorColumnName",B.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",$w,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(te.BSSelect),{disabled:_.value,"model-value":k.value,items:u,"value-provider":m,"label-provider":h,"onUpdate:modelValue":M[10]||(M[10]=B=>B&&N(B))},null,8,["disabled","model-value"])]),t.createElementVNode("label",Aw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(te.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:_.value,"model-value":(S=r.value.jpaAttrs)==null?void 0:S.discriminatorLength,"onUpdate:modelValue":M[11]||(M[11]=B=>f("discriminatorLength",B||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(te.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":I},null,8,["label","model-value"]),t.createElementVNode("fieldset",Tw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",Mw,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:M[12]||(M[12]=B=>R(null))},"∅",10,Vw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Zn),B=>(t.openBlock(),t.createElementBlock("button",{key:B,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===B}]),style:t.normalizeStyle({background:t.unref(To)(B)}),title:t.unref(a).t(t.unref(Qn)(B)),onClick:z=>R(B)},null,14,Bw))),128))])])],64)):t.createCommentVNode("",!0)],8,yw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9055ced6"]]),Dw=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"],of=["inherit","true","false"],Ga="__OWN__";function af(e,n){const o=t.computed(()=>e.state.logical.entities.find(W=>W.modelId===n())??null),i=t.computed(()=>{var W;return((W=o.value)==null?void 0:W.stereotype)==="JPA_EMBEDDABLE"}),a=t.computed(()=>new Set(e.selectedAttrIds.value));function r(W){return W==="none"?e.t("em.common.noneParen"):W}const l=W=>W;function s(W,ne){o.value&&e.updateAttribute(o.value.modelId,W.modelId,ne)}function c(W){return!!o.value&&!!Wi(e.state.logical,o.value.modelId,W.modelId)}function d(W,ne){s(W,{naturalId:ne||void 0,naturalIdMutable:ne?W.naturalIdMutable:void 0})}function u(){return{naturalId:void 0,naturalIdMutable:void 0}}function m(W,ne){s(W,{identifier:ne,...ne?u():{}})}function h(W,ne){s(W,{transient:ne||void 0,...ne?u():{}})}function p(W){return!!W.transient||W.attrType==="RELATION_REF"}function y(W){return Bi(W)}function b(W,ne=0){var G;return((G=Di(W,o.value,e.state.logical.entities,e.state.logical.associations,ne))==null?void 0:G.physicalName)||void 0}const f=W=>W.value,g=W=>W.label;function k(W,ne){if(!ne)return;const G=R.value.find(P=>P.type===ne);if(G){const P=W.dbAttrs[0]??{modelId:W.modelId+".c",physicalName:W.name,dataType:"VARCHAR"};s(W,{type:ne,customType:void 0,dbAttrs:[{...P,dataType:G.dataType,length:G.length,scale:G.scale}]});return}s(W,ne===en?{type:ne}:{type:ne,customType:void 0})}function _(W,ne){s(W,{customType:ne.trim()===""?void 0:ne})}function N(W,ne){if(W.attrType==="RELATION_REF")return;const P={...W.dbAttrs[0]??{modelId:W.modelId+".c",physicalName:W.name,dataType:"VARCHAR"},...ne};ne.dataType!==void 0&&!vr.has(P.dataType)&&(P.scale=void 0),s(W,{dbAttrs:[P]})}function I(W){var ne;return vr.has(((ne=W.dbAttrs[0])==null?void 0:ne.dataType)??"")}function A(W){return!I(W)&&!y(W)&&!p(W)?e.t("em.attr.scaleTypeHint"):void 0}function x(W,ne){N(W,{logicalName:Object.keys(ne).length?ne:void 0})}function $(W,ne){s(W,{description:Object.keys(ne).length?ne:void 0})}function T(W){return W.personalInfoAttributeType??"none"}function V(W,ne){s(W,{personalInfoAttributeType:ne==="none"?void 0:ne})}const R=t.computed(()=>e.predefinedCustomTypeCatalog.value),C=t.computed(()=>e.embeddableCatalog.value);function M(W){var ne,G,P;return((ne=W.label)==null?void 0:ne[e.userLanguage.value])??((G=W.label)==null?void 0:G.ko)??((P=W.label)==null?void 0:P.en)??W.type}const E=t.computed(()=>e.groupCodeCatalog.value);function w(W){var ne;return((ne=E.value.find(G=>G.groupCode===W.groupCode))==null?void 0:ne.codes)??[]}function S(W){return["none",...w(W)]}function B(W){return W==="none"?"none":W.code}function z(W){var G,P,ae;if(W==="none")return e.t("em.common.noneParen");const ne=((G=W.label)==null?void 0:G[e.userLanguage.value])??((P=W.label)==null?void 0:P.ko)??((ae=W.label)==null?void 0:ae.en);return ne?`${W.code} (${ne})`:W.code}function K(W,ne){o.value&&e.setAttributeGroupCode(o.value.modelId,W.modelId,ne)}function J(W,ne){s(W,{defaultValue:ne==="none"?void 0:ne})}function re(W,ne){s(W,{defaultValue:ne.trim()===""?void 0:ne})}function pe(W){return W.attrType.startsWith("EMBED")&&W.dbAttrs.length>0}function ce(W,ne,G){const P=W.dbAttrs.map((ae,Re)=>{if(Re!==ne)return ae;const le={...ae,...G};for(const j of Object.keys(G))G[j]===void 0&&delete le[j];return le});o.value&&e.setEmbedColumns(o.value.modelId,W.modelId,P)}function Ne(W,ne,G){ce(W,ne,{logicalName:Object.keys(G).length?G:void 0})}function he(W,ne){var ae,Re,le;if(W.attrType==="EMBED_PREDEF"){const j=(ae=e.embeddableCatalog.value.find(Xe=>Xe.type===W.type))==null?void 0:ae.fields[ne];return j?{name:j.name,physicalName:j.physicalName,dataType:j.dataType,length:j.length,scale:j.scale,shareable:j.shareable,logicalName:j.logicalName}:void 0}const G=(Re=W.embedded)==null?void 0:Re.embeddableRef;if(!G)return;const P=(le=e.state.logical.entities.find(j=>j.modelId===G))==null?void 0:le.attributes.flatMap(j=>j.dbAttrs)[ne];return P?{physicalName:P.physicalName,dataType:P.dataType,length:P.length,scale:P.scale,logicalName:P.logicalName}:void 0}function de(W,ne){var G,P;return((G=he(W,ne))==null?void 0:G.dataType)||((P=W.dbAttrs[ne])==null?void 0:P.dataType)||""}function _e(W,ne){var G,P;return((G=he(W,ne))==null?void 0:G.length)??((P=W.dbAttrs[ne])==null?void 0:P.length)}function Se(W,ne){var G,P;return((G=he(W,ne))==null?void 0:G.scale)??((P=W.dbAttrs[ne])==null?void 0:P.scale)}const me=of;function ye(W){return W==="inherit"?e.t("em.common.inherit"):W}function ie(W){return(W==null?void 0:W.updatable)===void 0?"inherit":W.updatable?"true":"false"}function se(W,ne,G){ce(W,ne,{updatable:G==="inherit"?void 0:G==="true"})}function fe(W,ne){N(W,{updatable:ne==="inherit"?void 0:ne==="true"})}const O=of;function L(W){return W==="inherit"?e.t("em.common.inherit"):W}function F(W){return(W==null?void 0:W.insertable)===void 0?"inherit":W.insertable?"true":"false"}function Q(W,ne,G){ce(W,ne,{insertable:G==="inherit"?void 0:G==="true"})}function Y(W,ne){N(W,{insertable:ne==="inherit"?void 0:ne==="true"})}const ke=t.computed(()=>o.value?Er(o.value,e.state.logical.entities):[]),be=t.computed(()=>so(ke.value.flatMap(W=>W.attributes.flatMap(ne=>ne.dbAttrs)))),Ce=t.computed(()=>ke.value.flatMap(W=>W.attributes.filter(ne=>ne.attrType==="NORMAL"&&ne.dbAttrs.length===1&&ne.dbAttrs[0]).map(ne=>{var G;return{modelId:ne.dbAttrs[0].modelId,physical:ne.dbAttrs[0].physicalName||ne.name,isCurrency:ne.type==="Currency",ownerName:W.modelId===((G=o.value)==null?void 0:G.modelId)?void 0:W.name}})));function ve(){const W=[...Ce.value].sort((ne,G)=>Number(G.isCurrency)-Number(ne.isCurrency));return[Ga,...W.map(ne=>ne.modelId)]}function U(W){if(W===Ga)return e.t("em.attr.sharedOwn");const ne=Ce.value.find(P=>P.modelId===W);if(!ne)return W;const G=ne.ownerName?`${ne.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:G,physical:ne.physical,mode:ne.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function H(W){return(W==null?void 0:W.sharedColumnRef)??Ga}function q(W,ne,G){ce(W,ne,{sharedColumnRef:G===Ga?void 0:G})}function xe(W){return(W==null?void 0:W.sharedColumnRef)!=null}function De(W){var ne;return((ne=Bn(W,be.value))==null?void 0:ne.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:Dw,piiLabel:r,idn:l,setAttr:s,isManagedFk:c,setNaturalId:d,clearNaturalIdPatch:u,setIdentifier:m,setTransient:h,dbLocked:p,fkDerived:y,fkOriginPhysical:b,typeValueOf:f,typeLabelOf:g,setAttrType:k,setAttrCustomType:_,setDb:N,scaleApplicable:I,scaleHint:A,setDbLogical:x,setAttrDescription:$,attrPiiValue:T,setAttrPii:V,predefinedCustomTypeCatalog:R,embeddableCatalog:C,predefinedLabel:M,groupCodeCatalog:E,attrGroupCodes:w,attrCodeItems:S,codeValueOf:B,codeLabelOf:z,setAttrGroupCode:K,setAttrCode:J,setAttrDefaultValue:re,isEmbedExpanded:pe,setDbAt:ce,setDbLogicalAt:Ne,embedColMeta:he,fixedDataType:de,fixedLength:_e,fixedScale:Se,updatableItems:me,updatableLabel:ye,updatableValue:ie,setUpdatableAt:se,setUpdatable:fe,insertableItems:O,insertableLabel:L,insertableValue:F,setInsertableAt:Q,setInsertable:Y,scopeEntities:ke,columnsById:be,sharedCandidates:Ce,sharedItems:ve,sharedLabel:U,sharedValue:H,setSharedAt:q,isShared:xe,sharedPhysical:De}}const rf={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatGroup":"Input format","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.title":"Command palette","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.connectHint":"Drag to connect a relationship to another entity","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every embedded column in this entity","em.node.embedAllShow":"Expand all collapsed embedded columns","em.node.embedAllSummary":"{n} embedded column(s) hidden","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.treeAria":"Diagram tree","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.current":"current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},lf={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.title":"コマンドパレット","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティの埋め込み列をすべて折りたたむ","em.node.embedAllShow":"折りたたまれた埋め込み列をすべて展開","em.node.embedAllSummary":"埋め込み列 {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{name}" — 同じパッケージに同じ名前があります。名前を変えるか、グループ(パッケージ)を分けると解消します',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},sf={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatGroup":"입력 형식","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.title":"명령 팔레트","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 임베드 컬럼 모두 접기","em.node.embedAllShow":"접힌 임베드 컬럼 모두 펼치기","em.node.embedAllSummary":"임베드 컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{name}" — 같은 패키지에 같은 이름이 있습니다. 이름을 바꾸거나 그룹(패키지)을 나누면 해소됩니다',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},Lw=["ko","en","ja"],Gl={ko:sf,en:rf,ja:lf};function Lt(e,n,o){let a=(Gl[e]??Gl.ko)[n]??Gl.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const cf=["ko","en","ja","zh"];function Ow(e){if(e)for(const n of cf){const o=e[n];if(o)return o}}function Yl(e){const n=Ow(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function Pw(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:cf.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const zw=["aria-expanded","placeholder"],Fw=["aria-selected","onClick","onMouseenter"],Uw={key:0,class:"gcc__opt gcc__opt--empty"},df=Ke(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(T,V)=>Lt(o.locale??"ko",T,V),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),h=t.computed(()=>o.items.find(T=>T.groupCode===o.modelValue)),p=t.computed(()=>h.value?Yl(h.value):"");t.watch(p,T=>{d.value||(c.value=T)},{immediate:!0});const y=t.computed(()=>c.value===p.value?o.items:Pw(o.items,c.value));function b(){var V;const T=(V=r.value)==null?void 0:V.getBoundingClientRect();T&&(m.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function f(){d.value=!0,b(),u.value=Math.max(0,y.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),document.addEventListener("mousedown",$)}function g(){d.value=!1,window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b),document.removeEventListener("mousedown",$)}t.onBeforeUnmount(g);function k(){f(),t.nextTick(()=>{var T;return(T=l.value)==null?void 0:T.select()})}function _(){d.value||f(),u.value=0}function N(T){i("update:modelValue",T.groupCode),c.value=Yl(T),g()}function I(){i("update:modelValue",void 0),c.value="",g()}function A(){c.value.trim()===""?I():(c.value=p.value,g())}function x(T){var V;if(T.key==="ArrowDown")d.value||f(),u.value=Math.min(u.value+1,y.value.length-1),T.preventDefault();else if(T.key==="ArrowUp")u.value=Math.max(u.value-1,0),T.preventDefault();else if(T.key==="Enter"){const R=y.value[u.value];R&&N(R),T.preventDefault()}else T.key==="Escape"&&(c.value=p.value,g(),(V=l.value)==null||V.blur())}function $(T){var R,C;const V=T.target;!((R=r.value)!=null&&R.contains(V))&&!((C=s.value)!=null&&C.contains(V))&&A()}return(T,V)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":V[0]||(V[0]=R=>c.value=R),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:k,onInput:_,onKeydown:x},null,40,zw),[[t.vModelText,c.value]]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[d.value?(t.openBlock(),t.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:t.normalizeStyle(m.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:V[1]||(V[1]=t.withModifiers(()=>{},["prevent"])),onClick:I},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(R,C)=>(t.openBlock(),t.createElementBlock("li",{key:R.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":C===u.value,"is-selected":R.groupCode===e.modelValue}]),role:"option","aria-selected":R.groupCode===e.modelValue,onMousedown:V[2]||(V[2]=t.withModifiers(()=>{},["prevent"])),onClick:M=>N(R),onMouseenter:M=>u.value=C},t.toDisplayString(t.unref(Yl)(R)),43,Fw))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Uw,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),Hw=["aria-labelledby"],jw=["aria-checked","tabindex","onClick","onKeydown"],uf=Ke(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,jw))),128))],8,Hw))}}),[["__scopeId","data-v-5c793bbb"]]),Kw=["disabled"],Gw={class:"em-aw__toolbar"},Yw={class:"em-aw__count"},qw={class:"em-aw__scroll"},Ww={class:"em-aw__table"},Jw={class:"c-name"},Xw={class:"c-type"},Zw={class:"c-logical"},Qw=["id"],eI={class:"c-col"},tI={class:"c-constraints"},nI={class:"c-del"},oI={class:"c-expand"},iI=["title","onClick","onKeydown"],aI=["title"],rI={key:1,class:"em-aw__muted"},lI=["title"],sI=["title"],cI=["title"],dI={class:"em-aw__cflags"},uI=["title"],mI={colspan:"8"},fI={class:"em-aw__detail"},pI={class:"em-aw__dgroup"},hI=["title"],yI={class:"em-aw__df"},gI={class:"em-aw__df"},bI={class:"em-aw__dgroup"},_I={key:0,class:"em-aw__dgroup"},kI={class:"em-aw__df"},EI={key:0,class:"em-aw__df"},NI={class:"em-aw__df"},wI={class:"em-aw__dgroup em-aw__ddesc"},II={class:"c-expand"},vI={class:"em-aw__caret is-static","aria-hidden":"true"},xI={class:"c-del"},CI={class:"c-expand"},SI=["title","onClick","onKeydown"],RI={class:"em-aw__embed-label"},$I=["title"],AI=["title"],TI={class:"em-aw__ro"},MI=["title"],VI={class:"em-aw__ro"},BI=["title"],DI={class:"em-aw__ro"},LI={key:0,class:"em-aw__detail-row em-aw__embed-detail"},OI={colspan:"8"},PI={class:"em-aw__detail"},zI={class:"em-aw__dgroup"},FI={key:0,class:"em-aw__df"},UI={class:"em-aw__df"},HI={class:"em-aw__df"},jI={key:0},KI={colspan:"99",class:"em-aw__empty"},GI=6,YI=5,qI=Ke(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:h,setTransient:p,dbLocked:y,fkDerived:b,fkOriginPhysical:f,typeValueOf:g,typeLabelOf:k,setAttrType:_,setAttrCustomType:N,setDb:I,scaleApplicable:A,scaleHint:x,setDbLogical:$,attrPiiValue:T,setAttrPii:V,predefinedCustomTypeCatalog:R,embeddableCatalog:C,predefinedLabel:M,groupCodeCatalog:E,attrGroupCodes:w,attrCodeItems:S,codeValueOf:B,codeLabelOf:z,setAttrGroupCode:K,setAttrCode:J,setAttrDefaultValue:re,setAttrDescription:pe,isEmbedExpanded:ce,setDbAt:Ne,setDbLogicalAt:he,embedColMeta:de,fixedDataType:_e,fixedLength:Se,fixedScale:me,updatableItems:ye,updatableLabel:ie,updatableValue:se,setUpdatableAt:fe,setUpdatable:O,insertableItems:L,insertableLabel:F,insertableValue:Q,setInsertableAt:Y,setInsertable:ke,sharedItems:be,sharedLabel:Ce,sharedValue:ve,setSharedAt:U,isShared:H,sharedPhysical:q}=af(o,()=>n.entityId),xe=t.computed(()=>{var Re;return[...((Re=i.value)==null?void 0:Re.attributes)??[]].sort((le,j)=>le.order-j.order)}),De=t.computed(()=>{var Re;return(((Re=i.value)==null?void 0:Re.attributes)??[]).filter(le=>le.attrType!=="DIVIDER").length}),W=t.ref(new Set);function ne(Re){return W.value.has(Re)}function G(Re){const le=new Set(W.value);le.has(Re)?le.delete(Re):le.add(Re),W.value=le}const P=t.ref(o.userLanguage.value);function ae(Re){!Re||!i.value||o.addPredefinedEmbed(i.value.modelId,Re)}return(Re,le)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",Gw,[t.createElementVNode("span",Yw,t.toDisplayString(t.unref(o).t("em.attr.section",{n:De.value})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:le[0]||(le[0]=j=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:le[1]||(le[1]=j=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(C).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(C),"value-provider":j=>j.type,"label-provider":t.unref(M),"onUpdate:modelValue":ae},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",qw,[t.createElementVNode("table",Ww,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[le[3]||(le[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",Jw,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",Xw,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",Zw,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,Qw),t.createVNode(uf,{modelValue:P.value,"onUpdate:modelValue":le[2]||(le[2]=j=>P.value=j),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",eI,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),le[4]||(le[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),le[5]||(le[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",tI,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),le[6]||(le[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(xe.value,j=>{var Xe,rt,He,Pe,Oe,X,Nt,Et,yn,gn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:j.modelId},[j.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(j.modelId)}])},[le[7]||(le[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-divlabel-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":j.name,"onUpdate:modelValue":Ee=>t.unref(d)(j,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:GI,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",nI,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,j.modelId)},null,8,["onClick"])])],2)):t.unref(ce)(j)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(j.modelId)}])},[t.createElementVNode("td",II,[t.createElementVNode("span",vI,[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":j.name,"onUpdate:modelValue":Ee=>t.unref(d)(j,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-type-${j.modelId}`,width:"100%",disabled:"","model-value":j.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:YI,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:j.dbAttrs.length})),1),t.createElementVNode("td",xI,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,j.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(j.dbAttrs,(Ee,nt)=>{var mt,Ft,Zt,Qt,we,et,ft,bn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Ee.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":ne(Ee.modelId)}])},[t.createElementVNode("td",CI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ne(Ee.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ne(Ee.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:ot=>G(Ee.modelId),onKeydown:[t.withKeys(t.withModifiers(ot=>G(Ee.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ot=>G(Ee.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,SI)]),t.createElementVNode("td",RI,"↳ "+t.toDisplayString(((mt=t.unref(de)(j,nt))==null?void 0:mt.name)??((Ft=t.unref(de)(j,nt))==null?void 0:Ft.physicalName)??t.unref(o).t("em.attr.colFallback",{n:nt+1})),1),le[14]||(le[14]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(dn,{name:`aw-embed-logical-${Ee.modelId}`,languages:t.unref(o).languages.value,"active-lang":P.value,placeholder:((Qt=(Zt=t.unref(de)(j,nt))==null?void 0:Zt.logicalName)==null?void 0:Qt[P.value])??((et=(we=t.unref(de)(j,nt))==null?void 0:we.logicalName)==null?void 0:et.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ee.logicalName,"onUpdate:modelValue":ot=>t.unref(he)(j,nt,ot)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(H)(Ee)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-embed-col-${Ee.modelId}`,width:"100%",disabled:t.unref(H)(Ee),placeholder:((ft=t.unref(de)(j,nt))==null?void 0:ft.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(H)(Ee)?t.unref(q)(Ee):Ee.physicalName,"onUpdate:modelValue":ot=>t.unref(Ne)(j,nt,{physicalName:ot})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(eo,{controller:t.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"])],8,$I),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",TI,t.toDisplayString(t.unref(_e)(j,nt)),1)],8,AI),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",VI,t.toDisplayString(t.unref(Se)(j,nt)??""),1)],8,MI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",DI,t.toDisplayString(t.unref(me)(j,nt)!=null?`scale ${t.unref(me)(j,nt)}`:""),1)],8,BI),le[15]||(le[15]=t.createElementVNode("td",null,null,-1))],2),ne(Ee.modelId)?(t.openBlock(),t.createElementBlock("tr",LI,[le[18]||(le[18]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",OI,[t.createElementVNode("div",PI,[t.createElementVNode("fieldset",zI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(bn=t.unref(de)(j,nt))!=null&&bn.shareable?(t.openBlock(),t.createElementBlock("label",FI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(te.BSSelect),{width:"150px","model-value":t.unref(ve)(Ee),items:t.unref(be)(),"value-provider":t.unref(c),"label-provider":t.unref(Ce),"onUpdate:modelValue":ot=>ot&&t.unref(U)(j,nt,ot)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",UI,[le[16]||(le[16]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(H)(Ee),"model-value":t.unref(H)(Ee)?"false":t.unref(Q)(Ee),items:t.unref(L),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":ot=>ot&&t.unref(Y)(j,nt,ot)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",HI,[le[17]||(le[17]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(H)(Ee),"model-value":t.unref(H)(Ee)?"false":t.unref(se)(Ee),items:t.unref(ye),"value-provider":t.unref(c),"label-provider":t.unref(ie),"onUpdate:modelValue":ot=>ot&&t.unref(fe)(j,nt,ot)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(r).has(j.modelId),"em-aw__open":ne(j.modelId)})},[t.createElementVNode("td",oI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ne(j.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ne(j.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:Ee=>G(j.modelId),onKeydown:[t.withKeys(t.withModifiers(Ee=>G(j.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Ee=>G(j.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,iI)]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":j.name,"onUpdate:modelValue":Ee=>t.unref(d)(j,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-type-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!j.groupCode||j.attrType==="RELATION_REF"||t.unref(b)(j),items:t.unref(Us)(j.type,t.unref(R)),"value-provider":t.unref(g),"label-provider":t.unref(k),"model-value":j.type,"onUpdate:modelValue":Ee=>t.unref(_)(j,Ee)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),j.type===t.unref(en)&&!t.unref(b)(j)?(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:0,name:`aw-customtype-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":j.customType??"","onUpdate:modelValue":Ee=>t.unref(N)(j,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,aI),t.createElementVNode("td",null,[j.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(dn,{key:0,name:`aw-logical-${j.modelId}`,languages:t.unref(o).languages.value,"active-lang":P.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Xe=j.dbAttrs[0])==null?void 0:Xe.logicalName,"onUpdate:modelValue":Ee=>t.unref($)(j,Ee)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",rI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-col-${j.modelId}`,width:"100%",placeholder:t.unref(f)(j)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(y)(j),"model-value":((rt=j.dbAttrs[0])==null?void 0:rt.physicalName)??"","onUpdate:modelValue":Ee=>t.unref(I)(j,{physicalName:Ee})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(eo,{controller:t.unref(o),"ref-id":(He=j.dbAttrs[0])==null?void 0:He.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-dtype-${j.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(y)(j)||t.unref(b)(j),items:t.unref(Ps)(((Pe=j.dbAttrs[0])==null?void 0:Pe.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Ir),"model-value":((Oe=j.dbAttrs[0])==null?void 0:Oe.dataType)??"","onUpdate:modelValue":Ee=>Ee&&t.unref(I)(j,{dataType:Ee})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,lI),t.createElementVNode("td",{title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSNumberInput),{name:`aw-len-${j.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(y)(j)||t.unref(b)(j),"model-value":(X=j.dbAttrs[0])==null?void 0:X.length,"onUpdate:modelValue":Ee=>t.unref(I)(j,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,sI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",dI,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${j.modelId}`,label:"PK","model-value":j.identifier,disabled:t.unref(a)||t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(h)(j,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${j.modelId}`,label:"NN","model-value":j.notNull,disabled:t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(d)(j,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-uq-${j.modelId}`,label:"UQ","model-value":!!((Nt=j.dbAttrs[0])!=null&&Nt.unique),disabled:t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(I)(j,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,cI),t.createElementVNode("td",{class:"c-del",title:t.unref(u)(j)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,j.modelId)},null,8,["onClick"])],8,uI)],2),ne(j.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(j.modelId)}])},[le[13]||(le[13]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",mI,[t.createElementVNode("div",fI,[t.createElementVNode("fieldset",pI,[le[11]||(le[11]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(x)(j)},[le[8]||(le[8]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(te.BSNumberInput),{name:`aw-scale-${j.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(y)(j)||t.unref(b)(j)||!t.unref(A)(j),"model-value":(Et=j.dbAttrs[0])==null?void 0:Et.scale,"onUpdate:modelValue":Ee=>t.unref(I)(j,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,hI),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-ai-${j.modelId}`,label:"Auto Increment","model-value":!!((yn=j.dbAttrs[0])!=null&&yn.autoIncrement),disabled:t.unref(y)(j)||t.unref(b)(j)||!j.identifier,"onUpdate:modelValue":Ee=>t.unref(I)(j,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",yI,[le[9]||(le[9]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-ins-${j.modelId}`,width:"110px",disabled:t.unref(y)(j),"model-value":t.unref(Q)(j.dbAttrs[0]),items:t.unref(L),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":Ee=>Ee&&t.unref(ke)(j,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",gI,[le[10]||(le[10]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-upd-${j.modelId}`,width:"110px",disabled:t.unref(y)(j),"model-value":t.unref(se)(j.dbAttrs[0]),items:t.unref(ye),"value-provider":t.unref(c),"label-provider":t.unref(ie),"onUpdate:modelValue":Ee=>Ee&&t.unref(O)(j,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",bI,[le[12]||(le[12]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-tr-${j.modelId}`,label:"@Transient","model-value":!!j.transient,disabled:j.identifier||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(p)(j,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nid-${j.modelId}`,label:"@NaturalId","model-value":!!j.naturalId,disabled:j.identifier||t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(m)(j,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${j.modelId}`,label:"mutable","model-value":!!j.naturalIdMutable,disabled:t.unref(y)(j)||!j.naturalId,"onUpdate:modelValue":Ee=>t.unref(d)(j,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-mv-${j.modelId}`,label:"Multi-Value (Set)","model-value":!!((gn=j.dbAttrs[0])!=null&&gn.multiValue),disabled:t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(I)(j,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(b)(j)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",_I,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",kI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"150px","model-value":t.unref(T)(j),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ee=>Ee&&t.unref(V)(j,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(E).length?(t.openBlock(),t.createElementBlock("label",EI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(df,{"model-value":j.groupCode,items:t.unref(E),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ee=>t.unref(K)(j,Ee)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",NI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(w)(j).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"150px","model-value":j.defaultValue??"none",items:t.unref(S)(j),"value-provider":t.unref(B),"label-provider":t.unref(z),"onUpdate:modelValue":Ee=>Ee&&t.unref(J)(j,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`aw-default-${j.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":j.defaultValue??"","onUpdate:modelValue":Ee=>t.unref(re)(j,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",wI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`aw-desc-${j.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":j.description,"onUpdate:modelValue":Ee=>t.unref(pe)(j,Ee)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",jI,[t.createElementVNode("td",KI,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,Kw)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-559a29b3"]]);function ql(e,n){return n&&n!==e?`${e} (${n})`:e}function mf(e,n,o){const i=e.dbAttrs[n];return i?Ko(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function ff(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):ql(o,mf(e,0,n))}function pf(e,n){var l;if(Vn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?ql(s.field,s.physicalName):e}const o=n.resolver.attributeOf(e);if(!o)return e;const i=o.name||n.t("em.index.unnamedAttr"),a=n.resolver.columnOf(e);if(!a)return n.t("em.index.colUnspecified",{name:i,n:o.dbAttrs.length});const r=o.dbAttrs.findIndex(s=>s.modelId===a.modelId);return ql(i,mf(o,r<0?0:r,n))}const WI=["disabled"],JI={class:"em-idxw__list"},XI={class:"em-idxw__list-head"},ZI=["aria-label"],QI=["aria-current","onClick","onKeydown"],ev={class:"em-idxw__item-name"},tv={key:0,class:"em-idxw__badge"},nv={class:"em-idxw__item-cnt"},ov={key:0,class:"em-idxw__empty"},iv={key:0,class:"em-idxw__edit"},av={class:"em-idxw__form"},rv={class:"em-field em-idxw__name"},lv={class:"em-field"},sv=["value","placeholder"],cv={class:"em-idxw__transfer"},dv={class:"em-idxw__pane"},uv={class:"em-idxw__pane-head"},mv=["aria-label"],fv=["aria-pressed","onClick","onKeydown"],pv=["title"],hv={key:0,class:"em-idxw__empty"},yv={class:"em-idxw__arrows"},gv={class:"em-idxw__pane"},bv={class:"em-idxw__pane-head"},_v={class:"em-idxw__col-name"},kv=["title"],Ev={class:"em-idxw__col-ops"},Nv=["title","disabled","onClick"],wv=["title","disabled","onClick"],Iv=["title","onClick"],vv={key:0,class:"em-idxw__empty"},xv={key:1,class:"em-idxw__edit em-idxw__edit--empty"},Cv=Ke(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(E=>E.modelId===n.entityId)??null),a=t.computed(()=>{var E;return((E=i.value)==null?void 0:E.indexes)??[]}),r=t.computed(()=>{var E;return((E=i.value)==null?void 0:E.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,E=>{var w;E.some(S=>S.modelId===s.value)||(s.value=((w=E[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(E=>E.modelId===s.value)??null),d=t.computed(()=>i.value?Ho(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Mn(r.value)),m=E=>u.value.canon(E),h=t.computed(()=>{var E;return new Set((((E=c.value)==null?void 0:E.columns)??[]).map(w=>m(w.columnRef)))}),p=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function y(E){return ff(E,p.value)}function b(E){return E.physicalName&&E.physicalName!==E.field?`${E.field} (${E.physicalName})`:E.field}function f(E){return pf(E,p.value)}const g=t.computed(()=>[...r.value.filter(E=>E.dbAttrs.length>0&&!h.value.has(m(E.modelId))).map(E=>({ref:E.modelId,label:y(E),inherited:!1})),...d.value.filter(E=>!h.value.has(m(E.modelId))).map(E=>({ref:E.modelId,label:b(E),inherited:!0}))]),k=t.ref(new Set);t.watch(s,()=>k.value=new Set);function _(E){return Vn(E)}function N(E,w){i.value&&o.updateIndex(i.value.modelId,E,w)}function I(){var w;if(!i.value)return;const E=Be();o.addIndex(i.value.modelId,{modelId:E,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=E}function A(E){i.value&&o.removeIndex(i.value.modelId,E)}function x(E){c.value&&N(c.value.modelId,{parameters:E.trim()===""?void 0:E})}function $(E){const w=new Set(k.value);w.has(E)?w.delete(E):w.add(E),k.value=w}function T(){const E=c.value;if(!E||!k.value.size)return;const w=[...k.value].map(S=>({columnRef:S,descending:!1}));N(E.modelId,{columns:[...E.columns,...w]}),k.value=new Set}function V(E){const w=c.value;w&&N(w.modelId,{columns:w.columns.filter((S,B)=>B!==E)})}function R(E,w){const S=c.value;S&&N(S.modelId,{columns:S.columns.map((B,z)=>z===E?{...B,descending:w}:B)})}function C(E,w){const S=c.value;if(!S)return;const B=E+w;if(B<0||B>=S.columns.length)return;const z=[...S.columns];[z[E],z[B]]=[z[B],z[E]],N(S.modelId,{columns:z}),M(B,w)}async function M(E,w){var J,re;await t.nextTick();const S=(J=l.value)==null?void 0:J.querySelectorAll(".em-idxw__col--idx")[E];if(!S)return;const B=pe=>S.querySelector(`[data-move="${pe}"]`),z=B(w<0?"up":"down"),K=B(w<0?"down":"up");(re=z&&!z.disabled?z:K)==null||re.focus()}return(E,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",JI,[t.createElementVNode("div",XI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:I},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,S=>(t.openBlock(),t.createElementBlock("li",{key:S.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":S.modelId===s.value}]),role:"button",tabindex:"0","aria-current":S.modelId===s.value?"true":void 0,onClick:B=>s.value=S.modelId,onKeydown:[t.withKeys(t.withModifiers(B=>s.value=S.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(B=>s.value=S.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",ev,t.toDisplayString(S.name||t.unref(o).t("em.attr.nameless")),1),S.unique?(t.openBlock(),t.createElementBlock("span",tv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",nv,t.toDisplayString(S.columns.length),1)],42,QI))),128))],8,ZI),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",ov,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",iv,[t.createElementVNode("div",av,[t.createElementVNode("label",rv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(te.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=S=>N(c.value.modelId,{name:S}))},null,8,["model-value"]),t.createVNode(eo,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":w[1]||(w[1]=S=>N(c.value.modelId,{unique:S}))},null,8,["model-value"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=S=>A(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",lv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:w[3]||(w[3]=S=>x(S.target.value))},null,40,sv)]),t.createElementVNode("div",cv,[t.createElementVNode("div",dv,[t.createElementVNode("div",uv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:g.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:g.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,S=>(t.openBlock(),t.createElementBlock("li",{key:S.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":k.value.has(S.ref)}]),role:"button",tabindex:"0","aria-pressed":k.value.has(S.ref),onClick:B=>$(S.ref),onKeydown:[t.withKeys(t.withModifiers(B=>$(S.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(B=>$(S.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(S.label),1),S.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,pv)):t.createCommentVNode("",!0)],42,fv))),128))],8,mv),g.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",hv,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",yv,[t.createVNode(t.unref(te.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!k.value.size,onClick:T},null,8,["caption","disabled"])]),t.createElementVNode("div",gv,[t.createElementVNode("div",bv,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(S,B)=>(t.openBlock(),t.createElementBlock("li",{key:B,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",_v,[t.createTextVNode(t.toDisplayString(f(S.columnRef)),1),_(S.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,kv)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(te.BSCheckbox),{name:`idxw-desc-${B}`,class:"em-check",label:"DESC","model-value":S.descending,"onUpdate:modelValue":z=>R(B,z)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",Ev,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:B===0,onClick:z=>C(B,-1)},"↑",8,Nv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:B===c.value.columns.length-1,onClick:z=>C(B,1)},"↓",8,wv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:z=>V(B)},"✕",8,Iv)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",vv,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",xv,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,WI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),Sv={class:"em-op-src"},Rv=["placeholder"],$v={class:"em-op-src__actions"},hf=Ke(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(l,s)=>Lt(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",Sv,[t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),class:"em-op-src__area",spellcheck:"false",placeholder:i("em.opSource.placeholder")},null,8,Rv),[[t.vModelText,a.value]]),t.createElementVNode("div",$v,[t.createVNode(t.unref(te.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),Av=["disabled"],Tv={class:"em-ow__toolbar"},Mv={class:"em-ow__count"},Vv={class:"em-ow__scroll"},Bv={class:"em-ow__table"},Dv={class:"c-name"},Lv={class:"c-desc"},Ov=["id"],Pv={class:"c-pii"},zv={class:"c-src"},Fv={class:"c-del"},Uv={key:0},Hv={colspan:"6",class:"em-ow__empty"},jv=Ke(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=te.useModal(),a=t.computed(()=>o.state.logical.entities.find(f=>f.modelId===n.entityId)??null),r=t.computed(()=>{var f;return[...((f=a.value)==null?void 0:f.operations)??[]].sort((g,k)=>g.order-k.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(f){return f==="none"?o.t("em.common.noneParen"):f}const u=f=>f;function m(f,g){a.value&&o.updateOperation(a.value.modelId,f.modelId,g)}function h(f,g){m(f,{description:Object.keys(g).length?g:void 0})}function p(f){return f.personalInfoAttributeType??"none"}function y(f,g){m(f,{personalInfoAttributeType:g==="none"?void 0:g})}function b(f){i.openModal({component:hf,bind:{operationName:f.name,sourceCode:f.sourceCode??"",locale:o.uiLocale.value,onSave:g=>m(f,{sourceCode:g})}})}return(f,g)=>{var k,_;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",Tv,[t.createElementVNode("span",Mv,t.toDisplayString(t.unref(o).t("em.op.section",{n:((k=a.value.operations)==null?void 0:k.length)??0})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:g[0]||(g[0]=N=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",Vv,[t.createElementVNode("table",Bv,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",Dv,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),g[2]||(g[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",Lv,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,Ov),t.createVNode(uf,{modelValue:l.value,"onUpdate:modelValue":g[1]||(g[1]=N=>l.value=N),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",Pv,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",zv,t.toDisplayString(t.unref(o).t("em.op.body")),1),g[3]||(g[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,N=>(t.openBlock(),t.createElementBlock("tr",{key:N.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":I=>m(N,{name:I})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":I=>I&&m(N,{visibility:I})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(dn,{name:`ow-desc-${N.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":N.description,"onUpdate:modelValue":I=>h(N,I)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":p(N),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":I=>I&&y(N,I)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t(N.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:I=>b(N)},null,8,["caption","onClick"])]),t.createElementVNode("td",Fv,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:I=>t.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])]))),128)),(_=a.value.operations)!=null&&_.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",Uv,[t.createElementVNode("td",Hv,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,Av)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),Kv={class:"em-detail__tabs"},Gv=["onClick"],Yv={key:0,class:"em-detail__lock"},qv=["disabled"],Wv={key:0,class:"em-detail__narrow"},Jv=Ke(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=te.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",Kv,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:h=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,Gv)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",Yv,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",Wv,[t.createVNode(nf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(qI,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(Cv,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(jv,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,qv)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function Ya(e,n,o){e.openModal({component:Jv,bind:{controller:t.markRaw(n),entityId:o}})}function un(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>Jc(e,r))}function Ot(e,n){if(!n.length)return[];const o=new Map;for(const{entityId:a,attributeId:r}of n){const l=o.get(a)??[];l.push(r),o.set(a,l)}const i=[];for(const[a,r]of o){const l=e.entities.find(s=>s.modelId===a);if(l)for(const s of Sd(l,r))i.push(ca(a,s.indexRef,{columns:s.columns}))}return i}function qa(e,n,o,i){var c;const a=[];a.push(...un(n,o.remove,i));for(const d of o.update)a.push(on(n,d.attributeId,d.patch));for(const d of o.add)a.push(Ht(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const h=l.filter(p=>{var y;return((y=p.derivedFrom)==null?void 0:y.associationRef)===d.modelId&&p.dbAttrs.length>0}).sort((p,y)=>p.order-y.order)[0];h&&a.push(Mt(d.modelId,"end2",{attributeRef:h.modelId}))}return a}function Mo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function ki(e,n,o){const i=[];for(const[a,r]of lc(e,n,Be))i.push(...qa(e,a,r,o));for(const a of Ag(e,n,Be))i.push(on(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function Xv(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=Fr(a.attributes,o,i).map(l=>l.modelId);return $d(e,n,r).map(l=>on(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function Zv(e,n,o){const i=new Set(o.remove);return Mo(e,n,a=>[...a.filter(r=>!i.has(r.modelId)).map(r=>{const l=o.update.find(s=>s.attributeId===r.modelId);return l?{...r,...l.patch}:r}),...o.add])}function Wa(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of sc(e,r,Be)){const c=i.get(l);i.set(l,c?rc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...qa(e,r,Qv(l),o));return a}function Qv(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function yf(e){return e.attributes.flatMap(n=>n.dbAttrs).map(n=>({...n,modelId:Be()}))}function ex(e,n){var u;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=$t(o.attributes),h=new Set(o.attributes.map(y=>y.name));let p="id";for(let y=2;h.has(p);y++)p=`id${y}`;a={modelId:Be(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Be(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(Ht(n,a))}const r=[];for(const m of e.entities)for(const h of m.attributes){if(((u=h.embedded)==null?void 0:u.embeddableRef)!==n)continue;const p=e.associations.find(g=>g.modelId===h.embedded.associationRef);if(!p)continue;const y=p.end1.entityRef===m.modelId,b=y?p.end1:p.end2,f=y?p.end2:p.end1;r.push({ownerId:m.modelId,dispId:h.modelId,assocId:p.modelId,end1:{entityRef:m.modelId,multiplicity:b.multiplicity,navigable:b.navigable,composition:!1},end2:{entityRef:n,multiplicity:f.multiplicity,navigable:f.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const h=new Set(r.filter(p=>p.ownerId===m.modelId).map(p=>p.dispId));return h.size?{...m,attributes:m.attributes.filter(p=>!h.has(p.modelId))}:m}),associations:e.associations.map(m=>{const h=r.find(p=>p.assocId===m.modelId);return h?{...m,end1:h.end1,end2:h.end2}:m})},s=Yo(l,n,Be);for(const m of r){const h=s.add.find(p=>{var y;return((y=p.derivedFrom)==null?void 0:y.associationRef)===m.assocId});h&&(m.end2.attributeRef=h.modelId)}const c=[];for(const m of r)i.push(...un(m.ownerId,[m.dispId],c)),i.push(sa(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...qa(l,n,s,c));const d=Zv(l,n,s);return i.push(...ki(d,n,c)),i.push(...Ot(e,c)),i}function tx(e,n){const o=e.entities.find(r=>r.modelId===n);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===n,s=r.end2.entityRef===n;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(_=>_.modelId===c);if(!d||d.attributes.some(_=>{var N;return((N=_.embedded)==null?void 0:N.associationRef)===r.modelId}))continue;const u=Be(),m=$t(d.attributes),h=new Set(d.attributes.map(_=>_.name)),p=a(o.name);let y=p;for(let _=2;h.has(y);_++)y=`${p}${_}`;const b=o.attributes.filter(_=>!_.identifier&&!_.derivedFrom).flatMap(_=>_.dbAttrs).map(_=>({..._,modelId:Be()})),f={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:b,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(Ht(c,f));const g=l?"end2":"end1",k=l?"end1":"end2";i.push(sa(r.modelId,{identifying:!1,[g]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Be()},[k]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function gf(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[Gc(n,o),...i.map(u=>ko(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const h=e.layout.associationLayouts.find(p=>p.associationRef===m.modelId);h&&h.waypoints.length&&c.push(sd(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const h=e.layout.notes.find(p=>p.modelId===m);h&&c.push(Qo(m,{x:h.geo.location.x+l,y:h.geo.location.y+s}))}}return c}function nx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Be(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},h={...n.logical,associations:[...n.logical.associations,m]},p=Yo(h,s,Be),y=p.add[0];y&&(m.end2.attributeRef=y.modelId);const b={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},f=la(m,b),g=qa(h,s,p,[]);return i(g.length?Je("관계 추가",[f,...g]):f),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(A=>A.modelId===l),d=n.logical.entities.find(A=>A.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Be(),m=Be(),h=Be(),p=$t(c.attributes),y=yf(d),b=A=>A&&A.charAt(0).toLowerCase()+A.slice(1),f=new Set(c.attributes.map(A=>A.name)),g=b(d.name);let k=g;for(let A=2;f.has(k);A++)k=`${g}${A}`;const _={modelId:m,name:k,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:p,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},N={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:h},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},I={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(Je("임베드 추가",[Ht(l,_),la(N,I)])),u},setEmbedCardinality(l,s){var g;if(r(l))return;const c=n.logical.associations.find(k=>k.modelId===l);if(!c)return;let d,u;for(const k of n.logical.entities){const _=k.attributes.find(N=>{var I;return((I=N.embedded)==null?void 0:I.associationRef)===l&&N.attrType==="EMBED_OWN"});if(_){d=k.modelId,u=_;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,h=c.end2.entityRef===m?"end2":"end1",p=c[h];if(p.multiplicity===s)return;const y=k=>k==="ZERO_OR_MORE_INSTANCES"||k==="ONE_OR_MORE_INSTANCES",b=y(p.multiplicity),f=y(s);if(b===f){i(Mt(l,h,{multiplicity:s}));return}if(f)i(Je("임베드 컬렉션 전환",[on(d,u.modelId,{dbAttrs:[]}),Mt(l,h,{multiplicity:s,jpa:{...p.jpa,collectionType:((g=p.jpa)==null?void 0:g.collectionType)??"LIST"}})]));else{const k=n.logical.entities.find(_=>_.modelId===m);if(!k)return;i(Je("임베드 단일 전환",[on(d,u.modelId,{dbAttrs:yf(k)}),Mt(l,h,{multiplicity:s,jpa:{...p.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(p=>p.modelId===l),c=od(l);if(!s){i(c);return}for(const p of n.logical.entities){const y=p.attributes.find(b=>{var f;return((f=b.embedded)==null?void 0:f.associationRef)===l});if(y){const b=[];i(Je("임베드 삭제",[c,...un(p.modelId,[y.modelId],b),...Ot(n.logical,b)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(p=>p.modelId!==l)},m=[],h=Wa(u,[d],m);if(s.end1.attributeRef){const p=n.logical.entities.find(b=>b.modelId===s.end1.entityRef),y=p==null?void 0:p.attributes.find(b=>b.modelId===s.end1.attributeRef&&b.attrType==="RELATION_REF");y&&h.push(...un(p.modelId,[y.modelId],m))}h.push(...Ot(n.logical,m)),i(h.length?Je("관계 삭제",[c,...h]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(y=>y.modelId===l),d=sa(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(y=>y.modelId===l?{...y,identifying:s}:y)},h=[],p=Wa(m,[u],h);p.push(...Ot(n.logical,h)),i(p.length?Je("식별 관계 변경",[d,...p]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=n.logical.entities.find(p=>p.modelId===d.end1.entityRef),m=n.logical.entities.find(p=>p.modelId===d.end2.entityRef),h=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!h){if(c.navigable===!0&&!d.end1.attributeRef){const p=zi(d.end2.multiplicity),y=d.end1.navFieldNameHint||Ui(m.name,p),b=co(y,new Set(u.attributes.map(_=>_.name))),f=Be(),g=$t(u.attributes),k={modelId:f,name:b,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:g,dbAttrs:[]};i(Je("inverse nav 추가",[Ht(d.end1.entityRef,k),Mt(l,"end1",{...c,attributeRef:f,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const p=d.end1.attributeRef,y=u.attributes.find(k=>k.modelId===p&&k.attrType==="RELATION_REF"),b=Mt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),f=[],g=y?un(d.end1.entityRef,[p],f):[];i(y?Je("inverse nav 제거",[...g,b,...Ot(n.logical,f)]):b);return}}}i(Mt(l,s,c))}}}function ox(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,h)=>{if(a(u))return;const p=on(u,m,h),y=Mo(n.logical,u,g=>g.map(k=>k.modelId===m?{...k,...h}:k)),b=[],f=ki(y,u,b);f.push(...Ot(n.logical,b)),i(f.length?Je("속성 수정",[p,...f]):p)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const h=r.value.find(k=>k.type===m),p=n.logical.entities.find(k=>k.modelId===u);if(!h||!p)return null;const y=$t(p.attributes),b=Be(),f=h.fields.map(()=>({modelId:Be(),physicalName:"",dataType:""})),g={modelId:b,name:h.defaultName,type:h.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:y,dbAttrs:f};return i(Ht(u,g)),b},addAttribute(u,m={}){if(!o.value||a(u))return null;const h=n.logical.entities.find(I=>I.modelId===u),p=h?$t(h.attributes):0,y=m.modelId??Be(),b=m.name??`field${p}`,f={modelId:y,name:b,type:m.type??xr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:p,dbAttrs:m.dbAttrs??[{modelId:Be(),physicalName:b,dataType:"VARCHAR"}],...m},g=Ht(u,f),k=Mo(n.logical,u,I=>[...I,f]),_=[],N=ki(k,u,_);return N.push(...Ot(n.logical,_)),i(N.length?Je("속성 추가",[g,...N]):g),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(b=>b.modelId===u),h=m?$t(m.attributes):0,p=Be();return i(Ht(u,{modelId:p,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:h,dbAttrs:[]})),p},updateAttribute(u,m,h){d(u,m,h)},setAttributeGroupCode(u,m,h){d(u,m,{groupCode:h,type:h?uo:xr})},setEmbedColumns(u,m,h){var k,_;if(a(u))return;const p=on(u,m,{dbAttrs:h}),y=(k=n.logical.entities.find(N=>N.modelId===u))==null?void 0:k.attributes.find(N=>N.modelId===m),b=(_=y==null?void 0:y.embedded)==null?void 0:_.associationRef,f=b?n.logical.associations.find(N=>N.modelId===b):void 0,g=[];f&&b&&(f.end1.legacyEmbedRaw&&g.push(Mt(b,"end1",{legacyEmbedRaw:void 0})),f.end2.legacyEmbedRaw&&g.push(Mt(b,"end2",{legacyEmbedRaw:void 0}))),i(g.length?Je("임베드 컬럼 수정",[p,...g]):p)},removeAttribute(u,m){if(a(u))return;if(Wi(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const h=[],p=un(u,[m],h),y=Mo(n.logical,u,g=>g.filter(k=>k.modelId!==m)),b=[...ki(y,u,h),...Ot(n.logical,h)],f=[...p,...b];i(f.length===1?f[0]:Je("속성 삭제",f))},removeAttributes(u,m){var k;if(!m.length||a(u))return;const h=m.filter(_=>!Wi(n.logical,u,_));if(h.length<m.length&&s(l("em.attr.fkDeleteHint")),!h.length)return;const p=[],y=un(u,h,p),b=new Set(h),f=Mo(n.logical,u,_=>_.filter(N=>!b.has(N.modelId))),g=[...y,...ki(f,u,p),...Ot(n.logical,p)];i(g.length===1?g[0]:Je("속성 삭제",g)),((k=c.value)==null?void 0:k.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,h){i(ia(u,m,h))},setAttributeSwatches(u,m,h){m.length&&(m.length===1?i(ia(u,m[0],h)):i(Je("속성 색상",m.map(p=>ia(u,p,h)))))},reorderAttributes(u,m,h){if(!m.length||a(u))return;const p=Zr(u,m,h),y=Xv(n.logical,u,m,h);i(y.length?Je("속성 재정렬",[p,...y]):p)}}}function ix(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Be(),n.name=`${e.name}_copy`,(i=n.table)!=null&&i.physicalName&&(n.table.physicalName=`${n.table.physicalName}_copy`);const o=new Map;for(const a of n.attributes){const r=Be();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Be()}for(const a of n.indexes??[]){a.modelId=Be();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Be();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const ax=220;function rx(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||ax));for(const r of e.groupLayouts)i=Math.max(i,r.geo.location.x+r.geo.size.width);let a=1/0;for(const r of n.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of n.groupLayouts)a=Math.min(a,r.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const Wl=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function lx(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const b=c.filter(f=>n.logical.entities.some(g=>g.modelId===f));if(b.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:b}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const b=n.logical.entities.find(g=>g.modelId===d.entityId);if(!b)return;const f=[...b.attributes].sort((g,k)=>g.order-k.order).filter(g=>d.ids.includes(g.modelId));if(!f.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:f}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(b=>b.modelId===u),h=n.layout.entityLayouts.find(b=>b.entityRef===u);if(!m)return;const p=(h==null?void 0:h.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let y;if(h){const{entityRef:b,geo:f,locked:g,...k}=h;Object.keys(k).length&&(y=k)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:p,layoutExtras:y}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const p=a.value;if(!p)return[];const y=n.logical.entities.find(N=>N.modelId===p);if(!y)return[];const b=new Set(y.attributes.map(N=>N.name)),f=new Set(y.attributes.flatMap(N=>N.dbAttrs.map(I=>I.physicalName))),g=$t(y.attributes),k=[],_=c.attributes.map((N,I)=>{const A=JSON.parse(JSON.stringify(N));A.modelId=Be();for(const x of A.dbAttrs)x.modelId=Be();b.has(A.name)&&(A.name=co(`${A.name}_copy`,b)),b.add(A.name);for(const x of A.dbAttrs)x.physicalName&&f.has(x.physicalName)&&(x.physicalName=co(`${x.physicalName}_copy`,f)),x.physicalName&&f.add(x.physicalName);return A.order=g+I,k.push(A.modelId),Ht(p,A)});return l(_.length===1?_[0]:Je("속성 붙여넣기",_)),i.value={kind:"attribute",entityId:p,ids:k,anchor:k[k.length-1]},[]}const{clone:d,idMap:u}=ix(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let h;if(c.layoutExtras){const p={...c.layoutExtras},y=b=>u.get(b);p.attributeStyles&&(p.attributeStyles=ea(p.attributeStyles,y)),p.operationStyles&&(p.operationStyles=ea(p.operationStyles,y)),h=p}return l(oa(d,m,h)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Sc(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const h=(u==null?void 0:u.placement)??"append-right",p=h==="append-right"?rx(n.layout,m.layout):h.offset,y=new Map(m.layout.entityLayouts.map(_=>[_.entityRef,_])),b=new Map(m.layout.associationLayouts.map(_=>[_.associationRef,_])),f=new Map(m.layout.groupLayouts.map(_=>[_.groupRef,_])),g=[];let k=80;for(const _ of m.logical.entities){const N=y.get(_.modelId),I=N?{location:Wl(N.geo.location,p),size:{...N.geo.size}}:{location:{x:k+=40,y:80},size:{width:220,height:140}};let A;if(N){const{entityRef:x,geo:$,locked:T,...V}=N;A=V}g.push(oa(_,I,A))}for(const _ of m.logical.associations){const N=b.get(_.modelId),I=N?{...N,waypoints:N.waypoints.map(A=>Wl(A,p))}:{associationRef:_.modelId,waypoints:[]};g.push(la(_,I))}for(const _ of m.logical.groups){const N=f.get(_.modelId),I=N?{location:Wl(N.geo.location,p),size:{...N.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let A;if(N){const{groupRef:x,geo:$,locked:T,memberNoteRefs:V,...R}=N;A=R}g.push(aa(_,I,A))}return l(Je("다이어그램 가져오기",g)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(_=>_.modelId)}};return s}function sx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l}=e;return{addEntity(s="NewEntity",c={x:80,y:80}){if(!o.value)return null;const d=Be(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:Be(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Be(),physicalName:"id",dataType:"BIGINT"}]}]};return i(oa(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(Oc(s,c))},updateEntity(s,c){if(a(s))return;const d=Lc(s,c),u=n.logical.entities.find(p=>p.modelId===s),m=c.stereotype==="JPA_EMBEDDABLE"&&!!u&&u.stereotype!=="JPA_EMBEDDABLE",h=!!c.stereotype&&c.stereotype!=="JPA_EMBEDDABLE"&&!!u&&u.stereotype==="JPA_EMBEDDABLE";if(m&&u){const p=u.attributes.filter(_=>_.identifier&&!_.derivedFrom).map(_=>on(s,_.modelId,{identifier:!1})),y=Mo({...n.logical,entities:n.logical.entities.map(_=>_.modelId===s?{..._,stereotype:"JPA_EMBEDDABLE"}:_)},s,_=>_.map(N=>N.identifier&&!N.derivedFrom?{...N,identifier:!1}:N)),b=[],f=Wa(y,[s],b);f.push(...Ot(n.logical,b));const g=tx(n.logical,s),k=[d,...p,...f,...g];i(k.length>1?Je("임베더블 변환",k):d);return}if(h){const p=ex(n.logical,s),y=[d,...p];i(y.length>1?Je("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(ko(s,c))},resizeEntity(s,c){a(s)||i(Pc(s,c))},removeEntity(s){if(a(s))return;const c=Dc(s);if(!n.logical.entities.find(f=>f.modelId===s)){i(c);return}const u=n.logical.associations.filter(f=>f.end1.entityRef===s||f.end2.entityRef===s),m=new Set(u.map(f=>f.modelId)),h=[],p=[];for(const f of n.logical.entities)if(f.modelId!==s)for(const g of f.attributes)g.embedded&&m.has(g.embedded.associationRef)&&h.push(...un(f.modelId,[g.modelId],p));for(const f of u){if(f.end1.entityRef===s||!f.end1.attributeRef)continue;const g=n.logical.entities.find(_=>_.modelId===f.end1.entityRef),k=g==null?void 0:g.attributes.find(_=>_.modelId===f.end1.attributeRef&&_.attrType==="RELATION_REF");k&&h.push(...un(g.modelId,[k.modelId],p))}const y={...n.logical,entities:n.logical.entities.filter(f=>f.modelId!==s),associations:n.logical.associations.filter(f=>!m.has(f.modelId))},b=new Set(u.filter(f=>f.end1.entityRef===s&&f.end2.entityRef!==s).map(f=>f.end2.entityRef));h.push(...Wa(y,[...b],p)),h.push(...Ot(n.logical,p.filter(f=>f.entityId!==s))),i(h.length?Je("엔티티 삭제",[c,...h]):c)},setEntitySwatch(s,c){i(zc(s,c))},setEntityCollapsed(s,c){i(Fc(s,c))},setEntityLocked(s,c){i(Uc(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(Xr(!0))},expandAll(){i(Xr(!1))}}}function cx(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(g=>n.layout.entityLayouts.find(k=>k.entityRef===g)).filter(g=>!!g);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,h=1/0,p=-1/0,y=-1/0;for(const g of u){const k=g.geo.size.width||220,_=g.geo.size.height||140;m=Math.min(m,g.geo.location.x),h=Math.min(h,g.geo.location.y),p=Math.max(p,g.geo.location.x+k),y=Math.max(y,g.geo.location.y+_)}const b=40,f=28;return{location:{x:m-b,y:h-b-f},size:{width:p-m+b*2,height:y-h+b*2+f}}}return{dragGroup(d,u,m){l(d)||i(Je("그룹 이동",gf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(Yc(d,u))},setGroupSwatch(d,u){i(qc(d,u))},setGroupLocked(d,u){i(Wc(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(Hc(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const b of d)y.memberEntityRefs.includes(b)&&m.push(ra(y.modelId,b));const h=Be(),p={modelId:h,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(aa(p,c(d))),i(Je("그룹 생성",m)),a.value=null,h},addEmptyGroup(d,u){if(!o.value)return null;const m=Be();return i(aa({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(jc(d))},dropEntity(d,u,m){var y;if(r(d))return;const h=((y=n.logical.groups.find(b=>b.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,p=[ko(d,u)];h!==m&&(h&&p.push(ra(h,d)),m&&p.push(Kc(m,d))),i(Je("이동",p))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(ra(u.modelId,d))},dropNote(d,u,m){var y;const h=((y=n.layout.groupLayouts.find(b=>{var f;return(f=b.memberNoteRefs)==null?void 0:f.includes(d)}))==null?void 0:y.groupRef)??null,p=[Qo(d,u)];h!==m&&(h&&p.push(gd(h,d)),m&&p.push(yd(m,d))),i(Je("이동",p))}}}function dx(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(b,f){if(d(),!o.value||!e.opTransport)return;const g=new vd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:k=>{i.value=!1,a.value=k},onError:e.onOpError});g.seed((f==null?void 0:f.revSeed)??{}),c=g.attach(b),s=g}const m=t.computed(()=>o.value&&r!==void 0),h=t.ref(0),p=t.computed(()=>o.value&&i.value&&l!==void 0);async function y(b){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let f;try{f=await l(b)}catch(g){return{ok:!1,reason:g instanceof Error?g.message:String(g)}}return f.ok&&h.value++,f}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:p,restoreToSeq:y,reloadRequest:h}}function ux(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Be();return o(ud({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(md(i))},moveNote(i,a){o(Qo(i,a))},resizeNote(i,a){o(fd(i,a))},setNoteMemo(i,a){o(pd(i,a))},setNoteSwatch(i,a){o(hd(i,a))},addNoteConnection(i,a){o(bd(i,a))},removeNoteConnection(i,a){o(_d(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(kd(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Ed(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Nd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(wd(i,a))}}}function mx(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const h=o.value,p=(h==null?void 0:h.kind)==="attribute"&&h.entityId===d;if(m==="replace"||!p){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const N=h.ids.includes(u),I=N?h.ids.filter(x=>x!==u):[...h.ids,u];if(!I.length){o.value=null;return}const A=N&&h.anchor===u?I[I.length-1]:N?h.anchor:u;o.value={kind:"attribute",entityId:d,ids:I,anchor:A};return}const y=n.logical.entities.find(N=>N.modelId===d),b=[...(y==null?void 0:y.attributes)??[]].sort((N,I)=>N.order-I.order).map(N=>N.modelId),f=b.indexOf(h.anchor),g=b.indexOf(u);if(f<0||g<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[k,_]=f<=g?[f,g]:[g,f];o.value={kind:"attribute",entityId:d,ids:b.slice(k,_+1),anchor:h.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(b=>b.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const h=m.attributes.findIndex(b=>b.modelId===u.anchor);if(h<0)return!1;const p=Math.min(Math.max(h+d,0),m.attributes.length-1);if(p===h)return!0;const y=m.attributes[p].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[y],anchor:y},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(N=>N.modelId===u.entityId);if(!m)return!1;const h=m.attributes,p=new Set(u.ids),y=h.map((N,I)=>p.has(N.modelId)?I:-1).filter(N=>N>=0);if(!y.length)return!1;const b=Math.min(...y),f=h.filter(N=>!p.has(N.modelId)),g=h.slice(0,b).filter(N=>!p.has(N.modelId)).length;let k;if(d<0){if(g<=0)return!0;k=g-1}else{if(f.length-g<=0)return!0;k=g+1}if(r(u.entityId))return!0;const _=h.filter(N=>p.has(N.modelId)).map(N=>N.modelId);return a(Zr(u.entityId,_,k)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const h=new Set(n.logical.entities.map(k=>k.modelId)),p=new Set(n.logical.groups.map(k=>k.modelId)),y=new Set(n.layout.notes.map(k=>k.modelId)),b=new Set;for(const k of d){if(!p.has(k))continue;const _=n.logical.groups.find(N=>N.modelId===k);for(const N of(_==null?void 0:_.memberEntityRefs)??[])b.add(N)}const f=[],g=[];for(const k of d)if(p.has(k)){if(s(k))continue;const _=n.layout.groupLayouts.find(x=>x.groupRef===k);if(!_)continue;const N=n.logical.groups.find(x=>x.modelId===k),I=((N==null?void 0:N.memberEntityRefs)??[]).map(x=>{var T;const $=((T=n.layout.entityLayouts.find(V=>V.entityRef===x))==null?void 0:T.geo.location)??{x:0,y:0};return{id:x,location:{x:$.x+u,y:$.y+m}}}),A={x:_.geo.location.x+u,y:_.geo.location.y+m};f.push(Je("그룹 이동",gf(n,k,A,I))),g.push("g:"+k)}else if(h.has(k)){if(b.has(k)||l(k))continue;const _=n.layout.entityLayouts.find(N=>N.entityRef===k);if(!_)continue;f.push(ko(k,{x:_.geo.location.x+u,y:_.geo.location.y+m})),g.push("e:"+k)}else if(y.has(k)){const _=n.layout.notes.find(N=>N.modelId===k);if(!_)continue;f.push(Qo(k,{x:_.geo.location.x+u,y:_.geo.location.y+m})),g.push("n:"+k)}return f.length?(a(Je("이동",f,"nudge:"+g.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const to=Symbol("editorController");function bf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function fx(e=bf(),n={}){var ne,G;const o=t.reactive(e);let i=new Jr(o);const a=t.ref(n.embeddableCatalog??[]),r=t.ref(n.groupCodeCatalog??[]),l=t.ref(n.predefinedCustomTypeCatalog??[]),s=t.ref(n.superClassCatalog??[]),c=t.ref(n.languages??["ko","en","ja","zh"]),d=t.ref(n.userLanguage??"ko"),u=t.ref(n.uiLocale??"ko"),m=(P,ae)=>Lt(u.value,P,ae),h=t.ref(n.reservedWords),p=t.ref(n.selectableDataTypes),y=t.ref(n.largeEntityThreshold),b=t.ref(n.flagEntitiesWithoutRelations??!1),f=t.ref(!1),g=t.ref(!1),k=t.ref(!1),_=t.ref(0),N=t.ref(null);let I=0;const A=P=>{if(n.onNotice){n.onNotice(P);return}N.value={text:P,id:++I}},x=t.ref(((ne=n.meta)==null?void 0:ne.schemaVersion)??1),$=t.ref(((G=n.meta)==null?void 0:G.opWriteEnabled)??!1),T=t.computed(()=>x.value>=2&&$.value),V=t.ref(!(x.value>=2&&$.value===!1)),R=t.ref("LOGICAL_PHYSICAL"),C=t.ref("straight"),M=t.ref(!0),E=t.ref(!0),w=t.ref(null),S=t.computed(()=>{var P;return((P=w.value)==null?void 0:P.kind)==="attribute"?{entityId:w.value.entityId,attrId:w.value.anchor}:null}),B=t.computed(()=>{var P;return((P=w.value)==null?void 0:P.kind)==="attribute"?w.value.ids:[]}),z=t.computed(()=>{var P,ae;return((P=w.value)==null?void 0:P.kind)==="entity"?w.value.id:((ae=w.value)==null?void 0:ae.kind)==="attribute"?w.value.entityId:null}),K=t.ref(null),J=t.ref(null),re=t.ref(null),pe=t.ref(null),ce=dx({state:o,opMode:T,editable:V,opConflict:re,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function Ne(){i.onChange(()=>{f.value=i.canUndo,g.value=i.canRedo,k.value=i.isDirty,_.value++})}Ne(),ce.setupOpAdapter(i,n.meta);const he=t.computed(()=>ws(o.logical,o.layout)),de=t.computed(()=>({reservedWords:h.value,selectableDataTypes:p.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:b.value,embeddableCatalog:a.value,superClassCatalog:s.value})),_e=n.validationDebounceMs??250;let Se,me=()=>{};if(_e>0){const P=t.shallowRef(Ji(o.logical,de.value));let ae;me=()=>{ae!==void 0&&(clearTimeout(ae),ae=void 0),P.value=Ji(o.logical,de.value)},t.watch([_,de],()=>{ae!==void 0&&clearTimeout(ae),ae=setTimeout(me,_e)},{flush:"sync"}),Se=t.computed(()=>P.value)}else Se=t.computed(()=>Ji(o.logical,de.value));const ye=t.computed(()=>{const P=new Map;for(const ae of Se.value){if(!ae.targetRef)continue;const Re=P.get(ae.targetRef);Re?Re.push(ae):P.set(ae.targetRef,[ae])}return P}),ie=1500,se=new Map,fe=P=>{const ae=Date.now();ae-(se.get(P)??0)<ie||(se.set(P,ae),A(P))},O=P=>{if(!pe.value){if(!V.value){fe(m("em.notice.readOnly"));return}try{i.execute(P)}catch(ae){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${P.label}):`,ae),V.value=!1,pe.value={label:P.label}}}},L=P=>o.layout.entityLayouts.some(ae=>ae.entityRef===P&&!!ae.locked),F=P=>o.layout.groupLayouts.some(ae=>ae.groupRef===P&&!!ae.locked),Q=P=>{const ae=o.logical.associations.find(Re=>Re.modelId===P);return!!ae&&(L(ae.end1.entityRef)||L(ae.end2.entityRef))},Y=P=>L(P)?(fe(m("em.notice.entityLocked")),!0):!1,ke=P=>F(P)?(fe(m("em.notice.groupLocked")),!0):!1,be=P=>Q(P)?(fe(m("em.notice.assocLocked")),!0):!1,Ce=lx({state:o,clipboard:J,selection:w,inspectedEntityId:z,editable:V,run:O}),ve=mx({state:o,selection:w,focusRequest:K,run:O,gateEntityLocked:Y,isEntityLockedFn:L,isGroupLockedFn:F}),U=sx({state:o,editable:V,run:O,gateEntityLocked:Y,isEntityLockedFn:L,isAssocLockedFn:Q}),H=ox({state:o,editable:V,run:O,gateEntityLocked:Y,embeddableCatalog:a,t:m,emitGateNotice:fe,selection:w}),q=cx({state:o,editable:V,run:O,selection:w,gateEntityLocked:Y,gateGroupLocked:ke,isGroupLockedFn:F}),xe=ux({editable:V,run:O}),De=nx({state:o,editable:V,run:O,gateEntityLocked:Y,gateAssocLocked:be});return{state:o,resolved:he,issues:Se,issuesByRef:ye,flagEntitiesWithoutRelations:b,canUndo:f,canRedo:g,dirty:k,revision:_,notice:N,editable:V,schemaVersion:x,opWriteEnabled:$,opMode:T,opConflict:re,commandFailure:pe,historyTransport:ce.historyTransport,historyAvailable:ce.historyAvailable,restoreTransport:ce.restoreTransport,restoreAvailable:ce.restoreAvailable,restoreToSeq:ce.restoreToSeq,reloadRequest:ce.reloadRequest,displayMode:R,routingMode:C,showGrid:M,showMinimap:E,selection:w,selectedAttr:S,selectedAttrIds:B,inspectedEntityId:z,focusRequest:K,clipboard:J,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,uiLocale:u,t:m,selectableDataTypes:p,setEditable(P){V.value=P&&T.value},setEmbeddableCatalog(P){a.value=P},setGroupCodeCatalog(P){r.value=P},setPredefinedCustomTypeCatalog(P){l.value=P},setSuperClassCatalog(P){s.value=P},selectAttribute:ve.selectAttribute,moveAttributeFocus:ve.moveAttributeFocus,nudgeSelectedAttributes:ve.nudgeSelectedAttributes,nudgeNodes:ve.nudgeNodes,requestFocus:ve.requestFocus,deleteSelection(){if(!V.value)return!1;const P=w.value;if(!P)return!1;if(P.kind==="attribute"){if(Y(P.entityId))return!1;const ae=P.ids;if(!ae.length)return!1;ae.length===1?H.removeAttribute(P.entityId,ae[0]):H.removeAttributes(P.entityId,ae)}else if(P.kind==="entity"){if(Y(P.id))return!1;U.removeEntity(P.id)}else if(P.kind==="note")xe.removeNote(P.id);else if(P.kind==="group"){if(ke(P.id))return!1;q.removeGroup(P.id)}else De.removeAssociation(P.id);return w.value=null,!0},undo:()=>{V.value&&i.undo()},redo:()=>{V.value&&i.redo()},markSaved:()=>{V.value&&(ce.flush(),i.markSavePoint())},loadDiagram(P,ae){ce.teardownOpAdapter(),o.logical=P.logical,o.layout=P.layout,i=new Jr(o),Ne(),x.value=(ae==null?void 0:ae.schemaVersion)??1,$.value=(ae==null?void 0:ae.opWriteEnabled)??!1,V.value=!(x.value>=2&&$.value===!1),re.value=null,pe.value=null,w.value=null,f.value=i.canUndo,g.value=i.canRedo,k.value=i.isDirty,ce.setupOpAdapter(i,ae),me()},flush:ce.flush,whenOpsSettled:ce.whenOpsSettled,addEntity:U.addEntity,renameEntity:U.renameEntity,updateEntity:U.updateEntity,moveEntity:U.moveEntity,resizeEntity:U.resizeEntity,removeEntity:U.removeEntity,setEntitySwatch:U.setEntitySwatch,setEntityCollapsed:U.setEntityCollapsed,setEntityLocked:U.setEntityLocked,isEntityLocked:U.isEntityLocked,isAssociationLocked:U.isAssociationLocked,collapseAll:U.collapseAll,expandAll:U.expandAll,setAttributeSwatch:H.setAttributeSwatch,dragGroup:q.dragGroup,resizeGroup:q.resizeGroup,setGroupSwatch:q.setGroupSwatch,setGroupLocked:q.setGroupLocked,isGroupLocked:q.isGroupLocked,updateGroup:q.updateGroup,createGroup:q.createGroup,addEmptyGroup:q.addEmptyGroup,removeGroup:q.removeGroup,dropEntity:q.dropEntity,ungroupEntity:q.ungroupEntity,dropNote:q.dropNote,addPredefinedEmbed:H.addPredefinedEmbed,addAttribute:H.addAttribute,addDivider:H.addDivider,updateAttribute:H.updateAttribute,setAttributeGroupCode:H.setAttributeGroupCode,setEmbedColumns:H.setEmbedColumns,removeAttribute:H.removeAttribute,removeAttributes:H.removeAttributes,setAttributeSwatches:H.setAttributeSwatches,reorderAttributes:H.reorderAttributes,addIndex(P,ae){Y(P)||O(id(P,ae))},updateIndex(P,ae,Re){Y(P)||O(ca(P,ae,Re))},removeIndex(P,ae){Y(P)||O(ad(P,ae))},addOperation(P,ae={}){if(!V.value||Y(P))return null;const Re=o.logical.entities.find(rt=>rt.modelId===P),le=Re!=null&&Re.operations?$t(Re.operations):0,j=ae.modelId??Be(),Xe={modelId:j,name:ae.name??`method${le}`,visibility:ae.visibility??"PACKAGE",order:le,...ae};return O(Zc(P,Xe)),j},updateOperation(P,ae,Re){Y(P)||O(Qc(P,ae,Re))},removeOperation(P,ae){Y(P)||O(ed(P,ae))},reorderOperations(P,ae,Re){!ae.length||Y(P)||O(td(P,ae,Re))},setOperationSwatch(P,ae,Re){O(nd(P,ae,Re))},addAssociation:De.addAssociation,addEmbedAssociation:De.addEmbedAssociation,setEmbedCardinality:De.setEmbedCardinality,removeAssociation:De.removeAssociation,setAssociationIdentifying:De.setAssociationIdentifying,updateAssociationEnd:De.updateAssociationEnd,hasQuickFix(P){if(!V.value)return!1;const ae=Dr(P,o.logical);return ae?ae.kind==="setEndCascades"?!Q(ae.assocRef):!L(ae.entityRef):!1},applyQuickFix(P){if(!V.value)return!1;const ae=Dr(P,o.logical);if(!ae)return!1;if(ae.kind==="setIndexColumns")return Y(ae.entityRef)?!1:(O(ca(ae.entityRef,ae.indexRef,{columns:ae.columns})),!0);if(be(ae.assocRef))return!1;const Re=o.logical.associations.find(le=>le.modelId===ae.assocRef);return Re?(O(Mt(ae.assocRef,ae.which,{jpa:{...Re[ae.which].jpa,cascadeTypes:ae.cascades}})),!0):!1},moveWaypoint(P,ae,Re){O(rd(P,ae,Re))},addWaypoint(P,ae,Re){O(dd(P,ae,Re))},removeWaypoint(P,ae){O(ld(P,ae))},clearWaypoints(P){O(cd(P))},addNote:xe.addNote,removeNote:xe.removeNote,moveNote:xe.moveNote,resizeNote:xe.resizeNote,setNoteMemo:xe.setNoteMemo,setNoteSwatch:xe.setNoteSwatch,addNoteConnection:xe.addNoteConnection,removeNoteConnection:xe.removeNoteConnection,moveNoteConnectionWaypoint:xe.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:xe.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:xe.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:xe.clearNoteConnectionWaypoints,autoLayout(){const P=Is(o.logical,o.layout);P.length&&O(Je("자동 배치",P.map(ae=>ko(ae.id,ae.location))))},copy:Ce.copy,paste:Ce.paste,importEntities:Ce.importEntities}}const Ja=Symbol("groupHover"),_f=Symbol("groupDrag"),Vo=Symbol("relationHighlight"),kf=Symbol("diffOverlay"),Ef=Symbol("nodeInternals"),Nf=Symbol("columnResolution");function px(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function wf(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!px(e[o],n[o]))return!1;return!0}function hx(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!wf(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function yx(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function gx(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!yx(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!hx(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!wf(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!0}function bx(){let e;return(n,o)=>e=_x(n,o,e)}function _x(e,n,o){const i=e.entities,a=new Map;for(const r of i){const l=new Map,s=new Map,c=new Map;let d=null;const u=()=>d??(d=so(En(r,i)));for(const b of r.attributes){if(Bi(b)){const _=b.dbAttrs[0];if(!(_!=null&&_.physicalName&&(_!=null&&_.dataType))){const N=Di(b,r,i,e.associations);N&&l.set(b.modelId,{...b,dbAttrs:[{..._,physicalName:(_==null?void 0:_.physicalName)||N.physicalName,dataType:(_==null?void 0:_.dataType)||N.dataType,length:(_==null?void 0:_.length)??N.length,scale:(_==null?void 0:_.scale)??N.scale},...b.dbAttrs.slice(1)]})}}const f=Cr(b,e.associations);if(f&&c.set(b.modelId,f),!b.attrType.startsWith("EMBED")||b.dbAttrs.length===0)continue;if(b.attrType!=="EMBED_PREDEF"){const _=u();s.set(b.modelId,b.dbAttrs.map((N,I)=>{const A=Bn(N,_);return A?{...N,physicalName:A.physicalName}:lo(b,N,I,r,e)}));continue}const g=n==null?void 0:n.find(_=>_.type===b.type);if(!g)continue;const k=u();s.set(b.modelId,b.dbAttrs.map((_,N)=>{const I=g.fields[N],A=Bn(_,k);return A?{..._,physicalName:A.physicalName,logicalName:_.logicalName??(I==null?void 0:I.logicalName),dataType:_.dataType||(I==null?void 0:I.dataType)||""}:I?{..._,physicalName:_.physicalName||I.physicalName,logicalName:_.logicalName??I.logicalName,dataType:_.dataType||I.dataType,length:_.length??I.length}:_}))}const m=new Map,h=new Map;for(const b of r.attributes){const f=s.get(b.modelId);if(f)for(let g=0;g<f.length;g++){const k=`${b.attrType}\0${b.type??""}\0${g}`,_={attrId:b.modelId,slot:g,name:f[g].physicalName??""},N=h.get(k);N?N.push(_):h.set(k,[_])}}for(const b of h.values()){if(b.length<2)continue;const f=new Map;for(const g of b)f.set(g.name,(f.get(g.name)??0)+1);for(const g of b){if((f.get(g.name)??0)<2)continue;const k=m.get(g.attrId);k?k.add(g.slot):m.set(g.attrId,new Set([g.slot]))}}const p={effectiveAttrs:l,embedCols:s,collectionTypes:c,redundantSlots:m},y=o==null?void 0:o.get(r.modelId);a.set(r.modelId,y&&gx(p,y)?y:p)}return a}const If=Symbol("embedSlotCollapse"),vf=(e,n)=>`${e}:${n}`,xf="all:",Cf="one:",Sf=e=>`${xf}${e}`,Rf=(e,n)=>`${Cf}${e}:${n}`,kx=e=>!e.startsWith(xf)&&!e.startsWith(Cf),Ex={key:0,class:"em-sel","aria-hidden":"true"},Nx=["title","aria-expanded","disabled"],wx={class:"em-entity__stereotype"},Ix={key:1,class:"em-entity__name"},vx=["title","aria-expanded"],xx={"aria-hidden":"true"},Cx=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Sx=["onPointerdown"],Rx={key:1,class:"em-entity__divider-label"},$x=["title"],Ax={class:"em-key-slot"},Tx={class:"em-key-slot"},Mx=["title","aria-expanded","onClick"],Vx=["title","onClick"],Bx=["title","aria-expanded","onClick"],Dx={key:2,class:"em-entity__type"},Lx=["onClick"],Ox={class:"em-entity__attrname"},Px={class:"em-entity__type"},zx={key:1,class:"em-entity__embed-summary"},Fx=["title"],Ux=["data-op"],Hx=["onPointerdown"],jx={class:"em-entity__op-vis","aria-hidden":"true"},Kx=["title"],Gx={key:4,class:"em-entity__footer"},$f=Ke(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(to,null),i=(oe,v)=>o?o.t(oe,v):Lt("ko",oe,v),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=te.useModal();function l(){o&&Ya(r,o,n.id)}const s=t.inject(Ja,null),c=t.inject(Vo,null),d=t.inject(kf,null),u=t.computed(()=>{var oe;return((oe=d==null?void 0:d.marks.value)==null?void 0:oe.get(n.id))??null}),m=t.inject(Nf,null),h=t.computed(()=>m==null?void 0:m.value.get(n.id)),p=t.inject(If,void 0),y=t.inject(Ef,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const b=t.computed(()=>!!o&&o.editable.value);function f(){s&&(s.value=n.data.groupRef??null)}function g(){c==null||c.setEntityHover(n.id)}function k(){c==null||c.setEntityHover(null)}const _=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),N=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!_.value),I=t.computed(()=>{var oe;return((oe=o==null?void 0:o.selection.value)==null?void 0:oe.kind)==="entity"&&o.selection.value.id===n.id}),A=t.computed(()=>!!n.selected&&!I.value),x=t.computed(()=>{var oe;return o&&((oe=o.selectedAttr.value)==null?void 0:oe.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),$=t.computed(()=>x.value.size>0);function T(oe,v){const D=v.shiftKey?"range":v.metaKey||v.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,oe.modelId,D)}const V=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!I.value),R=t.computed(()=>n.data.entity),C=t.computed(()=>[...R.value.attributes].sort((oe,v)=>oe.order-v.order)),M=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),E=t.computed(()=>n.data.collapsed??!1),w=t.computed(()=>n.data.locked??!1),S=t.computed(()=>b.value&&!w.value);function B(){b.value&&(o==null||o.setEntityCollapsed(n.id,!E.value))}const z=t.computed(()=>M.value==="PHYSICAL"||M.value==="LOGICAL_PHYSICAL"),K=t.computed(()=>{const oe=M.value==="PHYSICAL"||M.value==="LOGICAL_PHYSICAL",v={};for(const D of C.value){const ee=D.attrType.startsWith("RELATION")&&D.dbAttrs.length>0;v[D.modelId]={pk:D.identifier,fk:ee&&oe,required:D.notNull&&!D.identifier}}return v});function J(oe){if(!oe)return"";const v=[];return oe.pk&&oe.fk?v.push(i("em.node.keyPfk")):oe.pk?v.push(i("em.node.keyPk")):oe.fk&&v.push(i("em.node.keyFk")),oe.required&&v.push(i("em.node.required")),v.join(" · ")}const re=t.computed(()=>{const oe=Kl(_t(n.data.style)),v={};return oe&&(v["--em-header-bg"]=oe.bar,v["--em-header-fg"]=oe.barOn),v});function pe(oe){var v,D;return(D=Kl(_t((v=n.data.attributeStyles)==null?void 0:v[oe.modelId])))==null?void 0:D.text}const ce=t.computed(()=>[...R.value.operations??[]].sort((oe,v)=>oe.order-v.order)),Ne=t.computed(()=>M.value==="CLASS"&&ce.value.length>0),he={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function de(oe){return oe?he[oe]:"~"}function _e(oe){var v,D;return(D=Kl(_t((v=n.data.operationStyles)==null?void 0:v[oe.modelId])))==null?void 0:D.text}function Se(oe,v,D){switch(M.value){case"CLASS":return[{text:oe}];case"PHYSICAL":return[{text:D||oe}];case"LOGICAL":return[v?{text:v}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const ee=v?{text:v}:{text:i("em.node.logicalMissing"),missing:!0};return D?[ee,{text:` · ${D}`}]:[ee]}}}function me(oe){var v;return((v=h.value)==null?void 0:v.effectiveAttrs.get(oe.modelId))??oe}function ye(oe){var D,ee,Z;if(ie(oe))return[{text:oe.name}];const v=me(oe);return Se(oe.name,(ee=(D=v.dbAttrs[0])==null?void 0:D.logicalName)==null?void 0:ee[a.value],((Z=v.dbAttrs[0])==null?void 0:Z.physicalName)??"")}function ie(oe){return oe.attrType.startsWith("EMBED")&&oe.dbAttrs.length>0}function se(oe){return oe.attrType==="DIVIDER"}function fe(oe){var v;return((v=h.value)==null?void 0:v.embedCols.get(oe.modelId))??oe.dbAttrs}function O(oe){var v;return(v=h.value)==null?void 0:v.redundantSlots.get(oe.modelId)}const L=t.computed(()=>(p==null?void 0:p.isCollapsed(Sf(n.id)))??!1),F=t.computed(()=>L.value&&z.value?C.value.reduce((oe,v)=>ie(v)?oe+fe(v).length:oe,0):0),Q=t.computed(()=>C.value.some(oe=>ie(oe)));function Y(oe){const v=O(oe);return!v||v.size===0?!1:p?p.isCollapsed(vf(n.id,oe.modelId)):!1}function ke(oe){var v;return Y(oe)?((v=O(oe))==null?void 0:v.size)??0:0}function be(oe){return p?p.isCollapsed(Rf(n.id,oe.modelId)):!1}function Ce(oe){var v;return!z.value||L.value?null:be(oe)?"attr":(((v=O(oe))==null?void 0:v.size)??0)>0?"slot":null}function ve(oe){return!L.value&&ie(oe)}function U(oe){return be(oe)?fe(oe).length:0}function H(oe){if(L.value||be(oe))return[];const v=fe(oe);if(!Y(oe))return v;const D=O(oe);return v.filter((ee,Z)=>!D.has(Z))}function q(oe){p==null||p.toggle(vf(n.id,oe.modelId))}function xe(oe){p==null||p.toggle(Rf(n.id,oe.modelId))}function De(){p==null||p.toggle(Sf(n.id))}function W(oe){var v;return Se(oe.physicalName,(v=oe.logicalName)==null?void 0:v[a.value],oe.physicalName)}function ne(oe){var D;const v=(D=h.value)==null?void 0:D.collectionTypes.get(oe.modelId);return Sr(M.value,me(oe),v)}const G=t.computed(()=>{const oe={};for(const v of C.value)oe[v.modelId]=ne(v);return oe}),P=t.computed(()=>{var oe,v,D;return Se(R.value.name,(v=(oe=R.value.table)==null?void 0:oe.logicalName)==null?void 0:v[a.value],((D=R.value.table)==null?void 0:D.physicalName)??"")}),ae=t.ref(!1),Re=t.ref(""),le=t.ref(null);async function j(){var oe,v;S.value&&(Re.value=R.value.name,ae.value=!0,await t.nextTick(),(oe=le.value)==null||oe.focus(),(v=le.value)==null||v.select())}function Xe(){if(!ae.value)return;ae.value=!1;const oe=Re.value.trim();oe&&oe!==R.value.name&&(o==null||o.renameEntity(n.id,oe))}function rt(){o==null||o.addAttribute(n.id)}function He(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:Pe,findNode:Oe}=je(),X=t.ref(null),Nt=t.computed(()=>{const oe=X.value??n.data.size;return oe?{width:`${oe.width}px`,minHeight:`${oe.height}px`}:void 0});let Et=null;function yn(oe){var ee,Z,Ie;if(!S.value)return;oe.stopPropagation();const v=(ee=Oe(n.id))==null?void 0:ee.dimensions,D=Pe({x:oe.clientX,y:oe.clientY});Et={fx:D.x,fy:D.y,w:(v==null?void 0:v.width)??((Z=n.data.size)==null?void 0:Z.width)??200,h:(v==null?void 0:v.height)??((Ie=n.data.size)==null?void 0:Ie.height)??120},oe.target.setPointerCapture(oe.pointerId)}function gn(oe){if(!Et)return;const v=Pe({x:oe.clientX,y:oe.clientY});X.value={width:Math.max(40,Et.w+(v.x-Et.fx)),height:Math.max(40,Et.h+(v.y-Et.fy))}}function Ee(oe){var v,D,ee;if(Et&&X.value&&o){const Z=(v=Oe(n.id))==null?void 0:v.dimensions;o.resizeEntity(n.id,{width:Math.round((Z==null?void 0:Z.width)??X.value.width),height:Math.round((Z==null?void 0:Z.height)??X.value.height)})}Et=null,X.value=null,(ee=(D=oe.target).releasePointerCapture)==null||ee.call(D,oe.pointerId)}const nt=t.ref(null),mt=t.ref(null);function Ft(oe,v){if(!S.value)return;v.stopPropagation(),v.preventDefault();const D=x.value,ee=D.has(oe.modelId)?new Set(D):new Set([oe.modelId]);mt.value={ids:ee,dropIndex:-1,lineY:0},v.target.setPointerCapture(v.pointerId)}function Zt(oe){if(!mt.value||!nt.value)return;const v=Array.from(nt.value.querySelectorAll(".em-entity__row"));if(!v.length)return;let D=v.length;for(let Ie=0;Ie<v.length;Ie++){const Me=v[Ie].getBoundingClientRect();if(oe.clientY<Me.top+Me.height/2){D=Ie;break}}const ee=v[v.length-1],Z=D<v.length?v[D].offsetTop:ee.offsetTop+ee.offsetHeight;mt.value={...mt.value,dropIndex:D,lineY:Z}}function Qt(){const oe=mt.value;if(mt.value=null,!oe||oe.dropIndex<0)return;const v=C.value,D=v.filter(ue=>oe.ids.has(ue.modelId)).map(ue=>ue.modelId),ee=v.filter((ue,Ve)=>oe.ids.has(ue.modelId)&&Ve<oe.dropIndex).length,Z=oe.dropIndex-ee,Ie=v.filter(ue=>!oe.ids.has(ue.modelId)).map(ue=>ue.modelId);[...Ie.slice(0,Z),...D,...Ie.slice(Z)].join(",")!==v.map(ue=>ue.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,D,Z))}function we(){mt.value=null}const et=t.ref(null),ft=t.ref(null);function bn(oe,v){S.value&&(v.stopPropagation(),v.preventDefault(),ft.value={id:oe.modelId,dropIndex:-1,lineY:0},v.target.setPointerCapture(v.pointerId))}function ot(oe){if(!ft.value||!et.value)return;const v=Array.from(et.value.querySelectorAll(".em-entity__op-row"));if(!v.length)return;let D=v.length;for(let Ie=0;Ie<v.length;Ie++){const Me=v[Ie].getBoundingClientRect();if(oe.clientY<Me.top+Me.height/2){D=Ie;break}}const ee=v[v.length-1],Z=D<v.length?v[D].offsetTop:ee.offsetTop+ee.offsetHeight;ft.value={...ft.value,dropIndex:D,lineY:Z}}function Fo(){const oe=ft.value;if(ft.value=null,!oe||oe.dropIndex<0)return;const D=ce.value.findIndex(Z=>Z.modelId===oe.id);if(D<0)return;const ee=oe.dropIndex-(D<oe.dropIndex?1:0);ee!==D&&(o==null||o.reorderOperations(n.id,[oe.id],ee))}function Uo(){ft.value=null}return(oe,v)=>{var D,ee;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":_.value,"is-related":N.value,"is-dimmed":V.value,"is-selected":I.value,"is-multi-selected":A.value,"has-focused-attr":$.value,"is-locked":w.value,"is-diff-added":((D=u.value)==null?void 0:D.verb)==="added","is-diff-modified":((ee=u.value)==null?void 0:ee.verb)==="modified"}]),tabindex:"-1",style:t.normalizeStyle(Nt.value),onPointerdown:f,onMouseenter:g,onMouseleave:k,onDblclick:l},[I.value?(t.openBlock(),t.createElementBlock("div",Ex,[...v[11]||(v[11]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(re.value),onDblclick:t.withModifiers(j,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(E.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!E.value,disabled:!b.value,onClick:t.withModifiers(B,["stop"]),onPointerdown:v[0]||(v[0]=t.withModifiers(()=>{},["stop"])),onDblclick:v[1]||(v[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(E.value?"▸":"▾"),41,Nx),t.createElementVNode("span",wx,"«"+t.toDisplayString(t.unref(jo)(R.value.stereotype))+"»",1),ae.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:le,"onUpdate:modelValue":v[2]||(v[2]=Z=>Re.value=Z),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Xe,["enter"]),v[3]||(v[3]=t.withKeys(Z=>ae.value=!1,["esc"]))],onBlur:Xe,onPointerdown:v[4]||(v[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,Re.value]]):(t.openBlock(),t.createElementBlock("span",Ix,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(P.value,(Z,Ie)=>(t.openBlock(),t.createElementBlock("span",{key:Ie,class:t.normalizeClass({"em-entity__missing":Z.missing})},t.toDisplayString(Z.text),3))),128))])),!E.value&&z.value&&Q.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:L.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!L.value,onClick:t.withModifiers(De,["stop"]),onPointerdown:v[5]||(v[5]=t.withModifiers(()=>{},["stop"])),onDblclick:v[6]||(v[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",xx,t.toDisplayString(L.value?"▸":"▾"),1)],40,vx)):t.createCommentVNode("",!0),w.value?(t.openBlock(),t.createBlock(Ae,{key:3,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),E.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:nt,class:"em-entity__attrs"},[mt.value&&mt.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${mt.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(C.value,Z=>{var Ie,Me,ue,Ve,ze,Ue;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Z.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":x.value.has(Z.modelId),"is-dragging":(Ie=mt.value)==null?void 0:Ie.ids.has(Z.modelId),"is-embed":ie(Z),"is-divider":se(Z),"has-embed-badge":!!Ce(Z),nodrag:se(Z)&&S.value,"is-diff-changed":!!((Me=u.value)!=null&&Me.changedAttributeIds.has(Z.modelId))}]),"data-attr":Z.modelId,onClick:t.withModifiers(Fe=>T(Z,Fe),["stop"]),onPointerdown:Fe=>se(Z)?Ft(Z,Fe):void 0,onPointermove:Fe=>se(Z)?Zt(Fe):void 0,onPointerup:Fe=>se(Z)?Qt():void 0,onPointercancel:Fe=>se(Z)?we():void 0},[S.value&&!se(Z)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Fe=>Ft(Z,Fe),onPointermove:Zt,onPointerup:Qt,onPointercancel:we,onClick:v[7]||(v[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,Sx)):t.createCommentVNode("",!0),se(Z)?(t.openBlock(),t.createElementBlock("span",Rx,t.toDisplayString(Z.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Jn),{id:`l:${Z.modelId}`,type:"target",position:t.unref(Te).Left,class:"em-handle",title:S.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:J(K.value[Z.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",Ax,[(ue=K.value[Z.modelId])!=null&&ue.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Ve=K.value[Z.modelId])!=null&&Ve.required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",Tx,[z.value&&ve(Z)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:be(Z)?i("em.node.embedAttrShow",{count:U(Z)}):i("em.node.embedAttrHide"),"aria-expanded":!be(Z),onClick:t.withModifiers(Fe=>xe(Z),["stop"]),onPointerdown:v[8]||(v[8]=t.withModifiers(()=>{},["stop"])),onDblclick:v[9]||(v[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(be(Z)?"▸":"▾"),41,Mx)):ie(Z)?(t.openBlock(),t.createBlock(Ae,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(ze=K.value[Z.modelId])!=null&&ze.fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,$x),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:pe(Z)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ye(Z),(Fe,Ye)=>(t.openBlock(),t.createElementBlock("span",{key:Ye,class:t.normalizeClass({"em-entity__missing":Fe.missing})},t.toDisplayString(Fe.text),3))),128))],4),Ce(Z)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:U(Z)}),onClick:t.withModifiers(Fe=>xe(Z),["stop"])},"+"+t.toDisplayString(U(Z)),9,Vx)):Ce(Z)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:Y(Z)?i("em.node.embedRepeatedShow",{count:((Ue=O(Z))==null?void 0:Ue.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!Y(Z),onClick:t.withModifiers(Fe=>q(Z),["stop"])},t.toDisplayString(Y(Z)?`+${ke(Z)}`:"−"),9,Bx)):t.createCommentVNode("",!0),G.value[Z.modelId]?(t.openBlock(),t.createElementBlock("span",Dx,t.toDisplayString(G.value[Z.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Jn),{id:`r:${Z.modelId}`,type:"source",position:t.unref(Te).Right,class:"em-handle",title:S.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,Cx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ie(Z)&&z.value?H(Z):[],Fe=>(t.openBlock(),t.createElementBlock("li",{key:`${Z.modelId}:${Fe.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":x.value.has(Z.modelId)}]),onClick:t.withModifiers(Ye=>T(Z,Ye),["stop"])},[v[12]||(v[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",Ox,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(W(Fe),(Ye,pt)=>(t.openBlock(),t.createElementBlock("span",{key:pt,class:t.normalizeClass({"em-entity__missing":Ye.missing})},t.toDisplayString(Ye.text),3))),128))]),t.createElementVNode("span",Px,t.toDisplayString(Fe.dataType),1)],10,Lx))),128))],64)}),128)),F.value?(t.openBlock(),t.createElementBlock("li",zx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(De,["stop"])},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:F.value})),1)],8,Fx)])):t.createCommentVNode("",!0)],512)),!E.value&&Ne.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:et,class:"em-entity__ops"},[ft.value&&ft.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ft.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,Z=>{var Ie,Me;return t.openBlock(),t.createElementBlock("li",{key:Z.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Ie=ft.value)==null?void 0:Ie.id)===Z.modelId,"is-diff-changed":!!((Me=u.value)!=null&&Me.changedOperationIds.has(Z.modelId))}]),"data-op":Z.modelId},[S.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ue=>bn(Z,ue),onPointermove:ot,onPointerup:Fo,onPointercancel:Uo,onClick:v[10]||(v[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,Hx)):t.createCommentVNode("",!0),t.createElementVNode("span",jx,t.toDisplayString(de(Z.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:_e(Z)})},t.toDisplayString(Z.name)+"()",5)],10,Ux)}),128))],512)):ce.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ce.value.length})},[t.createVNode(Ae,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ce.value.length})),1)],8,Kx)):t.createCommentVNode("",!0),S.value?(t.openBlock(),t.createElementBlock("footer",Gx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:rt},t.toDisplayString(i("em.node.addAttr")),1),v[13]||(v[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:He},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),S.value&&!ae.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:yn,onPointermove:gn,onPointerup:Ee},null,32)):t.createCommentVNode("",!0)],38)}}}),[["__scopeId","data-v-00804c52"]]),Yx={key:0,class:"em-sel","aria-hidden":"true"},qx={class:"em-group__label"},Wx={class:"em-group__name"},Jx={key:0,class:"em-group__pkg"},Xx={key:1,class:"em-group__flag"},Af=Ke(t.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.computed(()=>n.data.group),i=t.computed(()=>n.data.locked??!1),a=t.computed(()=>_t(n.data.style)),r=t.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=t.inject(to,null),s=(R,C)=>l?l.t(R,C):Lt("ko",R,C),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var R;return!!n.id&&((R=l==null?void 0:l.selection.value)==null?void 0:R.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(Ja,null),h=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),p=t.inject(Vo,null);function y(){n.id&&(p==null||p.setGroupHover(n.id))}function b(){p==null||p.setGroupHover(null)}const f=t.computed(()=>!!p&&p.hoverGroupId.value===n.id),g=t.computed(()=>!!p&&p.hoverGroupId.value!==null&&p.hoverGroupId.value!==n.id),{screenToFlowCoordinate:k,findNode:_}=je();let N=null,I=null;function A(R){var E;if(!n.id||!c.value)return;R.stopPropagation();const C=((E=_(n.id))==null?void 0:E.dimensions)??{width:400,height:300},M=k({x:R.clientX,y:R.clientY});N={fx:M.x,fy:M.y,w:C.width,h:C.height},R.target.setPointerCapture(R.pointerId)}function x(R){if(!N||!n.id)return;const C=k({x:R.clientX,y:R.clientY});I={width:Math.max(160,N.w+(C.x-N.fx)),height:Math.max(120,N.h+(C.y-N.fy))};const M=_(n.id);M&&(M.style={width:`${I.width}px`,height:`${I.height}px`})}function $(R){var C,M;N&&I&&n.id&&l&&l.resizeGroup(n.id,I),N=null,I=null,(M=(C=R.target).releasePointerCapture)==null||M.call(C,R.pointerId)}const T=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),V=t.computed(()=>{const R=o.value.name;return(R==null?void 0:R[T.value])||(R==null?void 0:R.ko)||(R==null?void 0:R.en)||(R==null?void 0:R.ja)||(R==null?void 0:R.zh)||o.value.packageName||s("em.group.fallback")});return(R,C)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":h.value,"is-hover-origin":f.value,"is-dimmed":g.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:b},[d.value?(t.openBlock(),t.createElementBlock("div",Yx,[...C[0]||(C[0]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",qx,[t.createElementVNode("span",Wx,t.toDisplayString(V.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",Jx,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",Xx,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Ae,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)]),c.value&&!i.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:A,onPointermove:x,onPointerup:$},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),Zx={key:0,class:"em-sel","aria-hidden":"true"},Qx={key:2,class:"em-note__text"},Tf=Ke(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(to,null),i=t.inject(Ja,null),a=t.inject(Vo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>_t(r.value.style)),c=t.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=n.data.groupRef??null)}function u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const h=t.computed(()=>{var E;return((E=a==null?void 0:a.source.value)==null?void 0:E.kind)==="note"&&a.source.value.id===n.id}),p=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!h.value),y=t.computed(()=>{var E;return((E=o==null?void 0:o.selection.value)==null?void 0:E.kind)==="note"&&o.selection.value.id===n.id}),b=t.computed(()=>!!n.selected&&!y.value),f=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),g=[{id:"n-top",pos:Te.Top},{id:"n-right",pos:Te.Right},{id:"n-bottom",pos:Te.Bottom},{id:"n-left",pos:Te.Left}],k=t.ref(!1),_=t.ref(""),N=t.ref(null);async function I(){var E;l.value&&(_.value=r.value.memo,k.value=!0,await t.nextTick(),(E=N.value)==null||E.focus())}function A(){k.value&&(k.value=!1,_.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,_.value)))}const{screenToFlowCoordinate:x,findNode:$}=je();let T=null,V=null;function R(E){var B;if(!l.value)return;E.stopPropagation();const w=((B=$(n.id))==null?void 0:B.dimensions)??r.value.geo.size,S=x({x:E.clientX,y:E.clientY});T={fx:S.x,fy:S.y,w:w.width,h:w.height},E.target.setPointerCapture(E.pointerId)}function C(E){if(!T)return;const w=x({x:E.clientX,y:E.clientY});V={width:Math.max(140,T.w+(w.x-T.fx)),height:Math.max(60,T.h+(w.y-T.fy))};const S=$(n.id);S&&(S.style={width:`${V.width}px`,height:`${V.height}px`})}function M(E){var w,S;T&&V&&o&&o.resizeNote(n.id,V),T=null,V=null,(S=(w=E.target).releasePointerCapture)==null||S.call(w,E.pointerId)}return(E,w)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":h.value,"is-related":p.value,"is-dimmed":f.value,"is-selected":y.value,"is-multi-selected":b.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:I,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",Zx,[...w[4]||(w[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),k.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:N,"onUpdate:modelValue":w[0]||(w[0]=S=>_.value=S),class:"em-note__edit nodrag",onBlur:A,onKeydown:w[1]||(w[1]=t.withKeys(S=>k.value=!1,["esc"])),onPointerdown:w[2]||(w[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,_.value]]):(t.openBlock(),t.createElementBlock("div",Qx,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(g,S=>t.createVNode(t.unref(Jn),{id:S.id,key:S.id,type:"source",position:S.pos,class:"em-note-handle",onPointerdown:w[3]||(w[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!k.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:R,onPointermove:C,onPointerup:M},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function Xa(e){switch(e){case"right":return{x:1,y:0};case"left":return{x:-1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const Bo=.5;function Mf(e,n,o,i,a,r){const l=Xa(n),s=Xa(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let h=e;const p=(f,g)=>{(Math.abs(f.x-h.x)>=Bo||Math.abs(f.y-h.y)>=Bo)&&(m.push({a:h,b:f,seg:g}),h=f)};p(c,0);let y=l.x!==0,b=c;for(let f=1;f<u.length;f++){const g=u[f],k=f<=o.length?f-1:o.length,_=Math.abs(g.x-b.x)<Bo,N=Math.abs(g.y-b.y)<Bo;_&&N||(_?(p(g,k),y=!1):N?(p(g,k),y=!0):y?(p({x:b.x,y:g.y},k),p(g,k),y=!0):(p({x:g.x,y:b.y},k),p(g,k),y=!1),b=g)}return p(i,o.length),m}function Vf(e,n,o,i,a,r=20){const l=Mf(e,n,o,i,a,r);let s=`M ${kt(e.x)},${kt(e.y)}`;for(const c of l)s+=` L ${kt(c.b.x)},${kt(c.b.y)}`;return s}const eC=14;function Bf(e,n,o,i,a,r=20){return Mf(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=eC).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function kt(e){return Math.round(e*100)/100}const tC=36;function nC(e,n,o=tC){const i=Math.max(e.x,n.x)+o;return`M ${kt(e.x)},${kt(e.y)} L ${kt(i)},${kt(e.y)} L ${kt(i)},${kt(n.y)} L ${kt(n.x)},${kt(n.y)}`}function Df(e,n,o){const i=[e,...n,o];let a=`M ${kt(i[0].x)},${kt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${kt(i[r].x)},${kt(i[r].y)}`;return a}function oC(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Lf(e,n){const o=oC(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Bo&&Math.abs(l)<Bo)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=r!==0?i/Math.abs(r):1/0,c=l!==0?a/Math.abs(l):1/0,d=Math.min(s,c),u={x:o.x+r*d,y:o.y+l*d},m=s<=c?r>=0?"right":"left":l>=0?"bottom":"top";return{point:u,side:m}}function Of(e,n,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:n},side:i?"right":"left"}}function Pf(e,n,o){const i=[e,...n,o],a=[];for(let r=1;r<i.length;r++){const l=i[r-1],s=i[r];a.push({x:(l.x+s.x)/2,y:(l.y+s.y)/2})}return a}const iC=20,aC=22,rC=7,lC=22,zf=31,Ff=7,sC=20,Uf=11,Hf=11,cC=zf+Ff;function dC(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function uC(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Za(e,n,o){const i=n.x-e.x,a=n.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function jf(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function Qa(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function Kf(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:jf(e,n);return[Qa(o,a,r-Math.PI/2),Qa(o,a,r+Math.PI/2)]}function Gf(e,n,o,i){const a=n*180/Math.PI,l=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(l)*o+e.x,y:Math.cos(l)*o+e.y}}function Yf(e,n,o,i){const a=[],r=[],l=[];if(e.x===n.x&&e.y===n.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=Za(e,n,iC),[d,u]=Kf(e,n,c,aC);if(a.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),dC(o.multiplicity)){const m=Za(e,n,zf);r.push({cx:m.x,cy:m.y,r:Ff})}if(uC(o.multiplicity)){const m=Za(e,n,rC),[h,p]=Kf(e,n,m,lC);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.y}),a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=Za(e,n,sC),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=jf(e,n),m=Qa(d,Uf/2,u-Math.PI/2),h=Qa(d,Uf/2,u+Math.PI/2);l.push({points:[e,m,c,h]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=Gf(s,c,Hf,!0),u=Gf(s,c,Hf,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:a,circles:r,polygons:l}}const qf=200,Wf=120,Jl=24;function Jf(e){var a,r;if(!e)return{x:0,y:0,width:qf,height:Wf};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||qf,i=((r=e.dimensions)==null?void 0:r.height)||Wf;return{x:n.x,y:n.y,width:o,height:i}}function Xf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Zf(e){const n=t.computed(()=>Jf(e.sourceNode())),o=t.computed(()=>Jf(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var p,y;const d=n.value,u=d.x+d.width;let m=((p=e.sourceRowY)==null?void 0:p.call(e))??d.y+d.height/3,h=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(h-m)<Jl){const b=(m+h)/2;m=b-Jl/2,h=b+Jl/2}return{source:{x:u,y:m},target:{x:u,y:h}}}),r=t.computed(()=>e.waypoints()[0]??Xf(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??Xf(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Of(n.value,d,r.value.x):Lf(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Of(o.value,d,l.value.x):Lf(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const Xl=Symbol("waypointController"),mC=["d"],fC=["d"],pC=["d"],hC=["x1","y1","x2","y2"],yC=["cx","cy","r"],gC=["x","y"],bC=["x","y"],_C=["cx","cy","onDblclick"],kC=["x","y","onPointerdown","onDblclick"],Qf=Ke(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(Xl),a=t.inject(to,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(_f,null),s=t.inject(Vo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var ie;return((ie=a==null?void 0:a.selection.value)==null?void 0:ie.kind)==="association"&&a.selection.value.id===n.id}),u=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),m=t.computed(()=>{const ie=l==null?void 0:l.value;if(!ie||!a)return null;const se=a.resolved.value.entities,fe=L=>{var F;return(F=se.find(Q=>Q.entity.modelId===L))==null?void 0:F.groupRef},O=n.data.association;return fe(O.end1.entityRef)===ie.groupId&&fe(O.end2.entityRef)===ie.groupId?{dx:ie.dx,dy:ie.dy}:null}),h=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),p=t.ref(-1),y=t.ref({x:0,y:0}),b=t.computed(()=>{const ie=m.value;return h.value.map((se,fe)=>fe===p.value?y.value:ie?{x:se.x+ie.dx,y:se.y+ie.dy}:se)}),f=t.computed(()=>{var ie;return!!((ie=n.sourceNode.data)!=null&&ie.collapsed)}),g=t.computed(()=>{var ie;return!!((ie=n.targetNode.data)!=null&&ie.collapsed)}),{source:k,target:_,sourceSide:N,targetSide:I,isSelf:A}=Zf({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>b.value,sourceRowY:()=>n.data.sourceColumnRef&&!f.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!g.value?n.targetY:void 0}),x=cC+4,$=t.computed(()=>A.value?nC(k.value,_.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Vf(k.value,N.value,b.value,_.value,I.value,x):Df(k.value,b.value,_.value)),T=t.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Bf(k.value,N.value,b.value,_.value,I.value,x):Pf(k.value,b.value,_.value).map((ie,se)=>({point:ie,segIndex:se}))),V=t.computed(()=>A.value||!r.value?[]:b.value),R=Fi;function C(ie,se){p.value=ie,y.value={...h.value[ie]},se.target.setPointerCapture(se.pointerId),se.stopPropagation()}function M(ie){if(p.value<0)return;const se=o({x:ie.clientX,y:ie.clientY});y.value={x:se.x,y:se.y}}function E(ie){var se,fe;p.value>=0&&i&&i.movePoint(n.id,p.value,{...y.value}),p.value=-1,(fe=(se=ie.target).releasePointerCapture)==null||fe.call(se,ie.pointerId)}function w(ie,se){se.stopPropagation(),i==null||i.removePoint(n.id,ie)}function S(ie,se){if(!i)return;const fe=o({x:se.clientX,y:se.clientY});i.insertPoint(n.id,ie,{x:fe.x,y:fe.y})}const B=t.computed(()=>R(n.data.association.end1.multiplicity)),z=t.computed(()=>R(n.data.association.end2.multiplicity)),K=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),J=t.computed(()=>K.value==="class"),re=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ie=Xa(N.value);return{x:k.value.x+ie.x*10,y:k.value.y+ie.y*10}}return b.value[0]??_.value}),pe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const se=Xa(I.value);return{x:_.value.x+se.x*10,y:_.value.y+se.y*10}}const ie=b.value;return ie[ie.length-1]??k.value}),ce=t.computed(()=>{const ie=n.data.association;return{multiplicity:ie.end1.multiplicity,navigable:ie.end1.navigable,composition:ie.end1.composition,otherNavigable:ie.end2.navigable}}),Ne=t.computed(()=>{const ie=n.data.association;return{multiplicity:ie.end2.multiplicity,navigable:ie.end2.navigable,composition:ie.end2.composition,otherNavigable:ie.end1.navigable}}),he=t.computed(()=>Yf(k.value,re.value,ce.value,K.value)),de=t.computed(()=>Yf(_.value,pe.value,Ne.value,K.value)),_e=t.computed(()=>[...he.value.lines,...de.value.lines]),Se=t.computed(()=>[...he.value.circles,...de.value.circles]),me=t.computed(()=>[...he.value.polygons,...de.value.polygons].map(ie=>`M${ie.points.map(se=>`${se.x},${se.y}`).join(" L")} Z`)),ye=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ie,se)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:$.value,fill:"none",class:"em-edge__hit"},null,8,mC),t.createElementVNode("path",{d:$.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,fC),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me.value,(fe,O)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${O}`,d:fe,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",ye.value])},null,10,pC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_e.value,(fe,O)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${O}`,x1:fe.x1,y1:fe.y1,x2:fe.x2,y2:fe.y2,class:t.normalizeClass(["em-edge__marker",ye.value])},null,10,hC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value,(fe,O)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${O}`,cx:fe.cx,cy:fe.cy,r:fe.r,class:t.normalizeClass(["em-edge__marker",ye.value])},null,10,yC))),128)),J.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(k).x+8,y:t.unref(k).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(B.value),11,gC),t.createElementVNode("text",{x:t.unref(_).x-8,y:t.unref(_).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(z.value),11,bC)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,(fe,O)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${O}`,cx:fe.point.x,cy:fe.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(L=>S(fe.segIndex,L),["stop"])},null,42,_C))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.value,(fe,O)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${O}`,x:fe.x-5,y:fe.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:L=>C(O,L),onPointermove:M,onPointerup:E,onDblclick:L=>w(O,L)},null,42,kC))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var mn=(e=>(e.Lines="lines",e.Dots="dots",e))(mn||{});const ep=function({dimensions:e,size:n,color:o}){return t.h("path",{stroke:o,"stroke-width":n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},tp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};mn.Lines+"",mn.Dots+"";const EC={[mn.Dots]:"#81818a",[mn.Lines]:"#eee"},NC=["id","x","y","width","height","patternTransform"],wC={key:2,height:"100",width:"100"},IC=["fill"],vC=["x","y","fill"],xC={name:"Background",compatConfig:{MODE:3}},CC=t.defineComponent({...xC,props:{id:{},variant:{default:()=>mn.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:n,viewport:o}=je(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],p=[m*l||1+d[0]/2,h*l||1+d[1]/2];return{scaledGap:d,offset:p,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||EC[e.variant||mn.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[t.createElementVNode("pattern",{id:a.value,x:t.unref(o).x%i.value.scaledGap[0],y:t.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(mn).Lines?(t.openBlock(),t.createBlock(t.unref(ep),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(mn).Dots?(t.openBlock(),t.createBlock(t.unref(tp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",wC,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,IC)])):t.createCommentVNode("",!0)])],8,NC)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,vC),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),SC={name:"ControlButton",compatConfig:{MODE:3}},RC=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},$C={type:"button",class:"vue-flow__controls-button"};function AC(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",$C,[t.renderSlot(e.$slots,"default")])}const no=RC(SC,[["render",AC]]),TC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},MC=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function VC(e,n){return t.openBlock(),t.createElementBlock("svg",TC,MC)}const BC={render:VC},DC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},LC=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function OC(e,n){return t.openBlock(),t.createElementBlock("svg",DC,LC)}const PC={render:OC},zC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},FC=[t.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function UC(e,n){return t.openBlock(),t.createElementBlock("svg",zC,FC)}const HC={render:UC},jC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},KC=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function GC(e,n){return t.openBlock(),t.createElementBlock("svg",jC,KC)}const YC={render:GC},qC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},WC=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function JC(e,n){return t.openBlock(),t.createElementBlock("svg",qC,WC)}const XC={render:JC},ZC={name:"Controls",compatConfig:{MODE:3}},QC=t.defineComponent({...ZC,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>em.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=je(),h=t.toRef(()=>o.value||i.value||a.value),p=t.toRef(()=>d.value.zoom<=u.value),y=t.toRef(()=>d.value.zoom>=m.value);function b(){l(),n("zoomIn")}function f(){s(),n("zoomOut")}function g(){c(e.fitViewParams),n("fitView")}function k(){r(!h.value),n("interactionChange",!h.value)}return(_,N)=>(t.openBlock(),t.createBlock(t.unref(Zm),{class:"vue-flow__controls",position:_.position},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"top"),_.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(_.$slots,"control-zoom-in",{},()=>[t.createVNode(no,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:b},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(BC))))])]),_:3},8,["disabled"])]),t.renderSlot(_.$slots,"control-zoom-out",{},()=>[t.createVNode(no,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:f},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(PC))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),_.showFitView?t.renderSlot(_.$slots,"control-fit-view",{key:1},()=>[t.createVNode(no,{class:"vue-flow__controls-fitview",onClick:g},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(HC))))])]),_:3})]):t.createCommentVNode("",!0),_.showInteractive?t.renderSlot(_.$slots,"control-interactive",{key:2},()=>[_.showInteractive?(t.openBlock(),t.createBlock(no,{key:0,class:"vue-flow__controls-interactive",onClick:k},{default:t.withCtx(()=>[h.value?t.renderSlot(_.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(XC))))]):t.createCommentVNode("",!0),h.value?t.createCommentVNode("",!0):t.renderSlot(_.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(YC))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(_.$slots,"default")]),_:3},8,["position"]))}});var eS={value:()=>{}};function Zl(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new er(o)}function er(e){this._=e}function tS(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}er.prototype=Zl.prototype={constructor:er,on:function(e,n){var o=this._,i=tS(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=nS(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=np(o[a],e.name,n);else if(n==null)for(a in o)o[a]=np(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new er(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function nS(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function np(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=eS,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Ql="http://www.w3.org/1999/xhtml";const op={svg:"http://www.w3.org/2000/svg",xhtml:Ql,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function tr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),op.hasOwnProperty(n)?{space:op[n],local:e}:e}function oS(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Ql&&n.documentElement.namespaceURI===Ql?n.createElement(e):n.createElementNS(o,e)}}function iS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ip(e){var n=tr(e);return(n.local?iS:oS)(n)}function aS(){}function es(e){return e==null?aS:function(){return this.querySelector(e)}}function rS(e){typeof e!="function"&&(e=es(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Rt(i,this._parents)}function lS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function sS(){return[]}function ap(e){return e==null?sS:function(){return this.querySelectorAll(e)}}function cS(e){return function(){return lS(e.apply(this,arguments))}}function dS(e){typeof e=="function"?e=cS(e):e=ap(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new Rt(i,a)}function rp(e){return function(){return this.matches(e)}}function lp(e){return function(n){return n.matches(e)}}var uS=Array.prototype.find;function mS(e){return function(){return uS.call(this.children,e)}}function fS(){return this.firstElementChild}function pS(e){return this.select(e==null?fS:mS(typeof e=="function"?e:lp(e)))}var hS=Array.prototype.filter;function yS(){return Array.from(this.children)}function gS(e){return function(){return hS.call(this.children,e)}}function bS(e){return this.selectAll(e==null?yS:gS(typeof e=="function"?e:lp(e)))}function _S(e){typeof e!="function"&&(e=rp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Rt(i,this._parents)}function sp(e){return new Array(e.length)}function kS(){return new Rt(this._enter||this._groups.map(sp),this._parents)}function nr(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}nr.prototype={constructor:nr,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ES(e){return function(){return e}}function NS(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new nr(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function wS(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),p;for(s=0;s<u;++s)(c=n[s])&&(h[s]=p=l.call(c,c.__data__,s,n)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new nr(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function IS(e){return e.__data__}function vS(e,n){if(!arguments.length)return Array.from(this,IS);var o=n?wS:NS,i=this._parents,a=this._groups;typeof e!="function"&&(e=ES(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],h=m.length,p=xS(e.call(u,u&&u.__data__,d,i)),y=p.length,b=s[d]=new Array(y),f=l[d]=new Array(y),g=c[d]=new Array(h);o(u,m,b,f,g,p,n);for(var k=0,_=0,N,I;k<y;++k)if(N=b[k]){for(k>=_&&(_=k+1);!(I=f[_])&&++_<y;);N._next=I||null}}return l=new Rt(l,i),l._enter=s,l._exit=c,l}function xS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function CS(){return new Rt(this._exit||this._groups.map(sp),this._parents)}function SS(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function RS(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,h=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(h[y]=p);for(;c<a;++c)s[c]=o[c];return new Rt(s,this._parents)}function $S(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function AS(e){e||(e=TS);function n(m,h){return m&&h?e(m.__data__,h.__data__):!m-!h}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Rt(a,this._parents).order()}function TS(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function MS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function VS(){return Array.from(this)}function BS(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function DS(){let e=0;for(const n of this)++e;return e}function LS(){return!this.node()}function OS(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function PS(e){return function(){this.removeAttribute(e)}}function zS(e){return function(){this.removeAttributeNS(e.space,e.local)}}function FS(e,n){return function(){this.setAttribute(e,n)}}function US(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function HS(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function jS(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function KS(e,n){var o=tr(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?zS:PS:typeof n=="function"?o.local?jS:HS:o.local?US:FS)(o,n))}function cp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function GS(e){return function(){this.style.removeProperty(e)}}function YS(e,n,o){return function(){this.style.setProperty(e,n,o)}}function qS(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function WS(e,n,o){return arguments.length>1?this.each((n==null?GS:typeof n=="function"?qS:YS)(e,n,o??"")):Do(this.node(),e)}function Do(e,n){return e.style.getPropertyValue(n)||cp(e).getComputedStyle(e,null).getPropertyValue(n)}function JS(e){return function(){delete this[e]}}function XS(e,n){return function(){this[e]=n}}function ZS(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function QS(e,n){return arguments.length>1?this.each((n==null?JS:typeof n=="function"?ZS:XS)(e,n)):this.node()[e]}function dp(e){return e.trim().split(/^|\s+/)}function ts(e){return e.classList||new up(e)}function up(e){this._node=e,this._names=dp(e.getAttribute("class")||"")}up.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function mp(e,n){for(var o=ts(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function fp(e,n){for(var o=ts(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function eR(e){return function(){mp(this,e)}}function tR(e){return function(){fp(this,e)}}function nR(e,n){return function(){(n.apply(this,arguments)?mp:fp)(this,e)}}function oR(e,n){var o=dp(e+"");if(arguments.length<2){for(var i=ts(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?nR:n?eR:tR)(o,n))}function iR(){this.textContent=""}function aR(e){return function(){this.textContent=e}}function rR(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function lR(e){return arguments.length?this.each(e==null?iR:(typeof e=="function"?rR:aR)(e)):this.node().textContent}function sR(){this.innerHTML=""}function cR(e){return function(){this.innerHTML=e}}function dR(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function uR(e){return arguments.length?this.each(e==null?sR:(typeof e=="function"?dR:cR)(e)):this.node().innerHTML}function mR(){this.nextSibling&&this.parentNode.appendChild(this)}function fR(){return this.each(mR)}function pR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function hR(){return this.each(pR)}function yR(e){var n=typeof e=="function"?e:ip(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function gR(){return null}function bR(e,n){var o=typeof e=="function"?e:ip(e),i=n==null?gR:typeof n=="function"?n:es(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function _R(){var e=this.parentNode;e&&e.removeChild(this)}function kR(){return this.each(_R)}function ER(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function NR(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function wR(e){return this.select(e?NR:ER)}function IR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function vR(e){return function(n){e.call(this,n,this.__data__)}}function xR(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function CR(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function SR(e,n,o){return function(){var i=this.__on,a,r=vR(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function RR(e,n,o){var i=xR(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?SR:CR,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function pp(e,n,o){var i=cp(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function $R(e,n){return function(){return pp(this,e,n)}}function AR(e,n){return function(){return pp(this,e,n.apply(this,arguments))}}function TR(e,n){return this.each((typeof n=="function"?AR:$R)(e,n))}function*MR(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var hp=[null];function Rt(e,n){this._groups=e,this._parents=n}function Ei(){return new Rt([[document.documentElement]],hp)}function VR(){return this}Rt.prototype=Ei.prototype={constructor:Rt,select:rS,selectAll:dS,selectChild:pS,selectChildren:bS,filter:_S,data:vS,enter:kS,exit:CS,join:SS,merge:RS,selection:VR,order:$S,sort:AS,call:MS,nodes:VS,node:BS,size:DS,empty:LS,each:OS,attr:KS,style:WS,property:QS,classed:oR,text:lR,html:uR,raise:fR,lower:hR,append:yR,insert:bR,remove:kR,clone:wR,datum:IR,on:RR,dispatch:TR,[Symbol.iterator]:MR};function $n(e){return typeof e=="string"?new Rt([[document.querySelector(e)]],[document.documentElement]):new Rt([[e]],hp)}function BR(e){let n;for(;n=e.sourceEvent;)e=n;return e}function An(e,n){if(e=BR(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const ns={capture:!0,passive:!1};function os(e){e.preventDefault(),e.stopImmediatePropagation()}function DR(e){var n=e.document.documentElement,o=$n(e).on("dragstart.drag",os,ns);"onselectstart"in n?o.on("selectstart.drag",os,ns):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function LR(e,n){var o=e.document.documentElement,i=$n(e).on("dragstart.drag",null);n&&(i.on("click.drag",os,ns),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function is(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function yp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Ni(){}var wi=.7,or=1/wi,Lo="\\s*([+-]?\\d+)\\s*",Ii="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Jt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",OR=/^#([0-9a-f]{3,8})$/,PR=new RegExp(`^rgb\\(${Lo},${Lo},${Lo}\\)$`),zR=new RegExp(`^rgb\\(${Jt},${Jt},${Jt}\\)$`),FR=new RegExp(`^rgba\\(${Lo},${Lo},${Lo},${Ii}\\)$`),UR=new RegExp(`^rgba\\(${Jt},${Jt},${Jt},${Ii}\\)$`),HR=new RegExp(`^hsl\\(${Ii},${Jt},${Jt}\\)$`),jR=new RegExp(`^hsla\\(${Ii},${Jt},${Jt},${Ii}\\)$`),gp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};is(Ni,vi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:bp,formatHex:bp,formatHex8:KR,formatHsl:GR,formatRgb:_p,toString:_p});function bp(){return this.rgb().formatHex()}function KR(){return this.rgb().formatHex8()}function GR(){return Ip(this).formatHsl()}function _p(){return this.rgb().formatRgb()}function vi(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=OR.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?kp(n):o===3?new vt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ir(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ir(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=PR.exec(e))?new vt(n[1],n[2],n[3],1):(n=zR.exec(e))?new vt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=FR.exec(e))?ir(n[1],n[2],n[3],n[4]):(n=UR.exec(e))?ir(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=HR.exec(e))?wp(n[1],n[2]/100,n[3]/100,1):(n=jR.exec(e))?wp(n[1],n[2]/100,n[3]/100,n[4]):gp.hasOwnProperty(e)?kp(gp[e]):e==="transparent"?new vt(NaN,NaN,NaN,0):null}function kp(e){return new vt(e>>16&255,e>>8&255,e&255,1)}function ir(e,n,o,i){return i<=0&&(e=n=o=NaN),new vt(e,n,o,i)}function YR(e){return e instanceof Ni||(e=vi(e)),e?(e=e.rgb(),new vt(e.r,e.g,e.b,e.opacity)):new vt}function as(e,n,o,i){return arguments.length===1?YR(e):new vt(e,n,o,i??1)}function vt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}is(vt,as,yp(Ni,{brighter(e){return e=e==null?or:Math.pow(or,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?wi:Math.pow(wi,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vt(oo(this.r),oo(this.g),oo(this.b),ar(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ep,formatHex:Ep,formatHex8:qR,formatRgb:Np,toString:Np}));function Ep(){return`#${io(this.r)}${io(this.g)}${io(this.b)}`}function qR(){return`#${io(this.r)}${io(this.g)}${io(this.b)}${io((isNaN(this.opacity)?1:this.opacity)*255)}`}function Np(){const e=ar(this.opacity);return`${e===1?"rgb(":"rgba("}${oo(this.r)}, ${oo(this.g)}, ${oo(this.b)}${e===1?")":`, ${e})`}`}function ar(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function oo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function io(e){return e=oo(e),(e<16?"0":"")+e.toString(16)}function wp(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Pt(e,n,o,i)}function Ip(e){if(e instanceof Pt)return new Pt(e.h,e.s,e.l,e.opacity);if(e instanceof Ni||(e=vi(e)),!e)return new Pt;if(e instanceof Pt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Pt(l,s,c,e.opacity)}function WR(e,n,o,i){return arguments.length===1?Ip(e):new Pt(e,n,o,i??1)}function Pt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}is(Pt,WR,yp(Ni,{brighter(e){return e=e==null?or:Math.pow(or,e),new Pt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?wi:Math.pow(wi,e),new Pt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new vt(rs(e>=240?e-240:e+120,a,i),rs(e,a,i),rs(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Pt(vp(this.h),rr(this.s),rr(this.l),ar(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ar(this.opacity);return`${e===1?"hsl(":"hsla("}${vp(this.h)}, ${rr(this.s)*100}%, ${rr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vp(e){return e=(e||0)%360,e<0?e+360:e}function rr(e){return Math.max(0,Math.min(1,e||0))}function rs(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const xp=e=>()=>e;function JR(e,n){return function(o){return e+o*n}}function XR(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function ZR(e){return(e=+e)==1?Cp:function(n,o){return o-n?XR(n,o,e):xp(isNaN(n)?o:n)}}function Cp(e,n){var o=n-e;return o?JR(e,o):xp(isNaN(e)?n:e)}const Sp=(function e(n){var o=ZR(n);function i(a,r){var l=o((a=as(a)).r,(r=as(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Cp(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function Tn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var ls=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ss=new RegExp(ls.source,"g");function QR(e){return function(){return e}}function e$(e){return function(n){return e(n)+""}}function t$(e,n){var o=ls.lastIndex=ss.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=ls.exec(e))&&(a=ss.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Tn(i,a)})),o=ss.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?e$(c[0].x):QR(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var Rp=180/Math.PI,cs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $p(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*Rp,skewX:Math.atan(c)*Rp,scaleX:l,scaleY:s}}var lr;function n$(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?cs:$p(n.a,n.b,n.c,n.d,n.e,n.f)}function o$(e){return e==null||(lr||(lr=document.createElementNS("http://www.w3.org/2000/svg","g")),lr.setAttribute("transform",e),!(e=lr.transform.baseVal.consolidate()))?cs:(e=e.matrix,$p(e.a,e.b,e.c,e.d,e.e,e.f))}function Ap(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push("translate(",null,n,null,o);y.push({i:b-4,x:Tn(d,m)},{i:b-2,x:Tn(u,h)})}else(m||h)&&p.push("translate("+m+n+h+o)}function l(d,u,m,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Tn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,h){d!==u?h.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Tn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push(a(p)+"scale(",null,",",null,")");y.push({i:b-4,x:Tn(d,m)},{i:b-2,x:Tn(u,h)})}else(m!==1||h!==1)&&p.push(a(p)+"scale("+m+","+h+")")}return function(d,u){var m=[],h=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,h),l(d.rotate,u.rotate,m,h),s(d.skewX,u.skewX,m,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,h),d=u=null,function(p){for(var y=-1,b=h.length,f;++y<b;)m[(f=h[y]).i]=f.x(p);return m.join("")}}}var i$=Ap(n$,"px, ","px)","deg)"),a$=Ap(o$,", ",")",")"),r$=1e-12;function Tp(e){return((e=Math.exp(e))+1/e)/2}function l$(e){return((e=Math.exp(e))-1/e)/2}function s$(e){return((e=Math.exp(2*e))-1)/(e+1)}const c$=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],h=l[2],p=u-s,y=m-c,b=p*p+y*y,f,g;if(b<r$)g=Math.log(h/d)/n,f=function(x){return[s+x*p,c+x*y,d*Math.exp(n*x*g)]};else{var k=Math.sqrt(b),_=(h*h-d*d+i*b)/(2*d*o*k),N=(h*h-d*d-i*b)/(2*h*o*k),I=Math.log(Math.sqrt(_*_+1)-_),A=Math.log(Math.sqrt(N*N+1)-N);g=(A-I)/n,f=function(x){var $=x*g,T=Tp(I),V=d/(o*k)*(T*s$(n*$+I)-l$(I));return[s+V*p,c+V*y,d*T/Tp(n*$+I)]}}return f.duration=g*1e3*n/Math.SQRT2,f}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Oo=0,xi=0,Ci=0,Mp=1e3,sr,Si,cr=0,ao=0,dr=0,Ri=typeof performance=="object"&&performance.now?performance:Date,Vp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ds(){return ao||(Vp(d$),ao=Ri.now()+dr)}function d$(){ao=0}function ur(){this._call=this._time=this._next=null}ur.prototype=Bp.prototype={constructor:ur,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?ds():+o)+(n==null?0:+n),!this._next&&Si!==this&&(Si?Si._next=this:sr=this,Si=this),this._call=e,this._time=o,us()},stop:function(){this._call&&(this._call=null,this._time=1/0,us())}};function Bp(e,n,o){var i=new ur;return i.restart(e,n,o),i}function u$(){ds(),++Oo;for(var e=sr,n;e;)(n=ao-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Oo}function Dp(){ao=(cr=Ri.now())+dr,Oo=xi=0;try{u$()}finally{Oo=0,f$(),ao=0}}function m$(){var e=Ri.now(),n=e-cr;n>Mp&&(dr-=n,cr=e)}function f$(){for(var e,n=sr,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:sr=o);Si=e,us(i)}function us(e){if(!Oo){xi&&(xi=clearTimeout(xi));var n=e-ao;n>24?(e<1/0&&(xi=setTimeout(Dp,e-Ri.now()-dr)),Ci&&(Ci=clearInterval(Ci))):(Ci||(cr=Ri.now(),Ci=setInterval(m$,Mp)),Oo=1,Vp(Dp))}}function Lp(e,n,o){var i=new ur;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var p$=Zl("start","end","cancel","interrupt"),h$=[],Op=0,Pp=1,ms=2,mr=3,zp=4,fs=5,fr=6;function pr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;y$(e,o,{name:n,index:i,group:a,on:p$,tween:h$,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Op})}function ps(e,n){var o=zt(e,n);if(o.state>Op)throw new Error("too late; already scheduled");return o}function Xt(e,n){var o=zt(e,n);if(o.state>mr)throw new Error("too late; already running");return o}function zt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function y$(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Bp(r,0,o.time);function r(d){o.state=Pp,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,p;if(o.state!==Pp)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===mr)return Lp(l);p.state===zp?(p.state=fr,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<n&&(p.state=fr,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Lp(function(){o.state===mr&&(o.state=zp,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ms,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ms){for(o.state=mr,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=fs,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===fs&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=fr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function hr(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>ms&&i.state<fs,i.state=fr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function g$(e){return this.each(function(){hr(this,e)})}function b$(e,n){var o,i;return function(){var a=Xt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function _$(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Xt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function k$(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=zt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?b$:_$)(o,e,n))}function hs(e,n,o){var i=e._id;return e.each(function(){var a=Xt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return zt(a,i).value[n]}}function Fp(e,n){var o;return(typeof n=="number"?Tn:n instanceof vi?Sp:(o=vi(n))?(n=o,Sp):t$)(e,n)}function E$(e){return function(){this.removeAttribute(e)}}function N$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function w$(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function I$(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function v$(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function x$(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function C$(e,n){var o=tr(e),i=o==="transform"?a$:Fp;return this.attrTween(e,typeof n=="function"?(o.local?x$:v$)(o,i,hs(this,"attr."+e,n)):n==null?(o.local?N$:E$)(o):(o.local?I$:w$)(o,i,n))}function S$(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function R$(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function $$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&R$(e,r)),o}return a._value=n,a}function A$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&S$(e,r)),o}return a._value=n,a}function T$(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=tr(e);return this.tween(o,(i.local?$$:A$)(i,n))}function M$(e,n){return function(){ps(this,e).delay=+n.apply(this,arguments)}}function V$(e,n){return n=+n,function(){ps(this,e).delay=n}}function B$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?M$:V$)(n,e)):zt(this.node(),n).delay}function D$(e,n){return function(){Xt(this,e).duration=+n.apply(this,arguments)}}function L$(e,n){return n=+n,function(){Xt(this,e).duration=n}}function O$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?D$:L$)(n,e)):zt(this.node(),n).duration}function P$(e,n){if(typeof n!="function")throw new Error;return function(){Xt(this,e).ease=n}}function z$(e){var n=this._id;return arguments.length?this.each(P$(n,e)):zt(this.node(),n).ease}function F$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Xt(this,e).ease=o}}function U$(e){if(typeof e!="function")throw new Error;return this.each(F$(this._id,e))}function H$(e){typeof e!="function"&&(e=rp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new fn(i,this._parents,this._name,this._id)}function j$(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||d[p])&&(m[p]=h);for(;s<i;++s)l[s]=n[s];return new fn(l,this._parents,this._name,this._id)}function K$(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function G$(e,n,o){var i,a,r=K$(n)?ps:Xt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function Y$(e,n){var o=this._id;return arguments.length<2?zt(this.node(),o).on.on(e):this.each(G$(o,e,n))}function q$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function W$(){return this.on("end.remove",q$(this._id))}function J$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=es(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,h=0;h<c;++h)(u=s[h])&&(m=e.call(u,u.__data__,h,s))&&("__data__"in u&&(m.__data__=u.__data__),d[h]=m,pr(d[h],n,o,h,d,zt(u,o)));return new fn(r,this._parents,n,o)}function X$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=ap(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var h=e.call(u,u.__data__,m,c),p,y=zt(u,o),b=0,f=h.length;b<f;++b)(p=h[b])&&pr(p,n,o,b,h,y);r.push(h),l.push(u)}return new fn(r,l,n,o)}var Z$=Ei.prototype.constructor;function Q$(){return new Z$(this._groups,this._parents)}function eA(e,n){var o,i,a;return function(){var r=Do(this,e),l=(this.style.removeProperty(e),Do(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Up(e){return function(){this.style.removeProperty(e)}}function tA(e,n,o){var i,a=o+"",r;return function(){var l=Do(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function nA(e,n,o){var i,a,r;return function(){var l=Do(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Do(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function oA(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Xt(this,e),d=c.on,u=c.value[r]==null?s||(s=Up(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function iA(e,n,o){var i=(e+="")=="transform"?i$:Fp;return n==null?this.styleTween(e,eA(e,i)).on("end.style."+e,Up(e)):typeof n=="function"?this.styleTween(e,nA(e,i,hs(this,"style."+e,n))).each(oA(this._id,e)):this.styleTween(e,tA(e,i,n),o).on("end.style."+e,null)}function aA(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function rA(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&aA(e,l,o)),i}return r._value=n,r}function lA(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,rA(e,n,o??""))}function sA(e){return function(){this.textContent=e}}function cA(e){return function(){var n=e(this);this.textContent=n??""}}function dA(e){return this.tween("text",typeof e=="function"?cA(hs(this,"text",e)):sA(e==null?"":e+""))}function uA(e){return function(n){this.textContent=e.call(this,n)}}function mA(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&uA(a)),n}return i._value=e,i}function fA(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,mA(e))}function pA(){for(var e=this._name,n=this._id,o=Hp(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=zt(c,n);pr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new fn(i,this._parents,e,o)}function hA(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Xt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var yA=0;function fn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Hp(){return++yA}var pn=Ei.prototype;fn.prototype={constructor:fn,select:J$,selectAll:X$,selectChild:pn.selectChild,selectChildren:pn.selectChildren,filter:H$,merge:j$,selection:Q$,transition:pA,call:pn.call,nodes:pn.nodes,node:pn.node,size:pn.size,empty:pn.empty,each:pn.each,on:Y$,attr:C$,attrTween:T$,style:iA,styleTween:lA,text:dA,textTween:fA,remove:W$,tween:k$,delay:B$,duration:O$,ease:z$,easeVarying:U$,end:hA,[Symbol.iterator]:pn[Symbol.iterator]};function gA(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var bA={time:null,delay:0,duration:250,ease:gA};function _A(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function kA(e){var n,o;e instanceof fn?(n=e._id,e=e._name):(n=Hp(),(o=bA).time=ds(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&pr(c,e,n,d,l,o||_A(c,n));return new fn(i,this._parents,e,n)}Ei.prototype.interrupt=g$,Ei.prototype.transition=kA;const yr=e=>()=>e;function EA(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function hn(e,n,o){this.k=e,this.x=n,this.y=o}hn.prototype={constructor:hn,scale:function(e){return e===1?this:new hn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new hn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ys=new hn(1,0,0);hn.prototype;function gs(e){e.stopImmediatePropagation()}function $i(e){e.preventDefault(),e.stopImmediatePropagation()}function NA(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function wA(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function jp(){return this.__zoom||ys}function IA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function vA(){return navigator.maxTouchPoints||"ontouchstart"in this}function xA(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function CA(){var e=NA,n=wA,o=xA,i=IA,a=vA,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=c$,d=Zl("start","zoom","end"),u,m,h,p=500,y=150,b=0,f=10;function g(E){E.property("__zoom",jp).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",V).filter(a).on("touchstart.zoom",R).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(E,w,S,B){var z=E.selection?E.selection():E;z.property("__zoom",jp),E!==z?I(E,w,S,B):z.interrupt().each(function(){A(this,arguments).event(B).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},g.scaleBy=function(E,w,S,B){g.scaleTo(E,function(){var z=this.__zoom.k,K=typeof w=="function"?w.apply(this,arguments):w;return z*K},S,B)},g.scaleTo=function(E,w,S,B){g.transform(E,function(){var z=n.apply(this,arguments),K=this.__zoom,J=S==null?N(z):typeof S=="function"?S.apply(this,arguments):S,re=K.invert(J),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(k(K,pe),J,re),z,l)},S,B)},g.translateBy=function(E,w,S,B){g.transform(E,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof S=="function"?S.apply(this,arguments):S),n.apply(this,arguments),l)},null,B)},g.translateTo=function(E,w,S,B,z){g.transform(E,function(){var K=n.apply(this,arguments),J=this.__zoom,re=B==null?N(K):typeof B=="function"?B.apply(this,arguments):B;return o(ys.translate(re[0],re[1]).scale(J.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof S=="function"?-S.apply(this,arguments):-S),K,l)},B,z)};function k(E,w){return w=Math.max(r[0],Math.min(r[1],w)),w===E.k?E:new hn(w,E.x,E.y)}function _(E,w,S){var B=w[0]-S[0]*E.k,z=w[1]-S[1]*E.k;return B===E.x&&z===E.y?E:new hn(E.k,B,z)}function N(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function I(E,w,S,B){E.on("start.zoom",function(){A(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(B).end()}).tween("zoom",function(){var z=this,K=arguments,J=A(z,K).event(B),re=n.apply(z,K),pe=S==null?N(re):typeof S=="function"?S.apply(z,K):S,ce=Math.max(re[1][0]-re[0][0],re[1][1]-re[0][1]),Ne=z.__zoom,he=typeof w=="function"?w.apply(z,K):w,de=c(Ne.invert(pe).concat(ce/Ne.k),he.invert(pe).concat(ce/he.k));return function(_e){if(_e===1)_e=he;else{var Se=de(_e),me=ce/Se[2];_e=new hn(me,pe[0]-Se[0]*me,pe[1]-Se[1]*me)}J.zoom(null,_e)}})}function A(E,w,S){return!S&&E.__zooming||new x(E,w)}function x(E,w){this.that=E,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(E,w),this.taps=0}x.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,w){return this.mouse&&E!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var w=$n(this.that).datum();d.call(E,this.that,new EA(E,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),w)}};function $(E,...w){if(!e.apply(this,arguments))return;var S=A(this,w).event(E),B=this.__zoom,z=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,i.apply(this,arguments)))),K=An(E);if(S.wheel)(S.mouse[0][0]!==K[0]||S.mouse[0][1]!==K[1])&&(S.mouse[1]=B.invert(S.mouse[0]=K)),clearTimeout(S.wheel);else{if(B.k===z)return;S.mouse=[K,B.invert(K)],hr(this),S.start()}$i(E),S.wheel=setTimeout(J,y),S.zoom("mouse",o(_(k(B,z),S.mouse[0],S.mouse[1]),S.extent,l));function J(){S.wheel=null,S.end()}}function T(E,...w){if(h||!e.apply(this,arguments))return;var S=E.currentTarget,B=A(this,w,!0).event(E),z=$n(E.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ce,!0),K=An(E,S),J=E.clientX,re=E.clientY;DR(E.view),gs(E),B.mouse=[K,this.__zoom.invert(K)],hr(this),B.start();function pe(Ne){if($i(Ne),!B.moved){var he=Ne.clientX-J,de=Ne.clientY-re;B.moved=he*he+de*de>b}B.event(Ne).zoom("mouse",o(_(B.that.__zoom,B.mouse[0]=An(Ne,S),B.mouse[1]),B.extent,l))}function ce(Ne){z.on("mousemove.zoom mouseup.zoom",null),LR(Ne.view,B.moved),$i(Ne),B.event(Ne).end()}}function V(E,...w){if(e.apply(this,arguments)){var S=this.__zoom,B=An(E.changedTouches?E.changedTouches[0]:E,this),z=S.invert(B),K=S.k*(E.shiftKey?.5:2),J=o(_(k(S,K),B,z),n.apply(this,w),l);$i(E),s>0?$n(this).transition().duration(s).call(I,J,B,E):$n(this).call(g.transform,J,B,E)}}function R(E,...w){if(e.apply(this,arguments)){var S=E.touches,B=S.length,z=A(this,w,E.changedTouches.length===B).event(E),K,J,re,pe;for(gs(E),J=0;J<B;++J)re=S[J],pe=An(re,this),pe=[pe,this.__zoom.invert(pe),re.identifier],z.touch0?!z.touch1&&z.touch0[2]!==pe[2]&&(z.touch1=pe,z.taps=0):(z.touch0=pe,K=!0,z.taps=1+!!u);u&&(u=clearTimeout(u)),K&&(z.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},p)),hr(this),z.start())}}function C(E,...w){if(this.__zooming){var S=A(this,w).event(E),B=E.changedTouches,z=B.length,K,J,re,pe;for($i(E),K=0;K<z;++K)J=B[K],re=An(J,this),S.touch0&&S.touch0[2]===J.identifier?S.touch0[0]=re:S.touch1&&S.touch1[2]===J.identifier&&(S.touch1[0]=re);if(J=S.that.__zoom,S.touch1){var ce=S.touch0[0],Ne=S.touch0[1],he=S.touch1[0],de=S.touch1[1],_e=(_e=he[0]-ce[0])*_e+(_e=he[1]-ce[1])*_e,Se=(Se=de[0]-Ne[0])*Se+(Se=de[1]-Ne[1])*Se;J=k(J,Math.sqrt(_e/Se)),re=[(ce[0]+he[0])/2,(ce[1]+he[1])/2],pe=[(Ne[0]+de[0])/2,(Ne[1]+de[1])/2]}else if(S.touch0)re=S.touch0[0],pe=S.touch0[1];else return;S.zoom("touch",o(_(J,re,pe),S.extent,l))}}function M(E,...w){if(this.__zooming){var S=A(this,w).event(E),B=E.changedTouches,z=B.length,K,J;for(gs(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),K=0;K<z;++K)J=B[K],S.touch0&&S.touch0[2]===J.identifier?delete S.touch0:S.touch1&&S.touch1[2]===J.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(J=An(J,this),Math.hypot(m[0]-J[0],m[1]-J[1])<f)){var re=$n(this).on("dblclick.zoom");re&&re.apply(this,arguments)}}}return g.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:yr(+E),g):i},g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:yr(!!E),g):e},g.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:yr(!!E),g):a},g.extent=function(E){return arguments.length?(n=typeof E=="function"?E:yr([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),g):n},g.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],g):[r[0],r[1]]},g.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],g):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},g.constrain=function(E){return arguments.length?(o=E,g):o},g.duration=function(E){return arguments.length?(s=+E,g):s},g.interpolate=function(E){return arguments.length?(c=E,g):c},g.on=function(){var E=d.on.apply(d,arguments);return E===d?g:E},g.clickDistance=function(E){return arguments.length?(b=(E=+E)*E,g):Math.sqrt(b)},g.tapDistance=function(E){return arguments.length?(f=+E,g):f},g}const Kp=Symbol("MiniMapSlots"),SA=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],RA={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},$A=t.defineComponent({...RA,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:n}){const o=e,i=t.inject(Kp),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,h)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,SA))],64)):t.createCommentVNode("",!0)}}),AA=["width","height","viewBox","aria-labelledby"],TA=["id"],MA=["d","fill","stroke","stroke-width"],VA={name:"MiniMap",compatConfig:{MODE:3}},BA=t.defineComponent({...VA,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:h,d3Zoom:p,getNodesInitialized:y}=je(),b=t.ref();t.provide(Kp,o);const f=t.toRef(()=>{var z;return e.width??((z=i.style)==null?void 0:z.width)??a}),g=t.toRef(()=>{var z;return e.height??((z=i.style)==null?void 0:z.height)??r}),k=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",_=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),N=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),I=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=t.computed(()=>Al(y.value.filter(z=>!z.hidden))),x=t.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),$=t.computed(()=>y.value&&y.value.length?o0(A.value,x.value):x.value),T=t.computed(()=>{const z=$.value.width/f.value,K=$.value.height/g.value;return Math.max(z,K)}),V=t.computed(()=>{const z=T.value*f.value,K=T.value*g.value,J=e.offsetScale*T.value;return{offset:J,x:$.value.x-(z-$.value.width)/2-J,y:$.value.y-(K-$.value.height)/2-J,width:z+J*2,height:K+J*2}}),R=t.computed(()=>!V.value.x||!V.value.y?"":`
52
+ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class ut extends Error{constructor(n,...o){var i;super((i=vm[n])==null?void 0:i.call(vm,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function Dl(e){return"clientX"in e}function f0(e){return"sourceEvent"in e}function Wt(e,n){const o=Dl(e);let i,a;return o?(i=e.clientX,a=e.clientY):"touches"in e&&e.touches.length>0?(i=e.touches[0].clientX,a=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):(i=0,a=0),{x:i-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}}const bi=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function p0(e){var n,o;return{width:((n=e.dimensions)==null?void 0:n.width)??e.width??0,height:((o=e.dimensions)==null?void 0:o.height)??e.height??0}}function La(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const h0=()=>!0;function Ll(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function y0(e,n,o){const i=[],a={x:e.x-o,y:e.y-o,width:o*2,height:o*2};for(const r of n.values())Ma(a,Ta(r))>0&&i.push(r);return i}const g0=250;function b0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=y0(e,o,n+g0);for(const d of c){const u=[...((a=d.handleBounds)==null?void 0:a.source)??[],...((r=d.handleBounds)==null?void 0:r.target)??[]];for(const m of u){if(i.nodeId===m.nodeId&&i.type===m.type&&i.id===m.id)continue;const{x:h,y:p}=Ao(d,m,m.position,!0),y=Math.sqrt((h-e.x)**2+(p-e.y)**2);y>n||(y<s?(l=[{...m,x:h,y:p}],s=y):y===s&&l.push({...m,x:h,y:p}))}}if(!l.length)return null;if(l.length>1){const d=i.type==="source"?"target":"source";return l.find(u=>u.type===d)??l[0]}return l[0]}function xm(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=h0},u,m,h,p){const y=r==="target",b=n?l.querySelector(`.${s}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:f,y:g}=Wt(e),k=l.elementFromPoint(f,g),_=k!=null&&k.classList.contains(`${s}-flow__handle`)?k:b,N={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const I=Cm(void 0,_),A=_.getAttribute("data-nodeid"),x=_.getAttribute("data-handleid"),$=_.classList.contains("connectable"),T=_.classList.contains("connectableend");if(!A||!I)return N;const V={source:y?A:i,sourceHandle:y?x:a,target:y?i:A,targetHandle:y?a:x};N.connection=V;const C=$&&T&&(o===cn.Strict?y&&I==="source"||!y&&I==="target":A!==i||x!==a);N.isValid=C&&d(V,{nodes:m,edges:u,sourceNode:h(V.source),targetNode:h(V.target)}),N.toHandle=Sm(A,I,x,p,o,!0)}return N}function Cm(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function _0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function k0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Sm(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===cn.Strict?(l=d.handleBounds)==null?void 0:l[n]:[...((s=d.handleBounds)==null?void 0:s.source)??[],...((c=d.handleBounds)==null?void 0:c.target)??[]],m=(o?u==null?void 0:u.find(h=>h.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...Ao(d,m,m.position,!0)}:m}const Ol={[Te.Left]:Te.Right,[Te.Right]:Te.Left,[Te.Top]:Te.Bottom,[Te.Bottom]:Te.Top},E0=["production","prod"];function _i(e,...n){Rm()&&console.warn(`[Vue Flow]: ${e}`,...n)}function Rm(){return!E0.includes(process.env.NODE_ENV||"")}function $m(e,n,o,i,a){const r=n.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(s.left-o.left)/i,y:(s.top-o.top)/i,...Va(l)}}):null}function Pl(e,n,o,i,a,r=!1,l){a.value=!1,e.selected?(r||e.selected&&n)&&(i([e]),t.nextTick(()=>{l.blur()})):o([e])}function ct(e){return typeof t.unref(e)<"u"}function N0(e,n,o,i){if(!e||!e.source||!e.target)return o(new ut(st.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return xn(e)?a=e:a={...e,id:cm(e)},a=lm(a,void 0,i),n0(a,n)?!1:a}function w0(e,n,o,i,a){if(!n.source||!n.target)return a(new ut(st.EDGE_INVALID,e.id)),!1;if(!o)return a(new ut(st.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?cm(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Am(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!qn(l)){o(new ut(st.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=Q1(l,n(l.id),l.parentNode);l.parentNode&&(i[l.parentNode]=!0),a[r]=s}for(const r of a){const l=n(r.parentNode)||a.find(s=>s.id===r.parentNode);r.parentNode&&!l&&o(new ut(st.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||i[r.id])&&(i[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return a}function Tm(e,n,o,i,a,r){let l=a;const s=i.get(l)||new Map;i.set(l,s.set(o,n)),l=`${a}-${e}`;const c=i.get(l)||new Map;if(i.set(l,c.set(o,n)),r){l=`${a}-${e}-${r}`;const d=i.get(l)||new Map;i.set(l,d.set(o,n))}}function zl(e,n,o){e.clear();for(const i of o){const{source:a,target:r,sourceHandle:l=null,targetHandle:s=null}=i,c={edgeId:i.id,source:a,target:r,sourceHandle:l,targetHandle:s},d=`${a}-${l}--${r}-${s}`,u=`${r}-${s}--${a}-${l}`;Tm("source",c,u,e,a,l),Tm("target",c,d,e,r,s)}}function Mm(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Fl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=xn(d)?d:N0(d,s,a,r);if(!u)continue;const m=o(u.source),h=o(u.target);if(!m||!h){a(new ut(st.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new ut(st.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new ut(st.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:h})){a(new ut(st.EDGE_INVALID,u.id));continue}const p=i(u.id);c.push({...lm(u,p,r),sourceNode:m,targetNode:h})}return c}const Vm=Symbol("vueFlow"),Bm=Symbol("nodeId"),Dm=Symbol("nodeRef"),I0=Symbol("edgeId"),v0=Symbol("edgeRef"),Oa=Symbol("slots");function Lm(e){const{vueFlowRef:n,snapToGrid:o,snapGrid:i,noDragClassName:a,nodeLookup:r,nodeExtent:l,nodeDragThreshold:s,viewport:c,autoPanOnNodeDrag:d,autoPanSpeed:u,nodesDraggable:m,panBy:h,findNode:p,multiSelectionActive:y,nodesSelectionActive:b,selectNodesOnDrag:f,removeSelectedElements:g,addSelectedNodes:k,updateNodePositions:_,emits:N}=je(),{onStart:I,onDrag:A,onStop:x,onClick:$,el:T,disabled:V,id:R,selectable:C,dragHandle:M}=e,E=t.shallowRef(!1);let w=[],S,B=null,z={x:void 0,y:void 0},K={x:0,y:0},J=null,re=!1,pe=!1,ce=0,Ne=!1;const he=S0(),de=({x:se,y:fe})=>{z={x:se,y:fe};let O=!1;if(w=w.map(L=>{const F={x:se-L.distance.x,y:fe-L.distance.y},{computedPosition:Q}=Bl(L,o.value?La(F,i.value):F,N.error,l.value,L.parentNode?p(L.parentNode):void 0);return O=O||L.position.x!==Q.x||L.position.y!==Q.y,L.position=Q,L}),pe=pe||O,!!O&&(_(w,!0,!0),E.value=!0,J)){const[L,F]=Vl({id:R,dragItems:w,findNode:p});A({event:J,node:L,nodes:F})}},_e=()=>{if(!B)return;const[se,fe]=ym(K,B,u.value);if(se!==0||fe!==0){const O={x:(z.x??0)-se/c.value.zoom,y:(z.y??0)-fe/c.value.zoom};h({x:se,y:fe})&&de(O)}ce=requestAnimationFrame(_e)},Se=(se,fe)=>{re=!0;const O=p(R);!f.value&&!y.value&&O&&(O.selected||g()),O&&t.toValue(C)&&f.value&&Pl(O,y.value,k,g,b,!1,fe);const L=he(se.sourceEvent);if(z=L,w=l0(r.value,m.value,L,R),w.length){const[F,Q]=Vl({id:R,dragItems:w,findNode:p});I({event:se.sourceEvent,node:F,nodes:Q})}},me=(se,fe)=>{var O;se.sourceEvent.type==="touchmove"&&se.sourceEvent.touches.length>1||(pe=!1,s.value===0&&Se(se,fe),z=he(se.sourceEvent),B=((O=n.value)==null?void 0:O.getBoundingClientRect())||null,K=Wt(se.sourceEvent,B))},ye=(se,fe)=>{const O=he(se.sourceEvent);if(!Ne&&re&&d.value&&(Ne=!0,_e()),!re){const L=O.xSnapped-(z.x??0),F=O.ySnapped-(z.y??0);Math.sqrt(L*L+F*F)>s.value&&Se(se,fe)}(z.x!==O.xSnapped||z.y!==O.ySnapped)&&w.length&&re&&(J=se.sourceEvent,K=Wt(se.sourceEvent,B),de(O))},ie=se=>{let fe=!1;if(!re&&!E.value&&!y.value){const O=se.sourceEvent,L=he(O),F=L.xSnapped-(z.x??0),Q=L.ySnapped-(z.y??0),Y=Math.sqrt(F*F+Q*Q);Y!==0&&Y<=s.value&&($==null||$(O),fe=!0)}if(w.length&&!fe){pe&&(_(w,!1,!1),pe=!1);const[O,L]=Vl({id:R,dragItems:w,findNode:p});x({event:se.sourceEvent,node:O,nodes:L})}w=[],E.value=!1,Ne=!1,re=!1,z={x:void 0,y:void 0},cancelAnimationFrame(ce)};return t.watch([()=>t.toValue(V),T],([se,fe],O,L)=>{if(fe){const F=Vt(fe);se||(S=Zk().on("start",Q=>me(Q,fe)).on("drag",Q=>ye(Q,fe)).on("end",Q=>ie(Q)).filter(Q=>{const Y=Q.target,ke=t.toValue(M);return!Q.button&&(!a.value||!Nm(Y,`.${a.value}`,fe)&&(!ke||Nm(Y,ke,fe)))}),F.call(S)),L(()=>{F.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),E}function x0(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),updateStart:$e(),update:$e(),updateEnd:$e()}}function C0(e,n){const o=x0();return o.doubleClick.on(i=>{var a,r;n.edgeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.edgeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.edgeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.edgeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.edgeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.edgeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.updateStart.on(i=>{var a,r;n.edgeUpdateStart(i),(r=(a=e.events)==null?void 0:a.updateStart)==null||r.call(a,i)}),o.update.on(i=>{var a,r;n.edgeUpdate(i),(r=(a=e.events)==null?void 0:a.update)==null||r.call(a,i)}),o.updateEnd.on(i=>{var a,r;n.edgeUpdateEnd(i),(r=(a=e.events)==null?void 0:a.updateEnd)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function S0(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=je();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=f0(a)?a.sourceEvent:a,{x:c,y:d}=Wt(s,l),u=yi({x:c,y:d},e.value),{x:m,y:h}=o.value?La(u,n.value):u;return{xSnapped:m,ySnapped:h,...u}}}function Pa(){return!0}function Om({handleId:e,nodeId:n,type:o,isValidConnection:i,edgeUpdaterType:a,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:c,connectionMode:d,connectionRadius:u,connectOnClick:m,connectionClickStartHandle:h,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:b,findNode:f,panBy:g,startConnection:k,updateConnection:_,endConnection:N,emits:I,viewport:A,edges:x,nodes:$,isValidConnection:T,nodeLookup:V}=je();let R=null,C=!1,M=null;function E(S){var B;const z=t.toValue(o)==="target",K=Dl(S),J=rm(S.target),re=S.currentTarget;if(re&&(K&&S.button===0||!K)){let pe=function(ve){O=Wt(ve,ie),de=b0(yi(O,A.value,!1,[1,1]),u.value,V.value,Q),L||(F(),L=!0);const U=xm(ve,{handle:de,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:z?"target":"source",isValidConnection:he,doc:J,lib:"vue",flowId:s,nodeLookup:V.value},x.value,$.value,f,V.value);M=U.handleDomNode,R=U.connection,C=k0(!!de,U.isValid);const H={...Ce,isValid:C,to:U.toHandle&&C?hi({x:U.toHandle.x,y:U.toHandle.y},A.value):O,toHandle:U.toHandle,toPosition:C&&U.toHandle?U.toHandle.position:Ol[Q.position],toNode:U.toHandle?V.value.get(U.toHandle.nodeId):null};if(C&&de&&(Ce!=null&&Ce.toHandle)&&H.toHandle&&Ce.toHandle.type===H.toHandle.type&&Ce.toHandle.nodeId===H.toHandle.nodeId&&Ce.toHandle.id===H.toHandle.id&&Ce.to.x===H.to.x&&Ce.to.y===H.to.y)return;const q=de??U.toHandle;if(_(q&&C?hi({x:q.x,y:q.y},A.value):O,q,_0(!!q,C)),Ce=H,!de&&!C&&!M)return Ll(fe);R&&R.source!==R.target&&M&&(Ll(fe),fe=M,M.classList.add("connecting","vue-flow__handle-connecting"),M.classList.toggle("valid",!!C),M.classList.toggle("vue-flow__handle-valid",!!C))},ce=function(ve){"touches"in ve&&ve.touches.length>0||((de||M)&&R&&C&&(r?r(ve,R):I.connect(R)),I.connectEnd(ve),a&&(l==null||l(ve)),Ll(fe),cancelAnimationFrame(_e),N(ve),L=!1,C=!1,R=null,M=null,J.removeEventListener("mousemove",pe),J.removeEventListener("mouseup",ce),J.removeEventListener("touchmove",pe),J.removeEventListener("touchend",ce))};const Ne=f(t.toValue(n));let he=t.toValue(i)||T.value||Pa;!he&&Ne&&(he=(z?Ne.isValidSourcePos:Ne.isValidTargetPos)||Pa);let de,_e=0;const{x:Se,y:me}=Wt(S),ye=Cm(t.toValue(a),re),ie=(B=c.value)==null?void 0:B.getBoundingClientRect();if(!ie||!ye)return;const se=Sm(t.toValue(n),ye,t.toValue(e),V.value,d.value);if(!se)return;let fe,O=Wt(S,ie),L=!1;const F=()=>{if(!y.value)return;const[ve,U]=ym(O,ie,b.value);g({x:ve,y:U}),_e=requestAnimationFrame(F)},Q={...se,nodeId:t.toValue(n),type:ye,position:se.position},Y=V.value.get(t.toValue(n)),be={inProgress:!0,isValid:null,from:Ao(Y,Q,Te.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:Y,to:O,toHandle:null,toPosition:Ol[Q.position],toNode:null};k({nodeId:t.toValue(n),id:t.toValue(e),type:ye,position:(re==null?void 0:re.getAttribute("data-handlepos"))||Te.Top,...O},{x:Se-ie.left,y:me-ie.top}),I.connectStart({event:S,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:ye});let Ce=be;J.addEventListener("mousemove",pe),J.addEventListener("mouseup",ce),J.addEventListener("touchmove",pe),J.addEventListener("touchend",ce)}}function w(S){var B,z;if(!m.value)return;const K=t.toValue(o)==="target";if(!h.value){I.clickConnectStart({event:S,nodeId:t.toValue(n),handleId:t.toValue(e)}),k({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:Te.Top,...Wt(S)},void 0,!0);return}let J=t.toValue(i)||T.value||Pa;const re=f(t.toValue(n));if(!J&&re&&(J=(K?re.isValidSourcePos:re.isValidTargetPos)||Pa),re&&(typeof re.connectable>"u"?p.value:re.connectable)===!1)return;const pe=rm(S.target),ce=xm(S,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:Te.Top,...Wt(S)},connectionMode:d.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:J,doc:pe,lib:"vue",flowId:s,nodeLookup:V.value},x.value,$.value,f,V.value),Ne=((B=ce.connection)==null?void 0:B.source)===((z=ce.connection)==null?void 0:z.target);ce.isValid&&ce.connection&&!Ne&&I.connect(ce.connection),I.clickConnectEnd(S),N(S,!0)}return{handlePointerDown:E,handleClick:w}}function R0(){return t.inject(Bm,"")}function Pm(e){const n=e??R0()??"",o=t.inject(Dm,t.ref(null)),{findNode:i,edges:a,emits:r}=je(),l=i(n);return l||r.error(new ut(st.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>Wn([l],a.value))}}function $0(){return{doubleClick:$e(),click:$e(),mouseEnter:$e(),mouseMove:$e(),mouseLeave:$e(),contextMenu:$e(),dragStart:$e(),drag:$e(),dragStop:$e()}}function A0(e,n){const o=$0();return o.doubleClick.on(i=>{var a,r;n.nodeDoubleClick(i),(r=(a=e.events)==null?void 0:a.doubleClick)==null||r.call(a,i)}),o.click.on(i=>{var a,r;n.nodeClick(i),(r=(a=e.events)==null?void 0:a.click)==null||r.call(a,i)}),o.mouseEnter.on(i=>{var a,r;n.nodeMouseEnter(i),(r=(a=e.events)==null?void 0:a.mouseEnter)==null||r.call(a,i)}),o.mouseMove.on(i=>{var a,r;n.nodeMouseMove(i),(r=(a=e.events)==null?void 0:a.mouseMove)==null||r.call(a,i)}),o.mouseLeave.on(i=>{var a,r;n.nodeMouseLeave(i),(r=(a=e.events)==null?void 0:a.mouseLeave)==null||r.call(a,i)}),o.contextMenu.on(i=>{var a,r;n.nodeContextMenu(i),(r=(a=e.events)==null?void 0:a.contextMenu)==null||r.call(a,i)}),o.dragStart.on(i=>{var a,r;n.nodeDragStart(i),(r=(a=e.events)==null?void 0:a.dragStart)==null||r.call(a,i)}),o.drag.on(i=>{var a,r;n.nodeDrag(i),(r=(a=e.events)==null?void 0:a.drag)==null||r.call(a,i)}),o.dragStop.on(i=>{var a,r;n.nodeDragStop(i),(r=(a=e.events)==null?void 0:a.dragStop)==null||r.call(a,i)}),Object.entries(o).reduce((i,[a,r])=>(i.emit[a]=r.trigger,i.on[a]=r.on,i),{emit:{},on:{}})}function zm(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=je();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,h=d?4:1,p=c.x*u*h,y=c.y*m*h,b=[];for(const f of e.value)if(f.draggable||l&&typeof f.draggable>"u"){const g={x:f.computedPosition.x+p,y:f.computedPosition.y+y},{position:k}=Bl(f,g,s.error,n.value,f.parentNode?i(f.parentNode):void 0);b.push({id:f.id,position:k,from:f.position,distance:{x:c.x,y:c.y},dimensions:f.dimensions})}o(b,!0,!1)}}const za=.1,T0=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Rn(){return _i("Viewport not initialized yet."),Promise.resolve(!1)}const M0={zoomIn:Rn,zoomOut:Rn,zoomTo:Rn,fitView:Rn,setCenter:Rn,fitBounds:Rn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Rn,setTransform:Rn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function V0(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ri:Na).scaleBy(Ul(e.d3Selection,a==null?void 0:a.duration,a==null?void 0:a.ease,()=>{r(!0)}),i):r(!1)})}function o(i,a,r,l){return new Promise(s=>{var c;const{x:d,y:u}=am({x:-i,y:-a},e.translateExtent),m=So.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?ri:Na).transform(Ul(e.d3Selection,l==null?void 0:l.duration,l==null?void 0:l.ease,()=>{s(!0)}),m):s(!1)})}return t.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:a=>n(1.2,a),zoomOut:a=>n(1/1.2,a),zoomTo:(a,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?ri:Na).scaleTo(Ul(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{l(!0)}),a):l(!1)}),setViewport:(a,r)=>o(a.x,a.y,a.zoom,r),setTransform:(a,r)=>o(a.x,a.y,a.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(a={padding:za,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!h.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const c=Al(s),{x:d,y:u,zoom:m}=fm(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??za);return o(d,u,m,a)},setCenter:(a,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,c=e.dimensions.width/2-a*s,d=e.dimensions.height/2-r*s;return o(c,d,s,l)},fitBounds:(a,r={padding:za})=>{const{x:l,y:s,zoom:c}=fm(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??za);return o(l,s,c,r)},project:a=>yi(a,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x-r,y:a.y-l};return yi(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:a=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:a.x+r,y:a.y+l};return hi(s,e.viewport)}return{x:0,y:0}}}:M0)}function Ul(e,n=0,o=T0,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function B0(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let b,f,g=!!(o.nodes.value.length||o.edges.value.length);b=wo([e.modelValue,()=>{var k,_;return(_=(k=e.modelValue)==null?void 0:k.value)==null?void 0:_.length}],([k])=>{k&&Array.isArray(k)&&(f==null||f.pause(),o.setElements(k),!f&&!g&&k.length?g=!0:f==null||f.resume())}),f=wo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([k,_])=>{var N;(N=e.modelValue)!=null&&N.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...k,..._],t.nextTick(()=>{b==null||b.resume()}))},{immediate:g}),t.onScopeDispose(()=>{b==null||b.stop(),f==null||f.stop()})})},r=()=>{i.run(()=>{let b,f,g=!!o.nodes.value.length;b=wo([e.nodes,()=>{var k,_;return(_=(k=e.nodes)==null?void 0:k.value)==null?void 0:_.length}],([k])=>{k&&Array.isArray(k)&&(f==null||f.pause(),o.setNodes(k),!f&&!g&&k.length?g=!0:f==null||f.resume())}),f=wo([o.nodes,()=>o.nodes.value.length],([k])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...k],t.nextTick(()=>{b==null||b.resume()}))},{immediate:g}),t.onScopeDispose(()=>{b==null||b.stop(),f==null||f.stop()})})},l=()=>{i.run(()=>{let b,f,g=!!o.edges.value.length;b=wo([e.edges,()=>{var k,_;return(_=(k=e.edges)==null?void 0:k.value)==null?void 0:_.length}],([k])=>{k&&Array.isArray(k)&&(f==null||f.pause(),o.setEdges(k),!f&&!g&&k.length?g=!0:f==null||f.resume())}),f=wo([o.edges,()=>o.edges.value.length],([k])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...k],t.nextTick(()=>{b==null||b.resume()}))},{immediate:g}),t.onScopeDispose(()=>{b==null||b.stop(),f==null||f.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&&ct(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&&ct(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&&ct(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&&ct(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{ct(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},h=()=>{i.run(()=>{const b=async f=>{let g=f;typeof n.autoConnect=="function"&&(g=await n.autoConnect(f)),g!==!1&&o.addEdges([g])};t.watch(()=>n.autoConnect,()=>{ct(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(f,g,k)=>{f?o.onConnect(b):o.hooks.value.connect.off(b),k(()=>{o.hooks.value.connect.off(b)})},{immediate:!0})})},p=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const f of Object.keys(n)){const g=f;if(!b.includes(g)){const k=t.toRef(()=>n[g]),_=o[g];t.isRef(_)&&i.run(()=>{t.watch(k,N=>{ct(N)&&(_.value=N)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),h(),p()})()}),()=>i.stop()}function D0(){return{edgesChange:$e(),nodesChange:$e(),nodeDoubleClick:$e(),nodeClick:$e(),nodeMouseEnter:$e(),nodeMouseMove:$e(),nodeMouseLeave:$e(),nodeContextMenu:$e(),nodeDragStart:$e(),nodeDrag:$e(),nodeDragStop:$e(),nodesInitialized:$e(),miniMapNodeClick:$e(),miniMapNodeDoubleClick:$e(),miniMapNodeMouseEnter:$e(),miniMapNodeMouseMove:$e(),miniMapNodeMouseLeave:$e(),connect:$e(),connectStart:$e(),connectEnd:$e(),clickConnectStart:$e(),clickConnectEnd:$e(),paneReady:$e(),init:$e(),move:$e(),moveStart:$e(),moveEnd:$e(),selectionDragStart:$e(),selectionDrag:$e(),selectionDragStop:$e(),selectionContextMenu:$e(),selectionStart:$e(),selectionEnd:$e(),viewportChangeStart:$e(),viewportChange:$e(),viewportChangeEnd:$e(),paneScroll:$e(),paneClick:$e(),paneContextMenu:$e(),paneMouseEnter:$e(),paneMouseMove:$e(),paneMouseLeave:$e(),edgeContextMenu:$e(),edgeMouseEnter:$e(),edgeMouseMove:$e(),edgeMouseLeave:$e(),edgeDoubleClick:$e(),edgeClick:$e(),edgeUpdateStart:$e(),edgeUpdate:$e(),edgeUpdateEnd:$e(),updateNodeInternals:$e(),error:$e(e=>_i(e.message))}}function L0(e,n){const o=t.getCurrentInstance();t.onBeforeMount(()=>{for(const[a,r]of Object.entries(n.value)){const l=s=>{e(a,s)};r.setEmitter(l),ei(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),ei(r.removeHasEmitListeners)}});function i(a){var r;const l=O0(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function O0(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function Fm(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:Sl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:mi.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Gn.Bezier,style:{}},connectionMode:cn.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:bi()?"Meta":"Control",zoomActivationKeyCode:bi()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:D0(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const P0=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function z0(e,n,o){const i=V0(e),a=O=>{const L=O??[];e.hooks.updateNodeInternals.trigger(L)},r=O=>t0(O,e.nodes,e.edges),l=O=>e0(O,e.nodes,e.edges),s=O=>Wn(O,e.edges),c=({id:O,type:L,nodeId:F})=>{var Q;const Y=O?`-${L}-${O}`:`-${L}`;return Array.from(((Q=e.connectionLookup.get(`${F}${Y}`))==null?void 0:Q.values())??[])},d=O=>{if(O)return n.value.get(O)},u=O=>{if(O)return o.value.get(O)},m=(O,L,F)=>{var Q,Y;const ke=[];for(const be of O){const Ce={id:be.id,type:"position",dragging:F,from:be.from};if(L&&(Ce.position=be.position,be.parentNode)){const ve=d(be.parentNode);Ce.position={x:Ce.position.x-(((Q=ve==null?void 0:ve.computedPosition)==null?void 0:Q.x)??0),y:Ce.position.y-(((Y=ve==null?void 0:ve.computedPosition)==null?void 0:Y.y)??0)}}ke.push(Ce)}ke!=null&&ke.length&&e.hooks.nodesChange.trigger(ke)},h=O=>{if(!e.vueFlowRef)return;const L=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!L)return;const F=window.getComputedStyle(L),{m22:Q}=new window.DOMMatrixReadOnly(F.transform),Y=[];for(const ke of O){const be=ke,Ce=d(be.id);if(Ce){const ve=Va(be.nodeElement);if(!!(ve.width&&ve.height&&(Ce.dimensions.width!==ve.width||Ce.dimensions.height!==ve.height||be.forceUpdate))){const H=be.nodeElement.getBoundingClientRect();Ce.dimensions=ve,Ce.handleBounds.source=$m("source",be.nodeElement,H,Q,Ce.id),Ce.handleBounds.target=$m("target",be.nodeElement,H,Q,Ce.id),Y.push({id:Ce.id,type:"dimensions",dimensions:ve})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),Y.length&&e.hooks.nodesChange.trigger(Y)},p=(O,L)=>{const F=new Set,Q=new Set;for(const be of O)qn(be)?F.add(be.id):xn(be)&&Q.add(be.id);const Y=Sn(n.value,F,!0),ke=Sn(o.value,Q);if(e.multiSelectionActive){for(const be of F)Y.push(Cn(be,L));for(const be of Q)ke.push(Cn(be,L))}Y.length&&e.hooks.nodesChange.trigger(Y),ke.length&&e.hooks.edgesChange.trigger(ke)},y=O=>{if(e.multiSelectionActive){const L=O.map(F=>Cn(F.id,!0));e.hooks.nodesChange.trigger(L);return}e.hooks.nodesChange.trigger(Sn(n.value,new Set(O.map(L=>L.id)),!0)),e.hooks.edgesChange.trigger(Sn(o.value))},b=O=>{if(e.multiSelectionActive){const L=O.map(F=>Cn(F.id,!0));e.hooks.edgesChange.trigger(L);return}e.hooks.edgesChange.trigger(Sn(o.value,new Set(O.map(L=>L.id)))),e.hooks.nodesChange.trigger(Sn(n.value,new Set,!0))},f=O=>{p(O,!0)},g=O=>{const F=(O||e.nodes).map(Q=>(Q.selected=!1,Cn(Q.id,!1)));e.hooks.nodesChange.trigger(F)},k=O=>{const F=(O||e.edges).map(Q=>(Q.selected=!1,Cn(Q.id,!1)));e.hooks.edgesChange.trigger(F)},_=O=>{if(!O||!O.length)return p([],!1);const L=O.reduce((F,Q)=>{const Y=Cn(Q.id,!1);return qn(Q)?F.nodes.push(Y):F.edges.push(Y),F},{nodes:[],edges:[]});L.nodes.length&&e.hooks.nodesChange.trigger(L.nodes),L.edges.length&&e.hooks.edgesChange.trigger(L.edges)},N=O=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([O,e.maxZoom]),e.minZoom=O},I=O=>{var L;(L=e.d3Zoom)==null||L.scaleExtent([e.minZoom,O]),e.maxZoom=O},A=O=>{var L;(L=e.d3Zoom)==null||L.translateExtent(O),e.translateExtent=O},x=O=>{e.nodeExtent=O,a()},$=O=>{var L;(L=e.d3Zoom)==null||L.clickDistance(O)},T=O=>{e.nodesDraggable=O,e.nodesConnectable=O,e.elementsSelectable=O},V=O=>{const L=O instanceof Function?O(e.nodes):O;!e.initialized&&!L.length||(e.nodes=Am(L,d,e.hooks.error.trigger))},R=O=>{const L=O instanceof Function?O(e.edges):O;if(!e.initialized&&!L.length)return;const F=Fl(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);zl(e.connectionLookup,o.value,F),e.edges=F},C=O=>{const L=O instanceof Function?O([...e.nodes,...e.edges]):O;!e.initialized&&!L.length||(V(L.filter(qn)),R(L.filter(xn)))},M=O=>{let L=O instanceof Function?O(e.nodes):O;L=Array.isArray(L)?L:[L];const F=Am(L,d,e.hooks.error.trigger),Q=[];for(const Y of F)Q.push(bm(Y));Q.length&&e.hooks.nodesChange.trigger(Q)},E=O=>{let L=O instanceof Function?O(e.edges):O;L=Array.isArray(L)?L:[L];const F=Fl(L,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const Y of F)Q.push(bm(Y));Q.length&&e.hooks.edgesChange.trigger(Q)},w=(O,L=!0,F=!1)=>{const Q=O instanceof Function?O(e.nodes):O,Y=Array.isArray(Q)?Q:[Q],ke=[],be=[];function Ce(U){const H=s(U);for(const q of H)(!ct(q.deletable)||q.deletable)&&be.push(km(q.id,q.source,q.target,q.sourceHandle,q.targetHandle))}function ve(U){const H=[];for(const q of e.nodes)q.parentNode===U&&H.push(q);if(H.length){for(const q of H)ke.push(_m(q.id));L&&Ce(H);for(const q of H)ve(q.id)}}for(const U of Y){const H=typeof U=="string"?d(U):U;H&&(ct(H.deletable)&&!H.deletable||(ke.push(_m(H.id)),L&&Ce([H]),F&&ve(H.id)))}be.length&&e.hooks.edgesChange.trigger(be),ke.length&&e.hooks.nodesChange.trigger(ke)},S=O=>{const L=O instanceof Function?O(e.edges):O,F=Array.isArray(L)?L:[L],Q=[];for(const Y of F){const ke=typeof Y=="string"?u(Y):Y;ke&&(ct(ke.deletable)&&!ke.deletable||Q.push(km(typeof Y=="string"?Y:Y.id,ke.source,ke.target,ke.sourceHandle,ke.targetHandle)))}e.hooks.edgesChange.trigger(Q)},B=(O,L,F=!0)=>{const Q=u(O.id);if(!Q)return!1;const Y=e.edges.indexOf(Q),ke=w0(O,L,Q,F,e.hooks.error.trigger);if(ke){const[be]=Fl([ke],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((Ce,ve)=>ve===Y?be:Ce),zl(e.connectionLookup,o.value,[be]),be}return!1},z=(O,L,F={replace:!1})=>{const Q=u(O);if(!Q)return;const Y=typeof L=="function"?L(Q):L;Q.data=F.replace?Y:{...Q.data,...Y}},K=O=>gm(O,e.nodes),J=O=>{const L=gm(O,e.edges);return zl(e.connectionLookup,o.value,L),L},re=(O,L,F={replace:!1})=>{const Q=d(O);if(!Q)return;const Y=typeof L=="function"?L(Q):L;F.replace?e.nodes.splice(e.nodes.indexOf(Q),1,Y):Object.assign(Q,Y)},pe=(O,L,F={replace:!1})=>{const Q=d(O);if(!Q)return;const Y=typeof L=="function"?L(Q):L;Q.data=F.replace?Y:{...Q.data,...Y}},ce=(O,L,F=!1)=>{F?e.connectionClickStartHandle=O:e.connectionStartHandle=O,e.connectionEndHandle=null,e.connectionStatus=null,L&&(e.connectionPosition=L)},Ne=(O,L=null,F=null)=>{e.connectionStartHandle&&(e.connectionPosition=O,e.connectionEndHandle=L,e.connectionStatus=F)},he=(O,L)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,L?e.connectionClickStartHandle=null:e.connectionStartHandle=null},de=O=>{const L=Z1(O),F=L?null:pi(O)?O:d(O.id);return!L&&!F?[null,null,L]:[L?O:Ta(F),F,L]},_e=(O,L=!0,F=e.nodes)=>{const[Q,Y,ke]=de(O);if(!Q)return[];const be=[];for(const Ce of F||e.nodes){if(!ke&&(Ce.id===Y.id||!Ce.computedPosition))continue;const ve=Ta(Ce),U=Ma(ve,Q);(L&&U>0||U>=ve.width*ve.height||U>=Number(Q.width)*Number(Q.height))&&be.push(Ce)}return be},Se=(O,L,F=!0)=>{const[Q]=de(O);if(!Q)return!1;const Y=Ma(Q,L);return F&&Y>0||Y>=Number(Q.width)*Number(Q.height)},me=O=>{const{viewport:L,dimensions:F,d3Zoom:Q,d3Selection:Y,translateExtent:ke}=e;if(!Q||!Y||!O.x&&!O.y)return!1;const be=So.translate(L.x+O.x,L.y+O.y).scale(L.zoom),Ce=[[0,0],[F.width,F.height]],ve=Q.constrain()(be,Ce,ke),U=e.viewport.x!==ve.x||e.viewport.y!==ve.y||e.viewport.zoom!==ve.k;return Q.transform(Y,ve),U},ye=O=>{const L=O instanceof Function?O(e):O,F=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ct(L.defaultEdgeOptions)&&(e.defaultEdgeOptions=L.defaultEdgeOptions);const Q=L.modelValue||L.nodes||L.edges?[]:void 0;Q&&(L.modelValue&&Q.push(...L.modelValue),L.nodes&&Q.push(...L.nodes),L.edges&&Q.push(...L.edges),C(Q));const Y=()=>{ct(L.maxZoom)&&I(L.maxZoom),ct(L.minZoom)&&N(L.minZoom),ct(L.translateExtent)&&A(L.translateExtent)};for(const ke of Object.keys(L)){const be=ke,Ce=L[be];![...P0,...F].includes(be)&&ct(Ce)&&(e[be]=Ce)}ll(()=>e.d3Zoom).not.toBeNull().then(Y),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:h,setElements:C,setNodes:V,setEdges:R,addNodes:M,addEdges:E,removeNodes:w,removeEdges:S,findNode:d,findEdge:u,updateEdge:B,updateEdgeData:z,updateNode:re,updateNodeData:pe,applyEdgeChanges:J,applyNodeChanges:K,addSelectedElements:f,addSelectedNodes:y,addSelectedEdges:b,setMinZoom:N,setMaxZoom:I,setTranslateExtent:A,setNodeExtent:x,setPaneClickDistance:$,removeSelectedElements:_,removeSelectedNodes:g,removeSelectedEdges:k,startConnection:ce,updateConnection:Ne,endConnection:he,setInteractive:T,setState:ye,getIntersectingNodes:_e,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Se,panBy:me,fitView:O=>i.value.fitView(O),zoomIn:O=>i.value.zoomIn(O),zoomOut:O=>i.value.zoomOut(O),zoomTo:(O,L)=>i.value.zoomTo(O,L),setViewport:(O,L)=>i.value.setViewport(O,L),setTransform:(O,L)=>i.value.setTransform(O,L),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(O,L,F)=>i.value.setCenter(O,L,F),fitBounds:(O,L)=>i.value.fitBounds(O,L),project:O=>i.value.project(O),screenToFlowCoordinate:O=>i.value.screenToFlowCoordinate(O),flowToScreenCoordinate:O=>i.value.flowToScreenCoordinate(O),toObject:()=>{const O=[],L=[];for(const F of e.nodes){const{computedPosition:Q,handleBounds:Y,selected:ke,dimensions:be,isParent:Ce,resizing:ve,dragging:U,events:H,...q}=F;O.push(q)}for(const F of e.edges){const{selected:Q,sourceNode:Y,targetNode:ke,events:be,...Ce}=F;L.push(Ce)}return JSON.parse(JSON.stringify({nodes:O,edges:L,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:O=>new Promise(L=>{const{nodes:F,edges:Q,position:Y,zoom:ke,viewport:be}=O;F&&V(F),Q&&R(Q);const[Ce,ve]=be!=null&&be.x&&(be!=null&&be.y)?[be.x,be.y]:Y??[null,null];if(Ce&&ve){const U=(be==null?void 0:be.zoom)||ke||e.viewport.zoom;return ll(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:Ce,y:ve,zoom:U}).then(()=>{L(!0)})})}else L(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const O=Fm();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const L=So.translate(O.defaultViewport.x??0,O.defaultViewport.y??0).scale(Yn(O.defaultViewport.zoom??1,O.minZoom,O.maxZoom)),F=e.viewportRef.getBoundingClientRect(),Q=[[0,0],[F.width,F.height]],Y=e.d3Zoom.constrain()(L,Q,O.translateExtent);e.d3Zoom.transform(e.d3Selection,Y)}ye(O)},$destroy:()=>{}}}const F0=["data-id","data-handleid","data-nodeid","data-handlepos"],U0={name:"Handle",compatConfig:{MODE:3}},Jn=t.defineComponent({...U0,props:{id:{default:null},type:{},position:{default:()=>Te.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:n}){const o=t.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),i=t.toRef(()=>o.type??"source"),a=t.toRef(()=>o.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:c,vueFlowRef:d,nodesConnectable:u,noDragClassName:m,noPanClassName:h}=je(),{id:p,node:y,nodeEl:b,connectedEdges:f}=Pm(),g=t.ref(),k=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),N=t.toRef(()=>{var R,C,M,E,w,S;return((R=l.value)==null?void 0:R.nodeId)===p&&((C=l.value)==null?void 0:C.id)===e.id&&((M=l.value)==null?void 0:M.type)===i.value||((E=c.value)==null?void 0:E.nodeId)===p&&((w=c.value)==null?void 0:w.id)===e.id&&((S=c.value)==null?void 0:S.type)===i.value}),I=t.toRef(()=>{var R,C,M;return((R=s.value)==null?void 0:R.nodeId)===p&&((C=s.value)==null?void 0:C.id)===e.id&&((M=s.value)==null?void 0:M.type)===i.value}),{handlePointerDown:A,handleClick:x}=Om({nodeId:p,handleId:e.id,isValidConnection:a,type:i}),$=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!f.value.some(R=>{const C=R[`${i.value}Handle`];return R[i.value]!==p?!1:C?C===e.id:!0}):typeof e.connectable=="number"?f.value.filter(R=>{const C=R[`${i.value}Handle`];return R[i.value]!==p?!1:C?C===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,f.value):ct(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var R;if(!y.dimensions.width||!y.dimensions.height)return;const C=(R=y.handleBounds[i.value])==null?void 0:R.find(K=>K.id===e.id);if(!d.value||C)return;const M=d.value.querySelector(".vue-flow__transformationpane");if(!b.value||!g.value||!M||!e.id)return;const E=b.value.getBoundingClientRect(),w=g.value.getBoundingClientRect(),S=window.getComputedStyle(M),{m22:B}=new window.DOMMatrixReadOnly(S.transform),z={id:e.id,position:e.position,x:(w.left-E.left)/B,y:(w.top-E.top)/B,type:i.value,nodeId:p,...Va(g.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],z]});function T(R){const C=Dl(R);$.value&&k.value&&(C&&R.button===0||!C)&&A(R)}function V(R){!p||!s.value&&!k.value||$.value&&x(R)}return n({handleClick:x,handlePointerDown:A,onClick:V,onPointerDown:T}),(R,C)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:g,"data-id":`${t.unref(r)}-${t.unref(p)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(p),"data-handlepos":R.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${R.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(h),i.value,{connectable:$.value,connecting:I.value,connectablestart:k.value,connectableend:_.value,connectionindicator:$.value&&(k.value&&!N.value||_.value&&N.value)}]]),onMousedown:T,onTouchstartPassive:T,onClick:V},[t.renderSlot(R.$slots,"default",{id:R.id})],42,F0))}}),Fa=function({sourcePosition:e=Te.Bottom,targetPosition:n=Te.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Jn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Jn,{type:"source",position:e,connectable:i,isValidConnection:r})]};Fa.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Fa.inheritAttrs=!1,Fa.compatConfig={MODE:3};const H0=Fa,Ua=function({targetPosition:e=Te.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Jn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};Ua.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ua.inheritAttrs=!1,Ua.compatConfig={MODE:3};const j0=Ua,Ha=function({sourcePosition:e=Te.Bottom,label:n,connectable:o=!0,isValidSourcePos:i,data:a}){const r=a.label??n;return[typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r]),t.h(Jn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Ha.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ha.inheritAttrs=!1,Ha.compatConfig={MODE:3};const K0=Ha,G0=["transform"],Y0=["width","height","x","y","rx","ry"],q0=["y"],W0={name:"EdgeText",compatConfig:{MODE:3}},J0=t.defineComponent({...W0,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const n=t.ref({x:0,y:0,width:0,height:0}),o=t.ref(null),i=t.computed(()=>`translate(${e.x-n.value.width/2} ${e.y-n.value.height/2})`);t.onMounted(a),t.watch([()=>e.x,()=>e.y,o,()=>e.label],a);function a(){if(!o.value)return;const r=o.value.getBBox();(r.width!==n.value.width||r.height!==n.value.height)&&(n.value=r)}return(r,l)=>(t.openBlock(),t.createElementBlock("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(t.openBlock(),t.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${n.value.width+2*r.labelBgPadding[0]}px`,height:`${n.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:t.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Y0)):t.createCommentVNode("",!0),t.createElementVNode("text",t.mergeProps(r.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:n.value.height/2,dy:"0.3em",style:r.labelStyle}),[t.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.label),{key:0})):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(r.label),1)],64))])],16,q0)],8,G0))}}),X0=["id","d","marker-end","marker-start"],Z0=["d","stroke-width"],Q0={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ja=t.defineComponent({...Q0,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:n}){const o=t.ref(null),i=t.ref(null),a=t.ref(null),r=t.useAttrs();return n({pathEl:o,interactionEl:i,labelEl:a}),(l,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",t.mergeProps(t.unref(r),{id:l.id,ref_key:"pathEl",ref:o,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,X0),l.interactionWidth?(t.openBlock(),t.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Z0)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(J0,{key:1,ref_key:"labelEl",ref:a,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):t.createCommentVNode("",!0)],64))}});function Um({sourceX:e,sourceY:n,targetX:o,targetY:i}){const a=Math.abs(o-e)/2,r=o<e?o+a:o-a,l=Math.abs(i-n)/2,s=i<n?i+l:i-l;return[r,s,a,l]}function Hm({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:a,sourceControlY:r,targetControlX:l,targetControlY:s}){const c=e*.125+a*.375+l*.375+o*.125,d=n*.125+r*.375+s*.375+i*.125,u=Math.abs(c-e),m=Math.abs(d-n);return[c,d,u,m]}function Ka(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function jm({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case Te.Left:l=n-Ka(n-i,r),s=o;break;case Te.Right:l=n+Ka(i-n,r),s=o;break;case Te.Top:l=n,s=o-Ka(o-a,r);break;case Te.Bottom:l=n,s=o+Ka(a-o,r);break}return[l,s]}function Km(e){const{sourceX:n,sourceY:o,sourcePosition:i=Te.Bottom,targetX:a,targetY:r,targetPosition:l=Te.Top,curvature:s=.25}=e,[c,d]=jm({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=jm({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[h,p,y,b]=Hm({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:m});return[`M${n},${o} C${c},${d} ${u},${m} ${a},${r}`,h,p,y,b]}function Gm({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case Te.Left:case Te.Right:r=.5*(n+i),l=o;break;case Te.Top:case Te.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function Ym(e){const{sourceX:n,sourceY:o,sourcePosition:i=Te.Bottom,targetX:a,targetY:r,targetPosition:l=Te.Top}=e,[s,c]=Gm({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=Gm({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,h,p,y]=Hm({sourceX:n,sourceY:o,targetX:a,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${n},${o} C${s},${c} ${d},${u} ${a},${r}`,m,h,p,y]}const qm={[Te.Left]:{x:-1,y:0},[Te.Right]:{x:1,y:0},[Te.Top]:{x:0,y:-1},[Te.Bottom]:{x:0,y:1}};function eN({source:e,sourcePosition:n=Te.Bottom,target:o}){return n===Te.Left||n===Te.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}function Wm(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function tN({source:e,sourcePosition:n=Te.Bottom,target:o,targetPosition:i=Te.Top,center:a,offset:r}){const l=qm[n],s=qm[i],c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:o.x+s.x*r,y:o.y+s.y*r},u=eN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",h=u[m];let p,y,b;const f={x:0,y:0},g={x:0,y:0},[k,_,N,I]=Um({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??k,b=a.y??_;const x=[{x:y,y:c.y},{x:y,y:d.y}],$=[{x:c.x,y:b},{x:d.x,y:b}];l[m]===h?p=m==="x"?x:$:p=m==="x"?$:x}else{const x=[{x:c.x,y:d.y}],$=[{x:d.x,y:c.y}];if(m==="x"?p=l.x===h?$:x:p=l.y===h?x:$,n===i){const M=Math.abs(e[m]-o[m]);if(M<=r){const E=Math.min(r-1,r-M);l[m]===h?f[m]=(c[m]>e[m]?-1:1)*E:g[m]=(d[m]>o[m]?-1:1)*E}}if(n!==i){const M=m==="x"?"y":"x",E=l[m]===s[M],w=c[M]>d[M],S=c[M]<d[M];(l[m]===1&&(!E&&w||E&&S)||l[m]!==1&&(!E&&S||E&&w))&&(p=m==="x"?x:$)}const T={x:c.x+f.x,y:c.y+f.y},V={x:d.x+g.x,y:d.y+g.y},R=Math.max(Math.abs(T.x-p[0].x),Math.abs(V.x-p[0].x)),C=Math.max(Math.abs(T.y-p[0].y),Math.abs(V.y-p[0].y));R>=C?(y=(T.x+V.x)/2,b=p[0].y):(y=p[0].x,b=(T.y+V.y)/2)}return[[e,{x:c.x+f.x,y:c.y+f.y},...p,{x:d.x+g.x,y:d.y+g.y},o],y,b,N,I]}function nN(e,n,o,i){const a=Math.min(Wm(e,n)/2,Wm(n,o)/2,i),{x:r,y:l}=n;if(e.x===r&&r===o.x||e.y===l&&l===o.y)return`L${r} ${l}`;if(e.y===l){const d=e.x<o.x?-1:1,u=e.y<o.y?1:-1;return`L ${r+a*d},${l}Q ${r},${l} ${r},${l+a*u}`}const s=e.x<o.x?1:-1,c=e.y<o.y?-1:1;return`L ${r},${l+a*c}Q ${r},${l} ${r+a*s},${l}`}function Hl(e){const{sourceX:n,sourceY:o,sourcePosition:i=Te.Bottom,targetX:a,targetY:r,targetPosition:l=Te.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,h,p,y,b]=tN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((g,k,_)=>{let N;return _>0&&_<m.length-1?N=nN(m[_-1],k,m[_+1],s):N=`${_===0?"M":"L"}${k.x} ${k.y}`,g+=N,g},""),h,p,y,b]}function oN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=Um({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const iN=t.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=oN(e);return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),Jm=t.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Hl({...e,sourcePosition:e.sourcePosition??Te.Bottom,targetPosition:e.targetPosition??Te.Top});return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),aN=t.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:n}){return()=>t.h(Jm,{...e,...n,borderRadius:0})}}),rN=t.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Km({...e,sourcePosition:e.sourcePosition??Te.Bottom,targetPosition:e.targetPosition??Te.Top});return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),lN=t.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:n}){return()=>{const[o,i,a]=Ym({...e,sourcePosition:e.sourcePosition??Te.Bottom,targetPosition:e.targetPosition??Te.Top});return t.h(ja,{path:o,labelX:i,labelY:a,...n,...e})}}}),sN={input:K0,default:H0,output:j0},cN={default:rN,straight:iN,step:aN,smoothstep:Jm,simplebezier:lN};function dN(e,n,o){const i=t.computed(()=>b=>n.value.get(b)),a=t.computed(()=>b=>o.value.get(b)),r=t.computed(()=>{const b={...cN,...e.edgeTypes},f=Object.keys(b);for(const g of e.edges)g.type&&!f.includes(g.type)&&(b[g.type]=g.type);return b}),l=t.computed(()=>{const b={...sN,...e.nodeTypes},f=Object.keys(b);for(const g of e.nodes)g.type&&!f.includes(g.type)&&(b[g.type]=g.type);return b}),s=t.computed(()=>e.onlyRenderVisibleElements?mm(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=t.computed(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const f of e.edges){const g=n.value.get(f.source),k=n.value.get(f.target);u0({sourcePos:g.computedPosition||{x:0,y:0},targetPos:k.computedPosition||{x:0,y:0},sourceWidth:g.dimensions.width,sourceHeight:g.dimensions.height,targetWidth:k.dimensions.width,targetHeight:k.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(f)}return b}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const b=[];for(const f of e.nodes)f.selected&&b.push(f);return b}),m=t.computed(()=>{const b=[];for(const f of e.edges)f.selected&&b.push(f);return b}),h=t.computed(()=>[...u.value,...m.value]),p=t.computed(()=>{const b=[];for(const f of e.nodes)f.dimensions.width&&f.dimensions.height&&f.handleBounds!==void 0&&b.push(f);return b}),y=t.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:p,areNodesInitialized:y}}class Xn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var n;const o=(n=t.getCurrentInstance())==null?void 0:n.appContext.app,i=(o==null?void 0:o.config.globalProperties.$vueFlowStorage)??Xn.instance;return Xn.instance=i??new Xn,o&&(o.config.globalProperties.$vueFlowStorage=Xn.instance),Xn.instance}set(n,o){return this.flows.set(n,o)}get(n){return this.flows.get(n)}remove(n){return this.flows.delete(n)}create(n,o){const i=Fm(),a=t.reactive(i),r={};for(const[h,p]of Object.entries(a.hooks)){const y=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[y]=p.on}const l={};for(const[h,p]of Object.entries(a.hooks))l[h]=p.trigger;const s=t.computed(()=>{const h=new Map;for(const p of a.nodes)h.set(p.id,p);return h}),c=t.computed(()=>{const h=new Map;for(const p of a.edges)h.set(p.id,p);return h}),d=dN(a,s,c),u=z0(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...l_(a),nodeLookup:s,edgeLookup:c,emits:l,id:n,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(n)}};return this.set(n,m),m}getId(){return`vue-flow-${this.currentId++}`}}function je(e){const n=Xn.getInstance(),o=t.getCurrentScope(),i=typeof e=="object",a=i?e:{id:e},r=a.id,l=r??(o==null?void 0:o.vueFlowId);let s;if(o){const c=t.inject(Vm,null);typeof c<"u"&&c!==null&&(!l||c.id===l)&&(s=c)}if(s||l&&(s=n.get(l)),!s||l&&s.id!==l){const c=r??n.getId(),d=n.create(c,a);s=d,(o??t.effectScope(!0)).run(()=>{t.watch(d.applyDefault,(m,h,p)=>{const y=f=>{d.applyNodeChanges(f)},b=f=>{d.applyEdgeChanges(f)};m?(d.onNodesChange(y),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)),p(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(b)})},{immediate:!0}),ei(()=>{if(s){const m=n.get(s.id);m?m.$destroy():_i(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Vm,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new ut(st.USEVUEFLOW_OPTIONS))}return s}function uN(e){const{emits:n,dimensions:o}=je();let i;t.onMounted(()=>{const a=()=>{var r,l;if(!e.value||!(((l=(r=e.value).checkVisibility)==null?void 0:l.call(r))??!0))return;const s=Va(e.value);(s.width===0||s.height===0)&&n.error(new ut(st.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),window.addEventListener("resize",a),e.value&&(i=new ResizeObserver(()=>a()),i.observe(e.value)),t.onBeforeUnmount(()=>{window.removeEventListener("resize",a),i&&e.value&&i.unobserve(e.value)})})}const mN={name:"UserSelection",compatConfig:{MODE:3}},fN=t.defineComponent({...mN,props:{userSelectionRect:{}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:t.normalizeStyle({width:`${n.userSelectionRect.width}px`,height:`${n.userSelectionRect.height}px`,transform:`translate(${n.userSelectionRect.x}px, ${n.userSelectionRect.y}px)`})},null,4))}}),pN=["tabIndex"],hN={name:"NodesSelection",compatConfig:{MODE:3}},yN=t.defineComponent({...hN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=je(),s=zm(),c=t.ref(null),d=Lm({el:c,onStart(y){n.selectionDragStart(y),n.nodeDragStart(y)},onDrag(y){n.selectionDrag(y),n.nodeDrag(y)},onStop(y){n.selectionDragStop(y),n.nodeDragStop(y)}});t.onMounted(()=>{var y;r.value||(y=c.value)==null||y.focus({preventScroll:!0})});const u=t.computed(()=>Al(i.value)),m=t.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(y){n.selectionContextMenu({event:y,nodes:i.value})}function p(y){r.value||Ro[y.key]&&(y.preventDefault(),s({x:Ro[y.key].x,y:Ro[y.key].y},y.shiftKey))}return(y,b)=>!t.unref(l)&&u.value.width&&u.value.height?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["vue-flow__nodesselection vue-flow__container",t.unref(a)]),style:t.normalizeStyle({transform:`translate(${t.unref(o).x}px,${t.unref(o).y}px) scale(${t.unref(o).zoom})`})},[t.createElementVNode("div",{ref_key:"el",ref:c,class:t.normalizeClass([{dragging:t.unref(d)},"vue-flow__nodesselection-rect"]),style:t.normalizeStyle(m.value),tabIndex:t.unref(r)?void 0:-1,onContextmenu:h,onKeydown:p},null,46,pN)],6)):t.createCommentVNode("",!0)}});function gN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const bN={name:"Pane",compatConfig:{MODE:3}},_N=t.defineComponent({...bN,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:n,nodes:o,viewport:i,emits:a,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:c,nodesSelectionActive:d,getSelectedEdges:u,getSelectedNodes:m,removeNodes:h,removeEdges:p,selectionMode:y,deleteKeyCode:b,multiSelectionKeyCode:f,multiSelectionActive:g,edgeLookup:k,nodeLookup:_,connectionLookup:N,defaultEdgeOptions:I,connectionStartHandle:A,panOnDrag:x}=je(),$=t.shallowRef(null),T=t.shallowRef(new Set),V=t.shallowRef(new Set),R=t.shallowRef(null),C=t.toRef(()=>c.value&&(e.isSelecting||r.value)),M=t.toRef(()=>A.value!==null);let E=!1,w=!1;const S=fi(b,{actInsideInputWithModifier:!1}),B=fi(f);t.watch(S,he=>{he&&(h(m.value),p(u.value),d.value=!1)}),t.watch(B,he=>{g.value=he});function z(he,de){return _e=>{_e.target===de&&(he==null||he(_e))}}function K(he){if(E||M.value){E=!1;return}a.paneClick(he),l(),d.value=!1}function J(he){var de;if(Array.isArray(x.value)&&((de=x.value)!=null&&de.includes(2))){he.preventDefault();return}a.paneContextMenu(he)}function re(he){a.paneScroll(he)}function pe(he){var de,_e,Se;if(R.value=((de=n.value)==null?void 0:de.getBoundingClientRect())??null,!c.value||!e.isSelecting||he.button!==0||he.target!==$.value||!R.value)return;(Se=(_e=he.target)==null?void 0:_e.setPointerCapture)==null||Se.call(_e,he.pointerId);const{x:me,y:ye}=gN(he,R.value);w=!0,E=!1,l(),s.value={width:0,height:0,startX:me,startY:ye,x:me,y:ye},a.selectionStart(he)}function ce(he){var de;if(!R.value||!s.value)return;E=!0;const{x:_e,y:Se}=Wt(he,R.value),{startX:me=0,startY:ye=0}=s.value,ie={startX:me,startY:ye,x:_e<me?_e:me,y:Se<ye?Se:ye,width:Math.abs(_e-me),height:Math.abs(Se-ye)},se=T.value,fe=V.value;T.value=new Set(mm(o.value,ie,i.value,y.value===Sl.Partial,!0).map(L=>L.id)),V.value=new Set;const O=((de=I.value)==null?void 0:de.selectable)??!0;for(const L of T.value){const F=N.value.get(L);if(F)for(const{edgeId:Q}of F.values()){const Y=k.value.get(Q);Y&&(Y.selectable??O)&&V.value.add(Q)}}if(!Mm(se,T.value)){const L=Sn(_.value,T.value,!0);a.nodesChange(L)}if(!Mm(fe,V.value)){const L=Sn(k.value,V.value);a.edgesChange(L)}s.value=ie,r.value=!0,d.value=!1}function Ne(he){var de;he.button!==0||!w||((de=he.target)==null||de.releasePointerCapture(he.pointerId),!r.value&&s.value&&he.target===$.value&&K(he),r.value=!1,s.value=null,d.value=T.value.size>0,a.selectionEnd(he),e.selectionKeyPressed&&(E=!1),w=!1)}return(he,de)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:$,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:he.isSelecting}]),onClick:de[0]||(de[0]=_e=>C.value?void 0:z(K,$.value)(_e)),onContextmenu:de[1]||(de[1]=_e=>z(J,$.value)(_e)),onWheelPassive:de[2]||(de[2]=_e=>z(re,$.value)(_e)),onPointerenter:de[3]||(de[3]=_e=>C.value?void 0:t.unref(a).paneMouseEnter(_e)),onPointerdown:de[4]||(de[4]=_e=>C.value?pe(_e):t.unref(a).paneMouseMove(_e)),onPointermove:de[5]||(de[5]=_e=>C.value?ce(_e):t.unref(a).paneMouseMove(_e)),onPointerup:de[6]||(de[6]=_e=>C.value?Ne(_e):void 0),onPointerleave:de[7]||(de[7]=_e=>t.unref(a).paneMouseLeave(_e))},[t.renderSlot(he.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(fN,{key:0,"user-selection-rect":t.unref(s)},null,8,["user-selection-rect"])):t.createCommentVNode("",!0),t.unref(d)&&t.unref(m).length?(t.openBlock(),t.createBlock(yN,{key:1})):t.createCommentVNode("",!0)],34))}}),kN={name:"Transform",compatConfig:{MODE:3}},EN=t.defineComponent({...kN,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=je(),a=t.computed(()=>o.value?!i.value:!1),r=t.computed(()=>`translate(${n.value.x}px,${n.value.y}px) scale(${n.value.zoom})`);return(l,s)=>(t.openBlock(),t.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:t.normalizeStyle({transform:r.value,opacity:a.value?0:void 0})},[t.renderSlot(l.$slots,"default")],4))}}),NN={name:"Viewport",compatConfig:{MODE:3}},wN=t.defineComponent({...NN,setup(e){const{minZoom:n,maxZoom:o,defaultViewport:i,translateExtent:a,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:c,panOnScrollMode:d,panOnScrollSpeed:u,panOnDrag:m,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:b,noWheelClassName:f,noPanClassName:g,emits:k,connectionStartHandle:_,userSelectionActive:N,paneDragging:I,d3Zoom:A,d3Selection:x,d3ZoomHandler:$,viewport:T,viewportRef:V,paneClickDistance:R}=je();uN(V);const C=t.shallowRef(!1),M=t.shallowRef(!1);let E=null,w=!1,S=0,B={x:0,y:0,zoom:0};const z=fi(s),K=fi(l),J=fi(r),re=t.toRef(()=>(!K.value||K.value&&l.value===!0)&&(z.value||m.value)),pe=t.toRef(()=>z.value||c.value),ce=t.toRef(()=>l.value===!0&&re.value!==!0),Ne=t.toRef(()=>K.value&&l.value!==!0||N.value||ce.value),he=t.toRef(()=>_.value!==null);t.onMounted(()=>{if(!V.value){_i("Viewport element is missing");return}const ye=V.value,ie=ye.getBoundingClientRect(),se=K1().clickDistance(R.value).scaleExtent([n.value,o.value]).translateExtent(a.value),fe=Vt(ye).call(se),O=fe.on("wheel.zoom"),L=So.translate(i.value.x??0,i.value.y??0).scale(Yn(i.value.zoom??1,n.value,o.value)),F=[[0,0],[ie.width,ie.height]],Q=se.constrain()(L,F,a.value);se.transform(fe,Q),se.wheelDelta(Tl),A.value=se,x.value=fe,$.value=O,T.value={x:Q.x,y:Q.y,zoom:Q.k},se.on("start",Y=>{var ke;if(!Y.sourceEvent)return null;S=Y.sourceEvent.button,C.value=!0;const be=Se(Y.transform);((ke=Y.sourceEvent)==null?void 0:ke.type)==="mousedown"&&(I.value=!0),B=be,k.viewportChangeStart(be),k.moveStart({event:Y,flowTransform:be})}),se.on("end",Y=>{if(!Y.sourceEvent)return null;if(C.value=!1,I.value=!1,de(re.value,S??0)&&!w&&k.paneContextMenu(Y.sourceEvent),w=!1,_e(B,Y.transform)){const ke=Se(Y.transform);B=ke,k.viewportChangeEnd(ke),k.moveEnd({event:Y,flowTransform:ke})}}),se.filter(Y=>{var ke;const be=J.value||y.value,Ce=p.value&&Y.ctrlKey,ve=Y.button,U=Y.type==="wheel";if(ve===1&&Y.type==="mousedown"&&(me(Y,"vue-flow__node")||me(Y,"vue-flow__edge")))return!0;if(!re.value&&!be&&!pe.value&&!h.value&&!p.value||N.value||he.value&&!U||!h.value&&Y.type==="dblclick"||me(Y,f.value)&&U||me(Y,g.value)&&(!U||pe.value&&U&&!J.value)||!p.value&&Y.ctrlKey&&U||!be&&!pe.value&&!Ce&&U)return!1;if(!p&&Y.type==="touchstart"&&((ke=Y.touches)==null?void 0:ke.length)>1)return Y.preventDefault(),!1;if(!re.value&&(Y.type==="mousedown"||Y.type==="touchstart")||ce.value&&Array.isArray(m.value)&&m.value.includes(0)&&ve===0||Array.isArray(m.value)&&!m.value.includes(ve)&&(Y.type==="mousedown"||Y.type==="touchstart"))return!1;const H=Array.isArray(m.value)&&m.value.includes(ve)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!ve||ve<=1;return(!Y.ctrlKey||z.value||U)&&H}),t.watch([N,re],()=>{N.value&&!C.value?se.on("zoom",null):N.value||se.on("zoom",Y=>{T.value={x:Y.transform.x,y:Y.transform.y,zoom:Y.transform.k};const ke=Se(Y.transform);w=de(re.value,S??0),k.viewportChange(ke),k.move({event:Y,flowTransform:ke})})},{immediate:!0}),t.watch([N,pe,d,J,p,b,f],()=>{pe.value&&!J.value&&!N.value?fe.on("wheel.zoom",Y=>{if(me(Y,f.value))return!1;const ke=J.value||y.value,be=p.value&&Y.ctrlKey;if(!(!b.value||pe.value||ke||be))return!1;Y.preventDefault(),Y.stopImmediatePropagation();const ve=fe.property("__zoom").k||1,U=bi();if(!z.value&&Y.ctrlKey&&p.value&&U){const W=Kt(Y),ne=Tl(Y),G=ve*2**ne;se.scaleTo(fe,G,W,Y);return}const H=Y.deltaMode===1?20:1;let q=d.value===mi.Vertical?0:Y.deltaX*H,xe=d.value===mi.Horizontal?0:Y.deltaY*H;!U&&Y.shiftKey&&d.value!==mi.Vertical&&!q&&xe&&(q=xe,xe=0),se.translateBy(fe,-(q/ve)*u.value,-(xe/ve)*u.value);const De=Se(fe.property("__zoom"));E&&clearTimeout(E),M.value?(k.move({event:Y,flowTransform:De}),k.viewportChange(De),E=setTimeout(()=>{k.moveEnd({event:Y,flowTransform:De}),k.viewportChangeEnd(De),M.value=!1},150)):(M.value=!0,k.moveStart({event:Y,flowTransform:De}),k.viewportChangeStart(De))},{passive:!1}):typeof O<"u"&&fe.on("wheel.zoom",function(Y,ke){const be=!b.value&&Y.type==="wheel"&&!Y.ctrlKey,Ce=J.value||y.value,ve=p.value&&Y.ctrlKey;if(!Ce&&!c.value&&!ve&&Y.type==="wheel"||be||me(Y,f.value))return null;Y.preventDefault(),O.call(this,Y,ke)},{passive:!1})},{immediate:!0})});function de(ye,ie){return ie===2&&Array.isArray(ye)&&ye.includes(2)}function _e(ye,ie){return ye.x!==ie.x&&!Number.isNaN(ie.x)||ye.y!==ie.y&&!Number.isNaN(ie.y)||ye.zoom!==ie.k&&!Number.isNaN(ie.k)}function Se(ye){return{x:ye.x,y:ye.y,zoom:ye.k}}function me(ye,ie){return ye.target.closest(`.${ie}`)}return(ye,ie)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:V,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(_N,{"is-selecting":Ne.value,"selection-key-pressed":t.unref(K),class:t.normalizeClass({connecting:he.value,dragging:t.unref(I),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(EN,null,{default:t.withCtx(()=>[t.renderSlot(ye.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),IN=["id"],vN=["id"],xN=["id"],CN={name:"A11yDescriptions",compatConfig:{MODE:3}},SN=t.defineComponent({...CN,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref(nm)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select a node. "+t.toDisplayString(t.unref(o)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,IN),t.createElementVNode("div",{id:`${t.unref(om)}-${t.unref(n)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,vN),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(X1)}-${t.unref(n)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},t.toDisplayString(t.unref(i)),9,xN))],64))}});function RN(){const e=je();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function $N(e,n,o){return o===Te.Left?e-n:o===Te.Right?e+n:e}function AN(e,n,o){return o===Te.Top?e-n:o===Te.Bottom?e+n:e}const jl=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=Te.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:$N(n,e,i),cy:AN(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};jl.props=["radius","centerX","centerY","position","type"],jl.compatConfig={MODE:3};const Xm=jl,TN=t.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:a,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:c,removeSelectedEdges:d,findEdge:u,findNode:m,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:b,edgesUpdatable:f,edgesFocusable:g,hooks:k}=je(),_=t.computed(()=>u(e.id)),{emit:N,on:I}=C0(_.value,r),A=t.inject(Oa),x=t.getCurrentInstance(),$=t.ref(!1),T=t.ref(!1),V=t.ref(""),R=t.ref(null),C=t.ref("source"),M=t.ref(null),E=t.toRef(()=>typeof _.value.selectable>"u"?b.value:_.value.selectable),w=t.toRef(()=>typeof _.value.updatable>"u"?f.value:_.value.updatable),S=t.toRef(()=>typeof _.value.focusable>"u"?g.value:_.value.focusable);t.provide(I0,e.id),t.provide(v0,M);const B=t.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),z=t.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),K=t.computed(()=>{const L=_.value.type||"default",F=A==null?void 0:A[`edge-${L}`];if(F)return F;let Q=_.value.template??c.value[L];if(typeof Q=="string"&&x){const Y=Object.keys(x.appContext.components);Y&&Y.includes(L)&&(Q=t.resolveComponent(L,!1))}return Q&&typeof Q!="string"?Q:(r.error(new ut(st.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:J}=Om({nodeId:V,handleId:R,type:C,isValidConnection:h,edgeUpdaterType:C,onEdgeUpdate:ce,onEdgeUpdateEnd:Ne});return()=>{const L=m(_.value.source),F=m(_.value.target),Q="pathOptions"in _.value?_.value.pathOptions:{};if(!L&&!F)return r.error(new ut(st.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!L)return r.error(new ut(st.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!F)return r.error(new ut(st.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||L.hidden||F.hidden)return null;let Y;i.value===cn.Strict?Y=L.handleBounds.source:Y=[...L.handleBounds.source||[],...L.handleBounds.target||[]];const ke=Im(Y,_.value.sourceHandle);let be;i.value===cn.Strict?be=F.handleBounds.target:be=[...F.handleBounds.target||[],...F.handleBounds.source||[]];const Ce=Im(be,_.value.targetHandle),ve=(ke==null?void 0:ke.position)||Te.Bottom,U=(Ce==null?void 0:Ce.position)||Te.Top,{x:H,y:q}=Ao(L,ke,ve),{x:xe,y:De}=Ao(F,Ce,U);return _.value.sourceX=H,_.value.sourceY=q,_.value.targetX=xe,_.value.targetY=De,t.h("g",{ref:M,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${K.value===!1?"default":_.value.type||"default"}`,s.value,B.value,{updating:$.value,selected:_.value.selected,animated:_.value.animated,inactive:!E.value&&!k.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel??`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":S.value?`${om}-${n}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",..._.value.domAttributes,onClick:de,onContextmenu:_e,onDblclick:Se,onMouseenter:me,onMousemove:ye,onMouseleave:ie,onKeyDown:S.value?O:void 0},[T.value?null:t.h(K.value===!1?c.value.default:K.value,{id:e.id,sourceNode:L,targetNode:F,source:_.value.source,target:_.value.target,type:_.value.type,updatable:w.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...I},style:z.value,markerStart:`url('#${gi(_.value.markerStart,n)}')`,markerEnd:`url('#${gi(_.value.markerEnd,n)}')`,sourcePosition:ve,targetPosition:U,sourceX:H,sourceY:q,targetX:xe,targetY:De,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...Q}),[w.value==="source"||w.value===!0?[t.h("g",{onMousedown:se,onMouseenter:re,onMouseout:pe},t.h(Xm,{position:ve,centerX:H,centerY:q,radius:a.value,type:"source","data-type":"source"}))]:null,w.value==="target"||w.value===!0?[t.h("g",{onMousedown:fe,onMouseenter:re,onMouseout:pe},t.h(Xm,{position:U,centerX:xe,centerY:De,radius:a.value,type:"target","data-type":"target"}))]:null]])};function re(){$.value=!0}function pe(){$.value=!1}function ce(L,F){N.update({event:L,edge:_.value,connection:F})}function Ne(L){N.updateEnd({event:L,edge:_.value}),T.value=!1}function he(L,F){L.button===0&&(T.value=!0,V.value=F?_.value.target:_.value.source,R.value=(F?_.value.targetHandle:_.value.sourceHandle)??null,C.value=F?"target":"source",N.updateStart({event:L,edge:_.value}),J(L))}function de(L){var F;const Q={event:L,edge:_.value};E.value&&(l.value=!1,_.value.selected&&p.value?(d([_.value]),(F=M.value)==null||F.blur()):o([_.value])),N.click(Q)}function _e(L){N.contextMenu({event:L,edge:_.value})}function Se(L){N.doubleClick({event:L,edge:_.value})}function me(L){N.mouseEnter({event:L,edge:_.value})}function ye(L){N.mouseMove({event:L,edge:_.value})}function ie(L){N.mouseLeave({event:L,edge:_.value})}function se(L){he(L,!0)}function fe(L){he(L,!1)}function O(L){var F;!y.value&&im.includes(L.key)&&E.value&&(L.key==="Escape"?((F=M.value)==null||F.blur(),d([u(e.id)])):o([u(e.id)]))}}}),MN=t.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:n,connectionMode:o,connectionStartHandle:i,connectionEndHandle:a,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:c,connectionStatus:d,viewport:u,findNode:m}=je(),h=(e=t.inject(Oa))==null?void 0:e["connection-line"],p=t.computed(()=>{var k;return m((k=i.value)==null?void 0:k.nodeId)}),y=t.computed(()=>{var k;return m((k=a.value)==null?void 0:k.nodeId)??null}),b=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),f=t.computed(()=>c.value.markerStart?`url(#${gi(c.value.markerStart,n)})`:""),g=t.computed(()=>c.value.markerEnd?`url(#${gi(c.value.markerEnd,n)})`:"");return()=>{var k,_,N;if(!p.value||!i.value)return null;const I=i.value.id,A=i.value.type,x=p.value.handleBounds;let $=(x==null?void 0:x[A])??[];if(o.value===cn.Loose){const z=(x==null?void 0:x[A==="source"?"target":"source"])??[];$=[...$,...z]}if(!$)return null;const T=(I?$.find(z=>z.id===I):$[0])??null,V=(T==null?void 0:T.position)??Te.Top,{x:R,y:C}=Ao(p.value,T,V);let M=null;y.value&&(o.value===cn.Strict?M=((k=y.value.handleBounds[A==="source"?"target":"source"])==null?void 0:k.find(z=>{var K;return z.id===((K=a.value)==null?void 0:K.id)}))||null:M=((_=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:_.find(z=>{var K;return z.id===((K=a.value)==null?void 0:K.id)}))||null);const E=((N=a.value)==null?void 0:N.position)??(V?Ol[V]:null);if(!V||!E)return null;const w=l.value??c.value.type??Gn.Bezier;let S="";const B={sourceX:R,sourceY:C,sourcePosition:V,targetX:b.value.x,targetY:b.value.y,targetPosition:E};return w===Gn.Bezier?[S]=Km(B):w===Gn.Step?[S]=Hl({...B,borderRadius:0}):w===Gn.SmoothStep?[S]=Hl(B):w===Gn.SimpleBezier?[S]=Ym(B):S=`M${R},${C} ${b.value.x},${b.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},h?t.h(h,{sourceX:R,sourceY:C,sourcePosition:V,targetX:b.value.x,targetY:b.value.y,targetPosition:E,sourceNode:p.value,sourceHandle:T,targetNode:y.value,targetHandle:M,markerEnd:g.value,markerStart:f.value,connectionStatus:d.value}):t.h("path",{d:S,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":g.value,"marker-start":f.value})))}}}),VN=["id","markerWidth","markerHeight","markerUnits","orient"],BN={name:"MarkerType",compatConfig:{MODE:3}},DN=t.defineComponent({...BN,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("marker",{id:n.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${n.width}`,markerHeight:`${n.height}`,markerUnits:n.markerUnits,orient:n.orient},[n.type===t.unref(Rl).ArrowClosed?(t.openBlock(),t.createElementBlock("polyline",{key:0,style:t.normalizeStyle({stroke:n.color,fill:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):t.createCommentVNode("",!0),n.type===t.unref(Rl).Arrow?(t.openBlock(),t.createElementBlock("polyline",{key:1,style:t.normalizeStyle({stroke:n.color,strokeWidth:n.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):t.createCommentVNode("",!0)],8,VN))}}),LN={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},ON={name:"MarkerDefinitions",compatConfig:{MODE:3}},PN=t.defineComponent({...ON,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=je(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=gi(d,n);l.has(u)||(typeof d=="object"?s.push({...d,id:u,color:d.color||a.value}):s.push({id:u,color:a.value,type:d}),l.add(u))}};for(const d of[i.value.markerEnd,i.value.markerStart])c(d);for(const d of o.value)for(const u of[d.markerStart,d.markerEnd])c(u);return s.sort((d,u)=>d.id.localeCompare(u.id))});return(l,s)=>(t.openBlock(),t.createElementBlock("svg",LN,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(DN,{id:c.id,key:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,"stroke-width":c.strokeWidth,orient:c.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),zN={name:"Edges",compatConfig:{MODE:3}},FN=t.defineComponent({...zN,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(PN),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o),l=>(t.openBlock(),t.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:t.normalizeStyle({zIndex:t.unref(m0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(TN),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(MN))],64))}}),UN=t.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:n,noPanClassName:o,selectNodesOnDrag:i,nodesSelectionActive:a,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:u,getNodeTypes:m,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:b,snapToGrid:f,snapGrid:g,nodeDragThreshold:k,nodesDraggable:_,elementsSelectable:N,nodesConnectable:I,nodesFocusable:A,hooks:x}=je(),$=t.ref(null);t.provide(Dm,$),t.provide(Bm,e.id);const T=t.inject(Oa),V=t.getCurrentInstance(),R=zm(),{node:C,parentNode:M}=Pm(e.id),{emit:E,on:w}=A0(C,l),S=t.toRef(()=>typeof C.draggable>"u"?_.value:C.draggable),B=t.toRef(()=>typeof C.selectable>"u"?N.value:C.selectable),z=t.toRef(()=>typeof C.connectable>"u"?I.value:C.connectable),K=t.toRef(()=>typeof C.focusable>"u"?A.value:C.focusable),J=t.computed(()=>B.value||S.value||x.value.nodeClick.hasListeners()||x.value.nodeDoubleClick.hasListeners()||x.value.nodeMouseEnter.hasListeners()||x.value.nodeMouseMove.hasListeners()||x.value.nodeMouseLeave.hasListeners()),re=t.toRef(()=>!!C.dimensions.width&&!!C.dimensions.height),pe=t.computed(()=>{const F=C.type||"default",Q=T==null?void 0:T[`node-${F}`];if(Q)return Q;let Y=C.template||m.value[F];if(typeof Y=="string"&&V){const ke=Object.keys(V.appContext.components);ke&&ke.includes(F)&&(Y=t.resolveComponent(F,!1))}return Y&&typeof Y!="string"?Y:(l.error(new ut(st.NODE_TYPE_MISSING,Y)),!1)}),ce=Lm({id:e.id,el:$,disabled:()=>!S.value,selectable:B,dragHandle:()=>C.dragHandle,onStart(F){E.dragStart(F)},onDrag(F){E.drag(F)},onStop(F){E.dragStop(F)},onClick(F){O(F)}}),Ne=t.computed(()=>C.class instanceof Function?C.class(C):C.class),he=t.computed(()=>{const F=(C.style instanceof Function?C.style(C):C.style)||{},Q=C.width instanceof Function?C.width(C):C.width,Y=C.height instanceof Function?C.height(C):C.height;return!F.width&&Q&&(F.width=typeof Q=="string"?Q:`${Q}px`),!F.height&&Y&&(F.height=typeof Y=="string"?Y:`${Y}px`),F}),de=t.toRef(()=>Number(C.zIndex??he.value.zIndex??0));return u(F=>{(F.includes(e.id)||!F.length)&&Se()}),t.onMounted(()=>{t.watch(()=>C.hidden,(F=!1,Q,Y)=>{!F&&$.value&&(e.resizeObserver.observe($.value),Y(()=>{$.value&&e.resizeObserver.unobserve($.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>C.type,()=>C.sourcePosition,()=>C.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:$.value,forceUpdate:!0}])})}),t.watch([()=>C.position.x,()=>C.position.y,()=>{var F;return(F=M.value)==null?void 0:F.computedPosition.x},()=>{var F;return(F=M.value)==null?void 0:F.computedPosition.y},()=>{var F;return(F=M.value)==null?void 0:F.computedPosition.z},de,()=>C.selected,()=>C.dimensions.height,()=>C.dimensions.width,()=>{var F;return(F=M.value)==null?void 0:F.dimensions.height},()=>{var F;return(F=M.value)==null?void 0:F.dimensions.width}],([F,Q,Y,ke,be,Ce])=>{const ve={x:F,y:Q,z:Ce+(p.value&&C.selected?1e3:0)};typeof Y<"u"&&typeof ke<"u"?C.computedPosition=r0({x:Y,y:ke,z:be},ve):C.computedPosition=ve},{flush:"post",immediate:!0}),t.watch([()=>C.extent,h],([F,Q],[Y,ke])=>{(F!==Y||Q!==ke)&&_e()}),C.extent==="parent"||typeof C.extent=="object"&&"range"in C.extent&&C.extent.range==="parent"?ll(()=>re).toBe(!0).then(_e):_e(),()=>C.hidden?null:t.h("div",{ref:$,"data-id":C.id,class:["vue-flow__node",`vue-flow__node-${pe.value===!1?"default":C.type||"default"}`,{[o.value]:S.value,dragging:ce==null?void 0:ce.value,draggable:S.value,selected:C.selected,selectable:B.value,parent:C.isParent},Ne.value],style:{visibility:re.value?"visible":"hidden",zIndex:C.computedPosition.z??de.value,transform:`translate(${C.computedPosition.x}px,${C.computedPosition.y}px)`,pointerEvents:J.value?"all":"none",...he.value},tabIndex:K.value?0:void 0,role:K.value?"group":void 0,"aria-describedby":y.value?void 0:`${nm}-${n}`,"aria-label":C.ariaLabel,"aria-roledescription":"node",...C.domAttributes,onMouseenter:me,onMousemove:ye,onMouseleave:ie,onContextmenu:se,onClick:O,onDblclick:fe,onKeydown:L},[t.h(pe.value===!1?m.value.default:pe.value,{id:C.id,type:C.type,data:C.data,events:{...C.events,...w},selected:C.selected,resizing:C.resizing,dragging:ce.value,connectable:z.value,position:C.computedPosition,dimensions:C.dimensions,isValidTargetPos:C.isValidTargetPos,isValidSourcePos:C.isValidSourcePos,parent:C.parentNode,parentNodeId:C.parentNode,zIndex:C.computedPosition.z??de.value,targetPosition:C.targetPosition,sourcePosition:C.sourcePosition,label:C.label,dragHandle:C.dragHandle,onUpdateNodeInternals:Se})]);function _e(){const F=C.computedPosition,{computedPosition:Q,position:Y}=Bl(C,f.value?La(F,g.value):F,l.error,h.value,M.value);(C.computedPosition.x!==Q.x||C.computedPosition.y!==Q.y)&&(C.computedPosition={...C.computedPosition,...Q}),(C.position.x!==Y.x||C.position.y!==Y.y)&&(C.position=Y)}function Se(){$.value&&d([{id:e.id,nodeElement:$.value,forceUpdate:!0}])}function me(F){ce!=null&&ce.value||E.mouseEnter({event:F,node:C})}function ye(F){ce!=null&&ce.value||E.mouseMove({event:F,node:C})}function ie(F){ce!=null&&ce.value||E.mouseLeave({event:F,node:C})}function se(F){return E.contextMenu({event:F,node:C})}function fe(F){return E.doubleClick({event:F,node:C})}function O(F){B.value&&(!i.value||!S.value||k.value>0)&&Pl(C,r.value,c,s,a,!1,$.value),E.click({event:F,node:C})}function L(F){if(!($l(F)||y.value))if(im.includes(F.key)&&B.value){const Q=F.key==="Escape";Pl(C,r.value,c,s,a,Q,$.value)}else S.value&&C.selected&&Ro[F.key]&&(F.preventDefault(),b.value=`Moved selected node ${F.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~C.position.x}, y: ${~~C.position.y}`,R({x:Ro[F.key].x,y:Ro[F.key].y},F.shiftKey))}}});function HN(e={includeHiddenNodes:!1}){const{nodes:n}=je();return t.computed(()=>{if(n.value.length===0)return!1;for(const o of n.value)if((e.includeHiddenNodes||!o.hidden)&&((o==null?void 0:o.handleBounds)===void 0||o.dimensions.width===0||o.dimensions.height===0))return!1;return!0})}const jN={class:"vue-flow__nodes vue-flow__container"},KN={name:"Nodes",compatConfig:{MODE:3}},GN=t.defineComponent({...KN,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=je(),a=HN(),r=t.ref();return t.watch(a,l=>{l&&t.nextTick(()=>{i.nodesInitialized(n.value)})},{immediate:!0}),t.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(c=>({id:c.target.getAttribute("data-id"),nodeElement:c.target,forceUpdate:!0}));t.nextTick(()=>o(s))})}),t.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",jN,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const h=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,h))return m;const p=(t.openBlock(),t.createBlock(t.unref(UN),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=h,p},s,0),128)):t.createCommentVNode("",!0)]))}});function YN(){const{emits:e}=je();t.onMounted(()=>{if(Rm()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new ut(st.MISSING_STYLES))}})}const qN=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),WN={name:"VueFlow",compatConfig:{MODE:3}},JN=t.defineComponent({...WN,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:n,emit:o}){const i=e,a=t.useSlots(),r=sl(i,"modelValue",o),l=sl(i,"nodes",o),s=sl(i,"edges",o),c=je(i),d=B0({modelValue:r,nodes:l,edges:s},i,c);return L0(o,c.hooks),RN(),YN(),t.provide(Oa,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(wN,null,{default:t.withCtx(()=>[t.createVNode(FN),qN,t.createVNode(GN),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(SN)],512))}}),XN={name:"Panel",compatConfig:{MODE:3}},Zm=t.defineComponent({...XN,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=je(),i=t.computed(()=>`${n.position}`.split("-"));return(a,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["vue-flow__panel",i.value]),style:t.normalizeStyle({pointerEvents:t.unref(o)?"none":"all"})},[t.renderSlot(a.$slots,"default")],6))}}),ZN=["width","height","innerHTML"],QN=t.defineComponent({__name:"EmIcon",props:{name:{},size:{}},setup(e){const n={network:'<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',table:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M12 3v18"/>',key:'<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>',asterisk:'<path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/>',link:'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',field:'<circle cx="12" cy="12" r="3"/>',method:'<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/><path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>',"arrow-lr":'<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>',note:'<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11l5-5V5a2 2 0 0 0-2-2Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>',chevron:'<path d="m9 18 6-6-6-6"/>',"expand-all":'<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',"collapse-all":'<path d="m7 20 5-5 5 5"/><path d="m7 4 5 5 5-5"/>',"panel-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m16 15-3-3 3-3"/>',"panel-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/><path d="m14 9 3 3-3 3"/>',"panel-right-close":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m8 9 3 3-3 3"/>',"panel-right-open":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/><path d="m10 15-3-3 3-3"/>',eye:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',undo:'<path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>',redo:'<path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>',history:'<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>',"add-entity":'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M8 12h8"/><path d="M12 8v8"/>',"auto-layout":'<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',image:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',save:'<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/><path d="M7 3v4a1 1 0 0 0 1 1h7"/>',route:'<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>',grid:'<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/>',map:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clipboard:'<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',trash:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',"alert-circle":'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><line x1="12" x2="12" y1="9" y2="13"/><line x1="12" x2="12.01" y1="17" y2="17"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',unlock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};return(o,i)=>(t.openBlock(),t.createElementBlock("svg",{class:"em-icon",width:e.size??16,height:e.size??16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",innerHTML:n[e.name]??""},null,8,ZN))}}),Ke=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ae=Ke(QN,[["__scopeId","data-v-05aac699"]]),Zn=["red","amber","green","teal","blue","indigo","violet","pink"],Qm={red:"em.swatch.red",amber:"em.swatch.amber",green:"em.swatch.green",teal:"em.swatch.teal",blue:"em.swatch.blue",indigo:"em.swatch.indigo",violet:"em.swatch.violet",pink:"em.swatch.pink"};function ew(e){return typeof e=="string"&&e in Qm}const tw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},nw=.15;function ow(e){const n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n)return null;let o=n[1];o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]);const i=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,r=parseInt(o.slice(4,6),16)/255,l=Math.max(i,a,r),s=Math.min(i,a,r),c=l-s,d=(l+s)/2;let u=0,m=0;return c!==0&&(u=c/(1-Math.abs(2*d-1)),l===i?m=(a-r)/c%6:l===a?m=(r-i)/c+2:m=(i-a)/c+4,m*=60,m<0&&(m+=360)),{h:m,s:u,l:d}}function iw(e){if(typeof e!="string")return null;const n=ow(e);if(!n||n.s<nw)return null;let o=null,i=1/0;for(const a of Zn){const r=Math.abs(n.h-tw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function _t(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(ew(n))return n;const o=e==null?void 0:e.properties;return iw((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Kl(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const aw={red:"var(--em-swatch-red-bar)",amber:"var(--em-swatch-amber-bar)",green:"var(--em-swatch-green-bar)",teal:"var(--em-swatch-teal-bar)",blue:"var(--em-swatch-blue-bar)",indigo:"var(--em-swatch-indigo-bar)",violet:"var(--em-swatch-violet-bar)",pink:"var(--em-swatch-pink-bar)"},rw={red:"color-mix(in srgb, var(--em-swatch-red-bar) 22%, transparent)",amber:"color-mix(in srgb, var(--em-swatch-amber-bar) 22%, transparent)",green:"color-mix(in srgb, var(--em-swatch-green-bar) 22%, transparent)",teal:"color-mix(in srgb, var(--em-swatch-teal-bar) 22%, transparent)",blue:"color-mix(in srgb, var(--em-swatch-blue-bar) 22%, transparent)",indigo:"color-mix(in srgb, var(--em-swatch-indigo-bar) 22%, transparent)",violet:"color-mix(in srgb, var(--em-swatch-violet-bar) 22%, transparent)",pink:"color-mix(in srgb, var(--em-swatch-pink-bar) 22%, transparent)"};function ef(e,n=!1){return e?n?rw[e]:aw[e]:null}function Qn(e){return Qm[e]}function To(e){return`var(--em-swatch-${e}-bar)`}function lw(e){switch(e.split("-")[1]){case"NAME":return"em.check.catName";case"JPA":return"em.check.catJpa";case"TYPE":return"em.check.catType";case"DSN":return"em.check.catDsn";default:return null}}function sw(e,n){const o=lw(n);return o?e(o):n.split("-")[1]??n}function cw(e){var o,i,a;const n=r=>e.params!=null&&r in e.params;switch(e.ruleId){case"CHK-NAME-1":return"em.check.name1";case"CHK-NAME-2":return"em.check.name2";case"CHK-NAME-3":return((o=e.params)==null?void 0:o.reason)==="package"?"em.check.name3Package":"em.check.name3Entity";case"CHK-NAME-4":return e.targetKind==="entity"?"em.check.name4Entity":"em.check.name4Attr";case"CHK-NAME-5":return"em.check.name5";case"CHK-NAME-6":return e.targetKind==="entity"?"em.check.name6Table":e.targetKind==="index"?"em.check.name6Index":"em.check.name6Column";case"CHK-NAME-7":return"em.check.name7";case"CHK-NAME-8":return"em.check.name8";case"CHK-NAME-9":return"em.check.name9";case"CHK-NAME-10":return"em.check.name10";case"CHK-JPA-1":return"em.check.jpa1";case"CHK-JPA-2":return"em.check.jpa2";case"CHK-JPA-4":return"em.check.jpa4";case"CHK-JPA-5":return"em.check.jpa5";case"CHK-JPA-6":return"em.check.jpa6";case"CHK-JPA-7":return"em.check.jpa7";case"CHK-JPA-8":return"em.check.jpa8";case"CHK-JPA-9":return"em.check.jpa9";case"CHK-JPA-10":return"em.check.jpa10";case"CHK-JPA-11":return"em.check.jpa11";case"CHK-JPA-12":return"em.check.jpa12";case"CHK-JPA-13":return n("seq")?"em.check.jpa13Sequence":"em.check.jpa13AutoIncrement";case"CHK-JPA-14":return"em.check.jpa14";case"CHK-JPA-15":return"em.check.jpa15";case"CHK-JPA-16":return"em.check.jpa16";case"CHK-JPA-17":return"em.check.jpa17";case"CHK-JPA-18":return"em.check.jpa18";case"CHK-JPA-19":return"em.check.jpa19";case"CHK-JPA-20":return"em.check.jpa20";case"CHK-JPA-21":return Number(((i=e.params)==null?void 0:i.slots)??0)<Number(((a=e.params)==null?void 0:a.declared)??0)?"em.check.jpa21Missing":"em.check.jpa21Extra";case"CHK-TYPE-1":return"em.check.type1";case"CHK-TYPE-2":return"em.check.type2";case"CHK-TYPE-3":return"em.check.type3";case"CHK-TYPE-4":return"em.check.type4";case"CHK-TYPE-6":return"em.check.type6";case"CHK-DSN-1":return"em.check.dsn1";case"CHK-DSN-2":return"em.check.dsn2";case"CHK-DSN-3":return"em.check.dsn3";case"CHK-DSN-4":return"em.check.dsn4";case"CHK-DSN-5":return n("field")?"em.check.dsn5Inherited":"em.check.dsn5Missing";case"CHK-DSN-6":return"em.check.dsn6";case"CHK-DSN-7":return"em.check.dsn7";default:return e.ruleId}}function tf(e,n){const o=cw(n);if(n.ruleId==="CHK-TYPE-4"){const i=e("em.check.unspecified"),a=n.params??{};return e(o,{type:a.type||i,dataType:a.dataType||i})}return e(o,n.params)}function dw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const uw={class:"em-inline-issue__msgs"},eo=Ke(t.defineComponent({__name:"InlineIssueBadge",props:{controller:{},refId:{}},setup(e){const n=e,o=n.controller,i={error:{order:0,icon:"alert-circle"},warning:{order:1,icon:"alert-triangle"},info:{order:2,icon:"info"}},a=t.computed(()=>n.refId?n.controller.issuesByRef.value.get(n.refId)??[]:[]),r=t.computed(()=>{let l=null;for(const s of a.value)(l===null||i[s.severity].order<i[l].order)&&(l=s.severity);return l});return(l,s)=>r.value?(t.openBlock(),t.createElementBlock("p",{key:0,class:t.normalizeClass(["em-inline-issue",`is-${r.value}`])},[t.createVNode(Ae,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",uw,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(c,d)=>(t.openBlock(),t.createElementBlock("span",{key:d},t.toDisplayString(t.unref(tf)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),mw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],fw={key:0,class:"em-mlang__dot"},pw=["id","role","aria-labelledby"],hw=["title"],dn=Ke(t.defineComponent({__name:"MultiLangTextField",props:{modelValue:{},name:{},languages:{default:()=>["ko","en","ja","zh"]},defaultLang:{},multiline:{type:Boolean,default:!1},placeholder:{},height:{},activeLang:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;function a(){const g=o.defaultLang;return g&&o.languages.includes(g)?g:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const g=o.activeLang;return g&&o.languages.includes(g)?g:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(g){var k,_;return!!((_=(k=o.modelValue)==null?void 0:k[g])!=null&&_.trim())}const d=g=>`${o.name}-tab-${g}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function h(g){var N,I;const k=o.languages,_=k[(g+k.length)%k.length];_&&(l.value=_,await t.nextTick(),(I=(N=m.value)==null?void 0:N.querySelectorAll('[role="tab"]')[k.indexOf(_)])==null||I.focus())}function p(g){h(o.languages.indexOf(s.value)+g)}const y=t.computed(()=>o.languages.filter(g=>{var k,_;return g!==s.value&&!!((_=(k=o.modelValue)==null?void 0:k[g])!=null&&_.trim())})),b=t.computed(()=>{var g;return((g=o.modelValue)==null?void 0:g[s.value])??""});function f(g){const k={...o.modelValue};g.trim()===""?delete k[s.value]:k[s.value]=g,i("update:modelValue",k)}return(g,k)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-mlang",{"is-controlled":r.value}])},[r.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:m,class:"em-mlang__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,_=>(t.openBlock(),t.createElementBlock("span",{id:d(_),key:_,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===_}]),role:"tab","aria-selected":s.value===_,"aria-controls":u.value,tabindex:s.value===_?0:-1,onClick:N=>l.value=_,onKeydown:[t.withKeys(t.withModifiers(N=>l.value=_,["prevent"]),["enter"]),t.withKeys(t.withModifiers(N=>l.value=_,["prevent"]),["space"]),k[0]||(k[0]=t.withKeys(t.withModifiers(N=>p(-1),["prevent"]),["left"])),k[1]||(k[1]=t.withKeys(t.withModifiers(N=>p(1),["prevent"]),["right"])),k[2]||(k[2]=t.withKeys(t.withModifiers(N=>h(0),["prevent"]),["home"])),k[3]||(k[3]=t.withKeys(t.withModifiers(N=>h(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(_),1),c(_)?(t.openBlock(),t.createElementBlock("span",fw,"•")):t.createCommentVNode("",!0)],42,mw))),128))],512)),t.createElementVNode("div",{id:u.value,role:r.value?void 0:"tabpanel","aria-labelledby":r.value?void 0:d(s.value)},[e.multiline?(t.openBlock(),t.createBlock(t.unref(te.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":b.value,"onUpdate:modelValue":f},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":b.value,"onUpdate:modelValue":f},null,8,["name","placeholder","model-value"]))],8,pw),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,hw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),yw=["disabled"],gw={class:"em-panel__sub-label"},bw={class:"em-field"},_w={class:"em-field"},kw={class:"em-field"},Ew={class:"em-class"},Nw={class:"em-field"},ww={class:"em-field"},Iw={class:"em-field"},vw={class:"em-field"},xw={class:"em-multilang"},Cw={class:"em-multilang"},Sw={class:"em-jpa"},Rw={class:"em-field"},$w={class:"em-field"},Aw={class:"em-field"},Tw={class:"em-swatch"},Mw={class:"em-swatch__row"},Vw=["title"],Bw=["title","onClick"],nf=Ke(t.defineComponent({__name:"EntityBasicsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean},title:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(C=>C.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(C=>C.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var C;return _t(((C=l.value)==null?void 0:C.style)??void 0)}),c=["JPA_ENTITY","JPA_EMBEDDABLE","JPA_MULTI_LANGUAGE_ENTITY","UNDEFINED"],d=[{key:"useVersion",label:"@Version"},{key:"useCacheable",label:"@Cacheable"},{key:"useDynamicInsert",label:"@DynamicInsert"},{key:"useDynamicUpdate",label:"@DynamicUpdate"},{key:"useDiscriminator",label:"@Discriminator"}],u=["inherit","STRING","CHAR","INTEGER"],m=C=>C;function h(C){return C==="inherit"?a.t("em.common.inherit"):C}function p(C){r.value&&a.updateEntity(r.value.modelId,C)}function y(C,M,E){var S;const w=((S=r.value)==null?void 0:S.table)??{physicalName:""};p(C==="physicalName"?{table:{...w,physicalName:E}}:{table:{...w,logicalName:{...w.logicalName,[M]:E}}})}function b(C){p({description:Object.keys(C).length?C:void 0})}function f(C,M){var E;p({jpaAttrs:{...(E=r.value)==null?void 0:E.jpaAttrs,[C]:M}})}function g(C,M){f(C,M)}const k=t.computed(()=>{var C,M;return((M=(C=r.value)==null?void 0:C.jpaAttrs)==null?void 0:M.discriminatorType)??"inherit"}),_=t.computed(()=>{var C,M;return!((M=(C=r.value)==null?void 0:C.jpaAttrs)!=null&&M.useDiscriminator)});function N(C){f("discriminatorType",C==="inherit"?void 0:C)}function I(C){p({hasPersonalInfo:C})}function A(C){p({superClass:C.trim()||void 0})}function x(C){p({schema:C.trim()||void 0})}function $(C){p({abstractClass:C})}const T=t.computed(()=>{var C,M;return((M=(C=r.value)==null?void 0:C.declarationOfInterfaces)==null?void 0:M.join(", "))??""});function V(C){const M=C.split(",").map(E=>E.trim()).filter(Boolean);p({declarationOfInterfaces:M.length?M:void 0})}function R(C){r.value&&a.setEntitySwatch(r.value.modelId,C)}return(C,M)=>{var E,w,S;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[e.collapsible?(t.openBlock(),t.createElementBlock("h4",{key:0,class:"em-panel__sub em-panel__sub--toggle",onClick:M[0]||(M[0]=B=>i("toggle"))},[t.createElementVNode("span",gw,[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString(e.title||r.value.name||t.unref(a).t("em.entity.fallback")),1)])])):t.createCommentVNode("",!0),!e.collapsible||!e.collapsed?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(eo,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",bw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":M[1]||(M[1]=B=>p({name:B}))},null,8,["model-value"])]),t.createElementVNode("label",_w,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":t.unref(jo),"onUpdate:modelValue":M[2]||(M[2]=B=>p({stereotype:B}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",kw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":M[3]||(M[3]=B=>p({packageName:B}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Ew,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Nw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":M[4]||(M[4]=B=>A(B))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",ww,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":T.value,"onUpdate:modelValue":M[5]||(M[5]=B=>V(B))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":M[6]||(M[6]=B=>$(B))},null,8,["label","model-value"])]),t.createElementVNode("label",Iw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-table",width:"100%","model-value":((E=r.value.table)==null?void 0:E.physicalName)??"","onUpdate:modelValue":M[7]||(M[7]=B=>y("physicalName",null,B))},null,8,["model-value"])]),t.createElementVNode("label",vw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(te.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":M[8]||(M[8]=B=>x(B))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",xw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.tableLogicalLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a).languages.value,B=>{var z,K;return t.openBlock(),t.createElementBlock("label",{key:B,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(B),1),t.createVNode(t.unref(te.BSTextInput),{name:`ent-logical-${B}`,width:"100%","model-value":((K=(z=r.value.table)==null?void 0:z.logicalName)==null?void 0:K[B])??"","onUpdate:modelValue":J=>y("logicalName",B,J)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",Cw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":b},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",Sw,[M[13]||(M[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,B=>{var z;return t.createVNode(t.unref(te.BSCheckbox),{key:B.key,name:`jpa-${B.key}`,class:"em-check",label:B.label,"model-value":!!((z=r.value.jpaAttrs)!=null&&z[B.key]),"onUpdate:modelValue":K=>g(B.key,K)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",Rw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(te.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:_.value,"model-value":((w=r.value.jpaAttrs)==null?void 0:w.discriminatorColumnName)??"","onUpdate:modelValue":M[9]||(M[9]=B=>f("discriminatorColumnName",B.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",$w,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(te.BSSelect),{disabled:_.value,"model-value":k.value,items:u,"value-provider":m,"label-provider":h,"onUpdate:modelValue":M[10]||(M[10]=B=>B&&N(B))},null,8,["disabled","model-value"])]),t.createElementVNode("label",Aw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(te.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:_.value,"model-value":(S=r.value.jpaAttrs)==null?void 0:S.discriminatorLength,"onUpdate:modelValue":M[11]||(M[11]=B=>f("discriminatorLength",B||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(te.BSCheckbox),{name:"ent-personalinfo",class:"em-check em-check--block",label:t.unref(a).t("em.entity.hasPersonalInfo"),"model-value":!!r.value.hasPersonalInfo,"onUpdate:modelValue":I},null,8,["label","model-value"]),t.createElementVNode("fieldset",Tw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",Mw,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":s.value===null}]),title:t.unref(a).t("em.swatch.none"),onClick:M[12]||(M[12]=B=>R(null))},"∅",10,Vw),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Zn),B=>(t.openBlock(),t.createElementBlock("button",{key:B,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===B}]),style:t.normalizeStyle({background:t.unref(To)(B)}),title:t.unref(a).t(t.unref(Qn)(B)),onClick:z=>R(B)},null,14,Bw))),128))])])],64)):t.createCommentVNode("",!0)],8,yw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9055ced6"]]),Dw=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"],of=["inherit","true","false"],Ga="__OWN__";function af(e,n){const o=t.computed(()=>e.state.logical.entities.find(W=>W.modelId===n())??null),i=t.computed(()=>{var W;return((W=o.value)==null?void 0:W.stereotype)==="JPA_EMBEDDABLE"}),a=t.computed(()=>new Set(e.selectedAttrIds.value));function r(W){return W==="none"?e.t("em.common.noneParen"):W}const l=W=>W;function s(W,ne){o.value&&e.updateAttribute(o.value.modelId,W.modelId,ne)}function c(W){return!!o.value&&!!Wi(e.state.logical,o.value.modelId,W.modelId)}function d(W,ne){s(W,{naturalId:ne||void 0,naturalIdMutable:ne?W.naturalIdMutable:void 0})}function u(){return{naturalId:void 0,naturalIdMutable:void 0}}function m(W,ne){s(W,{identifier:ne,...ne?u():{}})}function h(W,ne){s(W,{transient:ne||void 0,...ne?u():{}})}function p(W){return!!W.transient||W.attrType==="RELATION_REF"}function y(W){return Bi(W)}function b(W,ne=0){var G;return((G=Di(W,o.value,e.state.logical.entities,e.state.logical.associations,ne))==null?void 0:G.physicalName)||void 0}const f=W=>W.value,g=W=>W.label;function k(W,ne){if(!ne)return;const G=R.value.find(P=>P.type===ne);if(G){const P=W.dbAttrs[0]??{modelId:W.modelId+".c",physicalName:W.name,dataType:"VARCHAR"};s(W,{type:ne,customType:void 0,dbAttrs:[{...P,dataType:G.dataType,length:G.length,scale:G.scale}]});return}s(W,ne===en?{type:ne}:{type:ne,customType:void 0})}function _(W,ne){s(W,{customType:ne.trim()===""?void 0:ne})}function N(W,ne){if(W.attrType==="RELATION_REF")return;const P={...W.dbAttrs[0]??{modelId:W.modelId+".c",physicalName:W.name,dataType:"VARCHAR"},...ne};ne.dataType!==void 0&&!vr.has(P.dataType)&&(P.scale=void 0),s(W,{dbAttrs:[P]})}function I(W){var ne;return vr.has(((ne=W.dbAttrs[0])==null?void 0:ne.dataType)??"")}function A(W){return!I(W)&&!y(W)&&!p(W)?e.t("em.attr.scaleTypeHint"):void 0}function x(W,ne){N(W,{logicalName:Object.keys(ne).length?ne:void 0})}function $(W,ne){s(W,{description:Object.keys(ne).length?ne:void 0})}function T(W){return W.personalInfoAttributeType??"none"}function V(W,ne){s(W,{personalInfoAttributeType:ne==="none"?void 0:ne})}const R=t.computed(()=>e.predefinedCustomTypeCatalog.value),C=t.computed(()=>e.embeddableCatalog.value);function M(W){var ne,G,P;return((ne=W.label)==null?void 0:ne[e.userLanguage.value])??((G=W.label)==null?void 0:G.ko)??((P=W.label)==null?void 0:P.en)??W.type}const E=t.computed(()=>e.groupCodeCatalog.value);function w(W){var ne;return((ne=E.value.find(G=>G.groupCode===W.groupCode))==null?void 0:ne.codes)??[]}function S(W){return["none",...w(W)]}function B(W){return W==="none"?"none":W.code}function z(W){var G,P,ae;if(W==="none")return e.t("em.common.noneParen");const ne=((G=W.label)==null?void 0:G[e.userLanguage.value])??((P=W.label)==null?void 0:P.ko)??((ae=W.label)==null?void 0:ae.en);return ne?`${W.code} (${ne})`:W.code}function K(W,ne){o.value&&e.setAttributeGroupCode(o.value.modelId,W.modelId,ne)}function J(W,ne){s(W,{defaultValue:ne==="none"?void 0:ne})}function re(W,ne){s(W,{defaultValue:ne.trim()===""?void 0:ne})}function pe(W){return W.attrType.startsWith("EMBED")&&W.dbAttrs.length>0}function ce(W,ne,G){const P=W.dbAttrs.map((ae,Re)=>{if(Re!==ne)return ae;const le={...ae,...G};for(const j of Object.keys(G))G[j]===void 0&&delete le[j];return le});o.value&&e.setEmbedColumns(o.value.modelId,W.modelId,P)}function Ne(W,ne,G){ce(W,ne,{logicalName:Object.keys(G).length?G:void 0})}function he(W,ne){var ae,Re,le;if(W.attrType==="EMBED_PREDEF"){const j=(ae=e.embeddableCatalog.value.find(Xe=>Xe.type===W.type))==null?void 0:ae.fields[ne];return j?{name:j.name,physicalName:j.physicalName,dataType:j.dataType,length:j.length,scale:j.scale,shareable:j.shareable,logicalName:j.logicalName}:void 0}const G=(Re=W.embedded)==null?void 0:Re.embeddableRef;if(!G)return;const P=(le=e.state.logical.entities.find(j=>j.modelId===G))==null?void 0:le.attributes.flatMap(j=>j.dbAttrs)[ne];return P?{physicalName:P.physicalName,dataType:P.dataType,length:P.length,scale:P.scale,logicalName:P.logicalName}:void 0}function de(W,ne){var G,P;return((G=he(W,ne))==null?void 0:G.dataType)||((P=W.dbAttrs[ne])==null?void 0:P.dataType)||""}function _e(W,ne){var G,P;return((G=he(W,ne))==null?void 0:G.length)??((P=W.dbAttrs[ne])==null?void 0:P.length)}function Se(W,ne){var G,P;return((G=he(W,ne))==null?void 0:G.scale)??((P=W.dbAttrs[ne])==null?void 0:P.scale)}const me=of;function ye(W){return W==="inherit"?e.t("em.common.inherit"):W}function ie(W){return(W==null?void 0:W.updatable)===void 0?"inherit":W.updatable?"true":"false"}function se(W,ne,G){ce(W,ne,{updatable:G==="inherit"?void 0:G==="true"})}function fe(W,ne){N(W,{updatable:ne==="inherit"?void 0:ne==="true"})}const O=of;function L(W){return W==="inherit"?e.t("em.common.inherit"):W}function F(W){return(W==null?void 0:W.insertable)===void 0?"inherit":W.insertable?"true":"false"}function Q(W,ne,G){ce(W,ne,{insertable:G==="inherit"?void 0:G==="true"})}function Y(W,ne){N(W,{insertable:ne==="inherit"?void 0:ne==="true"})}const ke=t.computed(()=>o.value?Er(o.value,e.state.logical.entities):[]),be=t.computed(()=>so(ke.value.flatMap(W=>W.attributes.flatMap(ne=>ne.dbAttrs)))),Ce=t.computed(()=>ke.value.flatMap(W=>W.attributes.filter(ne=>ne.attrType==="NORMAL"&&ne.dbAttrs.length===1&&ne.dbAttrs[0]).map(ne=>{var G;return{modelId:ne.dbAttrs[0].modelId,physical:ne.dbAttrs[0].physicalName||ne.name,isCurrency:ne.type==="Currency",ownerName:W.modelId===((G=o.value)==null?void 0:G.modelId)?void 0:W.name}})));function ve(){const W=[...Ce.value].sort((ne,G)=>Number(G.isCurrency)-Number(ne.isCurrency));return[Ga,...W.map(ne=>ne.modelId)]}function U(W){if(W===Ga)return e.t("em.attr.sharedOwn");const ne=Ce.value.find(P=>P.modelId===W);if(!ne)return W;const G=ne.ownerName?`${ne.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:G,physical:ne.physical,mode:ne.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function H(W){return(W==null?void 0:W.sharedColumnRef)??Ga}function q(W,ne,G){ce(W,ne,{sharedColumnRef:G===Ga?void 0:G})}function xe(W){return(W==null?void 0:W.sharedColumnRef)!=null}function De(W){var ne;return((ne=Bn(W,be.value))==null?void 0:ne.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:Dw,piiLabel:r,idn:l,setAttr:s,isManagedFk:c,setNaturalId:d,clearNaturalIdPatch:u,setIdentifier:m,setTransient:h,dbLocked:p,fkDerived:y,fkOriginPhysical:b,typeValueOf:f,typeLabelOf:g,setAttrType:k,setAttrCustomType:_,setDb:N,scaleApplicable:I,scaleHint:A,setDbLogical:x,setAttrDescription:$,attrPiiValue:T,setAttrPii:V,predefinedCustomTypeCatalog:R,embeddableCatalog:C,predefinedLabel:M,groupCodeCatalog:E,attrGroupCodes:w,attrCodeItems:S,codeValueOf:B,codeLabelOf:z,setAttrGroupCode:K,setAttrCode:J,setAttrDefaultValue:re,isEmbedExpanded:pe,setDbAt:ce,setDbLogicalAt:Ne,embedColMeta:he,fixedDataType:de,fixedLength:_e,fixedScale:Se,updatableItems:me,updatableLabel:ye,updatableValue:ie,setUpdatableAt:se,setUpdatable:fe,insertableItems:O,insertableLabel:L,insertableValue:F,setInsertableAt:Q,setInsertable:Y,scopeEntities:ke,columnsById:be,sharedCandidates:Ce,sharedItems:ve,sharedLabel:U,sharedValue:H,setSharedAt:q,isShared:xe,sharedPhysical:De}}const rf={"em.mode.view":"View","em.mode.edit":"Edit","em.mode.frozen":"Editing locked (conflict)","em.mode.frozenTitle":"Editing is locked due to a concurrent-edit conflict. Reloading the latest content.","em.mode.readonlyTitle":"This diagram is read-only","em.toolbar.undo":"Undo","em.toolbar.redo":"Redo","em.toolbar.displayLabel":"Show","em.toolbar.routingToggle":"Toggle connector mode","em.toolbar.routingOrthogonal":"Orthogonal","em.toolbar.routingStraight":"Straight","em.toolbar.grid":"Grid","em.toolbar.gridOn":"Show grid","em.toolbar.gridOff":"Hide grid","em.toolbar.minimap":"Minimap","em.toolbar.minimapOn":"Show minimap","em.toolbar.minimapOff":"Hide minimap","em.toolbar.exportText":"Export (Text · Mermaid)","em.toolbar.exportSvg":"Export SVG","em.toolbar.exportPng":"Export PNG","em.toolbar.import":"Import (paste text)","em.toolbar.history":"History","em.toolbar.historyOpen":"Open change history","em.toolbar.historyClose":"Close change history","em.toolbar.shortcuts":"Keyboard shortcuts (?)","em.displayMode.logical":"Logical","em.displayMode.physical":"Physical","em.displayMode.logicalPhysical":"Logical · Physical","em.displayMode.class":"Class","em.panel.resizeWidth":"Resize width","em.panel.collapse":"Collapse","em.panel.expand":"Expand","em.panel.collapseAll":"Collapse all","em.panel.expandAll":"Expand all","em.panel.lockedBanner":"Locked — move, edit, and delete are blocked","em.panel.openNamed":"Open {name}","em.notice.readOnly":"Editing is not available in view mode","em.notice.entityLocked":"This entity is locked — unlock it to edit","em.notice.groupLocked":"This group is locked — unlock it to edit","em.notice.assocLocked":"This association touches a locked entity — unlock it to edit","em.validation.title":"Validation","em.validation.noIssues":"No validation issues.","em.validation.noVisibleIssues":"No issues to show (filter applied).","em.validation.checkOrphanEntities":"Check entities without relations","em.validation.nameless":"(no name)","em.validation.severityError":"Errors","em.validation.severityWarning":"Warnings","em.validation.severityInfo":"Info","em.validation.hideSeverity":"Hide {label}","em.validation.showSeverity":"Show {label}","em.validation.expandPanel":"Expand validation panel","em.validation.quickFix":"Fix","em.validation.quickFixTip":"Apply automatic fix (undoable)","em.common.close":"Close","em.common.save":"Save","em.export.title":"Export","em.export.formatText":"Logical model text","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (Class)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (backup)","em.export.copy":"Copy","em.export.download":"Download","em.export.copied":"Copied to clipboard.","em.export.copyFailed":"Failed to copy.","em.import.title":"Import","em.import.placeholder":"Paste SQL DDL, Mermaid ER, or a JSON backup.","em.import.formatGroup":"Input format","em.import.formatAuto":"Auto-detect","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"Detected: {format}","em.import.summary":"{entities} entities · {relations} relations","em.import.warnings":"{n} warning(s) (partial parse)","em.import.error":"Parse failed: {message}","em.import.emptyParse":"No entities recognized.","em.import.unknownFormat":"Could not detect format — pick one above.","em.import.confirm":"Import","em.shortcuts.title":"Keyboard shortcuts","em.shortcuts.groupEdit":"Edit","em.shortcuts.groupMove":"Move · Arrange","em.shortcuts.groupExplorer":"Explorer","em.shortcuts.descExplorerSearch":"Focus explorer search","em.shortcuts.descExplorerNav":"Move through tree (←→ collapse/expand)","em.shortcuts.descExplorerSelect":"Select item + center canvas","em.shortcuts.descExplorerDetail":"Open entity detail editor","em.shortcuts.groupOther":"Other","em.shortcuts.keyArrows":"Arrow keys","em.shortcuts.keyRightClick":"Right-click","em.shortcuts.descUndo":"Undo","em.shortcuts.descRedo":"Redo","em.shortcuts.descCopy":"Copy selection","em.shortcuts.descPaste":"Paste","em.shortcuts.descDelete":"Delete selection (same as Backspace)","em.shortcuts.descMove1":"Move selected node 1px","em.shortcuts.descMove10":"Move selected node 10px","em.shortcuts.descAttrFocus":"Move focus when an attribute is selected","em.shortcuts.descAttrReorder":"Reorder attribute up/down","em.shortcuts.descContextMenu":"Context menu (add entity·note, etc.)","em.shortcuts.descInlineConfirm":"Confirm inline edit","em.shortcuts.descCloseEdit":"Close edit·menu","em.shortcuts.descOpenHelp":"Open this help","em.shortcuts.descCommandPalette":"Command palette (go to · run command)","em.opSource.title":"Body — {name}()","em.opSource.placeholder":"// Java implementation code","em.entity.name":"Name","em.entity.stereotype":"Stereotype","em.entity.package":"Package","em.panel.unlock":"Unlock","em.entity.fallback":"Entity","em.group.fallback":"Group","em.common.description":"Description","em.common.memo":"Memo","em.common.color":"Color","em.common.add":"Add","em.common.inherit":"Default (inherit)","em.common.noneParen":"(none)","em.swatch.none":"None","em.swatch.red":"Red","em.swatch.amber":"Orange","em.swatch.green":"Green","em.swatch.teal":"Teal","em.swatch.blue":"Blue","em.swatch.indigo":"Indigo","em.swatch.violet":"Violet","em.swatch.pink":"Pink","em.inspector.ctxEntityAttrs":"Entity · {name} › Attributes · {n}","em.inspector.ctxEntityDivider":"Entity · {name} › Divider","em.inspector.ctxEntityAttr":"Entity · {name} › Attribute · {attr}","em.inspector.ctxEntity":"Entity · {name}","em.inspector.ctxAssoc":"Relation · {a} — {b}","em.inspector.ctxGroup":"Group · {name}","em.inspector.ctxNote":"Note","em.inspector.ctxNone":"No selection","em.assoc.identifying":"identifying (identifying relation)","em.assoc.selfNoIdentifying":"A self-association cannot be an identifying relation (non-identifying FK enforced).","em.assoc.embedNoIdentifying":"Embedded (@Embedded/@ElementCollection) cannot be an identifying relation (an embeddable has no independent identifier).","em.assoc.multiplicity":"Multiplicity","em.assoc.navFieldName":"Field name (nav)","em.assoc.cascadeAllNote":"ALL already includes every individual cascade (CHK-JPA-5).","em.assoc.orphanRemovalNote":"The opposite end is a collection (@ManyToOne/@ManyToMany), so orphanRemoval has no effect (CHK-JPA-14).","em.assoc.navRequiredNote":"This direction has no nav property (navigable off), so cascade and fetch do not apply.","em.assoc.ownerNavFixed":"The JPA owning-side reference (@ManyToOne) is inherent to the relation and always on — model a reference-less FK as a plain column instead.","em.assoc.orderByPlaceholder":"e.g. name ASC","em.assoc.jpaDetails":"JPA details","em.embed.legend":"Embedded","em.embed.cardinality":"Cardinality","em.embed.card1":"1 (required @Embedded)","em.embed.card01":"0..1 (optional @Embedded)","em.embed.card0N":"0..* (collection @ElementCollection)","em.embed.collectionTablePlaceholder":"Codegen fallback if unset","em.embed.orderColumnPlaceholder":"Order not preserved if unset","em.embed.ownerFixedNote":"An embeddable is flattened into its owner, so the owner-side end (multiplicity·navigable·composition) is structurally fixed and not shown.","em.group.nameLegend":"Group name","em.group.excludeDDL":"Exclude from DDL generation","em.group.members":"{n} member entities","em.entity.classLegend":"Class","em.entity.superClass":"Superclass","em.entity.superClassPlaceholder":"e.g. BaseEntity","em.entity.interfaces":"Implemented interfaces","em.entity.interfacesPlaceholder":"Comma-separated (e.g. Serializable, Cloneable)","em.entity.abstractClass":"Abstract class","em.entity.tablePhysical":"Table (physical)","em.entity.schema":"Schema","em.entity.schemaPlaceholder":"e.g. sales, master","em.entity.tableLogicalLegend":"Table logical name","em.entity.discColumn":"Discriminator column","em.entity.discColumnPlaceholder":"e.g. DTYPE","em.entity.discType":"Discriminator type","em.entity.discLength":"Discriminator length","em.entity.hasPersonalInfo":"Contains personal info (hasPersonalInfo)","em.entity.headerColor":"Header color","em.attr.section":"Attributes ({n})","em.attr.addEmbeddable":"Add embeddable","em.attr.nameless":"(no name)","em.attr.selectHint":"Select an attribute above to show its edit form.","em.attr.inverseNavHint":"Inverse association field — no physical column (references the target entity).","em.attr.fkDerivedNote":"Derived from a foreign key — its shape follows the parent PK; change it on the association line or identifying relationship.","em.attr.scaleTypeHint":"Scale (fractional digits) applies only to NUMERIC and DECIMAL types.","em.attr.embedFixedHint":"Fixed by the embeddable definition.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.namePlaceholder":"Name","em.attr.typePlaceholder":"Type","em.attr.customTypePlaceholder":"Custom type name","em.attr.logicalPlaceholder":"Logical name","em.attr.columnPlaceholder":"Column","em.attr.defaultValue":"Default value","em.attr.codeGroup":"Code group","em.attr.currencyColumn":"Currency column","em.attr.pii":"Personal info","em.attr.colFallback":"Column {n}","em.attr.sharedOwn":"Own column (OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"currency","em.attr.sharedMode":"shared","em.attr.batchHint":"{n} selected · bulk","em.attr.fkDeleteHint":"Foreign keys are derived from associations — delete the association line instead","em.op.section":"Operations ({n})","em.op.namePlaceholder":"Operation name","em.op.editBodyDirty":"Edit body ●","em.op.editBody":"Edit body","em.index.section":"Indexes ({n})","em.index.inherited":"{field} (inherited)","em.index.namePlaceholder":"Index name","em.index.addColumn":"Column","em.index.condition":"Condition (partial index)","em.index.conditionPlaceholder":"e.g. WHERE status = 'A'","em.groupCode.searchPlaceholder":"Search / select code group","em.groupCode.noMatch":"No matching code group","em.detail.tabBasics":"Basics","em.detail.tabColumns":"Attributes","em.detail.tabIndexes":"Indexes","em.detail.tabOperations":"Operations","em.detail.title":"Entity — {name}","em.attr.addDivider":"Divider","em.attr.columnPhysical":"Column (physical)","em.attr.constraints":"Constraints","em.attr.dividerLabelPlaceholder":"Divider label (optional)","em.attr.dividerNote":"── divider ──","em.attr.detailCollapse":"Collapse details","em.attr.detailExpand":"Expand details","em.attr.semanticLegend":"Semantics","em.attr.embedChildCols":"Embeddable — {n} child columns","em.attr.overrideCollapse":"Collapse overrides","em.attr.overrideExpand":"Expand overrides","em.attr.overrideLegend":"Column overrides","em.attr.empty":"No attributes — create with 'Add'","em.op.body":"Body","em.op.bodyDirty":"Body ●","em.op.empty":"No operations — create with 'Add'","em.index.delete":"Delete index","em.index.empty":"No indexes — create with 'Add'","em.index.conditionPlaceholderWide":"e.g. WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"Superclass inherited column","em.index.inheritedBadge":"inherited","em.index.colUnspecified":"{name} (column unspecified of {n})","em.index.multiColumn":"{name} ({n} columns)","em.index.unnamedAttr":"(unnamed)","em.index.availColumns":"Available columns ({n})","em.index.indexColumns":"Index columns ({n})","em.index.allColumnsUsed":"All columns used","em.index.addArrow":"Add →","em.index.moveUp":"Move up","em.index.moveDown":"Move down","em.index.removeColumn":"Remove","em.index.noColumns":"No columns — add from the left","em.index.selectPrompt":"Select or add an index.","em.palette.autoLayout":"Auto layout","em.cmd.title":"Command palette","em.cmd.placeholder":"Jump to an entity or run a command…","em.cmd.sectionGoto":"Go to","em.cmd.sectionActions":"Commands","em.cmd.empty":"No matches","em.cmd.groupTag":"Group","em.canvas.emptyTitle":"This diagram is empty","em.canvas.emptyHint":"<strong>Right-click</strong> the canvas or use the bottom-left <strong>+</strong> button to add your first entity.","em.canvas.emptyConnectHint":"Once you have two or more entities, <strong>drag</strong> from an entity edge to connect them with a relationship.","em.canvas.emptyShortcutHint":"Press <kbd>?</kbd> for keyboard shortcuts","em.canvas.emptyReadonly":"No entities to show","em.canvas.exportFailed":"Export failed","em.conflict.lockedTitle":"Editing is locked","em.conflict.missingDetail":"Your changes could not be saved (server or network error). Reload the latest content.","em.conflict.changedDetail":"This diagram was changed elsewhere, so editing is locked. Reload the latest content.","em.conflict.commandFailedDetail":"The edit could not be processed, so what you see is out of sync. Your saved content is unaffected — reload the latest content.","em.ctx.addEntity":"Add entity","em.ctx.addNote":"Add note","em.ctx.addGroup":"Add group","em.ctx.paste":"Paste","em.ctx.copy":"Copy","em.ctx.copyN":"Copy ({n})","em.ctx.editDetail":"Edit details…","em.ctx.viewDetail":"View details…","em.ctx.lock":"Lock","em.ctx.ungroup":"Ungroup","em.ctx.deleteNote":"Delete note","em.ctx.addAttr":"Add attribute","em.ctx.colorN":"Color ({n})","em.ctx.pasteAttr":"Paste attributes","em.ctx.pasteAttrN":"Paste attributes ({n})","em.ctx.deleteAttr":"Delete attribute","em.ctx.deleteAttrN":"Delete attributes ({n})","em.ctx.addOperation":"Add operation","em.ctx.deleteOperation":"Delete operation","em.ctx.addMethod":"Add method","em.ctx.groupInto":"Group together","em.ctx.addSelfAssoc":"Add self-association","em.ctx.addEmbeddableNamed":"Add embeddable: {label}","em.ctx.ungroupEntity":"Remove from group","em.ctx.deleteEntity":"Delete entity","em.ctx.clearWaypoints":"Clear bends","em.ctx.deleteConnection":"Delete connection","em.ctx.deleteAssociation":"Delete relation","em.node.keyPfk":"PFK (identifying foreign key)","em.node.keyPk":"PK (primary key)","em.node.keyFk":"FK (foreign key)","em.node.required":"Required (NOT NULL)","em.node.logicalMissing":"(logical name)","em.node.editLock":"Editing locked","em.node.connectHint":"Drag to connect a relationship to another entity","em.node.embedRepeatedShow":"Show {count} column(s) collapsed as identical within this entity","em.node.embedRepeatedHide":"Collapse columns repeated with the same value","em.node.embedAttrHide":"Collapse this embedded column group","em.node.embedAttrShow":"Show {count} collapsed embedded column(s)","em.node.embedAllHide":"Collapse every embedded column in this entity","em.node.embedAllShow":"Expand all collapsed embedded columns","em.node.embedAllSummary":"{n} embedded column(s) hidden","em.node.opsSummaryTitle":"{n} operations — expanded in Class display mode","em.node.opsSummary":"{n} operations","em.node.addAttr":"+ Attribute","em.node.addDivider":"+ Divider","em.group.ddlExcludeBadge":"DDL excluded","em.explorer.groupFallback":"(group)","em.explorer.associations":"Relations ({n})","em.explorer.notes":"Notes ({n})","em.explorer.emptyNote":"(empty note)","em.explorer.diagram":"Diagram","em.explorer.searchPlaceholder":"Search entities · attributes ( / )","em.explorer.treeAria":"Diagram tree","em.explorer.searchAria":"Search entities and attributes","em.explorer.clearSearchAria":"Clear search","em.explorer.clearSearchTitle":"Clear (Esc)","em.explorer.noMatches":"No matching entities or attributes","em.history.title":"Change history","em.history.refresh":"Refresh","em.history.loading":"Loading history…","em.history.loadError":"Failed to load history.","em.history.emptyLoaded":"No change history to show.","em.history.emptyNotLoaded":"Load history.","em.history.filterAll":"All","em.history.kindEdit":"Edit","em.history.kindRestore":"Restored","em.history.verbAdd":"Added","em.history.verbUpdate":"Updated","em.history.verbRemove":"Removed","em.history.assocFallback":"Relation","em.history.groupSubject":"Group {name}","em.history.emptyValue":"(empty)","em.history.noChange":"No changes","em.history.summaryAdd":"{name} added","em.history.summaryRemove":"{name} removed","em.history.summaryFields":"{name} — {n} changes","em.history.summaryMore":"{summary} and {n} more","em.history.restoreFailed":"Restore failed: {reason}","em.history.unknown":"Unknown","em.history.confirmRestore":"Revert to this point.","em.history.doRestore":"Restore","em.history.cancel":"Cancel","em.history.restoreToHere":"Restore to this point","em.history.diff.compare":"Compare with current","em.history.diff.current":"current","em.history.diff.exit":"Exit comparison","em.history.diff.count":"{n} net change(s)","em.history.diff.empty":"No net changes in this range.","em.history.diff.restorePreview":"{n} change(s) will be rolled back","em.history.diff.restorePreviewNone":"Nothing to roll back.","em.history.loadMore":"Show older ({n})","em.history.periodLabel":"Period","em.history.periodFrom":"From","em.history.periodTo":"To","em.history.periodReset":"Clear period","em.check.catName":"Naming","em.check.catJpa":"JPA","em.check.catType":"Type","em.check.catDsn":"Design","em.check.name1":'Duplicate attribute name: "{name}"',"em.check.name2":'Duplicate column physical name: "{name}"',"em.check.name3Entity":'Duplicate entity name: "{name}" — another entity shares this name. JPA registers entity names across the whole persistence unit, so splitting packages (groups) will not resolve it',"em.check.name3Package":'Duplicate entity name: "{name}" — the same name exists in the same package. Rename it, or split the group (package)',"em.check.name4Entity":"Entity name is empty","em.check.name4Attr":"Attribute name is empty","em.check.name5":"Physical name exceeds {max} characters ({len}) — it may be truncated in some databases","em.check.name6Column":'Column physical name is a SQL reserved word: "{name}"',"em.check.name6Table":'Table physical name is a SQL reserved word: "{name}"',"em.check.name6Index":'Index name is a SQL reserved word: "{name}"',"em.check.name7":"the relation/embed attribute ({attrType}) has no name — the name is the JPA field name, so codegen omits this relationship entirely. Fill in the attribute name","em.check.name8":'attribute "{name}" has no column physical name — DDL and codegen omit this column entirely. Fill in the physical name',"em.check.name9":'two entities map to the same table "{name}" — their columns collide in one table. Give them distinct table physical names',"em.check.name10":'duplicate index name: "{name}" — index names must be unique across the whole DB schema',"em.check.jpa1":"JPA entity has no identifier (PK) attribute","em.check.jpa2":'An embeddable type cannot have an identifier attribute: "{name}"',"em.check.jpa4":"Identifying relationship cycle (PK depends on itself infinitely): {path}","em.check.jpa5":"{which}: cascade ALL is redundant with individual cascades (ALL includes them all)","em.check.jpa6":"{which}: orphanRemoval overlaps with cascade {cascade}","em.check.jpa7":"{which}: EAGER fetch on a collection (to-many) association is a performance risk","em.check.jpa8":"JPA entity has no table physical name set","em.check.jpa9":"{which}: collection metadata (collectionType/collectionTable/orderColumn) is meaningless on a to-one association — @ElementCollection applies only to collections","em.check.jpa10":"{which}: a SET collection does not preserve order, so orderColumn (@OrderColumn) is meaningless","em.check.jpa11":"An embed (@Embedded/@ElementCollection) cannot be an identifying relationship — embeddables have no independent identifier","em.check.jpa12":'An identifier (@Id) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa13AutoIncrement":'Auto increment can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa13Sequence":'A sequence ("{seq}") can only be used on an identifier (@Id) attribute — it is set on non-identifier attribute "{name}"',"em.check.jpa14":"{which}: orphanRemoval cannot be applied to a @ManyToOne/@ManyToMany association (the other end is a collection) — it is valid only on @OneToOne/@OneToMany","em.check.jpa15":'An identifier (@Id) attribute cannot be a natural id (@NaturalId) — a natural id is a business key distinct from the PK: "{name}"',"em.check.jpa16":'A natural id (@NaturalId) attribute cannot be transient (@Transient): "{name}"',"em.check.jpa17":'A natural id (@NaturalId) attribute should be not null (business keys are non-null by principle): "{name}"',"em.check.jpa18":"cascade is set on both ends of the relationship, so operations propagate both ways — risk of unintended cascading persist/remove or cascade cycles. cascade is usually placed on one side only","em.check.jpa19":"the parent has a collection/reference field but the child ({child}) has no matching relation attribute, so mappedBy cannot be resolved — codegen skips this relationship. Add an FK attribute on the child or make the relationship unidirectional","em.check.jpa20":'a composite PK (@IdClass/@EmbeddedId) cannot use generation (@GeneratedValue) — it is set on attribute "{name}"',"em.check.jpa21Missing":'embedded "{name}" has fewer columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns added later are not reflected and are dropped from the DDL (JPA maps columns per the embeddable declaration)',"em.check.jpa21Extra":'embedded "{name}" has more columns than the embeddable ({embeddable}) declares — {slots} slots / {declared} declared. Columns removed from the embeddable linger and emit DDL columns that no longer exist',"em.check.type1":'Column type not supported by the target DB: "{dataType}"',"em.check.type2":"No length specified for type {dataType}","em.check.type3":"The shared target column type ({targetType}) differs from the {metaName} definition ({metaType})","em.check.type4":"A Multi-Value attribute gets an auto-generated converter only for the GroupCodeEnum + VARCHAR combination — currently ({type} / {dataType}) only a Set<…> field is generated and the mapping may be incomplete","em.check.type6":'the column of attribute "{name}" has no data type — DDL omits this column',"em.check.dsn1":"A both-many (M:N) relationship is connected directly without a join entity — consider introducing an association entity","em.check.dsn2":"Entity has no attributes","em.check.dsn3":"No modeled relationship (not part of any association, inheritance, or embedding — ignore if intentional)","em.check.dsn4":"Has {count} attributes (over the threshold of {threshold}) — consider decomposing","em.check.dsn5Inherited":'Index "{name}" references an inherited column not found in the superclass catalog ({field}).',"em.check.dsn5Missing":'Index "{name}" references a column that does not exist.',"em.check.dsn6":'index "{name}" has no columns — an index without columns is not emitted in DDL or codegen',"em.check.dsn7":'index "{name}" lists the same column more than once — the repeated entries have no effect',"em.check.unspecified":"unspecified"},lf={"em.mode.view":"閲覧","em.mode.edit":"編集","em.mode.frozen":"編集ロック(競合)","em.mode.frozenTitle":"同時編集の競合により編集がロックされています。最新の内容を再読み込み中です。","em.mode.readonlyTitle":"このダイアグラムは閲覧専用です","em.toolbar.undo":"元に戻す","em.toolbar.redo":"やり直し","em.toolbar.displayLabel":"表示","em.toolbar.routingToggle":"接続線モード切替","em.toolbar.routingOrthogonal":"直角","em.toolbar.routingStraight":"直線","em.toolbar.grid":"グリッド","em.toolbar.gridOn":"グリッド表示","em.toolbar.gridOff":"グリッド非表示","em.toolbar.minimap":"ミニマップ","em.toolbar.minimapOn":"ミニマップ表示","em.toolbar.minimapOff":"ミニマップ非表示","em.toolbar.exportText":"エクスポート(テキスト · Mermaid)","em.toolbar.exportSvg":"SVG エクスポート","em.toolbar.exportPng":"PNG エクスポート","em.toolbar.import":"インポート(テキスト貼り付け)","em.toolbar.history":"履歴","em.toolbar.historyOpen":"変更履歴を開く","em.toolbar.historyClose":"変更履歴を閉じる","em.toolbar.shortcuts":"キーボードショートカット (?)","em.displayMode.logical":"論理","em.displayMode.physical":"物理","em.displayMode.logicalPhysical":"論理・物理","em.displayMode.class":"クラス","em.panel.resizeWidth":"幅を調整","em.panel.collapse":"折りたたむ","em.panel.expand":"展開","em.panel.collapseAll":"すべて折りたたむ","em.panel.expandAll":"すべて展開","em.panel.lockedBanner":"編集ロック — 移動・編集・削除は不可","em.panel.openNamed":"{name} を開く","em.notice.readOnly":"照会モードでは編集できません","em.notice.entityLocked":"このエンティティはロックされています — 解除してから編集してください","em.notice.groupLocked":"このグループはロックされています — 解除してから編集してください","em.notice.assocLocked":"ロックされたエンティティに接続された関連です — 解除してから編集してください","em.validation.title":"検証","em.validation.noIssues":"検証の問題はありません。","em.validation.noVisibleIssues":"表示する問題はありません(フィルター適用中)。","em.validation.checkOrphanEntities":"関連のないエンティティを検査","em.validation.nameless":"(名前なし)","em.validation.severityError":"エラー","em.validation.severityWarning":"警告","em.validation.severityInfo":"情報","em.validation.hideSeverity":"{label} を非表示","em.validation.showSeverity":"{label} を表示","em.validation.expandPanel":"検証パネルを展開","em.validation.quickFix":"修正","em.validation.quickFixTip":"自動修正を適用(元に戻せます)","em.common.close":"閉じる","em.common.save":"保存","em.export.title":"エクスポート","em.export.formatText":"論理モデルテキスト","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (クラス)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (バックアップ)","em.export.copy":"コピー","em.export.download":"ダウンロード","em.export.copied":"クリップボードにコピーしました。","em.export.copyFailed":"コピーに失敗しました。","em.import.title":"インポート","em.import.placeholder":"SQL DDL・Mermaid ER・JSON バックアップを貼り付けてください。","em.import.formatGroup":"入力形式","em.import.formatAuto":"自動判定","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"判定: {format}","em.import.summary":"エンティティ {entities} · 関連 {relations}","em.import.warnings":"警告 {n}件(部分パース)","em.import.error":"パース失敗: {message}","em.import.emptyParse":"認識されたエンティティがありません。","em.import.unknownFormat":"フォーマットを判定できませんでした — 上で選択してください。","em.import.confirm":"インポート","em.shortcuts.title":"キーボードショートカット","em.shortcuts.groupEdit":"編集","em.shortcuts.groupMove":"移動・整列","em.shortcuts.groupExplorer":"エクスプローラー","em.shortcuts.descExplorerSearch":"エクスプローラー検索へフォーカス","em.shortcuts.descExplorerNav":"ツリー移動(←→ 折りたたみ・展開)","em.shortcuts.descExplorerSelect":"項目を選択+キャンバス移動","em.shortcuts.descExplorerDetail":"エンティティ詳細編集を開く","em.shortcuts.groupOther":"その他","em.shortcuts.keyArrows":"矢印キー","em.shortcuts.keyRightClick":"右クリック","em.shortcuts.descUndo":"元に戻す","em.shortcuts.descRedo":"やり直し","em.shortcuts.descCopy":"選択をコピー","em.shortcuts.descPaste":"貼り付け","em.shortcuts.descDelete":"選択項目を削除(Backspace と同じ)","em.shortcuts.descMove1":"選択ノードを1px移動","em.shortcuts.descMove10":"選択ノードを10px移動","em.shortcuts.descAttrFocus":"属性選択時にフォーカス移動","em.shortcuts.descAttrReorder":"属性の順序を上下","em.shortcuts.descContextMenu":"コンテキストメニュー(エンティティ・ノート追加など)","em.shortcuts.descInlineConfirm":"インライン編集を確定","em.shortcuts.descCloseEdit":"編集・メニューを閉じる","em.shortcuts.descOpenHelp":"このヘルプを開く","em.shortcuts.descCommandPalette":"コマンドパレット(移動・コマンド実行)","em.opSource.title":"本文 — {name}()","em.opSource.placeholder":"// Java 実装コード","em.entity.name":"名前","em.entity.stereotype":"ステレオタイプ","em.entity.package":"パッケージ","em.panel.unlock":"ロック解除","em.entity.fallback":"エンティティ","em.group.fallback":"グループ","em.common.description":"説明","em.common.memo":"メモ","em.common.color":"色","em.common.add":"追加","em.common.inherit":"デフォルト(継承)","em.common.noneParen":"(なし)","em.swatch.none":"なし","em.swatch.red":"赤","em.swatch.amber":"オレンジ","em.swatch.green":"緑","em.swatch.teal":"青緑","em.swatch.blue":"青","em.swatch.indigo":"藍","em.swatch.violet":"紫","em.swatch.pink":"ピンク","em.inspector.ctxEntityAttrs":"エンティティ · {name} › 属性 · {n}件","em.inspector.ctxEntityDivider":"エンティティ · {name} › 区切り線","em.inspector.ctxEntityAttr":"エンティティ · {name} › 属性 · {attr}","em.inspector.ctxEntity":"エンティティ · {name}","em.inspector.ctxAssoc":"関連 · {a} — {b}","em.inspector.ctxGroup":"グループ · {name}","em.inspector.ctxNote":"ノート","em.inspector.ctxNone":"選択項目なし","em.assoc.identifying":"identifying(識別関連)","em.assoc.selfNoIdentifying":"自己関連は識別関連にできません(非識別 FK を強制)。","em.assoc.embedNoIdentifying":"埋め込み(@Embedded/@ElementCollection)は識別関連にできません(埋め込み可能クラスは独立した識別子を持ちません)。","em.assoc.multiplicity":"多重度","em.assoc.navFieldName":"関連フィールド名(nav)","em.assoc.cascadeAllNote":"ALL は個別の cascade をすべて含みます(CHK-JPA-5)。","em.assoc.orphanRemovalNote":"相手側がコレクション(@ManyToOne/@ManyToMany)のため orphanRemoval は無効です(CHK-JPA-14)。","em.assoc.navRequiredNote":"この方向に nav プロパティがない(navigable オフ)ため cascade・fetch は適用されません。","em.assoc.ownerNavFixed":"JPA 所有側参照(@ManyToOne)はリレーションの存在と同義で常にオンです — 参照なしの FK はリレーションではなく通常のカラムとしてモデリングしてください。","em.assoc.orderByPlaceholder":"例: name ASC","em.assoc.jpaDetails":"JPA 詳細","em.embed.legend":"埋め込み","em.embed.cardinality":"カーディナリティ","em.embed.card1":"1(必須 @Embedded)","em.embed.card01":"0..1(任意 @Embedded)","em.embed.card0N":"0..*(コレクション @ElementCollection)","em.embed.collectionTablePlaceholder":"未指定時はコード生成のフォールバック","em.embed.orderColumnPlaceholder":"未指定時は順序を保持しません","em.embed.ownerFixedNote":"埋め込み可能クラスは所有者にフラット化されるため、所有者側の end(多重度・navigable・composition)は構造的に固定であり表示しません。","em.group.nameLegend":"グループ名","em.group.excludeDDL":"DDL 生成から除外","em.group.members":"メンバーエンティティ {n}件","em.entity.classLegend":"クラス","em.entity.superClass":"親クラス","em.entity.superClassPlaceholder":"例: BaseEntity","em.entity.interfaces":"実装インターフェース","em.entity.interfacesPlaceholder":"カンマ区切り(例: Serializable, Cloneable)","em.entity.abstractClass":"抽象クラス","em.entity.tablePhysical":"テーブル(物理)","em.entity.schema":"スキーマ","em.entity.schemaPlaceholder":"例: sales, master","em.entity.tableLogicalLegend":"テーブル論理名","em.entity.discColumn":"Discriminator カラム名","em.entity.discColumnPlaceholder":"例: DTYPE","em.entity.discType":"Discriminator タイプ","em.entity.discLength":"Discriminator 長さ","em.entity.hasPersonalInfo":"個人情報を含む(hasPersonalInfo)","em.entity.headerColor":"ヘッダー色","em.attr.section":"属性 ({n})","em.attr.addEmbeddable":"埋め込み追加","em.attr.nameless":"(名前なし)","em.attr.selectHint":"上のリストから属性を選択すると編集フォームが表示されます。","em.attr.inverseNavHint":"逆方向の関連フィールド — 物理カラムはありません(対象エンティティを参照)。","em.attr.fkDerivedNote":"外部キー(FK)から派生したカラムです — 形状は親のPKに従います。変更は関連線・識別関連で行ってください。","em.attr.scaleTypeHint":"小数部(scale)はNUMERIC・DECIMAL型にのみ適用されます。","em.attr.embedFixedHint":"埋め込み型の定義で固定された値です。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.namePlaceholder":"名前","em.attr.typePlaceholder":"タイプ","em.attr.customTypePlaceholder":"カスタムタイプ名","em.attr.logicalPlaceholder":"論理名","em.attr.columnPlaceholder":"カラム","em.attr.defaultValue":"デフォルト値","em.attr.codeGroup":"コードグループ","em.attr.currencyColumn":"通貨カラム","em.attr.pii":"個人情報","em.attr.colFallback":"カラム {n}","em.attr.sharedOwn":"専用カラム(OWN)","em.attr.sharedRef":"↗ {owner}{physical}({mode})","em.attr.currencyMode":"通貨","em.attr.sharedMode":"共有","em.attr.batchHint":"選択 {n}件 一括","em.attr.fkDeleteHint":"外部キーは関連から派生します — 関連線を削除してください","em.op.section":"オペレーション ({n})","em.op.namePlaceholder":"オペレーション名","em.op.editBodyDirty":"本文編集 ●","em.op.editBody":"本文編集","em.index.section":"インデックス ({n})","em.index.inherited":"{field}(継承)","em.index.namePlaceholder":"インデックス名","em.index.addColumn":"カラム","em.index.condition":"条件(partial index)","em.index.conditionPlaceholder":"例: WHERE status = 'A'","em.groupCode.searchPlaceholder":"コードグループ検索/選択","em.groupCode.noMatch":"一致するコードグループがありません","em.detail.tabBasics":"基本","em.detail.tabColumns":"属性","em.detail.tabIndexes":"インデックス","em.detail.tabOperations":"オペレーション","em.detail.title":"エンティティ — {name}","em.attr.addDivider":"区切り線","em.attr.columnPhysical":"カラム(物理)","em.attr.constraints":"制約","em.attr.dividerLabelPlaceholder":"区切り線ラベル(任意)","em.attr.dividerNote":"── 視覚区切り ──","em.attr.detailCollapse":"詳細を折りたたむ","em.attr.detailExpand":"詳細を展開","em.attr.semanticLegend":"意味","em.attr.embedChildCols":"埋め込み可能 — 子カラム {n}件","em.attr.overrideCollapse":"オーバーライドを折りたたむ","em.attr.overrideExpand":"オーバーライドを展開","em.attr.overrideLegend":"カラムオーバーライド","em.attr.empty":"属性なし — 「追加」で作成","em.op.body":"本文","em.op.bodyDirty":"本文 ●","em.op.empty":"オペレーションなし — 「追加」で作成","em.index.delete":"インデックス削除","em.index.empty":"インデックスなし — 「追加」で作成","em.index.conditionPlaceholderWide":"例: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"スーパークラス継承カラム","em.index.inheritedBadge":"継承","em.index.colUnspecified":"{name} (カラム{n}個のうち未指定)","em.index.multiColumn":"{name} (カラム{n}個)","em.index.unnamedAttr":"(名称なし)","em.index.availColumns":"利用可能カラム ({n})","em.index.indexColumns":"インデックスカラム ({n})","em.index.allColumnsUsed":"全カラム使用済み","em.index.addArrow":"追加 →","em.index.moveUp":"上へ","em.index.moveDown":"下へ","em.index.removeColumn":"削除","em.index.noColumns":"カラムなし — 左から追加","em.index.selectPrompt":"インデックスを選択または追加してください。","em.palette.autoLayout":"自動配置","em.cmd.title":"コマンドパレット","em.cmd.placeholder":"エンティティへ移動、またはコマンド実行…","em.cmd.sectionGoto":"移動","em.cmd.sectionActions":"コマンド","em.cmd.empty":"一致する項目がありません","em.cmd.groupTag":"グループ","em.canvas.emptyTitle":"空のダイアグラムです","em.canvas.emptyHint":"キャンバスを<strong>右クリック</strong>するか、左下の<strong>+</strong>ボタンで最初のエンティティを追加してください。","em.canvas.emptyConnectHint":"エンティティを2つ以上作成すると、エンティティの端から<strong>ドラッグ</strong>して関連を接続できます。","em.canvas.emptyShortcutHint":"ショートカットのヘルプは<kbd>?</kbd>キー","em.canvas.emptyReadonly":"表示するエンティティがありません","em.canvas.exportFailed":"エクスポートに失敗しました","em.conflict.lockedTitle":"編集がロックされました","em.conflict.missingDetail":"変更を保存できませんでした(サーバーまたはネットワークエラー)。最新の内容を再読み込みしてください。","em.conflict.changedDetail":"他の場所で変更されたため、編集がロックされました。最新の内容を再読み込みしてください。","em.conflict.commandFailedDetail":"編集を処理できず、表示内容が食い違っています。保存済みの内容はそのままです。最新の内容を再読み込みしてください。","em.ctx.addEntity":"エンティティ追加","em.ctx.addNote":"ノート追加","em.ctx.addGroup":"グループ追加","em.ctx.paste":"貼り付け","em.ctx.copy":"コピー","em.ctx.copyN":"コピー ({n})","em.ctx.editDetail":"詳細編集…","em.ctx.viewDetail":"詳細表示…","em.ctx.lock":"ロック","em.ctx.ungroup":"グループ解除","em.ctx.deleteNote":"ノート削除","em.ctx.addAttr":"属性追加","em.ctx.colorN":"色 ({n})","em.ctx.pasteAttr":"属性貼り付け","em.ctx.pasteAttrN":"属性貼り付け ({n})","em.ctx.deleteAttr":"属性削除","em.ctx.deleteAttrN":"属性削除 ({n})","em.ctx.addOperation":"オペレーション追加","em.ctx.deleteOperation":"オペレーション削除","em.ctx.addMethod":"メソッド追加","em.ctx.groupInto":"グループ化","em.ctx.addSelfAssoc":"自己関連追加","em.ctx.addEmbeddableNamed":"埋め込み追加: {label}","em.ctx.ungroupEntity":"グループから外す","em.ctx.deleteEntity":"エンティティ削除","em.ctx.clearWaypoints":"折れ線を解除","em.ctx.deleteConnection":"接続削除","em.ctx.deleteAssociation":"関連削除","em.node.keyPfk":"PFK(識別外部キー)","em.node.keyPk":"PK(主キー)","em.node.keyFk":"FK(外部キー)","em.node.required":"必須(NOT NULL)","em.node.logicalMissing":"(論理名)","em.node.editLock":"編集ロック","em.node.connectHint":"ドラッグして他のエンティティと関連を接続","em.node.embedRepeatedShow":"このエンティティ内で値が同じため折りたたまれた列 {count} 件を表示","em.node.embedRepeatedHide":"値が同じで繰り返される列を折りたたむ","em.node.embedAttrHide":"この埋め込み列グループを折りたたむ","em.node.embedAttrShow":"折りたたまれた埋め込み列 {count} 件を表示","em.node.embedAllHide":"このエンティティの埋め込み列をすべて折りたたむ","em.node.embedAllShow":"折りたたまれた埋め込み列をすべて展開","em.node.embedAllSummary":"埋め込み列 {n} 件を非表示","em.node.opsSummaryTitle":"オペレーション {n}件 — クラス表示モードで展開されます","em.node.opsSummary":"オペレーション {n}件","em.node.addAttr":"+ 属性","em.node.addDivider":"+ 区切り線","em.group.ddlExcludeBadge":"DDL 除外","em.explorer.groupFallback":"(グループ)","em.explorer.associations":"関連 ({n})","em.explorer.notes":"ノート ({n})","em.explorer.emptyNote":"(空のノート)","em.explorer.diagram":"ダイアグラム","em.explorer.searchPlaceholder":"エンティティ・属性検索 ( / )","em.explorer.treeAria":"ダイアグラムツリー","em.explorer.searchAria":"エンティティ・属性検索","em.explorer.clearSearchAria":"検索語をクリア","em.explorer.clearSearchTitle":"クリア (Esc)","em.explorer.noMatches":"一致するエンティティ・属性がありません","em.history.title":"変更履歴","em.history.refresh":"更新","em.history.loading":"履歴を読み込み中…","em.history.loadError":"履歴を読み込めませんでした。","em.history.emptyLoaded":"表示する変更履歴がありません。","em.history.emptyNotLoaded":"履歴を読み込んでください。","em.history.filterAll":"すべて","em.history.kindEdit":"編集","em.history.kindRestore":"復元","em.history.verbAdd":"追加","em.history.verbUpdate":"変更","em.history.verbRemove":"削除","em.history.assocFallback":"関連","em.history.groupSubject":"グループ {name}","em.history.emptyValue":"(空)","em.history.noChange":"変更なし","em.history.summaryAdd":"{name} 追加","em.history.summaryRemove":"{name} 削除","em.history.summaryFields":"{name} {n}件変更","em.history.summaryMore":"{summary} 他 {n}件","em.history.restoreFailed":"復元失敗: {reason}","em.history.unknown":"不明","em.history.confirmRestore":"この時点に戻します。","em.history.doRestore":"復元","em.history.cancel":"キャンセル","em.history.restoreToHere":"この時点に復元","em.history.diff.compare":"現在と比較","em.history.diff.current":"現在","em.history.diff.exit":"比較を解除","em.history.diff.count":"累積変更 {n}件","em.history.diff.empty":"この区間に累積変更はありません。","em.history.diff.restorePreview":"巻き戻される変更 {n}件","em.history.diff.restorePreviewNone":"巻き戻される変更はありません。","em.history.loadMore":"以前の記録をもっと見る ({n})","em.history.periodLabel":"期間","em.history.periodFrom":"開始日","em.history.periodTo":"終了日","em.history.periodReset":"期間クリア","em.check.catName":"名前","em.check.catJpa":"JPA","em.check.catType":"型","em.check.catDsn":"設計","em.check.name1":'属性名が重複しています: "{name}"',"em.check.name2":'カラム物理名が重複しています: "{name}"',"em.check.name3Entity":'エンティティ名が重複しています: "{name}" — 同名のエンティティが他にもあります。JPA はエンティティ名を永続化ユニット全体に登録するため、パッケージ(グループ)を分けても解消しません',"em.check.name3Package":'エンティティ名が重複しています: "{name}" — 同じパッケージに同じ名前があります。名前を変えるか、グループ(パッケージ)を分けると解消します',"em.check.name4Entity":"エンティティ名が空です","em.check.name4Attr":"属性名が空です","em.check.name5":"物理名が{max}文字を超えています({len}文字)— 一部のDBで切り詰められる可能性があります","em.check.name6Column":'カラム物理名がSQL予約語です: "{name}"',"em.check.name6Table":'テーブル物理名がSQL予約語です: "{name}"',"em.check.name6Index":'インデックス名がSQL予約語です: "{name}"',"em.check.name7":"関係/埋め込み属性({attrType})の名前が空です — 名前がそのまま JPA フィールド名になるため、コード生成でこの関係が丸ごと欠落します。属性名を入力してください","em.check.name8":"属性「{name}」のカラム物理名が空です — DDL・コード生成でこのカラムが丸ごと欠落します。物理名を入力してください","em.check.name9":"2つのエンティティが同じテーブル「{name}」にマッピングされています — カラムが1つのテーブルに混在します。テーブル物理名を分けてください","em.check.name10":"インデックス名が重複しています:「{name}」 — インデックス名は DB スキーマ全体で一意である必要があります","em.check.jpa1":"JPAエンティティに識別子(PK)属性がありません","em.check.jpa2":'組込み可能(embeddable)型は識別子属性を持てません: "{name}"',"em.check.jpa4":"識別関係の循環です(PKが自身に無限依存): {path}","em.check.jpa5":"{which}: cascade ALLが個別のcascadeと重複しています(ALLがすべて含む)","em.check.jpa6":"{which}: orphanRemovalがcascade {cascade}と意味が重なります","em.check.jpa7":"{which}: コレクション(to-many)関連へのEAGERフェッチは性能リスクがあります","em.check.jpa8":"JPAエンティティにテーブル物理名が設定されていません","em.check.jpa9":"{which}: 単一(to-one)関連にコレクションメタ(collectionType/collectionTable/orderColumn)は無意味です — @ElementCollectionはコレクションにのみ適用されます","em.check.jpa10":"{which}: SETコレクションは順序を保持しないため、orderColumn(@OrderColumn)は無意味です","em.check.jpa11":"組込み(@Embedded/@ElementCollection)は識別関係にできません — 組込み可能型には独立した識別子がありません","em.check.jpa12":'識別子(@Id)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa13AutoIncrement":'採番(auto increment)は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa13Sequence":'採番(シーケンス "{seq}")は識別子(@Id)属性にのみ使えます — 非識別属性 "{name}" に設定されています',"em.check.jpa14":"{which}: orphanRemovalは@ManyToOne/@ManyToMany(相手側がコレクション)関連には適用できません — @OneToOne/@OneToManyでのみ有効です","em.check.jpa15":'識別子(@Id)属性は自然キー(@NaturalId)にできません — 自然キーはPKとは別のビジネスキーです: "{name}"',"em.check.jpa16":'自然キー(@NaturalId)属性はtransient(@Transient)にできません: "{name}"',"em.check.jpa17":'自然キー(@NaturalId)属性はnot nullが推奨されます(ビジネスキーはnon-nullが原則): "{name}"',"em.check.jpa18":"cascade が関係の両端(親・子)に設定され双方向に伝播します — 意図しない連鎖 persist/remove や伝播サイクルの危険があります。通常 cascade は片側のみに設定します","em.check.jpa19":"親にコレクション/参照フィールドがありますが、子({child})に対応する関係属性がないため mappedBy を解決できません — コード生成はこの関係を出力しません。子に FK 属性を作るか、関係を単方向に整理してください","em.check.jpa20":"複合PK(@IdClass/@EmbeddedId)には採番(@GeneratedValue)を使用できません — 属性「{name}」に設定されています","em.check.jpa21Missing":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より少ないです — スロット {slots} / 宣言 {declared}。後から追加された列が反映されず DDL から漏れます(JPA は埋め込み可能クラスの宣言どおりに列を生成します)","em.check.jpa21Extra":"埋め込み「{name}」の列が埋め込み可能クラス({embeddable})の宣言より多いです — スロット {slots} / 宣言 {declared}。埋め込み可能クラスで削除された列が残り、存在しない列を DDL に出力します","em.check.type1":'ターゲットDBがサポートしないカラム型です: "{dataType}"',"em.check.type2":"{dataType}型にlengthが指定されていません","em.check.type3":"共有先カラムの型({targetType})が{metaName}の定義({metaType})と異なります","em.check.type4":"マルチ値(Multi-Value)属性はGroupCodeEnum + VARCHARの組み合わせでのみコンバータが自動生成されます — 現在({type} / {dataType})ではSet<…>フィールドのみ生成され、マッピングが不完全になる可能性があります","em.check.type6":"属性「{name}」のカラムにデータ型が指定されていません — DDL でこのカラムは出力されません","em.check.dsn1":"both-many(M:N)関係を結合エンティティなしで直接接続しています — 関連エンティティの導入を検討してください","em.check.dsn2":"属性が一つもないエンティティです","em.check.dsn3":"モデル化された関係がありません(関連・継承・組込みに未参加 — 意図的な省略なら無視)","em.check.dsn4":"属性が{count}個と多いです(しきい値{threshold}超過)— 分解を検討してください","em.check.dsn5Inherited":'インデックス "{name}" が参照する継承カラムがスーパークラスカタログに見つかりません({field})。',"em.check.dsn5Missing":'インデックス "{name}" が存在しないカラムを参照しています。',"em.check.dsn6":"インデックス「{name}」にカラムがありません — カラムのないインデックスは DDL・コード生成で出力されません","em.check.dsn7":"インデックス「{name}」に同じカラムが2回以上含まれています — 後続の重複項目は意味がありません","em.check.unspecified":"未指定"},sf={"em.mode.view":"조회","em.mode.edit":"편집","em.mode.frozen":"편집 잠김 (충돌)","em.mode.frozenTitle":"동시편집 충돌로 편집이 잠겼습니다. 최신 내용을 다시 불러오는 중입니다.","em.mode.readonlyTitle":"이 다이어그램은 조회 전용입니다","em.toolbar.undo":"실행 취소","em.toolbar.redo":"다시 실행","em.toolbar.displayLabel":"표시","em.toolbar.routingToggle":"연결선 모드 전환","em.toolbar.routingOrthogonal":"직각","em.toolbar.routingStraight":"직선","em.toolbar.grid":"그리드","em.toolbar.gridOn":"그리드 켜기","em.toolbar.gridOff":"그리드 끄기","em.toolbar.minimap":"미니맵","em.toolbar.minimapOn":"미니맵 켜기","em.toolbar.minimapOff":"미니맵 끄기","em.toolbar.exportText":"내보내기 (텍스트 · Mermaid)","em.toolbar.exportSvg":"SVG 내보내기","em.toolbar.exportPng":"PNG 내보내기","em.toolbar.import":"가져오기 (텍스트 붙여넣기)","em.toolbar.history":"이력","em.toolbar.historyOpen":"변경 이력 열기","em.toolbar.historyClose":"변경 이력 닫기","em.toolbar.shortcuts":"키보드 단축키 (?)","em.displayMode.logical":"논리","em.displayMode.physical":"물리","em.displayMode.logicalPhysical":"논리·물리","em.displayMode.class":"클래스","em.panel.resizeWidth":"너비 조절","em.panel.collapse":"접기","em.panel.expand":"펼치기","em.panel.collapseAll":"모두 접기","em.panel.expandAll":"모두 펼치기","em.panel.lockedBanner":"편집 잠김 — 이동·수정·삭제 차단","em.panel.openNamed":"{name} 열기","em.notice.readOnly":"조회 모드에서는 편집할 수 없습니다","em.notice.entityLocked":"잠긴 엔티티입니다 — 잠금 해제 후 편집하세요","em.notice.groupLocked":"잠긴 그룹입니다 — 잠금 해제 후 편집하세요","em.notice.assocLocked":"잠긴 엔티티에 연결된 관계입니다 — 잠금 해제 후 편집하세요","em.validation.title":"검증","em.validation.noIssues":"검증 이슈가 없습니다.","em.validation.noVisibleIssues":"표시할 이슈가 없습니다 (필터 적용 중).","em.validation.checkOrphanEntities":"관계 없는 엔티티 검사","em.validation.nameless":"(이름 없음)","em.validation.severityError":"오류","em.validation.severityWarning":"경고","em.validation.severityInfo":"정보","em.validation.hideSeverity":"{label} 숨기기","em.validation.showSeverity":"{label} 표시","em.validation.expandPanel":"검증 패널 펼치기","em.validation.quickFix":"수정","em.validation.quickFixTip":"자동 수정 적용 (되돌리기 가능)","em.common.close":"닫기","em.common.save":"저장","em.export.title":"내보내기","em.export.formatText":"논리 모델 텍스트","em.export.formatMermaidEr":"Mermaid (ER)","em.export.formatMermaidClass":"Mermaid (클래스)","em.export.formatDdl":"SQL DDL (PostgreSQL)","em.export.formatJson":"JSON (백업)","em.export.copy":"복사","em.export.download":"다운로드","em.export.copied":"클립보드에 복사되었습니다.","em.export.copyFailed":"복사에 실패했습니다.","em.import.title":"가져오기","em.import.placeholder":"SQL DDL · Mermaid ER · JSON 백업을 붙여넣으세요.","em.import.formatGroup":"입력 형식","em.import.formatAuto":"자동 감지","em.import.formatMermaid":"Mermaid ER","em.import.formatDdl":"SQL DDL","em.import.formatJson":"JSON","em.import.detected":"감지: {format}","em.import.summary":"엔티티 {entities} · 관계 {relations}","em.import.warnings":"경고 {n}건 (부분 파싱)","em.import.error":"파싱 실패: {message}","em.import.emptyParse":"인식된 엔티티가 없습니다.","em.import.unknownFormat":"포맷을 감지하지 못했습니다 — 위에서 직접 선택하세요.","em.import.confirm":"가져오기","em.shortcuts.title":"키보드 단축키","em.shortcuts.groupEdit":"편집","em.shortcuts.groupMove":"이동 · 정렬","em.shortcuts.groupExplorer":"탐색기","em.shortcuts.descExplorerSearch":"탐색기 검색으로 포커스","em.shortcuts.descExplorerNav":"트리 이동 (←→ 접기·펼치기)","em.shortcuts.descExplorerSelect":"항목 선택 + 캔버스 이동","em.shortcuts.descExplorerDetail":"엔티티 상세 편집 열기","em.shortcuts.groupOther":"기타","em.shortcuts.keyArrows":"방향키","em.shortcuts.keyRightClick":"우클릭","em.shortcuts.descUndo":"실행 취소","em.shortcuts.descRedo":"다시 실행","em.shortcuts.descCopy":"선택 복사","em.shortcuts.descPaste":"붙여넣기","em.shortcuts.descDelete":"선택 항목 삭제 (Backspace 동일)","em.shortcuts.descMove1":"선택 노드 1px 이동","em.shortcuts.descMove10":"선택 노드 10px 이동","em.shortcuts.descAttrFocus":"속성 선택 시 포커스 이동","em.shortcuts.descAttrReorder":"속성 순서 위/아래로","em.shortcuts.descContextMenu":"컨텍스트 메뉴 (엔티티·노트 추가 등)","em.shortcuts.descInlineConfirm":"인라인 편집 확정","em.shortcuts.descCloseEdit":"편집·메뉴 닫기","em.shortcuts.descOpenHelp":"이 도움말 열기","em.shortcuts.descCommandPalette":"명령 팔레트 (이동·명령 실행)","em.opSource.title":"본문 — {name}()","em.opSource.placeholder":"// Java 구현 코드","em.entity.name":"이름","em.entity.stereotype":"스테레오타입","em.entity.package":"패키지","em.panel.unlock":"잠금 해제","em.entity.fallback":"엔티티","em.group.fallback":"그룹","em.common.description":"설명","em.common.memo":"메모","em.common.color":"색상","em.common.add":"추가","em.common.inherit":"기본(따름)","em.common.noneParen":"(없음)","em.swatch.none":"없음","em.swatch.red":"빨강","em.swatch.amber":"주황","em.swatch.green":"초록","em.swatch.teal":"청록","em.swatch.blue":"파랑","em.swatch.indigo":"남색","em.swatch.violet":"보라","em.swatch.pink":"분홍","em.inspector.ctxEntityAttrs":"엔티티 · {name} › 속성 · {n}개","em.inspector.ctxEntityDivider":"엔티티 · {name} › 구분선","em.inspector.ctxEntityAttr":"엔티티 · {name} › 속성 · {attr}","em.inspector.ctxEntity":"엔티티 · {name}","em.inspector.ctxAssoc":"관계 · {a} — {b}","em.inspector.ctxGroup":"그룹 · {name}","em.inspector.ctxNote":"노트","em.inspector.ctxNone":"선택된 항목 없음","em.assoc.identifying":"identifying (식별 관계)","em.assoc.selfNoIdentifying":"셀프 연관은 식별 관계로 둘 수 없습니다 (비식별 FK 강제).","em.assoc.embedNoIdentifying":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 (임베더블은 독립 식별자가 없음).","em.assoc.multiplicity":"다중성","em.assoc.navFieldName":"연관 필드명(nav)","em.assoc.cascadeAllNote":"ALL이 개별 cascade를 모두 포함합니다 (CHK-JPA-5).","em.assoc.orphanRemovalNote":"반대편이 컬렉션(@ManyToOne/@ManyToMany)이라 orphanRemoval이 무효입니다 (CHK-JPA-14).","em.assoc.navRequiredNote":"이 방향에 nav 속성이 없어(navigable 꺼짐) cascade·fetch가 적용되지 않습니다.","em.assoc.ownerNavFixed":"JPA 소유측 참조(@ManyToOne)는 관계 존재와 동치라 항상 켜집니다 — 참조 없는 FK는 관계 대신 일반 컬럼으로 모델링하세요.","em.assoc.orderByPlaceholder":"예: name ASC","em.assoc.jpaDetails":"JPA 상세","em.embed.legend":"임베드","em.embed.cardinality":"카디널리티","em.embed.card1":"1 (필수 @Embedded)","em.embed.card01":"0..1 (선택 @Embedded)","em.embed.card0N":"0..* (컬렉션 @ElementCollection)","em.embed.collectionTablePlaceholder":"미지정 시 코드젠 폴백","em.embed.orderColumnPlaceholder":"미지정 시 순서 비보존","em.embed.ownerFixedNote":"임베더블은 소유자에 평탄화되므로 소유자 쪽 end(다중성·navigable·composition)는 구조적으로 고정이라 표시하지 않습니다.","em.group.nameLegend":"그룹명","em.group.excludeDDL":"DDL 생성 제외","em.group.members":"멤버 엔티티 {n}개","em.entity.classLegend":"클래스","em.entity.superClass":"부모 클래스","em.entity.superClassPlaceholder":"예: BaseEntity","em.entity.interfaces":"구현 인터페이스","em.entity.interfacesPlaceholder":"콤마로 구분 (예: Serializable, Cloneable)","em.entity.abstractClass":"추상 클래스","em.entity.tablePhysical":"테이블(물리)","em.entity.schema":"스키마","em.entity.schemaPlaceholder":"예: sales, master","em.entity.tableLogicalLegend":"테이블 논리명","em.entity.discColumn":"Discriminator 컬럼명","em.entity.discColumnPlaceholder":"예: DTYPE","em.entity.discType":"Discriminator 타입","em.entity.discLength":"Discriminator 길이","em.entity.hasPersonalInfo":"개인정보 포함 (hasPersonalInfo)","em.entity.headerColor":"헤더 색상","em.attr.section":"속성 ({n})","em.attr.addEmbeddable":"임베더블 추가","em.attr.nameless":"(이름 없음)","em.attr.selectHint":"위 목록에서 속성을 선택하면 편집 폼이 표시됩니다.","em.attr.inverseNavHint":"역방향 연관관계 필드 — 물리 컬럼이 없습니다(대상 엔티티 참조).","em.attr.fkDerivedNote":"외래키(FK)에서 파생된 컬럼입니다 — 형상은 부모 PK를 따르며, 변경은 관계선·식별관계에서 하세요.","em.attr.scaleTypeHint":"소수부(scale)는 NUMERIC·DECIMAL 타입에만 적용됩니다.","em.attr.embedFixedHint":"임베더블 정의에서 고정된 값입니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.namePlaceholder":"이름","em.attr.typePlaceholder":"타입","em.attr.customTypePlaceholder":"커스텀 타입명","em.attr.logicalPlaceholder":"논리명","em.attr.columnPlaceholder":"컬럼","em.attr.defaultValue":"기본값","em.attr.codeGroup":"코드그룹","em.attr.currencyColumn":"통화 컬럼","em.attr.pii":"개인정보","em.attr.colFallback":"컬럼 {n}","em.attr.sharedOwn":"전용 컬럼(OWN)","em.attr.sharedRef":"↗ {owner}{physical} ({mode})","em.attr.currencyMode":"통화","em.attr.sharedMode":"공유","em.attr.batchHint":"선택 {n}개 일괄","em.attr.fkDeleteHint":"외래키는 연관관계에서 파생됩니다 — 연관관계선을 삭제하세요","em.op.section":"오퍼레이션 ({n})","em.op.namePlaceholder":"오퍼레이션명","em.op.editBodyDirty":"본문 편집 ●","em.op.editBody":"본문 편집","em.index.section":"인덱스 ({n})","em.index.inherited":"{field} (상속)","em.index.namePlaceholder":"인덱스명","em.index.addColumn":"컬럼","em.index.condition":"조건 (partial index)","em.index.conditionPlaceholder":"예: WHERE status = 'A'","em.groupCode.searchPlaceholder":"코드그룹 검색/선택","em.groupCode.noMatch":"일치하는 코드그룹 없음","em.detail.tabBasics":"기본","em.detail.tabColumns":"속성","em.detail.tabIndexes":"인덱스","em.detail.tabOperations":"오퍼레이션","em.detail.title":"엔티티 — {name}","em.attr.addDivider":"구분선","em.attr.columnPhysical":"컬럼(물리)","em.attr.constraints":"제약","em.attr.dividerLabelPlaceholder":"구분선 라벨(선택)","em.attr.dividerNote":"── 시각 구획 ──","em.attr.detailCollapse":"상세 접기","em.attr.detailExpand":"상세 펼치기","em.attr.semanticLegend":"의미","em.attr.embedChildCols":"임베더블 — 하위 컬럼 {n}개","em.attr.overrideCollapse":"오버라이드 접기","em.attr.overrideExpand":"오버라이드 펼치기","em.attr.overrideLegend":"컬럼 오버라이드","em.attr.empty":"속성 없음 — '추가'로 생성","em.op.body":"본문","em.op.bodyDirty":"본문 ●","em.op.empty":"오퍼레이션 없음 — '추가'로 생성","em.index.delete":"인덱스 삭제","em.index.empty":"인덱스 없음 — '추가'로 생성","em.index.conditionPlaceholderWide":"예: WHERE status = 'A' AND deleted = false","em.index.inheritedColTitle":"슈퍼클래스 상속 컬럼","em.index.inheritedBadge":"상속","em.index.colUnspecified":"{name} (컬럼 {n}개 중 미지정)","em.index.multiColumn":"{name} (컬럼 {n}개)","em.index.unnamedAttr":"(이름 없음)","em.index.availColumns":"가용 컬럼 ({n})","em.index.indexColumns":"인덱스 컬럼 ({n})","em.index.allColumnsUsed":"모든 컬럼 사용됨","em.index.addArrow":"추가 →","em.index.moveUp":"위로","em.index.moveDown":"아래로","em.index.removeColumn":"제거","em.index.noColumns":"컬럼 없음 — 좌측에서 추가","em.index.selectPrompt":"인덱스를 선택하거나 추가하세요.","em.palette.autoLayout":"자동 배치","em.cmd.title":"명령 팔레트","em.cmd.placeholder":"엔티티로 이동하거나 명령 실행…","em.cmd.sectionGoto":"이동","em.cmd.sectionActions":"명령","em.cmd.empty":"일치하는 항목이 없습니다","em.cmd.groupTag":"그룹","em.canvas.emptyTitle":"빈 다이어그램입니다","em.canvas.emptyHint":"캔버스를 <strong>우클릭</strong>하거나 좌하단 <strong>+</strong> 버튼으로 첫 엔티티를 추가하세요.","em.canvas.emptyConnectHint":"엔티티를 두 개 이상 만들면, 엔티티 가장자리에서 <strong>드래그</strong>해 관계를 연결할 수 있어요.","em.canvas.emptyShortcutHint":"단축키 도움말은 <kbd>?</kbd> 키","em.canvas.emptyReadonly":"표시할 엔티티가 없습니다","em.canvas.exportFailed":"내보내기에 실패했습니다","em.conflict.lockedTitle":"편집이 잠겼습니다","em.conflict.missingDetail":"변경 사항을 저장하지 못했습니다(서버 또는 네트워크 오류). 최신 내용을 다시 불러오세요.","em.conflict.changedDetail":"다른 곳에서 변경되어 편집이 잠겼습니다. 최신 내용을 다시 불러오세요.","em.conflict.commandFailedDetail":"편집을 처리하지 못해 화면 내용이 어긋났습니다. 저장된 내용은 그대로이니 최신 내용을 다시 불러오세요.","em.ctx.addEntity":"엔티티 추가","em.ctx.addNote":"노트 추가","em.ctx.addGroup":"그룹 추가","em.ctx.paste":"붙여넣기","em.ctx.copy":"복사","em.ctx.copyN":"복사 ({n})","em.ctx.editDetail":"상세 편집…","em.ctx.viewDetail":"상세 보기…","em.ctx.lock":"잠금","em.ctx.ungroup":"그룹 해제","em.ctx.deleteNote":"노트 삭제","em.ctx.addAttr":"속성 추가","em.ctx.colorN":"색상 ({n})","em.ctx.pasteAttr":"속성 붙여넣기","em.ctx.pasteAttrN":"속성 붙여넣기 ({n})","em.ctx.deleteAttr":"속성 삭제","em.ctx.deleteAttrN":"속성 삭제 ({n})","em.ctx.addOperation":"오퍼레이션 추가","em.ctx.deleteOperation":"오퍼레이션 삭제","em.ctx.addMethod":"메서드 추가","em.ctx.groupInto":"그룹으로 묶기","em.ctx.addSelfAssoc":"셀프 연관 추가","em.ctx.addEmbeddableNamed":"임베더블 추가: {label}","em.ctx.ungroupEntity":"그룹에서 빼기","em.ctx.deleteEntity":"엔티티 삭제","em.ctx.clearWaypoints":"꺾은선 풀기","em.ctx.deleteConnection":"연결 삭제","em.ctx.deleteAssociation":"관계 삭제","em.node.keyPfk":"PFK (식별 외래키)","em.node.keyPk":"PK (기본키)","em.node.keyFk":"FK (외래키)","em.node.required":"필수 (NOT NULL)","em.node.logicalMissing":"(논리명)","em.node.editLock":"편집 잠금","em.node.connectHint":"드래그해 다른 엔티티와 관계 연결","em.node.embedRepeatedShow":"이 엔티티에서 값이 같아 접힌 컬럼 {count}개 보기","em.node.embedRepeatedHide":"값이 같아 반복되는 컬럼 접기","em.node.embedAttrHide":"이 임베드 컬럼 접기","em.node.embedAttrShow":"접힌 임베드 컬럼 {count}개 보기","em.node.embedAllHide":"이 엔티티의 임베드 컬럼 모두 접기","em.node.embedAllShow":"접힌 임베드 컬럼 모두 펼치기","em.node.embedAllSummary":"임베드 컬럼 {n}개 숨김","em.node.opsSummaryTitle":"오퍼레이션 {n}개 — 클래스 표시 모드에서 펼쳐 보입니다","em.node.opsSummary":"오퍼레이션 {n}개","em.node.addAttr":"+ 속성","em.node.addDivider":"+ 구분선","em.group.ddlExcludeBadge":"DDL 제외","em.explorer.groupFallback":"(그룹)","em.explorer.associations":"관계 ({n})","em.explorer.notes":"노트 ({n})","em.explorer.emptyNote":"(빈 노트)","em.explorer.diagram":"다이어그램","em.explorer.searchPlaceholder":"엔티티·속성 검색 ( / )","em.explorer.treeAria":"다이어그램 트리","em.explorer.searchAria":"엔티티·속성 검색","em.explorer.clearSearchAria":"검색어 지우기","em.explorer.clearSearchTitle":"지우기 (Esc)","em.explorer.noMatches":"일치하는 엔티티·속성이 없습니다","em.history.title":"변경 이력","em.history.refresh":"새로고침","em.history.loading":"이력을 불러오는 중…","em.history.loadError":"이력을 불러오지 못했습니다.","em.history.emptyLoaded":"표시할 변경 이력이 없습니다.","em.history.emptyNotLoaded":"이력을 불러오세요.","em.history.filterAll":"전체","em.history.kindEdit":"편집","em.history.kindRestore":"복원","em.history.verbAdd":"추가","em.history.verbUpdate":"수정","em.history.verbRemove":"삭제","em.history.assocFallback":"연관","em.history.groupSubject":"그룹 {name}","em.history.emptyValue":"(비움)","em.history.noChange":"변경 없음","em.history.summaryAdd":"{name} 추가","em.history.summaryRemove":"{name} 삭제","em.history.summaryFields":"{name} {n}개 변경","em.history.summaryMore":"{summary} 외 {n}건","em.history.restoreFailed":"복원 실패: {reason}","em.history.unknown":"알 수 없음","em.history.confirmRestore":"이 시점으로 되돌립니다.","em.history.doRestore":"복원","em.history.cancel":"취소","em.history.restoreToHere":"이 시점으로 복원","em.history.diff.compare":"현재와 비교","em.history.diff.current":"현재","em.history.diff.exit":"비교 해제","em.history.diff.count":"누적 변경 {n}건","em.history.diff.empty":"이 구간의 누적 변경이 없습니다.","em.history.diff.restorePreview":"되돌아갈 변경 {n}건","em.history.diff.restorePreviewNone":"되돌아갈 변경이 없습니다.","em.history.loadMore":"이전 기록 더 보기 ({n})","em.history.periodLabel":"기간","em.history.periodFrom":"시작일","em.history.periodTo":"종료일","em.history.periodReset":"기간 해제","em.check.catName":"이름","em.check.catJpa":"JPA","em.check.catType":"타입","em.check.catDsn":"설계","em.check.name1":'속성 이름이 중복됩니다: "{name}"',"em.check.name2":'컬럼 물리명이 중복됩니다: "{name}"',"em.check.name3Entity":'엔티티 이름이 중복됩니다: "{name}" — 같은 이름의 엔티티가 또 있습니다. JPA는 엔티티 이름을 퍼시스턴스 유닛 전역에 등록하므로 패키지(그룹)를 나눠도 해소되지 않습니다',"em.check.name3Package":'엔티티 이름이 중복됩니다: "{name}" — 같은 패키지에 같은 이름이 있습니다. 이름을 바꾸거나 그룹(패키지)을 나누면 해소됩니다',"em.check.name4Entity":"엔티티 이름이 비어 있습니다","em.check.name4Attr":"속성 이름이 비어 있습니다","em.check.name5":"물리명이 {max}자를 초과했습니다 ({len}자) — 일부 DB에서 잘릴 수 있습니다","em.check.name6Column":'컬럼 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Table":'테이블 물리명이 SQL 예약어입니다: "{name}"',"em.check.name6Index":'인덱스 이름이 SQL 예약어입니다: "{name}"',"em.check.name7":"관계/임베드 속성({attrType})의 이름이 비어 있습니다 — 이름이 곧 JPA 필드명이라 코드 생성 시 이 관계가 통째로 누락됩니다. 속성명을 채우세요","em.check.name8":'속성 "{name}"의 컬럼 물리명이 비어 있습니다 — DDL·코드 생성에서 이 컬럼이 통째로 누락됩니다. 물리명을 채우세요',"em.check.name9":'두 엔티티가 같은 테이블 "{name}"에 매핑됩니다 — 컬럼이 한 테이블에 뒤섞입니다. 테이블 물리명을 구분하세요',"em.check.name10":'인덱스 이름이 중복됩니다: "{name}" — 인덱스 이름은 DB 스키마 전역에서 유일해야 합니다',"em.check.jpa1":"JPA 엔티티에 식별자(PK) 속성이 없습니다","em.check.jpa2":'임베더블 타입은 식별자 속성을 가질 수 없습니다: "{name}"',"em.check.jpa4":"식별 관계 사이클입니다 (PK 무한 의존): {path}","em.check.jpa5":"{which}: cascade ALL이 개별 cascade와 중복됩니다 (ALL이 모두 포함)","em.check.jpa6":"{which}: orphanRemoval이 cascade {cascade}와 의미가 겹칩니다","em.check.jpa7":"{which}: 컬렉션(to-many) 연관에 EAGER 페치는 성능 위험이 있습니다","em.check.jpa8":"JPA 엔티티에 테이블 물리명이 설정되지 않았습니다","em.check.jpa9":"{which}: 단일(to-one) 연관에 컬렉션 메타(collectionType/collectionTable/orderColumn)는 무의미합니다 — @ElementCollection은 컬렉션에서만 적용됩니다","em.check.jpa10":"{which}: SET 컬렉션은 순서를 보존하지 않아 orderColumn(@OrderColumn)이 무의미합니다","em.check.jpa11":"임베드(@Embedded/@ElementCollection)는 식별 관계로 둘 수 없습니다 — 임베더블은 독립 식별자가 없습니다","em.check.jpa12":'식별자(@Id) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa13AutoIncrement":'채번(auto increment)은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa13Sequence":'채번(시퀀스 "{seq}")은 식별자(@Id) 속성에만 쓸 수 있습니다 — 비식별 속성 "{name}"에 설정되어 있습니다',"em.check.jpa14":"{which}: orphanRemoval은 @ManyToOne/@ManyToMany(반대편이 컬렉션) 연관에는 적용할 수 없습니다 — @OneToOne·@OneToMany에서만 유효합니다","em.check.jpa15":'식별자(@Id) 속성은 자연키(@NaturalId)일 수 없습니다 — 자연키는 PK와 별개의 비즈니스 키입니다: "{name}"',"em.check.jpa16":'자연키(@NaturalId) 속성은 transient(@Transient)일 수 없습니다: "{name}"',"em.check.jpa17":'자연키(@NaturalId) 속성은 not null이 권장됩니다(비즈니스 키는 non-null이 원칙): "{name}"',"em.check.jpa18":"cascade가 관계 양쪽(부모·자식)에 모두 설정되어 양방향 전파됩니다 — 의도치 않은 연쇄 저장/삭제·전파 사이클 위험. 보통 cascade는 한쪽에만 둡니다","em.check.jpa19":"부모에 컬렉션/참조 필드가 있으나 자식({child})에 대응 관계 속성이 없어 JPA 매핑(mappedBy)을 만들 수 없습니다 — 코드젠이 이 관계를 방출하지 못합니다. 자식에 FK 속성을 만들거나 관계를 단방향으로 정리하세요","em.check.jpa20":'복합 PK(@IdClass/@EmbeddedId)에는 채번(@GeneratedValue)을 쓸 수 없습니다 — 속성 "{name}"에 설정되어 있습니다',"em.check.jpa21Missing":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 적습니다 — 슬롯 {slots} / 선언 {declared}. 뒤에 추가된 컬럼이 반영되지 않아 DDL에서 빠집니다(JPA는 임베더블 선언대로 컬럼을 만듭니다)',"em.check.jpa21Extra":'임베드 "{name}"의 컬럼이 임베더블({embeddable}) 선언보다 많습니다 — 슬롯 {slots} / 선언 {declared}. 임베더블에서 지워진 컬럼이 남아 DDL에 없는 컬럼을 방출합니다',"em.check.type1":'타겟 DB가 지원하지 않는 컬럼 타입입니다: "{dataType}"',"em.check.type2":"{dataType} 타입에 length가 지정되지 않았습니다","em.check.type3":"공유 대상 컬럼의 타입({targetType})이 {metaName} 정의({metaType})와 다릅니다","em.check.type4":"다중값(Multi-Value) 속성은 GroupCodeEnum + VARCHAR 조합에서만 컨버터가 자동 생성됩니다 — 현재({type} / {dataType})에서는 Set<…> 필드만 생성되어 매핑이 불완전할 수 있습니다","em.check.type6":'속성 "{name}"의 컬럼에 데이터 타입이 지정되지 않았습니다 — DDL에서 이 컬럼이 생략됩니다',"em.check.dsn1":"both-many(M:N) 관계를 조인 엔티티 없이 직접 연결했습니다 — 연관 엔티티 도입을 검토하세요","em.check.dsn2":"속성이 하나도 없는 엔티티입니다","em.check.dsn3":"모델링된 관계가 없습니다 (연관·상속·임베딩 미참여 — 의도적 생략이면 무시)","em.check.dsn4":"속성이 {count}개로 많습니다 (임계치 {threshold} 초과) — 분해를 검토하세요","em.check.dsn5Inherited":'인덱스 "{name}"가 참조하는 상속 컬럼을 슈퍼클래스 카탈로그에서 찾을 수 없습니다({field}).',"em.check.dsn5Missing":'인덱스 "{name}"가 존재하지 않는 컬럼을 참조합니다.',"em.check.dsn6":'인덱스 "{name}"에 컬럼이 없습니다 — 컬럼 없는 인덱스는 DDL·코드 생성에서 산출되지 않습니다',"em.check.dsn7":'인덱스 "{name}"에 같은 컬럼이 두 번 이상 들어 있습니다 — 뒤의 중복 항목은 의미가 없습니다',"em.check.unspecified":"미지정"},Lw=["ko","en","ja"],Gl={ko:sf,en:rf,ja:lf};function Lt(e,n,o){let a=(Gl[e]??Gl.ko)[n]??Gl.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const cf=["ko","en","ja","zh"];function Ow(e){if(e)for(const n of cf){const o=e[n];if(o)return o}}function Yl(e){const n=Ow(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function Pw(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:cf.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const zw=["aria-expanded","placeholder"],Fw=["aria-selected","onClick","onMouseenter"],Uw={key:0,class:"gcc__opt gcc__opt--empty"},df=Ke(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(T,V)=>Lt(o.locale??"ko",T,V),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),h=t.computed(()=>o.items.find(T=>T.groupCode===o.modelValue)),p=t.computed(()=>h.value?Yl(h.value):"");t.watch(p,T=>{d.value||(c.value=T)},{immediate:!0});const y=t.computed(()=>c.value===p.value?o.items:Pw(o.items,c.value));function b(){var V;const T=(V=r.value)==null?void 0:V.getBoundingClientRect();T&&(m.value={left:`${T.left}px`,top:`${T.bottom}px`,width:`${T.width}px`})}function f(){d.value=!0,b(),u.value=Math.max(0,y.value.findIndex(T=>T.groupCode===o.modelValue)),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),document.addEventListener("mousedown",$)}function g(){d.value=!1,window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b),document.removeEventListener("mousedown",$)}t.onBeforeUnmount(g);function k(){f(),t.nextTick(()=>{var T;return(T=l.value)==null?void 0:T.select()})}function _(){d.value||f(),u.value=0}function N(T){i("update:modelValue",T.groupCode),c.value=Yl(T),g()}function I(){i("update:modelValue",void 0),c.value="",g()}function A(){c.value.trim()===""?I():(c.value=p.value,g())}function x(T){var V;if(T.key==="ArrowDown")d.value||f(),u.value=Math.min(u.value+1,y.value.length-1),T.preventDefault();else if(T.key==="ArrowUp")u.value=Math.max(u.value-1,0),T.preventDefault();else if(T.key==="Enter"){const R=y.value[u.value];R&&N(R),T.preventDefault()}else T.key==="Escape"&&(c.value=p.value,g(),(V=l.value)==null||V.blur())}function $(T){var R,C;const V=T.target;!((R=r.value)!=null&&R.contains(V))&&!((C=s.value)!=null&&C.contains(V))&&A()}return(T,V)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":V[0]||(V[0]=R=>c.value=R),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:k,onInput:_,onKeydown:x},null,40,zw),[[t.vModelText,c.value]]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[d.value?(t.openBlock(),t.createElementBlock("ul",{key:0,ref_key:"popup",ref:s,class:"gcc__popup",style:t.normalizeStyle(m.value),role:"listbox"},[t.createElementVNode("li",{class:"gcc__opt gcc__opt--none",onMousedown:V[1]||(V[1]=t.withModifiers(()=>{},["prevent"])),onClick:I},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(R,C)=>(t.openBlock(),t.createElementBlock("li",{key:R.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":C===u.value,"is-selected":R.groupCode===e.modelValue}]),role:"option","aria-selected":R.groupCode===e.modelValue,onMousedown:V[2]||(V[2]=t.withModifiers(()=>{},["prevent"])),onClick:M=>N(R),onMouseenter:M=>u.value=C},t.toDisplayString(t.unref(Yl)(R)),43,Fw))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Uw,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),Hw=["aria-labelledby"],jw=["aria-checked","tabindex","onClick","onKeydown"],uf=Ke(t.defineComponent({__name:"ColumnLangSelect",props:{modelValue:{},languages:{},defaultLang:{},labelledBy:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n;t.watch(()=>[o.languages,o.defaultLang],([l,s])=>{l.includes(s)?o.modelValue!==s&&i("update:modelValue",s):l.includes(o.modelValue)||i("update:modelValue",l[0]??"ko")});const a=t.ref(null);async function r(l){var d,u;const s=o.languages,c=s[(s.indexOf(o.modelValue)+l+s.length)%s.length];c&&(i("update:modelValue",c),await t.nextTick(),(u=(d=a.value)==null?void 0:d.querySelectorAll('[role="radio"]')[s.indexOf(c)])==null||u.focus())}return(l,s)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"rootEl",ref:a,class:"em-langsel",role:"radiogroup","aria-labelledby":e.labelledBy},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.languages,c=>(t.openBlock(),t.createElementBlock("span",{key:c,class:t.normalizeClass(["em-langsel__opt",{"is-active":e.modelValue===c}]),role:"radio","aria-checked":e.modelValue===c,tabindex:e.modelValue===c?0:-1,onClick:d=>i("update:modelValue",c),onKeydown:[t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["enter"]),t.withKeys(t.withModifiers(d=>i("update:modelValue",c),["prevent"]),["space"]),s[0]||(s[0]=t.withKeys(t.withModifiers(d=>r(-1),["prevent"]),["left"])),s[1]||(s[1]=t.withKeys(t.withModifiers(d=>r(1),["prevent"]),["right"]))]},t.toDisplayString(c),43,jw))),128))],8,Hw))}}),[["__scopeId","data-v-5c793bbb"]]),Kw=["disabled"],Gw={class:"em-aw__toolbar"},Yw={class:"em-aw__count"},qw={class:"em-aw__scroll"},Ww={class:"em-aw__table"},Jw={class:"c-name"},Xw={class:"c-type"},Zw={class:"c-logical"},Qw=["id"],eI={class:"c-col"},tI={class:"c-constraints"},nI={class:"c-del"},oI={class:"c-expand"},iI=["title","onClick","onKeydown"],aI=["title"],rI={key:1,class:"em-aw__muted"},lI=["title"],sI=["title"],cI=["title"],dI={class:"em-aw__cflags"},uI=["title"],mI={colspan:"8"},fI={class:"em-aw__detail"},pI={class:"em-aw__dgroup"},hI=["title"],yI={class:"em-aw__df"},gI={class:"em-aw__df"},bI={class:"em-aw__dgroup"},_I={key:0,class:"em-aw__dgroup"},kI={class:"em-aw__df"},EI={key:0,class:"em-aw__df"},NI={class:"em-aw__df"},wI={class:"em-aw__dgroup em-aw__ddesc"},II={class:"c-expand"},vI={class:"em-aw__caret is-static","aria-hidden":"true"},xI={class:"c-del"},CI={class:"c-expand"},SI=["title","onClick","onKeydown"],RI={class:"em-aw__embed-label"},$I=["title"],AI=["title"],TI={class:"em-aw__ro"},MI=["title"],VI={class:"em-aw__ro"},BI=["title"],DI={class:"em-aw__ro"},LI={key:0,class:"em-aw__detail-row em-aw__embed-detail"},OI={colspan:"8"},PI={class:"em-aw__detail"},zI={class:"em-aw__dgroup"},FI={key:0,class:"em-aw__df"},UI={class:"em-aw__df"},HI={class:"em-aw__df"},jI={key:0},KI={colspan:"99",class:"em-aw__empty"},GI=6,YI=5,qI=Ke(t.defineComponent({__name:"EntityAttributesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,{entity:i,isEmbeddable:a,focusedAttrIds:r,personalInfoItems:l,piiLabel:s,idn:c,setAttr:d,isManagedFk:u,setNaturalId:m,setIdentifier:h,setTransient:p,dbLocked:y,fkDerived:b,fkOriginPhysical:f,typeValueOf:g,typeLabelOf:k,setAttrType:_,setAttrCustomType:N,setDb:I,scaleApplicable:A,scaleHint:x,setDbLogical:$,attrPiiValue:T,setAttrPii:V,predefinedCustomTypeCatalog:R,embeddableCatalog:C,predefinedLabel:M,groupCodeCatalog:E,attrGroupCodes:w,attrCodeItems:S,codeValueOf:B,codeLabelOf:z,setAttrGroupCode:K,setAttrCode:J,setAttrDefaultValue:re,setAttrDescription:pe,isEmbedExpanded:ce,setDbAt:Ne,setDbLogicalAt:he,embedColMeta:de,fixedDataType:_e,fixedLength:Se,fixedScale:me,updatableItems:ye,updatableLabel:ie,updatableValue:se,setUpdatableAt:fe,setUpdatable:O,insertableItems:L,insertableLabel:F,insertableValue:Q,setInsertableAt:Y,setInsertable:ke,sharedItems:be,sharedLabel:Ce,sharedValue:ve,setSharedAt:U,isShared:H,sharedPhysical:q}=af(o,()=>n.entityId),xe=t.computed(()=>{var Re;return[...((Re=i.value)==null?void 0:Re.attributes)??[]].sort((le,j)=>le.order-j.order)}),De=t.computed(()=>{var Re;return(((Re=i.value)==null?void 0:Re.attributes)??[]).filter(le=>le.attrType!=="DIVIDER").length}),W=t.ref(new Set);function ne(Re){return W.value.has(Re)}function G(Re){const le=new Set(W.value);le.has(Re)?le.delete(Re):le.add(Re),W.value=le}const P=t.ref(o.userLanguage.value);function ae(Re){!Re||!i.value||o.addPredefinedEmbed(i.value.modelId,Re)}return(Re,le)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",Gw,[t.createElementVNode("span",Yw,t.toDisplayString(t.unref(o).t("em.attr.section",{n:De.value})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:le[0]||(le[0]=j=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:le[1]||(le[1]=j=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(C).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(C),"value-provider":j=>j.type,"label-provider":t.unref(M),"onUpdate:modelValue":ae},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",qw,[t.createElementVNode("table",Ww,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[le[3]||(le[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",Jw,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",Xw,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",Zw,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,Qw),t.createVNode(uf,{modelValue:P.value,"onUpdate:modelValue":le[2]||(le[2]=j=>P.value=j),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`aw-logical-head-${t.unref(i).modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",eI,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),le[4]||(le[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),le[5]||(le[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",tI,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),le[6]||(le[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(xe.value,j=>{var Xe,rt,He,Pe,Oe,X,Nt,Et,yn,gn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:j.modelId},[j.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(j.modelId)}])},[le[7]||(le[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-divlabel-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":j.name,"onUpdate:modelValue":Ee=>t.unref(d)(j,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:GI,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",nI,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,j.modelId)},null,8,["onClick"])])],2)):t.unref(ce)(j)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(j.modelId)}])},[t.createElementVNode("td",II,[t.createElementVNode("span",vI,[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":j.name,"onUpdate:modelValue":Ee=>t.unref(d)(j,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-type-${j.modelId}`,width:"100%",disabled:"","model-value":j.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:YI,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:j.dbAttrs.length})),1),t.createElementVNode("td",xI,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,j.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(j.dbAttrs,(Ee,nt)=>{var mt,Ft,Zt,Qt,we,et,ft,bn;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Ee.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":ne(Ee.modelId)}])},[t.createElementVNode("td",CI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ne(Ee.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ne(Ee.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:ot=>G(Ee.modelId),onKeydown:[t.withKeys(t.withModifiers(ot=>G(Ee.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ot=>G(Ee.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,SI)]),t.createElementVNode("td",RI,"↳ "+t.toDisplayString(((mt=t.unref(de)(j,nt))==null?void 0:mt.name)??((Ft=t.unref(de)(j,nt))==null?void 0:Ft.physicalName)??t.unref(o).t("em.attr.colFallback",{n:nt+1})),1),le[14]||(le[14]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(dn,{name:`aw-embed-logical-${Ee.modelId}`,languages:t.unref(o).languages.value,"active-lang":P.value,placeholder:((Qt=(Zt=t.unref(de)(j,nt))==null?void 0:Zt.logicalName)==null?void 0:Qt[P.value])??((et=(we=t.unref(de)(j,nt))==null?void 0:we.logicalName)==null?void 0:et.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ee.logicalName,"onUpdate:modelValue":ot=>t.unref(he)(j,nt,ot)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(H)(Ee)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-embed-col-${Ee.modelId}`,width:"100%",disabled:t.unref(H)(Ee),placeholder:((ft=t.unref(de)(j,nt))==null?void 0:ft.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(H)(Ee)?t.unref(q)(Ee):Ee.physicalName,"onUpdate:modelValue":ot=>t.unref(Ne)(j,nt,{physicalName:ot})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(eo,{controller:t.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"])],8,$I),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",TI,t.toDisplayString(t.unref(_e)(j,nt)),1)],8,AI),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",VI,t.toDisplayString(t.unref(Se)(j,nt)??""),1)],8,MI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",DI,t.toDisplayString(t.unref(me)(j,nt)!=null?`scale ${t.unref(me)(j,nt)}`:""),1)],8,BI),le[15]||(le[15]=t.createElementVNode("td",null,null,-1))],2),ne(Ee.modelId)?(t.openBlock(),t.createElementBlock("tr",LI,[le[18]||(le[18]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",OI,[t.createElementVNode("div",PI,[t.createElementVNode("fieldset",zI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(bn=t.unref(de)(j,nt))!=null&&bn.shareable?(t.openBlock(),t.createElementBlock("label",FI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(te.BSSelect),{width:"150px","model-value":t.unref(ve)(Ee),items:t.unref(be)(),"value-provider":t.unref(c),"label-provider":t.unref(Ce),"onUpdate:modelValue":ot=>ot&&t.unref(U)(j,nt,ot)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",UI,[le[16]||(le[16]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(H)(Ee),"model-value":t.unref(H)(Ee)?"false":t.unref(Q)(Ee),items:t.unref(L),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":ot=>ot&&t.unref(Y)(j,nt,ot)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",HI,[le[17]||(le[17]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(H)(Ee),"model-value":t.unref(H)(Ee)?"false":t.unref(se)(Ee),items:t.unref(ye),"value-provider":t.unref(c),"label-provider":t.unref(ie),"onUpdate:modelValue":ot=>ot&&t.unref(fe)(j,nt,ot)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])])])])):t.createCommentVNode("",!0)],64)}),128))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("tr",{class:t.normalizeClass({"is-focused":t.unref(r).has(j.modelId),"em-aw__open":ne(j.modelId)})},[t.createElementVNode("td",oI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":ne(j.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(ne(j.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:Ee=>G(j.modelId),onKeydown:[t.withKeys(t.withModifiers(Ee=>G(j.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Ee=>G(j.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,iI)]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":j.name,"onUpdate:modelValue":Ee=>t.unref(d)(j,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-type-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!j.groupCode||j.attrType==="RELATION_REF"||t.unref(b)(j),items:t.unref(Us)(j.type,t.unref(R)),"value-provider":t.unref(g),"label-provider":t.unref(k),"model-value":j.type,"onUpdate:modelValue":Ee=>t.unref(_)(j,Ee)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),j.type===t.unref(en)&&!t.unref(b)(j)?(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:0,name:`aw-customtype-${j.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":j.customType??"","onUpdate:modelValue":Ee=>t.unref(N)(j,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,aI),t.createElementVNode("td",null,[j.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(dn,{key:0,name:`aw-logical-${j.modelId}`,languages:t.unref(o).languages.value,"active-lang":P.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Xe=j.dbAttrs[0])==null?void 0:Xe.logicalName,"onUpdate:modelValue":Ee=>t.unref($)(j,Ee)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",rI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-col-${j.modelId}`,width:"100%",placeholder:t.unref(f)(j)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(y)(j),"model-value":((rt=j.dbAttrs[0])==null?void 0:rt.physicalName)??"","onUpdate:modelValue":Ee=>t.unref(I)(j,{physicalName:Ee})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(eo,{controller:t.unref(o),"ref-id":(He=j.dbAttrs[0])==null?void 0:He.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-dtype-${j.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(y)(j)||t.unref(b)(j),items:t.unref(Ps)(((Pe=j.dbAttrs[0])==null?void 0:Pe.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Ir),"model-value":((Oe=j.dbAttrs[0])==null?void 0:Oe.dataType)??"","onUpdate:modelValue":Ee=>Ee&&t.unref(I)(j,{dataType:Ee})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,lI),t.createElementVNode("td",{title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSNumberInput),{name:`aw-len-${j.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(y)(j)||t.unref(b)(j),"model-value":(X=j.dbAttrs[0])==null?void 0:X.length,"onUpdate:modelValue":Ee=>t.unref(I)(j,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,sI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(b)(j)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",dI,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${j.modelId}`,label:"PK","model-value":j.identifier,disabled:t.unref(a)||t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(h)(j,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${j.modelId}`,label:"NN","model-value":j.notNull,disabled:t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(d)(j,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-uq-${j.modelId}`,label:"UQ","model-value":!!((Nt=j.dbAttrs[0])!=null&&Nt.unique),disabled:t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(I)(j,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,cI),t.createElementVNode("td",{class:"c-del",title:t.unref(u)(j)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,j.modelId)},null,8,["onClick"])],8,uI)],2),ne(j.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(j.modelId)}])},[le[13]||(le[13]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",mI,[t.createElementVNode("div",fI,[t.createElementVNode("fieldset",pI,[le[11]||(le[11]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(x)(j)},[le[8]||(le[8]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(te.BSNumberInput),{name:`aw-scale-${j.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(y)(j)||t.unref(b)(j)||!t.unref(A)(j),"model-value":(Et=j.dbAttrs[0])==null?void 0:Et.scale,"onUpdate:modelValue":Ee=>t.unref(I)(j,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,hI),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-ai-${j.modelId}`,label:"Auto Increment","model-value":!!((yn=j.dbAttrs[0])!=null&&yn.autoIncrement),disabled:t.unref(y)(j)||t.unref(b)(j)||!j.identifier,"onUpdate:modelValue":Ee=>t.unref(I)(j,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",yI,[le[9]||(le[9]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-ins-${j.modelId}`,width:"110px",disabled:t.unref(y)(j),"model-value":t.unref(Q)(j.dbAttrs[0]),items:t.unref(L),"value-provider":t.unref(c),"label-provider":t.unref(F),"onUpdate:modelValue":Ee=>Ee&&t.unref(ke)(j,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",gI,[le[10]||(le[10]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-upd-${j.modelId}`,width:"110px",disabled:t.unref(y)(j),"model-value":t.unref(se)(j.dbAttrs[0]),items:t.unref(ye),"value-provider":t.unref(c),"label-provider":t.unref(ie),"onUpdate:modelValue":Ee=>Ee&&t.unref(O)(j,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",bI,[le[12]||(le[12]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-tr-${j.modelId}`,label:"@Transient","model-value":!!j.transient,disabled:j.identifier||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(p)(j,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nid-${j.modelId}`,label:"@NaturalId","model-value":!!j.naturalId,disabled:j.identifier||t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(m)(j,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${j.modelId}`,label:"mutable","model-value":!!j.naturalIdMutable,disabled:t.unref(y)(j)||!j.naturalId,"onUpdate:modelValue":Ee=>t.unref(d)(j,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-mv-${j.modelId}`,label:"Multi-Value (Set)","model-value":!!((gn=j.dbAttrs[0])!=null&&gn.multiValue),disabled:t.unref(y)(j)||t.unref(b)(j),"onUpdate:modelValue":Ee=>t.unref(I)(j,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(b)(j)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",_I,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",kI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"150px","model-value":t.unref(T)(j),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ee=>Ee&&t.unref(V)(j,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(E).length?(t.openBlock(),t.createElementBlock("label",EI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(df,{"model-value":j.groupCode,items:t.unref(E),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ee=>t.unref(K)(j,Ee)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",NI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(w)(j).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"150px","model-value":j.defaultValue??"none",items:t.unref(S)(j),"value-provider":t.unref(B),"label-provider":t.unref(z),"onUpdate:modelValue":Ee=>Ee&&t.unref(J)(j,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`aw-default-${j.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":j.defaultValue??"","onUpdate:modelValue":Ee=>t.unref(re)(j,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",wI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(dn,{multiline:"",name:`aw-desc-${j.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":j.description,"onUpdate:modelValue":Ee=>t.unref(pe)(j,Ee)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0)],64))],64)}),128)),t.unref(i).attributes.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",jI,[t.createElementVNode("td",KI,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,Kw)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-559a29b3"]]);function ql(e,n){return n&&n!==e?`${e} (${n})`:e}function mf(e,n,o){const i=e.dbAttrs[n];return i?Ko(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function ff(e,n){const o=e.name||n.t("em.index.unnamedAttr");return e.dbAttrs.length>1?n.t("em.index.multiColumn",{name:o,n:e.dbAttrs.length}):ql(o,mf(e,0,n))}function pf(e,n){var l;if(Vn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?ql(s.field,s.physicalName):e}const o=n.resolver.attributeOf(e);if(!o)return e;const i=o.name||n.t("em.index.unnamedAttr"),a=n.resolver.columnOf(e);if(!a)return n.t("em.index.colUnspecified",{name:i,n:o.dbAttrs.length});const r=o.dbAttrs.findIndex(s=>s.modelId===a.modelId);return ql(i,mf(o,r<0?0:r,n))}const WI=["disabled"],JI={class:"em-idxw__list"},XI={class:"em-idxw__list-head"},ZI=["aria-label"],QI=["aria-current","onClick","onKeydown"],ev={class:"em-idxw__item-name"},tv={key:0,class:"em-idxw__badge"},nv={class:"em-idxw__item-cnt"},ov={key:0,class:"em-idxw__empty"},iv={key:0,class:"em-idxw__edit"},av={class:"em-idxw__form"},rv={class:"em-field em-idxw__name"},lv={class:"em-field"},sv=["value","placeholder"],cv={class:"em-idxw__transfer"},dv={class:"em-idxw__pane"},uv={class:"em-idxw__pane-head"},mv=["aria-label"],fv=["aria-pressed","onClick","onKeydown"],pv=["title"],hv={key:0,class:"em-idxw__empty"},yv={class:"em-idxw__arrows"},gv={class:"em-idxw__pane"},bv={class:"em-idxw__pane-head"},_v={class:"em-idxw__col-name"},kv=["title"],Ev={class:"em-idxw__col-ops"},Nv=["title","disabled","onClick"],wv=["title","disabled","onClick"],Iv=["title","onClick"],vv={key:0,class:"em-idxw__empty"},xv={key:1,class:"em-idxw__edit em-idxw__edit--empty"},Cv=Ke(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(E=>E.modelId===n.entityId)??null),a=t.computed(()=>{var E;return((E=i.value)==null?void 0:E.indexes)??[]}),r=t.computed(()=>{var E;return((E=i.value)==null?void 0:E.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,E=>{var w;E.some(S=>S.modelId===s.value)||(s.value=((w=E[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(E=>E.modelId===s.value)??null),d=t.computed(()=>i.value?Ho(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Mn(r.value)),m=E=>u.value.canon(E),h=t.computed(()=>{var E;return new Set((((E=c.value)==null?void 0:E.columns)??[]).map(w=>m(w.columnRef)))}),p=t.computed(()=>({entity:i.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:o.state.logical,resolver:u.value,inherited:d.value,embeddableCatalog:o.embeddableCatalog.value,t:o.t}));function y(E){return ff(E,p.value)}function b(E){return E.physicalName&&E.physicalName!==E.field?`${E.field} (${E.physicalName})`:E.field}function f(E){return pf(E,p.value)}const g=t.computed(()=>[...r.value.filter(E=>E.dbAttrs.length>0&&!h.value.has(m(E.modelId))).map(E=>({ref:E.modelId,label:y(E),inherited:!1})),...d.value.filter(E=>!h.value.has(m(E.modelId))).map(E=>({ref:E.modelId,label:b(E),inherited:!0}))]),k=t.ref(new Set);t.watch(s,()=>k.value=new Set);function _(E){return Vn(E)}function N(E,w){i.value&&o.updateIndex(i.value.modelId,E,w)}function I(){var w;if(!i.value)return;const E=Be();o.addIndex(i.value.modelId,{modelId:E,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=E}function A(E){i.value&&o.removeIndex(i.value.modelId,E)}function x(E){c.value&&N(c.value.modelId,{parameters:E.trim()===""?void 0:E})}function $(E){const w=new Set(k.value);w.has(E)?w.delete(E):w.add(E),k.value=w}function T(){const E=c.value;if(!E||!k.value.size)return;const w=[...k.value].map(S=>({columnRef:S,descending:!1}));N(E.modelId,{columns:[...E.columns,...w]}),k.value=new Set}function V(E){const w=c.value;w&&N(w.modelId,{columns:w.columns.filter((S,B)=>B!==E)})}function R(E,w){const S=c.value;S&&N(S.modelId,{columns:S.columns.map((B,z)=>z===E?{...B,descending:w}:B)})}function C(E,w){const S=c.value;if(!S)return;const B=E+w;if(B<0||B>=S.columns.length)return;const z=[...S.columns];[z[E],z[B]]=[z[B],z[E]],N(S.modelId,{columns:z}),M(B,w)}async function M(E,w){var J,re;await t.nextTick();const S=(J=l.value)==null?void 0:J.querySelectorAll(".em-idxw__col--idx")[E];if(!S)return;const B=pe=>S.querySelector(`[data-move="${pe}"]`),z=B(w<0?"up":"down"),K=B(w<0?"down":"up");(re=z&&!z.disabled?z:K)==null||re.focus()}return(E,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",JI,[t.createElementVNode("div",XI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:I},null,8,["caption"])]),t.createElementVNode("ul",{role:"group","aria-label":t.unref(o).t("em.index.section",{n:a.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,S=>(t.openBlock(),t.createElementBlock("li",{key:S.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":S.modelId===s.value}]),role:"button",tabindex:"0","aria-current":S.modelId===s.value?"true":void 0,onClick:B=>s.value=S.modelId,onKeydown:[t.withKeys(t.withModifiers(B=>s.value=S.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(B=>s.value=S.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",ev,t.toDisplayString(S.name||t.unref(o).t("em.attr.nameless")),1),S.unique?(t.openBlock(),t.createElementBlock("span",tv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",nv,t.toDisplayString(S.columns.length),1)],42,QI))),128))],8,ZI),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",ov,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",iv,[t.createElementVNode("div",av,[t.createElementVNode("label",rv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(te.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=S=>N(c.value.modelId,{name:S}))},null,8,["model-value"]),t.createVNode(eo,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":w[1]||(w[1]=S=>N(c.value.modelId,{unique:S}))},null,8,["model-value"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=S=>A(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",lv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:c.value.parameters??"",rows:"2",placeholder:t.unref(o).t("em.index.conditionPlaceholderWide"),onChange:w[3]||(w[3]=S=>x(S.target.value))},null,40,sv)]),t.createElementVNode("div",cv,[t.createElementVNode("div",dv,[t.createElementVNode("div",uv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:g.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:g.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,S=>(t.openBlock(),t.createElementBlock("li",{key:S.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":k.value.has(S.ref)}]),role:"button",tabindex:"0","aria-pressed":k.value.has(S.ref),onClick:B=>$(S.ref),onKeydown:[t.withKeys(t.withModifiers(B=>$(S.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(B=>$(S.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(S.label),1),S.inherited?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,pv)):t.createCommentVNode("",!0)],42,fv))),128))],8,mv),g.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",hv,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",yv,[t.createVNode(t.unref(te.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!k.value.size,onClick:T},null,8,["caption","disabled"])]),t.createElementVNode("div",gv,[t.createElementVNode("div",bv,t.toDisplayString(t.unref(o).t("em.index.indexColumns",{n:c.value.columns.length})),1),t.createElementVNode("ul",{ref_key:"colsUl",ref:l,class:"em-idxw__cols"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value.columns,(S,B)=>(t.openBlock(),t.createElementBlock("li",{key:B,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",_v,[t.createTextVNode(t.toDisplayString(f(S.columnRef)),1),_(S.columnRef)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-idxw__inh",title:t.unref(o).t("em.index.inheritedColTitle")},t.toDisplayString(t.unref(o).t("em.index.inheritedBadge")),9,kv)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(te.BSCheckbox),{name:`idxw-desc-${B}`,class:"em-check",label:"DESC","model-value":S.descending,"onUpdate:modelValue":z=>R(B,z)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",Ev,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:B===0,onClick:z=>C(B,-1)},"↑",8,Nv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:B===c.value.columns.length-1,onClick:z=>C(B,1)},"↓",8,wv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:z=>V(B)},"✕",8,Iv)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",vv,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",xv,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,WI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),Sv={class:"em-op-src"},Rv=["placeholder"],$v={class:"em-op-src__actions"},hf=Ke(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(l,s)=>Lt(n.locale??"ko",l,s),a=t.ref(n.sourceCode);function r(){n.onSave(a.value),o.close()}return(l,s)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",Sv,[t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":s[0]||(s[0]=c=>a.value=c),class:"em-op-src__area",spellcheck:"false",placeholder:i("em.opSource.placeholder")},null,8,Rv),[[t.vModelText,a.value]]),t.createElementVNode("div",$v,[t.createVNode(t.unref(te.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:s[1]||(s[1]=c=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-34c9b822"]]),Av=["disabled"],Tv={class:"em-ow__toolbar"},Mv={class:"em-ow__count"},Vv={class:"em-ow__scroll"},Bv={class:"em-ow__table"},Dv={class:"c-name"},Lv={class:"c-desc"},Ov=["id"],Pv={class:"c-pii"},zv={class:"c-src"},Fv={class:"c-del"},Uv={key:0},Hv={colspan:"6",class:"em-ow__empty"},jv=Ke(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=te.useModal(),a=t.computed(()=>o.state.logical.entities.find(f=>f.modelId===n.entityId)??null),r=t.computed(()=>{var f;return[...((f=a.value)==null?void 0:f.operations)??[]].sort((g,k)=>g.order-k.order)}),l=t.ref(o.userLanguage.value),s=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],c=["none","PASSWORD","SOCIAL_SECURITY_NO","PASSPORT_NO","ALIEN_REGISTRATION_NO","DRIVERS_LICENSE_NO","BIOMETRICS","CREDITCARD_NO","ACCOUNT_NO","MEMBERSHIP_CARD_NO","ID","NAME","DATE_OF_BIRTH","PHONE_NO","EMAIL_ADDRESS","ADDRESS","IP_ADDRESS"];function d(f){return f==="none"?o.t("em.common.noneParen"):f}const u=f=>f;function m(f,g){a.value&&o.updateOperation(a.value.modelId,f.modelId,g)}function h(f,g){m(f,{description:Object.keys(g).length?g:void 0})}function p(f){return f.personalInfoAttributeType??"none"}function y(f,g){m(f,{personalInfoAttributeType:g==="none"?void 0:g})}function b(f){i.openModal({component:hf,bind:{operationName:f.name,sourceCode:f.sourceCode??"",locale:o.uiLocale.value,onSave:g=>m(f,{sourceCode:g})}})}return(f,g)=>{var k,_;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",Tv,[t.createElementVNode("span",Mv,t.toDisplayString(t.unref(o).t("em.op.section",{n:((k=a.value.operations)==null?void 0:k.length)??0})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:g[0]||(g[0]=N=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",Vv,[t.createElementVNode("table",Bv,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",Dv,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),g[2]||(g[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",Lv,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,Ov),t.createVNode(uf,{modelValue:l.value,"onUpdate:modelValue":g[1]||(g[1]=N=>l.value=N),languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"labelled-by":`ow-desc-head-${a.value.modelId}`},null,8,["modelValue","languages","default-lang","labelled-by"])]),t.createElementVNode("th",Pv,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",zv,t.toDisplayString(t.unref(o).t("em.op.body")),1),g[3]||(g[3]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,N=>(t.openBlock(),t.createElementBlock("tr",{key:N.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`ow-name-${N.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":N.name,"onUpdate:modelValue":I=>m(N,{name:I})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":N.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":I=>I&&m(N,{visibility:I})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(dn,{name:`ow-desc-${N.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":N.description,"onUpdate:modelValue":I=>h(N,I)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":p(N),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":I=>I&&y(N,I)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t(N.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:I=>b(N)},null,8,["caption","onClick"])]),t.createElementVNode("td",Fv,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:I=>t.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])]))),128)),(_=a.value.operations)!=null&&_.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",Uv,[t.createElementVNode("td",Hv,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,Av)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),Kv={class:"em-detail__tabs"},Gv=["onClick"],Yv={key:0,class:"em-detail__lock"},qv=["disabled"],Wv={key:0,class:"em-detail__narrow"},Jv=Ke(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=te.useModalHandle(),a=t.computed(()=>o.isEntityLocked(n.entityId)),r=t.computed(()=>o.state.logical.entities.find(c=>c.modelId===n.entityId)??null);t.watch(r,c=>{c||i.close()});const l=[{key:"basics",labelKey:"em.detail.tabBasics"},{key:"columns",labelKey:"em.detail.tabColumns"},{key:"indexes",labelKey:"em.detail.tabIndexes"},{key:"operations",labelKey:"em.detail.tabOperations"}],s=t.ref("basics");return(c,d)=>{var u;return t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:t.unref(o).t("em.detail.title",{name:((u=r.value)==null?void 0:u.name)??""})},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["em-detail",{"is-maximized":t.unref(i).maximized}])},[t.createElementVNode("nav",Kv,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,m=>t.createElementVNode("button",{key:m.key,type:"button",class:t.normalizeClass(["em-detail__tab",{"is-active":s.value===m.key}]),onClick:h=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,Gv)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",Yv,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.panel.lockedBanner")),1),t.unref(o).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-detail__unlock",onClick:d[0]||(d[0]=m=>t.unref(o).setEntityLocked(e.entityId,!1))},t.toDisplayString(t.unref(o).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("fieldset",{class:t.normalizeClass(["em-detail__body",{"is-readonly":!t.unref(o).editable.value||a.value}]),disabled:!t.unref(o).editable.value||a.value},[s.value==="basics"?(t.openBlock(),t.createElementBlock("div",Wv,[t.createVNode(nf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(qI,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(Cv,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(jv,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,qv)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function Ya(e,n,o){e.openModal({component:Jv,bind:{controller:t.markRaw(n),entityId:o}})}function un(e,n,o){const i=new Set(o.map(r=>`${r.entityId}\0${r.attributeId}`)),a=[];for(const r of n){const l=`${e}\0${r}`;i.has(l)||(i.add(l),a.push(r),o.push({entityId:e,attributeId:r}))}return a.map(r=>Jc(e,r))}function Ot(e,n){if(!n.length)return[];const o=new Map;for(const{entityId:a,attributeId:r}of n){const l=o.get(a)??[];l.push(r),o.set(a,l)}const i=[];for(const[a,r]of o){const l=e.entities.find(s=>s.modelId===a);if(l)for(const s of Sd(l,r))i.push(ca(a,s.indexRef,{columns:s.columns}))}return i}function qa(e,n,o,i){var c;const a=[];a.push(...un(n,o.remove,i));for(const d of o.update)a.push(on(n,d.attributeId,d.patch));for(const d of o.add)a.push(Ht(n,d));const r=new Set(o.remove),l=[...(((c=e.entities.find(d=>d.modelId===n))==null?void 0:c.attributes)??[]).filter(d=>!r.has(d.modelId)),...o.add],s=new Set(l.map(d=>d.modelId));for(const d of e.associations){if(d.end2.entityRef!==n)continue;const u=d.end2.attributeRef;if(u&&s.has(u))continue;const h=l.filter(p=>{var y;return((y=p.derivedFrom)==null?void 0:y.associationRef)===d.modelId&&p.dbAttrs.length>0}).sort((p,y)=>p.order-y.order)[0];h&&a.push(Mt(d.modelId,"end2",{attributeRef:h.modelId}))}return a}function Mo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function ki(e,n,o){const i=[];for(const[a,r]of lc(e,n,Be))i.push(...qa(e,a,r,o));for(const a of Ag(e,n,Be))i.push(on(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function Xv(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=Fr([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return $d(e,n,r).map(l=>on(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function Zv(e,n,o){const i=new Set(o.remove);return Mo(e,n,a=>[...a.filter(r=>!i.has(r.modelId)).map(r=>{const l=o.update.find(s=>s.attributeId===r.modelId);return l?{...r,...l.patch}:r}),...o.add])}function Wa(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of sc(e,r,Be)){const c=i.get(l);i.set(l,c?rc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...qa(e,r,Qv(l),o));return a}function Qv(e){if(e.add.length<2)return e;const n=new Set,o=e.add.filter(i=>{const a=i.derivedFrom?`${i.derivedFrom.associationRef}\0${i.derivedFrom.sourceAttributeRef}`:i.modelId;return n.has(a)?!1:(n.add(a),!0)});return o.length===e.add.length?e:{...e,add:o}}function yf(e){return e.attributes.flatMap(n=>n.dbAttrs).map(n=>({...n,modelId:Be()}))}function ex(e,n){var u;const o=e.entities.find(m=>m.modelId===n);if(!o)return[];const i=[];let a;if(!o.attributes.some(m=>m.identifier)){const m=$t(o.attributes),h=new Set(o.attributes.map(y=>y.name));let p="id";for(let y=2;h.has(p);y++)p=`id${y}`;a={modelId:Be(),name:p,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Be(),physicalName:p.toLowerCase(),dataType:"BIGINT"}]},i.push(Ht(n,a))}const r=[];for(const m of e.entities)for(const h of m.attributes){if(((u=h.embedded)==null?void 0:u.embeddableRef)!==n)continue;const p=e.associations.find(g=>g.modelId===h.embedded.associationRef);if(!p)continue;const y=p.end1.entityRef===m.modelId,b=y?p.end1:p.end2,f=y?p.end2:p.end1;r.push({ownerId:m.modelId,dispId:h.modelId,assocId:p.modelId,end1:{entityRef:m.modelId,multiplicity:b.multiplicity,navigable:b.navigable,composition:!1},end2:{entityRef:n,multiplicity:f.multiplicity,navigable:f.navigable,composition:!1}})}const l={...e,entities:e.entities.map(m=>{if(m.modelId===n)return a?{...m,stereotype:"JPA_ENTITY",attributes:[...m.attributes,a]}:{...m,stereotype:"JPA_ENTITY"};const h=new Set(r.filter(p=>p.ownerId===m.modelId).map(p=>p.dispId));return h.size?{...m,attributes:m.attributes.filter(p=>!h.has(p.modelId))}:m}),associations:e.associations.map(m=>{const h=r.find(p=>p.assocId===m.modelId);return h?{...m,end1:h.end1,end2:h.end2}:m})},s=Yo(l,n,Be);for(const m of r){const h=s.add.find(p=>{var y;return((y=p.derivedFrom)==null?void 0:y.associationRef)===m.assocId});h&&(m.end2.attributeRef=h.modelId)}const c=[];for(const m of r)i.push(...un(m.ownerId,[m.dispId],c)),i.push(sa(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...qa(l,n,s,c));const d=Zv(l,n,s);return i.push(...ki(d,n,c)),i.push(...Ot(e,c)),i}function tx(e,n){const o=e.entities.find(r=>r.modelId===n);if(!o)return[];const i=[],a=r=>r&&r.charAt(0).toLowerCase()+r.slice(1);for(const r of e.associations){if(r.end1.entityRef===r.end2.entityRef)continue;const l=r.end1.entityRef===n,s=r.end2.entityRef===n;if(!l&&!s)continue;const c=l?r.end2.entityRef:r.end1.entityRef,d=e.entities.find(_=>_.modelId===c);if(!d||d.attributes.some(_=>{var N;return((N=_.embedded)==null?void 0:N.associationRef)===r.modelId}))continue;const u=Be(),m=$t(d.attributes),h=new Set(d.attributes.map(_=>_.name)),p=a(o.name);let y=p;for(let _=2;h.has(y);_++)y=`${p}${_}`;const b=o.attributes.filter(_=>!_.identifier&&!_.derivedFrom).flatMap(_=>_.dbAttrs).map(_=>({..._,modelId:Be()})),f={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:b,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(Ht(c,f));const g=l?"end2":"end1",k=l?"end1":"end2";i.push(sa(r.modelId,{identifying:!1,[g]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Be()},[k]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function gf(e,n,o,i){var d;const a=e.layout.groupLayouts.find(u=>u.groupRef===n),r=(a==null?void 0:a.geo.location)??o,l=o.x-r.x,s=o.y-r.y,c=[Gc(n,o),...i.map(u=>ko(u.id,u.location))];if(l||s){const u=new Set(((d=e.logical.groups.find(m=>m.modelId===n))==null?void 0:d.memberEntityRefs)??[]);for(const m of e.logical.associations){if(!u.has(m.end1.entityRef)||!u.has(m.end2.entityRef))continue;const h=e.layout.associationLayouts.find(p=>p.associationRef===m.modelId);h&&h.waypoints.length&&c.push(sd(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const h=e.layout.notes.find(p=>p.modelId===m);h&&c.push(Qo(m,{x:h.geo.location.x+l,y:h.geo.location.y+s}))}}return c}function nx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,gateAssocLocked:r}=e;return{addAssociation(l,s,c,d){if(!o.value||a(l)||a(s))return null;const u=Be(),m={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:s,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}},h={...n.logical,associations:[...n.logical.associations,m]},p=Yo(h,s,Be),y=p.add[0];y&&(m.end2.attributeRef=y.modelId);const b={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},f=la(m,b),g=qa(h,s,p,[]);return i(g.length?Je("관계 추가",[f,...g]):f),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(A=>A.modelId===l),d=n.logical.entities.find(A=>A.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Be(),m=Be(),h=Be(),p=$t(c.attributes),y=yf(d),b=A=>A&&A.charAt(0).toLowerCase()+A.slice(1),f=new Set(c.attributes.map(A=>A.name)),g=b(d.name);let k=g;for(let A=2;f.has(k);A++)k=`${g}${A}`;const _={modelId:m,name:k,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:p,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},N={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:h},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},I={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(Je("임베드 추가",[Ht(l,_),la(N,I)])),u},setEmbedCardinality(l,s){var g;if(r(l))return;const c=n.logical.associations.find(k=>k.modelId===l);if(!c)return;let d,u;for(const k of n.logical.entities){const _=k.attributes.find(N=>{var I;return((I=N.embedded)==null?void 0:I.associationRef)===l&&N.attrType==="EMBED_OWN"});if(_){d=k.modelId,u=_;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,h=c.end2.entityRef===m?"end2":"end1",p=c[h];if(p.multiplicity===s)return;const y=k=>k==="ZERO_OR_MORE_INSTANCES"||k==="ONE_OR_MORE_INSTANCES",b=y(p.multiplicity),f=y(s);if(b===f){i(Mt(l,h,{multiplicity:s}));return}if(f)i(Je("임베드 컬렉션 전환",[on(d,u.modelId,{dbAttrs:[]}),Mt(l,h,{multiplicity:s,jpa:{...p.jpa,collectionType:((g=p.jpa)==null?void 0:g.collectionType)??"LIST"}})]));else{const k=n.logical.entities.find(_=>_.modelId===m);if(!k)return;i(Je("임베드 단일 전환",[on(d,u.modelId,{dbAttrs:yf(k)}),Mt(l,h,{multiplicity:s,jpa:{...p.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(p=>p.modelId===l),c=od(l);if(!s){i(c);return}for(const p of n.logical.entities){const y=p.attributes.find(b=>{var f;return((f=b.embedded)==null?void 0:f.associationRef)===l});if(y){const b=[];i(Je("임베드 삭제",[c,...un(p.modelId,[y.modelId],b),...Ot(n.logical,b)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(p=>p.modelId!==l)},m=[],h=Wa(u,[d],m);if(s.end1.attributeRef){const p=n.logical.entities.find(b=>b.modelId===s.end1.entityRef),y=p==null?void 0:p.attributes.find(b=>b.modelId===s.end1.attributeRef&&b.attrType==="RELATION_REF");y&&h.push(...un(p.modelId,[y.modelId],m))}h.push(...Ot(n.logical,m)),i(h.length?Je("관계 삭제",[c,...h]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(y=>y.modelId===l),d=sa(l,{identifying:s});if(!c||c.identifying===s){i(d);return}const u=c.end2.entityRef,m={...n.logical,associations:n.logical.associations.map(y=>y.modelId===l?{...y,identifying:s}:y)},h=[],p=Wa(m,[u],h);p.push(...Ot(n.logical,h)),i(p.length?Je("식별 관계 변경",[d,...p]):d)},updateAssociationEnd(l,s,c){if(r(l))return;const d=n.logical.associations.find(u=>u.modelId===l);if(d&&s==="end1"&&"navigable"in c&&c.navigable!==d.end1.navigable){const u=n.logical.entities.find(p=>p.modelId===d.end1.entityRef),m=n.logical.entities.find(p=>p.modelId===d.end2.entityRef),h=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!h){if(c.navigable===!0&&!d.end1.attributeRef){const p=zi(d.end2.multiplicity),y=d.end1.navFieldNameHint||Ui(m.name,p),b=co(y,new Set(u.attributes.map(_=>_.name))),f=Be(),g=$t(u.attributes),k={modelId:f,name:b,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:g,dbAttrs:[]};i(Je("inverse nav 추가",[Ht(d.end1.entityRef,k),Mt(l,"end1",{...c,attributeRef:f,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const p=d.end1.attributeRef,y=u.attributes.find(k=>k.modelId===p&&k.attrType==="RELATION_REF"),b=Mt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),f=[],g=y?un(d.end1.entityRef,[p],f):[];i(y?Je("inverse nav 제거",[...g,b,...Ot(n.logical,f)]):b);return}}}i(Mt(l,s,c))}}}function ox(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,h)=>{if(a(u))return;const p=on(u,m,h),y=Mo(n.logical,u,g=>g.map(k=>k.modelId===m?{...k,...h}:k)),b=[],f=ki(y,u,b);f.push(...Ot(n.logical,b)),i(f.length?Je("속성 수정",[p,...f]):p)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const h=r.value.find(k=>k.type===m),p=n.logical.entities.find(k=>k.modelId===u);if(!h||!p)return null;const y=$t(p.attributes),b=Be(),f=h.fields.map(()=>({modelId:Be(),physicalName:"",dataType:""})),g={modelId:b,name:h.defaultName,type:h.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:y,dbAttrs:f};return i(Ht(u,g)),b},addAttribute(u,m={}){if(!o.value||a(u))return null;const h=n.logical.entities.find(I=>I.modelId===u),p=h?$t(h.attributes):0,y=m.modelId??Be(),b=m.name??`field${p}`,f={modelId:y,name:b,type:m.type??xr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:p,dbAttrs:m.dbAttrs??[{modelId:Be(),physicalName:b,dataType:"VARCHAR"}],...m},g=Ht(u,f),k=Mo(n.logical,u,I=>[...I,f]),_=[],N=ki(k,u,_);return N.push(...Ot(n.logical,_)),i(N.length?Je("속성 추가",[g,...N]):g),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(b=>b.modelId===u),h=m?$t(m.attributes):0,p=Be();return i(Ht(u,{modelId:p,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:h,dbAttrs:[]})),p},updateAttribute(u,m,h){d(u,m,h)},setAttributeGroupCode(u,m,h){d(u,m,{groupCode:h,type:h?uo:xr})},setEmbedColumns(u,m,h){var k,_;if(a(u))return;const p=on(u,m,{dbAttrs:h}),y=(k=n.logical.entities.find(N=>N.modelId===u))==null?void 0:k.attributes.find(N=>N.modelId===m),b=(_=y==null?void 0:y.embedded)==null?void 0:_.associationRef,f=b?n.logical.associations.find(N=>N.modelId===b):void 0,g=[];f&&b&&(f.end1.legacyEmbedRaw&&g.push(Mt(b,"end1",{legacyEmbedRaw:void 0})),f.end2.legacyEmbedRaw&&g.push(Mt(b,"end2",{legacyEmbedRaw:void 0}))),i(g.length?Je("임베드 컬럼 수정",[p,...g]):p)},removeAttribute(u,m){if(a(u))return;if(Wi(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const h=[],p=un(u,[m],h),y=Mo(n.logical,u,g=>g.filter(k=>k.modelId!==m)),b=[...ki(y,u,h),...Ot(n.logical,h)],f=[...p,...b];i(f.length===1?f[0]:Je("속성 삭제",f))},removeAttributes(u,m){var k;if(!m.length||a(u))return;const h=m.filter(_=>!Wi(n.logical,u,_));if(h.length<m.length&&s(l("em.attr.fkDeleteHint")),!h.length)return;const p=[],y=un(u,h,p),b=new Set(h),f=Mo(n.logical,u,_=>_.filter(N=>!b.has(N.modelId))),g=[...y,...ki(f,u,p),...Ot(n.logical,p)];i(g.length===1?g[0]:Je("속성 삭제",g)),((k=c.value)==null?void 0:k.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,h){i(ia(u,m,h))},setAttributeSwatches(u,m,h){m.length&&(m.length===1?i(ia(u,m[0],h)):i(Je("속성 색상",m.map(p=>ia(u,p,h)))))},reorderAttributes(u,m,h){if(!m.length||a(u))return;const p=Zr(u,m,h),y=Xv(n.logical,u,m,h);i(y.length?Je("속성 재정렬",[p,...y]):p)}}}function ix(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Be(),n.name=`${e.name}_copy`,(i=n.table)!=null&&i.physicalName&&(n.table.physicalName=`${n.table.physicalName}_copy`);const o=new Map;for(const a of n.attributes){const r=Be();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Be()}for(const a of n.indexes??[]){a.modelId=Be();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Be();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const ax=220;function rx(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||ax));for(const r of e.groupLayouts)i=Math.max(i,r.geo.location.x+r.geo.size.width);let a=1/0;for(const r of n.entityLayouts)a=Math.min(a,r.geo.location.x);for(const r of n.groupLayouts)a=Math.min(a,r.geo.location.x);return!Number.isFinite(i)||!Number.isFinite(a)?{x:0,y:0}:{x:i+80-a,y:0}}const Wl=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function lx(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const b=c.filter(f=>n.logical.entities.some(g=>g.modelId===f));if(b.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:b}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const b=n.logical.entities.find(g=>g.modelId===d.entityId);if(!b)return;const f=[...b.attributes].sort((g,k)=>g.order-k.order).filter(g=>d.ids.includes(g.modelId));if(!f.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:f}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(b=>b.modelId===u),h=n.layout.entityLayouts.find(b=>b.entityRef===u);if(!m)return;const p=(h==null?void 0:h.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let y;if(h){const{entityRef:b,geo:f,locked:g,...k}=h;Object.keys(k).length&&(y=k)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:p,layoutExtras:y}))},paste(){if(!r.value)return[];const c=o.value;if(!c)return[];if(c.kind==="entities")return s.importEntities(c.source,c.selectedIds,{placement:{offset:{x:40,y:40}},collisionSuffix:"_copy"});if(c.kind==="attribute"){const p=a.value;if(!p)return[];const y=n.logical.entities.find(N=>N.modelId===p);if(!y)return[];const b=new Set(y.attributes.map(N=>N.name)),f=new Set(y.attributes.flatMap(N=>N.dbAttrs.map(I=>I.physicalName))),g=$t(y.attributes),k=[],_=c.attributes.map((N,I)=>{const A=JSON.parse(JSON.stringify(N));A.modelId=Be();for(const x of A.dbAttrs)x.modelId=Be();b.has(A.name)&&(A.name=co(`${A.name}_copy`,b)),b.add(A.name);for(const x of A.dbAttrs)x.physicalName&&f.has(x.physicalName)&&(x.physicalName=co(`${x.physicalName}_copy`,f)),x.physicalName&&f.add(x.physicalName);return A.order=g+I,k.push(A.modelId),Ht(p,A)});return l(_.length===1?_[0]:Je("속성 붙여넣기",_)),i.value={kind:"attribute",entityId:p,ids:k,anchor:k[k.length-1]},[]}const{clone:d,idMap:u}=ix(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let h;if(c.layoutExtras){const p={...c.layoutExtras},y=b=>u.get(b);p.attributeStyles&&(p.attributeStyles=ea(p.attributeStyles,y)),p.operationStyles&&(p.operationStyles=ea(p.operationStyles,y)),h=p}return l(oa(d,m,h)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Sc(c,d,{existing:n.logical,includeRelated:u==null?void 0:u.includeRelated,collisionSuffix:u==null?void 0:u.collisionSuffix});if(m.logical.entities.length===0)return[];const h=(u==null?void 0:u.placement)??"append-right",p=h==="append-right"?rx(n.layout,m.layout):h.offset,y=new Map(m.layout.entityLayouts.map(_=>[_.entityRef,_])),b=new Map(m.layout.associationLayouts.map(_=>[_.associationRef,_])),f=new Map(m.layout.groupLayouts.map(_=>[_.groupRef,_])),g=[];let k=80;for(const _ of m.logical.entities){const N=y.get(_.modelId),I=N?{location:Wl(N.geo.location,p),size:{...N.geo.size}}:{location:{x:k+=40,y:80},size:{width:220,height:140}};let A;if(N){const{entityRef:x,geo:$,locked:T,...V}=N;A=V}g.push(oa(_,I,A))}for(const _ of m.logical.associations){const N=b.get(_.modelId),I=N?{...N,waypoints:N.waypoints.map(A=>Wl(A,p))}:{associationRef:_.modelId,waypoints:[]};g.push(la(_,I))}for(const _ of m.logical.groups){const N=f.get(_.modelId),I=N?{location:Wl(N.geo.location,p),size:{...N.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let A;if(N){const{groupRef:x,geo:$,locked:T,memberNoteRefs:V,...R}=N;A=R}g.push(aa(_,I,A))}return l(Je("다이어그램 가져오기",g)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(_=>_.modelId)}};return s}function sx(e){const{state:n,editable:o,run:i,gateEntityLocked:a,isEntityLockedFn:r,isAssocLockedFn:l}=e;return{addEntity(s="NewEntity",c={x:80,y:80}){if(!o.value)return null;const d=Be(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:Be(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Be(),physicalName:"id",dataType:"BIGINT"}]}]};return i(oa(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(Oc(s,c))},updateEntity(s,c){if(a(s))return;const d=Lc(s,c),u=n.logical.entities.find(p=>p.modelId===s),m=c.stereotype==="JPA_EMBEDDABLE"&&!!u&&u.stereotype!=="JPA_EMBEDDABLE",h=!!c.stereotype&&c.stereotype!=="JPA_EMBEDDABLE"&&!!u&&u.stereotype==="JPA_EMBEDDABLE";if(m&&u){const p=u.attributes.filter(_=>_.identifier&&!_.derivedFrom).map(_=>on(s,_.modelId,{identifier:!1})),y=Mo({...n.logical,entities:n.logical.entities.map(_=>_.modelId===s?{..._,stereotype:"JPA_EMBEDDABLE"}:_)},s,_=>_.map(N=>N.identifier&&!N.derivedFrom?{...N,identifier:!1}:N)),b=[],f=Wa(y,[s],b);f.push(...Ot(n.logical,b));const g=tx(n.logical,s),k=[d,...p,...f,...g];i(k.length>1?Je("임베더블 변환",k):d);return}if(h){const p=ex(n.logical,s),y=[d,...p];i(y.length>1?Je("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(ko(s,c))},resizeEntity(s,c){a(s)||i(Pc(s,c))},removeEntity(s){if(a(s))return;const c=Dc(s);if(!n.logical.entities.find(f=>f.modelId===s)){i(c);return}const u=n.logical.associations.filter(f=>f.end1.entityRef===s||f.end2.entityRef===s),m=new Set(u.map(f=>f.modelId)),h=[],p=[];for(const f of n.logical.entities)if(f.modelId!==s)for(const g of f.attributes)g.embedded&&m.has(g.embedded.associationRef)&&h.push(...un(f.modelId,[g.modelId],p));for(const f of u){if(f.end1.entityRef===s||!f.end1.attributeRef)continue;const g=n.logical.entities.find(_=>_.modelId===f.end1.entityRef),k=g==null?void 0:g.attributes.find(_=>_.modelId===f.end1.attributeRef&&_.attrType==="RELATION_REF");k&&h.push(...un(g.modelId,[k.modelId],p))}const y={...n.logical,entities:n.logical.entities.filter(f=>f.modelId!==s),associations:n.logical.associations.filter(f=>!m.has(f.modelId))},b=new Set(u.filter(f=>f.end1.entityRef===s&&f.end2.entityRef!==s).map(f=>f.end2.entityRef));h.push(...Wa(y,[...b],p)),h.push(...Ot(n.logical,p.filter(f=>f.entityId!==s))),i(h.length?Je("엔티티 삭제",[c,...h]):c)},setEntitySwatch(s,c){i(zc(s,c))},setEntityCollapsed(s,c){i(Fc(s,c))},setEntityLocked(s,c){i(Uc(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(Xr(!0))},expandAll(){i(Xr(!1))}}}function cx(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(g=>n.layout.entityLayouts.find(k=>k.entityRef===g)).filter(g=>!!g);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,h=1/0,p=-1/0,y=-1/0;for(const g of u){const k=g.geo.size.width||220,_=g.geo.size.height||140;m=Math.min(m,g.geo.location.x),h=Math.min(h,g.geo.location.y),p=Math.max(p,g.geo.location.x+k),y=Math.max(y,g.geo.location.y+_)}const b=40,f=28;return{location:{x:m-b,y:h-b-f},size:{width:p-m+b*2,height:y-h+b*2+f}}}return{dragGroup(d,u,m){l(d)||i(Je("그룹 이동",gf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(Yc(d,u))},setGroupSwatch(d,u){i(qc(d,u))},setGroupLocked(d,u){i(Wc(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(Hc(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const b of d)y.memberEntityRefs.includes(b)&&m.push(ra(y.modelId,b));const h=Be(),p={modelId:h,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(aa(p,c(d))),i(Je("그룹 생성",m)),a.value=null,h},addEmptyGroup(d,u){if(!o.value)return null;const m=Be();return i(aa({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(jc(d))},dropEntity(d,u,m){var y;if(r(d))return;const h=((y=n.logical.groups.find(b=>b.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,p=[ko(d,u)];h!==m&&(h&&p.push(ra(h,d)),m&&p.push(Kc(m,d))),i(Je("이동",p))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(ra(u.modelId,d))},dropNote(d,u,m){var y;const h=((y=n.layout.groupLayouts.find(b=>{var f;return(f=b.memberNoteRefs)==null?void 0:f.includes(d)}))==null?void 0:y.groupRef)??null,p=[Qo(d,u)];h!==m&&(h&&p.push(gd(h,d)),m&&p.push(yd(m,d))),i(Je("이동",p))}}}function dx(e){const{state:n,opMode:o,editable:i,opConflict:a,historyTransport:r,restoreTransport:l}=e;let s=null,c=null;function d(){c==null||c(),c=null,s=null}function u(b,f){if(d(),!o.value||!e.opTransport)return;const g=new vd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:k=>{i.value=!1,a.value=k},onError:e.onOpError});g.seed((f==null?void 0:f.revSeed)??{}),c=g.attach(b),s=g}const m=t.computed(()=>o.value&&r!==void 0),h=t.ref(0),p=t.computed(()=>o.value&&i.value&&l!==void 0);async function y(b){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let f;try{f=await l(b)}catch(g){return{ok:!1,reason:g instanceof Error?g.message:String(g)}}return f.ok&&h.value++,f}return{setupOpAdapter:u,teardownOpAdapter:d,flush(){s==null||s.flush()},whenOpsSettled(){return(s==null?void 0:s.whenSettled())??Promise.resolve()},historyTransport:r,historyAvailable:m,restoreTransport:l,restoreAvailable:p,restoreToSeq:y,reloadRequest:h}}function ux(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Be();return o(ud({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(md(i))},moveNote(i,a){o(Qo(i,a))},resizeNote(i,a){o(fd(i,a))},setNoteMemo(i,a){o(pd(i,a))},setNoteSwatch(i,a){o(hd(i,a))},addNoteConnection(i,a){o(bd(i,a))},removeNoteConnection(i,a){o(_d(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(kd(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Ed(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Nd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(wd(i,a))}}}function mx(e){const{state:n,selection:o,focusRequest:i,run:a,gateEntityLocked:r,isEntityLockedFn:l,isGroupLockedFn:s}=e;let c=0;return{selectAttribute(d,u,m="replace"){const h=o.value,p=(h==null?void 0:h.kind)==="attribute"&&h.entityId===d;if(m==="replace"||!p){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const N=h.ids.includes(u),I=N?h.ids.filter(x=>x!==u):[...h.ids,u];if(!I.length){o.value=null;return}const A=N&&h.anchor===u?I[I.length-1]:N?h.anchor:u;o.value={kind:"attribute",entityId:d,ids:I,anchor:A};return}const y=n.logical.entities.find(N=>N.modelId===d),b=[...(y==null?void 0:y.attributes)??[]].sort((N,I)=>N.order-I.order).map(N=>N.modelId),f=b.indexOf(h.anchor),g=b.indexOf(u);if(f<0||g<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[k,_]=f<=g?[f,g]:[g,f];o.value={kind:"attribute",entityId:d,ids:b.slice(k,_+1),anchor:h.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(b=>b.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const h=m.attributes.findIndex(b=>b.modelId===u.anchor);if(h<0)return!1;const p=Math.min(Math.max(h+d,0),m.attributes.length-1);if(p===h)return!0;const y=m.attributes[p].modelId;return o.value={kind:"attribute",entityId:u.entityId,ids:[y],anchor:y},!0},nudgeSelectedAttributes(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(N=>N.modelId===u.entityId);if(!m)return!1;const h=m.attributes,p=new Set(u.ids),y=h.map((N,I)=>p.has(N.modelId)?I:-1).filter(N=>N>=0);if(!y.length)return!1;const b=Math.min(...y),f=h.filter(N=>!p.has(N.modelId)),g=h.slice(0,b).filter(N=>!p.has(N.modelId)).length;let k;if(d<0){if(g<=0)return!0;k=g-1}else{if(f.length-g<=0)return!0;k=g+1}if(r(u.entityId))return!0;const _=h.filter(N=>p.has(N.modelId)).map(N=>N.modelId);return a(Zr(u.entityId,_,k)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const h=new Set(n.logical.entities.map(k=>k.modelId)),p=new Set(n.logical.groups.map(k=>k.modelId)),y=new Set(n.layout.notes.map(k=>k.modelId)),b=new Set;for(const k of d){if(!p.has(k))continue;const _=n.logical.groups.find(N=>N.modelId===k);for(const N of(_==null?void 0:_.memberEntityRefs)??[])b.add(N)}const f=[],g=[];for(const k of d)if(p.has(k)){if(s(k))continue;const _=n.layout.groupLayouts.find(x=>x.groupRef===k);if(!_)continue;const N=n.logical.groups.find(x=>x.modelId===k),I=((N==null?void 0:N.memberEntityRefs)??[]).map(x=>{var T;const $=((T=n.layout.entityLayouts.find(V=>V.entityRef===x))==null?void 0:T.geo.location)??{x:0,y:0};return{id:x,location:{x:$.x+u,y:$.y+m}}}),A={x:_.geo.location.x+u,y:_.geo.location.y+m};f.push(Je("그룹 이동",gf(n,k,A,I))),g.push("g:"+k)}else if(h.has(k)){if(b.has(k)||l(k))continue;const _=n.layout.entityLayouts.find(N=>N.entityRef===k);if(!_)continue;f.push(ko(k,{x:_.geo.location.x+u,y:_.geo.location.y+m})),g.push("e:"+k)}else if(y.has(k)){const _=n.layout.notes.find(N=>N.modelId===k);if(!_)continue;f.push(Qo(k,{x:_.geo.location.x+u,y:_.geo.location.y+m})),g.push("n:"+k)}return f.length?(a(Je("이동",f,"nudge:"+g.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const to=Symbol("editorController");function bf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function fx(e=bf(),n={}){var ne,G;const o=t.reactive(e);let i=new Jr(o);const a=t.ref(n.embeddableCatalog??[]),r=t.ref(n.groupCodeCatalog??[]),l=t.ref(n.predefinedCustomTypeCatalog??[]),s=t.ref(n.superClassCatalog??[]),c=t.ref(n.languages??["ko","en","ja","zh"]),d=t.ref(n.userLanguage??"ko"),u=t.ref(n.uiLocale??"ko"),m=(P,ae)=>Lt(u.value,P,ae),h=t.ref(n.reservedWords),p=t.ref(n.selectableDataTypes),y=t.ref(n.largeEntityThreshold),b=t.ref(n.flagEntitiesWithoutRelations??!1),f=t.ref(!1),g=t.ref(!1),k=t.ref(!1),_=t.ref(0),N=t.ref(null);let I=0;const A=P=>{if(n.onNotice){n.onNotice(P);return}N.value={text:P,id:++I}},x=t.ref(((ne=n.meta)==null?void 0:ne.schemaVersion)??1),$=t.ref(((G=n.meta)==null?void 0:G.opWriteEnabled)??!1),T=t.computed(()=>x.value>=2&&$.value),V=t.ref(!(x.value>=2&&$.value===!1)),R=t.ref("LOGICAL_PHYSICAL"),C=t.ref("straight"),M=t.ref(!0),E=t.ref(!0),w=t.ref(null),S=t.computed(()=>{var P;return((P=w.value)==null?void 0:P.kind)==="attribute"?{entityId:w.value.entityId,attrId:w.value.anchor}:null}),B=t.computed(()=>{var P;return((P=w.value)==null?void 0:P.kind)==="attribute"?w.value.ids:[]}),z=t.computed(()=>{var P,ae;return((P=w.value)==null?void 0:P.kind)==="entity"?w.value.id:((ae=w.value)==null?void 0:ae.kind)==="attribute"?w.value.entityId:null}),K=t.ref(null),J=t.ref(null),re=t.ref(null),pe=t.ref(null),ce=dx({state:o,opMode:T,editable:V,opConflict:re,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function Ne(){i.onChange(()=>{f.value=i.canUndo,g.value=i.canRedo,k.value=i.isDirty,_.value++})}Ne(),ce.setupOpAdapter(i,n.meta);const he=t.computed(()=>ws(o.logical,o.layout)),de=t.computed(()=>({reservedWords:h.value,selectableDataTypes:p.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:b.value,embeddableCatalog:a.value,superClassCatalog:s.value})),_e=n.validationDebounceMs??250;let Se,me=()=>{};if(_e>0){const P=t.shallowRef(Ji(o.logical,de.value));let ae;me=()=>{ae!==void 0&&(clearTimeout(ae),ae=void 0),P.value=Ji(o.logical,de.value)},t.watch([_,de],()=>{ae!==void 0&&clearTimeout(ae),ae=setTimeout(me,_e)},{flush:"sync"}),Se=t.computed(()=>P.value)}else Se=t.computed(()=>Ji(o.logical,de.value));const ye=t.computed(()=>{const P=new Map;for(const ae of Se.value){if(!ae.targetRef)continue;const Re=P.get(ae.targetRef);Re?Re.push(ae):P.set(ae.targetRef,[ae])}return P}),ie=1500,se=new Map,fe=P=>{const ae=Date.now();ae-(se.get(P)??0)<ie||(se.set(P,ae),A(P))},O=P=>{if(!pe.value){if(!V.value){fe(m("em.notice.readOnly"));return}try{i.execute(P)}catch(ae){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${P.label}):`,ae),V.value=!1,pe.value={label:P.label}}}},L=P=>o.layout.entityLayouts.some(ae=>ae.entityRef===P&&!!ae.locked),F=P=>o.layout.groupLayouts.some(ae=>ae.groupRef===P&&!!ae.locked),Q=P=>{const ae=o.logical.associations.find(Re=>Re.modelId===P);return!!ae&&(L(ae.end1.entityRef)||L(ae.end2.entityRef))},Y=P=>L(P)?(fe(m("em.notice.entityLocked")),!0):!1,ke=P=>F(P)?(fe(m("em.notice.groupLocked")),!0):!1,be=P=>Q(P)?(fe(m("em.notice.assocLocked")),!0):!1,Ce=lx({state:o,clipboard:J,selection:w,inspectedEntityId:z,editable:V,run:O}),ve=mx({state:o,selection:w,focusRequest:K,run:O,gateEntityLocked:Y,isEntityLockedFn:L,isGroupLockedFn:F}),U=sx({state:o,editable:V,run:O,gateEntityLocked:Y,isEntityLockedFn:L,isAssocLockedFn:Q}),H=ox({state:o,editable:V,run:O,gateEntityLocked:Y,embeddableCatalog:a,t:m,emitGateNotice:fe,selection:w}),q=cx({state:o,editable:V,run:O,selection:w,gateEntityLocked:Y,gateGroupLocked:ke,isGroupLockedFn:F}),xe=ux({editable:V,run:O}),De=nx({state:o,editable:V,run:O,gateEntityLocked:Y,gateAssocLocked:be});return{state:o,resolved:he,issues:Se,issuesByRef:ye,flagEntitiesWithoutRelations:b,canUndo:f,canRedo:g,dirty:k,revision:_,notice:N,editable:V,schemaVersion:x,opWriteEnabled:$,opMode:T,opConflict:re,commandFailure:pe,historyTransport:ce.historyTransport,historyAvailable:ce.historyAvailable,restoreTransport:ce.restoreTransport,restoreAvailable:ce.restoreAvailable,restoreToSeq:ce.restoreToSeq,reloadRequest:ce.reloadRequest,displayMode:R,routingMode:C,showGrid:M,showMinimap:E,selection:w,selectedAttr:S,selectedAttrIds:B,inspectedEntityId:z,focusRequest:K,clipboard:J,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,uiLocale:u,t:m,selectableDataTypes:p,setEditable(P){V.value=P&&T.value},setEmbeddableCatalog(P){a.value=P},setGroupCodeCatalog(P){r.value=P},setPredefinedCustomTypeCatalog(P){l.value=P},setSuperClassCatalog(P){s.value=P},selectAttribute:ve.selectAttribute,moveAttributeFocus:ve.moveAttributeFocus,nudgeSelectedAttributes:ve.nudgeSelectedAttributes,nudgeNodes:ve.nudgeNodes,requestFocus:ve.requestFocus,deleteSelection(){if(!V.value)return!1;const P=w.value;if(!P)return!1;if(P.kind==="attribute"){if(Y(P.entityId))return!1;const ae=P.ids;if(!ae.length)return!1;ae.length===1?H.removeAttribute(P.entityId,ae[0]):H.removeAttributes(P.entityId,ae)}else if(P.kind==="entity"){if(Y(P.id))return!1;U.removeEntity(P.id)}else if(P.kind==="note")xe.removeNote(P.id);else if(P.kind==="group"){if(ke(P.id))return!1;q.removeGroup(P.id)}else De.removeAssociation(P.id);return w.value=null,!0},undo:()=>{V.value&&i.undo()},redo:()=>{V.value&&i.redo()},markSaved:()=>{V.value&&(ce.flush(),i.markSavePoint())},loadDiagram(P,ae){ce.teardownOpAdapter(),o.logical=P.logical,o.layout=P.layout,i=new Jr(o),Ne(),x.value=(ae==null?void 0:ae.schemaVersion)??1,$.value=(ae==null?void 0:ae.opWriteEnabled)??!1,V.value=!(x.value>=2&&$.value===!1),re.value=null,pe.value=null,w.value=null,f.value=i.canUndo,g.value=i.canRedo,k.value=i.isDirty,ce.setupOpAdapter(i,ae),me()},flush:ce.flush,whenOpsSettled:ce.whenOpsSettled,addEntity:U.addEntity,renameEntity:U.renameEntity,updateEntity:U.updateEntity,moveEntity:U.moveEntity,resizeEntity:U.resizeEntity,removeEntity:U.removeEntity,setEntitySwatch:U.setEntitySwatch,setEntityCollapsed:U.setEntityCollapsed,setEntityLocked:U.setEntityLocked,isEntityLocked:U.isEntityLocked,isAssociationLocked:U.isAssociationLocked,collapseAll:U.collapseAll,expandAll:U.expandAll,setAttributeSwatch:H.setAttributeSwatch,dragGroup:q.dragGroup,resizeGroup:q.resizeGroup,setGroupSwatch:q.setGroupSwatch,setGroupLocked:q.setGroupLocked,isGroupLocked:q.isGroupLocked,updateGroup:q.updateGroup,createGroup:q.createGroup,addEmptyGroup:q.addEmptyGroup,removeGroup:q.removeGroup,dropEntity:q.dropEntity,ungroupEntity:q.ungroupEntity,dropNote:q.dropNote,addPredefinedEmbed:H.addPredefinedEmbed,addAttribute:H.addAttribute,addDivider:H.addDivider,updateAttribute:H.updateAttribute,setAttributeGroupCode:H.setAttributeGroupCode,setEmbedColumns:H.setEmbedColumns,removeAttribute:H.removeAttribute,removeAttributes:H.removeAttributes,setAttributeSwatches:H.setAttributeSwatches,reorderAttributes:H.reorderAttributes,addIndex(P,ae){Y(P)||O(id(P,ae))},updateIndex(P,ae,Re){Y(P)||O(ca(P,ae,Re))},removeIndex(P,ae){Y(P)||O(ad(P,ae))},addOperation(P,ae={}){if(!V.value||Y(P))return null;const Re=o.logical.entities.find(rt=>rt.modelId===P),le=Re!=null&&Re.operations?$t(Re.operations):0,j=ae.modelId??Be(),Xe={modelId:j,name:ae.name??`method${le}`,visibility:ae.visibility??"PACKAGE",order:le,...ae};return O(Zc(P,Xe)),j},updateOperation(P,ae,Re){Y(P)||O(Qc(P,ae,Re))},removeOperation(P,ae){Y(P)||O(ed(P,ae))},reorderOperations(P,ae,Re){!ae.length||Y(P)||O(td(P,ae,Re))},setOperationSwatch(P,ae,Re){O(nd(P,ae,Re))},addAssociation:De.addAssociation,addEmbedAssociation:De.addEmbedAssociation,setEmbedCardinality:De.setEmbedCardinality,removeAssociation:De.removeAssociation,setAssociationIdentifying:De.setAssociationIdentifying,updateAssociationEnd:De.updateAssociationEnd,hasQuickFix(P){if(!V.value)return!1;const ae=Dr(P,o.logical);return ae?ae.kind==="setEndCascades"?!Q(ae.assocRef):!L(ae.entityRef):!1},applyQuickFix(P){if(!V.value)return!1;const ae=Dr(P,o.logical);if(!ae)return!1;if(ae.kind==="setIndexColumns")return Y(ae.entityRef)?!1:(O(ca(ae.entityRef,ae.indexRef,{columns:ae.columns})),!0);if(be(ae.assocRef))return!1;const Re=o.logical.associations.find(le=>le.modelId===ae.assocRef);return Re?(O(Mt(ae.assocRef,ae.which,{jpa:{...Re[ae.which].jpa,cascadeTypes:ae.cascades}})),!0):!1},moveWaypoint(P,ae,Re){O(rd(P,ae,Re))},addWaypoint(P,ae,Re){O(dd(P,ae,Re))},removeWaypoint(P,ae){O(ld(P,ae))},clearWaypoints(P){O(cd(P))},addNote:xe.addNote,removeNote:xe.removeNote,moveNote:xe.moveNote,resizeNote:xe.resizeNote,setNoteMemo:xe.setNoteMemo,setNoteSwatch:xe.setNoteSwatch,addNoteConnection:xe.addNoteConnection,removeNoteConnection:xe.removeNoteConnection,moveNoteConnectionWaypoint:xe.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:xe.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:xe.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:xe.clearNoteConnectionWaypoints,autoLayout(){const P=Is(o.logical,o.layout);P.length&&O(Je("자동 배치",P.map(ae=>ko(ae.id,ae.location))))},copy:Ce.copy,paste:Ce.paste,importEntities:Ce.importEntities}}const Ja=Symbol("groupHover"),_f=Symbol("groupDrag"),Vo=Symbol("relationHighlight"),kf=Symbol("diffOverlay"),Ef=Symbol("nodeInternals"),Nf=Symbol("columnResolution");function px(e,n){const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(i[r]!==a[r])return!1;return!0}function wf(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!px(e[o],n[o]))return!1;return!0}function hx(e,n){if(e===n)return!0;const o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;const i=e,a=n;for(const r of o)if(r==="dbAttrs"){if(!wf(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function yx(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function gx(e,n){if(e.effectiveAttrs.size!==n.effectiveAttrs.size||e.embedCols.size!==n.embedCols.size||e.collectionTypes.size!==n.collectionTypes.size||e.redundantSlots.size!==n.redundantSlots.size)return!1;for(const[o,i]of e.redundantSlots){const a=n.redundantSlots.get(o);if(!a||!yx(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!hx(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!wf(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!0}function bx(){let e;return(n,o)=>e=_x(n,o,e)}function _x(e,n,o){const i=e.entities,a=new Map;for(const r of i){const l=new Map,s=new Map,c=new Map;let d=null;const u=()=>d??(d=so(En(r,i)));for(const b of r.attributes){if(Bi(b)){const _=b.dbAttrs[0];if(!(_!=null&&_.physicalName&&(_!=null&&_.dataType))){const N=Di(b,r,i,e.associations);N&&l.set(b.modelId,{...b,dbAttrs:[{..._,physicalName:(_==null?void 0:_.physicalName)||N.physicalName,dataType:(_==null?void 0:_.dataType)||N.dataType,length:(_==null?void 0:_.length)??N.length,scale:(_==null?void 0:_.scale)??N.scale},...b.dbAttrs.slice(1)]})}}const f=Cr(b,e.associations);if(f&&c.set(b.modelId,f),!b.attrType.startsWith("EMBED")||b.dbAttrs.length===0)continue;if(b.attrType!=="EMBED_PREDEF"){const _=u();s.set(b.modelId,b.dbAttrs.map((N,I)=>{const A=Bn(N,_);return A?{...N,physicalName:A.physicalName}:lo(b,N,I,r,e)}));continue}const g=n==null?void 0:n.find(_=>_.type===b.type);if(!g)continue;const k=u();s.set(b.modelId,b.dbAttrs.map((_,N)=>{const I=g.fields[N],A=Bn(_,k);return A?{..._,physicalName:A.physicalName,logicalName:_.logicalName??(I==null?void 0:I.logicalName),dataType:_.dataType||(I==null?void 0:I.dataType)||""}:I?{..._,physicalName:_.physicalName||I.physicalName,logicalName:_.logicalName??I.logicalName,dataType:_.dataType||I.dataType,length:_.length??I.length}:_}))}const m=new Map,h=new Map;for(const b of r.attributes){const f=s.get(b.modelId);if(f)for(let g=0;g<f.length;g++){const k=`${b.attrType}\0${b.type??""}\0${g}`,_={attrId:b.modelId,slot:g,name:f[g].physicalName??""},N=h.get(k);N?N.push(_):h.set(k,[_])}}for(const b of h.values()){if(b.length<2)continue;const f=new Map;for(const g of b)f.set(g.name,(f.get(g.name)??0)+1);for(const g of b){if((f.get(g.name)??0)<2)continue;const k=m.get(g.attrId);k?k.add(g.slot):m.set(g.attrId,new Set([g.slot]))}}const p={effectiveAttrs:l,embedCols:s,collectionTypes:c,redundantSlots:m},y=o==null?void 0:o.get(r.modelId);a.set(r.modelId,y&&gx(p,y)?y:p)}return a}const If=Symbol("embedSlotCollapse"),vf=(e,n)=>`${e}:${n}`,xf="all:",Cf="one:",Sf=e=>`${xf}${e}`,Rf=(e,n)=>`${Cf}${e}:${n}`,kx=e=>!e.startsWith(xf)&&!e.startsWith(Cf),Ex={key:0,class:"em-sel","aria-hidden":"true"},Nx=["title","aria-expanded","disabled"],wx={class:"em-entity__stereotype"},Ix={key:1,class:"em-entity__name"},vx=["title","aria-expanded"],xx={"aria-hidden":"true"},Cx=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],Sx=["onPointerdown"],Rx={key:1,class:"em-entity__divider-label"},$x=["title"],Ax={class:"em-key-slot"},Tx={class:"em-key-slot"},Mx=["title","aria-expanded","onClick"],Vx=["title","onClick"],Bx=["title","aria-expanded","onClick"],Dx={key:2,class:"em-entity__type"},Lx=["onClick"],Ox={class:"em-entity__attrname"},Px={class:"em-entity__type"},zx={key:1,class:"em-entity__embed-summary"},Fx=["title"],Ux=["data-op"],Hx=["onPointerdown"],jx={class:"em-entity__op-vis","aria-hidden":"true"},Kx=["title"],Gx={key:4,class:"em-entity__footer"},$f=Ke(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(to,null),i=(oe,v)=>o?o.t(oe,v):Lt("ko",oe,v),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=te.useModal();function l(){o&&Ya(r,o,n.id)}const s=t.inject(Ja,null),c=t.inject(Vo,null),d=t.inject(kf,null),u=t.computed(()=>{var oe;return((oe=d==null?void 0:d.marks.value)==null?void 0:oe.get(n.id))??null}),m=t.inject(Nf,null),h=t.computed(()=>m==null?void 0:m.value.get(n.id)),p=t.inject(If,void 0),y=t.inject(Ef,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const b=t.computed(()=>!!o&&o.editable.value);function f(){s&&(s.value=n.data.groupRef??null)}function g(){c==null||c.setEntityHover(n.id)}function k(){c==null||c.setEntityHover(null)}const _=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),N=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!_.value),I=t.computed(()=>{var oe;return((oe=o==null?void 0:o.selection.value)==null?void 0:oe.kind)==="entity"&&o.selection.value.id===n.id}),A=t.computed(()=>!!n.selected&&!I.value),x=t.computed(()=>{var oe;return o&&((oe=o.selectedAttr.value)==null?void 0:oe.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),$=t.computed(()=>x.value.size>0);function T(oe,v){const D=v.shiftKey?"range":v.metaKey||v.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,oe.modelId,D)}const V=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!I.value),R=t.computed(()=>n.data.entity),C=t.computed(()=>[...R.value.attributes].sort((oe,v)=>oe.order-v.order)),M=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),E=t.computed(()=>n.data.collapsed??!1),w=t.computed(()=>n.data.locked??!1),S=t.computed(()=>b.value&&!w.value);function B(){b.value&&(o==null||o.setEntityCollapsed(n.id,!E.value))}const z=t.computed(()=>M.value==="PHYSICAL"||M.value==="LOGICAL_PHYSICAL"),K=t.computed(()=>{const oe=M.value==="PHYSICAL"||M.value==="LOGICAL_PHYSICAL",v={};for(const D of C.value){const ee=D.attrType.startsWith("RELATION")&&D.dbAttrs.length>0;v[D.modelId]={pk:D.identifier,fk:ee&&oe,required:D.notNull&&!D.identifier}}return v});function J(oe){if(!oe)return"";const v=[];return oe.pk&&oe.fk?v.push(i("em.node.keyPfk")):oe.pk?v.push(i("em.node.keyPk")):oe.fk&&v.push(i("em.node.keyFk")),oe.required&&v.push(i("em.node.required")),v.join(" · ")}const re=t.computed(()=>{const oe=Kl(_t(n.data.style)),v={};return oe&&(v["--em-header-bg"]=oe.bar,v["--em-header-fg"]=oe.barOn),v});function pe(oe){var v,D;return(D=Kl(_t((v=n.data.attributeStyles)==null?void 0:v[oe.modelId])))==null?void 0:D.text}const ce=t.computed(()=>[...R.value.operations??[]].sort((oe,v)=>oe.order-v.order)),Ne=t.computed(()=>M.value==="CLASS"&&ce.value.length>0),he={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function de(oe){return oe?he[oe]:"~"}function _e(oe){var v,D;return(D=Kl(_t((v=n.data.operationStyles)==null?void 0:v[oe.modelId])))==null?void 0:D.text}function Se(oe,v,D){switch(M.value){case"CLASS":return[{text:oe}];case"PHYSICAL":return[{text:D||oe}];case"LOGICAL":return[v?{text:v}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const ee=v?{text:v}:{text:i("em.node.logicalMissing"),missing:!0};return D?[ee,{text:` · ${D}`}]:[ee]}}}function me(oe){var v;return((v=h.value)==null?void 0:v.effectiveAttrs.get(oe.modelId))??oe}function ye(oe){var D,ee,Z;if(ie(oe))return[{text:oe.name}];const v=me(oe);return Se(oe.name,(ee=(D=v.dbAttrs[0])==null?void 0:D.logicalName)==null?void 0:ee[a.value],((Z=v.dbAttrs[0])==null?void 0:Z.physicalName)??"")}function ie(oe){return oe.attrType.startsWith("EMBED")&&oe.dbAttrs.length>0}function se(oe){return oe.attrType==="DIVIDER"}function fe(oe){var v;return((v=h.value)==null?void 0:v.embedCols.get(oe.modelId))??oe.dbAttrs}function O(oe){var v;return(v=h.value)==null?void 0:v.redundantSlots.get(oe.modelId)}const L=t.computed(()=>(p==null?void 0:p.isCollapsed(Sf(n.id)))??!1),F=t.computed(()=>L.value&&z.value?C.value.reduce((oe,v)=>ie(v)?oe+fe(v).length:oe,0):0),Q=t.computed(()=>C.value.some(oe=>ie(oe)));function Y(oe){const v=O(oe);return!v||v.size===0?!1:p?p.isCollapsed(vf(n.id,oe.modelId)):!1}function ke(oe){var v;return Y(oe)?((v=O(oe))==null?void 0:v.size)??0:0}function be(oe){return p?p.isCollapsed(Rf(n.id,oe.modelId)):!1}function Ce(oe){var v;return!z.value||L.value?null:be(oe)?"attr":(((v=O(oe))==null?void 0:v.size)??0)>0?"slot":null}function ve(oe){return!L.value&&ie(oe)}function U(oe){return be(oe)?fe(oe).length:0}function H(oe){if(L.value||be(oe))return[];const v=fe(oe);if(!Y(oe))return v;const D=O(oe);return v.filter((ee,Z)=>!D.has(Z))}function q(oe){p==null||p.toggle(vf(n.id,oe.modelId))}function xe(oe){p==null||p.toggle(Rf(n.id,oe.modelId))}function De(){p==null||p.toggle(Sf(n.id))}function W(oe){var v;return Se(oe.physicalName,(v=oe.logicalName)==null?void 0:v[a.value],oe.physicalName)}function ne(oe){var D;const v=(D=h.value)==null?void 0:D.collectionTypes.get(oe.modelId);return Sr(M.value,me(oe),v)}const G=t.computed(()=>{const oe={};for(const v of C.value)oe[v.modelId]=ne(v);return oe}),P=t.computed(()=>{var oe,v,D;return Se(R.value.name,(v=(oe=R.value.table)==null?void 0:oe.logicalName)==null?void 0:v[a.value],((D=R.value.table)==null?void 0:D.physicalName)??"")}),ae=t.ref(!1),Re=t.ref(""),le=t.ref(null);async function j(){var oe,v;S.value&&(Re.value=R.value.name,ae.value=!0,await t.nextTick(),(oe=le.value)==null||oe.focus(),(v=le.value)==null||v.select())}function Xe(){if(!ae.value)return;ae.value=!1;const oe=Re.value.trim();oe&&oe!==R.value.name&&(o==null||o.renameEntity(n.id,oe))}function rt(){o==null||o.addAttribute(n.id)}function He(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:Pe,findNode:Oe}=je(),X=t.ref(null),Nt=t.computed(()=>{const oe=X.value??n.data.size;return oe?{width:`${oe.width}px`,minHeight:`${oe.height}px`}:void 0});let Et=null;function yn(oe){var ee,Z,Ie;if(!S.value)return;oe.stopPropagation();const v=(ee=Oe(n.id))==null?void 0:ee.dimensions,D=Pe({x:oe.clientX,y:oe.clientY});Et={fx:D.x,fy:D.y,w:(v==null?void 0:v.width)??((Z=n.data.size)==null?void 0:Z.width)??200,h:(v==null?void 0:v.height)??((Ie=n.data.size)==null?void 0:Ie.height)??120},oe.target.setPointerCapture(oe.pointerId)}function gn(oe){if(!Et)return;const v=Pe({x:oe.clientX,y:oe.clientY});X.value={width:Math.max(40,Et.w+(v.x-Et.fx)),height:Math.max(40,Et.h+(v.y-Et.fy))}}function Ee(oe){var v,D,ee;if(Et&&X.value&&o){const Z=(v=Oe(n.id))==null?void 0:v.dimensions;o.resizeEntity(n.id,{width:Math.round((Z==null?void 0:Z.width)??X.value.width),height:Math.round((Z==null?void 0:Z.height)??X.value.height)})}Et=null,X.value=null,(ee=(D=oe.target).releasePointerCapture)==null||ee.call(D,oe.pointerId)}const nt=t.ref(null),mt=t.ref(null);function Ft(oe,v){if(!S.value)return;v.stopPropagation(),v.preventDefault();const D=x.value,ee=D.has(oe.modelId)?new Set(D):new Set([oe.modelId]);mt.value={ids:ee,dropIndex:-1,lineY:0},v.target.setPointerCapture(v.pointerId)}function Zt(oe){if(!mt.value||!nt.value)return;const v=Array.from(nt.value.querySelectorAll(".em-entity__row"));if(!v.length)return;let D=v.length;for(let Ie=0;Ie<v.length;Ie++){const Me=v[Ie].getBoundingClientRect();if(oe.clientY<Me.top+Me.height/2){D=Ie;break}}const ee=v[v.length-1],Z=D<v.length?v[D].offsetTop:ee.offsetTop+ee.offsetHeight;mt.value={...mt.value,dropIndex:D,lineY:Z}}function Qt(){const oe=mt.value;if(mt.value=null,!oe||oe.dropIndex<0)return;const v=C.value,D=v.filter(ue=>oe.ids.has(ue.modelId)).map(ue=>ue.modelId),ee=v.filter((ue,Ve)=>oe.ids.has(ue.modelId)&&Ve<oe.dropIndex).length,Z=oe.dropIndex-ee,Ie=v.filter(ue=>!oe.ids.has(ue.modelId)).map(ue=>ue.modelId);[...Ie.slice(0,Z),...D,...Ie.slice(Z)].join(",")!==v.map(ue=>ue.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,D,Z))}function we(){mt.value=null}const et=t.ref(null),ft=t.ref(null);function bn(oe,v){S.value&&(v.stopPropagation(),v.preventDefault(),ft.value={id:oe.modelId,dropIndex:-1,lineY:0},v.target.setPointerCapture(v.pointerId))}function ot(oe){if(!ft.value||!et.value)return;const v=Array.from(et.value.querySelectorAll(".em-entity__op-row"));if(!v.length)return;let D=v.length;for(let Ie=0;Ie<v.length;Ie++){const Me=v[Ie].getBoundingClientRect();if(oe.clientY<Me.top+Me.height/2){D=Ie;break}}const ee=v[v.length-1],Z=D<v.length?v[D].offsetTop:ee.offsetTop+ee.offsetHeight;ft.value={...ft.value,dropIndex:D,lineY:Z}}function Fo(){const oe=ft.value;if(ft.value=null,!oe||oe.dropIndex<0)return;const D=ce.value.findIndex(Z=>Z.modelId===oe.id);if(D<0)return;const ee=oe.dropIndex-(D<oe.dropIndex?1:0);ee!==D&&(o==null||o.reorderOperations(n.id,[oe.id],ee))}function Uo(){ft.value=null}return(oe,v)=>{var D,ee;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":_.value,"is-related":N.value,"is-dimmed":V.value,"is-selected":I.value,"is-multi-selected":A.value,"has-focused-attr":$.value,"is-locked":w.value,"is-diff-added":((D=u.value)==null?void 0:D.verb)==="added","is-diff-modified":((ee=u.value)==null?void 0:ee.verb)==="modified"}]),tabindex:"-1",style:t.normalizeStyle(Nt.value),onPointerdown:f,onMouseenter:g,onMouseleave:k,onDblclick:l},[I.value?(t.openBlock(),t.createElementBlock("div",Ex,[...v[11]||(v[11]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("header",{class:"em-entity__header",style:t.normalizeStyle(re.value),onDblclick:t.withModifiers(j,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(E.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!E.value,disabled:!b.value,onClick:t.withModifiers(B,["stop"]),onPointerdown:v[0]||(v[0]=t.withModifiers(()=>{},["stop"])),onDblclick:v[1]||(v[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(E.value?"▸":"▾"),41,Nx),t.createElementVNode("span",wx,"«"+t.toDisplayString(t.unref(jo)(R.value.stereotype))+"»",1),ae.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:le,"onUpdate:modelValue":v[2]||(v[2]=Z=>Re.value=Z),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Xe,["enter"]),v[3]||(v[3]=t.withKeys(Z=>ae.value=!1,["esc"]))],onBlur:Xe,onPointerdown:v[4]||(v[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,Re.value]]):(t.openBlock(),t.createElementBlock("span",Ix,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(P.value,(Z,Ie)=>(t.openBlock(),t.createElementBlock("span",{key:Ie,class:t.normalizeClass({"em-entity__missing":Z.missing})},t.toDisplayString(Z.text),3))),128))])),!E.value&&z.value&&Q.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:L.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!L.value,onClick:t.withModifiers(De,["stop"]),onPointerdown:v[5]||(v[5]=t.withModifiers(()=>{},["stop"])),onDblclick:v[6]||(v[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",xx,t.toDisplayString(L.value?"▸":"▾"),1)],40,vx)):t.createCommentVNode("",!0),w.value?(t.openBlock(),t.createBlock(Ae,{key:3,name:"lock",size:12,class:"em-entity__lock",title:i("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["em-entity__diff-badge",u.value.verb==="added"?"is-added":"is-modified"]),"aria-hidden":"true"},t.toDisplayString(u.value.verb==="added"?"+":"±"),3)):t.createCommentVNode("",!0)],36),E.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:nt,class:"em-entity__attrs"},[mt.value&&mt.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${mt.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(C.value,Z=>{var Ie,Me,ue,Ve,ze,Ue;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Z.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":x.value.has(Z.modelId),"is-dragging":(Ie=mt.value)==null?void 0:Ie.ids.has(Z.modelId),"is-embed":ie(Z),"is-divider":se(Z),"has-embed-badge":!!Ce(Z),nodrag:se(Z)&&S.value,"is-diff-changed":!!((Me=u.value)!=null&&Me.changedAttributeIds.has(Z.modelId))}]),"data-attr":Z.modelId,onClick:t.withModifiers(Fe=>T(Z,Fe),["stop"]),onPointerdown:Fe=>se(Z)?Ft(Z,Fe):void 0,onPointermove:Fe=>se(Z)?Zt(Fe):void 0,onPointerup:Fe=>se(Z)?Qt():void 0,onPointercancel:Fe=>se(Z)?we():void 0},[S.value&&!se(Z)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Fe=>Ft(Z,Fe),onPointermove:Zt,onPointerup:Qt,onPointercancel:we,onClick:v[7]||(v[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,Sx)):t.createCommentVNode("",!0),se(Z)?(t.openBlock(),t.createElementBlock("span",Rx,t.toDisplayString(Z.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Jn),{id:`l:${Z.modelId}`,type:"target",position:t.unref(Te).Left,class:"em-handle",title:S.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:J(K.value[Z.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",Ax,[(ue=K.value[Z.modelId])!=null&&ue.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Ve=K.value[Z.modelId])!=null&&Ve.required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",Tx,[z.value&&ve(Z)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:be(Z)?i("em.node.embedAttrShow",{count:U(Z)}):i("em.node.embedAttrHide"),"aria-expanded":!be(Z),onClick:t.withModifiers(Fe=>xe(Z),["stop"]),onPointerdown:v[8]||(v[8]=t.withModifiers(()=>{},["stop"])),onDblclick:v[9]||(v[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(be(Z)?"▸":"▾"),41,Mx)):ie(Z)?(t.openBlock(),t.createBlock(Ae,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(ze=K.value[Z.modelId])!=null&&ze.fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,$x),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:pe(Z)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ye(Z),(Fe,Ye)=>(t.openBlock(),t.createElementBlock("span",{key:Ye,class:t.normalizeClass({"em-entity__missing":Fe.missing})},t.toDisplayString(Fe.text),3))),128))],4),Ce(Z)==="attr"?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"attr",title:i("em.node.embedAttrShow",{count:U(Z)}),onClick:t.withModifiers(Fe=>xe(Z),["stop"])},"+"+t.toDisplayString(U(Z)),9,Vx)):Ce(Z)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:Y(Z)?i("em.node.embedRepeatedShow",{count:((Ue=O(Z))==null?void 0:Ue.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!Y(Z),onClick:t.withModifiers(Fe=>q(Z),["stop"])},t.toDisplayString(Y(Z)?`+${ke(Z)}`:"−"),9,Bx)):t.createCommentVNode("",!0),G.value[Z.modelId]?(t.openBlock(),t.createElementBlock("span",Dx,t.toDisplayString(G.value[Z.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Jn),{id:`r:${Z.modelId}`,type:"source",position:t.unref(Te).Right,class:"em-handle",title:S.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,Cx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ie(Z)&&z.value?H(Z):[],Fe=>(t.openBlock(),t.createElementBlock("li",{key:`${Z.modelId}:${Fe.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":x.value.has(Z.modelId)}]),onClick:t.withModifiers(Ye=>T(Z,Ye),["stop"])},[v[12]||(v[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",Ox,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(W(Fe),(Ye,pt)=>(t.openBlock(),t.createElementBlock("span",{key:pt,class:t.normalizeClass({"em-entity__missing":Ye.missing})},t.toDisplayString(Ye.text),3))),128))]),t.createElementVNode("span",Px,t.toDisplayString(Fe.dataType),1)],10,Lx))),128))],64)}),128)),F.value?(t.openBlock(),t.createElementBlock("li",zx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(De,["stop"])},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:F.value})),1)],8,Fx)])):t.createCommentVNode("",!0)],512)),!E.value&&Ne.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:et,class:"em-entity__ops"},[ft.value&&ft.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ft.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,Z=>{var Ie,Me;return t.openBlock(),t.createElementBlock("li",{key:Z.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Ie=ft.value)==null?void 0:Ie.id)===Z.modelId,"is-diff-changed":!!((Me=u.value)!=null&&Me.changedOperationIds.has(Z.modelId))}]),"data-op":Z.modelId},[S.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ue=>bn(Z,ue),onPointermove:ot,onPointerup:Fo,onPointercancel:Uo,onClick:v[10]||(v[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,Hx)):t.createCommentVNode("",!0),t.createElementVNode("span",jx,t.toDisplayString(de(Z.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:_e(Z)})},t.toDisplayString(Z.name)+"()",5)],10,Ux)}),128))],512)):ce.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ce.value.length})},[t.createVNode(Ae,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ce.value.length})),1)],8,Kx)):t.createCommentVNode("",!0),S.value?(t.openBlock(),t.createElementBlock("footer",Gx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:rt},t.toDisplayString(i("em.node.addAttr")),1),v[13]||(v[13]=t.createElementVNode("span",{class:"em-entity__footer-sep","aria-hidden":"true"},null,-1)),t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:He},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),S.value&&!ae.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:yn,onPointermove:gn,onPointerup:Ee},null,32)):t.createCommentVNode("",!0)],38)}}}),[["__scopeId","data-v-00804c52"]]),Yx={key:0,class:"em-sel","aria-hidden":"true"},qx={class:"em-group__label"},Wx={class:"em-group__name"},Jx={key:0,class:"em-group__pkg"},Xx={key:1,class:"em-group__flag"},Af=Ke(t.defineComponent({__name:"GroupNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.computed(()=>n.data.group),i=t.computed(()=>n.data.locked??!1),a=t.computed(()=>_t(n.data.style)),r=t.computed(()=>a.value?{"--em-group-fill":`color-mix(in srgb, var(--em-swatch-${a.value}-bar) 14%, transparent)`}:{}),l=t.inject(to,null),s=(R,C)=>l?l.t(R,C):Lt("ko",R,C),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var R;return!!n.id&&((R=l==null?void 0:l.selection.value)==null?void 0:R.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(Ja,null),h=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),p=t.inject(Vo,null);function y(){n.id&&(p==null||p.setGroupHover(n.id))}function b(){p==null||p.setGroupHover(null)}const f=t.computed(()=>!!p&&p.hoverGroupId.value===n.id),g=t.computed(()=>!!p&&p.hoverGroupId.value!==null&&p.hoverGroupId.value!==n.id),{screenToFlowCoordinate:k,findNode:_}=je();let N=null,I=null;function A(R){var E;if(!n.id||!c.value)return;R.stopPropagation();const C=((E=_(n.id))==null?void 0:E.dimensions)??{width:400,height:300},M=k({x:R.clientX,y:R.clientY});N={fx:M.x,fy:M.y,w:C.width,h:C.height},R.target.setPointerCapture(R.pointerId)}function x(R){if(!N||!n.id)return;const C=k({x:R.clientX,y:R.clientY});I={width:Math.max(160,N.w+(C.x-N.fx)),height:Math.max(120,N.h+(C.y-N.fy))};const M=_(n.id);M&&(M.style={width:`${I.width}px`,height:`${I.height}px`})}function $(R){var C,M;N&&I&&n.id&&l&&l.resizeGroup(n.id,I),N=null,I=null,(M=(C=R.target).releasePointerCapture)==null||M.call(C,R.pointerId)}const T=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),V=t.computed(()=>{const R=o.value.name;return(R==null?void 0:R[T.value])||(R==null?void 0:R.ko)||(R==null?void 0:R.en)||(R==null?void 0:R.ja)||(R==null?void 0:R.zh)||o.value.packageName||s("em.group.fallback")});return(R,C)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":h.value,"is-hover-origin":f.value,"is-dimmed":g.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:b},[d.value?(t.openBlock(),t.createElementBlock("div",Yx,[...C[0]||(C[0]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",qx,[t.createElementVNode("span",Wx,t.toDisplayString(V.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",Jx,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",Xx,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Ae,{key:2,name:"lock",size:12,class:"em-group__lock",title:s("em.node.editLock")},null,8,["title"])):t.createCommentVNode("",!0)]),c.value&&!i.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-group__resize nodrag nopan",onPointerdown:A,onPointermove:x,onPointerup:$},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),Zx={key:0,class:"em-sel","aria-hidden":"true"},Qx={key:2,class:"em-note__text"},Tf=Ke(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(to,null),i=t.inject(Ja,null),a=t.inject(Vo,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>_t(r.value.style)),c=t.computed(()=>s.value?{"--em-note-fill":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 16%, var(--em-note-surface))`,"--em-note-stroke":`color-mix(in srgb, var(--em-swatch-${s.value}-bar) 50%, var(--em-note-border))`}:{});function d(){i&&(i.value=n.data.groupRef??null)}function u(){a==null||a.setNoteHover(n.id)}function m(){a==null||a.setNoteHover(null)}const h=t.computed(()=>{var E;return((E=a==null?void 0:a.source.value)==null?void 0:E.kind)==="note"&&a.source.value.id===n.id}),p=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!h.value),y=t.computed(()=>{var E;return((E=o==null?void 0:o.selection.value)==null?void 0:E.kind)==="note"&&o.selection.value.id===n.id}),b=t.computed(()=>!!n.selected&&!y.value),f=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),g=[{id:"n-top",pos:Te.Top},{id:"n-right",pos:Te.Right},{id:"n-bottom",pos:Te.Bottom},{id:"n-left",pos:Te.Left}],k=t.ref(!1),_=t.ref(""),N=t.ref(null);async function I(){var E;l.value&&(_.value=r.value.memo,k.value=!0,await t.nextTick(),(E=N.value)==null||E.focus())}function A(){k.value&&(k.value=!1,_.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,_.value)))}const{screenToFlowCoordinate:x,findNode:$}=je();let T=null,V=null;function R(E){var B;if(!l.value)return;E.stopPropagation();const w=((B=$(n.id))==null?void 0:B.dimensions)??r.value.geo.size,S=x({x:E.clientX,y:E.clientY});T={fx:S.x,fy:S.y,w:w.width,h:w.height},E.target.setPointerCapture(E.pointerId)}function C(E){if(!T)return;const w=x({x:E.clientX,y:E.clientY});V={width:Math.max(140,T.w+(w.x-T.fx)),height:Math.max(60,T.h+(w.y-T.fy))};const S=$(n.id);S&&(S.style={width:`${V.width}px`,height:`${V.height}px`})}function M(E){var w,S;T&&V&&o&&o.resizeNote(n.id,V),T=null,V=null,(S=(w=E.target).releasePointerCapture)==null||S.call(w,E.pointerId)}return(E,w)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":h.value,"is-related":p.value,"is-dimmed":f.value,"is-selected":y.value,"is-multi-selected":b.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:I,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",Zx,[...w[4]||(w[4]=[t.createElementVNode("span",{class:"em-sel__c em-sel__c--tl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--tr"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--bl"},null,-1),t.createElementVNode("span",{class:"em-sel__c em-sel__c--br"},null,-1)])])):t.createCommentVNode("",!0),k.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:N,"onUpdate:modelValue":w[0]||(w[0]=S=>_.value=S),class:"em-note__edit nodrag",onBlur:A,onKeydown:w[1]||(w[1]=t.withKeys(S=>k.value=!1,["esc"])),onPointerdown:w[2]||(w[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,_.value]]):(t.openBlock(),t.createElementBlock("div",Qx,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(g,S=>t.createVNode(t.unref(Jn),{id:S.id,key:S.id,type:"source",position:S.pos,class:"em-note-handle",onPointerdown:w[3]||(w[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!k.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:R,onPointermove:C,onPointerup:M},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function Xa(e){switch(e){case"right":return{x:1,y:0};case"left":return{x:-1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const Bo=.5;function Mf(e,n,o,i,a,r){const l=Xa(n),s=Xa(a),c={x:e.x+l.x*r,y:e.y+l.y*r},d={x:i.x+s.x*r,y:i.y+s.y*r},u=[c,...o,d],m=[];let h=e;const p=(f,g)=>{(Math.abs(f.x-h.x)>=Bo||Math.abs(f.y-h.y)>=Bo)&&(m.push({a:h,b:f,seg:g}),h=f)};p(c,0);let y=l.x!==0,b=c;for(let f=1;f<u.length;f++){const g=u[f],k=f<=o.length?f-1:o.length,_=Math.abs(g.x-b.x)<Bo,N=Math.abs(g.y-b.y)<Bo;_&&N||(_?(p(g,k),y=!1):N?(p(g,k),y=!0):y?(p({x:b.x,y:g.y},k),p(g,k),y=!0):(p({x:g.x,y:b.y},k),p(g,k),y=!1),b=g)}return p(i,o.length),m}function Vf(e,n,o,i,a,r=20){const l=Mf(e,n,o,i,a,r);let s=`M ${kt(e.x)},${kt(e.y)}`;for(const c of l)s+=` L ${kt(c.b.x)},${kt(c.b.y)}`;return s}const eC=14;function Bf(e,n,o,i,a,r=20){return Mf(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=eC).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function kt(e){return Math.round(e*100)/100}const tC=36;function nC(e,n,o=tC){const i=Math.max(e.x,n.x)+o;return`M ${kt(e.x)},${kt(e.y)} L ${kt(i)},${kt(e.y)} L ${kt(i)},${kt(n.y)} L ${kt(n.x)},${kt(n.y)}`}function Df(e,n,o){const i=[e,...n,o];let a=`M ${kt(i[0].x)},${kt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${kt(i[r].x)},${kt(i[r].y)}`;return a}function oC(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Lf(e,n){const o=oC(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Bo&&Math.abs(l)<Bo)return{point:{x:e.x+e.width,y:o.y},side:"right"};const s=r!==0?i/Math.abs(r):1/0,c=l!==0?a/Math.abs(l):1/0,d=Math.min(s,c),u={x:o.x+r*d,y:o.y+l*d},m=s<=c?r>=0?"right":"left":l>=0?"bottom":"top";return{point:u,side:m}}function Of(e,n,o){const i=o>=e.x+e.width/2;return{point:{x:i?e.x+e.width:e.x,y:n},side:i?"right":"left"}}function Pf(e,n,o){const i=[e,...n,o],a=[];for(let r=1;r<i.length;r++){const l=i[r-1],s=i[r];a.push({x:(l.x+s.x)/2,y:(l.y+s.y)/2})}return a}const iC=20,aC=22,rC=7,lC=22,zf=31,Ff=7,sC=20,Uf=11,Hf=11,cC=zf+Ff;function dC(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function uC(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Za(e,n,o){const i=n.x-e.x,a=n.y-e.y,r=Math.hypot(i,a)||1;return{x:e.x+i*o/r,y:e.y+a*o/r}}function jf(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function Qa(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function Kf(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:jf(e,n);return[Qa(o,a,r-Math.PI/2),Qa(o,a,r+Math.PI/2)]}function Gf(e,n,o,i){const a=n*180/Math.PI,l=(a>=0?i?a-20:a+20:i?a+20:a-20)*Math.PI/180;return{x:Math.sin(l)*o+e.x,y:Math.cos(l)*o+e.y}}function Yf(e,n,o,i){const a=[],r=[],l=[];if(e.x===n.x&&e.y===n.y)return{lines:a,circles:r,polygons:l};if(i==="db"){const c=Za(e,n,iC),[d,u]=Kf(e,n,c,aC);if(a.push({x1:d.x,y1:d.y,x2:u.x,y2:u.y}),a.push({x1:c.x,y1:c.y,x2:e.x,y2:e.y}),dC(o.multiplicity)){const m=Za(e,n,zf);r.push({cx:m.x,cy:m.y,r:Ff})}if(uC(o.multiplicity)){const m=Za(e,n,rC),[h,p]=Kf(e,n,m,lC);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.y}),a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:m.x,y2:m.y})}return{lines:a,circles:r,polygons:l}}let s=e;if(o.composition){const c=Za(e,n,sC),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=jf(e,n),m=Qa(d,Uf/2,u-Math.PI/2),h=Qa(d,Uf/2,u+Math.PI/2);l.push({points:[e,m,c,h]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=Gf(s,c,Hf,!0),u=Gf(s,c,Hf,!1);a.push({x1:s.x,y1:s.y,x2:d.x,y2:d.y}),a.push({x1:s.x,y1:s.y,x2:u.x,y2:u.y})}return{lines:a,circles:r,polygons:l}}const qf=200,Wf=120,Jl=24;function Jf(e){var a,r;if(!e)return{x:0,y:0,width:qf,height:Wf};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||qf,i=((r=e.dimensions)==null?void 0:r.height)||Wf;return{x:n.x,y:n.y,width:o,height:i}}function Xf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Zf(e){const n=t.computed(()=>Jf(e.sourceNode())),o=t.computed(()=>Jf(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var p,y;const d=n.value,u=d.x+d.width;let m=((p=e.sourceRowY)==null?void 0:p.call(e))??d.y+d.height/3,h=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(h-m)<Jl){const b=(m+h)/2;m=b-Jl/2,h=b+Jl/2}return{source:{x:u,y:m},target:{x:u,y:h}}}),r=t.computed(()=>e.waypoints()[0]??Xf(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??Xf(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?Of(n.value,d,r.value.x):Lf(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?Of(o.value,d,l.value.x):Lf(o.value,l.value)});return{source:t.computed(()=>i.value?a.value.source:s.value.point),target:t.computed(()=>i.value?a.value.target:c.value.point),sourceSide:t.computed(()=>i.value?"right":s.value.side),targetSide:t.computed(()=>i.value?"right":c.value.side),isSelf:i}}const Xl=Symbol("waypointController"),mC=["d"],fC=["d"],pC=["d"],hC=["x1","y1","x2","y2"],yC=["cx","cy","r"],gC=["x","y"],bC=["x","y"],_C=["cx","cy","onDblclick"],kC=["x","y","onPointerdown","onDblclick"],Qf=Ke(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(Xl),a=t.inject(to,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(_f,null),s=t.inject(Vo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var ie;return((ie=a==null?void 0:a.selection.value)==null?void 0:ie.kind)==="association"&&a.selection.value.id===n.id}),u=t.computed(()=>!!s&&s.active.value&&!s.relatedEdgeIds.value.has(n.id)&&!d.value),m=t.computed(()=>{const ie=l==null?void 0:l.value;if(!ie||!a)return null;const se=a.resolved.value.entities,fe=L=>{var F;return(F=se.find(Q=>Q.entity.modelId===L))==null?void 0:F.groupRef},O=n.data.association;return fe(O.end1.entityRef)===ie.groupId&&fe(O.end2.entityRef)===ie.groupId?{dx:ie.dx,dy:ie.dy}:null}),h=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),p=t.ref(-1),y=t.ref({x:0,y:0}),b=t.computed(()=>{const ie=m.value;return h.value.map((se,fe)=>fe===p.value?y.value:ie?{x:se.x+ie.dx,y:se.y+ie.dy}:se)}),f=t.computed(()=>{var ie;return!!((ie=n.sourceNode.data)!=null&&ie.collapsed)}),g=t.computed(()=>{var ie;return!!((ie=n.targetNode.data)!=null&&ie.collapsed)}),{source:k,target:_,sourceSide:N,targetSide:I,isSelf:A}=Zf({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>b.value,sourceRowY:()=>n.data.sourceColumnRef&&!f.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!g.value?n.targetY:void 0}),x=cC+4,$=t.computed(()=>A.value?nC(k.value,_.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Vf(k.value,N.value,b.value,_.value,I.value,x):Df(k.value,b.value,_.value)),T=t.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Bf(k.value,N.value,b.value,_.value,I.value,x):Pf(k.value,b.value,_.value).map((ie,se)=>({point:ie,segIndex:se}))),V=t.computed(()=>A.value||!r.value?[]:b.value),R=Fi;function C(ie,se){p.value=ie,y.value={...h.value[ie]},se.target.setPointerCapture(se.pointerId),se.stopPropagation()}function M(ie){if(p.value<0)return;const se=o({x:ie.clientX,y:ie.clientY});y.value={x:se.x,y:se.y}}function E(ie){var se,fe;p.value>=0&&i&&i.movePoint(n.id,p.value,{...y.value}),p.value=-1,(fe=(se=ie.target).releasePointerCapture)==null||fe.call(se,ie.pointerId)}function w(ie,se){se.stopPropagation(),i==null||i.removePoint(n.id,ie)}function S(ie,se){if(!i)return;const fe=o({x:se.clientX,y:se.clientY});i.insertPoint(n.id,ie,{x:fe.x,y:fe.y})}const B=t.computed(()=>R(n.data.association.end1.multiplicity)),z=t.computed(()=>R(n.data.association.end2.multiplicity)),K=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),J=t.computed(()=>K.value==="class"),re=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ie=Xa(N.value);return{x:k.value.x+ie.x*10,y:k.value.y+ie.y*10}}return b.value[0]??_.value}),pe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const se=Xa(I.value);return{x:_.value.x+se.x*10,y:_.value.y+se.y*10}}const ie=b.value;return ie[ie.length-1]??k.value}),ce=t.computed(()=>{const ie=n.data.association;return{multiplicity:ie.end1.multiplicity,navigable:ie.end1.navigable,composition:ie.end1.composition,otherNavigable:ie.end2.navigable}}),Ne=t.computed(()=>{const ie=n.data.association;return{multiplicity:ie.end2.multiplicity,navigable:ie.end2.navigable,composition:ie.end2.composition,otherNavigable:ie.end1.navigable}}),he=t.computed(()=>Yf(k.value,re.value,ce.value,K.value)),de=t.computed(()=>Yf(_.value,pe.value,Ne.value,K.value)),_e=t.computed(()=>[...he.value.lines,...de.value.lines]),Se=t.computed(()=>[...he.value.circles,...de.value.circles]),me=t.computed(()=>[...he.value.polygons,...de.value.polygons].map(ie=>`M${ie.points.map(se=>`${se.x},${se.y}`).join(" L")} Z`)),ye=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ie,se)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:$.value,fill:"none",class:"em-edge__hit"},null,8,mC),t.createElementVNode("path",{d:$.value,fill:"none","stroke-width":"1.5",class:t.normalizeClass(["em-edge__path",{"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}])},null,10,fC),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me.value,(fe,O)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${O}`,d:fe,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",ye.value])},null,10,pC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_e.value,(fe,O)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${O}`,x1:fe.x1,y1:fe.y1,x2:fe.x2,y2:fe.y2,class:t.normalizeClass(["em-edge__marker",ye.value])},null,10,hC))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value,(fe,O)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${O}`,cx:fe.cx,cy:fe.cy,r:fe.r,class:t.normalizeClass(["em-edge__marker",ye.value])},null,10,yC))),128)),J.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(k).x+8,y:t.unref(k).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(B.value),11,gC),t.createElementVNode("text",{x:t.unref(_).x-8,y:t.unref(_).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(z.value),11,bC)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,(fe,O)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${O}`,cx:fe.point.x,cy:fe.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(L=>S(fe.segIndex,L),["stop"])},null,42,_C))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.value,(fe,O)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${O}`,x:fe.x-5,y:fe.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:L=>C(O,L),onPointermove:M,onPointerup:E,onDblclick:L=>w(O,L)},null,42,kC))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var mn=(e=>(e.Lines="lines",e.Dots="dots",e))(mn||{});const ep=function({dimensions:e,size:n,color:o}){return t.h("path",{stroke:o,"stroke-width":n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},tp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};mn.Lines+"",mn.Dots+"";const EC={[mn.Dots]:"#81818a",[mn.Lines]:"#eee"},NC=["id","x","y","width","height","patternTransform"],wC={key:2,height:"100",width:"100"},IC=["fill"],vC=["x","y","fill"],xC={name:"Background",compatConfig:{MODE:3}},CC=t.defineComponent({...xC,props:{id:{},variant:{default:()=>mn.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:n,viewport:o}=je(),i=t.computed(()=>{const l=o.value.zoom,[s,c]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],d=[s*l||1,c*l||1],u=e.size*l,[m,h]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],p=[m*l||1+d[0]/2,h*l||1+d[1]/2];return{scaledGap:d,offset:p,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||EC[e.variant||mn.Dots]);return(l,s)=>(t.openBlock(),t.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:t.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[t.renderSlot(l.$slots,"pattern-container",{id:a.value},()=>[t.createElementVNode("pattern",{id:a.value,x:t.unref(o).x%i.value.scaledGap[0],y:t.unref(o).y%i.value.scaledGap[1],width:i.value.scaledGap[0],height:i.value.scaledGap[1],patternTransform:`translate(-${i.value.offset[0]},-${i.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[t.renderSlot(l.$slots,"pattern",{},()=>[l.variant===t.unref(mn).Lines?(t.openBlock(),t.createBlock(t.unref(ep),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(mn).Dots?(t.openBlock(),t.createBlock(t.unref(tp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",wC,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,IC)])):t.createCommentVNode("",!0)])],8,NC)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,vC),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),SC={name:"ControlButton",compatConfig:{MODE:3}},RC=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},$C={type:"button",class:"vue-flow__controls-button"};function AC(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",$C,[t.renderSlot(e.$slots,"default")])}const no=RC(SC,[["render",AC]]),TC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},MC=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function VC(e,n){return t.openBlock(),t.createElementBlock("svg",TC,MC)}const BC={render:VC},DC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},LC=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function OC(e,n){return t.openBlock(),t.createElementBlock("svg",DC,LC)}const PC={render:OC},zC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},FC=[t.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function UC(e,n){return t.openBlock(),t.createElementBlock("svg",zC,FC)}const HC={render:UC},jC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},KC=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function GC(e,n){return t.openBlock(),t.createElementBlock("svg",jC,KC)}const YC={render:GC},qC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},WC=[t.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function JC(e,n){return t.openBlock(),t.createElementBlock("svg",qC,WC)}const XC={render:JC},ZC={name:"Controls",compatConfig:{MODE:3}},QC=t.defineComponent({...ZC,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>em.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:n}){const{nodesDraggable:o,nodesConnectable:i,elementsSelectable:a,setInteractive:r,zoomIn:l,zoomOut:s,fitView:c,viewport:d,minZoom:u,maxZoom:m}=je(),h=t.toRef(()=>o.value||i.value||a.value),p=t.toRef(()=>d.value.zoom<=u.value),y=t.toRef(()=>d.value.zoom>=m.value);function b(){l(),n("zoomIn")}function f(){s(),n("zoomOut")}function g(){c(e.fitViewParams),n("fitView")}function k(){r(!h.value),n("interactionChange",!h.value)}return(_,N)=>(t.openBlock(),t.createBlock(t.unref(Zm),{class:"vue-flow__controls",position:_.position},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"top"),_.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(_.$slots,"control-zoom-in",{},()=>[t.createVNode(no,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:b},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(BC))))])]),_:3},8,["disabled"])]),t.renderSlot(_.$slots,"control-zoom-out",{},()=>[t.createVNode(no,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:f},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(PC))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),_.showFitView?t.renderSlot(_.$slots,"control-fit-view",{key:1},()=>[t.createVNode(no,{class:"vue-flow__controls-fitview",onClick:g},{default:t.withCtx(()=>[t.renderSlot(_.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(HC))))])]),_:3})]):t.createCommentVNode("",!0),_.showInteractive?t.renderSlot(_.$slots,"control-interactive",{key:2},()=>[_.showInteractive?(t.openBlock(),t.createBlock(no,{key:0,class:"vue-flow__controls-interactive",onClick:k},{default:t.withCtx(()=>[h.value?t.renderSlot(_.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(XC))))]):t.createCommentVNode("",!0),h.value?t.createCommentVNode("",!0):t.renderSlot(_.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(YC))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(_.$slots,"default")]),_:3},8,["position"]))}});var eS={value:()=>{}};function Zl(){for(var e=0,n=arguments.length,o={},i;e<n;++e){if(!(i=arguments[e]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new er(o)}function er(e){this._=e}function tS(e,n){return e.trim().split(/^|\s+/).map(function(o){var i="",a=o.indexOf(".");if(a>=0&&(i=o.slice(a+1),o=o.slice(0,a)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}er.prototype=Zl.prototype={constructor:er,on:function(e,n){var o=this._,i=tS(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=nS(o[a],e.name)))return a;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++r<l;)if(a=(e=i[r]).type)o[a]=np(o[a],e.name,n);else if(n==null)for(a in o)o[a]=np(o[a],e.name,null);return this},copy:function(){var e={},n=this._;for(var o in n)e[o]=n[o].slice();return new er(e)},call:function(e,n){if((a=arguments.length-2)>0)for(var o=new Array(a),i=0,a,r;i<a;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(n,o)},apply:function(e,n,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,r=i.length;a<r;++a)i[a].value.apply(n,o)}};function nS(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function np(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=eS,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Ql="http://www.w3.org/1999/xhtml";const op={svg:"http://www.w3.org/2000/svg",xhtml:Ql,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function tr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),op.hasOwnProperty(n)?{space:op[n],local:e}:e}function oS(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Ql&&n.documentElement.namespaceURI===Ql?n.createElement(e):n.createElementNS(o,e)}}function iS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ip(e){var n=tr(e);return(n.local?iS:oS)(n)}function aS(){}function es(e){return e==null?aS:function(){return this.querySelector(e)}}function rS(e){typeof e!="function"&&(e=es(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=new Array(l),c,d,u=0;u<l;++u)(c=r[u])&&(d=e.call(c,c.__data__,u,r))&&("__data__"in c&&(d.__data__=c.__data__),s[u]=d);return new Rt(i,this._parents)}function lS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function sS(){return[]}function ap(e){return e==null?sS:function(){return this.querySelectorAll(e)}}function cS(e){return function(){return lS(e.apply(this,arguments))}}function dS(e){typeof e=="function"?e=cS(e):e=ap(e);for(var n=this._groups,o=n.length,i=[],a=[],r=0;r<o;++r)for(var l=n[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&(i.push(e.call(c,c.__data__,d,l)),a.push(c));return new Rt(i,a)}function rp(e){return function(){return this.matches(e)}}function lp(e){return function(n){return n.matches(e)}}var uS=Array.prototype.find;function mS(e){return function(){return uS.call(this.children,e)}}function fS(){return this.firstElementChild}function pS(e){return this.select(e==null?fS:mS(typeof e=="function"?e:lp(e)))}var hS=Array.prototype.filter;function yS(){return Array.from(this.children)}function gS(e){return function(){return hS.call(this.children,e)}}function bS(e){return this.selectAll(e==null?yS:gS(typeof e=="function"?e:lp(e)))}function _S(e){typeof e!="function"&&(e=rp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new Rt(i,this._parents)}function sp(e){return new Array(e.length)}function kS(){return new Rt(this._enter||this._groups.map(sp),this._parents)}function nr(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}nr.prototype={constructor:nr,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ES(e){return function(){return e}}function NS(e,n,o,i,a,r){for(var l=0,s,c=n.length,d=r.length;l<d;++l)(s=n[l])?(s.__data__=r[l],i[l]=s):o[l]=new nr(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function wS(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),p;for(s=0;s<u;++s)(c=n[s])&&(h[s]=p=l.call(c,c.__data__,s,n)+"",d.has(p)?a[s]=c:d.set(p,c));for(s=0;s<m;++s)p=l.call(e,r[s],s,r)+"",(c=d.get(p))?(i[s]=c,c.__data__=r[s],d.delete(p)):o[s]=new nr(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function IS(e){return e.__data__}function vS(e,n){if(!arguments.length)return Array.from(this,IS);var o=n?wS:NS,i=this._parents,a=this._groups;typeof e!="function"&&(e=ES(e));for(var r=a.length,l=new Array(r),s=new Array(r),c=new Array(r),d=0;d<r;++d){var u=i[d],m=a[d],h=m.length,p=xS(e.call(u,u&&u.__data__,d,i)),y=p.length,b=s[d]=new Array(y),f=l[d]=new Array(y),g=c[d]=new Array(h);o(u,m,b,f,g,p,n);for(var k=0,_=0,N,I;k<y;++k)if(N=b[k]){for(k>=_&&(_=k+1);!(I=f[_])&&++_<y;);N._next=I||null}}return l=new Rt(l,i),l._enter=s,l._exit=c,l}function xS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function CS(){return new Rt(this._exit||this._groups.map(sp),this._parents)}function SS(e,n,o){var i=this.enter(),a=this,r=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(a=n(a),a&&(a=a.selection())),o==null?r.remove():o(r),i&&a?i.merge(a).order():a}function RS(e){for(var n=e.selection?e.selection():e,o=this._groups,i=n._groups,a=o.length,r=i.length,l=Math.min(a,r),s=new Array(a),c=0;c<l;++c)for(var d=o[c],u=i[c],m=d.length,h=s[c]=new Array(m),p,y=0;y<m;++y)(p=d[y]||u[y])&&(h[y]=p);for(;c<a;++c)s[c]=o[c];return new Rt(s,this._parents)}function $S(){for(var e=this._groups,n=-1,o=e.length;++n<o;)for(var i=e[n],a=i.length-1,r=i[a],l;--a>=0;)(l=i[a])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function AS(e){e||(e=TS);function n(m,h){return m&&h?e(m.__data__,h.__data__):!m-!h}for(var o=this._groups,i=o.length,a=new Array(i),r=0;r<i;++r){for(var l=o[r],s=l.length,c=a[r]=new Array(s),d,u=0;u<s;++u)(d=l[u])&&(c[u]=d);c.sort(n)}return new Rt(a,this._parents).order()}function TS(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function MS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function VS(){return Array.from(this)}function BS(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length;a<r;++a){var l=i[a];if(l)return l}return null}function DS(){let e=0;for(const n of this)++e;return e}function LS(){return!this.node()}function OS(e){for(var n=this._groups,o=0,i=n.length;o<i;++o)for(var a=n[o],r=0,l=a.length,s;r<l;++r)(s=a[r])&&e.call(s,s.__data__,r,a);return this}function PS(e){return function(){this.removeAttribute(e)}}function zS(e){return function(){this.removeAttributeNS(e.space,e.local)}}function FS(e,n){return function(){this.setAttribute(e,n)}}function US(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function HS(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function jS(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function KS(e,n){var o=tr(e);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((n==null?o.local?zS:PS:typeof n=="function"?o.local?jS:HS:o.local?US:FS)(o,n))}function cp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function GS(e){return function(){this.style.removeProperty(e)}}function YS(e,n,o){return function(){this.style.setProperty(e,n,o)}}function qS(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function WS(e,n,o){return arguments.length>1?this.each((n==null?GS:typeof n=="function"?qS:YS)(e,n,o??"")):Do(this.node(),e)}function Do(e,n){return e.style.getPropertyValue(n)||cp(e).getComputedStyle(e,null).getPropertyValue(n)}function JS(e){return function(){delete this[e]}}function XS(e,n){return function(){this[e]=n}}function ZS(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function QS(e,n){return arguments.length>1?this.each((n==null?JS:typeof n=="function"?ZS:XS)(e,n)):this.node()[e]}function dp(e){return e.trim().split(/^|\s+/)}function ts(e){return e.classList||new up(e)}function up(e){this._node=e,this._names=dp(e.getAttribute("class")||"")}up.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function mp(e,n){for(var o=ts(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function fp(e,n){for(var o=ts(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function eR(e){return function(){mp(this,e)}}function tR(e){return function(){fp(this,e)}}function nR(e,n){return function(){(n.apply(this,arguments)?mp:fp)(this,e)}}function oR(e,n){var o=dp(e+"");if(arguments.length<2){for(var i=ts(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?nR:n?eR:tR)(o,n))}function iR(){this.textContent=""}function aR(e){return function(){this.textContent=e}}function rR(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function lR(e){return arguments.length?this.each(e==null?iR:(typeof e=="function"?rR:aR)(e)):this.node().textContent}function sR(){this.innerHTML=""}function cR(e){return function(){this.innerHTML=e}}function dR(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function uR(e){return arguments.length?this.each(e==null?sR:(typeof e=="function"?dR:cR)(e)):this.node().innerHTML}function mR(){this.nextSibling&&this.parentNode.appendChild(this)}function fR(){return this.each(mR)}function pR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function hR(){return this.each(pR)}function yR(e){var n=typeof e=="function"?e:ip(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function gR(){return null}function bR(e,n){var o=typeof e=="function"?e:ip(e),i=n==null?gR:typeof n=="function"?n:es(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function _R(){var e=this.parentNode;e&&e.removeChild(this)}function kR(){return this.each(_R)}function ER(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function NR(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function wR(e){return this.select(e?NR:ER)}function IR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function vR(e){return function(n){e.call(this,n,this.__data__)}}function xR(e){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");return i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),{type:n,name:o}})}function CR(e){return function(){var n=this.__on;if(n){for(var o=0,i=-1,a=n.length,r;o<a;++o)r=n[o],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):n[++i]=r;++i?n.length=i:delete this.__on}}}function SR(e,n,o){return function(){var i=this.__on,a,r=vR(n);if(i){for(var l=0,s=i.length;l<s;++l)if((a=i[l]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=r,a.options=o),a.value=n;return}}this.addEventListener(e.type,r,o),a={type:e.type,name:e.name,value:n,listener:r,options:o},i?i.push(a):this.__on=[a]}}function RR(e,n,o){var i=xR(e+""),a,r=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,d=s.length,u;c<d;++c)for(a=0,u=s[c];a<r;++a)if((l=i[a]).type===u.type&&l.name===u.name)return u.value}return}for(s=n?SR:CR,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function pp(e,n,o){var i=cp(e),a=i.CustomEvent;typeof a=="function"?a=new a(n,o):(a=i.document.createEvent("Event"),o?(a.initEvent(n,o.bubbles,o.cancelable),a.detail=o.detail):a.initEvent(n,!1,!1)),e.dispatchEvent(a)}function $R(e,n){return function(){return pp(this,e,n)}}function AR(e,n){return function(){return pp(this,e,n.apply(this,arguments))}}function TR(e,n){return this.each((typeof n=="function"?AR:$R)(e,n))}function*MR(){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],a=0,r=i.length,l;a<r;++a)(l=i[a])&&(yield l)}var hp=[null];function Rt(e,n){this._groups=e,this._parents=n}function Ei(){return new Rt([[document.documentElement]],hp)}function VR(){return this}Rt.prototype=Ei.prototype={constructor:Rt,select:rS,selectAll:dS,selectChild:pS,selectChildren:bS,filter:_S,data:vS,enter:kS,exit:CS,join:SS,merge:RS,selection:VR,order:$S,sort:AS,call:MS,nodes:VS,node:BS,size:DS,empty:LS,each:OS,attr:KS,style:WS,property:QS,classed:oR,text:lR,html:uR,raise:fR,lower:hR,append:yR,insert:bR,remove:kR,clone:wR,datum:IR,on:RR,dispatch:TR,[Symbol.iterator]:MR};function $n(e){return typeof e=="string"?new Rt([[document.querySelector(e)]],[document.documentElement]):new Rt([[e]],hp)}function BR(e){let n;for(;n=e.sourceEvent;)e=n;return e}function An(e,n){if(e=BR(e),n===void 0&&(n=e.currentTarget),n){var o=n.ownerSVGElement||n;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}}return[e.pageX,e.pageY]}const ns={capture:!0,passive:!1};function os(e){e.preventDefault(),e.stopImmediatePropagation()}function DR(e){var n=e.document.documentElement,o=$n(e).on("dragstart.drag",os,ns);"onselectstart"in n?o.on("selectstart.drag",os,ns):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function LR(e,n){var o=e.document.documentElement,i=$n(e).on("dragstart.drag",null);n&&(i.on("click.drag",os,ns),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function is(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function yp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Ni(){}var wi=.7,or=1/wi,Lo="\\s*([+-]?\\d+)\\s*",Ii="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Jt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",OR=/^#([0-9a-f]{3,8})$/,PR=new RegExp(`^rgb\\(${Lo},${Lo},${Lo}\\)$`),zR=new RegExp(`^rgb\\(${Jt},${Jt},${Jt}\\)$`),FR=new RegExp(`^rgba\\(${Lo},${Lo},${Lo},${Ii}\\)$`),UR=new RegExp(`^rgba\\(${Jt},${Jt},${Jt},${Ii}\\)$`),HR=new RegExp(`^hsl\\(${Ii},${Jt},${Jt}\\)$`),jR=new RegExp(`^hsla\\(${Ii},${Jt},${Jt},${Ii}\\)$`),gp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};is(Ni,vi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:bp,formatHex:bp,formatHex8:KR,formatHsl:GR,formatRgb:_p,toString:_p});function bp(){return this.rgb().formatHex()}function KR(){return this.rgb().formatHex8()}function GR(){return Ip(this).formatHsl()}function _p(){return this.rgb().formatRgb()}function vi(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=OR.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?kp(n):o===3?new vt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?ir(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?ir(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=PR.exec(e))?new vt(n[1],n[2],n[3],1):(n=zR.exec(e))?new vt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=FR.exec(e))?ir(n[1],n[2],n[3],n[4]):(n=UR.exec(e))?ir(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=HR.exec(e))?wp(n[1],n[2]/100,n[3]/100,1):(n=jR.exec(e))?wp(n[1],n[2]/100,n[3]/100,n[4]):gp.hasOwnProperty(e)?kp(gp[e]):e==="transparent"?new vt(NaN,NaN,NaN,0):null}function kp(e){return new vt(e>>16&255,e>>8&255,e&255,1)}function ir(e,n,o,i){return i<=0&&(e=n=o=NaN),new vt(e,n,o,i)}function YR(e){return e instanceof Ni||(e=vi(e)),e?(e=e.rgb(),new vt(e.r,e.g,e.b,e.opacity)):new vt}function as(e,n,o,i){return arguments.length===1?YR(e):new vt(e,n,o,i??1)}function vt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}is(vt,as,yp(Ni,{brighter(e){return e=e==null?or:Math.pow(or,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?wi:Math.pow(wi,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vt(oo(this.r),oo(this.g),oo(this.b),ar(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ep,formatHex:Ep,formatHex8:qR,formatRgb:Np,toString:Np}));function Ep(){return`#${io(this.r)}${io(this.g)}${io(this.b)}`}function qR(){return`#${io(this.r)}${io(this.g)}${io(this.b)}${io((isNaN(this.opacity)?1:this.opacity)*255)}`}function Np(){const e=ar(this.opacity);return`${e===1?"rgb(":"rgba("}${oo(this.r)}, ${oo(this.g)}, ${oo(this.b)}${e===1?")":`, ${e})`}`}function ar(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function oo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function io(e){return e=oo(e),(e<16?"0":"")+e.toString(16)}function wp(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Pt(e,n,o,i)}function Ip(e){if(e instanceof Pt)return new Pt(e.h,e.s,e.l,e.opacity);if(e instanceof Ni||(e=vi(e)),!e)return new Pt;if(e instanceof Pt)return e;e=e.rgb();var n=e.r/255,o=e.g/255,i=e.b/255,a=Math.min(n,o,i),r=Math.max(n,o,i),l=NaN,s=r-a,c=(r+a)/2;return s?(n===r?l=(o-i)/s+(o<i)*6:o===r?l=(i-n)/s+2:l=(n-o)/s+4,s/=c<.5?r+a:2-r-a,l*=60):s=c>0&&c<1?0:l,new Pt(l,s,c,e.opacity)}function WR(e,n,o,i){return arguments.length===1?Ip(e):new Pt(e,n,o,i??1)}function Pt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}is(Pt,WR,yp(Ni,{brighter(e){return e=e==null?or:Math.pow(or,e),new Pt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?wi:Math.pow(wi,e),new Pt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*n,a=2*o-i;return new vt(rs(e>=240?e-240:e+120,a,i),rs(e,a,i),rs(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Pt(vp(this.h),rr(this.s),rr(this.l),ar(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ar(this.opacity);return`${e===1?"hsl(":"hsla("}${vp(this.h)}, ${rr(this.s)*100}%, ${rr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vp(e){return e=(e||0)%360,e<0?e+360:e}function rr(e){return Math.max(0,Math.min(1,e||0))}function rs(e,n,o){return(e<60?n+(o-n)*e/60:e<180?o:e<240?n+(o-n)*(240-e)/60:n)*255}const xp=e=>()=>e;function JR(e,n){return function(o){return e+o*n}}function XR(e,n,o){return e=Math.pow(e,o),n=Math.pow(n,o)-e,o=1/o,function(i){return Math.pow(e+i*n,o)}}function ZR(e){return(e=+e)==1?Cp:function(n,o){return o-n?XR(n,o,e):xp(isNaN(n)?o:n)}}function Cp(e,n){var o=n-e;return o?JR(e,o):xp(isNaN(e)?n:e)}const Sp=(function e(n){var o=ZR(n);function i(a,r){var l=o((a=as(a)).r,(r=as(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Cp(a.opacity,r.opacity);return function(u){return a.r=l(u),a.g=s(u),a.b=c(u),a.opacity=d(u),a+""}}return i.gamma=e,i})(1);function Tn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var ls=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ss=new RegExp(ls.source,"g");function QR(e){return function(){return e}}function e$(e){return function(n){return e(n)+""}}function t$(e,n){var o=ls.lastIndex=ss.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=ls.exec(e))&&(a=ss.exec(n));)(r=a.index)>o&&(r=n.slice(o,r),s[l]?s[l]+=r:s[++l]=r),(i=i[0])===(a=a[0])?s[l]?s[l]+=a:s[++l]=a:(s[++l]=null,c.push({i:l,x:Tn(i,a)})),o=ss.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?e$(c[0].x):QR(n):(n=c.length,function(d){for(var u=0,m;u<n;++u)s[(m=c[u]).i]=m.x(d);return s.join("")})}var Rp=180/Math.PI,cs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $p(e,n,o,i,a,r){var l,s,c;return(l=Math.sqrt(e*e+n*n))&&(e/=l,n/=l),(c=e*o+n*i)&&(o-=e*c,i-=n*c),(s=Math.sqrt(o*o+i*i))&&(o/=s,i/=s,c/=s),e*i<n*o&&(e=-e,n=-n,c=-c,l=-l),{translateX:a,translateY:r,rotate:Math.atan2(n,e)*Rp,skewX:Math.atan(c)*Rp,scaleX:l,scaleY:s}}var lr;function n$(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?cs:$p(n.a,n.b,n.c,n.d,n.e,n.f)}function o$(e){return e==null||(lr||(lr=document.createElementNS("http://www.w3.org/2000/svg","g")),lr.setAttribute("transform",e),!(e=lr.transform.baseVal.consolidate()))?cs:(e=e.matrix,$p(e.a,e.b,e.c,e.d,e.e,e.f))}function Ap(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push("translate(",null,n,null,o);y.push({i:b-4,x:Tn(d,m)},{i:b-2,x:Tn(u,h)})}else(m||h)&&p.push("translate("+m+n+h+o)}function l(d,u,m,h){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),h.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Tn(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,h){d!==u?h.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Tn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,p,y){if(d!==m||u!==h){var b=p.push(a(p)+"scale(",null,",",null,")");y.push({i:b-4,x:Tn(d,m)},{i:b-2,x:Tn(u,h)})}else(m!==1||h!==1)&&p.push(a(p)+"scale("+m+","+h+")")}return function(d,u){var m=[],h=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,h),l(d.rotate,u.rotate,m,h),s(d.skewX,u.skewX,m,h),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,h),d=u=null,function(p){for(var y=-1,b=h.length,f;++y<b;)m[(f=h[y]).i]=f.x(p);return m.join("")}}}var i$=Ap(n$,"px, ","px)","deg)"),a$=Ap(o$,", ",")",")"),r$=1e-12;function Tp(e){return((e=Math.exp(e))+1/e)/2}function l$(e){return((e=Math.exp(e))-1/e)/2}function s$(e){return((e=Math.exp(2*e))-1)/(e+1)}const c$=(function e(n,o,i){function a(r,l){var s=r[0],c=r[1],d=r[2],u=l[0],m=l[1],h=l[2],p=u-s,y=m-c,b=p*p+y*y,f,g;if(b<r$)g=Math.log(h/d)/n,f=function(x){return[s+x*p,c+x*y,d*Math.exp(n*x*g)]};else{var k=Math.sqrt(b),_=(h*h-d*d+i*b)/(2*d*o*k),N=(h*h-d*d-i*b)/(2*h*o*k),I=Math.log(Math.sqrt(_*_+1)-_),A=Math.log(Math.sqrt(N*N+1)-N);g=(A-I)/n,f=function(x){var $=x*g,T=Tp(I),V=d/(o*k)*(T*s$(n*$+I)-l$(I));return[s+V*p,c+V*y,d*T/Tp(n*$+I)]}}return f.duration=g*1e3*n/Math.SQRT2,f}return a.rho=function(r){var l=Math.max(.001,+r),s=l*l,c=s*s;return e(l,s,c)},a})(Math.SQRT2,2,4);var Oo=0,xi=0,Ci=0,Mp=1e3,sr,Si,cr=0,ao=0,dr=0,Ri=typeof performance=="object"&&performance.now?performance:Date,Vp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ds(){return ao||(Vp(d$),ao=Ri.now()+dr)}function d$(){ao=0}function ur(){this._call=this._time=this._next=null}ur.prototype=Bp.prototype={constructor:ur,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?ds():+o)+(n==null?0:+n),!this._next&&Si!==this&&(Si?Si._next=this:sr=this,Si=this),this._call=e,this._time=o,us()},stop:function(){this._call&&(this._call=null,this._time=1/0,us())}};function Bp(e,n,o){var i=new ur;return i.restart(e,n,o),i}function u$(){ds(),++Oo;for(var e=sr,n;e;)(n=ao-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Oo}function Dp(){ao=(cr=Ri.now())+dr,Oo=xi=0;try{u$()}finally{Oo=0,f$(),ao=0}}function m$(){var e=Ri.now(),n=e-cr;n>Mp&&(dr-=n,cr=e)}function f$(){for(var e,n=sr,o,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(o=n._next,n._next=null,n=e?e._next=o:sr=o);Si=e,us(i)}function us(e){if(!Oo){xi&&(xi=clearTimeout(xi));var n=e-ao;n>24?(e<1/0&&(xi=setTimeout(Dp,e-Ri.now()-dr)),Ci&&(Ci=clearInterval(Ci))):(Ci||(cr=Ri.now(),Ci=setInterval(m$,Mp)),Oo=1,Vp(Dp))}}function Lp(e,n,o){var i=new ur;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var p$=Zl("start","end","cancel","interrupt"),h$=[],Op=0,Pp=1,ms=2,mr=3,zp=4,fs=5,fr=6;function pr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;y$(e,o,{name:n,index:i,group:a,on:p$,tween:h$,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Op})}function ps(e,n){var o=zt(e,n);if(o.state>Op)throw new Error("too late; already scheduled");return o}function Xt(e,n){var o=zt(e,n);if(o.state>mr)throw new Error("too late; already running");return o}function zt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function y$(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Bp(r,0,o.time);function r(d){o.state=Pp,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,p;if(o.state!==Pp)return c();for(u in i)if(p=i[u],p.name===o.name){if(p.state===mr)return Lp(l);p.state===zp?(p.state=fr,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete i[u]):+u<n&&(p.state=fr,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete i[u])}if(Lp(function(){o.state===mr&&(o.state=zp,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ms,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ms){for(o.state=mr,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(p=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=p);a.length=m+1}}function s(d){for(var u=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(c),o.state=fs,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===fs&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=fr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function hr(e,n){var o=e.__transition,i,a,r=!0,l;if(o){n=n==null?null:n+"";for(l in o){if((i=o[l]).name!==n){r=!1;continue}a=i.state>ms&&i.state<fs,i.state=fr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function g$(e){return this.each(function(){hr(this,e)})}function b$(e,n){var o,i;return function(){var a=Xt(this,e),r=a.tween;if(r!==o){i=o=r;for(var l=0,s=i.length;l<s;++l)if(i[l].name===n){i=i.slice(),i.splice(l,1);break}}a.tween=i}}function _$(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Xt(this,e),l=r.tween;if(l!==i){a=(i=l).slice();for(var s={name:n,value:o},c=0,d=a.length;c<d;++c)if(a[c].name===n){a[c]=s;break}c===d&&a.push(s)}r.tween=a}}function k$(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=zt(this.node(),o).tween,a=0,r=i.length,l;a<r;++a)if((l=i[a]).name===e)return l.value;return null}return this.each((n==null?b$:_$)(o,e,n))}function hs(e,n,o){var i=e._id;return e.each(function(){var a=Xt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return zt(a,i).value[n]}}function Fp(e,n){var o;return(typeof n=="number"?Tn:n instanceof vi?Sp:(o=vi(n))?(n=o,Sp):t$)(e,n)}function E$(e){return function(){this.removeAttribute(e)}}function N$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function w$(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttribute(e);return l===a?null:l===i?r:r=n(i=l,o)}}function I$(e,n,o){var i,a=o+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===a?null:l===i?r:r=n(i=l,o)}}function v$(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function x$(e,n,o){var i,a,r;return function(){var l,s=o(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),c=s+"",l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s)))}}function C$(e,n){var o=tr(e),i=o==="transform"?a$:Fp;return this.attrTween(e,typeof n=="function"?(o.local?x$:v$)(o,i,hs(this,"attr."+e,n)):n==null?(o.local?N$:E$)(o):(o.local?I$:w$)(o,i,n))}function S$(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function R$(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function $$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&R$(e,r)),o}return a._value=n,a}function A$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&S$(e,r)),o}return a._value=n,a}function T$(e,n){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;var i=tr(e);return this.tween(o,(i.local?$$:A$)(i,n))}function M$(e,n){return function(){ps(this,e).delay=+n.apply(this,arguments)}}function V$(e,n){return n=+n,function(){ps(this,e).delay=n}}function B$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?M$:V$)(n,e)):zt(this.node(),n).delay}function D$(e,n){return function(){Xt(this,e).duration=+n.apply(this,arguments)}}function L$(e,n){return n=+n,function(){Xt(this,e).duration=n}}function O$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?D$:L$)(n,e)):zt(this.node(),n).duration}function P$(e,n){if(typeof n!="function")throw new Error;return function(){Xt(this,e).ease=n}}function z$(e){var n=this._id;return arguments.length?this.each(P$(n,e)):zt(this.node(),n).ease}function F$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Xt(this,e).ease=o}}function U$(e){if(typeof e!="function")throw new Error;return this.each(F$(this._id,e))}function H$(e){typeof e!="function"&&(e=rp(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a<o;++a)for(var r=n[a],l=r.length,s=i[a]=[],c,d=0;d<l;++d)(c=r[d])&&e.call(c,c.__data__,d,r)&&s.push(c);return new fn(i,this._parents,this._name,this._id)}function j$(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,o=e._groups,i=n.length,a=o.length,r=Math.min(i,a),l=new Array(i),s=0;s<r;++s)for(var c=n[s],d=o[s],u=c.length,m=l[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||d[p])&&(m[p]=h);for(;s<i;++s)l[s]=n[s];return new fn(l,this._parents,this._name,this._id)}function K$(e){return(e+"").trim().split(/^|\s+/).every(function(n){var o=n.indexOf(".");return o>=0&&(n=n.slice(0,o)),!n||n==="start"})}function G$(e,n,o){var i,a,r=K$(n)?ps:Xt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function Y$(e,n){var o=this._id;return arguments.length<2?zt(this.node(),o).on.on(e):this.each(G$(o,e,n))}function q$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function W$(){return this.on("end.remove",q$(this._id))}function J$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=es(e));for(var i=this._groups,a=i.length,r=new Array(a),l=0;l<a;++l)for(var s=i[l],c=s.length,d=r[l]=new Array(c),u,m,h=0;h<c;++h)(u=s[h])&&(m=e.call(u,u.__data__,h,s))&&("__data__"in u&&(m.__data__=u.__data__),d[h]=m,pr(d[h],n,o,h,d,zt(u,o)));return new fn(r,this._parents,n,o)}function X$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=ap(e));for(var i=this._groups,a=i.length,r=[],l=[],s=0;s<a;++s)for(var c=i[s],d=c.length,u,m=0;m<d;++m)if(u=c[m]){for(var h=e.call(u,u.__data__,m,c),p,y=zt(u,o),b=0,f=h.length;b<f;++b)(p=h[b])&&pr(p,n,o,b,h,y);r.push(h),l.push(u)}return new fn(r,l,n,o)}var Z$=Ei.prototype.constructor;function Q$(){return new Z$(this._groups,this._parents)}function eA(e,n){var o,i,a;return function(){var r=Do(this,e),l=(this.style.removeProperty(e),Do(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function Up(e){return function(){this.style.removeProperty(e)}}function tA(e,n,o){var i,a=o+"",r;return function(){var l=Do(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function nA(e,n,o){var i,a,r;return function(){var l=Do(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Do(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function oA(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Xt(this,e),d=c.on,u=c.value[r]==null?s||(s=Up(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function iA(e,n,o){var i=(e+="")=="transform"?i$:Fp;return n==null?this.styleTween(e,eA(e,i)).on("end.style."+e,Up(e)):typeof n=="function"?this.styleTween(e,nA(e,i,hs(this,"style."+e,n))).each(oA(this._id,e)):this.styleTween(e,tA(e,i,n),o).on("end.style."+e,null)}function aA(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function rA(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&aA(e,l,o)),i}return r._value=n,r}function lA(e,n,o){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,rA(e,n,o??""))}function sA(e){return function(){this.textContent=e}}function cA(e){return function(){var n=e(this);this.textContent=n??""}}function dA(e){return this.tween("text",typeof e=="function"?cA(hs(this,"text",e)):sA(e==null?"":e+""))}function uA(e){return function(n){this.textContent=e.call(this,n)}}function mA(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&uA(a)),n}return i._value=e,i}function fA(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,mA(e))}function pA(){for(var e=this._name,n=this._id,o=Hp(),i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)if(c=l[d]){var u=zt(c,n);pr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new fn(i,this._parents,e,o)}function hA(){var e,n,o=this,i=o._id,a=o.size();return new Promise(function(r,l){var s={value:l},c={value:function(){--a===0&&r()}};o.each(function(){var d=Xt(this,i),u=d.on;u!==e&&(n=(e=u).copy(),n._.cancel.push(s),n._.interrupt.push(s),n._.end.push(c)),d.on=n}),a===0&&r()})}var yA=0;function fn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Hp(){return++yA}var pn=Ei.prototype;fn.prototype={constructor:fn,select:J$,selectAll:X$,selectChild:pn.selectChild,selectChildren:pn.selectChildren,filter:H$,merge:j$,selection:Q$,transition:pA,call:pn.call,nodes:pn.nodes,node:pn.node,size:pn.size,empty:pn.empty,each:pn.each,on:Y$,attr:C$,attrTween:T$,style:iA,styleTween:lA,text:dA,textTween:fA,remove:W$,tween:k$,delay:B$,duration:O$,ease:z$,easeVarying:U$,end:hA,[Symbol.iterator]:pn[Symbol.iterator]};function gA(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var bA={time:null,delay:0,duration:250,ease:gA};function _A(e,n){for(var o;!(o=e.__transition)||!(o=o[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return o}function kA(e){var n,o;e instanceof fn?(n=e._id,e=e._name):(n=Hp(),(o=bA).time=ds(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,r=0;r<a;++r)for(var l=i[r],s=l.length,c,d=0;d<s;++d)(c=l[d])&&pr(c,e,n,d,l,o||_A(c,n));return new fn(i,this._parents,e,n)}Ei.prototype.interrupt=g$,Ei.prototype.transition=kA;const yr=e=>()=>e;function EA(e,{sourceEvent:n,target:o,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function hn(e,n,o){this.k=e,this.x=n,this.y=o}hn.prototype={constructor:hn,scale:function(e){return e===1?this:new hn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new hn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ys=new hn(1,0,0);hn.prototype;function gs(e){e.stopImmediatePropagation()}function $i(e){e.preventDefault(),e.stopImmediatePropagation()}function NA(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function wA(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function jp(){return this.__zoom||ys}function IA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function vA(){return navigator.maxTouchPoints||"ontouchstart"in this}function xA(e,n,o){var i=e.invertX(n[0][0])-o[0][0],a=e.invertX(n[1][0])-o[1][0],r=e.invertY(n[0][1])-o[0][1],l=e.invertY(n[1][1])-o[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function CA(){var e=NA,n=wA,o=xA,i=IA,a=vA,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=c$,d=Zl("start","zoom","end"),u,m,h,p=500,y=150,b=0,f=10;function g(E){E.property("__zoom",jp).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",V).filter(a).on("touchstart.zoom",R).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(E,w,S,B){var z=E.selection?E.selection():E;z.property("__zoom",jp),E!==z?I(E,w,S,B):z.interrupt().each(function(){A(this,arguments).event(B).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},g.scaleBy=function(E,w,S,B){g.scaleTo(E,function(){var z=this.__zoom.k,K=typeof w=="function"?w.apply(this,arguments):w;return z*K},S,B)},g.scaleTo=function(E,w,S,B){g.transform(E,function(){var z=n.apply(this,arguments),K=this.__zoom,J=S==null?N(z):typeof S=="function"?S.apply(this,arguments):S,re=K.invert(J),pe=typeof w=="function"?w.apply(this,arguments):w;return o(_(k(K,pe),J,re),z,l)},S,B)},g.translateBy=function(E,w,S,B){g.transform(E,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof S=="function"?S.apply(this,arguments):S),n.apply(this,arguments),l)},null,B)},g.translateTo=function(E,w,S,B,z){g.transform(E,function(){var K=n.apply(this,arguments),J=this.__zoom,re=B==null?N(K):typeof B=="function"?B.apply(this,arguments):B;return o(ys.translate(re[0],re[1]).scale(J.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof S=="function"?-S.apply(this,arguments):-S),K,l)},B,z)};function k(E,w){return w=Math.max(r[0],Math.min(r[1],w)),w===E.k?E:new hn(w,E.x,E.y)}function _(E,w,S){var B=w[0]-S[0]*E.k,z=w[1]-S[1]*E.k;return B===E.x&&z===E.y?E:new hn(E.k,B,z)}function N(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function I(E,w,S,B){E.on("start.zoom",function(){A(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(B).end()}).tween("zoom",function(){var z=this,K=arguments,J=A(z,K).event(B),re=n.apply(z,K),pe=S==null?N(re):typeof S=="function"?S.apply(z,K):S,ce=Math.max(re[1][0]-re[0][0],re[1][1]-re[0][1]),Ne=z.__zoom,he=typeof w=="function"?w.apply(z,K):w,de=c(Ne.invert(pe).concat(ce/Ne.k),he.invert(pe).concat(ce/he.k));return function(_e){if(_e===1)_e=he;else{var Se=de(_e),me=ce/Se[2];_e=new hn(me,pe[0]-Se[0]*me,pe[1]-Se[1]*me)}J.zoom(null,_e)}})}function A(E,w,S){return!S&&E.__zooming||new x(E,w)}function x(E,w){this.that=E,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(E,w),this.taps=0}x.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,w){return this.mouse&&E!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var w=$n(this.that).datum();d.call(E,this.that,new EA(E,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),w)}};function $(E,...w){if(!e.apply(this,arguments))return;var S=A(this,w).event(E),B=this.__zoom,z=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,i.apply(this,arguments)))),K=An(E);if(S.wheel)(S.mouse[0][0]!==K[0]||S.mouse[0][1]!==K[1])&&(S.mouse[1]=B.invert(S.mouse[0]=K)),clearTimeout(S.wheel);else{if(B.k===z)return;S.mouse=[K,B.invert(K)],hr(this),S.start()}$i(E),S.wheel=setTimeout(J,y),S.zoom("mouse",o(_(k(B,z),S.mouse[0],S.mouse[1]),S.extent,l));function J(){S.wheel=null,S.end()}}function T(E,...w){if(h||!e.apply(this,arguments))return;var S=E.currentTarget,B=A(this,w,!0).event(E),z=$n(E.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ce,!0),K=An(E,S),J=E.clientX,re=E.clientY;DR(E.view),gs(E),B.mouse=[K,this.__zoom.invert(K)],hr(this),B.start();function pe(Ne){if($i(Ne),!B.moved){var he=Ne.clientX-J,de=Ne.clientY-re;B.moved=he*he+de*de>b}B.event(Ne).zoom("mouse",o(_(B.that.__zoom,B.mouse[0]=An(Ne,S),B.mouse[1]),B.extent,l))}function ce(Ne){z.on("mousemove.zoom mouseup.zoom",null),LR(Ne.view,B.moved),$i(Ne),B.event(Ne).end()}}function V(E,...w){if(e.apply(this,arguments)){var S=this.__zoom,B=An(E.changedTouches?E.changedTouches[0]:E,this),z=S.invert(B),K=S.k*(E.shiftKey?.5:2),J=o(_(k(S,K),B,z),n.apply(this,w),l);$i(E),s>0?$n(this).transition().duration(s).call(I,J,B,E):$n(this).call(g.transform,J,B,E)}}function R(E,...w){if(e.apply(this,arguments)){var S=E.touches,B=S.length,z=A(this,w,E.changedTouches.length===B).event(E),K,J,re,pe;for(gs(E),J=0;J<B;++J)re=S[J],pe=An(re,this),pe=[pe,this.__zoom.invert(pe),re.identifier],z.touch0?!z.touch1&&z.touch0[2]!==pe[2]&&(z.touch1=pe,z.taps=0):(z.touch0=pe,K=!0,z.taps=1+!!u);u&&(u=clearTimeout(u)),K&&(z.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},p)),hr(this),z.start())}}function C(E,...w){if(this.__zooming){var S=A(this,w).event(E),B=E.changedTouches,z=B.length,K,J,re,pe;for($i(E),K=0;K<z;++K)J=B[K],re=An(J,this),S.touch0&&S.touch0[2]===J.identifier?S.touch0[0]=re:S.touch1&&S.touch1[2]===J.identifier&&(S.touch1[0]=re);if(J=S.that.__zoom,S.touch1){var ce=S.touch0[0],Ne=S.touch0[1],he=S.touch1[0],de=S.touch1[1],_e=(_e=he[0]-ce[0])*_e+(_e=he[1]-ce[1])*_e,Se=(Se=de[0]-Ne[0])*Se+(Se=de[1]-Ne[1])*Se;J=k(J,Math.sqrt(_e/Se)),re=[(ce[0]+he[0])/2,(ce[1]+he[1])/2],pe=[(Ne[0]+de[0])/2,(Ne[1]+de[1])/2]}else if(S.touch0)re=S.touch0[0],pe=S.touch0[1];else return;S.zoom("touch",o(_(J,re,pe),S.extent,l))}}function M(E,...w){if(this.__zooming){var S=A(this,w).event(E),B=E.changedTouches,z=B.length,K,J;for(gs(E),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),K=0;K<z;++K)J=B[K],S.touch0&&S.touch0[2]===J.identifier?delete S.touch0:S.touch1&&S.touch1[2]===J.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(J=An(J,this),Math.hypot(m[0]-J[0],m[1]-J[1])<f)){var re=$n(this).on("dblclick.zoom");re&&re.apply(this,arguments)}}}return g.wheelDelta=function(E){return arguments.length?(i=typeof E=="function"?E:yr(+E),g):i},g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:yr(!!E),g):e},g.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:yr(!!E),g):a},g.extent=function(E){return arguments.length?(n=typeof E=="function"?E:yr([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),g):n},g.scaleExtent=function(E){return arguments.length?(r[0]=+E[0],r[1]=+E[1],g):[r[0],r[1]]},g.translateExtent=function(E){return arguments.length?(l[0][0]=+E[0][0],l[1][0]=+E[1][0],l[0][1]=+E[0][1],l[1][1]=+E[1][1],g):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},g.constrain=function(E){return arguments.length?(o=E,g):o},g.duration=function(E){return arguments.length?(s=+E,g):s},g.interpolate=function(E){return arguments.length?(c=E,g):c},g.on=function(){var E=d.on.apply(d,arguments);return E===d?g:E},g.clickDistance=function(E){return arguments.length?(b=(E=+E)*E,g):Math.sqrt(b)},g.tapDistance=function(E){return arguments.length?(f=+E,g):f},g}const Kp=Symbol("MiniMapSlots"),SA=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],RA={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},$A=t.defineComponent({...RA,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:n}){const o=e,i=t.inject(Kp),a=t.useAttrs(),r=t.toRef(()=>a.style??{});function l(m){n("click",m)}function s(m){n("dblclick",m)}function c(m){n("mouseenter",m)}function d(m){n("mousemove",m)}function u(m){n("mouseleave",m)}return(m,h)=>!m.hidden&&m.dimensions.width!==0&&m.dimensions.height!==0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.unref(i)[`node-${o.type}`]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(i)[`node-${o.type}`]),t.normalizeProps(t.mergeProps({key:0},{...o,...m.$attrs})),null,16)):(t.openBlock(),t.createElementBlock("rect",t.mergeProps({key:1,id:m.id},m.$attrs,{class:["vue-flow__minimap-node",{selected:m.selected,dragging:m.dragging}],x:m.position.x,y:m.position.y,rx:m.borderRadius,ry:m.borderRadius,width:m.dimensions.width,height:m.dimensions.height,fill:m.color||r.value.background||r.value.backgroundColor,stroke:m.strokeColor,"stroke-width":m.strokeWidth,"shape-rendering":m.shapeRendering,onClick:l,onDblclick:s,onMouseenter:c,onMousemove:d,onMouseleave:u}),null,16,SA))],64)):t.createCommentVNode("",!0)}}),AA=["width","height","viewBox","aria-labelledby"],TA=["id"],MA=["d","fill","stroke","stroke-width"],VA={name:"MiniMap",compatConfig:{MODE:3}},BA=t.defineComponent({...VA,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:n}){const o=t.useSlots(),i=t.useAttrs(),a=200,r=150,{id:l,edges:s,viewport:c,translateExtent:d,dimensions:u,emits:m,d3Selection:h,d3Zoom:p,getNodesInitialized:y}=je(),b=t.ref();t.provide(Kp,o);const f=t.toRef(()=>{var z;return e.width??((z=i.style)==null?void 0:z.width)??a}),g=t.toRef(()=>{var z;return e.height??((z=i.style)==null?void 0:z.height)??r}),k=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",_=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),N=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),I=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),A=t.computed(()=>Al(y.value.filter(z=>!z.hidden))),x=t.computed(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:u.value.width/c.value.zoom,height:u.value.height/c.value.zoom})),$=t.computed(()=>y.value&&y.value.length?o0(A.value,x.value):x.value),T=t.computed(()=>{const z=$.value.width/f.value,K=$.value.height/g.value;return Math.max(z,K)}),V=t.computed(()=>{const z=T.value*f.value,K=T.value*g.value,J=e.offsetScale*T.value;return{offset:J,x:$.value.x-(z-$.value.width)/2-J,y:$.value.y-(K-$.value.height)/2-J,width:z+J*2,height:K+J*2}}),R=t.computed(()=>!V.value.x||!V.value.y?"":`
53
53
  M${V.value.x-V.value.offset},${V.value.y-V.value.offset}
54
54
  h${V.value.width+V.value.offset*2}
55
55
  v${V.value.height+V.value.offset*2}