@g1cloud/entity-modeler-next 5.1.4 → 5.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/fkDerived.d.ts +50 -1
- package/dist/core/javaTypes.d.ts +3 -1
- package/dist/core/propagation.d.ts +6 -1
- package/dist/core/scaffoldJava.d.ts +86 -1
- package/dist/core/types.d.ts +14 -0
- package/dist/entity-modeler-next.css +1 -1
- package/dist/entity-modeler.js +12234 -11750
- package/dist/entity-modeler.umd.cjs +29 -29
- package/dist/i18n/ko.d.ts +10 -3
- package/dist/view/columnResolution.d.ts +30 -0
- package/dist/view/embedSlotCollapse.d.ts +9 -1
- package/dist/view/useAttributeEditing.d.ts +13 -1
- package/package.json +1 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
(function(be,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],t):(be=typeof globalThis<"u"?globalThis:be||self,t(be.EntityModeler={},be.Vue,be.OpenBlueseaCore))})(this,(function(be,t,ee){"use strict";var yD=Object.defineProperty;var gD=(be,t,ee)=>t in be?yD(be,t,{enumerable:!0,configurable:!0,writable:!0,value:ee}):be[t]=ee;var Xe=(be,t,ee)=>gD(be,typeof t!="symbol"?t+"":t,ee);const $h={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Th(e,n){const o=e%n.perRow,i=Math.floor(e/n.perRow);return{location:{x:n.startX+o*n.columnGap,y:n.startY+i*n.rowGap},size:{...n.defaultSize}}}function $s(e,n,o={}){const i={...$h,...o},a=new Map(e.entities.map(_=>[_.modelId,_])),r=new Map(n.entityLayouts.map(_=>[_.entityRef,_])),l=new Map(n.associationLayouts.map(_=>[_.associationRef,_])),s=new Map;for(const _ of e.groups)for(const E of _.memberEntityRefs)s.set(E,_.modelId);const c=new Map;for(const _ of n.groupLayouts)for(const E of _.memberNoteRefs??[])c.set(E,_.groupRef);let d=0;const u=e.entities.map(_=>{const E=s.get(_.modelId),N=r.get(_.modelId);if(N){const k={location:{x:N.geo.location.x,y:N.geo.location.y},size:{width:N.geo.size.width,height:N.geo.size.height}};return{entity:_,geo:k,collapsed:N.collapsed??!1,locked:N.locked??!1,groupRef:E,style:N.style,attributeStyles:N.attributeStyles,operationStyles:N.operationStyles}}const p=Th(d++,i);return{entity:_,geo:p,collapsed:!1,locked:!1,groupRef:E}}),m=new Map(n.groupLayouts.map(_=>[_.groupRef,_])),h=e.groups.map(_=>{const E=m.get(_.modelId),N=E?{location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:_,geo:N,style:E==null?void 0:E.style,locked:(E==null?void 0:E.locked)??!1}}),f=e.associations.map(_=>{const E=l.get(_.modelId);return{association:_,waypoints:(E==null?void 0:E.waypoints)??[],sourceColumnRef:E==null?void 0:E.sourceColumnRef,targetColumnRef:E==null?void 0:E.targetColumnRef}}),y=n.notes.map(_=>({note:{..._,geo:{location:{x:_.geo.location.x,y:_.geo.location.y},size:{width:_.geo.size.width,height:_.geo.size.height}}},groupRef:c.get(_.modelId)})),g=[];for(const _ of n.notes)for(const E of _.connections??[])a.has(E.targetRef)&&g.push({noteRef:_.modelId,targetRef:E.targetRef,waypoints:E.waypoints.map(N=>({x:N.x,y:N.y}))});return{entities:u,associations:f,groups:h,notes:y,noteConnections:g}}const Mh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function Ts(e,n,o={}){const i={...Mh,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),h=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const y=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((g,_)=>{const E=_%y,N=Math.floor(_/y);r.push({id:g,location:{x:h.x+i.pad+E*i.cellWidth,y:h.y+i.pad+i.headerHeight+N*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const h=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+h*i.cellWidth,y:d+f*i.cellHeight}})}),r}const Ms={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Vh(e,n={}){const o={...Ms,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Er(e,n={}){const o={...Ms,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Vh(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function Vn(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function Vs(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const Oi="inherited:";function Bs(e,n){return`${Oi}${e}:${n}`}function Bn(e){return e.startsWith(Oi)}function Nr(e){if(!Bn(e))return null;const n=e.slice(Oi.length),o=n.indexOf(":");if(o<0)return null;const i=n.slice(0,o),a=n.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function Ko(e,n){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(n.some(r=>r.name===e.name))return[];const o=e.superClass||((a=n.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=n.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Bs(i.name,r.field),baseClass:i.name,field:r.field,physicalName:r.physicalName,dataType:r.dataType,logicalName:r.logicalName,length:r.length,scale:r.scale})):[]}const Bh={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function Go(e){return Bh[e]??e}function Li(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function Pi(e,n,o,i,a=0){var u;if(!Li(e))return;const r=i.find(m=>m.end1.attributeRef===e.modelId||m.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(m=>m.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(u=e.derivedFrom)==null?void 0:u.sourceAttributeRef;if(c){const m=s==null?void 0:s.attributes.find(h=>h.modelId===c);if(m)return m.dbAttrs[a];for(const h of o){const f=h.attributes.find(y=>y.modelId===c);if(f)return f.dbAttrs[a]}}return s?s.attributes.filter(m=>m.identifier&&(m.attrType==="NORMAL"||m.attrType==="RELATION_OWN")).sort((m,h)=>m.order-h.order).flatMap(m=>m.dbAttrs)[a]:void 0}function Dh(e,n,o){var i,a,r,l;if(e.attrType==="EMBED_PREDEF"){const s=(a=(i=n==null?void 0:n.embeddableCatalog)==null?void 0:i.find(c=>c.type===e.type))==null?void 0:a.fields;return e.dbAttrs.map((c,d)=>{var u;return((u=s==null?void 0:s[d])==null?void 0:u.name)||void 0})}if(e.attrType==="EMBED_OWN"){const s=(r=e.embedded)==null?void 0:r.embeddableRef,c=s!=null?(l=n==null?void 0:n.entities)==null?void 0:l.find(u=>u.modelId===s):void 0,d=Ds(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function nn(e,n){return Ds(e,n,new Set)}function Ds(e,n,o){if(e==null||o.has(e.modelId))return[];const i=new Set(o).add(e.modelId);return e.attributes.flatMap(a=>{const r=Dh(a,n,i),l=a.name??"";return a.dbAttrs.map((s,c)=>({col:s,propertyPath:l?r===void 0?a.dbAttrs.length>1?"":l:r[c]?`${l}.${r[c]}`:"":"",defaultPhysical:s.physicalName??"",...s.sharedColumnRef!=null?{defaultSharedRef:s.sharedColumnRef}:{},ownColumn:!!s.physicalName&&s.sharedColumnRef==null}))})}const Os=e=>e==null||e.trim()==="";function Ls(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=nn(i.entities.find(u=>u.modelId===d))[n])==null?void 0:c.col}if(e.attrType.startsWith("RELATION"))return Pi(e,o,i.entities,i.associations,n)}function on(e,n,o,i,a,r){const l=Ls(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:Oh(n.logicalName)?n.logicalName:l.logicalName,...n.sharedColumnRef==null&&!n.physicalName&&l.sharedColumnRef!=null&&(e.attrType==="EMBED_OWN"||e.attrType==="EMBED_PREDEF")?{sharedColumnRef:l.sharedColumnRef}:{}}:n}function Oh(e){return e!=null&&Object.values(e).some(n=>!Os(n))}function Yo(e,n,o,i,a,r){var l;return Os(n.physicalName)?((l=Ls(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function Ps(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let h=0;h<m.dbAttrs.length;h++){if(u===n)return m.name||void 0;u++}}}function wr(e,n){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=n.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function Nn(e,n){return wr(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function co(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Dn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function zi(e,n,o,i,a="(논리명)"){switch(e){case"CLASS":return n;case"PHYSICAL":return i||n;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}const zs="(미지정)",Lh="(이름 없음)",Fi=e=>e==null||String(e).trim()==="",Ui=e=>Fi(e)?Lh:String(e),Fs=e=>Fi(e)?zs:String(e);function Us(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}return zs}function Hs(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=Fi(n)?Fs(e.physicalName):String(n),a=Fi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function js(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function Ks(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((r=c.name)==null?void 0:r.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(l=c.table)!=null&&l.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${Ui(c.name)}${d} «${Go(c.stereotype)}»${u?` [${u}]`:""}`);const m=co(Nn(c,e.entities)),h=_=>{var E;return _.sharedColumnRef?(E=Dn(_,m))==null?void 0:E.physicalName:void 0},f=[...c.attributes].sort((_,E)=>_.order-E.order);for(const _ of f){if(_.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${_.name?` ${_.name} ${"─".repeat(8)}`:""}`);continue}const E=_.dbAttrs.map(($,L)=>on(_,$,L,c,e,n)),N=[_.identifier?"PK":"",_.notNull?"NOT NULL":""].filter(Boolean),p=` - ${Ui(_.name)}: ${Fs(_.type)}`,k=$=>$.length?` {${$.join(", ")}}`:"";if(E.length>1){a.push(`${p}${k(N)}`),E.forEach(($,L)=>{const V=Ps(_,L,e,n);a.push(` · ${V?`${V} → `:""}${Hs($,h($))}${k(js($))}`)});continue}const I=E[0],A=I?` → ${Hs(I,h(I))}`:"";a.push(`${p}${A}${k([...N,...I?js(I):[]])}`)}const y=Vn(c.attributes);for(const _ of c.indexes??[]){const E=_.columns.map(N=>{var p,k;return`${((p=y.attributeOf(N.columnRef))==null?void 0:p.name)??((k=Nr(N.columnRef))==null?void 0:k.field)??N.columnRef}${N.descending?" DESC":""}`}).join(", ");a.push(` index ${Ui(_.name)}${_.unique?" UNIQUE":""}: ${E}`)}const g=[...c.operations??[]].sort((_,E)=>_.order-E.order);for(const _ of g){const E=_.visibility?` {${_.visibility}}`:"",N=(s=_.description)!=null&&s.ko?` — ${_.description.ko}`:"";a.push(` method ${Ui(_.name)}()${E}${N}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${Us(c.end1.multiplicity)} —— ${Us(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
-
`).trim()}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`),o=[],i=new Map,a=[],r=new Set,l=d=>{const u=i.get(d);if(u)return u;const m={modelId:
|
|
6
|
-
`)}function
|
|
7
|
-
`)+(
|
|
8
|
-
${
|
|
9
|
-
${
|
|
10
|
-
);`);const
|
|
1
|
+
(function(Ne,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@g1cloud/open-bluesea-core")):typeof define=="function"&&define.amd?define(["exports","vue","@g1cloud/open-bluesea-core"],t):(Ne=typeof globalThis<"u"?globalThis:Ne||self,t(Ne.EntityModeler={},Ne.Vue,Ne.OpenBlueseaCore))})(this,(function(Ne,t,te){"use strict";var KD=Object.defineProperty;var GD=(Ne,t,te)=>t in Ne?KD(Ne,t,{enumerable:!0,configurable:!0,writable:!0,value:te}):Ne[t]=te;var ct=(Ne,t,te)=>GD(Ne,typeof t!="symbol"?t+"":t,te);const zh={startX:40,startY:40,columnGap:280,rowGap:220,perRow:4,defaultSize:{width:220,height:140}};function Fh(e,n){const o=e%n.perRow,i=Math.floor(e/n.perRow);return{location:{x:n.startX+o*n.columnGap,y:n.startY+i*n.rowGap},size:{...n.defaultSize}}}function Ys(e,n,o={}){const i={...zh,...o},a=new Map(e.entities.map(g=>[g.modelId,g])),r=new Map(n.entityLayouts.map(g=>[g.entityRef,g])),l=new Map(n.associationLayouts.map(g=>[g.associationRef,g])),s=new Map;for(const g of e.groups)for(const b of g.memberEntityRefs)s.set(b,g.modelId);const c=new Map;for(const g of n.groupLayouts)for(const b of g.memberNoteRefs??[])c.set(b,g.groupRef);let d=0;const u=e.entities.map(g=>{const b=s.get(g.modelId),E=r.get(g.modelId);if(E){const N={location:{x:E.geo.location.x,y:E.geo.location.y},size:{width:E.geo.size.width,height:E.geo.size.height}};return{entity:g,geo:N,collapsed:E.collapsed??!1,locked:E.locked??!1,groupRef:b,style:E.style,attributeStyles:E.attributeStyles,operationStyles:E.operationStyles}}const h=Fh(d++,i);return{entity:g,geo:h,collapsed:!1,locked:!1,groupRef:b}}),m=new Map(n.groupLayouts.map(g=>[g.groupRef,g])),p=e.groups.map(g=>{const b=m.get(g.modelId),E=b?{location:{x:b.geo.location.x,y:b.geo.location.y},size:{width:b.geo.size.width,height:b.geo.size.height}}:{location:{x:0,y:0},size:{width:400,height:300}};return{group:g,geo:E,style:b==null?void 0:b.style,locked:(b==null?void 0:b.locked)??!1}}),f=e.associations.map(g=>{const b=l.get(g.modelId);return{association:g,waypoints:(b==null?void 0:b.waypoints)??[],sourceColumnRef:b==null?void 0:b.sourceColumnRef,targetColumnRef:b==null?void 0:b.targetColumnRef}}),y=n.notes.map(g=>({note:{...g,geo:{location:{x:g.geo.location.x,y:g.geo.location.y},size:{width:g.geo.size.width,height:g.geo.size.height}}},groupRef:c.get(g.modelId)})),_=[];for(const g of n.notes)for(const b of g.connections??[])a.has(b.targetRef)&&_.push({noteRef:g.modelId,targetRef:b.targetRef,waypoints:b.waypoints.map(E=>({x:E.x,y:E.y}))});return{entities:u,associations:f,groups:p,notes:y,noteConnections:_}}const Uh={cellWidth:260,cellHeight:200,pad:24,headerHeight:28,ungroupedCols:4};function qs(e,n,o={}){const i={...Uh,...o},a=new Map(n.groupLayouts.map(u=>[u.groupRef,u.geo])),r=[];let l=0;for(const u of e.groups){const m=a.get(u.modelId),p=m?m.location:{x:0,y:0},f=m?m.size.width:800;m&&(l=Math.max(l,m.location.y+m.size.height));const y=Math.max(1,Math.floor((f-i.pad*2)/i.cellWidth));u.memberEntityRefs.forEach((_,g)=>{const b=g%y,E=Math.floor(g/y);r.push({id:_,location:{x:p.x+i.pad+b*i.cellWidth,y:p.y+i.pad+i.headerHeight+E*i.cellHeight}})})}const s=new Set(e.groups.flatMap(u=>u.memberEntityRefs)),c=e.entities.filter(u=>!s.has(u.modelId)),d=l>0?l+40:i.pad;return c.forEach((u,m)=>{const p=m%i.ungroupedCols,f=Math.floor(m/i.ungroupedCols);r.push({id:u.modelId,location:{x:i.pad+p*i.cellWidth,y:d+f*i.cellHeight}})}),r}const Ws={cols:5,boxWidth:200,gap:60,baseX:0,baseY:0,headerHeight:48,rowHeight:24,footerHeight:16,minHeight:120};function Hh(e,n={}){const o={...Ws,...n},i=o.headerHeight+Math.max(0,e)*o.rowHeight+o.footerHeight;return Math.max(o.minHeight,i)}function Vr(e,n={}){const o={...Ws,...n},i=Math.max(1,o.cols),a=new Array(i).fill(o.baseY);return e.map((r,l)=>{const s=l%i,c=Hh(r.attributeCount,o),d=o.baseX+s*(o.boxWidth+o.gap),u=a[s];return a[s]=u+c+o.gap,{id:r.id,location:{x:d,y:u},size:{width:o.boxWidth,height:c}}})}function Hn(e){const n=new Map,o=new Map;for(const i of e){o.set(i.modelId,i),i.dbAttrs.length===1&&n.set(i.modelId,i.dbAttrs[0]);for(const a of i.dbAttrs)n.set(a.modelId,a),o.set(a.modelId,i)}return{attributeOf:i=>o.get(i),columnOf:i=>n.get(i),canon:i=>{var a;return((a=n.get(i))==null?void 0:a.modelId)??i}}}function Js(e,n){const o=e.attributeOf(n);if(!o)return n;const i=o.name||"(이름 없음)";if(o.dbAttrs.length<=1)return i;const a=e.columnOf(n);if(!a)return`${i}(컬럼 ${o.dbAttrs.length}개 중 미지정)`;const r=o.dbAttrs.findIndex(l=>l.modelId===a.modelId);return`${i}.${a.physicalName||`#${r+1}`}`}const qi="inherited:";function Xs(e,n){return`${qi}${e}:${n}`}function jn(e){return e.startsWith(qi)}function Br(e){if(!jn(e))return null;const n=e.slice(qi.length),o=n.indexOf(":");if(o<0)return null;const i=n.slice(0,o),a=n.slice(o+1);return!i||!a?null:{baseClass:i,field:a}}function Qo(e,n){var a;if(e.stereotype==="JPA_EMBEDDABLE")return[];if(n.some(r=>r.name===e.name))return[];const o=e.superClass||((a=n.find(r=>r.default))==null?void 0:a.name);if(!o)return[];const i=n.find(r=>r.name===o);return i?i.columns.map(r=>({modelId:Xs(i.name,r.field),baseClass:i.name,field:r.field,physicalName:r.physicalName,dataType:r.dataType,logicalName:r.logicalName,length:r.length,scale:r.scale})):[]}const jh={UNDEFINED:"Undefined",JPA_ENTITY:"Entity",JPA_EMBEDDABLE:"Embeddable",JPA_MULTI_LANGUAGE_ENTITY:"MultiLanguageEntity"};function ei(e){return jh[e]??e}function Wi(e){return e.attrType.startsWith("RELATION")&&e.dbAttrs.length>0}function mn(e){return e.attrType==="RELATION_OWN"&&e.dbAttrs.length>1}function Dr(e){const n=new Set;for(const o of e)o.end2.attributeRef&&n.add(o.end2.attributeRef),o.end1.attributeRef&&o.end1.navigable&&n.add(o.end1.attributeRef);return n}function Or(e,n,o){var a;if(e.attrType!=="RELATION_OWN"||o.has(e.modelId))return!1;const i=(a=e.derivedFrom)==null?void 0:a.associationRef;return i?n.attributes.some(r=>{var l;return r.modelId!==e.modelId&&r.attrType==="RELATION_OWN"&&((l=r.derivedFrom)==null?void 0:l.associationRef)===i&&o.has(r.modelId)}):!1}function Kn(e,n,o,i,a=0){var d;if(!Wi(e))return;const r=i.find(u=>u.end1.attributeRef===e.modelId||u.end2.attributeRef===e.modelId),l=n==null?void 0:n.modelId,s=r?o.find(u=>u.modelId===(r.end1.entityRef===l?r.end2.entityRef:r.end1.entityRef)):void 0,c=(d=e.derivedFrom)==null?void 0:d.sourceAttributeRef;if(c){const u=s==null?void 0:s.attributes.find(m=>m.modelId===c);if(u!=null&&u.dbAttrs[a])return u.dbAttrs[a];if(u)return ti(s)[a];for(const m of o){const p=m.attributes.find(f=>f.modelId===c);if(p)return p.dbAttrs[a]??ti(s)[a]}}if(s)return ti(s)[a]}function ti(e){return((e==null?void 0:e.attributes)??[]).filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).slice().sort((n,o)=>n.order-o.order).flatMap(n=>n.dbAttrs)}function Kh(e,n,o){var i,a,r,l;if(e.attrType==="EMBED_PREDEF"){const s=(a=(i=n==null?void 0:n.embeddableCatalog)==null?void 0:i.find(c=>c.type===e.type))==null?void 0:a.fields;return e.dbAttrs.map((c,d)=>{var u;return((u=s==null?void 0:s[d])==null?void 0:u.name)||void 0})}if(e.attrType==="EMBED_OWN"){const s=(r=e.embedded)==null?void 0:r.embeddableRef,c=s!=null?(l=n==null?void 0:n.entities)==null?void 0:l.find(u=>u.modelId===s):void 0,d=Zs(c,n,o);return d.length!==e.dbAttrs.length?e.dbAttrs.map(()=>{}):d.map(u=>u.propertyPath||void 0)}}function fn(e,n){return Zs(e,n,new Set)}function Zs(e,n,o){if(e==null||o.has(e.modelId))return[];const i=new Set(o).add(e.modelId);return e.attributes.flatMap(a=>{const r=Kh(a,n,i),l=a.name??"";return a.dbAttrs.map((s,c)=>({col:s,propertyPath:l?r===void 0?a.dbAttrs.length>1?"":l:r[c]?`${l}.${r[c]}`:"":"",defaultPhysical:s.physicalName??"",...s.sharedColumnRef!=null?{defaultSharedRef:s.sharedColumnRef}:{},ownColumn:!!s.physicalName&&s.sharedColumnRef==null}))})}const Qs=e=>e==null||e.trim()==="";function ec(e,n,o,i,a){var r,l,s,c;if(e.attrType==="EMBED_PREDEF")return(l=(r=a==null?void 0:a.embeddableCatalog)==null?void 0:r.find(d=>d.type===e.type))==null?void 0:l.fields[n];if(e.attrType==="EMBED_OWN"){const d=(s=e.embedded)==null?void 0:s.embeddableRef;return d==null||(c=fn(i.entities.find(u=>u.modelId===d))[n])==null?void 0:c.col}if(e.attrType.startsWith("RELATION"))return Kn(e,o,i.entities,i.associations,n)}function pn(e,n,o,i,a,r){const l=ec(e,o,i,a,r);return l?{...n,physicalName:n.physicalName||l.physicalName||"",dataType:n.dataType||l.dataType||"",length:n.length??l.length,scale:n.scale??l.scale,logicalName:Gh(n.logicalName)?n.logicalName:l.logicalName,...n.sharedColumnRef==null&&!n.physicalName&&l.sharedColumnRef!=null&&(e.attrType==="EMBED_OWN"||e.attrType==="EMBED_PREDEF")?{sharedColumnRef:l.sharedColumnRef}:{}}:n}function Gh(e){return e!=null&&Object.values(e).some(n=>!Qs(n))}function ni(e,n,o,i,a,r){var l;return Qs(n.physicalName)?((l=ec(e,o,i,a,r))==null?void 0:l.physicalName)??"":n.physicalName}function tc(e,n,o,i){var a,r,l,s;if(e.attrType==="EMBED_PREDEF")return((l=(r=(a=i==null?void 0:i.embeddableCatalog)==null?void 0:a.find(c=>c.type===e.type))==null?void 0:r.fields[n])==null?void 0:l.name)||void 0;if(e.attrType==="EMBED_OWN"){const c=(s=e.embedded)==null?void 0:s.embeddableRef;if(c==null)return;const d=o.entities.find(m=>m.modelId===c);if(!d)return;let u=0;for(const m of d.attributes)for(let p=0;p<m.dbAttrs.length;p++){if(u===n)return m.name||void 0;u++}}}function Lr(e,n){if(e.stereotype!=="JPA_EMBEDDABLE")return[e];const o=n.filter(i=>i.modelId!==e.modelId&&i.attributes.some(a=>{var r;return a.attrType==="EMBED_OWN"&&((r=a.embedded)==null?void 0:r.embeddableRef)===e.modelId}));return[e,...o]}function $n(e,n){return Lr(e,n).flatMap(o=>o.attributes.flatMap(i=>i.dbAttrs))}function ko(e){const n=new Map;for(const o of e)n.set(o.modelId,o);return n}function Gn(e,n){if(e.sharedColumnRef==null)return null;const o=n.get(e.sharedColumnRef);return o?{physicalName:o.physicalName,insertable:!1,updatable:!1}:null}function Ji(e,n,o,i,a="(논리명)"){switch(e){case"CLASS":return n;case"PHYSICAL":return i||n;case"LOGICAL":return o||a;default:return i?`${o||a} · ${i}`:o||a}}const nc="(미지정)",Yh="(이름 없음)",Xi=e=>e==null||String(e).trim()==="",Zi=e=>Xi(e)?Yh:String(e),oc=e=>Xi(e)?nc:String(e);function ic(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}return nc}function ac(e,n){const o=e.length?`(${e.length}${e.scale!=null?`,${e.scale}`:""})`:"",i=Xi(n)?oc(e.physicalName):String(n),a=Xi(e.dataType)?"":String(e.dataType).trim();return a?`${i} ${a}${o}`:i}function rc(e){return[e.unique?"UNIQUE":"",e.autoIncrement?"AUTO_INCREMENT":"",e.sharedColumnRef?"SHARED":""].filter(Boolean)}function lc(e,n){var r,l,s;const o=new Map(e.entities.map(c=>[c.modelId,c.name])),i=new Map;for(const c of e.groups)for(const d of c.memberEntityRefs)i.set(d,c.packageName||(((r=c.name)==null?void 0:r.ko)??c.modelId));const a=[];for(const c of e.entities){const d=(l=c.table)!=null&&l.physicalName?` (${c.table.physicalName})`:"",u=i.get(c.modelId);a.push(`## ${Zi(c.name)}${d} «${ei(c.stereotype)}»${u?` [${u}]`:""}`);const m=ko($n(c,e.entities)),p=g=>{var b;return g.sharedColumnRef?(b=Gn(g,m))==null?void 0:b.physicalName:void 0},f=[...c.attributes].sort((g,b)=>g.order-b.order);for(const g of f){if(g.attrType==="DIVIDER"){a.push(` ${"─".repeat(8)}${g.name?` ${g.name} ${"─".repeat(8)}`:""}`);continue}const b=g.dbAttrs.map((S,V)=>pn(g,S,V,c,e,n)),E=[g.identifier?"PK":"",g.notNull?"NOT NULL":""].filter(Boolean),h=` - ${Zi(g.name)}: ${oc(g.type)}`,N=S=>S.length?` {${S.join(", ")}}`:"";if(b.length>1){a.push(`${h}${N(E)}`),b.forEach((S,V)=>{const $=tc(g,V,e,n);a.push(` · ${$?`${$} → `:""}${ac(S,p(S))}${N(rc(S))}`)});continue}const w=b[0],C=w?` → ${ac(w,p(w))}`:"";a.push(`${h}${C}${N([...E,...w?rc(w):[]])}`)}const y=Hn(c.attributes);for(const g of c.indexes??[]){const b=g.columns.map(E=>{var h,N;return`${((h=y.attributeOf(E.columnRef))==null?void 0:h.name)??((N=Br(E.columnRef))==null?void 0:N.field)??E.columnRef}${E.descending?" DESC":""}`}).join(", ");a.push(` index ${Zi(g.name)}${g.unique?" UNIQUE":""}: ${b}`)}const _=[...c.operations??[]].sort((g,b)=>g.order-b.order);for(const g of _){const b=g.visibility?` {${g.visibility}}`:"",E=(s=g.description)!=null&&s.ko?` — ${g.description.ko}`:"";a.push(` method ${Zi(g.name)}()${b}${E}`)}a.push("")}if(e.associations.length){a.push("# 관계");for(const c of e.associations){const d=o.get(c.end1.entityRef)??c.end1.entityRef,u=o.get(c.end2.entityRef)??c.end2.entityRef,m=c.end2.composition||c.end1.composition?" (composition)":"";a.push(` ${d} ${ic(c.end1.multiplicity)} —— ${ic(c.end2.multiplicity)} ${u}${m}`)}}return a.join(`
|
|
2
|
+
`).trim()}function Eo(e){return e.referenceOnly===!0}function Pr(e){const n=new Set;for(const o of e.entities)Eo(o)&&n.add(o.modelId);return n}function sc(e){return e.entities.filter(n=>!Eo(n))}function cc(e,n=Pr(e)){return n.size===0?e.associations:e.associations.filter(o=>!n.has(o.end1.entityRef)&&!n.has(o.end2.entityRef))}function zr(e,n){return n?{...e,entities:e.entities.map(o=>o.referenceOnly?o:{...o,referenceOnly:!0})}:e}function qh(e,n){return Eo(e)||n===!0}const Wh=e=>e&&e[0].toLowerCase()+e.slice(1);function Qi(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function dc(e){return e!=="EXACTLY_ONE_INSTANCE"&&e!=="ONE_OR_MORE_INSTANCES"}function ea(e){switch(e){case"NO_INSTANCE_OR_ONE_INSTANCE":return"0..1";case"EXACTLY_ONE_INSTANCE":return"1";case"ZERO_OR_MORE_INSTANCES":return"0..*";case"ONE_OR_MORE_INSTANCES":return"1..*"}}function Jh(e){return/[^aeiou]y$/.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/.test(e)?`${e}es`:`${e}s`}function ta(e,n){const o=Wh(e);return n?Jh(o):o}function No(e,n){if(!n.has(e))return e;for(let o=2;;o++){const i=`${e}${o}`;if(!n.has(i))return i}}function Xh(e){return e==="CLASS"?"class":"er"}function Fr(e,n,o){const i=Zh(e);return n==="class"?ay(i):ny(i,o)}function Zh(e){const n=Pr(e);return n.size===0?e:{...e,entities:sc(e),associations:cc(e,n)}}function oi(e,n){return(e??"").trim().replace(/[^0-9A-Za-z_]/g,"_").replace(/^(\d)/,"_$1")||n}function Ur(e){return(e??"").replace(/"/g,"'").replace(/\s+/g," ").trim()}function uc(e,n){const o=new Set,i=new Map;return e.entities.forEach((a,r)=>{const l=oi(n(a),`Entity_${r+1}`);let s=l,c=2;for(;o.has(s);)s=`${l}_${c++}`;o.add(s),i.set(a.modelId,s)}),i}function Qh(e){return e.attrType==="RELATION_OWN"||e.attrType==="RELATION_REF"||e.derivedFrom!=null}const mc=ea;function Hr(e){return e!=null&&fc[e]!=null}const fc={NO_INSTANCE_OR_ONE_INSTANCE:"|o",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"}o",ONE_OR_MORE_INSTANCES:"}|"};function pc(e,n){const o={NO_INSTANCE_OR_ONE_INSTANCE:"o|",EXACTLY_ONE_INSTANCE:"||",ZERO_OR_MORE_INSTANCES:"o{",ONE_OR_MORE_INSTANCES:"|{"},i=Hr(e)?e:"ZERO_OR_MORE_INSTANCES";return(n==="left"?fc:o)[i]}function ey(e,n,o,i){if(e.dbAttrs.length===0)return[];const a=[];return e.dbAttrs.forEach((r,l)=>{var p;const s=pn(e,r,l,n,o,i);if(s.sharedColumnRef!=null)return;const c=l===0?e.name:tc(e,l,o,i),d=oi(s.dataType||e.type,"unknown"),u=oi(s.physicalName||c,"col"),m=s.length?`(${s.length}${s.scale!=null?`,${s.scale}`:""})`:"";a.push(ty(d,u,e,s.unique===!0,m,(p=s.logicalName)==null?void 0:p.ko))}),a}function ty(e,n,o,i,a,r){const l=[o.identifier?"PK":"",Qh(o)?"FK":"",i?"UK":""].filter(Boolean).join(", "),s=Ur([r,a].filter(Boolean).join(" ")),c=[` ${e} ${n}`];return l&&c.push(l),c.join(" ")+(s?` "${s}"`:"")}function ny(e,n){const o=uc(e,r=>{var l;return((l=r.table)==null?void 0:l.physicalName)||r.name}),i=["erDiagram"];for(const r of e.entities){const l=o.get(r.modelId),s=[...r.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);if(s.length===0){i.push(` ${l}`);continue}i.push(` ${l} {`);for(const c of s)for(const d of ey(c,r,e,n))i.push(d);i.push(" }")}const a=[];for(const r of e.associations){const l=o.get(r.end1.entityRef),s=o.get(r.end2.entityRef);if(!l||!s)continue;const c=`${pc(r.end1.multiplicity,"left")}--${pc(r.end2.multiplicity,"right")}`,d=Ur(r.description);i.push(` ${l} ${c} ${s} : "${d}"`),(!Hr(r.end1.multiplicity)||!Hr(r.end2.multiplicity))&&a.push(`${l} -- ${s}`)}if(a.length>0){i.push(`%% ⚠ 다중성 미지정 ${a.length}건 — 0..*(가장 약한 주장)로 표기함. 모델을 정정할 지점:`);for(const r of a)i.push(`%% ${r}`)}return i.join(`
|
|
3
|
+
`)}function oy(e){return e&&e!=="UNDEFINED"?ei(e):null}function iy(e){return(e??"").trim().replace(/</g,"~").replace(/>/g,"~").replace(/[^0-9A-Za-z_~]/g,"")||"any"}function ay(e){const n=uc(e,i=>i.name),o=["classDiagram"];for(const i of e.entities){const a=n.get(i.modelId),r=[],l=oy(i.stereotype);l&&r.push(` <<${l}>>`);const s=[...i.attributes].filter(c=>c.attrType!=="DIVIDER").sort((c,d)=>c.order-d.order);for(const c of s)r.push(` +${iy(c.type)} ${oi(c.name,"field")}`);for(const c of[...i.operations??[]].sort((d,u)=>d.order-u.order))r.push(` +${oi(c.name,"op")}()`);r.length===0?o.push(` class ${a}`):(o.push(` class ${a} {`),o.push(...r),o.push(" }"))}for(const i of e.associations){const a=n.get(i.end1.entityRef),r=n.get(i.end2.entityRef);if(!a||!r)continue;const l=ry(i),s=Ur(i.description),c=` ${a} "${mc(i.end1.multiplicity)}" ${l} "${mc(i.end2.multiplicity)}" ${r}`;o.push(s?`${c} : ${s}`:c)}return o.join(`
|
|
4
|
+
`)}function ry(e){return e.end1.composition||e.end2.composition?"*--":e.end2.navigable||e.end1.navigable?"-->":"--"}function Pe(){return crypto.randomUUID()}const hc=["BIT","TINYINT","SMALLINT","INTEGER","BIGINT","FLOAT","REAL","DOUBLE","NUMERIC","DECIMAL","CHAR","VARCHAR","LONGVARCHAR","DATE","TIME","TIMESTAMP","BINARY","VARBINARY","LONGVARBINARY","NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","BLOB","CLOB","REF","DATALINK","BOOLEAN","ROWID","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","REF_CURSOR","TIME_WITH_TIMEZONE","TIMESTAMP_WITH_TIMEZONE","SERIAL","BIG_SERIAL","JSONB"],ly=new Set(["NULL","OTHER","JAVA_OBJECT","DISTINCT","STRUCT","ARRAY","REF","DATALINK","ROWID","REF_CURSOR","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","SQLXML","TIME_WITH_TIMEZONE","BIT","TINYINT","FLOAT"]),sy=hc.filter(e=>!ly.has(e)),cy={TIMESTAMP_WITH_TIMEZONE:"TIMESTAMP WITH TIME ZONE",BIG_SERIAL:"BIGSERIAL",DOUBLE:"DOUBLE PRECISION"};function jr(e){return cy[e]??e}const dy=new Set(["CHAR","VARCHAR","NCHAR","NVARCHAR","BINARY","VARBINARY","NUMERIC","DECIMAL"]),Kr=new Set(["NUMERIC","DECIMAL"]);function yc(e,n=sy){const o=[...n];return e&&!o.includes(e)?[e,...o]:o}const hn="CustomType",Yn="GroupCodeEnum",Gr="String",ii=[{value:"String",label:"String"},{value:"Integer",label:"Integer"},{value:"Long",label:"Long"},{value:"Double",label:"Double"},{value:"Boolean",label:"Boolean"},{value:"Date",label:"Date"},{value:"LocalDate",label:"LocalDate"},{value:"LocalDateTime",label:"LocalDateTime"},{value:"Instant",label:"Instant"},{value:"ZonedDateTime",label:"ZonedDateTime"},{value:"OffsetDateTime",label:"OffsetDateTime"},{value:"BigDecimal",label:"BigDecimal"},{value:"BigInteger",label:"BigInteger"},{value:"Currency",label:"Currency"},{value:"ByteArray",label:"Byte[]"},{value:"CharacterArray",label:"Character[]"},{value:"Short",label:"Short"},{value:"PrimitiveInt",label:"int",boxed:"Integer"},{value:"PrimitiveLong",label:"long",boxed:"Long"},{value:"PrimitiveDouble",label:"double",boxed:"Double"},{value:"PrimitiveBoolean",label:"boolean",boxed:"Boolean"},{value:"PrimitiveShort",label:"short",boxed:"Short"},{value:"PrimitiveByteArray",label:"byte[]",boxed:"Byte[]"},{value:"PrimitiveCharacterArray",label:"char[]",boxed:"Character[]"},{value:Yn,label:"GroupCodeEnum"},{value:"CustomMoneyType",label:"Money"},{value:hn,label:"CustomType"}],uy=new Map(ii.map(e=>[e.value,e.label]));function wo(e){return uy.get(e)??e}const my={TINYINT:"Short",SMALLINT:"Short",INTEGER:"Integer",BIGINT:"Long",SERIAL:"Integer",BIG_SERIAL:"Long",FLOAT:"Double",REAL:"Double",DOUBLE:"Double",NUMERIC:"BigDecimal",DECIMAL:"BigDecimal",CHAR:"String",VARCHAR:"String",LONGVARCHAR:"String",NCHAR:"String",NVARCHAR:"String",LONGNVARCHAR:"String",CLOB:"String",NCLOB:"String",BIT:"Boolean",BOOLEAN:"Boolean",DATE:"LocalDate",TIMESTAMP:"LocalDateTime",TIMESTAMP_WITH_TIMEZONE:"OffsetDateTime",BINARY:"ByteArray",VARBINARY:"ByteArray",LONGVARBINARY:"ByteArray",BLOB:"ByteArray"};function gc(e){if(e)return my[e.toUpperCase()]}const fy={String:new Set(["VARCHAR","CHAR","LONGVARCHAR","CLOB","NCHAR","NVARCHAR","LONGNVARCHAR","NCLOB","JSONB"]),CharacterArray:new Set(["CHAR","VARCHAR","LONGVARCHAR","CLOB"]),Integer:new Set(["INTEGER","SERIAL","SMALLINT","NUMERIC","DECIMAL"]),Long:new Set(["BIGINT","BIG_SERIAL","NUMERIC","DECIMAL"]),Short:new Set(["SMALLINT","TINYINT","NUMERIC","DECIMAL"]),Double:new Set(["DOUBLE","FLOAT","REAL","NUMERIC","DECIMAL"]),BigDecimal:new Set(["NUMERIC","DECIMAL"]),BigInteger:new Set(["NUMERIC","DECIMAL","BIGINT"]),Boolean:new Set(["BOOLEAN","BIT","CHAR","VARCHAR"]),Date:new Set(["DATE","TIME","TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),LocalDate:new Set(["DATE"]),LocalDateTime:new Set(["TIMESTAMP"]),Instant:new Set(["TIMESTAMP","TIMESTAMP_WITH_TIMEZONE"]),ZonedDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),OffsetDateTime:new Set(["TIMESTAMP_WITH_TIMEZONE","TIMESTAMP"]),ByteArray:new Set(["BINARY","VARBINARY","LONGVARBINARY","BLOB"]),Currency:new Set(["VARCHAR","CHAR"]),[Yn]:new Set(["VARCHAR","CHAR"])},py=new Map(ii.filter(e=>e.boxed).map(e=>[e.value,e.boxed]));function hy(e,n){const o=e==null?void 0:e.trim(),i=n==null?void 0:n.trim();if(!o||!i||!hc.includes(i))return;const a=py.get(o)??o,r=fy[a];if(r)return r.has(i)}const yy=new Set([Yn,"CustomMoneyType"]),bc=ii.filter(e=>!yy.has(e.value)).map(e=>e.value===hn?{...e,label:"CustomType (사용자정의)"}:e);function _c(e,n=[]){const o=n.map(a=>{var l,s;const r=((l=a.label)==null?void 0:l.ko)??((s=a.label)==null?void 0:s.en);return{value:a.type,label:r?`${a.type} (${r})`:a.type}}),i=[...bc,...o];return e&&!i.some(a=>a.value===e)?[{value:e,label:wo(e)},...i]:i}function gy(e){return e.attrType.startsWith("EMBED")&&e.dbAttrs.length>0}function na(e,n){var r;if(!e.embedded||!e.attrType.startsWith("EMBED"))return;const o=n.find(l=>l.modelId===e.embedded.associationRef);if(!o)return;const i=o.end2.entityRef===e.embedded.embeddableRef?o.end2:o.end1;if(i.multiplicity==="ZERO_OR_MORE_INSTANCES"||i.multiplicity==="ONE_OR_MORE_INSTANCES")return((r=i.jpa)==null?void 0:r.collectionType)??"LIST"}function Yr(e,n,o,i){var a;return n.attrType==="DIVIDER"||e==="LOGICAL"?"":(e==="CLASS"||mn(n))&&n.attrType.startsWith("RELATION")&&i?o?`${o==="SET"?"Set":"List"}<${i}>`:i:o&&n.attrType.startsWith("EMBED")?`${o==="SET"?"Set":"List"}<${wo(n.type)}>`:gy(n)?wo(n.type):e==="CLASS"?n.type===hn&&n.customType||wo(n.type):jr(((a=n.dbAttrs[0])==null?void 0:a.dataType)??"")}const by={"|o":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","}o":"ZERO_OR_MORE_INSTANCES","}|":"ONE_OR_MORE_INSTANCES"},_y={"o|":"NO_INSTANCE_OR_ONE_INSTANCE","||":"EXACTLY_ONE_INSTANCE","o{":"ZERO_OR_MORE_INSTANCES","|{":"ONE_OR_MORE_INSTANCES"};function ky(e,n,o){var a,r;if(!o.size)return;const i=new Map(e.map(l=>[l.modelId,l]));for(const l of e){const s=l.attributes.filter(d=>o.has(d.modelId));if(!s.length)continue;const c=n.filter(d=>d.end2.entityRef===l.modelId).map(d=>({assoc:d,parent:i.get(d.end1.entityRef)})).filter(d=>d.parent!=null);if(c.length)for(const d of s){const u=(a=d.dbAttrs[0])==null?void 0:a.physicalName,m=(f,y)=>f.attributes.find(_=>{var g;return _.identifier&&(y==null||((g=_.dbAttrs[0])==null?void 0:g.physicalName)===y)});let p=c.length===1?c[0]:void 0;if(!p){const f=c.filter(y=>m(y.parent,u)!=null);f.length===1&&(p=f[0])}p&&(d.attrType="RELATION_OWN",d.derivedFrom={associationRef:p.assoc.modelId,sourceAttributeRef:((r=m(p.parent,u)??m(p.parent))==null?void 0:r.modelId)??""},p.assoc.end2.attributeRef||(p.assoc.end2.attributeRef=d.modelId))}}}function Ey(e,n){let o=e,i;const a=o.match(/"([^"]*)"\s*$/);a&&(i=a[1],o=o.slice(0,a.index).trim());const r=o.split(/\s+/).filter(Boolean);if(r.length<2)return null;const l=r[0],s=r[1],c=new Set(r.slice(2).join(" ").split(",").map(y=>y.trim()).filter(Boolean));let d,u,m;if(i!=null){const y=i.match(/\((\d+)(?:,\s*(\d+))?\)\s*$/);if(y){d=Number(y[1]),y[2]!=null&&(u=Number(y[2]));const _=i.slice(0,y.index).trim();_&&(m=_)}else i.trim()&&(m=i.trim())}const p={modelId:Pe(),physicalName:s,dataType:l};return d!=null&&(p.length=d),u!=null&&(p.scale=u),c.has("UK")&&(p.unique=!0),m&&(p.logicalName={ko:m}),{attr:{modelId:Pe(),name:s,type:gc(l)??"",attrType:"NORMAL",identifier:c.has("PK"),notNull:c.has("PK"),order:n,dbAttrs:[p]},foreignKey:c.has("FK")}}function kc(e){const n=e.split(`
|
|
5
|
+
`),o=[],i=new Map,a=[],r=new Set,l=d=>{const u=i.get(d);if(u)return u;const m={modelId:Pe(),name:d,stereotype:"JPA_ENTITY",table:{physicalName:d},attributes:[]};return o.push(m),i.set(d,m),m};let s=null;for(const d of n){const u=d.trim();if(!u||u==="erDiagram"||u.startsWith("%%"))continue;if(s){if(u==="}"){s=null;continue}const f=Ey(u,s.attributes.length);f&&(s.attributes.push(f.attr),f.foreignKey&&r.add(f.attr.modelId));continue}const m=u.match(/^(\S+)\s*\{$/);if(m){s=l(m[1]);continue}const p=u.match(/^(\S+)\s+(\S+)\s+(\S+)\s*(?::\s*(.*))?$/);if(p&&/--|\.\./.test(p[2])){const[f,y]=p[2].split(/--|\.\./);let _=(p[4]??"").trim();const g=_.match(/^"([^"]*)"$/);g&&(_=g[1]),a.push({left:p[1],right:p[3],cardL:f??"",cardR:y??"",label:_});continue}/^\S+$/.test(u)&&l(u)}const c=a.map(d=>{const u=l(d.left),m=l(d.right);return{modelId:Pe(),description:d.label||void 0,end1:{entityRef:u.modelId,multiplicity:by[d.cardL]??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:_y[d.cardR]??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}}});return ky(o,c,r),{modelId:Pe(),entities:o,associations:c,groups:[]}}function Ec(e){const n=kc(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Vr(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:Pe(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}const Nc={smallint:{dataType:"SMALLINT"},int2:{dataType:"SMALLINT"},integer:{dataType:"INTEGER"},int:{dataType:"INTEGER"},int4:{dataType:"INTEGER"},bigint:{dataType:"BIGINT"},int8:{dataType:"BIGINT"},smallserial:{dataType:"SMALLINT",autoIncrement:!0},serial:{dataType:"INTEGER",autoIncrement:!0},serial4:{dataType:"INTEGER",autoIncrement:!0},bigserial:{dataType:"BIGINT",autoIncrement:!0},serial8:{dataType:"BIGINT",autoIncrement:!0},real:{dataType:"REAL"},float4:{dataType:"REAL"},"double precision":{dataType:"DOUBLE"},float8:{dataType:"DOUBLE"},numeric:{dataType:"NUMERIC"},decimal:{dataType:"DECIMAL"},boolean:{dataType:"BOOLEAN"},bool:{dataType:"BOOLEAN"},char:{dataType:"CHAR"},character:{dataType:"CHAR"},varchar:{dataType:"VARCHAR"},"character varying":{dataType:"VARCHAR"},text:{dataType:"LONGVARCHAR"},bytea:{dataType:"VARBINARY"},date:{dataType:"DATE"},time:{dataType:"TIME"},"time with time zone":{dataType:"TIME_WITH_TIMEZONE"},timestamp:{dataType:"TIMESTAMP"},"timestamp with time zone":{dataType:"TIMESTAMP_WITH_TIMEZONE"},jsonb:{dataType:"JSONB"},json:{dataType:"JSONB"},xml:{dataType:"SQLXML"}},Ny=Object.keys(Nc).sort((e,n)=>n.length-e.length),wc=String.raw`(?:"[^"]+"|\`[^\`]+\`|\[[^\]]+\]|\w+)`,Io=`${wc}(?:\\.${wc})*`,wy=new RegExp(String.raw`^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Io})\s*\(([\s\S]*)\)\s*$`,"i"),Iy=new RegExp(String.raw`FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Io})\s*\(([^)]*)\)`,"i"),vy=new RegExp(String.raw`^ALTER\s+TABLE\s+(?:ONLY\s+)?(${Io})\s+ADD\s+(?:CONSTRAINT\s+\S+\s+)?FOREIGN\s+KEY\s*\(([^)]*)\)\s*REFERENCES\s+(${Io})\s*\(([^)]*)\)`,"i"),Cy=new RegExp(String.raw`^CREATE\s+(UNIQUE\s+)?INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(${Io})\s+ON\s+(${Io})\s*\(([^)]*)\)`,"i");function Dt(e){let n=e.trim().replace(/[";`\[\]]/g,"");const o=n.lastIndexOf(".");return o>=0&&(n=n.slice(o+1)),n}function qn(e){const n=[];let o=0,i="";for(const a of e)a==="("?(o++,i+=a):a===")"?(o--,i+=a):a===","&&o===0?(n.push(i),i=""):i+=a;return i.trim()&&n.push(i),n.map(a=>a.trim()).filter(Boolean)}function Sy(e){const n=e.match(/^\s*("[^"]+"|`[^`]+`|\[[^\]]+\]|\S+)\s+([\s\S]+)$/);if(!n)return null;const o=Dt(n[1]),i=n[2].trim(),a=i.toLowerCase();let r="VARCHAR",l=!1,s,c,d=i,u=!1;for(const g of Ny)if(a.startsWith(g)){const b=Nc[g];r=b.dataType,l=!!b.autoIncrement;let E=i.slice(g.length);const h=E.match(/^\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\)/);h&&(s=Number(h[1]),h[2]!=null&&(c=Number(h[2])),E=E.slice(h[0].length)),d=E,u=!0;break}if(!u){const g=i.match(/^(\w+)(?:\s*\(\s*(\d+)\s*(?:,\s*(\d+))?\s*\))?([\s\S]*)$/);g&&(r=g[1].toUpperCase(),g[2]!=null&&(s=Number(g[2])),g[3]!=null&&(c=Number(g[3])),d=g[4]??"")}const m=d.toUpperCase(),p=/\bPRIMARY\s+KEY\b/.test(m),f=p||/\bNOT\s+NULL\b/.test(m),y=/\bUNIQUE\b/.test(m),_={modelId:Pe(),physicalName:o,dataType:r};return s!=null&&(_.length=s),c!=null&&(_.scale=c),y&&(_.unique=!0),l&&(_.autoIncrement=!0),{primaryKey:p,attr:{modelId:Pe(),name:o,type:gc(r)??"",attrType:"NORMAL",identifier:p,notNull:f,order:0,dbAttrs:[_]}}}function xy(e){return/^\s*(PRIMARY\s+KEY|UNIQUE|FOREIGN\s+KEY|CONSTRAINT|CHECK|EXCLUDE)\b/i.test(e)}function Ic(e){const n=e.match(/\(([^)]*)\)/);return n?qn(n[1]).map(Dt):[]}function qr(e){var d;const n=[],o=[],i=new Map,a=new Map,r=[],l=[],c=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/--[^\n]*/g," ").split(";").map(u=>u.trim()).filter(Boolean);for(const u of c){const m=u.match(wy);if(!m)continue;const p=Dt(m[1]),f=m[2],y={modelId:Pe(),name:p,stereotype:"JPA_ENTITY",table:{physicalName:p},attributes:[]},_=new Map,g=[];let b=0;for(const E of qn(f)){if(xy(E)){if(/^\s*(CONSTRAINT\s+\S+\s+)?PRIMARY\s+KEY/i.test(E))g.push(...Ic(E));else if(/^\s*(CONSTRAINT\s+\S+\s+)?UNIQUE/i.test(E))for(const w of Ic(E)){const C=_.get(w.toLowerCase());C!=null&&C.dbAttrs[0]&&(C.dbAttrs[0].unique=!0)}const N=E.match(Iy);N&&l.push({childTable:p,childCols:qn(N[1]).map(Dt),parentTable:Dt(N[2]),parentCols:qn(N[3]).map(Dt)});continue}const h=Sy(E);if(!h){n.push(`컬럼 정의 해석 실패: ${E.slice(0,40)}`);continue}h.attr.order=b++,h.attr.type||n.push(`자바 타입 미해소(수동 지정 필요): ${p}.${h.attr.name} — ${(d=h.attr.dbAttrs[0])==null?void 0:d.dataType}`),y.attributes.push(h.attr),_.set(h.attr.name.toLowerCase(),h.attr)}for(const E of g){const h=_.get(E.toLowerCase());h&&(h.identifier=!0,h.notNull=!0)}o.push(y),i.set(p.toLowerCase(),y);for(const[E,h]of _)a.set(`${p.toLowerCase()}.${E}`,h)}for(const u of c){const m=u.match(vy);m&&l.push({childTable:Dt(m[1]),childCols:qn(m[2]).map(Dt),parentTable:Dt(m[3]),parentCols:qn(m[4]).map(Dt)})}for(const u of l){const m=i.get(u.childTable.toLowerCase()),p=i.get(u.parentTable.toLowerCase());if(!m||!p){n.push(`FK 대상 테이블 없음: ${u.childTable}→${u.parentTable}`);continue}const f=a.get(`${u.childTable.toLowerCase()}.${(u.childCols[0]??"").toLowerCase()}`),y={modelId:Pe(),end1:{entityRef:p.modelId,multiplicity:f!=null&&f.notNull?"EXACTLY_ONE_INSTANCE":"NO_INSTANCE_OR_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:m.modelId,multiplicity:"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:!1}};u.childCols.forEach((_,g)=>{const b=a.get(`${u.childTable.toLowerCase()}.${_.toLowerCase()}`),E=a.get(`${u.parentTable.toLowerCase()}.${(u.parentCols[g]??"").toLowerCase()}`);b&&(b.attrType="RELATION_OWN",b.derivedFrom={associationRef:y.modelId,sourceAttributeRef:(E==null?void 0:E.modelId)??""},g===0&&(y.end2.attributeRef=b.modelId))}),r.push(y)}for(const u of c){const m=u.match(Cy);if(!m)continue;const p=Dt(m[3]),f=i.get(p.toLowerCase());if(!f){n.push(`인덱스 대상 테이블 없음: ${p}`);continue}const _=qn(m[4]).map(b=>Dt(b.replace(/\s+(ASC|DESC)$/i,""))).map(b=>{var E,h;return(h=(E=a.get(`${p.toLowerCase()}.${b.toLowerCase()}`))==null?void 0:E.dbAttrs[0])==null?void 0:h.modelId}).filter(b=>!!b).map(b=>({columnRef:b,descending:!1}));if(!_.length)continue;const g={modelId:Pe(),name:Dt(m[2]),unique:!!m[1],columns:_};f.indexes=[...f.indexes??[],g]}return{logical:{modelId:Pe(),entities:o,associations:r,groups:[]},warnings:n}}function vc(e){const{logical:n}=qr(e),o=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(n.entities.length||1)))),a=Vr(n.entities.map(l=>({id:l.modelId,attributeCount:l.attributes.length})),{cols:o}).map(l=>({entityRef:l.id,geo:{location:l.location,size:l.size}})),r={diagramId:Pe(),logicalModelRef:n.modelId,entityLayouts:a,associationLayouts:n.associations.map(l=>({associationRef:l.modelId,waypoints:[]})),groupLayouts:[],notes:[]};return{logical:n,layout:r}}function Ry(){return"postgres"}function Cc(e,n="postgres",o){return By(e,o)}const vo=e=>e==null||e.trim()==="";function oa(e){return[...e.attributes].filter(n=>n.attrType!=="DIVIDER"&&!n.transient).sort((n,o)=>n.order-o.order)}function Ay(e){const n=new Set;for(const o of e.groups)if(o.excludeDDLGeneration)for(const i of o.memberEntityRefs)n.add(i);return e.entities.filter(o=>o.stereotype!=="JPA_EMBEDDABLE"&&!n.has(o.modelId)&&!Eo(o))}function Wr(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name}const $y={SMALLINT:"smallint",TINYINT:"smallint",INTEGER:"integer",BIGINT:"bigint",SERIAL:"serial",BIG_SERIAL:"bigserial",REAL:"real",FLOAT:"double precision",DOUBLE:"double precision",BOOLEAN:"boolean",BIT:"boolean",LONGVARCHAR:"text",LONGNVARCHAR:"text",CLOB:"text",NCLOB:"text",BINARY:"bytea",VARBINARY:"bytea",LONGVARBINARY:"bytea",BLOB:"bytea",DATE:"date",TIME:"time",TIME_WITH_TIMEZONE:"time with time zone",TIMESTAMP:"timestamp",TIMESTAMP_WITH_TIMEZONE:"timestamp with time zone",JSONB:"jsonb",JAVA_OBJECT:"jsonb",SQLXML:"xml"};function Ty(e){const n=e.dataType;if(e.autoIncrement){if(n==="BIGINT")return"bigserial";if(n==="SMALLINT")return"smallserial";if(n==="INTEGER")return"serial"}return n==="NUMERIC"||n==="DECIMAL"?e.length==null?"numeric":e.scale!=null?`numeric(${e.length}, ${e.scale})`:`numeric(${e.length})`:n==="CHAR"||n==="NCHAR"?e.length!=null?`char(${e.length})`:"char":n==="VARCHAR"||n==="NVARCHAR"?e.length!=null?`varchar(${e.length})`:"varchar":$y[n]??n.toLowerCase()}function My(e,n,o){const i=[];for(const a of oa(e))a.dbAttrs.forEach((r,l)=>{const s=pn(a,r,l,e,n,o);Sc(s)&&i.push({attr:a,col:s,name:s.physicalName})});return i}function Sc(e){return e.sharedColumnRef==null&&!vo(e.physicalName)&&!vo(e.dataType)}function Vy(e){return[` -- ⚠ 컬럼명 충돌로 ${e.length}개 컬럼 생략 (CHK-NAME-2 — 같은 물리명을 둘 이상이 사용):`,...e.map(({attr:o,name:i})=>` -- ${o.name||"(이름 없음)"} → ${i}`)].join(`
|
|
6
|
+
`)}function By(e,n){const o=Ay(e),i=new Map,a=new Map;for(const d of e.entities)for(const u of oa(d)){i.set(u.modelId,d);const m=[];u.dbAttrs.forEach((p,f)=>{const y=pn(u,p,f,d,e,n);Sc(y)&&(m[f]=y.physicalName)}),a.set(u.modelId,m)}const r=[],l=[],s=[];for(const d of o){const u=Wr(d),m=My(d,e,n);if(m.length===0)continue;const p=new Map,f=new Map;for(const{attr:S,col:V,name:$}of m){const R=S.dbAttrs.findIndex(T=>T.modelId===V.modelId),x=p.get(S.modelId)??[];x[R<0?x.length:R]=$,p.set(S.modelId,x),f.set(V.modelId,$)}const y=new Set,_=[],g=[];for(const{attr:S,col:V,name:$}of m){if(y.has($)){_.push({attr:S,col:V,name:$});continue}y.add($);const R=[` ${$} ${Ty(V)}`];S.notNull&&!S.identifier&&R.push("NOT NULL"),V.unique&&R.push("UNIQUE"),g.push(R.join(" "))}const b=oa(d).filter(S=>S.identifier).flatMap(S=>p.get(S.modelId)??[]).filter(S=>!vo(S));b.length&&g.push(` PRIMARY KEY (${b.join(", ")})`);const E=g.join(`,
|
|
7
|
+
`)+(_.length?`
|
|
8
|
+
${Vy(_)}`:"");r.push(`CREATE TABLE ${u} (
|
|
9
|
+
${E}
|
|
10
|
+
);`);const h=new Map,N=[];for(const S of oa(d)){const V=S.derivedFrom;if(!V)continue;const $=i.get(V.sourceAttributeRef);if(!$)continue;if(Eo($)){N.push(`${S.name||S.modelId} → ${Wr($)}`);continue}const R=p.get(S.modelId)??[],x=a.get(V.sourceAttributeRef)??[],T=[];for(let k=0;k<Math.max(R.length,x.length);k++){const v=R[k],I=x[k];vo(v)||vo(I)||T.push([v,I])}if(!T.length)continue;const M=h.get(V.associationRef)??{childCols:[],parentTable:Wr($),parentCols:[]};for(const[k,v]of T)M.childCols.push(k),M.parentCols.push(v);h.set(V.associationRef,M)}N.length&&l.push(`-- ⚠ ${u}: 참고 전용 부모를 참조하는 FK ${N.length}개 생략 — ${N.join(", ")}`);let w=0;for(const S of h.values()){const V=`fk_${u}_${S.parentTable}${h.size>1?`_${++w}`:""}`;l.push(`ALTER TABLE ${u} ADD CONSTRAINT ${V} FOREIGN KEY (${S.childCols.join(", ")}) REFERENCES ${S.parentTable} (${S.parentCols.join(", ")});`)}const C=Hn(d.attributes);for(const S of d.indexes??[]){const V=[],$=[],R=[],x=new Set;for(const M of S.columns){const k=f.get(C.canon(M.columnRef));if(vo(k)){jn(M.columnRef)||$.push(Js(C,M.columnRef));continue}if(x.has(k)){R.push(k);continue}x.add(k),V.push(k)}if($.length&&s.push(`-- ⚠ ${u} 인덱스 ${S.name||"(이름 없음)"}: 컬럼 참조 미해소 ${$.length}개 생략 — ${$.join(", ")}`),R.length&&s.push(`-- ⚠ ${u} 인덱스 ${S.name||"(이름 없음)"}: 중복 컬럼 ${R.length}개 생략 (CHK-DSN-7) — ${R.join(", ")}`),!V.length)continue;const T=S.name||`ix_${u}_${V.join("_")}`;s.push(`CREATE ${S.unique?"UNIQUE ":""}INDEX ${T} ON ${u} (${V.join(", ")});`)}}return[r.join(`
|
|
11
11
|
|
|
12
12
|
`),l.join(`
|
|
13
13
|
`),s.join(`
|
|
14
14
|
`)].filter(d=>d.length).join(`
|
|
15
15
|
|
|
16
|
-
`)}const Dr="entity-modeler-diagram",Or=1;class Pn extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function mc(e,n){return JSON.stringify({format:Dr,version:Or,logical:e,layout:n},null,2)}const Yi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),yo=e=>Array.isArray(e)?e:[];function fc(e){let n;try{n=JSON.parse(e)}catch{throw new Pn("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!Yi(n))throw new Pn("최상위가 객체가 아닙니다.");if(n.format!==Dr)throw new Pn(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Or)throw new Pn(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!Yi(o)||!Array.isArray(o.entities))throw new Pn("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!Yi(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new Pn("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:yo(o.associations),groups:yo(o.groups)},a=Yi(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:yo(a.entityLayouts),associationLayouts:yo(a.associationLayouts),groupLayouts:yo(a.groupLayouts),notes:yo(a.notes)};return{logical:i,layout:r}}const xy=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Ct(e){return e.replace(xy,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Oe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function pc(e){return`<text ${[`x="${Oe(e.x)}"`,`y="${Oe(e.y)}"`,`fill="${Ct(e.fill)}"`,`font-size="${Oe(e.fontSize)}"`,e.fontFamily?`font-family="${Ct(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Ct(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Ct(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Ct(e.text)}</text>`}function Sy(e){return`<line x1="${Oe(e.x1)}" y1="${Oe(e.y)}" x2="${Oe(e.x2)}" y2="${Oe(e.y)}" stroke="${Ct(e.stroke)}" stroke-width="${Oe(e.strokeWidth??1)}" />`}function Ry(e){return e==null?{tl:0,tr:0,br:0,bl:0}:typeof e=="number"?{tl:e,tr:e,br:e,bl:e}:e}function Ay(e,n,o,i,a){return[`M${Oe(e+a.tl)},${Oe(n)}`,`L${Oe(e+o-a.tr)},${Oe(n)}`,a.tr?`Q${Oe(e+o)},${Oe(n)} ${Oe(e+o)},${Oe(n+a.tr)}`:"",`L${Oe(e+o)},${Oe(n+i-a.br)}`,a.br?`Q${Oe(e+o)},${Oe(n+i)} ${Oe(e+o-a.br)},${Oe(n+i)}`:"",`L${Oe(e+a.bl)},${Oe(n+i)}`,a.bl?`Q${Oe(e)},${Oe(n+i)} ${Oe(e)},${Oe(n+i-a.bl)}`:"",`L${Oe(e)},${Oe(n+a.tl)}`,a.tl?`Q${Oe(e)},${Oe(n)} ${Oe(e+a.tl)},${Oe(n)}`:"","Z"].filter(Boolean).join(" ")}function Lr(e){const n=Ry(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${Ct(e.fill)}"`,`stroke="${Ct(e.stroke)}"`,`stroke-width="${Oe(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Ct(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${Oe(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Ay(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${Oe(e.x)}" y="${Oe(e.y)}" width="${Oe(e.w)}" height="${Oe(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Sy(l));for(const l of e.texts)r.push(pc(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function $y(e){const o=[`<path ${[`d="${Ct(e.d)}"`,'fill="none"',`stroke="${Ct(e.stroke)}"`,`stroke-width="${Oe(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Ct(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(pc(i));return`<g>${o.join("")}</g>`}function hc(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${Oe(n)}" y="${Oe(o)}" width="${Oe(i)}" height="${Oe(a)}" fill="${Ct(e.background)}" />`);for(const l of e.groups)r.push(Lr(l));for(const l of e.edges)r.push($y(l));for(const l of e.entities)r.push(Lr(l));for(const l of e.notes)r.push(Lr(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${Oe(n)} ${Oe(o)} ${Oe(i)} ${Oe(a)}" width="${Oe(i)}" height="${Oe(a)}">`+r.join("")+"</svg>"}function qi(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function Ty(e,n,o){const i=qi(e,o),a=qi(n,o);return i.kind===a.kind&&i.value!==a.value}const Pr=()=>crypto.randomUUID(),yc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,My=e=>e&&e[0].toLowerCase()+e.slice(1),Vy=e=>e&&e[0].toUpperCase()+e.slice(1),gc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase();function By(e,n){return My(e??"")+Vy(n??"")}function Dy(e,n){const o=mo(e.name,n);return o===e.name?e:{...e,name:o,dbAttrs:e.dbAttrs.map(i=>({...i,physicalName:gc(o)}))}}function bc(e,n){const o=e.entities.find(s=>s.modelId===n.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!qs(n.end1.multiplicity);return o.attributes.filter(s=>s.identifier&&(s.attrType==="NORMAL"||s.attrType==="RELATION_OWN")).sort((s,c)=>s.order-c.order).map(s=>{const c=By(o.name,s.name);return{associationRef:n.modelId,sourceAttributeRef:s.modelId,name:c,type:s.type,identifier:a,notNull:r,dbAttrs:s.dbAttrs.map(d=>({physicalName:gc(c),logicalName:d.logicalName,dataType:d.dataType,length:d.length,scale:d.scale}))}})}const Wi=(e,n)=>`${e}::${n}`,Ji=e=>e??void 0;function Oy(e,n,o){const i={};return e.type!==n.type&&(i.type=n.type),e.identifier!==n.identifier&&(i.identifier=n.identifier),e.notNull!==n.notNull&&(i.notNull=n.notNull),(e.dbAttrs.length!==n.dbAttrs.length||n.dbAttrs.some((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||Ji(s.length)!==Ji(r.length)||Ji(s.scale)!==Ji(r.scale)}))&&(i.dbAttrs=n.dbAttrs.map((r,l)=>{const s=e.dbAttrs[l];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??r.physicalName,logicalName:(s==null?void 0:s.logicalName)??r.logicalName,dataType:r.dataType,length:r.length,scale:r.scale}})),Object.keys(i).length?i:null}function Ly(e,n,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:n,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function Jo(e,n,o=Pr){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===n);if(!a)return i;const r=e.associations.filter(f=>f.end2.entityRef===n),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(f=>bc(e,f)),s=new Map(l.map(f=>[Wi(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[Wi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const y=Wi(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(y)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let h=a.attributes.reduce((f,y)=>Math.max(f,y.order),-1)+1;for(const f of l){const y=Wi(f.associationRef,f.sourceAttributeRef),g=d.get(y);if(g){const _=Oy(g,f,o);_&&i.update.push({attributeId:g.modelId,patch:_})}else{const _=Dy(f,m);m.add(_.name),i.add.push(Ly(_,h++,o))}}return i}function _c(e,n){if(n.remove.length){const o=new Set(n.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of n.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}n.add.length&&e.attributes.push(...n.add)}function Py(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function kc(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function Ec(e,n,o=Pr){const i=new Map,a=Py(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(h=>h.end1.entityRef===d).map(h=>h.end2.entityRef));for(const h of m){const f=Jo(a,h,o);if(yc(f))continue;const y=i.get(h);i.set(h,y?kc(y,f):f);const g=a.entities.find(_=>_.modelId===h);g&&_c(g,f),r.has(h)||(r.add(h),c.push(h))}}return i}function Nc(e,n,o=Pr){const i=[],a=Jo(e,n,o);let r=e;yc(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return _c(s,a),s})});for(const[l,s]of Ec(r,n,o))i.push({entityId:l,plan:s});return i}function Xi(e,n,o){var l;const i=e.entities.find(s=>s.modelId===n),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!Li(a))return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===n&&s.end1.attributeRef===o||s.end2.entityRef===n&&s.end2.attributeRef===o)}const Xo=63;function zr(e){if(!e)return null;const n=e.length;return n>Xo?n:null}function Fr(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function bt(e){return!e||e.trim()===""}function go(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function zy(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const h=o.get(m.end1.entityRef)??[];h.push(m.end2.entityRef),o.set(m.end1.entityRef,h)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const h of o.get(m)??[]){const f=l.get(h)??i;if(f===i)u(h);else if(f===a){const y=s.slice(s.indexOf(h)),g=[...y].sort().join(" ");d.has(g)||(d.add(g),c.push(y))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function wc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function Fy(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function Ic(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Uy(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=bt(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Hy(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Uy(a,o))).size===1}function vc(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function Ur(e,n){const o=new Map;for(const i of e){const a=n(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=n(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function Zi(e,n){var m,h,f,y,g,_,E,N,p;const o=[],i=new Map(e.entities.map(k=>[k.modelId,k])),a=new Map(e.associations.map(k=>[k.modelId,k])),r=Ir(e),l=r.size===0?e.entities:Gs(e),s=Ys(e,r);for(const k of vc(l,I=>I.name))for(const I of k){const A=k.filter(V=>V!==I),$=wc(I)&&A.some(wc),L=A.some(V=>!Ty(I,V,e));!$&&!L||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:I.modelId,params:{name:I.name,reason:$?"entity":"package"}})}for(const k of vc(Fy(l),Ic))if(new Set(k.map(I=>I.name)).size!==1&&!Hy(k,e))for(const I of k)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:I.modelId,params:{name:Ic(I)}});const c=l.flatMap(k=>(k.indexes??[]).map(I=>({e:k,ix:I})));for(const k of Ur(c,I=>I.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:k.ix.modelId,contextRef:k.e.modelId,params:{name:k.ix.name}});for(const k of l){const I=k.attributes.filter(b=>b.attrType!=="DIVIDER");if(bt(k.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:k.modelId}),k.stereotype==="JPA_ENTITY"&&!k.abstractClass&&(I.some(b=>b.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:k.modelId}),bt((m=k.table)==null?void 0:m.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:k.modelId})),k.stereotype==="JPA_EMBEDDABLE")for(const b of I.filter(w=>w.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I.filter(w=>w.identifier&&w.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I)if(!b.identifier)for(const w of b.dbAttrs)!w.autoIncrement&&bt(w.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:w.autoIncrement?{name:b.name}:{name:b.name,seq:w.sequenceName??""}});const A=I.filter(b=>b.identifier&&!b.transient);if(A.reduce((b,w)=>b+w.dbAttrs.length,0)>=2)for(const b of A)for(const w of b.dbAttrs)!w.autoIncrement&&bt(w.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I.filter(w=>w.naturalId&&w.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I.filter(w=>w.naturalId&&w.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I.filter(w=>w.naturalId&&!w.notNull&&!w.identifier&&!w.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});!k.abstractClass&&I.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:k.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&I.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:k.modelId,params:{count:I.length,threshold:n.largeEntityThreshold}});for(const b of Ur(I,w=>w.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of I)if(bt(b.name)){const w=b.attrType.startsWith("RELATION")||b.attrType.startsWith("EMBED");o.push({ruleId:w?"CHK-NAME-7":"CHK-NAME-4",severity:w?"error":"info",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,...w?{params:{attrType:b.attrType}}:{}})}const $=I.flatMap(b=>b.dbAttrs.map((w,v)=>({attr:b,index:v,col:w,eff:on(b,w,v,k,e,n),name:Yo(b,w,v,k,e,n)})).filter(w=>w.eff.sharedColumnRef==null));for(const b of Ur($,w=>w.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:b.col.modelId,contextRef:k.modelId,params:{name:b.name}});for(const b of $){if(!bt(b.name)||b.attr.transient||bt(b.attr.name)&&(b.attr.attrType.startsWith("RELATION")||b.attr.attrType.startsWith("EMBED"))||b.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const w=Pi(b.attr,k,e.entities,e.associations,b.index);bt(w==null?void 0:w.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:b.col.modelId,contextRef:k.modelId,params:{name:b.attr.name}})}for(const b of $){const w=b.col,v=zr(w.physicalName);v!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{max:Xo,len:v}}),n!=null&&n.reservedWords&&!bt(w.physicalName)&&n.reservedWords.has(w.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{name:w.physicalName}}),n!=null&&n.selectableDataTypes&&!bt(w.dataType)&&!n.selectableDataTypes.has(w.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{dataType:w.dataType}});const O=b.attr.transient||w.multiValue||b.attr.attrType.startsWith("EMBED")||b.attr.attrType.startsWith("RELATION")?void 0:ry(b.attr.type,w.dataType);O===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{type:b.attr.type,dataType:Fr(w)}}),O!==!1&&!bt(w.dataType)&&ty.has(w.dataType)&&!w.length&&(on(b.attr,w,b.index,k,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{dataType:w.dataType}}))}for(const b of $)bt(b.col.dataType)&&(b.attr.transient||b.attr.attrType.startsWith("EMBED")||b.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:b.col.modelId,contextRef:k.modelId,params:{name:b.attr.name}}));if((h=n==null?void 0:n.embeddableCatalog)!=null&&h.length){const b=co(Nn(k,e.entities));for(const w of I){if(w.attrType!=="EMBED_PREDEF")continue;const v=n.embeddableCatalog.find(O=>O.type===w.type);v&&w.dbAttrs.forEach((O,M)=>{if(O.sharedColumnRef==null)return;const z=v.fields[M],j=b.get(O.sharedColumnRef);if(!z||!j)return;(j.dataType!==z.dataType||(j.length??null)!==(z.length??null)||(j.scale??null)!==(z.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:O.modelId,contextRef:k.modelId,params:{targetType:Fr(j),metaName:z.name,metaType:Fr(z)}})})}}for(const b of I){const w=b.dbAttrs[0];if(!(w!=null&&w.multiValue))continue;b.type===On&&w.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:w.modelId,contextRef:k.modelId,params:{type:b.type||"",dataType:w.dataType||""}})}for(const b of I){if(b.attrType!=="EMBED_OWN"||!b.embedded)continue;const w=i.get(b.embedded.embeddableRef);if(!w)continue;const v=a.get(b.embedded.associationRef),O=v==null?void 0:v.end1.entityRef===b.embedded.embeddableRef?v.end1:v.end2;if(O&&go(O.multiplicity))continue;const M=nn(w).length;b.dbAttrs.length!==M&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name,embeddable:w.name,slots:b.dbAttrs.length,declared:M}})}const L=(f=k.table)==null?void 0:f.physicalName,V=zr(L);V!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:k.modelId,params:{max:Xo,len:V}}),n!=null&&n.reservedWords&&!bt(L)&&n.reservedWords.has(L.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:k.modelId,params:{name:L}});const S=new Set;for(const b of k.attributes){S.add(b.modelId);for(const w of b.dbAttrs)S.add(w.modelId)}const x=new Set(Ko(k,(n==null?void 0:n.superClassCatalog)??[]).map(b=>b.modelId)),T=(((y=n==null?void 0:n.superClassCatalog)==null?void 0:y.length)??0)>0,D=Vn(k.attributes);for(const b of k.indexes??[]){const w=zr(b.name);w!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:b.modelId,contextRef:k.modelId,params:{max:Xo,len:w}}),n!=null&&n.reservedWords&&!bt(b.name)&&n.reservedWords.has(b.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}});for(const v of b.columns){const O=v.columnRef;if(S.has(O)||x.has(O))continue;const M=Bn(O);M&&!T||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:b.modelId,contextRef:k.modelId,params:M?{name:b.name,field:((g=Nr(O))==null?void 0:g.field)??O}:{name:b.name}})}b.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}}),new Set(b.columns.map(v=>D.canon(v.columnRef))).size!==b.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:b.modelId,contextRef:k.modelId,params:{name:b.name}})}}const d=new Map;for(const k of e.entities)for(const I of k.attributes)I.attrType==="EMBED_OWN"&&I.embedded&&d.set(I.embedded.associationRef,I);for(const k of s){if(go(k.end1.multiplicity)&&go(k.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:k.modelId}),d.has(k.modelId)&&k.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:k.modelId}),!d.has(k.modelId)){const I=!!k.end2.attributeRef&&(((E=(_=k.end2.jpa)==null?void 0:_.cascadeTypes)==null?void 0:E.length)??0)>0,A=!!k.end1.attributeRef&&k.end1.navigable&&(((p=(N=k.end1.jpa)==null?void 0:N.cascadeTypes)==null?void 0:p.length)??0)>0;I&&A&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:k.modelId})}if(!d.has(k.modelId)&&k.end1.navigable&&k.end1.attributeRef){const I=i.get(k.end1.entityRef),A=I==null?void 0:I.attributes.some(V=>V.modelId===k.end1.attributeRef),$=i.get(k.end2.entityRef),L=bc(e,k).length>0;A&&$&&L&&(k.end2.attributeRef&&$.attributes.some(S=>S.modelId===k.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:k.modelId,params:{child:$.name}}))}for(const I of["end1","end2"]){const A=k[I].jpa;if(!A)continue;const $=A.cascadeTypes??[],L=$.includes("ALL"),V=$.includes("REMOVE");L&&$.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:I}}),A.orphanRemoval&&(V||L)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:k.modelId,params:{which:I,cascade:L?"ALL":"REMOVE"}}),go(k[I].multiplicity)&&A.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:I}}),A.orphanRemoval&&go(k[I==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:k.modelId,params:{which:I}}),!go(k[I].multiplicity)&&(A.collectionType||A.collectionTable||A.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:I}}),A.collectionType==="SET"&&A.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:k.modelId,params:{which:I}})}}const u=new Map(e.entities.map(k=>[k.modelId,k.name||k.modelId]));for(const k of zy(l,s)){const I=[...k,k[0]].map(A=>u.get(A)??A).join(" → ");for(const A of k)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:A,params:{path:I}})}if(n!=null&&n.flagEntitiesWithoutRelations){const k=new Set;for(const A of e.associations)k.add(A.end1.entityRef),k.add(A.end2.entityRef);const I=new Map(e.entities.map(A=>[A.name,A.modelId]));for(const A of e.entities){for(const $ of A.attributes)$.embedded&&(k.add(A.modelId),k.add($.embedded.embeddableRef));if(!bt(A.superClass)){k.add(A.modelId);const $=I.get(A.superClass);$&&k.add($)}}for(const A of l)k.has(A.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:A.modelId})}return o}function Hr(e,n){var r,l,s;if(e.ruleId==="CHK-DSN-7")return jy(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}function jy(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=Vn(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const bo="javax.persistence",Je={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},Ky={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function Cc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Ut(o)?null:o??Ky[n]}const Qi={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function Gy(e){if(!e)return;if(Qi[e])return{simpleName:e,fqn:Qi[e]};const n=Object.entries(Qi).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function xc(e){return!(Ut(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function Yy(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&(uo(l)||o.skipUngeneratable!==!1&&!xc(l)||a.push(Xy(l,e,o)))}return a}class Sc{constructor(){Xe(this,"imports",new Set);Xe(this,"body",[]);Xe(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${bo}.${n}`)}line(n=""){this.body.push(n)}fillIn(n){this.fillIns.push(n)}render(n){const o=[`package ${n};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
|
|
16
|
+
`)}const Jr="entity-modeler-diagram",Xr=1;class Wn extends Error{constructor(n){super(n),this.name="InvalidDiagramJsonError"}}function xc(e,n){return JSON.stringify({format:Jr,version:Xr,logical:e,layout:n},null,2)}const ia=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Co=e=>Array.isArray(e)?e:[];function Rc(e){let n;try{n=JSON.parse(e)}catch{throw new Wn("JSON 파싱 실패 — 올바른 JSON이 아닙니다.")}if(!ia(n))throw new Wn("최상위가 객체가 아닙니다.");if(n.format!==Jr)throw new Wn(`형식이 아닙니다(format=${String(n.format)}).`);if(typeof n.version!="number"||n.version>Xr)throw new Wn(`지원하지 않는 버전(version=${String(n.version)}).`);const o=n.logical;if(!ia(o)||!Array.isArray(o.entities))throw new Wn("logical.entities 배열이 없습니다.");for(const l of o.entities)if(!ia(l)||typeof l.modelId!="string"||!Array.isArray(l.attributes))throw new Wn("엔티티 골격(modelId·attributes)이 올바르지 않습니다.");const i={modelId:typeof o.modelId=="string"?o.modelId:"imported",packageName:typeof o.packageName=="string"?o.packageName:void 0,entities:o.entities,associations:Co(o.associations),groups:Co(o.groups)},a=ia(n.layout)?n.layout:{},r={diagramId:typeof a.diagramId=="string"?a.diagramId:"imported",logicalModelRef:typeof a.logicalModelRef=="string"?a.logicalModelRef:i.modelId,entityLayouts:Co(a.entityLayouts),associationLayouts:Co(a.associationLayouts),groupLayouts:Co(a.groupLayouts),notes:Co(a.notes)};return{logical:i,layout:r}}const Dy=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function Ot(e){return e.replace(Dy,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function He(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Ac(e){return`<text ${[`x="${He(e.x)}"`,`y="${He(e.y)}"`,`fill="${Ot(e.fill)}"`,`font-size="${He(e.fontSize)}"`,e.fontFamily?`font-family="${Ot(e.fontFamily)}"`:"",e.fontWeight!=null?`font-weight="${Ot(String(e.fontWeight))}"`:"",e.fontStyle&&e.fontStyle!=="normal"?`font-style="${Ot(e.fontStyle)}"`:"",e.anchor&&e.anchor!=="start"?`text-anchor="${e.anchor}"`:"",'dominant-baseline="central"'].filter(Boolean).join(" ")}>${Ot(e.text)}</text>`}function Oy(e){return`<line x1="${He(e.x1)}" y1="${He(e.y)}" x2="${He(e.x2)}" y2="${He(e.y)}" stroke="${Ot(e.stroke)}" stroke-width="${He(e.strokeWidth??1)}" />`}function Ly(e){return e==null?{tl:0,tr:0,br:0,bl:0}:typeof e=="number"?{tl:e,tr:e,br:e,bl:e}:e}function Py(e,n,o,i,a){return[`M${He(e+a.tl)},${He(n)}`,`L${He(e+o-a.tr)},${He(n)}`,a.tr?`Q${He(e+o)},${He(n)} ${He(e+o)},${He(n+a.tr)}`:"",`L${He(e+o)},${He(n+i-a.br)}`,a.br?`Q${He(e+o)},${He(n+i)} ${He(e+o-a.br)},${He(n+i)}`:"",`L${He(e+a.bl)},${He(n+i)}`,a.bl?`Q${He(e)},${He(n+i)} ${He(e)},${He(n+i-a.bl)}`:"",`L${He(e)},${He(n+a.tl)}`,a.tl?`Q${He(e)},${He(n)} ${He(e+a.tl)},${He(n)}`:"","Z"].filter(Boolean).join(" ")}function Zr(e){const n=Ly(e.radius),o=n.tl||n.tr||n.br||n.bl,i=[`fill="${Ot(e.fill)}"`,`stroke="${Ot(e.stroke)}"`,`stroke-width="${He(e.strokeWidth??1)}"`,e.strokeDasharray?`stroke-dasharray="${Ot(e.strokeDasharray)}"`:"",e.opacity!=null?`opacity="${He(e.opacity)}"`:""].filter(Boolean),r=[o?`<path d="${Py(e.x,e.y,e.w,e.h,n)}" ${i.join(" ")} />`:`<rect x="${He(e.x)}" y="${He(e.y)}" width="${He(e.w)}" height="${He(e.h)}" ${i.join(" ")} />`];for(const l of e.lines??[])r.push(Oy(l));for(const l of e.texts)r.push(Ac(l));for(const l of e.icons??[])r.push(l);return`<g>${r.join("")}</g>`}function zy(e){const o=[`<path ${[`d="${Ot(e.d)}"`,'fill="none"',`stroke="${Ot(e.stroke)}"`,`stroke-width="${He(e.strokeWidth)}"`,e.strokeDasharray?`stroke-dasharray="${Ot(e.strokeDasharray)}"`:""].filter(Boolean).join(" ")} />`];for(const i of e.markers??[])o.push(i);for(const i of e.labels)o.push(Ac(i));return`<g>${o.join("")}</g>`}function $c(e){const{x:n,y:o,w:i,h:a}=e.viewBox,r=[];e.background&&r.push(`<rect x="${He(n)}" y="${He(o)}" width="${He(i)}" height="${He(a)}" fill="${Ot(e.background)}" />`);for(const l of e.groups)r.push(Zr(l));for(const l of e.edges)r.push(zy(l));for(const l of e.entities)r.push(Zr(l));for(const l of e.notes)r.push(Zr(l));return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${He(n)} ${He(o)} ${He(i)} ${He(a)}" width="${He(i)}" height="${He(a)}">`+r.join("")+"</svg>"}function aa(e,n){if(e.packageName)return{kind:"explicit",value:e.packageName};const o=n.groups.find(i=>{var a;return(a=i.memberEntityRefs)==null?void 0:a.includes(e.modelId)});return{kind:"group",value:(o==null?void 0:o.packageName)??""}}function Fy(e,n,o){const i=aa(e,o),a=aa(n,o);return i.kind===a.kind&&i.value!==a.value}const Qr=()=>crypto.randomUUID(),Tc=e=>e.add.length===0&&e.update.length===0&&e.remove.length===0,Uy=e=>e&&e[0].toLowerCase()+e.slice(1),Hy=e=>e&&e[0].toUpperCase()+e.slice(1);function jy(e,n){return Uy(e??"")+Hy(n??"")}function Ky(e,n){const o=No(e.name,n);if(o===e.name)return e;const i=o.slice(e.name.length);return{...e,name:o,dbAttrs:e.dbAttrs.map((a,r)=>{var l;return{...a,physicalName:`${((l=e.originPhysicalNames)==null?void 0:l[r])??""}${i}`}})}}function Mc(e,n){const o=e.entities.find(d=>d.modelId===n.end1.entityRef);if(!o)return[];if(o.stereotype==="JPA_EMBEDDABLE")return[];const i=n.end1.entityRef===n.end2.entityRef,a=i?!1:n.identifying===!0,r=a||!i&&!dc(n.end1.multiplicity),l=o.attributes.filter(d=>d.identifier&&(d.attrType==="NORMAL"||d.attrType==="RELATION_OWN")).sort((d,u)=>d.order-u.order);if(l.length===0)return[];const s=l[0],c=l.flatMap(d=>d.dbAttrs);return[(d=>{const u=jy(o.name,d.name);return{associationRef:n.modelId,sourceAttributeRef:d.modelId,name:u,type:d.type,identifier:a,notNull:r,dbAttrs:c.map(m=>({physicalName:"",logicalName:m.logicalName,dataType:m.dataType,length:m.length,scale:m.scale})),originPhysicalNames:c.map(m=>m.physicalName??"")}})(s)]}const ra=(e,n)=>`${e}::${n}`,la=e=>e??void 0;function Gy(e,n,o){const i={};return e.type!==n.type&&(i.type=n.type),e.identifier!==n.identifier&&(i.identifier=n.identifier),e.notNull!==n.notNull&&(i.notNull=n.notNull),(e.dbAttrs.length!==n.dbAttrs.length||n.dbAttrs.some((r,l)=>{const s=e.dbAttrs[l];return!s||s.dataType!==r.dataType||la(s.length)!==la(r.length)||la(s.scale)!==la(r.scale)}))&&(i.dbAttrs=n.dbAttrs.map((r,l)=>{const s=e.dbAttrs[l];return{modelId:(s==null?void 0:s.modelId)??o(),physicalName:(s==null?void 0:s.physicalName)??r.physicalName,logicalName:(s==null?void 0:s.logicalName)??r.logicalName,dataType:r.dataType,length:r.length,scale:r.scale}})),Object.keys(i).length?i:null}function Yy(e,n,o){return{modelId:o(),name:e.name,type:e.type,attrType:"RELATION_OWN",identifier:e.identifier,notNull:e.notNull,order:n,dbAttrs:e.dbAttrs.map(i=>({...i,modelId:o()})),derivedFrom:{associationRef:e.associationRef,sourceAttributeRef:e.sourceAttributeRef}}}function ai(e,n,o=Qr){const i={add:[],update:[],remove:[]},a=e.entities.find(f=>f.modelId===n);if(!a)return i;const r=e.associations.filter(f=>f.end2.entityRef===n),l=a.stereotype==="JPA_EMBEDDABLE"?[]:r.flatMap(f=>Mc(e,f)),s=new Map(l.map(f=>[ra(f.associationRef,f.sourceAttributeRef),f])),c=a.attributes.filter(f=>f.derivedFrom),d=new Map(c.map(f=>[ra(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef),f]));for(const f of c){const y=ra(f.derivedFrom.associationRef,f.derivedFrom.sourceAttributeRef);s.has(y)||i.remove.push(f.modelId)}const u=new Set(i.remove),m=new Set(a.attributes.filter(f=>!u.has(f.modelId)).map(f=>f.name));let p=a.attributes.reduce((f,y)=>Math.max(f,y.order),-1)+1;for(const f of l){const y=ra(f.associationRef,f.sourceAttributeRef),_=d.get(y);if(_){const g=Gy(_,f,o);g&&i.update.push({attributeId:_.modelId,patch:g})}else{const g=Ky(f,m);m.add(g.name),i.add.push(Yy(g,p++,o))}}return i}function Vc(e,n){if(n.remove.length){const o=new Set(n.remove);e.attributes=e.attributes.filter(i=>!o.has(i.modelId))}for(const o of n.update){const i=e.attributes.find(a=>a.modelId===o.attributeId);i&&Object.assign(i,o.patch)}n.add.length&&e.attributes.push(...n.add)}function qy(e){return{...e,entities:e.entities.map(n=>({...n,attributes:n.attributes.map(o=>({...o}))}))}}function Bc(e,n){const o=e.add.map(r=>({...r})),i=e.update.map(r=>({...r,patch:{...r.patch}})),a=[...e.remove];for(const r of n.update){const l=o.findIndex(c=>c.modelId===r.attributeId);if(l>=0){o[l]={...o[l],...r.patch};continue}const s=i.find(c=>c.attributeId===r.attributeId);s?Object.assign(s.patch,r.patch):i.push({...r,patch:{...r.patch}})}for(const r of n.remove){const l=o.findIndex(s=>s.modelId===r);if(l>=0)o.splice(l,1);else{a.push(r);const s=i.findIndex(c=>c.attributeId===r);s>=0&&i.splice(s,1)}}return o.push(...n.add),{add:o,update:i,remove:a}}function Dc(e,n,o=Qr){const i=new Map,a=qy(e),r=new Set([n]),l=new Map,s=e.entities.length,c=[n];for(;c.length;){const d=c.shift();r.delete(d);const u=l.get(d)??0;if(u>=s)continue;l.set(d,u+1);const m=new Set(a.associations.filter(p=>p.end1.entityRef===d).map(p=>p.end2.entityRef));for(const p of m){const f=ai(a,p,o);if(Tc(f))continue;const y=i.get(p);i.set(p,y?Bc(y,f):f);const _=a.entities.find(g=>g.modelId===p);_&&Vc(_,f),r.has(p)||(r.add(p),c.push(p))}}return i}function Oc(e,n,o=Qr){const i=[],a=ai(e,n,o);let r=e;Tc(a)||(i.push({entityId:n,plan:a}),r={...e,entities:e.entities.map(l=>{if(l.modelId!==n)return l;const s={...l,attributes:l.attributes.map(c=>({...c}))};return Vc(s,a),s})});for(const[l,s]of Dc(r,n,o))i.push({entityId:l,plan:s});return i}function So(e,n,o){var l;const i=e.entities.find(s=>s.modelId===n),a=i==null?void 0:i.attributes.find(s=>s.modelId===o);if(!a||!Wi(a))return;const r=(l=a.derivedFrom)==null?void 0:l.associationRef;if(r){const s=e.associations.find(c=>c.modelId===r);if(s)return s}return e.associations.find(s=>s.end1.entityRef===n&&s.end1.attributeRef===o||s.end2.entityRef===n&&s.end2.attributeRef===o)}const ri=63;function el(e){if(!e)return null;const n=e.length;return n>ri?n:null}function tl(e){return e.dataType?e.length==null?e.dataType:e.scale==null?`${e.dataType}(${e.length})`:`${e.dataType}(${e.length},${e.scale})`:"(미지정)"}function Ct(e){return!e||e.trim()===""}function xo(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function Wy(e,n){const o=new Map;for(const m of n){if(m.identifying!==!0||m.end1.entityRef===m.end2.entityRef)continue;const p=o.get(m.end1.entityRef)??[];p.push(m.end2.entityRef),o.set(m.end1.entityRef,p)}const i=0,a=1,r=2,l=new Map,s=[],c=[],d=new Set,u=m=>{l.set(m,a),s.push(m);for(const p of o.get(m)??[]){const f=l.get(p)??i;if(f===i)u(p);else if(f===a){const y=s.slice(s.indexOf(p)),_=[...y].sort().join(" ");d.has(_)||(d.add(_),c.push(y))}}s.pop(),l.set(m,r)};for(const m of e)(l.get(m.modelId)??i)===i&&u(m.modelId);return c}function Lc(e){return e.stereotype!=="JPA_EMBEDDABLE"}function Jy(e){return e.filter(n=>n.stereotype!=="JPA_EMBEDDABLE"&&!n.abstractClass)}function Pc(e){var n;return((n=e.table)==null?void 0:n.physicalName)||e.name||""}function Xy(e,n){const o=new Set([e.modelId]);let i=e;for(;;){const a=Ct(i.superClass)?void 0:n.get(i.superClass);if(!a||o.has(a.modelId))return i.modelId;o.add(a.modelId),i=a}}function Zy(e,n){const o=new Map(n.entities.map(a=>[a.name,a]));return new Set(e.map(a=>Xy(a,o))).size===1}function zc(e,n){const o=new Map;for(const i of e){const a=n(i);if(a==null||a==="")continue;const r=o.get(a);r?r.push(i):o.set(a,[i])}return[...o.values()].filter(i=>i.length>1)}function nl(e,n){const o=new Map;for(const i of e){const a=n(i);a==null||a===""||o.set(a,(o.get(a)??0)+1)}return e.filter(i=>{const a=n(i);return a!=null&&a!==""&&(o.get(a)??0)>1})}function sa(e,n){var p,f,y,_,g,b,E,h,N;const o=[],i=new Map(e.entities.map(w=>[w.modelId,w])),a=new Map(e.associations.map(w=>[w.modelId,w])),r=Dr(e.associations),l=Pr(e),s=l.size===0?e.entities:sc(e),c=cc(e,l);for(const w of zc(s,C=>C.name))for(const C of w){const S=w.filter(R=>R!==C),V=Lc(C)&&S.some(Lc),$=S.some(R=>!Fy(C,R,e));!V&&!$||o.push({ruleId:"CHK-NAME-3",severity:"warning",targetKind:"entity",targetRef:C.modelId,params:{name:C.name,reason:V?"entity":"package"}})}for(const w of zc(Jy(s),Pc))if(new Set(w.map(C=>C.name)).size!==1&&!Zy(w,e))for(const C of w)o.push({ruleId:"CHK-NAME-9",severity:"error",targetKind:"entity",targetRef:C.modelId,params:{name:Pc(C)}});const d=s.flatMap(w=>(w.indexes??[]).map(C=>({e:w,ix:C})));for(const w of nl(d,C=>C.ix.name))o.push({ruleId:"CHK-NAME-10",severity:"error",targetKind:"index",targetRef:w.ix.modelId,contextRef:w.e.modelId,params:{name:w.ix.name}});for(const w of s){const C=w.attributes.filter(v=>v.attrType!=="DIVIDER");if(Ct(w.name)&&o.push({ruleId:"CHK-NAME-4",severity:"info",targetKind:"entity",targetRef:w.modelId}),w.stereotype==="JPA_ENTITY"&&!w.abstractClass&&(C.some(v=>v.identifier)||o.push({ruleId:"CHK-JPA-1",severity:"error",targetKind:"entity",targetRef:w.modelId}),Ct((p=w.table)==null?void 0:p.physicalName)&&o.push({ruleId:"CHK-JPA-8",severity:"warning",targetKind:"entity",targetRef:w.modelId})),w.stereotype==="JPA_EMBEDDABLE")for(const v of C.filter(I=>I.identifier))o.push({ruleId:"CHK-JPA-2",severity:"error",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C.filter(I=>I.identifier&&I.transient))o.push({ruleId:"CHK-JPA-12",severity:"error",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C)if(!v.identifier)for(const I of v.dbAttrs)!I.autoIncrement&&Ct(I.sequenceName)||o.push({ruleId:"CHK-JPA-13",severity:"error",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:I.autoIncrement?{name:v.name}:{name:v.name,seq:I.sequenceName??""}});const S=C.filter(v=>v.identifier&&!v.transient);if(S.reduce((v,I)=>v+I.dbAttrs.length,0)>=2)for(const v of S)for(const I of v.dbAttrs)!I.autoIncrement&&Ct(I.sequenceName)||o.push({ruleId:"CHK-JPA-20",severity:"error",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C.filter(I=>I.naturalId&&I.identifier))o.push({ruleId:"CHK-JPA-15",severity:"error",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C.filter(I=>I.naturalId&&I.transient))o.push({ruleId:"CHK-JPA-16",severity:"error",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C.filter(I=>I.naturalId&&!I.notNull&&!I.identifier&&!I.transient))o.push({ruleId:"CHK-JPA-17",severity:"warning",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});!w.abstractClass&&C.length===0&&o.push({ruleId:"CHK-DSN-2",severity:"warning",targetKind:"entity",targetRef:w.modelId}),(n==null?void 0:n.largeEntityThreshold)!=null&&C.length>n.largeEntityThreshold&&o.push({ruleId:"CHK-DSN-4",severity:"info",targetKind:"entity",targetRef:w.modelId,params:{count:C.length,threshold:n.largeEntityThreshold}});for(const v of nl(C,I=>I.name))o.push({ruleId:"CHK-NAME-1",severity:"error",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of C)if(Ct(v.name)){const I=(v.attrType.startsWith("RELATION")||v.attrType.startsWith("EMBED"))&&!Or(v,w,r);o.push({ruleId:I?"CHK-NAME-7":"CHK-NAME-4",severity:I?"error":"info",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,...I?{params:{attrType:v.attrType}}:{}})}const V=C.flatMap(v=>v.dbAttrs.map((I,O)=>({attr:v,index:O,col:I,eff:pn(v,I,O,w,e,n),name:ni(v,I,O,w,e,n)})).filter(I=>I.eff.sharedColumnRef==null));for(const v of nl(V,I=>I.name))o.push({ruleId:"CHK-NAME-2",severity:"error",targetKind:"column",targetRef:v.col.modelId,contextRef:w.modelId,params:{name:v.name}});for(const v of V){if(!Ct(v.name)||v.attr.transient||Ct(v.attr.name)&&(v.attr.attrType.startsWith("RELATION")||v.attr.attrType.startsWith("EMBED"))||v.attr.attrType==="EMBED_PREDEF"&&!(n!=null&&n.embeddableCatalog))continue;const I=Kn(v.attr,w,e.entities,e.associations,v.index);Ct(I==null?void 0:I.physicalName)&&o.push({ruleId:"CHK-NAME-8",severity:"warning",targetKind:"column",targetRef:v.col.modelId,contextRef:w.modelId,params:{name:v.attr.name}})}for(const v of V){const I=v.col,O=el(I.physicalName);O!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{max:ri,len:O}}),n!=null&&n.reservedWords&&!Ct(I.physicalName)&&n.reservedWords.has(I.physicalName.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{name:I.physicalName}}),n!=null&&n.selectableDataTypes&&!Ct(I.dataType)&&!n.selectableDataTypes.has(I.dataType)&&o.push({ruleId:"CHK-TYPE-1",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{dataType:I.dataType}});const A=v.attr.transient||I.multiValue||v.attr.attrType.startsWith("EMBED")||v.attr.attrType.startsWith("RELATION")?void 0:hy(v.attr.type,I.dataType);A===!1&&o.push({ruleId:"CHK-TYPE-7",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{type:v.attr.type,dataType:tl(I)}}),A!==!1&&!Ct(I.dataType)&&dy.has(I.dataType)&&!I.length&&(pn(v.attr,I,v.index,w,e,n).length||o.push({ruleId:"CHK-TYPE-2",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{dataType:I.dataType}}))}for(const v of V)Ct(v.col.dataType)&&(v.attr.transient||v.attr.attrType.startsWith("EMBED")||v.attr.attrType.startsWith("RELATION")||o.push({ruleId:"CHK-TYPE-6",severity:"warning",targetKind:"column",targetRef:v.col.modelId,contextRef:w.modelId,params:{name:v.attr.name}}));if((f=n==null?void 0:n.embeddableCatalog)!=null&&f.length){const v=ko($n(w,e.entities));for(const I of C){if(I.attrType!=="EMBED_PREDEF")continue;const O=n.embeddableCatalog.find(A=>A.type===I.type);O&&I.dbAttrs.forEach((A,L)=>{if(A.sharedColumnRef==null)return;const H=O.fields[L],oe=v.get(A.sharedColumnRef);if(!H||!oe)return;(oe.dataType!==H.dataType||(oe.length??null)!==(H.length??null)||(oe.scale??null)!==(H.scale??null))&&o.push({ruleId:"CHK-TYPE-3",severity:"warning",targetKind:"column",targetRef:A.modelId,contextRef:w.modelId,params:{targetType:tl(oe),metaName:H.name,metaType:tl(H)}})})}}for(const v of C){const I=v.dbAttrs[0];if(!(I!=null&&I.multiValue))continue;v.type===Yn&&I.dataType==="VARCHAR"||o.push({ruleId:"CHK-TYPE-4",severity:"warning",targetKind:"column",targetRef:I.modelId,contextRef:w.modelId,params:{type:v.type||"",dataType:I.dataType||""}})}for(const v of C){if(v.attrType!=="EMBED_OWN"||!v.embedded)continue;const I=i.get(v.embedded.embeddableRef);if(!I)continue;const O=a.get(v.embedded.associationRef),A=O==null?void 0:O.end1.entityRef===v.embedded.embeddableRef?O.end1:O.end2;if(A&&xo(A.multiplicity))continue;const L=fn(I).length;v.dbAttrs.length!==L&&o.push({ruleId:"CHK-JPA-21",severity:"warning",targetKind:"attribute",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name,embeddable:I.name,slots:v.dbAttrs.length,declared:L}})}const $=(y=w.table)==null?void 0:y.physicalName,R=el($);R!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"entity",targetRef:w.modelId,params:{max:ri,len:R}}),n!=null&&n.reservedWords&&!Ct($)&&n.reservedWords.has($.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"entity",targetRef:w.modelId,params:{name:$}});const x=new Set;for(const v of w.attributes){x.add(v.modelId);for(const I of v.dbAttrs)x.add(I.modelId)}const T=new Set(Qo(w,(n==null?void 0:n.superClassCatalog)??[]).map(v=>v.modelId)),M=(((_=n==null?void 0:n.superClassCatalog)==null?void 0:_.length)??0)>0,k=Hn(w.attributes);for(const v of w.indexes??[]){const I=el(v.name);I!=null&&o.push({ruleId:"CHK-NAME-5",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:w.modelId,params:{max:ri,len:I}}),n!=null&&n.reservedWords&&!Ct(v.name)&&n.reservedWords.has(v.name.toUpperCase())&&o.push({ruleId:"CHK-NAME-6",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}});for(const O of v.columns){const A=O.columnRef;if(x.has(A)||T.has(A))continue;const L=jn(A);L&&!M||o.push({ruleId:"CHK-DSN-5",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:w.modelId,params:L?{name:v.name,field:((g=Br(A))==null?void 0:g.field)??A}:{name:v.name}})}v.columns.length===0&&o.push({ruleId:"CHK-DSN-6",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}}),new Set(v.columns.map(O=>k.canon(O.columnRef))).size!==v.columns.length&&o.push({ruleId:"CHK-DSN-7",severity:"warning",targetKind:"index",targetRef:v.modelId,contextRef:w.modelId,params:{name:v.name}})}}const u=new Map;for(const w of e.entities)for(const C of w.attributes)C.attrType==="EMBED_OWN"&&C.embedded&&u.set(C.embedded.associationRef,C);for(const w of c){if(xo(w.end1.multiplicity)&&xo(w.end2.multiplicity)&&o.push({ruleId:"CHK-DSN-1",severity:"info",targetKind:"association",targetRef:w.modelId}),u.has(w.modelId)&&w.identifying&&o.push({ruleId:"CHK-JPA-11",severity:"error",targetKind:"association",targetRef:w.modelId}),!u.has(w.modelId)){const C=!!w.end2.attributeRef&&(((E=(b=w.end2.jpa)==null?void 0:b.cascadeTypes)==null?void 0:E.length)??0)>0,S=!!w.end1.attributeRef&&w.end1.navigable&&(((N=(h=w.end1.jpa)==null?void 0:h.cascadeTypes)==null?void 0:N.length)??0)>0;C&&S&&o.push({ruleId:"CHK-JPA-18",severity:"warning",targetKind:"association",targetRef:w.modelId})}if(!u.has(w.modelId)&&w.end1.navigable&&w.end1.attributeRef){const C=i.get(w.end1.entityRef),S=C==null?void 0:C.attributes.some(R=>R.modelId===w.end1.attributeRef),V=i.get(w.end2.entityRef),$=Mc(e,w).length>0;S&&V&&$&&(w.end2.attributeRef&&V.attributes.some(x=>x.modelId===w.end2.attributeRef)||o.push({ruleId:"CHK-JPA-19",severity:"error",targetKind:"association",targetRef:w.modelId,params:{child:V.name}}))}for(const C of["end1","end2"]){const S=w[C].jpa;if(!S)continue;const V=S.cascadeTypes??[],$=V.includes("ALL"),R=V.includes("REMOVE");$&&V.length>1&&o.push({ruleId:"CHK-JPA-5",severity:"warning",targetKind:"association",targetRef:w.modelId,params:{which:C}}),S.orphanRemoval&&(R||$)&&o.push({ruleId:"CHK-JPA-6",severity:"info",targetKind:"association",targetRef:w.modelId,params:{which:C,cascade:$?"ALL":"REMOVE"}}),xo(w[C].multiplicity)&&S.fetchType==="EAGER"&&o.push({ruleId:"CHK-JPA-7",severity:"warning",targetKind:"association",targetRef:w.modelId,params:{which:C}}),S.orphanRemoval&&xo(w[C==="end1"?"end2":"end1"].multiplicity)&&o.push({ruleId:"CHK-JPA-14",severity:"error",targetKind:"association",targetRef:w.modelId,params:{which:C}}),!xo(w[C].multiplicity)&&(S.collectionType||S.collectionTable||S.orderColumn)&&o.push({ruleId:"CHK-JPA-9",severity:"warning",targetKind:"association",targetRef:w.modelId,params:{which:C}}),S.collectionType==="SET"&&S.orderColumn&&o.push({ruleId:"CHK-JPA-10",severity:"warning",targetKind:"association",targetRef:w.modelId,params:{which:C}})}}const m=new Map(e.entities.map(w=>[w.modelId,w.name||w.modelId]));for(const w of Wy(s,c)){const C=[...w,w[0]].map(S=>m.get(S)??S).join(" → ");for(const S of w)o.push({ruleId:"CHK-JPA-4",severity:"warning",targetKind:"entity",targetRef:S,params:{path:C}})}if(n!=null&&n.flagEntitiesWithoutRelations){const w=new Set;for(const S of e.associations)w.add(S.end1.entityRef),w.add(S.end2.entityRef);const C=new Map(e.entities.map(S=>[S.name,S.modelId]));for(const S of e.entities){for(const V of S.attributes)V.embedded&&(w.add(S.modelId),w.add(V.embedded.embeddableRef));if(!Ct(S.superClass)){w.add(S.modelId);const V=C.get(S.superClass);V&&w.add(V)}}for(const S of s)w.has(S.modelId)||o.push({ruleId:"CHK-DSN-3",severity:"info",targetKind:"entity",targetRef:S.modelId})}return o}function ol(e,n){var r,l,s;if(e.ruleId==="CHK-DSN-7")return Qy(e,n);const o=(r=e.params)==null?void 0:r.which;if(o!=="end1"&&o!=="end2"||!e.targetRef)return null;const i=n.associations.find(c=>c.modelId===e.targetRef);if(!i)return null;const a=((l=i[o].jpa)==null?void 0:l.cascadeTypes)??[];return e.ruleId==="CHK-JPA-5"?!a.includes("ALL")||a.length<=1?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:["ALL"]}:e.ruleId==="CHK-JPA-6"?((s=e.params)==null?void 0:s.cascade)!=="REMOVE"||!a.includes("REMOVE")?null:{ruleId:e.ruleId,kind:"setEndCascades",assocRef:i.modelId,which:o,cascades:a.filter(c=>c!=="REMOVE")}:null}function Qy(e,n){var s;if(!e.targetRef||!e.contextRef)return null;const o=n.entities.find(c=>c.modelId===e.contextRef),i=(s=o==null?void 0:o.indexes)==null?void 0:s.find(c=>c.modelId===e.targetRef);if(!o||!i)return null;const a=Hn(o.attributes),r=new Set,l=i.columns.filter(c=>{const d=a.canon(c.columnRef);return r.has(d)?!1:(r.add(d),!0)});return l.length===i.columns.length?null:{ruleId:e.ruleId,kind:"setIndexColumns",entityRef:o.modelId,indexRef:i.modelId,columns:l}}const Ro="javax.persistence",lt={jsonIdentityInfo:"com.fasterxml.jackson.annotation.JsonIdentityInfo",jsogGenerator:"com.voodoodyne.jackson.jsog.JSOGGenerator",dynamicInsert:"org.hibernate.annotations.DynamicInsert",dynamicUpdate:"org.hibernate.annotations.DynamicUpdate",naturalId:"org.hibernate.annotations.NaturalId",jpaRepository:"org.springframework.data.jpa.repository.JpaRepository",querydslExecutor:"org.springframework.data.querydsl.QuerydslPredicateExecutor",jsonBackReference:"com.fasterxml.jackson.annotation.JsonBackReference",serializable:"java.io.Serializable",objects:"java.util.Objects",hibernateBeanUtil:"net.g1project.bluewave.core.util.HibernateBeanUtil",jsonUtils:"net.g1project.bluewave.core.util.JSONUtils",compositeType:"org.hibernate.annotations.CompositeType",money:"net.g1project.bluecomm.money.Money",moneyUserType:"net.g1project.bluecomm.money.MoneyUserType",jdbcTypeCode:"org.hibernate.annotations.JdbcTypeCode",sqlTypes:"org.hibernate.type.SqlTypes",lombokGetter:"lombok.Getter",lombokNoArgs:"lombok.NoArgsConstructor",lombokAccessLevel:"lombok.AccessLevel"},eg={booleanYnPrimitive:"net.g1project.ecp.common.jpa.converter.PrimitiveBooleanToYNStringConverter",booleanYnBoxed:"net.g1project.ecp.common.jpa.converter.BooleanToYNStringConverter",money:"net.g1project.bluecomm.money.MoneyAttributeConverter"};function Fc(e,n){var i;const o=(i=e.converterCatalog)==null?void 0:i[n];return o===null||typeof o=="string"&&Qt(o)?null:o??eg[n]}const ca={StoredFile:"net.g1project.bluecomm.model.StoredFile",MultiLangString:"net.g1project.bluecomm.dto.MultiLangString"};function tg(e){if(!e)return;if(ca[e])return{simpleName:e,fqn:ca[e]};const n=Object.entries(ca).find(([,o])=>o===e);return n?{simpleName:n[0],fqn:n[1]}:void 0}function Uc(e){return!(Qt(e.name)||e.stereotype==="JPA_ENTITY"&&!e.attributes.some(n=>n.identifier))}function ng(e,n,o={}){const i=new Map(e.entities.map(r=>[r.modelId,r])),a=[];for(const r of n){const l=i.get(r);l&&(Eo(l)||o.skipUngeneratable!==!1&&!Uc(l)||a.push(ag(l,e,o)))}return a}class Hc{constructor(){ct(this,"imports",new Set);ct(this,"body",[]);ct(this,"fillIns",[])}import(n){n.includes(".")&&!n.startsWith("java.lang.")&&this.imports.add(n)}jpa(n){this.import(`${Ro}.${n}`)}line(n=""){this.body.push(n)}fillIn(n){this.fillIns.push(n)}render(n){const o=[`package ${n};`,""],i=[...this.imports].sort();if(i.length>0){for(const a of i)o.push(`import ${a};`);o.push("")}return o.push(...this.body),o.join(`
|
|
17
17
|
`)+`
|
|
18
|
-
`}}function Rc(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function qy(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function _o(e,n){n&&(e.import(Je.lombokGetter),e.line(" @Getter"))}const Wy=["ko","en","ja","zh"];function jr(e,n){if(!e)return[];const o=Wy.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${n} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${n}/**`,`${n} * <ul>`,...o,`${n} * </ul>`,`${n} */`]}function ea(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...Wo,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===On){if(i){const c=[`${bo}.Enumerated`,`${bo}.EnumType`],d=[];return o.groupCodeEnumPackage?c.push(`${o.groupCodeEnumPackage}.${i}`):d.push(`enum ${i} import 패키지 확인 (groupCodeEnumPackage 미주입 — 같은 패키지 가정)`),{type:i,primitive:!1,imports:c,fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:d}}return{type:"Enum",primitive:!1,imports:[`${bo}.Enumerated`,`${bo}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===an){const c=Gy(n),d=c?`CustomType '${n}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${n??"(미지정)"}`;return{...a,type:n||"Object",fillIns:[d]}}if(e==="CustomMoneyType"){const c=Cc(o,"money");return{type:"Money",primitive:!1,imports:c?[Je.money,`${bo}.Convert`]:[Je.money],fieldAnnotations:c?[`@Convert(converter = ${c}.class)`]:[],fillIns:c?[]:["레거시 단일 컬럼 Money 컨버터 비활성(converterCatalog.money = null) — @Convert 손채움 필요"]}}const s=Qi[e];if(s)return{type:e,primitive:!1,imports:[s,Je.jdbcTypeCode,Je.sqlTypes],fieldAnnotations:["@JdbcTypeCode(SqlTypes.JSON)"],fillIns:[]};if(l){const c=l.label,d=[],u=[];return["LocalDate","LocalDateTime","Instant","ZonedDateTime","OffsetDateTime"].includes(c)?d.push(`java.time.${c}`):c==="Date"?(d.push("java.util.Date"),u.push("Date 타입 다의 — 레거시 java.util.Date로 방출, 필요 시 JSR-310로 보정")):c==="BigDecimal"||c==="BigInteger"?d.push(`java.math.${c}`):c==="Currency"&&d.push("java.util.Currency"),{type:c,primitive:l.boxed!=null,imports:d,fieldAnnotations:[],fillIns:u}}return{...a,fillIns:[`타입 해소 확인 필요: ${e}`]}}function Ac(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function Kr(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return ea(e.type,e.customType,o,e.groupCode).type;const a=n.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return ea(e.type,e.customType,o).type;const r=Ac(a);return r.length>=2?`${a.name}PK`:r.length===1?Kr(r[0],n,o,new Set([...i,a.modelId])):ea(e.type,e.customType,o).type}function Jy(e,n,o){if(!e.identifier||e.attrType!=="RELATION_OWN"||!n)return!1;const i=!Yr(n.end2.multiplicity),a=e.dbAttrs.length===1?e.dbAttrs[0].physicalName:void 0;return i&&!!a&&o.has(a)}function Xy(e,n,o){var V,S,x,T,D,b;if(e.stereotype==="JPA_EMBEDDABLE")return Zy(e,n,o);const i=new Sc,a=e.name;let r=Zo(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ta}')`),r=ta);const l=new Map(n.entities.map(w=>[w.modelId,w])),s=r,c=ug(e,o,i),d=new Map;for(const w of n.associations)w.end2.attributeRef&&d.set(w.end2.attributeRef,{assoc:w,role:"owner"}),w.end1.attributeRef&&w.end1.navigable&&d.set(w.end1.attributeRef,{assoc:w,role:"inverse"});const u=Ac(e),m=new Set(u.filter(w=>w.attrType==="NORMAL").flatMap(w=>w.dbAttrs.map(v=>v.physicalName)).filter(Boolean)),h=new Set;for(const w of u)Jy(w,(V=d.get(w.modelId))==null?void 0:V.assoc,m)&&h.add(w.modelId);const f=u.filter(w=>!h.has(w.modelId)),y=f.length>=2,g=f.length===1,_=`${a}PK`,E=w=>h.has(w.modelId)?"mapsId":w.identifier?"id":"none",N=o.lombok!==!1;i.jpa("Entity"),i.import(Je.jsonIdentityInfo),i.import(Je.jsogGenerator);const p=["@Entity"];p.push(ig(e,n,o,i)),p.push('@SuppressWarnings("serial")'),p.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),y&&(i.jpa("IdClass"),i.import(`${r}.${a}.${_}`),p.push(`@IdClass(${a}.${_}.class)`)),(S=e.jpaAttrs)!=null&&S.useDynamicInsert&&(p.push("@DynamicInsert"),i.import(Je.dynamicInsert)),(x=e.jpaAttrs)!=null&&x.useDynamicUpdate&&(p.push("@DynamicUpdate"),i.import(Je.dynamicUpdate)),(T=e.jpaAttrs)!=null&&T.useCacheable&&(p.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(Qy),p.push("@PersonalInfo")),N&&(i.import(Je.lombokNoArgs),i.import(Je.lombokAccessLevel),p.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const w of jr((D=e.table)==null?void 0:D.logicalName,""))i.line(w);for(const w of p)i.line(w);const k=e.abstractClass?"abstract ":"";i.line(`public ${k}class ${a}${c}${Mc(e,i)} {`);const I=e.attributes.filter(w=>w.attrType!=="DIVIDER").sort((w,v)=>w.order-v.order),A=(b=e.jpaAttrs)!=null&&b.useVersion?u.length?u[u.length-1].modelId:null:void 0,$=[];for(const w of I){if(w.attrType.startsWith("EMBED"))$.push(...Oc(w,e,n,o,i));else if(w.attrType==="RELATION_OWN"){const v=d.get(w.modelId);if(v){const O=sg(w,v.assoc,s,l,E(w),N,n,o,i);O&&$.push(O)}else rg(w,e,new Set(d.keys()))||i.fillIn(`${e.name}.${w.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`)}else if(w.attrType==="RELATION_REF"){const v=d.get(w.modelId),O=v?cg(w,v.assoc,s,l,N,n,o,i):null;O&&$.push(O)}else $.push(Bc(w,a,o,i));w.modelId===A&&$c(i,$,N)}A===null&&$c(i,$,N),N||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Tc($,i,N),Vc(e,i),y&&(i.import(Je.jsonBackReference),i.import(Je.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${_} getPK() {`),i.line(` return (${_}) HibernateBeanUtil.getPK(this);`),i.line(" }"),mg(_,f.map(w=>({type:Kr(w,n,o),name:w.name})),N,i)),i.line("}");let L;return y?L=fg(a,_,r):g&&(L=pg(a,r,Kr(f[0],n,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:L}}function $c(e,n,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||n.push({type:"int",name:"dataVersion",category:0})}function Tc(e,n,o){const i=e.map((a,r)=>({g:a,i:r})).sort((a,r)=>a.g.category-r.g.category||a.i-r.i);for(const{g:a}of i){if(o&&!a.collection)continue;n.line(""),n.line(` public ${a.type} get${Rc(a.name)}() {`);const r=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;r?(n.import("java.util.Collections"),n.line(` return Collections.${r}(this.${a.name});`)):n.line(` return ${a.name};`),n.line(" }")}}function Zy(e,n,o){var d;const i=new Sc,a=e.name;let r=Zo(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${ta}')`),r=ta),i.jpa("Embeddable"),i.import(Je.jsonIdentityInfo),i.import(Je.jsogGenerator),i.import(Je.serializable);for(const u of jr((d=e.table)==null?void 0:d.logicalName,""))i.line(u);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)");const l=e.abstractClass?"abstract ":"";i.line(`public ${l}class ${a}${Mc(e,i,["Serializable"])} {`);const s=e.attributes.filter(u=>u.attrType!=="DIVIDER").sort((u,m)=>u.order-m.order),c=[];for(const u of s){if(u.attrType.startsWith("EMBED")){c.push(...Oc(u,e,n,o,i));continue}c.push(Bc(u,a,o,i))}return Tc(c,i,o.lombok!==!1),Vc(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function Mc(e,n,o=[]){const i=(e.declarationOfInterfaces??[]).map(s=>s.trim()).filter(Boolean),a=new Set(i.filter(s=>!s.includes("."))),r=[...i].sort().map(s=>{if(!s.includes("."))return s;const c=s.slice(s.lastIndexOf(".")+1);return a.has(c)?s:(n.import(s),c)}),l=[...o,...r];return l.length?` implements ${l.join(", ")}`:""}const Qy="net.g1project.bluecomm.annotation.PersonalInfo",eg="net.g1project.bluecomm.annotation.PersonalInfoAttribute",tg="net.g1project.bluecomm.model.PersonalInfoAttributeType";function Vc(e,n){const o=[...e.operations??[]].sort((i,a)=>i.order-a.order);for(const i of o){const a=i.sourceCode??"";if(Ut(i.name)||Ut(a))continue;const r=a.replace(/\r\n/g,`
|
|
18
|
+
`}}function jc(e){return e?e.length===0?e:e[0].toUpperCase()+e.slice(1):""}function Kc(e){return e?e.toLowerCase().replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase()):""}function Ao(e,n){n&&(e.import(lt.lombokGetter),e.line(" @Getter"))}const og=["ko","en","ja","zh"];function il(e,n){if(!e)return[];const o=og.filter(i=>e[i]!=null&&e[i]!=="").map(i=>`${n} * <li>${i}: ${e[i]}</li>`);return o.length===0?[]:[`${n}/**`,`${n} * <ul>`,...o,`${n} * </ul>`,`${n} */`]}function da(e,n,o,i){const a={type:e,primitive:!1,imports:[],fieldAnnotations:[],fillIns:[]};if(!e)return{...a,type:"Object",fillIns:["속성 타입 미지정 — Object로 폴백 방출, 모델 정정 필요"]};const l=[...ii,...o.javaTypeCatalog??[]].find(c=>c.value===e);if(e===Yn){if(i){const c=[`${Ro}.Enumerated`,`${Ro}.EnumType`],d=[];return o.groupCodeEnumPackage?c.push(`${o.groupCodeEnumPackage}.${i}`):d.push(`enum ${i} import 패키지 확인 (groupCodeEnumPackage 미주입 — 같은 패키지 가정)`),{type:i,primitive:!1,imports:c,fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:d}}return{type:"Enum",primitive:!1,imports:[`${Ro}.Enumerated`,`${Ro}.EnumType`],fieldAnnotations:["@Enumerated(EnumType.STRING)"],fillIns:["enum 타입 확인 필요 (groupCode 미지정 — 실제 자바 enum 클래스 지정)"]}}if(e===hn){const c=tg(n),d=c?`CustomType '${n}' 은 predef 타입 '${c.simpleName}' 로 승격됨 — 모델에서 '${c.simpleName}' 타입으로 변경 권장(그러면 @JdbcTypeCode + import 자동 방출)`:`CustomType 확인 필요: ${n??"(미지정)"}`;return{...a,type:n||"Object",fillIns:[d]}}if(e==="CustomMoneyType"){const c=Fc(o,"money");return{type:"Money",primitive:!1,imports:c?[lt.money,`${Ro}.Convert`]:[lt.money],fieldAnnotations:c?[`@Convert(converter = ${c}.class)`]:[],fillIns:c?[]:["레거시 단일 컬럼 Money 컨버터 비활성(converterCatalog.money = null) — @Convert 손채움 필요"]}}const s=ca[e];if(s)return{type:e,primitive:!1,imports:[s,lt.jdbcTypeCode,lt.sqlTypes],fieldAnnotations:["@JdbcTypeCode(SqlTypes.JSON)"],fillIns:[]};if(l){const c=l.label,d=[],u=[];return["LocalDate","LocalDateTime","Instant","ZonedDateTime","OffsetDateTime"].includes(c)?d.push(`java.time.${c}`):c==="Date"?(d.push("java.util.Date"),u.push("Date 타입 다의 — 레거시 java.util.Date로 방출, 필요 시 JSR-310로 보정")):c==="BigDecimal"||c==="BigInteger"?d.push(`java.math.${c}`):c==="Currency"&&d.push("java.util.Currency"),{type:c,primitive:l.boxed!=null,imports:d,fieldAnnotations:[],fillIns:u}}return{...a,fillIns:[`타입 해소 확인 필요: ${e}`]}}function al(e){return e.attributes.filter(n=>n.identifier&&(n.attrType==="NORMAL"||n.attrType==="RELATION_OWN")).sort((n,o)=>n.order-o.order)}function li(e,n,o,i=new Set){if(e.attrType!=="RELATION_OWN")return da(e.type,e.customType,o,e.groupCode).type;const a=n.entities.find(l=>l.name===e.type);if(!a||i.has(a.modelId))return da(e.type,e.customType,o).type;const r=al(a);return r.length>=2?`${a.name}PK`:r.length===1?li(r[0],n,o,new Set([...i,a.modelId])):da(e.type,e.customType,o).type}function ua(e,n){return!e.identifier||e.attrType!=="RELATION_OWN"||!n?!1:!ma(n.end2.multiplicity)&&e.dbAttrs.length===1}function rl(e,n,o){var a;if(e.derivedIdFieldName)return e.derivedIdFieldName;const i=cl(e,n,o,0);return Kc(i||((a=e.dbAttrs[0])==null?void 0:a.physicalName))}function ig(e,n,o,i,a){var l;const r=e.derivedFrom?(l=o.get(n.end1.entityRef))==null?void 0:l.attributes.find(s=>s.modelId===e.derivedFrom.sourceAttributeRef):void 0;return li(r||e,i,a)}function ll(e,n,o){var y,_,g;const i=new Map(n.entities.map(b=>[b.modelId,b])),a=Dr(n.associations),r=new Map;for(const b of n.associations)b.end2.attributeRef&&r.set(b.end2.attributeRef,{assoc:b,role:"owner"}),b.end1.attributeRef&&b.end1.navigable&&r.set(b.end1.attributeRef,{assoc:b,role:"inverse"});const l=al(e),s=new Set;for(const b of l)ua(b,(y=r.get(b.modelId))==null?void 0:y.assoc)&&s.add(b.modelId);const c=new Set(l.filter(b=>b.attrType==="NORMAL").flatMap(b=>b.dbAttrs.map(E=>E.physicalName)).filter(Boolean)),d=[],u=[];for(const b of l){if(!s.has(b.modelId))continue;const E=r.get(b.modelId).assoc,h=b.dbAttrs[0],N=(h==null?void 0:h.physicalName)||cl(b,E,i,0)||"";if(N&&c.has(N))continue;const w=rl(b,E,i);if(!w){u.push(b);continue}const C=b.derivedFrom?(_=i.get(E.end1.entityRef))==null?void 0:_.attributes.find(S=>S.modelId===b.derivedFrom.sourceAttributeRef):void 0;d.push({attr:{modelId:`synthetic-id:${b.modelId}`,name:w,type:o?o(b,E):(C==null?void 0:C.type)??b.type,customType:(C==null?void 0:C.customType)??b.customType,attrType:"NORMAL",identifier:!0,notNull:!0,order:b.order,dbAttrs:[{...h??{modelId:`synthetic-col:${b.modelId}`,dataType:""},physicalName:N}]},role:"scalar",synthetic:!0,sourceAttr:b})}const m=[],p=[];for(const b of e.attributes)if(b.attrType!=="DIVIDER"){if(b.attrType.startsWith("EMBED")){p.push({attr:b,role:"embed",synthetic:!1,sourceAttr:b,collection:na(b,n.associations)});continue}if(b.attrType==="RELATION_OWN"){const E=r.get(b.modelId);E?p.push({attr:b,role:"relation-owner",synthetic:!1,sourceAttr:b,assoc:E.assoc,target:i.get(E.assoc.end1.entityRef)}):Or(b,e,a)?m.push({attr:b,reason:"join-column-only"}):m.push({attr:b,reason:"no-anchor"});continue}if(b.attrType==="RELATION_REF"){const E=r.get(b.modelId);if(!E){m.push({attr:b,reason:"nav-not-materialized"});continue}p.push({attr:b,role:"relation-inverse",synthetic:!1,sourceAttr:b,assoc:E.assoc,target:i.get(E.assoc.end2.entityRef),collection:ma(E.assoc.end2.multiplicity)?((g=E.assoc.end2.jpa)==null?void 0:g.collectionType)??"LIST":void 0});continue}p.push({attr:b,role:"scalar",synthetic:!1,sourceAttr:b})}return{fields:[...d,...p].sort((b,E)=>b.attr.order-E.attr.order),omitted:m,unresolvedDerivedIds:u}}function ag(e,n,o){var x,T,M,k,v,I,O;if(e.stereotype==="JPA_EMBEDDABLE")return rg(e,n,o);const i=new Hc,a=e.name;let r=si(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${fa}')`),r=fa);const l=new Map(n.entities.map(A=>[A.modelId,A])),s=r,c=gg(e,o,i),d=new Map;for(const A of n.associations)A.end2.attributeRef&&d.set(A.end2.attributeRef,{assoc:A,role:"owner"}),A.end1.attributeRef&&A.end1.navigable&&d.set(A.end1.attributeRef,{assoc:A,role:"inverse"});const u=al(e),m=new Set;for(const A of u)ua(A,(x=d.get(A.modelId))==null?void 0:x.assoc)&&m.add(A.modelId);const p=ll(e,n,(A,L)=>ig(A,L,l,n,o)),f=p.fields.filter(A=>A.synthetic).map(A=>A.attr);for(const A of p.unresolvedDerivedIds)i.fillIn(`${a}.${A.name}: @MapsId 스칼라 식별자 필드명 미해소(부모 PK·FK 물리명 부재) — 확인 필요`);for(const A of p.omitted)A.reason==="no-anchor"&&i.fillIn(`${e.name}.${A.attr.name||"(이름 없음)"}: FK 속성이 관계 앵커에 지목되지 않음 — 관계 필드 미방출로 컬럼 누락`);const y=[...u.filter(A=>!m.has(A.modelId)),...f].sort((A,L)=>A.order-L.order),_=y.length>=2,g=y.length===1,b=`${a}PK`,E=A=>m.has(A.modelId)?"mapsId":A.identifier?"id":"none",h=o.lombok!==!1;i.jpa("Entity"),i.import(lt.jsonIdentityInfo),i.import(lt.jsogGenerator);const N=["@Entity"];N.push(mg(e,n,o,i)),N.push('@SuppressWarnings("serial")'),N.push("@JsonIdentityInfo(generator = JSOGGenerator.class)"),_&&(i.jpa("IdClass"),i.import(`${r}.${a}.${b}`),N.push(`@IdClass(${a}.${b}.class)`)),(T=e.jpaAttrs)!=null&&T.useDynamicInsert&&(N.push("@DynamicInsert"),i.import(lt.dynamicInsert)),(M=e.jpaAttrs)!=null&&M.useDynamicUpdate&&(N.push("@DynamicUpdate"),i.import(lt.dynamicUpdate)),(k=e.jpaAttrs)!=null&&k.useCacheable&&(N.push("@Cacheable"),i.jpa("Cacheable")),e.hasPersonalInfo&&(i.import(lg),N.push("@PersonalInfo")),h&&(i.import(lt.lombokNoArgs),i.import(lt.lombokAccessLevel),N.push("@NoArgsConstructor(access = AccessLevel.PROTECTED)"));for(const A of il((v=e.table)==null?void 0:v.logicalName,""))i.line(A);for(const A of N)i.line(A);const w=e.abstractClass?"abstract ":"";i.line(`public ${w}class ${a}${c}${qc(e,i)} {`);const C=p.fields.map(A=>A.attr),S=new Set(f.map(A=>A.modelId));for(const A of u){if(!m.has(A.modelId))continue;const L=(I=A.dbAttrs[0])==null?void 0:I.physicalName;if(L)for(const H of u)H.attrType==="NORMAL"&&H.dbAttrs.some(oe=>oe.physicalName===L)&&S.add(H.modelId)}const V=(O=e.jpaAttrs)!=null&&O.useVersion?u.length?u[u.length-1].modelId:null:void 0,$=[];for(const A of C){if(A.attrType.startsWith("EMBED"))$.push(...Zc(A,e,n,o,i));else if(A.attrType==="RELATION_OWN"){const L=d.get(A.modelId),H=pg(A,L.assoc,s,l,E(A),h,n,o,i);H&&$.push(H)}else if(A.attrType==="RELATION_REF"){const L=d.get(A.modelId),H=hg(A,L.assoc,s,l,h,n,o,i);H&&$.push(H)}else $.push(Jc(A,a,o,i,S.has(A.modelId)));A.modelId===V&&Gc(i,$,h)}V===null&&Gc(i,$,h),h||(i.line(""),i.line(` protected ${a}() {`),i.line(" }")),Yc($,i,h),Wc(e,i),_&&(i.import(lt.jsonBackReference),i.import(lt.hibernateBeanUtil),i.line(""),i.line(" @JsonBackReference"),i.line(" public String getStringId() {"),i.line(" return HibernateBeanUtil.getIdString(this);"),i.line(" }"),i.line(""),i.line(" @JsonBackReference"),i.line(` public ${b} getPK() {`),i.line(` return (${b}) HibernateBeanUtil.getPK(this);`),i.line(" }"),bg(b,y.map(A=>({type:li(A,n,o),name:A.name})),h,i)),i.line("}");let R;return _?R=_g(a,b,r):g&&(R=kg(a,r,li(y[0],n,o))),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns,repository:R}}function Gc(e,n,o){e.jpa("Column"),e.jpa("Version"),e.line(""),e.line(' @Column(name = "data_ver")'),e.line(" @Version"),e.line(" private int dataVersion;"),o||n.push({type:"int",name:"dataVersion",category:0})}function Yc(e,n,o){const i=e.map((a,r)=>({g:a,i:r})).sort((a,r)=>a.g.category-r.g.category||a.i-r.i);for(const{g:a}of i){if(o&&!a.collection)continue;n.line(""),n.line(` public ${a.type} get${jc(a.name)}() {`);const r=a.collection?a.type.startsWith("Set<")?"unmodifiableSet":"unmodifiableList":void 0;r?(n.import("java.util.Collections"),n.line(` return Collections.${r}(this.${a.name});`)):n.line(` return ${a.name};`),n.line(" }")}}function rg(e,n,o){var d;const i=new Hc,a=e.name;let r=si(e,n,o);r||(i.fillIn(`${a}: package 미지정 — 로컬 소스트리 관례로 결정 필요(임시 '${fa}')`),r=fa),i.jpa("Embeddable"),i.import(lt.jsonIdentityInfo),i.import(lt.jsogGenerator),i.import(lt.serializable);for(const u of il((d=e.table)==null?void 0:d.logicalName,""))i.line(u);i.line("@Embeddable"),i.line('@SuppressWarnings("serial")'),i.line("@JsonIdentityInfo(generator = JSOGGenerator.class)");const l=e.abstractClass?"abstract ":"";i.line(`public ${l}class ${a}${qc(e,i,["Serializable"])} {`);const s=e.attributes.filter(u=>u.attrType!=="DIVIDER").sort((u,m)=>u.order-m.order),c=[];for(const u of s){if(u.attrType.startsWith("EMBED")){c.push(...Zc(u,e,n,o,i));continue}c.push(Jc(u,a,o,i))}return Yc(c,i,o.lombok!==!1),Wc(e,i),i.line("}"),{modelId:e.modelId,fileName:`${a}.java`,packageName:r,source:i.render(r),fillIns:i.fillIns}}function qc(e,n,o=[]){const i=(e.declarationOfInterfaces??[]).map(s=>s.trim()).filter(Boolean),a=new Set(i.filter(s=>!s.includes("."))),r=[...i].sort().map(s=>{if(!s.includes("."))return s;const c=s.slice(s.lastIndexOf(".")+1);return a.has(c)?s:(n.import(s),c)}),l=[...o,...r];return l.length?` implements ${l.join(", ")}`:""}const lg="net.g1project.bluecomm.annotation.PersonalInfo",sg="net.g1project.bluecomm.annotation.PersonalInfoAttribute",cg="net.g1project.bluecomm.model.PersonalInfoAttributeType";function Wc(e,n){const o=[...e.operations??[]].sort((i,a)=>i.order-a.order);for(const i of o){const a=i.sourceCode??"";if(Qt(i.name)||Qt(a))continue;const r=a.replace(/\r\n/g,`
|
|
19
19
|
`).split(`
|
|
20
|
-
`),l=r.filter(c=>c.trim()).map(c=>c.length-c.trimStart().length),s=l.length?Math.min(...l):0;n.line(""),i.personalInfoAttributeType&&!new RegExp(`\\bvoid\\s+${i.name}\\s*\\(`).test(a)&&(n.import(
|
|
20
|
+
`),l=r.filter(c=>c.trim()).map(c=>c.length-c.trimStart().length),s=l.length?Math.min(...l):0;n.line(""),i.personalInfoAttributeType&&!new RegExp(`\\bvoid\\s+${i.name}\\s*\\(`).test(a)&&(n.import(sg),n.import(cg),n.line(` @PersonalInfoAttribute(PersonalInfoAttributeType.${i.personalInfoAttributeType})`));for(const c of r)n.line(c.trim()?` ${c.slice(s)}`:"")}}function Jc(e,n,o,i,a=!1){const r=e.dbAttrs[0],l=e.name||Kc(r==null?void 0:r.physicalName)||"unnamedField";e.name||i.fillIn(`${n}.${l}: 속성 이름 미지정 — 물리명 '${(r==null?void 0:r.physicalName)??""}'에서 파생, 모델 정정 필요`);const s=da(e.type,e.customType,o,e.groupCode);for(const m of s.imports)i.import(m);for(const m of s.fillIns)i.fillIn(`${n}.${l}: ${m}`);const c=(r==null?void 0:r.multiValue)===!0,d=c?`Set<${s.type}>`:s.type;c&&(i.import("java.util.Set"),i.import("java.util.LinkedHashSet"),i.fillIn(`${n}.${l}: 다중값(단일 컬럼 Set) 컨버터 @Convert(converter = <…AttributeConverter>.class) 지정`)),i.line("");for(const m of il(r==null?void 0:r.logicalName," "))i.line(m);e.identifier&&(i.jpa("Id"),i.line(" @Id"),r!=null&&r.autoIncrement&&a?i.fillIn(`${n}.${l}: 파생 식별(@MapsId) 스칼라에 autoIncrement 지정 — 값의 출처가 연관이므로 @GeneratedValue 미방출, 모델 확인 필요`):r!=null&&r.autoIncrement&&(i.jpa("GeneratedValue"),i.jpa("GenerationType"),i.line(" @GeneratedValue(strategy = GenerationType.IDENTITY)"))),e.naturalId&&(i.import(lt.naturalId),i.line(e.naturalIdMutable?" @NaturalId(mutable = true)":" @NaturalId")),i.line(` ${yg(e,r,i,a)}`);for(const m of s.fieldAnnotations)i.line(` ${m}`);const u=!c&&(r==null?void 0:r.dataType)==="VARCHAR"?e.type==="PrimitiveBoolean"?"booleanYnPrimitive":e.type==="Boolean"?"booleanYnBoxed":null:null;if(u){const m=Fc(o,u);m?(i.jpa("Convert"),i.line(` @Convert(converter = ${m}.class)`)):i.fillIn(`${n}.${l}: Y/N 문자 플래그 컨버터 비활성(converterCatalog) — boolean × VARCHAR 매핑 @Convert 손채움 필요`)}return c?(i.line(` // TODO [손채움]: ${l} 다중값 Set 컨버터 — @Convert(converter = <…AttributeConverter>.class)`),Ao(i,o.lombok!==!1),i.line(` private ${d} ${l} = new LinkedHashSet<>();`)):(Ao(i,o.lombok!==!1),i.line(` private ${d} ${l};`)),{type:d,name:l,category:0}}function Xc(e,n,o){var s,c;if(e.attrType==="EMBED_PREDEF"){const d=(s=o.embeddableCatalog)==null?void 0:s.find(u=>u.type===e.type);return e.dbAttrs.map((u,m)=>{var p,f;return{propertyPath:((p=d==null?void 0:d.fields[m])==null?void 0:p.name)??"",defaultPhysical:((f=d==null?void 0:d.fields[m])==null?void 0:f.physicalName)??""}})}const i=(c=e.embedded)!=null&&c.embeddableRef?n.entities.find(d=>d.modelId===e.embedded.embeddableRef):void 0,a=fn(i,{entities:n.entities,embeddableCatalog:o.embeddableCatalog}),r=d=>({propertyPath:d.propertyPath,defaultPhysical:d.defaultPhysical,...d.defaultSharedRef!=null?{defaultSharedRef:d.defaultSharedRef}:{}});return e.dbAttrs.length===a.length?a.map(r):a.filter(d=>!!d.defaultPhysical).map(r)}function dg(e,n,o,i,a,r){var u;const l=ko($n(n,o.entities)),s=m=>{var p;return m==null?"":((p=l.get(m))==null?void 0:p.physicalName)??""},c=e.dbAttrs.length===fn((u=e.embedded)!=null&&u.embeddableRef?o.entities.find(m=>m.modelId===e.embedded.embeddableRef):void 0).length,d=[];return e.dbAttrs.forEach((m,p)=>{const f=i[p],y=c?pn(e,m,p,n,o,{embeddableCatalog:a.embeddableCatalog}):m,_=Gn(y,l),g=_?_.physicalName:y.physicalName||"",b=(f==null?void 0:f.defaultSharedRef)!=null?s(f.defaultSharedRef):(f==null?void 0:f.defaultPhysical)??"";if(!(!g||g===b)){if(!f||!f.propertyPath){r.fillIn(`${n.name}.${e.name}: EMBED 서브컬럼[${p}] @AttributeOverride 프로퍼티 경로 미해소(카탈로그/중첩 임베더블 형상 확인)`);return}d.push(_?`@AttributeOverride(name = "${f.propertyPath}", column = @Column(name = "${g}", insertable = false, updatable = false))`:`@AttributeOverride(name = "${f.propertyPath}", column = @Column(name = "${g}"))`)}}),d}function Qt(e){return!e||e.trim()===""}function Zc(e,n,o,i,a){var m,p,f,y;const r=n.name,l=si(n,o,i);if(Qt(e.name))return a.fillIn(`${r} 임베드: 속성명(필드명) 미지정 — @Embedded/@ElementCollection 방출 불가, 속성명을 채워야 함`),[];let s=e.type;if(e.attrType==="EMBED_OWN"){const _=(m=e.embedded)!=null&&m.embeddableRef?o.entities.find(g=>g.modelId===e.embedded.embeddableRef):void 0;if(_){s=_.name;const g=si(_,o,i);g&&g!==l&&a.import(`${g}.${_.name}`)}}if(Qt(s))return a.fillIn(`${r}.${e.name}: 임베드 대상 타입 미해소 — @Embedded/@ElementCollection 방출 불가`),[];if(e.type==="Money")return[ug(e,n,o,i,a)];const c=Xc(e,o,i),d=dg(e,n,o,c,i,a),u=na(e,o.associations);if(a.line(""),u){const _=o.associations.find(w=>{var C;return w.modelId===((C=e.embedded)==null?void 0:C.associationRef)}),g=_?_.end2.entityRef===((p=e.embedded)==null?void 0:p.embeddableRef)?_.end2:_.end1:void 0;a.jpa("ElementCollection"),a.line(" @ElementCollection");const b=(f=g==null?void 0:g.jpa)==null?void 0:f.collectionTable;b?(a.jpa("CollectionTable"),a.line(` @CollectionTable(name = "${b}")`)):a.fillIn(`${r}.${e.name}: @CollectionTable 이름 미지정(코드젠 규약 폴백 또는 지정 필요)`),sl(d,a);const E=u==="SET";!E&&((y=g==null?void 0:g.jpa)!=null&&y.orderColumn)&&(a.jpa("OrderColumn"),a.line(` @OrderColumn(name = "${g.jpa.orderColumn}")`)),a.import(E?"java.util.Set":"java.util.List"),a.import(E?"java.util.LinkedHashSet":"java.util.ArrayList");const h=E?`Set<${s}>`:`List<${s}>`,N=E?"new LinkedHashSet<>()":"new ArrayList<>()";return a.line(` private ${h} ${e.name} = ${N};`),[{type:h,name:e.name,category:0,collection:!0}]}return a.jpa("Embedded"),a.line(" @Embedded"),sl(d,a),Ao(a,i.lombok!==!1),a.line(` private ${s} ${e.name};`),[{type:s,name:e.name,category:0}]}function ug(e,n,o,i,a){a.jpa("Embedded"),a.import(lt.compositeType),a.import(lt.money),a.import(lt.moneyUserType);const r=Xc(e,o,i),l=ko($n(n,o.entities)),s=e.dbAttrs.flatMap((c,d)=>{var g,b;const u=((g=r[d])==null?void 0:g.propertyPath)||(d===0?"amount":d===1?"currency":`field${d}`),m=Gn(c,l),p=((b=r[d])==null?void 0:b.defaultPhysical)||"",f=c.physicalName||"",y=c.insertable===!1||c.updatable===!1;if(!m&&!y&&(!f||f===p))return[];const _=[`name = "${m?m.physicalName:f||p}"`];return e.notNull&&_.push("nullable = false"),m?_.push("insertable = false","updatable = false"):(c.insertable===!1&&_.push("insertable = false"),c.updatable===!1&&_.push("updatable = false")),[`@AttributeOverride(name = "${u}", column = @Column(${_.join(", ")}))`]});return a.line(""),a.line(" @Embedded"),a.line(" @CompositeType(MoneyUserType.class)"),sl(s,a),Ao(a,i.lombok!==!1),a.line(` private Money ${e.name};`),{type:"Money",name:e.name,category:0}}function sl(e,n){e.length!==0&&(n.jpa("AttributeOverride"),n.jpa("AttributeOverrides"),n.jpa("Column"),n.line(" @AttributeOverrides({"),e.forEach((o,i)=>n.line(` ${o}${i<e.length-1?",":""}`)),n.line(" })"))}function mg(e,n,o,i){var m;i.jpa("Table");const a=((m=e.table)==null?void 0:m.physicalName)??"",r=e.indexes??[];if(r.length===0)return`@Table(name = "${a}")`;const l={embeddableCatalog:o.embeddableCatalog},s=new Map;for(const p of e.attributes)p.dbAttrs.forEach((f,y)=>s.set(f.modelId,ni(p,f,y,e,n,l)));for(const p of Qo(e,o.superClassCatalog??[]))s.set(p.modelId,p.physicalName);const c=Hn(e.attributes),d=[];for(const p of r){const f=[];for(const _ of p.columns){const g=s.get(c.canon(_.columnRef));if(!g){i.fillIn(`${e.name}.@Index(${p.name}): 컬럼 참조 미해소(${Js(c,_.columnRef)}) — 카탈로그 확인`);continue}f.includes(g)||f.push(g)}if(!f.length)continue;const y=p.unique?", unique = true":"";d.push(`@Index(name = "${p.name}", columnList = "${f.join(", ")}"${y})`)}if(d.length===0)return`@Table(name = "${a}")`;if(i.jpa("Index"),d.length===1)return`@Table(name = "${a}", indexes = { ${d[0]} })`;const u=d.map(p=>` ${p}`).join(`,
|
|
21
21
|
`);return`@Table(name = "${a}", indexes = {
|
|
22
22
|
${u}
|
|
23
|
-
})`}function
|
|
23
|
+
})`}function ma(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function cl(e,n,o,i=0){var r,l;const a=o.get(n.end1.entityRef);if(e.derivedFrom){const s=a==null?void 0:a.attributes.find(c=>c.modelId===e.derivedFrom.sourceAttributeRef);if(s!=null&&s.dbAttrs[i])return s.dbAttrs[i].physicalName;if(s&&i>0)return(r=ti(a)[i])==null?void 0:r.physicalName}return(l=ti(a)[i])==null?void 0:l.physicalName}function fg(e,n,o,i){const a=n.modelId,r=o.attributes.filter(c=>{var d;return c.attrType==="RELATION_OWN"&&((d=c.derivedFrom)==null?void 0:d.associationRef)===a});if(r.length<=1)return[e];const l=i.get(n.end1.entityRef),s=c=>{const d=l==null?void 0:l.attributes.find(u=>{var m;return u.modelId===((m=c.derivedFrom)==null?void 0:m.sourceAttributeRef)});return d?d.order:Number.MAX_SAFE_INTEGER};return r.slice().sort((c,d)=>s(c)-s(d)||c.order-d.order)}function Qc(e,n,o,i,a){if(!e)return;const r=si(e,o,i);r&&r!==n&&a.import(`${r}.${e.name}`)}function pg(e,n,o,i,a,r,l,s,c){var b;const d=i.get(n.end1.entityRef),u=(d==null?void 0:d.name)??n.end1.entityRef;if(Qt(e.name)||Qt(u))return c.fillIn(`${u||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @ManyToOne/@OneToOne 방출 불가`),null;const m=ma(n.end2.multiplicity)?"ManyToOne":"OneToOne";c.jpa(m),Qc(d,o,l,s,c);const p=n.end2.jpa,f=[];e.notNull&&f.push("optional = false"),p!=null&&p.fetchType&&(c.jpa("FetchType"),f.push(`fetch = FetchType.${p.fetchType}`)),(b=p==null?void 0:p.cascadeTypes)!=null&&b.length&&(c.jpa("CascadeType"),f.push(`cascade = { ${p.cascadeTypes.map(E=>`CascadeType.${E}`).join(", ")} }`)),c.jpa("JoinColumn");const y=i.get(n.end2.entityRef),_=y?fg(e,n,y,i):[e],g=[];for(const E of _){const h=Math.max(1,E.dbAttrs.length);for(let N=0;N<h;N++){const w=E.dbAttrs[N],C=cl(E,n,i,N),S=(w==null?void 0:w.physicalName)||C||"",V=[];S?V.push(`name = "${S}"`):c.fillIn(`${(y==null?void 0:y.name)??""}.${E.name}: @JoinColumn 컬럼명 미해소(FK·참조 컬럼 물리명 부재) — 확인 필요`),C&&V.push(`referencedColumnName = "${C}"`),E.notNull&&V.push("nullable = false"),(w==null?void 0:w.insertable)===!1&&V.push("insertable = false"),(w==null?void 0:w.updatable)===!1&&V.push("updatable = false"),g.push(`@JoinColumn(${V.join(", ")})`)}}return c.line(""),a==="id"&&(c.jpa("Id"),c.line(" @Id")),c.line(` @${m}${f.length?`(${f.join(", ")})`:""}`),g.length===1?c.line(` ${g[0]}`):(c.jpa("JoinColumns"),c.line(` @JoinColumns({${g[0]},`),g.slice(1).forEach((E,h)=>{const N=h===g.length-2;c.line(` ${E}${N?"})":","}`)})),a==="mapsId"&&(c.jpa("MapsId"),c.line(" @MapsId")),Ao(c,r),c.line(` private ${u} ${e.name};`),{type:u,name:e.name,category:2}}function hg(e,n,o,i,a,r,l,s){const c=i.get(n.end2.entityRef),d=(c==null?void 0:c.name)??n.end2.entityRef;if(Qt(e.name)||Qt(d))return s.fillIn(`${d||"(대상 미해소)"} 관계: ${e.name?"대상 엔티티명":"속성명(필드명)"} 미지정 — @OneToMany/@OneToOne 방출 불가`),null;const u=c==null?void 0:c.attributes.find(w=>w.modelId===n.end2.attributeRef),m=(u==null?void 0:u.name)??"";if(!m)return s.fillIn(`${e.name}: 반대편(${d})에 대응 관계 속성이 없어 @OneToMany/@OneToOne(mappedBy) 방출 불가 — 자식에 FK 속성을 만들거나 관계를 단방향으로 정리 필요(CHK-JPA-19)`),null;Qc(c,o,r,l,s);const p=ma(n.end2.multiplicity);if(s.line(""),!p)return s.jpa("OneToOne"),s.line(` @OneToOne(mappedBy = "${m}")`),Ao(s,a),s.line(` private ${d} ${e.name};`),{type:d,name:e.name,category:1};s.jpa("OneToMany");const f=n.end1.jpa,y=n.end1.composition||n.end2.composition;let _=(f==null?void 0:f.cascadeTypes)??[],g=f==null?void 0:f.orphanRemoval;y&&_.length===0&&(_=["ALL"],g==null&&(g=!0),s.fillIn(`${d}.${e.name}: composition → cascade=ALL·orphanRemoval=true 제안(사람 확인)`));const b=[`mappedBy = "${m}"`];_.length&&(s.jpa("CascadeType"),b.push(`cascade = { ${_.map(w=>`CascadeType.${w}`).join(", ")} }`)),g&&b.push("orphanRemoval = true"),f!=null&&f.fetchType&&(s.jpa("FetchType"),b.push(`fetch = FetchType.${f.fetchType}`)),s.line(` @OneToMany(${b.join(", ")})`),f!=null&&f.orderBy&&(s.jpa("OrderBy"),s.line(` @OrderBy("${f.orderBy}")`));const E=(f==null?void 0:f.collectionType)==="SET";s.import(E?"java.util.Set":"java.util.List"),s.import(E?"java.util.LinkedHashSet":"java.util.ArrayList");const h=E?`Set<${d}>`:`List<${d}>`,N=E?"new LinkedHashSet<>()":"new ArrayList<>()";return s.line(` private ${h} ${e.name} = ${N};`),{type:h,name:e.name,category:1,collection:!0}}function yg(e,n,o,i=!1){o.jpa("Column");const a=[`name = "${(n==null?void 0:n.physicalName)??""}"`];if(e.notNull&&a.push("nullable = false"),n){const r=Kr.has(n.dataType);n.length!=null&&a.push(r?`precision = ${n.length}`:`length = ${n.length}`),n.scale!=null&&a.push(`scale = ${n.scale}`),i?a.push("insertable = false","updatable = false"):(n.insertable===!1&&a.push("insertable = false"),n.updatable===!1&&a.push("updatable = false")),n.unique&&a.push("unique = true")}return`@Column(${a.join(", ")})`}function gg(e,n,o){var l;const i=n.superClassCatalog??[],a=e.superClass||((l=i.find(s=>s.default))==null?void 0:l.name);if(!a||a==="Object")return"";const r=i.find(s=>s.name===a);return r!=null&&r.packageName?o.import(`${r.packageName}.${r.name}`):o.fillIn(`${e.name}: superClass '${a}' import 확인 필요 (카탈로그 미등록 또는 packageName 부재)`),` extends ${a}`}function bg(e,n,o,i){i.import(lt.serializable),i.import(lt.objects),i.import(lt.jsonUtils),o&&i.import(lt.lombokGetter),i.line(""),i.line(` public static class ${e} implements Serializable {`);for(const a of n)i.line(""),o&&i.line(" @Getter"),i.line(` private ${a.type} ${a.name};`);i.line(""),i.line(` protected ${e}() {`),i.line(" }"),i.line(""),i.line(` public ${e}(${n.map(a=>`${a.type} ${a.name}`).join(", ")}) {`);for(const a of n)i.line(` this.${a.name} = ${a.name};`);if(i.line(" }"),!o)for(const a of n)i.line(""),i.line(` public ${a.type} get${jc(a.name)}() {`),i.line(` return ${a.name};`),i.line(" }");i.line(""),i.line(" @Override"),i.line(" public int hashCode() {"),i.line(` return Objects.hash(${n.map(a=>a.name).join(", ")});`),i.line(" }"),i.line(""),i.line(" @Override"),i.line(" public boolean equals(Object obj) {"),i.line(" if (this == obj) {"),i.line(" return true;"),i.line(" }"),i.line(" if (obj == null) {"),i.line(" return false;"),i.line(" }"),i.line(" if (getClass() != obj.getClass()) {"),i.line(" return false;"),i.line(" }"),i.line(` ${e} other = (${e}) obj;`),i.line(` return ${n.map(a=>`Objects.equals(this.${a.name}, other.${a.name})`).join(" && ")};`),i.line(" }"),i.line(""),i.line(` public static ${e} getPK(String stringId) {`),i.line(` return JSONUtils.readValue(stringId, ${e}.class);`),i.line(" }"),i.line(" }")}function _g(e,n,o){const i=[`${o}.${e}`,`${o}.${e}.${n}`,lt.jpaRepository,lt.querydslExecutor].sort(),a=[`package ${o};`,""];for(const r of i)a.push(`import ${r};`);return a.push(""),a.push(`public interface ${e}Repository extends JpaRepository<${e}, ${n}>, QuerydslPredicateExecutor<${e}> {`),a.push("}"),{fileName:`${e}Repository.java`,source:a.join(`
|
|
24
24
|
`)+`
|
|
25
|
-
`}}function
|
|
25
|
+
`}}function kg(e,n,o){const i=[`${n}.${e}`,lt.jpaRepository,lt.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 ta="com.example",hg="command.domain";function Zo(e,n,o={}){const i=qi(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??hg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const yg="CustomMoneyType",gg="Money";function bg(e){return!(e.type!==yg||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function _g(e){const n=e.dbAttrs[0]??{modelId:Me(),physicalName:"",dataType:""},o={modelId:Me(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:gg,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function kg(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>bg(l)?(a=!0,n=!0,_g(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function Eg(e,n){const o=new Map,i=[],a=new Map;for(const y of e.entities){const g=new Map,_=new Map,E=new Map,N=(p,k,I)=>{if(!p)return;o.get(p)||o.set(p,[{entityId:k,assignedId:p}]),i.push({id:p,entityId:k,sink:I}),I(p)};for(const p of y.attributes){N(p.modelId,y.modelId,k=>g.set(p,k));for(const k of p.dbAttrs)N(k.modelId,y.modelId,I=>_.set(k,I))}for(const p of y.indexes??[])N(p.modelId,y.modelId,k=>E.set(p,k));a.set(y,{attrs:g,cols:_,idx:E})}const r=new Set(o.keys()),l=new Map;for(const y of i){const g=(l.get(y.id)??0)+1;if(l.set(y.id,g),g===1)continue;const _=Ng(y.id,g-1,r);r.add(_),o.get(y.id).push({entityId:y.entityId,assignedId:_}),y.sink(_)}const s=[...o.values()].reduce((y,g)=>y+Math.max(0,g.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,g)=>{var E;if(!g||!y)return g;const _=o.get(g);return!_||_.length<2?g:((E=_.find(N=>N.entityId===y))==null?void 0:E.assignedId)??g},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,g)=>{const _=d.get(y);if(_)return _.end1.entityRef===g?_.end2.entityRef:_.end1.entityRef},m=e.entities.map(y=>{var p;const g=a.get(y),_=y.attributes.map(k=>{const I=g.attrs.get(k),A=k.dbAttrs.map(V=>{const S=g.cols.get(V);return S===V.modelId?V:{...V,modelId:S}});let $=k.derivedFrom;if($){const V=u($.associationRef,y.modelId),S=c(V,$.sourceAttributeRef);S!==$.sourceAttributeRef&&($={...$,sourceAttributeRef:S})}return I!==k.modelId||$!==k.derivedFrom||A.some((V,S)=>V!==k.dbAttrs[S])?{...k,modelId:I,dbAttrs:A,derivedFrom:$}:k}),E=(p=y.indexes)==null?void 0:p.map(k=>{const I=g.idx.get(k),A=k.columns.map(L=>{const V=c(y.modelId,L.columnRef);return V===L.columnRef?L:{...L,columnRef:V}});return I!==k.modelId||A.some((L,V)=>L!==k.columns[V])?{...k,modelId:I,columns:A}:k});return _.some((k,I)=>k!==y.attributes[I])||E&&y.indexes&&E.some((k,I)=>k!==y.indexes[I])?{...y,attributes:_,...E?{indexes:E}:{}}:y}),h=e.associations.map(y=>{const g=c(y.end1.entityRef,y.end1.attributeRef),_=c(y.end2.entityRef,y.end2.attributeRef);return g===y.end1.attributeRef&&_===y.end2.attributeRef?y:{...y,end1:g===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:g},end2:_===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:_}}}),f=n.associationLayouts.map(y=>{const g=d.get(y.associationRef);if(!g)return y;const _=c(g.end1.entityRef,y.sourceColumnRef),E=c(g.end2.entityRef,y.targetColumnRef);return _===y.sourceColumnRef&&E===y.targetColumnRef?y:{...y,sourceColumnRef:_,targetColumnRef:E}});return{logical:{...e,entities:m,associations:h},layout:f.some((y,g)=>y!==n.associationLayouts[g])?{...n,associationLayouts:f}:n,reissued:s}}function Ng(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function Rt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function qr(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 zc(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function Fc(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(zc);if(!i.length)continue;const a=o.filter(s=>!zc(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 ko(e){return JSON.parse(JSON.stringify(e))}function Uc(e,n,o){var L;const i=o.idFactory??Me,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const V=new Set(n);for(const S of r.associations){const x=V.has(S.end1.entityRef),T=V.has(S.end2.entityRef);x!==T&&s.add(x?S.end2.entityRef:S.end1.entityRef)}}const c=r.entities.filter(V=>s.has(V.modelId)),d=new Set(c.map(V=>V.modelId)),u=r.associations.filter(V=>d.has(V.end1.entityRef)&&d.has(V.end2.entityRef)),m=new Set(u.map(V=>V.modelId)),h=new Map,f=V=>{let S=h.get(V);return S||(S=i(),h.set(V,S)),S};for(const V of c){f(V.modelId);for(const S of V.attributes){f(S.modelId);for(const x of S.dbAttrs)f(x.modelId)}for(const S of V.indexes??[])f(S.modelId);for(const S of V.operations??[])f(S.modelId)}for(const V of u)f(V.modelId);const y=V=>h.get(V),g=c.map(V=>{const S=ko(V);S.modelId=y(V.modelId),S.attributes=S.attributes.map(x=>wg(x,y,m,d));for(const x of S.indexes??[])x.modelId=y(x.modelId),x.columns=x.columns.map(T=>Bn(T.columnRef)?T:{...T,columnRef:y(T.columnRef)}).filter(T=>T.columnRef!==void 0);for(const x of S.operations??[])x.modelId=y(x.modelId);return S});Fc(g);const _=u.map(V=>{const S=ko(V);return S.modelId=y(V.modelId),S.end1=Hc(S.end1,y),S.end2=Hc(S.end2,y),S}),E=[];for(const V of r.groups){const S=V.memberEntityRefs.filter(T=>d.has(T));if(S.length===0)continue;const x=ko(V);x.modelId=f(V.modelId),x.memberEntityRefs=S.map(T=>y(T)),E.push(x)}const N=o.collisionSuffix??"_imported",p=new Set(o.existing.entities.map(V=>V.name)),k=new Set(o.existing.entities.map(V=>{var S;return(S=V.table)==null?void 0:S.physicalName}).filter(V=>!!V));for(const V of g)p.has(V.name)&&(V.name=`${V.name}${N}`),(L=V.table)!=null&&L.physicalName&&k.has(V.table.physicalName)&&(V.table.physicalName=`${V.table.physicalName}${N}`);const I=[];for(const V of l.entityLayouts){const S=y(V.entityRef);if(!S)continue;const x=ko(V);x.entityRef=S,x.geo={...x.geo,location:Wr(x.geo.location,a)},x.attributeStyles&&(x.attributeStyles=na(x.attributeStyles,y)),x.operationStyles&&(x.operationStyles=na(x.operationStyles,y)),I.push(x)}const A=[];for(const V of l.associationLayouts){const S=y(V.associationRef);if(!S)continue;const x=ko(V);x.associationRef=S,x.sourceColumnRef=V.sourceColumnRef?y(V.sourceColumnRef):void 0,x.targetColumnRef=V.targetColumnRef?y(V.targetColumnRef):void 0,x.waypoints=x.waypoints.map(T=>Wr(T,a)),A.push(x)}const $=[];for(const V of l.groupLayouts){const S=y(V.groupRef);if(!S)continue;const x=ko(V);x.groupRef=S,x.geo={...x.geo,location:Wr(x.geo.location,a)},delete x.memberNoteRefs,$.push(x)}return{logical:{entities:g,associations:_,groups:E},layout:{entityLayouts:I,associationLayouts:A,groupLayouts:$},idMap:h}}function Wr(e,n){return{x:e.x+n.x,y:e.y+n.y}}function wg(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 Hc(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function na(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function Jr(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function zn(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)=>zn(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(!zn(e[i],n[i]))return!1;return!0}return!1}function Fn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||zn(e[r],n[r])||(i[r]=n[r]===void 0?null:n[r]);return Object.keys(i).length?i:null}function Un(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 Ig(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 vg=new Set(["attributes","operations","indexes","rev"]),Cg=new Set(["end1","end2","rev"]),xg=new Set(["memberEntityRefs","rev"]),jc=new Set(["modelId"]),Sg=new Set(["modelId","columns"]),Rg=new Set([]);function Ag(e,n,o,i){const a=Un(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=Fn(s,c,jc);d&&i.push({kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:s.modelId,patch:d})}const r=Un(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=Fn(s,c,jc);d&&i.push({kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:s.modelId,patch:d})}const l=Un(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(!zn(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=Fn(s,c,Sg);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function $g(e,n,o){const i=Un(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:Jr(l)});for(const{cur:l,tgt:s}of i.common){const c=Fn(l,s,vg);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Ag(l.modelId,l,s,o)}const a=Un(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:Jr(l)});for(const{cur:l,tgt:s}of a.common){const c=Fn(l,s,Cg);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=Fn(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=Un(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:Jr(l)});for(const{cur:l,tgt:s}of r.common){const c=Fn(l,s,xg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Ig(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 oa(e,n,o,i,a,r,l){const s=Un(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)zn(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 Tg(e,n,o){oa(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),oa(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),oa(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),oa(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Mg(e,n){const o=[];return $g(e.logical,n.logical,o),Tg(e.layout,n.layout,o),o}function Vg(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 Bg={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 Dg{constructor(n){Xe(this,"out",[]);Xe(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({...Qo(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({...Qo(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({...Qo(n),field:a,value:void 0,removed:!0});continue}this.out.push({...Qo(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({...Qo(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function Qo(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 Ht(e,n,o,i){if(o==null||typeof o!="object")return;const a=Bg[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Hn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function Xr(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function wn(e,n){var r,l,s,c,d,u,m,h;const o=Vg(n),i=new Dg(n.field),a=[...e].sort((f,y)=>f.seq-y.seq);for(const f of a)for(const y of f.ops)switch(o){case"entity":if(y.entityRef!==n.entityRef)break;y.kind==="entity.add"?Ht(i,f,y.value,"entity"):y.kind==="entity.update"?Hn(i,f,y.patch):y.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const g=Xr((r=y.value)==null?void 0:r.attributes,n.attributeRef);g&&Ht(i,f,g,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===n.attributeRef?Ht(i,f,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===n.attributeRef?Hn(i,f,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===n.attributeRef||y.kind==="entity.remove")&&i.remove(f);break;case"operation":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const g=Xr((s=y.value)==null?void 0:s.operations,n.operationRef);g&&Ht(i,f,g,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===n.operationRef?Ht(i,f,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===n.operationRef?Hn(i,f,y.patch):(y.kind==="operation.remove"&&y.operationRef===n.operationRef||y.kind==="entity.remove")&&i.remove(f);break;case"index":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const g=Xr((d=y.value)==null?void 0:d.indexes,n.indexRef);g&&Ht(i,f,g,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===n.indexRef?Ht(i,f,y.value,"index"):y.kind==="index.update"&&y.indexRef===n.indexRef?Hn(i,f,y.patch):(y.kind==="index.remove"&&y.indexRef===n.indexRef||y.kind==="entity.remove")&&i.remove(f);break;case"association":if(y.associationRef!==n.associationRef)break;y.kind==="association.add"?Ht(i,f,y.value,"association"):y.kind==="association.update"?Hn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(y.associationRef!==n.associationRef)break;if(y.kind==="association.add"){const g=(m=y.value)==null?void 0:m[n.end];Ht(i,f,g,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===n.end?Hn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"group":if(y.groupRef!==n.groupRef)break;if(y.kind==="group.add"){Ht(i,f,y.value,"group");const g=(h=y.value)==null?void 0:h.memberEntityRefs;if(Array.isArray(g))for(const _ of g)i.member(f,_,!1)}else y.kind==="group.update"?Hn(i,f,y.patch):y.kind==="group.remove"?i.remove(f):y.kind==="group.addMember"&&y.entityRef!=null?i.member(f,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(f,y.entityRef,!0);break}return i.result()}const qe={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},Og={"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":qe,"entityLayout.remove":qe,"entityLayout.move":qe,"entityLayout.resize":qe,"entityLayout.setCollapsed":qe,"entityLayout.setLocked":qe,"entityLayout.setStyle":qe,"entityLayout.setAttrStyle":qe,"entityLayout.setOpStyle":qe,"groupLayout.add":qe,"groupLayout.remove":qe,"groupLayout.move":qe,"groupLayout.resize":qe,"groupLayout.setLocked":qe,"groupLayout.setStyle":qe,"groupLayout.addNoteMember":qe,"groupLayout.removeNoteMember":qe,"associationLayout.add":qe,"associationLayout.remove":qe,"associationLayout.setWaypoints":qe,"note.add":qe,"note.remove":qe,"note.move":qe,"note.resize":qe,"note.setMemo":qe,"note.setStyle":qe,"noteConnection.add":qe,"noteConnection.remove":qe,"noteConnection.setWaypoints":qe},At=e=>typeof e=="string"?e:void 0,Lg=e=>{var n;return At((n=e.value)==null?void 0:n.modelId)};function Kc(e){return At(e.containerRef)??At(e.entityRef)}function Zr(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 Qr(e){const n=Og[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,...Zr(o,"attributes","attribute",a),...Zr(o,"operations","operation",a),...Zr(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=Kc(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?Lg(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 Pg(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=Kc(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 zg(e,n){const o=e;return o.entityRef===n||o.containerRef===n}function Fg(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 Qr(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 ia(e,n){return e.map(o=>({...o,subject:n}))}function Gc(e,n){const o=e.filter(s=>s.ops.some(c=>zg(c,n))),{attributes:i,operations:a,indexes:r}=Fg(o,n),l=[...ia(wn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...ia(wn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...ia(wn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...ia(wn(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 el(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Ug(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of Qr(i))a.existence==="add"&&n.add(el(a.subject));return n}function Hg(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=Pg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function jg(e){const{entities:n,associations:o,groups:i}=Hg(e),a=[];for(const r of n)for(const l of Gc(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of wn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of wn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of wn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function tl(e){const n=jg(e),o=Ug(e),i=new Map;for(const l of n){const s=el(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=el(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 Yc(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Kg(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 Qr(r)){if(!l.existence||l.inline)continue;const s=l.subject;Gg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const Gg=new Set(["attribute","operation","index"]);function nl(e,n){const{fromSeq:o}=n,i=tl(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=Yc(m.subject);let f=s.get(h);f||(f={subject:m.subject,evs:[]},s.set(h,f)),f.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 Kg(e,o,r)){const h=s.get(Yc(m.subject));h!=null&&h.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,y)=>f.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",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||h&&f)continue;const y=new Map;let g=null;for(const E of m.evs){E.verb==="add"&&g!==null&&g!=="add"&&y.clear(),g=E.verb;for(const N of E.fields){const p=y.get(N.field);p?p.lastValue=N.value:y.set(N.field,{firstOld:N.oldValue,hasOld:N.oldValue!==void 0,lastValue:N.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(h){const E=[];for(const[N,p]of y)E.push({field:N,value:p.lastValue});d.push({subject:m.subject,verb:"added",fields:E});continue}const _=[];for(const[E,N]of y)N.hasOld&&zn(N.firstOld,N.lastValue)||_.push({field:E,value:N.lastValue,...N.hasOld?{oldValue:N.firstOld}:{}});_.length!==0&&d.push({subject:m.subject,verb:"modified",fields:_})}return{fromSeq:o,toSeq:r,entries:d}}function qc(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 ol{constructor(n){Xe(this,"undoStack",[]);Xe(this,"redoStack",[]);Xe(this,"savePoint",null);Xe(this,"listeners",new Set);Xe(this,"commandListeners",new Set);Xe(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 Nt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function Wc(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function mt(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function $t(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function Qe(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function rn(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 aa(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=Wc(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=mt(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 Jc(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=Wc(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=mt(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 Xc(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=Qe(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(Qe(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Nt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Nt(o)}]}}}}function Zc(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=Qe(i,e);o=a.name,a.name=n},invert(i){Qe(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 Eo(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=mt(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=mt(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 Qc(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=mt(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=mt(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 ei(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 ed(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=mt(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=ei(r.style,n)},invert(i){const a=mt(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=mt(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 td(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=mt(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=mt(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 nd(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=mt(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=mt(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 il(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 ra(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=ei(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=mt(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 la(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 od(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:Nt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Nt(o)}]}}}}function id(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 ad(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 sa(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 rd(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 ld(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 sd(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=ei(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 cd(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 jt(e,n){return{label:`속성 추가: ${n.name}`,apply(o){Qe(o,e).attributes.push(n)},invert(o){const i=Qe(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 Kt(e,n,o){const i={},a=r=>{const l=Qe(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:Nt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Nt(i)}]}}}}function dd(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=Qe(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&&Qe(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 ud(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 al(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=Qe(a,e);i=r.attributes.map(s=>({...s}));const l=qr([...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&&Qe(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).attributes;return ud("attribute.update","attributeRef",e,r,i??[])}}}function md(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=Qe(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=Qe(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 fd(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(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:Nt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Nt(i)}]}}}}function pd(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=Qe(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=Qe(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 hd(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=Qe(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=qr([...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=Qe(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=Qe(a,e).operations??[];return ud("operation.update","operationRef",e,r,i??[])}}}function yd(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=mt(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=ei(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=mt(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=mt(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 ca(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 gd(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 da(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:Nt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Nt(o)}]}}}}function Tt(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:Nt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Nt(i)}]}}}}function bd(e,n){return{label:"인덱스 추가",apply(o){const i=Qe(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=Qe(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 ua(e,n,o){const i={},a=r=>{var s;const l=(s=Qe(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:Nt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Nt(i)}]}}}}function _d(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=Qe(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&&Qe(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 Gt=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),ti=(e,n)=>{var o;return((o=$t(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function kd(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=$t(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=$t(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=ti(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[Gt(e,r)],invert:[Gt(e,l)]}}}}function Ed(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=$t(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=$t(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=ti(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[Gt(e,a)],invert:[Gt(e,r)]}}}}function Nd(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=$t(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=$t(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[Gt(e,ti(a,e))],invert:[Gt(e,i??[])]}}}}function wd(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=$t(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=$t(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[Gt(e,ti(o,e))],invert:[Gt(e,n??[])]}}}}function Id(e,n,o){return{label:"waypoint 추가",apply(i){const a=$t(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=$t(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=ti(i,e),r=a.slice();return r.splice(n,1),{forward:[Gt(e,a)],invert:[Gt(e,r)]}}}}function vd(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 Cd(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 ni(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 xd(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 Sd(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 Rd(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=ei(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 Ad(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 $d(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 In=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),ma=(e,n,o)=>{var i;return((i=rn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Td(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 Md(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 Vd(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=rn(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=rn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=ma(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[In(e,n,l)],invert:[In(e,n,s)]}}}}function Bd(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=rn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=rn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=ma(a,e,n),l=r.slice();return l.splice(o,1),{forward:[In(e,n,r)],invert:[In(e,n,l)]}}}}function Dd(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=rn(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=rn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=ma(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[In(e,n,r)],invert:[In(e,n,l)]}}}}function Od(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=rn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=rn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[In(e,n,ma(i,e,n))],invert:[In(e,n,o??[])]}}}}function We(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 Yg=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:ca,addAttribute:jt,addEntity:aa,addEntityToGroup:ad,addGroup:la,addIndex:bd,addNote:vd,addNoteConnection:Td,addNoteConnectionWaypoint:Bd,addNoteToGroup:Ad,addOperation:md,addWaypoint:Id,clearNoteConnectionWaypoints:Od,clearWaypoints:wd,composite:We,moveEntity:Eo,moveGroup:rd,moveNote:ni,moveNoteConnectionWaypoint:Vd,moveWaypoint:kd,removeAssociation:gd,removeAttribute:dd,removeEntity:Jc,removeEntityFromGroup:sa,removeGroup:id,removeIndex:_d,removeNote:Cd,removeNoteConnection:Md,removeNoteConnectionWaypoint:Dd,removeNoteFromGroup:$d,removeOperation:pd,removeWaypoint:Ed,renameEntity:Zc,reorderAttributes:al,reorderOperations:hd,resizeEntity:Qc,resizeGroup:ld,resizeNote:xd,setAllEntitiesCollapsed:il,setAttributeSwatch:ra,setEntityCollapsed:td,setEntityLocked:nd,setEntitySwatch:ed,setGroupLocked:cd,setGroupSwatch:sd,setNoteMemo:Sd,setNoteSwatch:Rd,setOperationSwatch:yd,translateWaypoints:Nd,updateAssociation:da,updateAssociationEnd:Tt,updateAttribute:Kt,updateEntity:Xc,updateGroup:od,updateIndex:ua,updateOperation:fd},Symbol.toStringTag,{value:"Module"}));class Ld{constructor(){Xe(this,"revs",new Map);Xe(this,"layoutVersion",0);Xe(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 qg=[400,1200];function Wg(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 Jg(e){const n=Wg(e);return n==null||n===408||n===429?!0:n<400||n>=500}const Xg=e=>new Promise(n=>setTimeout(n,e));class Pd{constructor(n){Xe(this,"cache",new Ld);Xe(this,"newClientOpId");Xe(this,"debounceMs");Xe(this,"retryDelaysMs");Xe(this,"emissions",new WeakMap);Xe(this,"open",null);Xe(this,"debounceHandle",null);Xe(this,"queue",[]);Xe(this,"sending",!1);Xe(this,"_frozen",!1);Xe(this,"stack",null);Xe(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Me,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??qg}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||!Jg(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await Xg(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 zd=["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"],Fd=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function Ud(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 Zg(e){return nn(e).length}function rl(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 Qg(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=Yo(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 Hd(e,n,o=Me){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=Zg(i);if(a===0)return[];const r=rl(e,n),l=nn(i).map(c=>c.col),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;Qg(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 jd(e,n,o){var h;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const y=r.get(f);if(!y)return[];l.push(y)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,y)=>f===c[y]))return[];const d=new Map(s.map((f,y)=>[f,y])),u=rl(e,n),m=[];for(const f of e.entities)for(const y of f.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 g=c.map(E=>y.dbAttrs[d.get(E)]),_=g.reduce((E,N,p)=>N===y.dbAttrs[p]?E:E+1,0);_&&m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:g,moved:_})}return m}function Kd(e,n,o){var h;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=new Set(o),r=i.attributes.filter(f=>!a.has(f.modelId));if(r.length===i.attributes.length)return[];const l=nn(i).map(f=>f.col),s=l.map(f=>f.modelId),c=new Set(nn({...i,attributes:r}).map(f=>f.col.modelId)),d=new Set;if(s.forEach((f,y)=>{c.has(f)&&d.add(y)}),d.size===s.length)return[];const u=rl(e,n),m=[];for(const f of e.entities)for(const y of f.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 g=y.dbAttrs.filter((N,p)=>d.has(p)),_=y.dbAttrs.filter((N,p)=>!d.has(p));y.dbAttrs.some((N,p)=>{if(d.has(p))return!1;const k=l[p],I=!!N.physicalName&&N.physicalName!==((k==null?void 0:k.physicalName)??""),A=N.sharedColumnRef!=null&&N.sharedColumnRef!==(k==null?void 0:k.sharedColumnRef);return I||A})||m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:g,dropped:_})}return m}function eb(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 tb(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 Gd(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=eb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>ib(i,e))}}function nb(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 ll(e,n){const o=nb(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 sl(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 ob=new Set(["name","description","packageName","excludeDDLGeneration"]);function ib(e,n){var a;const o=qi(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 Yd(e,n){const o=tb(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 ab(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 rb(e,n){const o=ab(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 qd(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 cl(e){return e.by!==void 0&&e.by!=="name"}function lb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function sb(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function cb(e,n){const o=lb(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 Wd(e,n){const o=sb(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 Jd(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function Xd(e){return Jd(e)&&e.dataType==null}function Zd(e,n,o){const i=Jd(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 Qd(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let h=!1;for(const f of n.fields){const y=u.get(f.name);if(y!=null&&y.sharedColumnPhysicalName){const g={ref:y.sharedColumnPhysicalName,by:"physicalName"},_=qd(Nn(i,a),g);if(!_.ok){s.push(_.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:_.matches}),h=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:_.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 db=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs"]),ub=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),mb=new Set(["description","identifying"]),fb=new Set(["multiplicity","navigable","composition"]),pb=new Set(["name","unique","description","parameters"]),hb=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function No(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 dl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),yb=new Set([...dl].filter(e=>e!=="sharedColumnRef"));function gb(e,n,o,i){if(i||o.some(l=>!yb.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))dl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function bb(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 f=n.fields[h],y=f?c.get(f.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const _={ref:y.sharedColumnPhysicalName,by:"physicalName"},E=qd(Nn(i,a),_);if(!E.ok){s.push(E.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:E.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:E.value.modelId});return}const g={...m};delete g.sharedColumnRef,d.push({...g,...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 eu(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 tu(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=rb(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 wo(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 _b(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 Ud(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function kb(e,n,o,i,a,r){const l=m=>{const h=new Map;for(const{entityId:f,item:y}of m){if(a.has(f))continue;const g=h.get(f)??[];g.push(y),h.set(f,g)}return h},s=l(o.pairs.map(m=>({entityId:m.entityId,item:m.attributeId}))),c=l(i.map(m=>({entityId:m.entityId,item:m.attribute}))),d=new Set(e.filter(m=>m.kind==="attribute.update").map(m=>m.attributeRef)),u=m=>{d.has(m.attributeId)||(d.add(m.attributeId),e.push({kind:"attribute.update",casUnit:"logical",containerRef:m.entityId,entityRef:m.entityId,attributeRef:m.attributeId,patch:{dbAttrs:m.dbAttrs}}))};for(const[m,h]of s)if(!c.has(m))for(const f of Kd(n,m,h))u(f);for(const[m,h]of c){if(s.has(m))continue;const f={...n,entities:n.entities.map(y=>y.modelId===m?{...y,attributes:[...y.attributes,...h]}:y)};for(const y of Hd(f,m,r))u(y)}}function ul(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of Nc(n,o,i)){for(const u of c.remove)wo(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 Eb(e,n,o={}){const i=o.mkId??Me,a=o.embeddableCatalog??[],r=p=>a.find(k=>k.type===p),l=[],s=[],c=new Map,d=(p,k)=>{const I=c.get(p)??Rt(k);return c.set(p,I+1),I},u=new Map,m=new Set,h=new Set,f={seen:new Set,pairs:[]},y=[],g=new Set,_=(p,k)=>`${p}\0${k}`,E=new Set;for(const p of n)p.kind==="entity.add"&&(E.add(p.spec.name),p.spec.physicalName&&E.add(p.spec.physicalName));const N=new Set;return n.forEach((p,k)=>{var I,A,$,L,V;switch(p.kind){case"entity.add":{const S=e.entities.filter(O=>O.name===p.spec.name).map(O=>O.modelId);if(S.length||N.has(p.spec.name)){s.push({code:"entity-name-conflict",opIndex:k,handle:{ref:p.spec.name},matches:S});break}N.add(p.spec.name);const x=i(),T={modelId:x,name:p.spec.name,stereotype:p.spec.stereotype??"JPA_ENTITY",attributes:[],...p.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...p.spec.physicalName?{table:{physicalName:p.spec.physicalName}}:{}},D={ref:p.spec.name};let b=!1;for(const[O,M]of(p.spec.attributes??[]).entries()){if(M.type==="GroupCodeEnum"&&!M.groupCode){s.push({code:"groupcode-required",opIndex:k,entity:D,handle:{ref:M.name}}),b=!0;continue}if(!r(M.type)&&!((I=M.embeddableOverrides)!=null&&I.length)&&Xd(M)){s.push({code:"datatype-required",opIndex:k,entity:D,handle:{ref:M.name}}),b=!0;continue}const z=r(M.type);if(z){const j=Qd(M,z,O,T,e.entities,k,D,s,i);j?T.attributes.push(j):b=!0}else(A=M.embeddableOverrides)!=null&&A.length?(s.push({code:"embeddable-type-unresolved",opIndex:k,entity:D,handle:{ref:M.name}}),b=!0):T.attributes.push(Zd(M,O,i))}const w=(p.spec.operations??[]).map((O,M)=>eu(O,M,i));w.length&&(T.operations=w);const v=[];for(const O of p.spec.indexes??[]){const M=tu(T,O,k,D,s,i);M?v.push(M):b=!0}if(v.length&&(T.indexes=v),b)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:x,value:T});break}case"entity.update":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}const x=No(p.patch,ub,["jpaAttrs.","table."]);if(x.length){s.push({code:"entity-patch-unknown-key",opIndex:k,entity:p.entity,keys:x});break}const T=p.patch.stereotype;if(typeof T=="string"&&T!==S.value.stereotype&&(T==="JPA_EMBEDDABLE"||S.value.stereotype==="JPA_EMBEDDABLE")){s.push({code:"stereotype-embeddable-transition-unsupported",opIndex:k,entity:p.entity,from:S.value.stereotype??"",to:T});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,patch:p.patch});break}case"entity.remove":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}const x=S.value.modelId,T=e.associations.filter(v=>v.end1.entityRef===x||v.end2.entityRef===x),D=new Set(T.map(v=>v.modelId));for(const v of T)m.has(v.modelId)||(m.add(v.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:v.modelId}));for(const v of e.entities)if(v.modelId!==x)for(const O of v.attributes)O.embedded&&D.has(O.embedded.associationRef)&&wo(l,f,v.modelId,O.modelId);for(const v of T){if(v.end1.entityRef===x||!v.end1.attributeRef)continue;const O=e.entities.find(z=>z.modelId===v.end1.entityRef),M=O==null?void 0:O.attributes.find(z=>z.modelId===v.end1.attributeRef&&z.attrType==="RELATION_REF");M&&wo(l,f,O.modelId,M.modelId)}const b={...e,entities:e.entities.filter(v=>v.modelId!==x),associations:e.associations.filter(v=>!D.has(v.modelId))},w=new Set(T.filter(v=>v.end1.entityRef===x&&v.end2.entityRef!==x).map(v=>v.end2.entityRef));for(const v of w)ul(l,b,v,i,f,d);for(const v of e.groups)v.memberEntityRefs.includes(x)&&(g.has(_(v.modelId,x))||(g.add(_(v.modelId,x)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:v.modelId,groupRef:v.modelId,entityRef:x})));h.add(x),l.push({kind:"entity.remove",casUnit:"logical",entityRef:x});break}case"attribute.add":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}if(p.spec.type==="GroupCodeEnum"&&!p.spec.groupCode){s.push({code:"groupcode-required",opIndex:k,entity:p.entity,handle:{ref:p.spec.name}});break}if(!r(p.spec.type)&&!(($=p.spec.embeddableOverrides)!=null&&$.length)&&Xd(p.spec)){s.push({code:"datatype-required",opIndex:k,entity:p.entity,handle:{ref:p.spec.name}});break}const x=d(S.value.modelId,S.value.attributes),T=r(p.spec.type);let D;if(T)D=Qd(p.spec,T,x,S.value,e.entities,k,p.entity,s,i);else if((L=p.spec.embeddableOverrides)!=null&&L.length){s.push({code:"embeddable-type-unresolved",opIndex:k,entity:p.entity,handle:{ref:p.spec.name}});break}else D=Zd(p.spec,x,i);if(!D)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,value:D}),y.push({entityId:S.value.modelId,attribute:D});break}case"attribute.update":case"attribute.remove":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}const x=Yd(S.value,p.attribute);if(!x.ok){s.push(x.reason==="not-found"?{code:"attribute-not-found",opIndex:k,entity:p.entity,handle:p.attribute}:{code:"attribute-ambiguous",opIndex:k,entity:p.entity,handle:p.attribute,matches:x.matches});break}if(p.kind==="attribute.update"){const T=[],D=[];let b=!1;for(const M of Object.keys(p.patch)){if(M.includes(".")){M.startsWith("dbAttrs.")?b=!0:D.push(M);continue}dl.has(M)?T.push(M):db.has(M)||D.push(M)}if(D.length){s.push({code:"attribute-patch-unknown-key",opIndex:k,entity:p.entity,handle:p.attribute,keys:D});break}if("attrType"in p.patch){const M=String(p.patch.attrType),z=Fd.includes(M)?M!==x.value.attrType?"transition":void 0:"unknown-value";if(z){s.push({code:"attribute-attrtype-unsupported",opIndex:k,entity:p.entity,handle:p.attribute,reason:z,current:x.value.attrType,requested:M});break}}const w="type"in p.patch?p.patch.type:x.value.type,v="groupCode"in p.patch?p.patch.groupCode:x.value.groupCode;if(w==="GroupCodeEnum"&&!v){s.push({code:"groupcode-required",opIndex:k,entity:p.entity,handle:p.attribute});break}let O=p.patch;if(T.length){const M=gb(x.value,p.patch,T,b);if(!M){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:k,entity:p.entity,handle:p.attribute,keys:T});break}O=M}if((V=p.embeddableOverrides)!=null&&V.length){const M=r(x.value.type);if(!M||x.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:k,entity:p.entity,handle:p.attribute});break}const z=bb(x.value,M,p.embeddableOverrides,S.value,e.entities,k,p.entity,s);if(!z)break;O={...O,dbAttrs:z}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,attributeRef:x.value.modelId,patch:O})}else{const T=Xi(e,S.value.modelId,x.value.modelId);if(T){const D=b=>{var w;return((w=e.entities.find(v=>v.modelId===b))==null?void 0:w.name)??b};s.push({code:"attribute-fk-managed",opIndex:k,entity:p.entity,handle:p.attribute,association:{from:D(T.end1.entityRef),to:D(T.end2.entityRef)}});break}wo(l,f,S.value.modelId,x.value.modelId)}break}case"association.add":{const S=yt(e,p.spec.from),x=yt(e,p.spec.to);if(S.ok||s.push(gt(S.reason,k,p.spec.from,S.matches,E)),x.ok||s.push(gt(x.reason,k,p.spec.to,x.matches,E)),!S.ok||!x.ok)break;if(p.spec.identifying&&S.value.modelId===x.value.modelId){s.push({code:"self-identifying",opIndex:k,handle:{from:p.spec.from,to:p.spec.to}});break}if(S.value.stereotype==="JPA_EMBEDDABLE"||x.value.stereotype==="JPA_EMBEDDABLE"){s.push({code:"embeddable-relation-unsupported",opIndex:k,handle:{from:p.spec.from,to:p.spec.to}});break}const T=i(),D={modelId:T,...p.spec.identifying!=null?{identifying:p.spec.identifying}:{},end1:{entityRef:S.value.modelId,multiplicity:p.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:x.value.modelId,multiplicity:p.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:p.spec.composition??!1}},b={...e,associations:[...e.associations,D]},w=Jo(b,x.value.modelId,i);w.add[0]&&(D.end2.attributeRef=w.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:T,value:D});for(const v of w.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:{...v,order:d(x.value.modelId,x.value.attributes)}});break}case"association.remove":{const S=yt(e,p.association.from),x=yt(e,p.association.to);if(S.ok||s.push(gt(S.reason,k,p.association.from,S.matches,E)),x.ok||s.push(gt(x.reason,k,p.association.to,x.matches,E)),!S.ok||!x.ok)break;const T=Gd(e,S.value.modelId,x.value.modelId);if(T.length!==1){s.push(T.length===0?{code:"association-not-found",opIndex:k,handle:p.association}:{code:"association-ambiguous",opIndex:k,handle:p.association,matches:T.map(v=>v.modelId)});break}const D=T[0];m.has(D.modelId)||(m.add(D.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:D.modelId}));const b=e.entities.find(v=>v.attributes.some(O=>{var M;return((M=O.embedded)==null?void 0:M.associationRef)===D.modelId}));if(b){const v=b.attributes.find(O=>{var M;return((M=O.embedded)==null?void 0:M.associationRef)===D.modelId});wo(l,f,b.modelId,v.modelId);break}if(D.end1.attributeRef){const v=e.entities.find(M=>M.modelId===D.end1.entityRef),O=v==null?void 0:v.attributes.find(M=>M.modelId===D.end1.attributeRef&&M.attrType==="RELATION_REF");O&&wo(l,f,v.modelId,O.modelId)}const w={...e,associations:e.associations.filter(v=>v.modelId!==D.modelId)};ul(l,w,D.end2.entityRef,i,f,d);break}case"association.update":{const S=nu(e,p.association,k,s,E);if(!S)break;const x=p.patch.identifying,T=typeof x=="boolean"?x:void 0;if(T===!0&&S.end1.entityRef===S.end2.entityRef){s.push({code:"self-identifying",opIndex:k,handle:p.association});break}const D=No(p.patch,mb);if(D.length){s.push({code:"association-patch-unknown-key",opIndex:k,handle:p.association,keys:D});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:S.modelId,associationRef:S.modelId,patch:p.patch}),T!==void 0&&T!==(S.identifying??!1)){const b={...e,associations:e.associations.map(w=>w.modelId===S.modelId?{...w,identifying:T}:w)};ul(l,b,S.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const S=nu(e,p.association,k,s,E);if(!S)break;const x=p.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(p.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:k,handle:p.association});break}const T=No(p.patch,fb,["jpa."]);if(T.length){s.push({code:"association-end-patch-unknown-key",opIndex:k,handle:p.association,keys:T});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:S.modelId,associationRef:S.modelId,end:x,patch:p.patch});break}case"index.add":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}const x=tu(S.value,p.spec,k,p.entity,s,i);if(!x)break;l.push({kind:"index.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:x.modelId,value:x});break}case"index.update":case"index.remove":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}if(cl(p.index)){s.push({code:"handle-by-unsupported",opIndex:k,entity:p.entity,handle:p.index,target:"index"});break}const x=cb(S.value,p.index);if(!x.ok){s.push(x.reason==="not-found"?{code:"index-not-found",opIndex:k,entity:p.entity,handle:p.index}:{code:"index-ambiguous",opIndex:k,entity:p.entity,handle:p.index,matches:x.matches});break}if(p.kind==="index.update"){if("columns"in p.patch){s.push({code:"index-columns-patch-unsupported",opIndex:k,entity:p.entity,handle:p.index});break}const T=No(p.patch,pb);if(T.length){s.push({code:"index-patch-unknown-key",opIndex:k,entity:p.entity,handle:p.index,keys:T});break}l.push({kind:"index.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:x.value.modelId,patch:p.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,indexRef:x.value.modelId});break}case"operation.add":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}const x=u.get(S.value.modelId)??(S.value.operations?Rt(S.value.operations):0);u.set(S.value.modelId,x+1);const T=eu(p.spec,x,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:T.modelId,value:T});break}case"operation.update":case"operation.remove":{const S=yt(e,p.entity);if(!S.ok){s.push(gt(S.reason,k,p.entity,S.matches,E));break}if(cl(p.operation)){s.push({code:"handle-by-unsupported",opIndex:k,entity:p.entity,handle:p.operation,target:"operation"});break}const x=Wd(S.value,p.operation);if(!x.ok){s.push(x.reason==="not-found"?{code:"operation-not-found",opIndex:k,entity:p.entity,handle:p.operation}:{code:"operation-ambiguous",opIndex:k,entity:p.entity,handle:p.operation,matches:x.matches});break}if(p.kind==="operation.update"){const T=No(p.patch,hb);if(T.length){s.push({code:"operation-patch-unknown-key",opIndex:k,entity:p.entity,handle:p.operation,keys:T});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:x.value.modelId,patch:p.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:S.value.modelId,entityRef:S.value.modelId,operationRef:x.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const S=p.kind==="attribute.reorder",x=yt(e,p.entity);if(!x.ok){s.push(gt(x.reason,k,p.entity,x.matches,E));break}const T=S?p.order:p.operations,D=[],b=new Set;let w=!1;for(const z of T){if(!S&&cl(z)){s.push({code:"handle-by-unsupported",opIndex:k,entity:p.entity,handle:z,target:"operation"}),w=!0;continue}const j=S?Yd(x.value,z):Wd(x.value,z);if(!j.ok){s.push(j.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:k,entity:p.entity,handle:z}:{code:"reorder-handle-ambiguous",opIndex:k,entity:p.entity,handle:z,matches:j.matches}),w=!0;continue}if(b.has(j.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:k,entity:p.entity,handle:z}),w=!0;continue}b.add(j.value.modelId),D.push(j.value)}if(w)break;const O=[...S?x.value.attributes:x.value.operations??[]].sort((z,j)=>z.order-j.order).filter(z=>!b.has(z.modelId)),M=[...D,...O];if(M.forEach((z,j)=>{z.order!==j&&l.push(S?{kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:z.modelId,patch:{order:j}}:{kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:z.modelId,patch:{order:j}})}),S)for(const z of jd(e,x.value.modelId,M.map(j=>j.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:z.entityId,entityRef:z.entityId,attributeRef:z.attributeId,patch:{dbAttrs:z.dbAttrs}});break}case"group.add":{const S=[];let x=!1;for(const b of p.spec.members){const w=yt(e,b);if(!w.ok){s.push(gt(w.reason,k,b,w.matches,E)),x=!0;continue}S.push(w.value.modelId)}if(x)break;const T=i(),D={modelId:T,excludeDDLGeneration:p.spec.excludeDDLGeneration??!1,memberEntityRefs:S,...p.spec.name?{name:p.spec.name}:{},...p.spec.packageName?{packageName:p.spec.packageName}:{},...p.spec.description?{description:p.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:T,value:D});break}case"group.update":{const S=ll(e,p.group);if(!S.ok){s.push(sl(S,k,p.group));break}const x=No(p.patch,ob);if(x.length){s.push({code:"group-patch-unknown-key",opIndex:k,handle:p.group,keys:x});break}l.push({kind:"group.update",casUnit:"logical",containerRef:S.value.modelId,groupRef:S.value.modelId,patch:p.patch});break}case"group.remove":{const S=ll(e,p.group);if(!S.ok){s.push(sl(S,k,p.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:S.value.modelId});break}case"group.addMember":case"group.removeMember":{const S=ll(e,p.group);if(!S.ok){s.push(sl(S,k,p.group));break}const x=yt(e,p.entity);if(!x.ok){s.push(gt(x.reason,k,p.entity,x.matches,E));break}const T=S.value.memberEntityRefs.includes(x.value.modelId);if(p.kind==="group.addMember"?T:!T)break;if(p.kind==="group.removeMember"){if(g.has(_(S.value.modelId,x.value.modelId)))break;g.add(_(S.value.modelId,x.value.modelId))}l.push({kind:p.kind,casUnit:"logical",containerRef:S.value.modelId,groupRef:S.value.modelId,entityRef:x.value.modelId});break}}}),s.length||_b(l,e,f,h),s.length||kb(l,e,f,y,h,i),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 nu(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=Gd(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 ou={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},Nb={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},wb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Ib={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},vn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},vb={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:{...vn,description:"속성 설명(다국어)."},columnLogicalName:{...vn,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},Cb={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}},iu={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},xb={type:"object",description:"일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)을 end 로 주면 거부된다(임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...iu,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...iu,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},Sb={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...ou,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:{...vn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Ab={type:"object",properties:{name:{...vn,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},$b={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:[...Fd],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},description:{...vn,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:{...vn,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},Tb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Mb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},Vb={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...vn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},Bb={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·referenceOnly·declarationOfInterfaces·table. jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경. stereotype 은 JPA_EMBEDDABLE 경계를 넘을 수 없다 — 들어가고 나오는 전환은 PK 해제/부여·FK reconcile·EMBED 복원/해체가 동반되는 composite라 patch로 표현되지 않는다(거부. 전환은 GUI 소관).'},Db={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 Ob={"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"]})},Lb={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},Pb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...vn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},au={anyOf:zd.map(e=>Ob[e])},zb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:ou,nameHandle:Nb,groupHandle:Lb,assocHandle:wb,entitySpec:Ib,attrSpec:vb,embeddableOverrides:Cb,assocSpec:xb,indexSpec:Sb,operationSpec:Rb,groupSpec:Ab,entityUpdatePatch:Bb,attrUpdatePatch:$b,assocUpdatePatch:Tb,assocEndUpdatePatch:Db,indexUpdatePatch:Mb,operationUpdatePatch:Vb,groupUpdatePatch:Pb,symbolicOp:au}};function Fb(e,n,o,i={}){const a=i.mkClientOpId??Me,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 ru={location:{x:0,y:0},size:{width:220,height:140}};function lu(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 Ub=/^[-=_*~\s]{3,}$/;function Hb(e){return e.attrType&&e.attrType!=="NORMAL"||!Ub.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function jb(e){return e.type===an&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Kb(e,n){if(e.attrType==="DIVIDER"||Hb(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=jb(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(lu)}}function Gb(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 Yb(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 qb(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(Kb),operations:(n=e.operations)==null?void 0:n.map(Gb),indexes:(o=e.indexes)==null?void 0:o.map(Yb),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function Wb(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??{...ru},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 su(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 ml(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:su(e)}}function Jb(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>fl(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function Xb(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:Jb(e),end1:ml(e.end1),end2:ml(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 fl(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function cu(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function du(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 uu(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(lu)}}function Zb(e,n,o){var k,I;const i=fl(e.end1.attribute),a=fl(e.end2.attribute);if(i===a)return Xb(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(I=(k=s.dbAttrs)==null?void 0:k[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,$)=>Math.max(A,$.order),-1)+1:s.order??0,h={...uu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(h);const f=n.get(r.endModel.refId),y=l.attribute;let g;if(y&&f&&r.navigable){const A=Hi(l.multiplicity);g={modelId:y.modelId??crypto.randomUUID(),name:mo(y.name??Ki((u==null?void 0:u.name)??l.endModel.refId,A),new Set(f.attributes.map($=>$.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce(($,L)=>Math.max($,L.order),-1)+1,dbAttrs:[]},f.attributes.push(g)}const _=(A,$)=>({entityRef:A.endModel.refId,multiplicity:A.multiplicity,navigable:A.navigable,composition:A.composition,attributeRef:$?g==null?void 0:g.modelId:h.modelId,jpa:su(A)}),E=r.endModel.refId===l.endModel.refId,N={modelId:e.modelId,description:e.description,identifying:!E&&h.identifier===!0?!0:void 0,end1:_(e.end1,i),end2:_(e.end2,a)},p={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:h.modelId,targetColumnRef:i?h.modelId:d,style:e.style};return{assoc:N,layout:p}}function Qb(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 e_(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((g,_)=>Math.max(g,_.order),-1)+1:l.order??0,d={...uu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(g=>Qb(g,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=g=>({...ml(g),legacyEmbedRaw:g.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},h=!i,f={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:f}}function t_(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 mu(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=t_(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 fu(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 n_(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=Hi(i.end2.multiplicity),u=Ki(r.name,d),m=mo(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,f)=>Math.max(h,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function o_(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 pu(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&&!qs(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 hu(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?i_(n):a_(n)}function i_(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:h,...f}=m;return h!=null&&(o[m.modelId]=h),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);n_(a,r),o_(a,r),pu(a,r);const{version:s,...c}=e.layout;fu(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,referenceOnly:e.referenceOnly,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function a_(e){var E,N;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(p,k)=>{o.push(qb(p));const I=Wb(p);I.geo={location:{x:I.geo.location.x+k.x,y:I.geo.location.y+k.y},size:I.geo.size},i.push(I);for(const A of p.ownedAssociations??[])c.push(A)},u={x:0,y:0};for(const p of e.entities??[])d(p,u);const m=[];for(const p of e.groups??[]){const k=p.entities??[];l.push({modelId:p.modelId,name:p.name,description:p.description,packageName:p.packageName,excludeDDLGeneration:p.excludeDDLGeneration??!1,memberEntityRefs:k.map(A=>A.modelId)});const I=((E=p.geo)==null?void 0:E.location)??u;if(p.geo){const A=(p.notes??[]).map($=>$.modelId);s.push({groupRef:p.modelId,geo:p.geo,style:p.style,locked:p.locked,memberNoteRefs:A.length?A:void 0})}for(const A of k)d(A,I);for(const A of p.notes??[])m.push(mu(A,I))}const h=new Map(o.map(p=>[p.modelId,p])),f=new Map,y=new Map;for(const p of o)for(const k of p.attributes)for(const I of k.dbAttrs)f.set(I.modelId,k.modelId),y.set(I.modelId,I);for(const p of c)for(const k of[p.end1,p.end2]){const I=k.attribute;if(I&&(((N=I.dbAttrs)==null?void 0:N.length)??0)>0)for(const A of I.dbAttrs)A.modelId&&f.set(A.modelId,I.modelId)}for(const p of c){const k=cu(p.end1.attribute),I=cu(p.end2.attribute),A=du(p.end1)||du(p.end2),{assoc:$,layout:L}=k!==I||A?e_(p,h,y):Zb(p,h,f);a.push($),r.push(L)}fu(o,a,r),Fc(o),pu(o,a);const g={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(p=>mu(p)),...m]}},_={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:g,meta:_}}function yu(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 r_(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(yu),style:n}}function l_(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 s_(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 Cn(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 c_(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{...yu(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function d_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function gu(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 u_(e){const n=new Set;for(const o of e.logical.associations){const i=gu(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function m_(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 f_(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function p_(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:f_(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 h_(e,n,o){let i;for(const m of n.logical.entities){const h=m.attributes.find(f=>{var y;return((y=f.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)=>p_(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:Cn(e.end1,c?s:u),end2:Cn(e.end2,c?u:s)}}function y_(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:Cn(e.end1,e.end1.legacyEmbedRaw),end2:Cn(e.end2,e.end2.legacyEmbedRaw)};const a=h_(e,n,i);if(a)return a;const r=gu(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?c_(r.fk,l):void 0,c=d_(r.navAttr);return{...i,end1:Cn(e.end1,r.navEnd===e.end1?s:c),end2:Cn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:Cn(e.end1),end2:Cn(e.end2)}}function bu(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(f=>f.associationRef===h),c=(r==null?void 0:r.geo)??{...ru},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 f;return r_(h,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[h.modelId])}),operations:(u=e.operations)==null?void 0:u.map(h=>{var f;return l_(h,(f=r==null?void 0:r.operationStyles)==null?void 0:f[h.modelId])}),ownedAssociations:l.map(h=>y_(h,n,s(h.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(s_),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 g_(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=>_u(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>bu(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 _u(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 b_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=u_(e),r=m_(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=>bu(s,e,a,r)),groups:e.logical.groups.map(s=>g_(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>_u(s))}}function __(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,referenceOnly:n.referenceOnly,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 k_=["notNull"];function E_(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}=hu(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 f of m.attributes){const y=h.get(f.modelId);if(!y){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const g={};for(const _ of k_)f[_]===!0!=(y[_]===!0)&&(g[_]=f[_],s.attributeFieldsByName[_]=(s.attributeFieldsByName[_]??0)+1);Object.keys(g).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:g}),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 oi(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function ln(e){return typeof e=="function"?e():t.unref(e)}const N_=typeof window<"u"&&typeof document<"u",w_=e=>typeof e<"u",I_=Object.prototype.toString,v_=e=>I_.call(e)==="[object Object]",C_=()=>{};function x_(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 ku=e=>e();function S_(e=ku){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 Eu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function R_(e,n,o={}){const{eventFilter:i=ku,...a}=o;return t.watch(e,x_(i,n),a)}function Io(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=S_(i);return{stop:R_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function A_(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=ln(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 pl(e,n=!1){function o(m,{flush:h="sync",deep:f=!1,timeout:y,throwOnTimeout:g}={}){let _=null;const N=[new Promise(p=>{_=t.watch(e,k=>{m(k)!==n&&(_==null||_(),p(k))},{flush:h,deep:f,immediate:!0})})];return y!=null&&N.push(Eu(y,g).then(()=>ln(e)).finally(()=>_==null?void 0:_())),Promise.race(N)}function i(m,h){if(!t.isRef(m))return o(k=>k===m,h);const{flush:f="sync",deep:y=!1,timeout:g,throwOnTimeout:_}=h??{};let E=null;const p=[new Promise(k=>{E=t.watch([e,m],([I,A])=>{n!==(I===A)&&(E==null||E(),k(I))},{flush:f,deep:y,immediate:!0})})];return g!=null&&p.push(Eu(g,_).then(()=>ln(e)).finally(()=>(E==null||E(),ln(e)))),Promise.race(p)}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(f=>{const y=Array.from(f);return y.includes(m)||y.includes(ln(m))},h)}function d(m){return u(1,m)}function u(m=1,h){let f=-1;return o(()=>(f+=1,f>=m),h)}return Array.isArray(ln(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return pl(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return pl(e,!n)}}}function hl(e){return pl(e)}function $_(e){var n;const o=ln(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Nu=N_?window:void 0;function wu(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=Nu):[n,o,i,a]=e,!n)return C_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,h,f)=>(u.addEventListener(m,h,f),()=>u.removeEventListener(m,h,f)),c=t.watch(()=>[$_(n),ln(a)],([u,m])=>{if(l(),!u)return;const h=v_(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(y=>s(u,f,y,h))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return oi(d),d}function T_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Iu(...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=Nu,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=T_(n);return wu(a,r,u=>{u.repeat&&ln(s)||c(u)&&o(u)},l)}function M_(e){return JSON.parse(JSON.stringify(e))}function yl(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,f=t.getCurrentInstance(),y=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let g=d;n||(n="modelValue"),g=g||`update:${n.toString()}`;const _=p=>s?typeof s=="function"?s(p):M_(p):p,E=()=>w_(e[n])?_(e[n]):m,N=p=>{h?h(p)&&y(g,p):y(g,p)};if(c){const p=E(),k=t.ref(p);let I=!1;return t.watch(()=>e[n],A=>{I||(I=!0,k.value=_(A),t.nextTick(()=>I=!1))}),t.watch(k,A=>{!I&&(A!==e[n]||u)&&N(A)},{deep:u}),k}else return t.computed({get(){return E()},set(p){N(p)}})}var V_={value:()=>{}};function fa(){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 pa(o)}function pa(e){this._=e}function B_(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}})}pa.prototype=fa.prototype={constructor:pa,on:function(e,n){var o=this._,i=B_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=D_(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]=vu(o[a],e.name,n);else if(n==null)for(a in o)o[a]=vu(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 pa(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 D_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function vu(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=V_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var gl="http://www.w3.org/1999/xhtml";const Cu={svg:"http://www.w3.org/2000/svg",xhtml:gl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ha(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Cu.hasOwnProperty(n)?{space:Cu[n],local:e}:e}function O_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===gl&&n.documentElement.namespaceURI===gl?n.createElement(e):n.createElementNS(o,e)}}function L_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function xu(e){var n=ha(e);return(n.local?L_:O_)(n)}function P_(){}function bl(e){return e==null?P_:function(){return this.querySelector(e)}}function z_(e){typeof e!="function"&&(e=bl(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 xt(i,this._parents)}function F_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function U_(){return[]}function Su(e){return e==null?U_:function(){return this.querySelectorAll(e)}}function H_(e){return function(){return F_(e.apply(this,arguments))}}function j_(e){typeof e=="function"?e=H_(e):e=Su(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 xt(i,a)}function Ru(e){return function(){return this.matches(e)}}function Au(e){return function(n){return n.matches(e)}}var K_=Array.prototype.find;function G_(e){return function(){return K_.call(this.children,e)}}function Y_(){return this.firstElementChild}function q_(e){return this.select(e==null?Y_:G_(typeof e=="function"?e:Au(e)))}var W_=Array.prototype.filter;function J_(){return Array.from(this.children)}function X_(e){return function(){return W_.call(this.children,e)}}function Z_(e){return this.selectAll(e==null?J_:X_(typeof e=="function"?e:Au(e)))}function Q_(e){typeof e!="function"&&(e=Ru(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 xt(i,this._parents)}function $u(e){return new Array(e.length)}function ek(){return new xt(this._enter||this._groups.map($u),this._parents)}function ya(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ya.prototype={constructor:ya,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 tk(e){return function(){return e}}function nk(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 ya(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function ok(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(h[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new ya(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function ik(e){return e.__data__}function ak(e,n){if(!arguments.length)return Array.from(this,ik);var o=n?ok:nk,i=this._parents,a=this._groups;typeof e!="function"&&(e=tk(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,f=rk(e.call(u,u&&u.__data__,d,i)),y=f.length,g=s[d]=new Array(y),_=l[d]=new Array(y),E=c[d]=new Array(h);o(u,m,g,_,E,f,n);for(var N=0,p=0,k,I;N<y;++N)if(k=g[N]){for(N>=p&&(p=N+1);!(I=_[p])&&++p<y;);k._next=I||null}}return l=new xt(l,i),l._enter=s,l._exit=c,l}function rk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lk(){return new xt(this._exit||this._groups.map($u),this._parents)}function sk(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 ck(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),f,y=0;y<m;++y)(f=d[y]||u[y])&&(h[y]=f);for(;c<a;++c)s[c]=o[c];return new xt(s,this._parents)}function dk(){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 uk(e){e||(e=mk);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 xt(a,this._parents).order()}function mk(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function fk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pk(){return Array.from(this)}function hk(){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 yk(){let e=0;for(const n of this)++e;return e}function gk(){return!this.node()}function bk(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 _k(e){return function(){this.removeAttribute(e)}}function kk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ek(e,n){return function(){this.setAttribute(e,n)}}function Nk(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function wk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Ik(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 vk(e,n){var o=ha(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?kk:_k:typeof n=="function"?o.local?Ik:wk:o.local?Nk:Ek)(o,n))}function Tu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ck(e){return function(){this.style.removeProperty(e)}}function xk(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Sk(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?Ck:typeof n=="function"?Sk:xk)(e,n,o??"")):vo(this.node(),e)}function vo(e,n){return e.style.getPropertyValue(n)||Tu(e).getComputedStyle(e,null).getPropertyValue(n)}function Ak(e){return function(){delete this[e]}}function $k(e,n){return function(){this[e]=n}}function Tk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Mk(e,n){return arguments.length>1?this.each((n==null?Ak:typeof n=="function"?Tk:$k)(e,n)):this.node()[e]}function Mu(e){return e.trim().split(/^|\s+/)}function _l(e){return e.classList||new Vu(e)}function Vu(e){this._node=e,this._names=Mu(e.getAttribute("class")||"")}Vu.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 Bu(e,n){for(var o=_l(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Du(e,n){for(var o=_l(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function Vk(e){return function(){Bu(this,e)}}function Bk(e){return function(){Du(this,e)}}function Dk(e,n){return function(){(n.apply(this,arguments)?Bu:Du)(this,e)}}function Ok(e,n){var o=Mu(e+"");if(arguments.length<2){for(var i=_l(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Dk:n?Vk:Bk)(o,n))}function Lk(){this.textContent=""}function Pk(e){return function(){this.textContent=e}}function zk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Fk(e){return arguments.length?this.each(e==null?Lk:(typeof e=="function"?zk:Pk)(e)):this.node().textContent}function Uk(){this.innerHTML=""}function Hk(e){return function(){this.innerHTML=e}}function jk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Kk(e){return arguments.length?this.each(e==null?Uk:(typeof e=="function"?jk:Hk)(e)):this.node().innerHTML}function Gk(){this.nextSibling&&this.parentNode.appendChild(this)}function Yk(){return this.each(Gk)}function qk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Wk(){return this.each(qk)}function Jk(e){var n=typeof e=="function"?e:xu(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Xk(){return null}function Zk(e,n){var o=typeof e=="function"?e:xu(e),i=n==null?Xk:typeof n=="function"?n:bl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function Qk(){var e=this.parentNode;e&&e.removeChild(this)}function eE(){return this.each(Qk)}function tE(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function nE(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function oE(e){return this.select(e?nE:tE)}function iE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function aE(e){return function(n){e.call(this,n,this.__data__)}}function rE(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 lE(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 sE(e,n,o){return function(){var i=this.__on,a,r=aE(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 cE(e,n,o){var i=rE(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?sE:lE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Ou(e,n,o){var i=Tu(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 dE(e,n){return function(){return Ou(this,e,n)}}function uE(e,n){return function(){return Ou(this,e,n.apply(this,arguments))}}function mE(e,n){return this.each((typeof n=="function"?uE:dE)(e,n))}function*fE(){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 Lu=[null];function xt(e,n){this._groups=e,this._parents=n}function ii(){return new xt([[document.documentElement]],Lu)}function pE(){return this}xt.prototype=ii.prototype={constructor:xt,select:z_,selectAll:j_,selectChild:q_,selectChildren:Z_,filter:Q_,data:ak,enter:ek,exit:lk,join:sk,merge:ck,selection:pE,order:dk,sort:uk,call:fk,nodes:pk,node:hk,size:yk,empty:gk,each:bk,attr:vk,style:Rk,property:Mk,classed:Ok,text:Fk,html:Kk,raise:Yk,lower:Wk,append:Jk,insert:Zk,remove:eE,clone:oE,datum:iE,on:cE,dispatch:mE,[Symbol.iterator]:fE};function Mt(e){return typeof e=="string"?new xt([[document.querySelector(e)]],[document.documentElement]):new xt([[e]],Lu)}function hE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Yt(e,n){if(e=hE(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 yE={passive:!1},ai={capture:!0,passive:!1};function kl(e){e.stopImmediatePropagation()}function Co(e){e.preventDefault(),e.stopImmediatePropagation()}function Pu(e){var n=e.document.documentElement,o=Mt(e).on("dragstart.drag",Co,ai);"onselectstart"in n?o.on("selectstart.drag",Co,ai):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function zu(e,n){var o=e.document.documentElement,i=Mt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Co,ai),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 ga=e=>()=>e;function El(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}})}El.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function gE(e){return!e.ctrlKey&&!e.button}function bE(){return this.parentNode}function _E(e,n){return n??{x:e.x,y:e.y}}function kE(){return navigator.maxTouchPoints||"ontouchstart"in this}function EE(){var e=gE,n=bE,o=_E,i=kE,a={},r=fa("start","drag","end"),l=0,s,c,d,u,m=0;function h(k){k.on("mousedown.drag",f).filter(i).on("touchstart.drag",_).on("touchmove.drag",E,yE).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(k,I){if(!(u||!e.call(this,k,I))){var A=p(this,n.call(this,k,I),k,I,"mouse");A&&(Mt(k.view).on("mousemove.drag",y,ai).on("mouseup.drag",g,ai),Pu(k.view),kl(k),d=!1,s=k.clientX,c=k.clientY,A("start",k))}}function y(k){if(Co(k),!d){var I=k.clientX-s,A=k.clientY-c;d=I*I+A*A>m}a.mouse("drag",k)}function g(k){Mt(k.view).on("mousemove.drag mouseup.drag",null),zu(k.view,d),Co(k),a.mouse("end",k)}function _(k,I){if(e.call(this,k,I)){var A=k.changedTouches,$=n.call(this,k,I),L=A.length,V,S;for(V=0;V<L;++V)(S=p(this,$,k,I,A[V].identifier,A[V]))&&(kl(k),S("start",k,A[V]))}}function E(k){var I=k.changedTouches,A=I.length,$,L;for($=0;$<A;++$)(L=a[I[$].identifier])&&(Co(k),L("drag",k,I[$]))}function N(k){var I=k.changedTouches,A=I.length,$,L;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),$=0;$<A;++$)(L=a[I[$].identifier])&&(kl(k),L("end",k,I[$]))}function p(k,I,A,$,L,V){var S=r.copy(),x=Yt(V||A,I),T,D,b;if((b=o.call(k,new El("beforestart",{sourceEvent:A,target:h,identifier:L,active:l,x:x[0],y:x[1],dx:0,dy:0,dispatch:S}),$))!=null)return T=b.x-x[0]||0,D=b.y-x[1]||0,function w(v,O,M){var z=x,j;switch(v){case"start":a[L]=w,j=l++;break;case"end":delete a[L],--l;case"drag":x=Yt(M||O,I),j=l;break}S.call(v,k,new El(v,{sourceEvent:O,subject:b,target:h,identifier:L,active:j,x:x[0]+T,y:x[1]+D,dx:x[0]-z[0],dy:x[1]-z[1],dispatch:S}),$)}}return h.filter=function(k){return arguments.length?(e=typeof k=="function"?k:ga(!!k),h):e},h.container=function(k){return arguments.length?(n=typeof k=="function"?k:ga(k),h):n},h.subject=function(k){return arguments.length?(o=typeof k=="function"?k:ga(k),h):o},h.touchable=function(k){return arguments.length?(i=typeof k=="function"?k:ga(!!k),h):i},h.on=function(){var k=r.on.apply(r,arguments);return k===r?h:k},h.clickDistance=function(k){return arguments.length?(m=(k=+k)*k,h):Math.sqrt(m)},h}function Nl(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Fu(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function ri(){}var li=.7,ba=1/li,xo="\\s*([+-]?\\d+)\\s*",si="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",NE=/^#([0-9a-f]{3,8})$/,wE=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),IE=new RegExp(`^rgb\\(${qt},${qt},${qt}\\)$`),vE=new RegExp(`^rgba\\(${xo},${xo},${xo},${si}\\)$`),CE=new RegExp(`^rgba\\(${qt},${qt},${qt},${si}\\)$`),xE=new RegExp(`^hsl\\(${si},${qt},${qt}\\)$`),SE=new RegExp(`^hsla\\(${si},${qt},${qt},${si}\\)$`),Uu={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};Nl(ri,jn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Hu,formatHex:Hu,formatHex8:RE,formatHsl:AE,formatRgb:ju,toString:ju});function Hu(){return this.rgb().formatHex()}function RE(){return this.rgb().formatHex8()}function AE(){return Wu(this).formatHsl()}function ju(){return this.rgb().formatRgb()}function jn(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=NE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Ku(n):o===3?new wt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?_a(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?_a(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=wE.exec(e))?new wt(n[1],n[2],n[3],1):(n=IE.exec(e))?new wt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=vE.exec(e))?_a(n[1],n[2],n[3],n[4]):(n=CE.exec(e))?_a(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=xE.exec(e))?qu(n[1],n[2]/100,n[3]/100,1):(n=SE.exec(e))?qu(n[1],n[2]/100,n[3]/100,n[4]):Uu.hasOwnProperty(e)?Ku(Uu[e]):e==="transparent"?new wt(NaN,NaN,NaN,0):null}function Ku(e){return new wt(e>>16&255,e>>8&255,e&255,1)}function _a(e,n,o,i){return i<=0&&(e=n=o=NaN),new wt(e,n,o,i)}function $E(e){return e instanceof ri||(e=jn(e)),e?(e=e.rgb(),new wt(e.r,e.g,e.b,e.opacity)):new wt}function wl(e,n,o,i){return arguments.length===1?$E(e):new wt(e,n,o,i??1)}function wt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}Nl(wt,wl,Fu(ri,{brighter(e){return e=e==null?ba:Math.pow(ba,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?li:Math.pow(li,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wt(Kn(this.r),Kn(this.g),Kn(this.b),ka(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:Gu,formatHex:Gu,formatHex8:TE,formatRgb:Yu,toString:Yu}));function Gu(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}`}function TE(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}${Gn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Yu(){const e=ka(this.opacity);return`${e===1?"rgb(":"rgba("}${Kn(this.r)}, ${Kn(this.g)}, ${Kn(this.b)}${e===1?")":`, ${e})`}`}function ka(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Kn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gn(e){return e=Kn(e),(e<16?"0":"")+e.toString(16)}function qu(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Vt(e,n,o,i)}function Wu(e){if(e instanceof Vt)return new Vt(e.h,e.s,e.l,e.opacity);if(e instanceof ri||(e=jn(e)),!e)return new Vt;if(e instanceof Vt)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 Vt(l,s,c,e.opacity)}function ME(e,n,o,i){return arguments.length===1?Wu(e):new Vt(e,n,o,i??1)}function Vt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}Nl(Vt,ME,Fu(ri,{brighter(e){return e=e==null?ba:Math.pow(ba,e),new Vt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?li:Math.pow(li,e),new Vt(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 wt(Il(e>=240?e-240:e+120,a,i),Il(e,a,i),Il(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Vt(Ju(this.h),Ea(this.s),Ea(this.l),ka(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=ka(this.opacity);return`${e===1?"hsl(":"hsla("}${Ju(this.h)}, ${Ea(this.s)*100}%, ${Ea(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ju(e){return e=(e||0)%360,e<0?e+360:e}function Ea(e){return Math.max(0,Math.min(1,e||0))}function Il(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 vl=e=>()=>e;function VE(e,n){return function(o){return e+o*n}}function BE(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 DE(e){return(e=+e)==1?Xu:function(n,o){return o-n?BE(n,o,e):vl(isNaN(n)?o:n)}}function Xu(e,n){var o=n-e;return o?VE(e,o):vl(isNaN(e)?n:e)}const Na=(function e(n){var o=DE(n);function i(a,r){var l=o((a=wl(a)).r,(r=wl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Xu(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 OE(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 LE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function PE(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]=ci(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 zE(e,n){var o=new Date;return e=+e,n=+n,function(i){return o.setTime(e*(1-i)+n*i),o}}function Wt(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function FE(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]=ci(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Cl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xl=new RegExp(Cl.source,"g");function UE(e){return function(){return e}}function HE(e){return function(n){return e(n)+""}}function Zu(e,n){var o=Cl.lastIndex=xl.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Cl.exec(e))&&(a=xl.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:Wt(i,a)})),o=xl.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?HE(c[0].x):UE(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 ci(e,n){var o=typeof n,i;return n==null||o==="boolean"?vl(n):(o==="number"?Wt:o==="string"?(i=jn(n))?(n=i,Na):Zu:n instanceof jn?Na:n instanceof Date?zE:LE(n)?OE:Array.isArray(n)?PE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?FE:Wt)(e,n)}var Qu=180/Math.PI,Sl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function em(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)*Qu,skewX:Math.atan(c)*Qu,scaleX:l,scaleY:s}}var wa;function jE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Sl:em(n.a,n.b,n.c,n.d,n.e,n.f)}function KE(e){return e==null||(wa||(wa=document.createElementNS("http://www.w3.org/2000/svg","g")),wa.setAttribute("transform",e),!(e=wa.transform.baseVal.consolidate()))?Sl:(e=e.matrix,em(e.a,e.b,e.c,e.d,e.e,e.f))}function tm(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,f,y){if(d!==m||u!==h){var g=f.push("translate(",null,n,null,o);y.push({i:g-4,x:Wt(d,m)},{i:g-2,x:Wt(u,h)})}else(m||h)&&f.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:Wt(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:Wt(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,f,y){if(d!==m||u!==h){var g=f.push(a(f)+"scale(",null,",",null,")");y.push({i:g-4,x:Wt(d,m)},{i:g-2,x:Wt(u,h)})}else(m!==1||h!==1)&&f.push(a(f)+"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(f){for(var y=-1,g=h.length,_;++y<g;)m[(_=h[y]).i]=_.x(f);return m.join("")}}}var GE=tm(jE,"px, ","px)","deg)"),YE=tm(KE,", ",")",")"),qE=1e-12;function nm(e){return((e=Math.exp(e))+1/e)/2}function WE(e){return((e=Math.exp(e))-1/e)/2}function JE(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ia=(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],f=u-s,y=m-c,g=f*f+y*y,_,E;if(g<qE)E=Math.log(h/d)/n,_=function($){return[s+$*f,c+$*y,d*Math.exp(n*$*E)]};else{var N=Math.sqrt(g),p=(h*h-d*d+i*g)/(2*d*o*N),k=(h*h-d*d-i*g)/(2*h*o*N),I=Math.log(Math.sqrt(p*p+1)-p),A=Math.log(Math.sqrt(k*k+1)-k);E=(A-I)/n,_=function($){var L=$*E,V=nm(I),S=d/(o*N)*(V*JE(n*L+I)-WE(I));return[s+S*f,c+S*y,d*V/nm(n*L+I)]}}return _.duration=E*1e3*n/Math.SQRT2,_}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 So=0,di=0,ui=0,om=1e3,va,mi,Ca=0,Yn=0,xa=0,fi=typeof performance=="object"&&performance.now?performance:Date,im=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Rl(){return Yn||(im(XE),Yn=fi.now()+xa)}function XE(){Yn=0}function Sa(){this._call=this._time=this._next=null}Sa.prototype=am.prototype={constructor:Sa,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Rl():+o)+(n==null?0:+n),!this._next&&mi!==this&&(mi?mi._next=this:va=this,mi=this),this._call=e,this._time=o,Al()},stop:function(){this._call&&(this._call=null,this._time=1/0,Al())}};function am(e,n,o){var i=new Sa;return i.restart(e,n,o),i}function ZE(){Rl(),++So;for(var e=va,n;e;)(n=Yn-e._time)>=0&&e._call.call(void 0,n),e=e._next;--So}function rm(){Yn=(Ca=fi.now())+xa,So=di=0;try{ZE()}finally{So=0,e1(),Yn=0}}function QE(){var e=fi.now(),n=e-Ca;n>om&&(xa-=n,Ca=e)}function e1(){for(var e,n=va,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:va=o);mi=e,Al(i)}function Al(e){if(!So){di&&(di=clearTimeout(di));var n=e-Yn;n>24?(e<1/0&&(di=setTimeout(rm,e-fi.now()-xa)),ui&&(ui=clearInterval(ui))):(ui||(Ca=fi.now(),ui=setInterval(QE,om)),So=1,im(rm))}}function lm(e,n,o){var i=new Sa;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var t1=fa("start","end","cancel","interrupt"),n1=[],sm=0,cm=1,$l=2,Ra=3,dm=4,Tl=5,Aa=6;function $a(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;o1(e,o,{name:n,index:i,group:a,on:t1,tween:n1,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:sm})}function Ml(e,n){var o=Bt(e,n);if(o.state>sm)throw new Error("too late; already scheduled");return o}function Jt(e,n){var o=Bt(e,n);if(o.state>Ra)throw new Error("too late; already running");return o}function Bt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function o1(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=am(r,0,o.time);function r(d){o.state=cm,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,f;if(o.state!==cm)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Ra)return lm(l);f.state===dm?(f.state=Aa,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Aa,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(lm(function(){o.state===Ra&&(o.state=dm,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=$l,o.on.call("start",e,e.__data__,o.index,o.group),o.state===$l){for(o.state=Ra,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);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=Tl,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Tl&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Aa,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Ta(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>$l&&i.state<Tl,i.state=Aa,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function i1(e){return this.each(function(){Ta(this,e)})}function a1(e,n){var o,i;return function(){var a=Jt(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 r1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=Jt(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 l1(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Bt(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?a1:r1)(o,e,n))}function Vl(e,n,o){var i=e._id;return e.each(function(){var a=Jt(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Bt(a,i).value[n]}}function um(e,n){var o;return(typeof n=="number"?Wt:n instanceof jn?Na:(o=jn(n))?(n=o,Na):Zu)(e,n)}function s1(e){return function(){this.removeAttribute(e)}}function c1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function d1(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 u1(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 m1(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 f1(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 p1(e,n){var o=ha(e),i=o==="transform"?YE:um;return this.attrTween(e,typeof n=="function"?(o.local?f1:m1)(o,i,Vl(this,"attr."+e,n)):n==null?(o.local?c1:s1)(o):(o.local?u1:d1)(o,i,n))}function h1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function y1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function g1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&y1(e,r)),o}return a._value=n,a}function b1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&h1(e,r)),o}return a._value=n,a}function _1(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=ha(e);return this.tween(o,(i.local?g1:b1)(i,n))}function k1(e,n){return function(){Ml(this,e).delay=+n.apply(this,arguments)}}function E1(e,n){return n=+n,function(){Ml(this,e).delay=n}}function N1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?k1:E1)(n,e)):Bt(this.node(),n).delay}function w1(e,n){return function(){Jt(this,e).duration=+n.apply(this,arguments)}}function I1(e,n){return n=+n,function(){Jt(this,e).duration=n}}function v1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?w1:I1)(n,e)):Bt(this.node(),n).duration}function C1(e,n){if(typeof n!="function")throw new Error;return function(){Jt(this,e).ease=n}}function x1(e){var n=this._id;return arguments.length?this.each(C1(n,e)):Bt(this.node(),n).ease}function S1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Jt(this,e).ease=o}}function R1(e){if(typeof e!="function")throw new Error;return this.each(S1(this._id,e))}function A1(e){typeof e!="function"&&(e=Ru(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 sn(i,this._parents,this._name,this._id)}function $1(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,f=0;f<u;++f)(h=c[f]||d[f])&&(m[f]=h);for(;s<i;++s)l[s]=n[s];return new sn(l,this._parents,this._name,this._id)}function T1(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 M1(e,n,o){var i,a,r=T1(n)?Ml:Jt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function V1(e,n){var o=this._id;return arguments.length<2?Bt(this.node(),o).on.on(e):this.each(M1(o,e,n))}function B1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function D1(){return this.on("end.remove",B1(this._id))}function O1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=bl(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,$a(d[h],n,o,h,d,Bt(u,o)));return new sn(r,this._parents,n,o)}function L1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Su(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),f,y=Bt(u,o),g=0,_=h.length;g<_;++g)(f=h[g])&&$a(f,n,o,g,h,y);r.push(h),l.push(u)}return new sn(r,l,n,o)}var P1=ii.prototype.constructor;function z1(){return new P1(this._groups,this._parents)}function F1(e,n){var o,i,a;return function(){var r=vo(this,e),l=(this.style.removeProperty(e),vo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function mm(e){return function(){this.style.removeProperty(e)}}function U1(e,n,o){var i,a=o+"",r;return function(){var l=vo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function H1(e,n,o){var i,a,r;return function(){var l=vo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),vo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function j1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=Jt(this,e),d=c.on,u=c.value[r]==null?s||(s=mm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function K1(e,n,o){var i=(e+="")=="transform"?GE:um;return n==null?this.styleTween(e,F1(e,i)).on("end.style."+e,mm(e)):typeof n=="function"?this.styleTween(e,H1(e,i,Vl(this,"style."+e,n))).each(j1(this._id,e)):this.styleTween(e,U1(e,i,n),o).on("end.style."+e,null)}function G1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function Y1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&G1(e,l,o)),i}return r._value=n,r}function q1(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,Y1(e,n,o??""))}function W1(e){return function(){this.textContent=e}}function J1(e){return function(){var n=e(this);this.textContent=n??""}}function X1(e){return this.tween("text",typeof e=="function"?J1(Vl(this,"text",e)):W1(e==null?"":e+""))}function Z1(e){return function(n){this.textContent=e.call(this,n)}}function Q1(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&Z1(a)),n}return i._value=e,i}function e0(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,Q1(e))}function t0(){for(var e=this._name,n=this._id,o=fm(),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=Bt(c,n);$a(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new sn(i,this._parents,e,o)}function n0(){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=Jt(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 o0=0;function sn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function fm(){return++o0}var cn=ii.prototype;sn.prototype={constructor:sn,select:O1,selectAll:L1,selectChild:cn.selectChild,selectChildren:cn.selectChildren,filter:A1,merge:$1,selection:z1,transition:t0,call:cn.call,nodes:cn.nodes,node:cn.node,size:cn.size,empty:cn.empty,each:cn.each,on:V1,attr:p1,attrTween:_1,style:K1,styleTween:q1,text:X1,textTween:e0,remove:D1,tween:l1,delay:N1,duration:v1,ease:x1,easeVarying:R1,end:n0,[Symbol.iterator]:cn[Symbol.iterator]};function i0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var a0={time:null,delay:0,duration:250,ease:i0};function r0(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 l0(e){var n,o;e instanceof sn?(n=e._id,e=e._name):(n=fm(),(o=a0).time=Rl(),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])&&$a(c,e,n,d,l,o||r0(c,n));return new sn(i,this._parents,e,n)}ii.prototype.interrupt=i1,ii.prototype.transition=l0;const Ma=e=>()=>e;function s0(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 dn(e,n,o){this.k=e,this.x=n,this.y=o}dn.prototype={constructor:dn,scale:function(e){return e===1?this:new dn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new dn(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 Ro=new dn(1,0,0);dn.prototype;function Bl(e){e.stopImmediatePropagation()}function pi(e){e.preventDefault(),e.stopImmediatePropagation()}function c0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function d0(){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 pm(){return this.__zoom||Ro}function u0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function m0(){return navigator.maxTouchPoints||"ontouchstart"in this}function f0(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 p0(){var e=c0,n=d0,o=f0,i=u0,a=m0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Ia,d=fa("start","zoom","end"),u,m,h,f=500,y=150,g=0,_=10;function E(b){b.property("__zoom",pm).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",V).on("dblclick.zoom",S).filter(a).on("touchstart.zoom",x).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(b,w,v,O){var M=b.selection?b.selection():b;M.property("__zoom",pm),b!==M?I(b,w,v,O):M.interrupt().each(function(){A(this,arguments).event(O).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},E.scaleBy=function(b,w,v,O){E.scaleTo(b,function(){var M=this.__zoom.k,z=typeof w=="function"?w.apply(this,arguments):w;return M*z},v,O)},E.scaleTo=function(b,w,v,O){E.transform(b,function(){var M=n.apply(this,arguments),z=this.__zoom,j=v==null?k(M):typeof v=="function"?v.apply(this,arguments):v,ie=z.invert(j),pe=typeof w=="function"?w.apply(this,arguments):w;return o(p(N(z,pe),j,ie),M,l)},v,O)},E.translateBy=function(b,w,v,O){E.transform(b,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,O)},E.translateTo=function(b,w,v,O,M){E.transform(b,function(){var z=n.apply(this,arguments),j=this.__zoom,ie=O==null?k(z):typeof O=="function"?O.apply(this,arguments):O;return o(Ro.translate(ie[0],ie[1]).scale(j.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),z,l)},O,M)};function N(b,w){return w=Math.max(r[0],Math.min(r[1],w)),w===b.k?b:new dn(w,b.x,b.y)}function p(b,w,v){var O=w[0]-v[0]*b.k,M=w[1]-v[1]*b.k;return O===b.x&&M===b.y?b:new dn(b.k,O,M)}function k(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function I(b,w,v,O){b.on("start.zoom",function(){A(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(O).end()}).tween("zoom",function(){var M=this,z=arguments,j=A(M,z).event(O),ie=n.apply(M,z),pe=v==null?k(ie):typeof v=="function"?v.apply(M,z):v,ye=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),ge=M.__zoom,me=typeof w=="function"?w.apply(M,z):w,se=c(ge.invert(pe).concat(ye/ge.k),me.invert(pe).concat(ye/me.k));return function(ke){if(ke===1)ke=me;else{var Se=se(ke),ce=ye/Se[2];ke=new dn(ce,pe[0]-Se[0]*ce,pe[1]-Se[1]*ce)}j.zoom(null,ke)}})}function A(b,w,v){return!v&&b.__zooming||new $(b,w)}function $(b,w){this.that=b,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(b,w),this.taps=0}$.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,w){return this.mouse&&b!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&b!=="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(b){var w=Mt(this.that).datum();d.call(b,this.that,new s0(b,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),w)}};function L(b,...w){if(!e.apply(this,arguments))return;var v=A(this,w).event(b),O=this.__zoom,M=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),z=Yt(b);if(v.wheel)(v.mouse[0][0]!==z[0]||v.mouse[0][1]!==z[1])&&(v.mouse[1]=O.invert(v.mouse[0]=z)),clearTimeout(v.wheel);else{if(O.k===M)return;v.mouse=[z,O.invert(z)],Ta(this),v.start()}pi(b),v.wheel=setTimeout(j,y),v.zoom("mouse",o(p(N(O,M),v.mouse[0],v.mouse[1]),v.extent,l));function j(){v.wheel=null,v.end()}}function V(b,...w){if(h||!e.apply(this,arguments))return;var v=b.currentTarget,O=A(this,w,!0).event(b),M=Mt(b.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ye,!0),z=Yt(b,v),j=b.clientX,ie=b.clientY;Pu(b.view),Bl(b),O.mouse=[z,this.__zoom.invert(z)],Ta(this),O.start();function pe(ge){if(pi(ge),!O.moved){var me=ge.clientX-j,se=ge.clientY-ie;O.moved=me*me+se*se>g}O.event(ge).zoom("mouse",o(p(O.that.__zoom,O.mouse[0]=Yt(ge,v),O.mouse[1]),O.extent,l))}function ye(ge){M.on("mousemove.zoom mouseup.zoom",null),zu(ge.view,O.moved),pi(ge),O.event(ge).end()}}function S(b,...w){if(e.apply(this,arguments)){var v=this.__zoom,O=Yt(b.changedTouches?b.changedTouches[0]:b,this),M=v.invert(O),z=v.k*(b.shiftKey?.5:2),j=o(p(N(v,z),O,M),n.apply(this,w),l);pi(b),s>0?Mt(this).transition().duration(s).call(I,j,O,b):Mt(this).call(E.transform,j,O,b)}}function x(b,...w){if(e.apply(this,arguments)){var v=b.touches,O=v.length,M=A(this,w,b.changedTouches.length===O).event(b),z,j,ie,pe;for(Bl(b),j=0;j<O;++j)ie=v[j],pe=Yt(ie,this),pe=[pe,this.__zoom.invert(pe),ie.identifier],M.touch0?!M.touch1&&M.touch0[2]!==pe[2]&&(M.touch1=pe,M.taps=0):(M.touch0=pe,z=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),z&&(M.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},f)),Ta(this),M.start())}}function T(b,...w){if(this.__zooming){var v=A(this,w).event(b),O=b.changedTouches,M=O.length,z,j,ie,pe;for(pi(b),z=0;z<M;++z)j=O[z],ie=Yt(j,this),v.touch0&&v.touch0[2]===j.identifier?v.touch0[0]=ie:v.touch1&&v.touch1[2]===j.identifier&&(v.touch1[0]=ie);if(j=v.that.__zoom,v.touch1){var ye=v.touch0[0],ge=v.touch0[1],me=v.touch1[0],se=v.touch1[1],ke=(ke=me[0]-ye[0])*ke+(ke=me[1]-ye[1])*ke,Se=(Se=se[0]-ge[0])*Se+(Se=se[1]-ge[1])*Se;j=N(j,Math.sqrt(ke/Se)),ie=[(ye[0]+me[0])/2,(ye[1]+me[1])/2],pe=[(ge[0]+se[0])/2,(ge[1]+se[1])/2]}else if(v.touch0)ie=v.touch0[0],pe=v.touch0[1];else return;v.zoom("touch",o(p(j,ie,pe),v.extent,l))}}function D(b,...w){if(this.__zooming){var v=A(this,w).event(b),O=b.changedTouches,M=O.length,z,j;for(Bl(b),h&&clearTimeout(h),h=setTimeout(function(){h=null},f),z=0;z<M;++z)j=O[z],v.touch0&&v.touch0[2]===j.identifier?delete v.touch0:v.touch1&&v.touch1[2]===j.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(j=Yt(j,this),Math.hypot(m[0]-j[0],m[1]-j[1])<_)){var ie=Mt(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return E.wheelDelta=function(b){return arguments.length?(i=typeof b=="function"?b:Ma(+b),E):i},E.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Ma(!!b),E):e},E.touchable=function(b){return arguments.length?(a=typeof b=="function"?b:Ma(!!b),E):a},E.extent=function(b){return arguments.length?(n=typeof b=="function"?b:Ma([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),E):n},E.scaleExtent=function(b){return arguments.length?(r[0]=+b[0],r[1]=+b[1],E):[r[0],r[1]]},E.translateExtent=function(b){return arguments.length?(l[0][0]=+b[0][0],l[1][0]=+b[1][0],l[0][1]=+b[0][1],l[1][1]=+b[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(b){return arguments.length?(o=b,E):o},E.duration=function(b){return arguments.length?(s=+b,E):s},E.interpolate=function(b){return arguments.length?(c=b,E):c},E.on=function(){var b=d.on.apply(d,arguments);return b===d?E:b},E.clickDistance=function(b){return arguments.length?(g=(b=+b)*b,E):Math.sqrt(g)},E.tapDistance=function(b){return arguments.length?(_=+b,E):_},E}var $e=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))($e||{}),Dl=(e=>(e.Partial="partial",e.Full="full",e))(Dl||{}),qn=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(qn||{}),un=(e=>(e.Strict="strict",e.Loose="loose",e))(un||{}),Ol=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Ol||{}),hi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(hi||{}),hm=(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))(hm||{});const h0=["INPUT","SELECT","TEXTAREA"],y0=typeof document<"u"?document:null;function Ll(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 h0.includes(i==null?void 0:i.nodeName)||a||!!r}function g0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ym(e,n,o,i){const a=n.replace("+",`
|
|
27
|
+
`}}const fa="com.example",Eg="command.domain";function si(e,n,o={}){const i=aa(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??Eg,s=l?`.${l}`:"";return`${a.basePackage}${r}${s}`}return n.packageName||""}const Ng="CustomMoneyType",wg="Money";function Ig(e){return!(e.type!==Ng||e.attrType!=="NORMAL"||e.identifier||e.dbAttrs.length>1)}function vg(e){const n=e.dbAttrs[0]??{modelId:Pe(),physicalName:"",dataType:""},o={modelId:Pe(),physicalName:"",dataType:""},{customType:i,...a}=e;return{...a,type:wg,attrType:"EMBED_PREDEF",dbAttrs:[n,o]}}function Cg(e){let n=!1;const o=e.entities.map(i=>{let a=!1;const r=i.attributes.map(l=>Ig(l)?(a=!0,n=!0,vg(l)):l);return a?{...i,attributes:r}:i});return n?{...e,entities:o}:e}function Sg(e,n){const o=new Map,i=[],a=new Map;for(const y of e.entities){const _=new Map,g=new Map,b=new Map,E=(h,N,w)=>{if(!h)return;o.get(h)||o.set(h,[{entityId:N,assignedId:h}]),i.push({id:h,entityId:N,sink:w}),w(h)};for(const h of y.attributes){E(h.modelId,y.modelId,N=>_.set(h,N));for(const N of h.dbAttrs)E(N.modelId,y.modelId,w=>g.set(N,w))}for(const h of y.indexes??[])E(h.modelId,y.modelId,N=>b.set(h,N));a.set(y,{attrs:_,cols:g,idx:b})}const r=new Set(o.keys()),l=new Map;for(const y of i){const _=(l.get(y.id)??0)+1;if(l.set(y.id,_),_===1)continue;const g=xg(y.id,_-1,r);r.add(g),o.get(y.id).push({entityId:y.entityId,assignedId:g}),y.sink(g)}const s=[...o.values()].reduce((y,_)=>y+Math.max(0,_.length-1),0);if(s===0)return{logical:e,layout:n,reissued:0};const c=(y,_)=>{var b;if(!_||!y)return _;const g=o.get(_);return!g||g.length<2?_:((b=g.find(E=>E.entityId===y))==null?void 0:b.assignedId)??_},d=new Map(e.associations.map(y=>[y.modelId,y])),u=(y,_)=>{const g=d.get(y);if(g)return g.end1.entityRef===_?g.end2.entityRef:g.end1.entityRef},m=e.entities.map(y=>{var h;const _=a.get(y),g=y.attributes.map(N=>{const w=_.attrs.get(N),C=N.dbAttrs.map($=>{const R=_.cols.get($);return R===$.modelId?$:{...$,modelId:R}});let S=N.derivedFrom;if(S){const $=u(S.associationRef,y.modelId),R=c($,S.sourceAttributeRef);R!==S.sourceAttributeRef&&(S={...S,sourceAttributeRef:R})}return w!==N.modelId||S!==N.derivedFrom||C.some(($,R)=>$!==N.dbAttrs[R])?{...N,modelId:w,dbAttrs:C,derivedFrom:S}:N}),b=(h=y.indexes)==null?void 0:h.map(N=>{const w=_.idx.get(N),C=N.columns.map(V=>{const $=c(y.modelId,V.columnRef);return $===V.columnRef?V:{...V,columnRef:$}});return w!==N.modelId||C.some((V,$)=>V!==N.columns[$])?{...N,modelId:w,columns:C}:N});return g.some((N,w)=>N!==y.attributes[w])||b&&y.indexes&&b.some((N,w)=>N!==y.indexes[w])?{...y,attributes:g,...b?{indexes:b}:{}}:y}),p=e.associations.map(y=>{const _=c(y.end1.entityRef,y.end1.attributeRef),g=c(y.end2.entityRef,y.end2.attributeRef);return _===y.end1.attributeRef&&g===y.end2.attributeRef?y:{...y,end1:_===y.end1.attributeRef?y.end1:{...y.end1,attributeRef:_},end2:g===y.end2.attributeRef?y.end2:{...y.end2,attributeRef:g}}}),f=n.associationLayouts.map(y=>{const _=d.get(y.associationRef);if(!_)return y;const g=c(_.end1.entityRef,y.sourceColumnRef),b=c(_.end2.entityRef,y.targetColumnRef);return g===y.sourceColumnRef&&b===y.targetColumnRef?y:{...y,sourceColumnRef:g,targetColumnRef:b}});return{logical:{...e,entities:m,associations:p},layout:f.some((y,_)=>y!==n.associationLayouts[_])?{...n,associationLayouts:f}:n,reissued:s}}function xg(e,n,o){let i=n;for(;;){const a=`dup${i}:${e}`;if(!o.has(a))return a;i++}}function zt(e){return e.reduce((n,o)=>Math.max(n,o.order),-1)+1}function dl(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 ed(e){return!!e.derivedFrom&&e.dbAttrs.length>0}function td(e){for(const n of e){const o=[...n.attributes].sort((s,c)=>s.order-c.order),i=o.filter(ed);if(!i.length)continue;const a=o.filter(s=>!ed(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 nd(e,n,o){var V;const i=o.idFactory??Pe,a=o.offset??{x:0,y:0},{logical:r,layout:l}=e,s=new Set(n);if(o.includeRelated){const $=new Set(n);for(const R of r.associations){const x=$.has(R.end1.entityRef),T=$.has(R.end2.entityRef);x!==T&&s.add(x?R.end2.entityRef:R.end1.entityRef)}}const c=r.entities.filter($=>s.has($.modelId)),d=new Set(c.map($=>$.modelId)),u=r.associations.filter($=>d.has($.end1.entityRef)&&d.has($.end2.entityRef)),m=new Set(u.map($=>$.modelId)),p=new Map,f=$=>{let R=p.get($);return R||(R=i(),p.set($,R)),R};for(const $ of c){f($.modelId);for(const R of $.attributes){f(R.modelId);for(const x of R.dbAttrs)f(x.modelId)}for(const R of $.indexes??[])f(R.modelId);for(const R of $.operations??[])f(R.modelId)}for(const $ of u)f($.modelId);const y=$=>p.get($),_=c.map($=>{const R=$o($);R.modelId=y($.modelId),R.attributes=R.attributes.map(x=>Rg(x,y,m,d));for(const x of R.indexes??[])x.modelId=y(x.modelId),x.columns=x.columns.map(T=>jn(T.columnRef)?T:{...T,columnRef:y(T.columnRef)}).filter(T=>T.columnRef!==void 0);for(const x of R.operations??[])x.modelId=y(x.modelId);return R});td(_);const g=u.map($=>{const R=$o($);return R.modelId=y($.modelId),R.end1=od(R.end1,y),R.end2=od(R.end2,y),R}),b=[];for(const $ of r.groups){const R=$.memberEntityRefs.filter(T=>d.has(T));if(R.length===0)continue;const x=$o($);x.modelId=f($.modelId),x.memberEntityRefs=R.map(T=>y(T)),b.push(x)}const E=o.collisionSuffix??"_imported",h=new Set(o.existing.entities.map($=>$.name)),N=new Set(o.existing.entities.map($=>{var R;return(R=$.table)==null?void 0:R.physicalName}).filter($=>!!$));for(const $ of _)h.has($.name)&&($.name=`${$.name}${E}`),(V=$.table)!=null&&V.physicalName&&N.has($.table.physicalName)&&($.table.physicalName=`${$.table.physicalName}${E}`);const w=[];for(const $ of l.entityLayouts){const R=y($.entityRef);if(!R)continue;const x=$o($);x.entityRef=R,x.geo={...x.geo,location:ul(x.geo.location,a)},x.attributeStyles&&(x.attributeStyles=pa(x.attributeStyles,y)),x.operationStyles&&(x.operationStyles=pa(x.operationStyles,y)),w.push(x)}const C=[];for(const $ of l.associationLayouts){const R=y($.associationRef);if(!R)continue;const x=$o($);x.associationRef=R,x.sourceColumnRef=$.sourceColumnRef?y($.sourceColumnRef):void 0,x.targetColumnRef=$.targetColumnRef?y($.targetColumnRef):void 0,x.waypoints=x.waypoints.map(T=>ul(T,a)),C.push(x)}const S=[];for(const $ of l.groupLayouts){const R=y($.groupRef);if(!R)continue;const x=$o($);x.groupRef=R,x.geo={...x.geo,location:ul(x.geo.location,a)},delete x.memberNoteRefs,S.push(x)}return{logical:{entities:_,associations:g,groups:b},layout:{entityLayouts:w,associationLayouts:C,groupLayouts:S},idMap:p}}function ul(e,n){return{x:e.x+n.x,y:e.y+n.y}}function Rg(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 od(e,n){return{...e,entityRef:n(e.entityRef),attributeRef:e.attributeRef?n(e.attributeRef):void 0}}function pa(e,n){const o={};for(const[i,a]of Object.entries(e)){const r=n(i);r&&(o[r]=a)}return o}function ml(e){if(!("rev"in e))return e;const{rev:n,...o}=e;return o}function Jn(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)=>Jn(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(!Jn(e[i],n[i]))return!1;return!0}return!1}function Xn(e,n,o){const i={},a=new Set([...Object.keys(e),...Object.keys(n)]);for(const r of a)o.has(r)||Jn(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 Ag(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 $g=new Set(["attributes","operations","indexes","rev"]),Tg=new Set(["end1","end2","rev"]),Mg=new Set(["memberEntityRefs","rev"]),id=new Set(["modelId"]),Vg=new Set(["modelId","columns"]),Bg=new Set([]);function Dg(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=Xn(s,c,id);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=Xn(s,c,id);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(!Jn(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=Xn(s,c,Vg);d&&i.push({kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:s.modelId,patch:d})}}function Og(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:ml(l)});for(const{cur:l,tgt:s}of i.common){const c=Xn(l,s,$g);c&&o.push({kind:"entity.update",casUnit:"logical",containerRef:l.modelId,entityRef:l.modelId,patch:c}),Dg(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:ml(l)});for(const{cur:l,tgt:s}of a.common){const c=Xn(l,s,Tg);c&&o.push({kind:"association.update",casUnit:"logical",containerRef:l.modelId,associationRef:l.modelId,patch:c});for(const d of["end1","end2"]){const u=Xn(l[d]??{},s[d]??{},Bg);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:ml(l)});for(const{cur:l,tgt:s}of r.common){const c=Xn(l,s,Mg);c&&o.push({kind:"group.update",casUnit:"logical",containerRef:l.modelId,groupRef:l.modelId,patch:c});const d=Ag(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 ha(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)Jn(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 Lg(e,n,o){ha(e.entityLayouts??[],n.entityLayouts??[],i=>i.entityRef,"entityLayout.add","entityLayout.remove","entityRef",o),ha(e.associationLayouts??[],n.associationLayouts??[],i=>i.associationRef,"associationLayout.add","associationLayout.remove","associationRef",o),ha(e.groupLayouts??[],n.groupLayouts??[],i=>i.groupRef,"groupLayout.add","groupLayout.remove","groupRef",o),ha(e.notes??[],n.notes??[],i=>i.modelId,"note.add","note.remove","noteRef",o)}function Pg(e,n){const o=[];return Og(e.logical,n.logical,o),Lg(e.layout,n.layout,o),o}function zg(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 Fg={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 Ug{constructor(n){ct(this,"out",[]);ct(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({...ci(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({...ci(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({...ci(n),field:a,value:void 0,removed:!0});continue}this.out.push({...ci(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({...ci(n),field:a,value:o,...i?{removed:!0}:{}})}result(){return this.out}}function ci(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 en(e,n,o,i){if(o==null||typeof o!="object")return;const a=Fg[i];for(const[r,l]of Object.entries(o))a.has(r)||e.set(n,r,l)}function Qn(e,n,o){if(!(o==null||typeof o!="object"))for(const[i,a]of Object.entries(o))e.set(n,i,a)}function fl(e,n){if(Array.isArray(e))return e.find(o=>o.modelId===n)}function Tn(e,n){var r,l,s,c,d,u,m,p;const o=zg(n),i=new Ug(n.field),a=[...e].sort((f,y)=>f.seq-y.seq);for(const f of a)for(const y of f.ops)switch(o){case"entity":if(y.entityRef!==n.entityRef)break;y.kind==="entity.add"?en(i,f,y.value,"entity"):y.kind==="entity.update"?Qn(i,f,y.patch):y.kind==="entity.remove"&&i.remove(f);break;case"attribute":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const _=fl((r=y.value)==null?void 0:r.attributes,n.attributeRef);_&&en(i,f,_,"attribute")}else y.kind==="attribute.add"&&((l=y.value)==null?void 0:l.modelId)===n.attributeRef?en(i,f,y.value,"attribute"):y.kind==="attribute.update"&&y.attributeRef===n.attributeRef?Qn(i,f,y.patch):(y.kind==="attribute.remove"&&y.attributeRef===n.attributeRef||y.kind==="entity.remove")&&i.remove(f);break;case"operation":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const _=fl((s=y.value)==null?void 0:s.operations,n.operationRef);_&&en(i,f,_,"operation")}else y.kind==="operation.add"&&((c=y.value)==null?void 0:c.modelId)===n.operationRef?en(i,f,y.value,"operation"):y.kind==="operation.update"&&y.operationRef===n.operationRef?Qn(i,f,y.patch):(y.kind==="operation.remove"&&y.operationRef===n.operationRef||y.kind==="entity.remove")&&i.remove(f);break;case"index":if(y.entityRef!==n.entityRef)break;if(y.kind==="entity.add"){const _=fl((d=y.value)==null?void 0:d.indexes,n.indexRef);_&&en(i,f,_,"index")}else y.kind==="index.add"&&((u=y.value)==null?void 0:u.modelId)===n.indexRef?en(i,f,y.value,"index"):y.kind==="index.update"&&y.indexRef===n.indexRef?Qn(i,f,y.patch):(y.kind==="index.remove"&&y.indexRef===n.indexRef||y.kind==="entity.remove")&&i.remove(f);break;case"association":if(y.associationRef!==n.associationRef)break;y.kind==="association.add"?en(i,f,y.value,"association"):y.kind==="association.update"?Qn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"associationEnd":if(y.associationRef!==n.associationRef)break;if(y.kind==="association.add"){const _=(m=y.value)==null?void 0:m[n.end];en(i,f,_,"associationEnd")}else y.kind==="associationEnd.update"&&y.end===n.end?Qn(i,f,y.patch):y.kind==="association.remove"&&i.remove(f);break;case"group":if(y.groupRef!==n.groupRef)break;if(y.kind==="group.add"){en(i,f,y.value,"group");const _=(p=y.value)==null?void 0:p.memberEntityRefs;if(Array.isArray(_))for(const g of _)i.member(f,g,!1)}else y.kind==="group.update"?Qn(i,f,y.patch):y.kind==="group.remove"?i.remove(f):y.kind==="group.addMember"&&y.entityRef!=null?i.member(f,y.entityRef,!1):y.kind==="group.removeMember"&&y.entityRef!=null&&i.member(f,y.entityRef,!0);break}return i.result()}const at={subject:null,existence:null,fieldAudit:!1,note:"레이아웃 축(LWW) — 감사·복원 diff는 논리 축 전용(AA-5: layout/note는 의도적 범위 밖)"},Hg={"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":at,"entityLayout.remove":at,"entityLayout.move":at,"entityLayout.resize":at,"entityLayout.setCollapsed":at,"entityLayout.setLocked":at,"entityLayout.setStyle":at,"entityLayout.setAttrStyle":at,"entityLayout.setOpStyle":at,"groupLayout.add":at,"groupLayout.remove":at,"groupLayout.move":at,"groupLayout.resize":at,"groupLayout.setLocked":at,"groupLayout.setStyle":at,"groupLayout.addNoteMember":at,"groupLayout.removeNoteMember":at,"associationLayout.add":at,"associationLayout.remove":at,"associationLayout.setWaypoints":at,"note.add":at,"note.remove":at,"note.move":at,"note.resize":at,"note.setMemo":at,"note.setStyle":at,"noteConnection.add":at,"noteConnection.remove":at,"noteConnection.setWaypoints":at},Ft=e=>typeof e=="string"?e:void 0,jg=e=>{var n;return Ft((n=e.value)==null?void 0:n.modelId)};function ad(e){return Ft(e.containerRef)??Ft(e.entityRef)}function pl(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=Ft(s.modelId);c&&r.push({subject:{kind:o,ref:c,...i?{entityRef:i}:{}},existence:"add",inline:!0})}return r}function hl(e){const n=Hg[e.kind];if(!n||!n.subject)return[];const o=e,i=n.existence??void 0;switch(n.subject){case"entity":{const a=Ft(o.entityRef);if(!a)return[];const r={subject:{kind:"entity",ref:a},...i?{existence:i}:{}};return e.kind!=="entity.add"?[r]:[r,...pl(o,"attributes","attribute",a),...pl(o,"operations","operation",a),...pl(o,"indexes","index",a)]}case"attribute":case"operation":case"index":{const a=n.subject,r=ad(o),l={attribute:"attributeRef",operation:"operationRef",index:"indexRef"}[a],s=i==="add"?jg(o):Ft(o[l]);return s?[{subject:{kind:a,ref:s,...r?{entityRef:r}:{}},...i?{existence:i}:{}}]:[]}case"association":case"associationEnd":{const a=Ft(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=Ft(o.groupRef);return a?[{subject:{kind:"group",ref:a},...i?{existence:i}:{}}]:[]}}}function Kg(e){const n=e,o=e.kind;if(o.startsWith("entity.")){const i=Ft(n.entityRef);return i?{kind:"entity",ref:i}:null}if(o.startsWith("attribute.")||o.startsWith("operation.")||o.startsWith("index.")){const i=ad(n);return i?{kind:"entity",ref:i}:null}if(o.startsWith("associationEnd.")||o.startsWith("association.")){const i=Ft(n.associationRef);return i?{kind:"association",ref:i}:null}if(o.startsWith("group.")){const i=Ft(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 Yg(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 hl(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 ya(e,n){return e.map(o=>({...o,subject:n}))}function rd(e,n){const o=e.filter(s=>s.ops.some(c=>Gg(c,n))),{attributes:i,operations:a,indexes:r}=Yg(o,n),l=[...ya(Tn(o,{entityRef:n}),{kind:"entity",ref:n})];for(const s of i)l.push(...ya(Tn(o,{entityRef:n,attributeRef:s}),{kind:"attribute",ref:s}));for(const s of a)l.push(...ya(Tn(o,{entityRef:n,operationRef:s}),{kind:"operation",ref:s}));for(const s of r)l.push(...ya(Tn(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 yl(e){return`${e.kind}:${e.ref}:${e.end??""}`}function qg(e){const n=new Set;for(const o of e)for(const i of o.ops)for(const a of hl(i))a.existence==="add"&&n.add(yl(a.subject));return n}function Wg(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=Kg(l);s&&a[s.kind].add(s.ref)}return{entities:n,associations:o,groups:i}}function Jg(e){const{entities:n,associations:o,groups:i}=Wg(e),a=[];for(const r of n)for(const l of rd(e,r))a.push({...l,subject:{...l.subject,entityRef:r}});for(const r of o){for(const l of Tn(e,{associationRef:r}))a.push({...l,subject:{kind:"association",ref:r}});for(const l of["end1","end2"])for(const s of Tn(e,{associationRef:r,end:l}))a.push({...s,subject:{kind:"associationEnd",ref:r,end:l}})}for(const r of i)for(const l of Tn(e,{groupRef:r}))a.push({...l,subject:{kind:"group",ref:r}});return a}function gl(e){const n=Jg(e),o=qg(e),i=new Map;for(const l of n){const s=yl(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=yl(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 ld(e){return`${e.kind}:${e.ref}:${e.end??""}`}function Xg(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 hl(r)){if(!l.existence||l.inline)continue;const s=l.subject;Zg.has(s.kind)&&!s.entityRef||i.push({seq:a.seq,subject:s,verb:l.existence,fields:[]})}return i}const Zg=new Set(["attribute","operation","index"]);function bl(e,n){const{fromSeq:o}=n,i=gl(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 p=ld(m.subject);let f=s.get(p);f||(f={subject:m.subject,evs:[]},s.set(p,f)),f.evs.push(m)};for(const m of l)for(const p of m.actions)c({seq:m.seq,subject:p.subject,verb:p.verb,fields:p.fields});for(const m of Xg(e,o,r)){const p=s.get(ld(m.subject));p!=null&&p.evs.some(f=>f.seq===m.seq)||c(m)}const d=[],u=new Set;for(const m of s.values()){m.evs.sort((f,y)=>f.seq-y.seq);const p=m.evs[m.evs.length-1];m.subject.kind==="entity"&&p.verb==="remove"&&u.add(m.subject.ref)}for(const m of s.values()){const p=m.evs[0].verb==="add",f=m.evs[m.evs.length-1].verb==="remove";if(m.subject.kind!=="entity"&&m.subject.entityRef&&u.has(m.subject.entityRef)||p&&f)continue;const y=new Map;let _=null;for(const b of m.evs){b.verb==="add"&&_!==null&&_!=="add"&&y.clear(),_=b.verb;for(const E of b.fields){const h=y.get(E.field);h?h.lastValue=E.value:y.set(E.field,{firstOld:E.oldValue,hasOld:E.oldValue!==void 0,lastValue:E.value})}}if(f){d.push({subject:m.subject,verb:"removed",fields:[]});continue}if(p){const b=[];for(const[E,h]of y)b.push({field:E,value:h.lastValue});d.push({subject:m.subject,verb:"added",fields:b});continue}const g=[];for(const[b,E]of y)E.hasOld&&Jn(E.firstOld,E.lastValue)||g.push({field:b,value:E.lastValue,...E.hasOld?{oldValue:E.firstOld}:{}});g.length!==0&&d.push({subject:m.subject,verb:"modified",fields:g})}return{fromSeq:o,toSeq:r,entries:d}}function sd(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 _l{constructor(n){ct(this,"undoStack",[]);ct(this,"redoStack",[]);ct(this,"savePoint",null);ct(this,"listeners",new Set);ct(this,"commandListeners",new Set);ct(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 Mt(e){const n={};for(const[o,i]of Object.entries(e))n[o]=i===void 0?null:i;return n}function cd(e,n){return e.logical.entities.findIndex(o=>o.modelId===n)}function _t(e,n){return e.layout.entityLayouts.findIndex(o=>o.entityRef===n)}function Ut(e,n){return e.layout.associationLayouts.find(o=>o.associationRef===n)}function dt(e,n){const o=e.logical.entities.find(i=>i.modelId===n);if(!o)throw new Error(`엔티티 없음: ${n}`);return o}function yn(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 ga(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=cd(i,e.modelId);a>=0&&i.logical.entities.splice(a,1);const r=_t(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 dd(e){let n=null;const o=i=>i.end1.entityRef===e||i.end2.entityRef===e;return{label:"엔티티 삭제",apply(i){const a=cd(i,e);if(a<0)throw new Error(`엔티티 없음: ${e}`);const r=_t(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(p=>p.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 ud(e,n){const o={};return{label:"엔티티 수정",apply(i){const a=dt(i,e);for(const r of Object.keys(n))o[r]=a[r];Object.assign(a,n)},invert(i){Object.assign(dt(i,e),o)},emitOps(){return{forward:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Mt(n)}],invert:[{kind:"entity.update",casUnit:"logical",containerRef:e,entityRef:e,patch:Mt(o)}]}}}}function md(e,n){let o="";return{label:`엔티티 이름 변경: ${n}`,apply(i){const a=dt(i,e);o=a.name,a.name=n},invert(i){dt(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 To(e,n){let o=null;return{label:"엔티티 이동",apply(i){const a=_t(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=_t(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 fd(e,n){let o=null;return{label:"엔티티 크기 변경",apply(i){const a=_t(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=_t(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 di(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 pd(e,n){let o;return{label:"엔티티 색상 변경",apply(i){const a=_t(i,e);if(a<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const r=i.layout.entityLayouts[a];o=r.style,r.style=di(r.style,n)},invert(i){const a=_t(i,e);a>=0&&(i.layout.entityLayouts[a].style=o)},emitOps(i){const a=_t(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 hd(e,n){let o;return{label:n?"엔티티 접기":"엔티티 펼치기",apply(i){const a=_t(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=_t(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 yd(e,n){let o;return{label:n?"엔티티 잠금":"엔티티 잠금 해제",apply(i){const a=_t(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=_t(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 kl(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 ba(e,n,o){let i;return{label:"속성 색상 변경",apply(a){const r=_t(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.attributeStyles;const s={...l.attributeStyles},c=di(s[n],o);c?s[n]=c:delete s[n],l.attributeStyles=Object.keys(s).length?s:void 0},invert(a){const r=_t(a,e);r>=0&&(a.layout.entityLayouts[r].attributeStyles=i)},emitOps(a){const r=_t(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 _a(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 gd(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:Mt(n)}],invert:[{kind:"group.update",casUnit:"logical",containerRef:e,groupRef:e,patch:Mt(o)}]}}}}function bd(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 _d(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 ka(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 kd(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 Ed(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 Nd(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=di(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 wd(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 tn(e,n){return{label:`속성 추가: ${n.name}`,apply(o){dt(o,e).attributes.push(n)},invert(o){const i=dt(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 nn(e,n,o){const i={},a=r=>{const l=dt(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:Mt(o)}],invert:[{kind:"attribute.update",casUnit:"logical",containerRef:e,entityRef:e,attributeRef:n,patch:Mt(i)}]}}}}function Id(e,n){let o=null;return{label:"속성 삭제",apply(i){const a=dt(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&&dt(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 vd(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 El(e,n,o){let i=null;return{label:"속성 재정렬",apply(a){const r=dt(a,e);i=r.attributes.map(s=>({...s}));const l=dl([...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&&dt(a,e).attributes.splice(0,1/0,...i)},emitOps(a){const r=dt(a,e).attributes;return vd("attribute.update","attributeRef",e,r,i??[])}}}function Cd(e,n){let o=!1;return{label:`메서드 추가: ${n.name}`,apply(i){const a=dt(i,e);a.operations||(a.operations=[],o=!0),a.operations.push(n)},invert(i){var l;const a=dt(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 Sd(e,n,o){const i={},a=r=>{var s;const l=(s=dt(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:Mt(o)}],invert:[{kind:"operation.update",casUnit:"logical",containerRef:e,entityRef:e,operationRef:n,patch:Mt(i)}]}}}}function xd(e,n){let o=null;return{label:"메서드 삭제",apply(i){var s;const a=dt(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=dt(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 Rd(e,n,o){let i=null;return{label:"메서드 재정렬",apply(a){const r=dt(a,e),l=r.operations??[];i=l.map(c=>({...c}));const s=dl([...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=dt(a,e);r.operations&&r.operations.splice(0,1/0,...i)},emitOps(a){const r=dt(a,e).operations??[];return vd("operation.update","operationRef",e,r,i??[])}}}function Ad(e,n,o){let i;return{label:"메서드 색상 변경",apply(a){const r=_t(a,e);if(r<0)throw new Error(`엔티티 레이아웃 없음: ${e}`);const l=a.layout.entityLayouts[r];i=l.operationStyles;const s={...l.operationStyles},c=di(s[n],o);c?s[n]=c:delete s[n],l.operationStyles=Object.keys(s).length?s:void 0},invert(a){const r=_t(a,e);r>=0&&(a.layout.entityLayouts[r].operationStyles=i)},emitOps(a){const r=_t(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 Ea(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 $d(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 Na(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:Mt(n)}],invert:[{kind:"association.update",casUnit:"logical",containerRef:e,associationRef:e,patch:Mt(o)}]}}}}function Ht(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:Mt(o)}],invert:[{kind:"associationEnd.update",casUnit:"logical",containerRef:e,associationRef:e,end:n,patch:Mt(i)}]}}}}function Td(e,n){return{label:"인덱스 추가",apply(o){const i=dt(o,e);(i.indexes??(i.indexes=[])).push(n)},invert(o){var r;const i=dt(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 wa(e,n,o){const i={},a=r=>{var s;const l=(s=dt(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:Mt(o)}],invert:[{kind:"index.update",casUnit:"logical",containerRef:e,entityRef:e,indexRef:n,patch:Mt(i)}]}}}}function Md(e,n){let o=null;return{label:"인덱스 삭제",apply(i){var l;const a=dt(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&&dt(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 on=(e,n)=>({kind:"associationLayout.setWaypoints",casUnit:"layout",associationRef:e,value:{waypoints:n}}),ui=(e,n)=>{var o;return((o=Ut(e,n))==null?void 0:o.waypoints.map(i=>({...i})))??[]};function Vd(e,n,o){let i=null;return{label:"waypoint 이동",coalesceKey:`waypoint:${e}`,apply(a){const r=Ut(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=Ut(a,e);r&&i&&r.waypoints.splice(n,1,i)},emitOps(a){const r=ui(a,e),l=r.map((s,c)=>c===n&&i?{...i}:s);return{forward:[on(e,r)],invert:[on(e,l)]}}}}function Bd(e,n){let o=null;return{label:"waypoint 제거",apply(i){const a=Ut(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=Ut(i,e);a&&o&&a.waypoints.splice(n,0,o)},emitOps(i){const a=ui(i,e),r=a.slice();return o&&r.splice(n,0,{...o}),{forward:[on(e,a)],invert:[on(e,r)]}}}}function Dd(e,n,o){let i=null;return{label:"waypoint 평행이동",apply(a){const r=Ut(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=Ut(a,e);r&&i&&(r.waypoints=i)},emitOps(a){return{forward:[on(e,ui(a,e))],invert:[on(e,i??[])]}}}}function Od(e){let n=null;return{label:"꺾은선 풀기",apply(o){const i=Ut(o,e);if(!i)throw new Error(`관계 레이아웃 없음: ${e}`);n=i.waypoints.map(a=>({...a})),i.waypoints=[]},invert(o){const i=Ut(o,e);i&&n&&(i.waypoints=n)},emitOps(o){return{forward:[on(e,ui(o,e))],invert:[on(e,n??[])]}}}}function Ld(e,n,o){return{label:"waypoint 추가",apply(i){const a=Ut(i,e);if(!a)throw new Error(`관계 레이아웃 없음: ${e}`);a.waypoints.splice(n,0,{...o})},invert(i){const a=Ut(i,e);a==null||a.waypoints.splice(n,1)},emitOps(i){const a=ui(i,e),r=a.slice();return r.splice(n,1),{forward:[on(e,a)],invert:[on(e,r)]}}}}function Pd(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 zd(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 mi(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 Ud(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=di(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 jd(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 Kd(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 Mn=(e,n,o)=>({kind:"noteConnection.setWaypoints",casUnit:"layout",noteRef:e,targetRef:n,value:{waypoints:o}}),Ia=(e,n,o)=>{var i;return((i=yn(e,n,o))==null?void 0:i.waypoints.map(a=>({...a})))??[]};function Gd(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 Yd(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 qd(e,n,o,i){let a=null;return{label:"waypoint 이동",coalesceKey:`noteConnWaypoint:${e}:${n}`,apply(r){const l=yn(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=yn(r,e,n);l&&a&&l.waypoints.splice(o,1,a)},emitOps(r){const l=Ia(r,e,n),s=l.map((c,d)=>d===o&&a?{...a}:c);return{forward:[Mn(e,n,l)],invert:[Mn(e,n,s)]}}}}function Wd(e,n,o,i){return{label:"waypoint 추가",apply(a){const r=yn(a,e,n);if(!r)throw new Error(`노트 연결 없음: ${e}→${n}`);r.waypoints.splice(o,0,{...i})},invert(a){const r=yn(a,e,n);r==null||r.waypoints.splice(o,1)},emitOps(a){const r=Ia(a,e,n),l=r.slice();return l.splice(o,1),{forward:[Mn(e,n,r)],invert:[Mn(e,n,l)]}}}}function Jd(e,n,o){let i=null;return{label:"waypoint 제거",apply(a){const r=yn(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=yn(a,e,n);r&&i&&r.waypoints.splice(o,0,i)},emitOps(a){const r=Ia(a,e,n),l=r.slice();return i&&l.splice(o,0,{...i}),{forward:[Mn(e,n,r)],invert:[Mn(e,n,l)]}}}}function Xd(e,n){let o=null;return{label:"꺾은선 풀기",apply(i){const a=yn(i,e,n);if(!a)throw new Error(`노트 연결 없음: ${e}→${n}`);o=a.waypoints.map(r=>({...r})),a.waypoints=[]},invert(i){const a=yn(i,e,n);a&&o&&(a.waypoints=o)},emitOps(i){return{forward:[Mn(e,n,Ia(i,e,n))],invert:[Mn(e,n,o??[])]}}}}function rt(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 Qg=Object.freeze(Object.defineProperty({__proto__:null,addAssociation:Ea,addAttribute:tn,addEntity:ga,addEntityToGroup:_d,addGroup:_a,addIndex:Td,addNote:Pd,addNoteConnection:Gd,addNoteConnectionWaypoint:Wd,addNoteToGroup:jd,addOperation:Cd,addWaypoint:Ld,clearNoteConnectionWaypoints:Xd,clearWaypoints:Od,composite:rt,moveEntity:To,moveGroup:kd,moveNote:mi,moveNoteConnectionWaypoint:qd,moveWaypoint:Vd,removeAssociation:$d,removeAttribute:Id,removeEntity:dd,removeEntityFromGroup:ka,removeGroup:bd,removeIndex:Md,removeNote:zd,removeNoteConnection:Yd,removeNoteConnectionWaypoint:Jd,removeNoteFromGroup:Kd,removeOperation:xd,removeWaypoint:Bd,renameEntity:md,reorderAttributes:El,reorderOperations:Rd,resizeEntity:fd,resizeGroup:Ed,resizeNote:Fd,setAllEntitiesCollapsed:kl,setAttributeSwatch:ba,setEntityCollapsed:hd,setEntityLocked:yd,setEntitySwatch:pd,setGroupLocked:wd,setGroupSwatch:Nd,setNoteMemo:Ud,setNoteSwatch:Hd,setOperationSwatch:Ad,translateWaypoints:Dd,updateAssociation:Na,updateAssociationEnd:Ht,updateAttribute:nn,updateEntity:ud,updateGroup:gd,updateIndex:wa,updateOperation:Sd},Symbol.toStringTag,{value:"Module"}));class Zd{constructor(){ct(this,"revs",new Map);ct(this,"layoutVersion",0);ct(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 eb=[400,1200];function tb(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 nb(e){const n=tb(e);return n==null||n===408||n===429?!0:n<400||n>=500}const ob=e=>new Promise(n=>setTimeout(n,e));class Qd{constructor(n){ct(this,"cache",new Zd);ct(this,"newClientOpId");ct(this,"debounceMs");ct(this,"retryDelaysMs");ct(this,"emissions",new WeakMap);ct(this,"open",null);ct(this,"debounceHandle",null);ct(this,"queue",[]);ct(this,"sending",!1);ct(this,"_frozen",!1);ct(this,"stack",null);ct(this,"settledWaiters",[]);this.opts=n,this.newClientOpId=n.newClientOpId??Pe,this.debounceMs=n.debounceMs??300,this.retryDelaysMs=n.retryDelaysMs??eb}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||!nb(l)){this.sending=!1,console.error("[op-sync] 전송 실패 확정 → 하드 프리즈(kind:missing)"),this.freeze({kind:"missing"});return}await ob(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 eu=["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"],tu=["NORMAL","RELATION_OWN","RELATION_REF","EMBED_OWN","EMBED_REF","EMBED_PREDEF","DIVIDER"];function nu(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 ib(e){return fn(e).length}function Nl(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 ab(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=ni(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 ou(e,n,o=Pe){const i=e.entities.find(c=>c.modelId===n);if(!i)return[];const a=ib(i);if(a===0)return[];const r=Nl(e,n),l=fn(i).map(c=>c.col),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;ab(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 iu(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=i.attributes;if(o.length!==a.length)return[];const r=new Map(a.map(f=>[f.modelId,f])),l=[];for(const f of o){const y=r.get(f);if(!y)return[];l.push(y)}const s=a.flatMap(f=>f.dbAttrs).map(f=>f.modelId),c=l.flatMap(f=>f.dbAttrs).map(f=>f.modelId);if(s.length!==c.length)return[];if(s.every((f,y)=>f===c[y]))return[];const d=new Map(s.map((f,y)=>[f,y])),u=Nl(e,n),m=[];for(const f of e.entities)for(const y of f.attributes){if(y.attrType!=="EMBED_OWN"||((p=y.embedded)==null?void 0:p.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const _=c.map(b=>y.dbAttrs[d.get(b)]),g=_.reduce((b,E,h)=>E===y.dbAttrs[h]?b:b+1,0);g&&m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:_,moved:g})}return m}function au(e,n,o){var p;const i=e.entities.find(f=>f.modelId===n);if(!i)return[];const a=new Set(o),r=i.attributes.filter(f=>!a.has(f.modelId));if(r.length===i.attributes.length)return[];const l=fn(i).map(f=>f.col),s=l.map(f=>f.modelId),c=new Set(fn({...i,attributes:r}).map(f=>f.col.modelId)),d=new Set;if(s.forEach((f,y)=>{c.has(f)&&d.add(y)}),d.size===s.length)return[];const u=Nl(e,n),m=[];for(const f of e.entities)for(const y of f.attributes){if(y.attrType!=="EMBED_OWN"||((p=y.embedded)==null?void 0:p.embeddableRef)!==n||u.has(y.embedded.associationRef)||y.dbAttrs.length!==s.length)continue;const _=y.dbAttrs.filter((E,h)=>d.has(h)),g=y.dbAttrs.filter((E,h)=>!d.has(h));y.dbAttrs.some((E,h)=>{if(d.has(h))return!1;const N=l[h],w=!!E.physicalName&&E.physicalName!==((N==null?void 0:N.physicalName)??""),C=E.sharedColumnRef!=null&&E.sharedColumnRef!==(N==null?void 0:N.sharedColumnRef);return w||C})||m.push({entityId:f.modelId,attributeId:y.modelId,dbAttrs:_,dropped:g})}return m}function rb(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 lb(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 ru(e,n,o){return e.associations.filter(i=>{const a=[i.end1.entityRef,i.end2.entityRef];return a.includes(n)&&a.includes(o)})}function wt(e,n){const o=rb(e,n);return o.length===1?{ok:!0,value:o[0]}:{ok:!1,reason:o.length===0?"not-found":"ambiguous",matches:o.map(i=>db(i,e))}}function sb(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 wl(e,n){const o=sb(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 Il(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 cb=new Set(["name","description","packageName","excludeDDLGeneration"]);function db(e,n){var a;const o=aa(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(p=>p.modelId===l);return(s==null?void 0:s.name)||((m=s==null?void 0:s.table)==null?void 0:m.physicalName)||String(l??"?")}))]}}function lu(e,n){const o=lb(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 ub(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 mb(e,n){const o=ub(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 su(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 vl(e){return e.by!==void 0&&e.by!=="name"}function fb(e,n){return(e.indexes??[]).filter(o=>o.name===n.ref)}function pb(e,n){return(e.operations??[]).filter(o=>o.name===n.ref)}function hb(e,n){const o=fb(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 cu(e,n){const o=pb(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 du(e){return e.physicalName!=null||e.dataType!=null||e.length!=null||e.scale!=null||e.columnLogicalName!=null||e.unique!=null||e.updatable!=null}function uu(e){return du(e)&&e.dataType==null}function mu(e,n,o){const i=du(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 fu(e,n,o,i,a,r,l,s,c){const d=c(),u=new Map((e.embeddableOverrides??[]).map(f=>[f.field,f])),m=[];let p=!1;for(const f of n.fields){const y=u.get(f.name);if(y!=null&&y.sharedColumnPhysicalName){const _={ref:y.sharedColumnPhysicalName,by:"physicalName"},g=su($n(i,a),_);if(!g.ok){s.push(g.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:_}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:_,matches:g.matches}),p=!0;continue}m.push({modelId:c(),physicalName:"",dataType:"",sharedColumnRef:g.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 p?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 yb=new Set(["name","type","customType","attrType","identifier","notNull","transient","naturalId","naturalIdMutable","description","attributeGroup","groupCode","defaultValue","personalInfoAttributeType","order","dbAttrs","derivedIdFieldName"]),gb=new Set(["name","stereotype","packageName","superClass","schema","description","abstractClass","hasPersonalInfo","declarationOfInterfaces","table","referenceOnly"]),bb=new Set(["description","identifying"]),_b=new Set(["multiplicity","navigable","composition"]),kb=new Set(["name","unique","description","parameters"]),Eb=new Set(["name","visibility","sourceCode","description","order","personalInfoAttributeType"]);function Mo(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 Cl=new Set(["physicalName","logicalName","dataType","length","scale","unique","autoIncrement","updatable","insertable","sharedColumnRef","multiValue","multiValueSeparator","sequenceName"]),Nb=new Set([...Cl].filter(e=>e!=="sharedColumnRef"));function wb(e,n,o,i){if(i||o.some(l=>!Nb.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))Cl.has(l)||(r[l]=s);return{...r,dbAttrs:[a]}}function Ib(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,p)=>{const f=n.fields[p],y=f?c.get(f.name):void 0;if(!y){d.push(m);return}if(y.sharedColumnPhysicalName){const g={ref:y.sharedColumnPhysicalName,by:"physicalName"},b=su($n(i,a),g);if(!b.ok){s.push(b.reason==="not-found"?{code:"shared-column-target-not-found",opIndex:r,entity:l,handle:g}:{code:"shared-column-target-ambiguous",opIndex:r,entity:l,handle:g,matches:b.matches}),u=!0;return}d.push({modelId:m.modelId,physicalName:"",dataType:"",sharedColumnRef:b.value.modelId});return}const _={...m};delete _.sharedColumnRef,d.push({..._,...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 pu(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 hu(e,n,o,i,a,r){const l=[];let s=!1;for(const c of n.columns){const d=mb(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 Vo(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 vb(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 nu(s,l))e.push({kind:"index.update",casUnit:"logical",containerRef:r,entityRef:r,indexRef:c.indexRef,patch:{columns:c.columns}})}}function Cb(e,n,o,i,a,r){const l=m=>{const p=new Map;for(const{entityId:f,item:y}of m){if(a.has(f))continue;const _=p.get(f)??[];_.push(y),p.set(f,_)}return p},s=l(o.pairs.map(m=>({entityId:m.entityId,item:m.attributeId}))),c=l(i.map(m=>({entityId:m.entityId,item:m.attribute}))),d=new Set(e.filter(m=>m.kind==="attribute.update").map(m=>m.attributeRef)),u=m=>{d.has(m.attributeId)||(d.add(m.attributeId),e.push({kind:"attribute.update",casUnit:"logical",containerRef:m.entityId,entityRef:m.entityId,attributeRef:m.attributeId,patch:{dbAttrs:m.dbAttrs}}))};for(const[m,p]of s)if(!c.has(m))for(const f of au(n,m,p))u(f);for(const[m,p]of c){if(s.has(m))continue;const f={...n,entities:n.entities.map(y=>y.modelId===m?{...y,attributes:[...y.attributes,...p]}:y)};for(const y of ou(f,m,r))u(y)}}function Sl(e,n,o,i,a,r){var l;for(const{entityId:s,plan:c}of Oc(n,o,i)){for(const u of c.remove)Vo(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 Sb(e,n,o={}){const i=o.mkId??Pe,a=o.embeddableCatalog??[],r=h=>a.find(N=>N.type===h),l=[],s=[],c=new Map,d=(h,N)=>{const w=c.get(h)??zt(N);return c.set(h,w+1),w},u=new Map,m=new Set,p=new Set,f={seen:new Set,pairs:[]},y=[],_=new Set,g=(h,N)=>`${h}\0${N}`,b=new Set;for(const h of n)h.kind==="entity.add"&&(b.add(h.spec.name),h.spec.physicalName&&b.add(h.spec.physicalName));const E=new Set;return n.forEach((h,N)=>{var w,C,S,V,$;switch(h.kind){case"entity.add":{const R=e.entities.filter(O=>O.name===h.spec.name).map(O=>O.modelId);if(R.length||E.has(h.spec.name)){s.push({code:"entity-name-conflict",opIndex:N,handle:{ref:h.spec.name},matches:R});break}E.add(h.spec.name);const x=i(),T={modelId:x,name:h.spec.name,stereotype:h.spec.stereotype??"JPA_ENTITY",attributes:[],...h.spec.useVersion?{jpaAttrs:{useVersion:!0}}:{},...h.spec.physicalName?{table:{physicalName:h.spec.physicalName}}:{}},M={ref:h.spec.name};let k=!1;for(const[O,A]of(h.spec.attributes??[]).entries()){if(A.type==="GroupCodeEnum"&&!A.groupCode){s.push({code:"groupcode-required",opIndex:N,entity:M,handle:{ref:A.name}}),k=!0;continue}if(!r(A.type)&&!((w=A.embeddableOverrides)!=null&&w.length)&&uu(A)){s.push({code:"datatype-required",opIndex:N,entity:M,handle:{ref:A.name}}),k=!0;continue}const L=r(A.type);if(L){const H=fu(A,L,O,T,e.entities,N,M,s,i);H?T.attributes.push(H):k=!0}else(C=A.embeddableOverrides)!=null&&C.length?(s.push({code:"embeddable-type-unresolved",opIndex:N,entity:M,handle:{ref:A.name}}),k=!0):T.attributes.push(mu(A,O,i))}const v=(h.spec.operations??[]).map((O,A)=>pu(O,A,i));v.length&&(T.operations=v);const I=[];for(const O of h.spec.indexes??[]){const A=hu(T,O,N,M,s,i);A?I.push(A):k=!0}if(I.length&&(T.indexes=I),k)break;l.push({kind:"entity.add",casUnit:"logical",entityRef:x,value:T});break}case"entity.update":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}const x=Mo(h.patch,gb,["jpaAttrs.","table."]);if(x.length){s.push({code:"entity-patch-unknown-key",opIndex:N,entity:h.entity,keys:x});break}const T=h.patch.stereotype;if(typeof T=="string"&&T!==R.value.stereotype&&(T==="JPA_EMBEDDABLE"||R.value.stereotype==="JPA_EMBEDDABLE")){s.push({code:"stereotype-embeddable-transition-unsupported",opIndex:N,entity:h.entity,from:R.value.stereotype??"",to:T});break}l.push({kind:"entity.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,patch:h.patch});break}case"entity.remove":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}const x=R.value.modelId,T=e.associations.filter(I=>I.end1.entityRef===x||I.end2.entityRef===x),M=new Set(T.map(I=>I.modelId));for(const I of T)m.has(I.modelId)||(m.add(I.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:I.modelId}));for(const I of e.entities)if(I.modelId!==x)for(const O of I.attributes)O.embedded&&M.has(O.embedded.associationRef)&&Vo(l,f,I.modelId,O.modelId);for(const I of T){if(I.end1.entityRef===x||!I.end1.attributeRef)continue;const O=e.entities.find(L=>L.modelId===I.end1.entityRef),A=O==null?void 0:O.attributes.find(L=>L.modelId===I.end1.attributeRef&&L.attrType==="RELATION_REF");A&&Vo(l,f,O.modelId,A.modelId)}const k={...e,entities:e.entities.filter(I=>I.modelId!==x),associations:e.associations.filter(I=>!M.has(I.modelId))},v=new Set(T.filter(I=>I.end1.entityRef===x&&I.end2.entityRef!==x).map(I=>I.end2.entityRef));for(const I of v)Sl(l,k,I,i,f,d);for(const I of e.groups)I.memberEntityRefs.includes(x)&&(_.has(g(I.modelId,x))||(_.add(g(I.modelId,x)),l.push({kind:"group.removeMember",casUnit:"logical",containerRef:I.modelId,groupRef:I.modelId,entityRef:x})));p.add(x),l.push({kind:"entity.remove",casUnit:"logical",entityRef:x});break}case"attribute.add":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}if(h.spec.type==="GroupCodeEnum"&&!h.spec.groupCode){s.push({code:"groupcode-required",opIndex:N,entity:h.entity,handle:{ref:h.spec.name}});break}if(!r(h.spec.type)&&!((S=h.spec.embeddableOverrides)!=null&&S.length)&&uu(h.spec)){s.push({code:"datatype-required",opIndex:N,entity:h.entity,handle:{ref:h.spec.name}});break}const x=d(R.value.modelId,R.value.attributes),T=r(h.spec.type);let M;if(T)M=fu(h.spec,T,x,R.value,e.entities,N,h.entity,s,i);else if((V=h.spec.embeddableOverrides)!=null&&V.length){s.push({code:"embeddable-type-unresolved",opIndex:N,entity:h.entity,handle:{ref:h.spec.name}});break}else M=mu(h.spec,x,i);if(!M)break;l.push({kind:"attribute.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,value:M}),y.push({entityId:R.value.modelId,attribute:M});break}case"attribute.update":case"attribute.remove":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}const x=lu(R.value,h.attribute);if(!x.ok){s.push(x.reason==="not-found"?{code:"attribute-not-found",opIndex:N,entity:h.entity,handle:h.attribute}:{code:"attribute-ambiguous",opIndex:N,entity:h.entity,handle:h.attribute,matches:x.matches});break}if(h.kind==="attribute.update"){const T=[],M=[];let k=!1;for(const A of Object.keys(h.patch)){if(A.includes(".")){A.startsWith("dbAttrs.")?k=!0:M.push(A);continue}Cl.has(A)?T.push(A):yb.has(A)||M.push(A)}if(M.length){s.push({code:"attribute-patch-unknown-key",opIndex:N,entity:h.entity,handle:h.attribute,keys:M});break}if("attrType"in h.patch){const A=String(h.patch.attrType),L=tu.includes(A)?A!==x.value.attrType?"transition":void 0:"unknown-value";if(L){s.push({code:"attribute-attrtype-unsupported",opIndex:N,entity:h.entity,handle:h.attribute,reason:L,current:x.value.attrType,requested:A});break}}const v="type"in h.patch?h.patch.type:x.value.type,I="groupCode"in h.patch?h.patch.groupCode:x.value.groupCode;if(v==="GroupCodeEnum"&&!I){s.push({code:"groupcode-required",opIndex:N,entity:h.entity,handle:h.attribute});break}let O=h.patch;if(T.length){const A=wb(x.value,h.patch,T,k);if(!A){s.push({code:"attribute-patch-dbattr-flat-key",opIndex:N,entity:h.entity,handle:h.attribute,keys:T});break}O=A}if(($=h.embeddableOverrides)!=null&&$.length){const A=r(x.value.type);if(!A||x.value.attrType!=="EMBED_PREDEF"){s.push({code:"embeddable-type-unresolved",opIndex:N,entity:h.entity,handle:h.attribute});break}const L=Ib(x.value,A,h.embeddableOverrides,R.value,e.entities,N,h.entity,s);if(!L)break;O={...O,dbAttrs:L}}l.push({kind:"attribute.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,attributeRef:x.value.modelId,patch:O})}else{const T=So(e,R.value.modelId,x.value.modelId);if(T){const M=k=>{var v;return((v=e.entities.find(I=>I.modelId===k))==null?void 0:v.name)??k};s.push({code:"attribute-fk-managed",opIndex:N,entity:h.entity,handle:h.attribute,association:{from:M(T.end1.entityRef),to:M(T.end2.entityRef)}});break}Vo(l,f,R.value.modelId,x.value.modelId)}break}case"association.add":{const R=wt(e,h.spec.from),x=wt(e,h.spec.to);if(R.ok||s.push(It(R.reason,N,h.spec.from,R.matches,b)),x.ok||s.push(It(x.reason,N,h.spec.to,x.matches,b)),!R.ok||!x.ok)break;if(h.spec.identifying&&R.value.modelId===x.value.modelId){s.push({code:"self-identifying",opIndex:N,handle:{from:h.spec.from,to:h.spec.to}});break}if(R.value.stereotype==="JPA_EMBEDDABLE"||x.value.stereotype==="JPA_EMBEDDABLE"){s.push({code:"embeddable-relation-unsupported",opIndex:N,handle:{from:h.spec.from,to:h.spec.to}});break}const T=i(),M={modelId:T,...h.spec.identifying!=null?{identifying:h.spec.identifying}:{},end1:{entityRef:R.value.modelId,multiplicity:h.spec.fromMultiplicity??"EXACTLY_ONE_INSTANCE",navigable:!1,composition:!1},end2:{entityRef:x.value.modelId,multiplicity:h.spec.toMultiplicity??"ZERO_OR_MORE_INSTANCES",navigable:!0,composition:h.spec.composition??!1}},k={...e,associations:[...e.associations,M]},v=ai(k,x.value.modelId,i);v.add[0]&&(M.end2.attributeRef=v.add[0].modelId),l.push({kind:"association.add",casUnit:"logical",associationRef:T,value:M});for(const I of v.add)l.push({kind:"attribute.add",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,value:{...I,order:d(x.value.modelId,x.value.attributes)}});break}case"association.remove":{const R=wt(e,h.association.from),x=wt(e,h.association.to);if(R.ok||s.push(It(R.reason,N,h.association.from,R.matches,b)),x.ok||s.push(It(x.reason,N,h.association.to,x.matches,b)),!R.ok||!x.ok)break;const T=ru(e,R.value.modelId,x.value.modelId);if(T.length!==1){s.push(T.length===0?{code:"association-not-found",opIndex:N,handle:h.association}:{code:"association-ambiguous",opIndex:N,handle:h.association,matches:T.map(I=>I.modelId)});break}const M=T[0];m.has(M.modelId)||(m.add(M.modelId),l.push({kind:"association.remove",casUnit:"logical",associationRef:M.modelId}));const k=e.entities.find(I=>I.attributes.some(O=>{var A;return((A=O.embedded)==null?void 0:A.associationRef)===M.modelId}));if(k){const I=k.attributes.find(O=>{var A;return((A=O.embedded)==null?void 0:A.associationRef)===M.modelId});Vo(l,f,k.modelId,I.modelId);break}if(M.end1.attributeRef){const I=e.entities.find(A=>A.modelId===M.end1.entityRef),O=I==null?void 0:I.attributes.find(A=>A.modelId===M.end1.attributeRef&&A.attrType==="RELATION_REF");O&&Vo(l,f,I.modelId,O.modelId)}const v={...e,associations:e.associations.filter(I=>I.modelId!==M.modelId)};Sl(l,v,M.end2.entityRef,i,f,d);break}case"association.update":{const R=yu(e,h.association,N,s,b);if(!R)break;const x=h.patch.identifying,T=typeof x=="boolean"?x:void 0;if(T===!0&&R.end1.entityRef===R.end2.entityRef){s.push({code:"self-identifying",opIndex:N,handle:h.association});break}const M=Mo(h.patch,bb);if(M.length){s.push({code:"association-patch-unknown-key",opIndex:N,handle:h.association,keys:M});break}if(l.push({kind:"association.update",casUnit:"logical",containerRef:R.modelId,associationRef:R.modelId,patch:h.patch}),T!==void 0&&T!==(R.identifying??!1)){const k={...e,associations:e.associations.map(v=>v.modelId===R.modelId?{...v,identifying:T}:v)};Sl(l,k,R.end2.entityRef,i,f,d)}break}case"associationEnd.update":{const R=yu(e,h.association,N,s,b);if(!R)break;const x=h.end==="from"?"end1":"end2";if(Object.prototype.hasOwnProperty.call(h.patch,"navigable")){s.push({code:"navigable-toggle-unsupported",opIndex:N,handle:h.association});break}const T=Mo(h.patch,_b,["jpa."]);if(T.length){s.push({code:"association-end-patch-unknown-key",opIndex:N,handle:h.association,keys:T});break}l.push({kind:"associationEnd.update",casUnit:"logical",containerRef:R.modelId,associationRef:R.modelId,end:x,patch:h.patch});break}case"index.add":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}const x=hu(R.value,h.spec,N,h.entity,s,i);if(!x)break;l.push({kind:"index.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,indexRef:x.modelId,value:x});break}case"index.update":case"index.remove":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}if(vl(h.index)){s.push({code:"handle-by-unsupported",opIndex:N,entity:h.entity,handle:h.index,target:"index"});break}const x=hb(R.value,h.index);if(!x.ok){s.push(x.reason==="not-found"?{code:"index-not-found",opIndex:N,entity:h.entity,handle:h.index}:{code:"index-ambiguous",opIndex:N,entity:h.entity,handle:h.index,matches:x.matches});break}if(h.kind==="index.update"){if("columns"in h.patch){s.push({code:"index-columns-patch-unsupported",opIndex:N,entity:h.entity,handle:h.index});break}const T=Mo(h.patch,kb);if(T.length){s.push({code:"index-patch-unknown-key",opIndex:N,entity:h.entity,handle:h.index,keys:T});break}l.push({kind:"index.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,indexRef:x.value.modelId,patch:h.patch})}else l.push({kind:"index.remove",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,indexRef:x.value.modelId});break}case"operation.add":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}const x=u.get(R.value.modelId)??(R.value.operations?zt(R.value.operations):0);u.set(R.value.modelId,x+1);const T=pu(h.spec,x,i);l.push({kind:"operation.add",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:T.modelId,value:T});break}case"operation.update":case"operation.remove":{const R=wt(e,h.entity);if(!R.ok){s.push(It(R.reason,N,h.entity,R.matches,b));break}if(vl(h.operation)){s.push({code:"handle-by-unsupported",opIndex:N,entity:h.entity,handle:h.operation,target:"operation"});break}const x=cu(R.value,h.operation);if(!x.ok){s.push(x.reason==="not-found"?{code:"operation-not-found",opIndex:N,entity:h.entity,handle:h.operation}:{code:"operation-ambiguous",opIndex:N,entity:h.entity,handle:h.operation,matches:x.matches});break}if(h.kind==="operation.update"){const T=Mo(h.patch,Eb);if(T.length){s.push({code:"operation-patch-unknown-key",opIndex:N,entity:h.entity,handle:h.operation,keys:T});break}l.push({kind:"operation.update",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:x.value.modelId,patch:h.patch})}else l.push({kind:"operation.remove",casUnit:"logical",containerRef:R.value.modelId,entityRef:R.value.modelId,operationRef:x.value.modelId});break}case"attribute.reorder":case"operation.reorder":{const R=h.kind==="attribute.reorder",x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,N,h.entity,x.matches,b));break}const T=R?h.order:h.operations,M=[],k=new Set;let v=!1;for(const L of T){if(!R&&vl(L)){s.push({code:"handle-by-unsupported",opIndex:N,entity:h.entity,handle:L,target:"operation"}),v=!0;continue}const H=R?lu(x.value,L):cu(x.value,L);if(!H.ok){s.push(H.reason==="not-found"?{code:"reorder-handle-not-found",opIndex:N,entity:h.entity,handle:L}:{code:"reorder-handle-ambiguous",opIndex:N,entity:h.entity,handle:L,matches:H.matches}),v=!0;continue}if(k.has(H.value.modelId)){s.push({code:"reorder-handle-duplicate",opIndex:N,entity:h.entity,handle:L}),v=!0;continue}k.add(H.value.modelId),M.push(H.value)}if(v)break;const O=[...R?x.value.attributes:x.value.operations??[]].sort((L,H)=>L.order-H.order).filter(L=>!k.has(L.modelId)),A=[...M,...O];if(A.forEach((L,H)=>{L.order!==H&&l.push(R?{kind:"attribute.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,attributeRef:L.modelId,patch:{order:H}}:{kind:"operation.update",casUnit:"logical",containerRef:x.value.modelId,entityRef:x.value.modelId,operationRef:L.modelId,patch:{order:H}})}),R)for(const L of iu(e,x.value.modelId,A.map(H=>H.modelId)))l.push({kind:"attribute.update",casUnit:"logical",containerRef:L.entityId,entityRef:L.entityId,attributeRef:L.attributeId,patch:{dbAttrs:L.dbAttrs}});break}case"group.add":{const R=[];let x=!1;for(const k of h.spec.members){const v=wt(e,k);if(!v.ok){s.push(It(v.reason,N,k,v.matches,b)),x=!0;continue}R.push(v.value.modelId)}if(x)break;const T=i(),M={modelId:T,excludeDDLGeneration:h.spec.excludeDDLGeneration??!1,memberEntityRefs:R,...h.spec.name?{name:h.spec.name}:{},...h.spec.packageName?{packageName:h.spec.packageName}:{},...h.spec.description?{description:h.spec.description}:{}};l.push({kind:"group.add",casUnit:"logical",groupRef:T,value:M});break}case"group.update":{const R=wl(e,h.group);if(!R.ok){s.push(Il(R,N,h.group));break}const x=Mo(h.patch,cb);if(x.length){s.push({code:"group-patch-unknown-key",opIndex:N,handle:h.group,keys:x});break}l.push({kind:"group.update",casUnit:"logical",containerRef:R.value.modelId,groupRef:R.value.modelId,patch:h.patch});break}case"group.remove":{const R=wl(e,h.group);if(!R.ok){s.push(Il(R,N,h.group));break}l.push({kind:"group.remove",casUnit:"logical",groupRef:R.value.modelId});break}case"group.addMember":case"group.removeMember":{const R=wl(e,h.group);if(!R.ok){s.push(Il(R,N,h.group));break}const x=wt(e,h.entity);if(!x.ok){s.push(It(x.reason,N,h.entity,x.matches,b));break}const T=R.value.memberEntityRefs.includes(x.value.modelId);if(h.kind==="group.addMember"?T:!T)break;if(h.kind==="group.removeMember"){if(_.has(g(R.value.modelId,x.value.modelId)))break;_.add(g(R.value.modelId,x.value.modelId))}l.push({kind:h.kind,casUnit:"logical",containerRef:R.value.modelId,groupRef:R.value.modelId,entityRef:x.value.modelId});break}}}),s.length||vb(l,e,f,p),s.length||Cb(l,e,f,y,p,i),s.length?{ok:!1,errors:s}:{ok:!0,ops:l}}function It(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 yu(e,n,o,i,a){const r=wt(e,n.from),l=wt(e,n.to);if(r.ok||i.push(It(r.reason,o,n.from,r.matches,a)),l.ok||i.push(It(l.reason,o,n.to,l.matches,a)),!r.ok||!l.ok)return null;const s=ru(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 gu={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},xb={type:"object",description:"엔티티 내 이름으로 지정(인덱스명·메서드명). 물리명 차원이 없어 매칭 키 고정(`by`)을 받지 않는다.",properties:{ref:{type:"string",description:"매칭할 이름."}},required:["ref"],additionalProperties:!1},Rb={type:"object",description:"관계는 무명이라 양 끝 엔티티로 주소. from=부모(end1), to=자식(end2). 같은 쌍 복수 관계는 모호 보고.",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"}},required:["from","to"],additionalProperties:!1},Ab={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},Vn={type:"object",properties:{ko:{type:"string"},en:{type:"string"},ja:{type:"string"},zh:{type:"string"}},additionalProperties:!1},$b={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:{...Vn,description:"속성 설명(다국어)."},columnLogicalName:{...Vn,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},Tb={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}},bu={type:"string",enum:["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"]},Mb={type:"object",description:"일반 연관 생성. 양 end 는 일반 엔티티여야 한다 — 임베더블(JPA_EMBEDDABLE)을 end 로 주면 거부된다(임베드는 EMBED 관계여야 하고 이 어휘엔 없다 → 캔버스에서 연결).",properties:{from:{$ref:"#/$defs/handle"},to:{$ref:"#/$defs/handle"},fromMultiplicity:{...bu,description:"end1 다중성(기본 EXACTLY_ONE_INSTANCE)."},toMultiplicity:{...bu,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},Vb={type:"object",properties:{name:{type:"string"},unique:{type:"boolean",description:"UNIQUE 인덱스 여부(기본 false)."},columns:{type:"array",description:"인덱스 컬럼(순서 의미 있음).",items:{type:"object",properties:{column:{...gu,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},Bb={type:"object",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"],description:"가시성(기본 미설정)."},sourceCode:{type:"string",description:"Java 메서드 본문(멀티라인, 파라미터·반환 시그니처 포함)."},description:{...Vn,description:"메서드 설명(다국어)."},personalInfoAttributeType:{type:"string",description:"개인정보 속성 유형(패스스루)."}},required:["name"],additionalProperties:!1},Db={type:"object",properties:{name:{...Vn,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},Ob={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:[...tu],description:"속성 종류. **현재 값과 다르게 주면 거부된다** — 관계/임베드/구분선은 동반 구조(관계 소유·embedded·빈 dbAttrs)가 있어야 성립하고 patch로는 표현할 수 없다. 관계 실체화는 association.add, 임베드 서브컬럼은 embeddableOverrides 소관."},identifier:{type:"boolean"},notNull:{type:"boolean"},transient:{type:"boolean"},naturalId:{type:"boolean"},naturalIdMutable:{type:"boolean"},derivedIdFieldName:{type:"string",description:"파생 식별(@MapsId) FK가 매핑되는 **스칼라 @Id 필드명**. 이 속성의 name은 연관 필드명(@MapsId @OneToOne 필드)이고 같은 관계가 두 Java 필드를 만든다. 단일 컬럼 @OneToOne 식별 FK에만 의미가 있고, 미설정 시 부모 PK 물리명의 camelCase로 파생된다(실물 관행). 컬럼은 공유하므로 속성은 하나이며 물리명은 지정하지 않는다."},description:{...Vn,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:{...Vn,description:"컬럼 논리명(다국어)."}},additionalProperties:!1},Lb={type:"object",description:"관계 부분 patch. 양 end 설정(multiplicity·nav·jpa)은 associationEnd.update로.",properties:{description:{type:"string"},identifying:{type:"boolean",description:"식별 관계(부모 PK가 자식 PK 일부로 전파)."}},additionalProperties:!1},Pb={type:"object",description:"인덱스 부분 patch. columns(컬럼 구성) 변경은 index.remove+index.add로(패치 불가).",properties:{name:{type:"string"},unique:{type:"boolean"},description:{type:"string"},parameters:{type:"string"}},additionalProperties:!1},zb={type:"object",description:"메서드 부분 patch.",properties:{name:{type:"string"},visibility:{type:"string",enum:["PUBLIC","PRIVATE","PROTECTED","PACKAGE"]},sourceCode:{type:"string"},description:{...Vn,description:"메서드 설명(다국어)."},order:{type:"integer"},personalInfoAttributeType:{type:"string"}},additionalProperties:!1},Fb={type:"object",description:'엔티티 부분 patch. 논리 키: name·stereotype·packageName·superClass·schema·description·abstractClass·hasPersonalInfo·referenceOnly·declarationOfInterfaces·table. jpaAttrs 플래그(useVersion 등)는 형제 클로버 방지를 위해 dotted-key로 준다: {"jpaAttrs.useVersion": true}. 자식(attributes/indexes/operations)은 patch가 아니라 전용 op로 변경. stereotype 은 JPA_EMBEDDABLE 경계를 넘을 수 없다 — 들어가고 나오는 전환은 PK 해제/부여·FK reconcile·EMBED 복원/해체가 동반되는 composite라 patch로 표현되지 않는다(거부. 전환은 GUI 소관).'},Ub={type:"object",description:'관계 end 부분 patch. 논리 키: multiplicity·navigable·composition. jpa 설정(cascadeTypes·fetchType·orphanRemoval·orderBy·collectionType·collectionTable·orderColumn)은 형제 클로버 방지를 위해 dotted-key로: {"jpa.orphanRemoval": true}.'};function mt(e,n){return{type:"object",properties:{kind:{const:e},...n.properties},required:["kind",...n.required],additionalProperties:!1}}const Hb={"entity.add":mt("entity.add",{properties:{spec:{$ref:"#/$defs/entitySpec"}},required:["spec"]}),"entity.update":mt("entity.update",{properties:{entity:{$ref:"#/$defs/handle"},patch:{$ref:"#/$defs/entityUpdatePatch"}},required:["entity","patch"]}),"entity.remove":mt("entity.remove",{properties:{entity:{$ref:"#/$defs/handle"}},required:["entity"]}),"attribute.add":mt("attribute.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/attrSpec"}},required:["entity","spec"]}),"attribute.update":mt("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":mt("attribute.remove",{properties:{entity:{$ref:"#/$defs/handle"},attribute:{$ref:"#/$defs/handle"}},required:["entity","attribute"]}),"association.add":mt("association.add",{properties:{spec:{$ref:"#/$defs/assocSpec"}},required:["spec"]}),"association.remove":mt("association.remove",{properties:{association:{$ref:"#/$defs/assocHandle"}},required:["association"]}),"association.update":mt("association.update",{properties:{association:{$ref:"#/$defs/assocHandle"},patch:{$ref:"#/$defs/assocUpdatePatch"}},required:["association","patch"]}),"associationEnd.update":mt("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":mt("index.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/indexSpec"}},required:["entity","spec"]}),"index.update":mt("index.update",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/indexUpdatePatch"}},required:["entity","index","patch"]}),"index.remove":mt("index.remove",{properties:{entity:{$ref:"#/$defs/handle"},index:{$ref:"#/$defs/nameHandle"}},required:["entity","index"]}),"operation.add":mt("operation.add",{properties:{entity:{$ref:"#/$defs/handle"},spec:{$ref:"#/$defs/operationSpec"}},required:["entity","spec"]}),"operation.update":mt("operation.update",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"},patch:{$ref:"#/$defs/operationUpdatePatch"}},required:["entity","operation","patch"]}),"operation.remove":mt("operation.remove",{properties:{entity:{$ref:"#/$defs/handle"},operation:{$ref:"#/$defs/nameHandle"}},required:["entity","operation"]}),"attribute.reorder":mt("attribute.reorder",{properties:{entity:{$ref:"#/$defs/handle"},order:{type:"array",items:{$ref:"#/$defs/handle"},minItems:1}},required:["entity","order"]}),"operation.reorder":mt("operation.reorder",{properties:{entity:{$ref:"#/$defs/handle"},operations:{type:"array",items:{$ref:"#/$defs/nameHandle"},minItems:1}},required:["entity","operations"]}),"group.add":mt("group.add",{properties:{spec:{$ref:"#/$defs/groupSpec"}},required:["spec"]}),"group.update":mt("group.update",{properties:{group:{$ref:"#/$defs/groupHandle"},patch:{$ref:"#/$defs/groupUpdatePatch"}},required:["group","patch"]}),"group.remove":mt("group.remove",{properties:{group:{$ref:"#/$defs/groupHandle"}},required:["group"]}),"group.addMember":mt("group.addMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]}),"group.removeMember":mt("group.removeMember",{properties:{group:{$ref:"#/$defs/groupHandle"},entity:{$ref:"#/$defs/handle"}},required:["group","entity"]})},jb={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},Kb={type:"object",description:"그룹 부분 patch. 멤버 변경은 group.addMember/removeMember로(배열 통째 교체는 동시 편집이 서로를 덮는다).",properties:{name:{...Vn,description:"그룹 논리명(다국어)."},packageName:{type:"string"},description:{type:"string"},excludeDDLGeneration:{type:"boolean"}},additionalProperties:!1},_u={anyOf:eu.map(e=>Hb[e])},Gb={type:"object",description:"엔티티 모델을 생성·수정·삭제할 때 호출한다. ops는 사람 핸들(엔티티 물리명/논리명, 속성명)로 지정하며 서버가 modelId로 해소한다. 모호하면 에러로 후보를 돌려주니 리소스로 현재 모델을 먼저 읽어 핸들을 확정하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{handle:gu,nameHandle:xb,groupHandle:jb,assocHandle:Rb,entitySpec:Ab,attrSpec:$b,embeddableOverrides:Tb,assocSpec:Mb,indexSpec:Vb,operationSpec:Bb,groupSpec:Db,entityUpdatePatch:Fb,attrUpdatePatch:Ob,assocUpdatePatch:Lb,assocEndUpdatePatch:Ub,indexUpdatePatch:Pb,operationUpdatePatch:zb,groupUpdatePatch:Kb,symbolicOp:_u}};function Yb(e,n,o,i={}){const a=i.mkClientOpId??Pe,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 ku={location:{x:0,y:0},size:{width:220,height:140}};function Eu(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 qb=/^[-=_*~\s]{3,}$/;function Wb(e){return e.attrType&&e.attrType!=="NORMAL"||!qb.test(e.name??"")?!1:!(e.dbAttrs??[]).some(n=>n.physicalName||n.dataType)}function Jb(e){return e.type===hn&&e.customType==="java.util.Currency"?{type:"Currency",customType:void 0}:{type:e.type,customType:e.customType}}function Xb(e,n){if(e.attrType==="DIVIDER"||Wb(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=Jb(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(Eu)}}function Zb(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 Qb(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 e_(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(Xb),operations:(n=e.operations)==null?void 0:n.map(Zb),indexes:(o=e.indexes)==null?void 0:o.map(Qb),jpaAttrs:e.jpaAttrs,table:e.dbAttrs?{physicalName:e.dbAttrs.physicalName,logicalName:e.dbAttrs.logicalName}:void 0}}function t_(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??{...ku},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 Nu(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 xl(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:Nu(e)}}function n_(e){if(e.end1.endModel.refId===e.end2.endModel.refId)return;const n=o=>Rl(o)&&(o==null?void 0:o.identifier)===!0;return n(e.end1.attribute)||n(e.end2.attribute)?!0:void 0}function o_(e){var i,a;const n={modelId:e.modelId,description:e.description,identifying:n_(e),end1:xl(e.end1),end2:xl(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 Rl(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("RELATION")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function wu(e){var n;return!!e&&typeof e.attrType=="string"&&e.attrType.startsWith("EMBED")&&(((n=e.dbAttrs)==null?void 0:n.length)??0)>0}function Iu(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 vu(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(Eu)}}function i_(e,n,o){var N,w;const i=Rl(e.end1.attribute),a=Rl(e.end2.attribute);if(i===a)return o_(e);const r=i?e.end1:e.end2,l=i?e.end2:e.end1,s=r.attribute,c=(w=(N=s.dbAttrs)==null?void 0:N[0])==null?void 0:w.targetModelId,d=c?o.get(c):void 0,u=n.get(l.endModel.refId),m=u?u.attributes.reduce((C,S)=>Math.max(C,S.order),-1)+1:s.order??0,p={...vu(s,m),attrType:"RELATION_OWN",derivedFrom:d?{associationRef:e.modelId,sourceAttributeRef:d}:void 0};u&&u.attributes.push(p);const f=n.get(r.endModel.refId),y=l.attribute;let _;if(y&&f&&r.navigable){const C=Qi(l.multiplicity);_={modelId:y.modelId??crypto.randomUUID(),name:No(y.name??ta((u==null?void 0:u.name)??l.endModel.refId,C),new Set(f.attributes.map(S=>S.name))),type:(u==null?void 0:u.name)??l.endModel.refId,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:f.attributes.reduce((S,V)=>Math.max(S,V.order),-1)+1,dbAttrs:[]},f.attributes.push(_)}const g=(C,S)=>({entityRef:C.endModel.refId,multiplicity:C.multiplicity,navigable:C.navigable,composition:C.composition,attributeRef:S?_==null?void 0:_.modelId:p.modelId,jpa:Nu(C)}),b=r.endModel.refId===l.endModel.refId,E={modelId:e.modelId,description:e.description,identifying:!b&&p.identifier===!0?!0:void 0,end1:g(e.end1,i),end2:g(e.end2,a)},h={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:i?d:p.modelId,targetColumnRef:i?p.modelId:d,style:e.style};return{assoc:E,layout:h}}function a_(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 r_(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((_,g)=>Math.max(_,g.order),-1)+1:l.order??0,d={...vu(l,c),attrType:l.attrType??"EMBED_OWN",dbAttrs:(l.dbAttrs??[]).map(_=>a_(_,o)),embedded:{associationRef:e.modelId,embeddableRef:a.endModel.refId}};s&&s.attributes.push(d);const u=_=>({...xl(_),legacyEmbedRaw:_.attribute}),m={modelId:e.modelId,description:e.description,end1:u(e.end1),end2:u(e.end2)},p=!i,f={associationRef:e.modelId,waypoints:e.locations??[],sourceColumnRef:p?d.modelId:void 0,targetColumnRef:p?void 0:d.modelId,style:e.style};return{assoc:m,layout:f}}function l_(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 Cu(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=l_(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 Su(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 s_(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(p=>p.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(p=>p.modelId===s);if((c==null?void 0:c.attrType)==="RELATION_REF"){i.end1.attributeRef=s;continue}const d=Qi(i.end2.multiplicity),u=ta(r.name,d),m=No(u,new Set(a.attributes.map(p=>p.name)));a.attributes.push({modelId:s,name:m,type:r.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:a.attributes.reduce((p,f)=>Math.max(p,f.order),-1)+1,dbAttrs:[]}),i.end1.attributeRef=s}}function c_(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 xu(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&&!dc(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 Ru(e){const n=JSON.parse(JSON.stringify(e));return(n.schemaVersion??1)>=2&&"logical"in n?d_(n):u_(n)}function d_(e){const n=e.id??e.logical.modelId??"",o={},i=m=>{const{rev:p,...f}=m;return p!=null&&(o[m.modelId]=p),f},a=e.logical.entities.map(i),r=e.logical.associations.map(i),l=e.logical.groups.map(i);s_(a,r),c_(a,r),xu(a,r);const{version:s,...c}=e.layout;Su(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,referenceOnly:e.referenceOnly,revSeed:{revs:o,layoutVersion:s??0,logicalVersion:e.logical.version??0}};return{state:d,meta:u}}function u_(e){var b,E;const n=e.id??"",o=[],i=[],a=[],r=[],l=[],s=[],c=[],d=(h,N)=>{o.push(e_(h));const w=t_(h);w.geo={location:{x:w.geo.location.x+N.x,y:w.geo.location.y+N.y},size:w.geo.size},i.push(w);for(const C of h.ownedAssociations??[])c.push(C)},u={x:0,y:0};for(const h of e.entities??[])d(h,u);const m=[];for(const h of e.groups??[]){const N=h.entities??[];l.push({modelId:h.modelId,name:h.name,description:h.description,packageName:h.packageName,excludeDDLGeneration:h.excludeDDLGeneration??!1,memberEntityRefs:N.map(C=>C.modelId)});const w=((b=h.geo)==null?void 0:b.location)??u;if(h.geo){const C=(h.notes??[]).map(S=>S.modelId);s.push({groupRef:h.modelId,geo:h.geo,style:h.style,locked:h.locked,memberNoteRefs:C.length?C:void 0})}for(const C of N)d(C,w);for(const C of h.notes??[])m.push(Cu(C,w))}const p=new Map(o.map(h=>[h.modelId,h])),f=new Map,y=new Map;for(const h of o)for(const N of h.attributes)for(const w of N.dbAttrs)f.set(w.modelId,N.modelId),y.set(w.modelId,w);for(const h of c)for(const N of[h.end1,h.end2]){const w=N.attribute;if(w&&(((E=w.dbAttrs)==null?void 0:E.length)??0)>0)for(const C of w.dbAttrs)C.modelId&&f.set(C.modelId,w.modelId)}for(const h of c){const N=wu(h.end1.attribute),w=wu(h.end2.attribute),C=Iu(h.end1)||Iu(h.end2),{assoc:S,layout:V}=N!==w||C?r_(h,p,y):i_(h,p,f);a.push(S),r.push(V)}Su(o,a,r),td(o),xu(o,a);const _={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(h=>Cu(h)),...m]}},g={id:e.id,version:e.version,diagramVersion:e.diagramVersion,size:e.size,packageName:e.packageName,schemaVersion:e.schemaVersion??1};return{state:_,meta:g}}function Au(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 m_(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(Au),style:n}}function f_(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 p_(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 Bn(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 h_(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{...Au(i),targetModelId:(r=o==null?void 0:o.dbAttrs[a])==null?void 0:r.modelId}})}}function y_(e){return{modelId:e.modelId,name:e.name,type:e.type,attrType:"RELATION_OWN",dbAttrs:[]}}function $u(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 g_(e){const n=new Set;for(const o of e.logical.associations){const i=$u(o,e);i&&(n.add(i.navAttr.modelId),i.fk&&n.add(i.fk.modelId))}return n}function b_(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 __(e,n){return e===n||JSON.stringify(e??null)===JSON.stringify(n??null)}function k_(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:__(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 E_(e,n,o){let i;for(const m of n.logical.entities){const p=m.attributes.find(f=>{var y;return((y=f.embedded)==null?void 0:y.associationRef)===e.modelId});if(p){i=p;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,p)=>k_(m,l[p]))},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:Bn(e.end1,c?s:u),end2:Bn(e.end2,c?u:s)}}function N_(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:Bn(e.end1,e.end1.legacyEmbedRaw),end2:Bn(e.end2,e.end2.legacyEmbedRaw)};const a=E_(e,n,i);if(a)return a;const r=$u(e,n);if(r){const l=n.logical.entities.find(d=>d.modelId===r.navEnd.entityRef),s=r.fk?h_(r.fk,l):void 0,c=y_(r.navAttr);return{...i,end1:Bn(e.end1,r.navEnd===e.end1?s:c),end2:Bn(e.end2,r.navEnd===e.end2?s:c)}}return{...i,end1:Bn(e.end1),end2:Bn(e.end2)}}function Tu(e,n,o,i,a={x:0,y:0}){var u,m;const r=n.layout.entityLayouts.find(p=>p.entityRef===e.modelId),l=n.logical.associations.filter(p=>p.end1.entityRef===e.modelId),s=p=>n.layout.associationLayouts.find(f=>f.associationRef===p),c=(r==null?void 0:r.geo)??{...ku},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(p=>!o.has(p.modelId)&&!i.has(p.modelId)).map(p=>{var f;return m_(p,(f=r==null?void 0:r.attributeStyles)==null?void 0:f[p.modelId])}),operations:(u=e.operations)==null?void 0:u.map(p=>{var f;return f_(p,(f=r==null?void 0:r.operationStyles)==null?void 0:f[p.modelId])}),ownedAssociations:l.map(p=>N_(p,n,s(p.modelId))),indexes:(m=e.indexes)==null?void 0:m.map(p_),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 w_(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=>Mu(c,l));return{modelId:e.modelId,name:e.name,description:e.description,packageName:e.packageName,excludeDDLGeneration:e.excludeDDLGeneration,entities:r.map(c=>Tu(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 Mu(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 I_(e,n={}){const o=new Set(e.logical.groups.flatMap(s=>s.memberEntityRefs)),i=e.logical.entities.filter(s=>!o.has(s.modelId)),a=g_(e),r=b_(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=>Tu(s,e,a,r)),groups:e.logical.groups.map(s=>w_(s,e,a,r)),notes:e.layout.notes.filter(s=>!l.has(s.modelId)).map(s=>Mu(s))}}function v_(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,referenceOnly:n.referenceOnly,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 C_=["notNull"];function S_(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}=Ru(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(p=>[p.modelId,p]))]));for(const m of i.logical.entities){const p=c.get(m.modelId);if(p)for(const f of m.attributes){const y=p.get(f.modelId);if(!y){l.push({kind:"attribute.add",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,value:f}),s.navAdds++;continue}const _={};for(const g of C_)f[g]===!0!=(y[g]===!0)&&(_[g]=f[g],s.attributeFieldsByName[g]=(s.attributeFieldsByName[g]??0)+1);Object.keys(_).length!==0&&(l.push({kind:"attribute.update",casUnit:"logical",containerRef:m.modelId,entityRef:m.modelId,attributeRef:f.modelId,patch:_}),s.attributeFieldPatches++)}}const d=new Map(o.logical.associations.map(m=>[m.modelId,m]));for(const m of i.logical.associations){const p=d.get(m.modelId);p&&(m.end1.attributeRef&&m.end1.attributeRef!==p.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&&p.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 fi(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}function gn(e){return typeof e=="function"?e():t.unref(e)}const x_=typeof window<"u"&&typeof document<"u",R_=e=>typeof e<"u",A_=Object.prototype.toString,$_=e=>A_.call(e)==="[object Object]",T_=()=>{};function M_(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 Vu=e=>e();function V_(e=Vu){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 Bu(e,n=!1,o="Timeout"){return new Promise((i,a)=>{setTimeout(n?()=>a(o):i,e)})}function B_(e,n,o={}){const{eventFilter:i=Vu,...a}=o;return t.watch(e,M_(i,n),a)}function Bo(e,n,o={}){const{eventFilter:i,...a}=o,{eventFilter:r,pause:l,resume:s,isActive:c}=V_(i);return{stop:B_(e,n,{...a,eventFilter:r}),pause:l,resume:s,isActive:c}}function D_(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=gn(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 Al(e,n=!1){function o(m,{flush:p="sync",deep:f=!1,timeout:y,throwOnTimeout:_}={}){let g=null;const E=[new Promise(h=>{g=t.watch(e,N=>{m(N)!==n&&(g==null||g(),h(N))},{flush:p,deep:f,immediate:!0})})];return y!=null&&E.push(Bu(y,_).then(()=>gn(e)).finally(()=>g==null?void 0:g())),Promise.race(E)}function i(m,p){if(!t.isRef(m))return o(N=>N===m,p);const{flush:f="sync",deep:y=!1,timeout:_,throwOnTimeout:g}=p??{};let b=null;const h=[new Promise(N=>{b=t.watch([e,m],([w,C])=>{n!==(w===C)&&(b==null||b(),N(w))},{flush:f,deep:y,immediate:!0})})];return _!=null&&h.push(Bu(_,g).then(()=>gn(e)).finally(()=>(b==null||b(),gn(e)))),Promise.race(h)}function a(m){return o(p=>!!p,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,p){return o(f=>{const y=Array.from(f);return y.includes(m)||y.includes(gn(m))},p)}function d(m){return u(1,m)}function u(m=1,p){let f=-1;return o(()=>(f+=1,f>=m),p)}return Array.isArray(gn(e))?{toMatch:o,toContains:c,changed:d,changedTimes:u,get not(){return Al(e,!n)}}:{toMatch:o,toBe:i,toBeTruthy:a,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:d,changedTimes:u,get not(){return Al(e,!n)}}}function $l(e){return Al(e)}function O_(e){var n;const o=gn(e);return(n=o==null?void 0:o.$el)!=null?n:o}const Du=x_?window:void 0;function Ou(...e){let n,o,i,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([o,i,a]=e,n=Du):[n,o,i,a]=e,!n)return T_;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const r=[],l=()=>{r.forEach(u=>u()),r.length=0},s=(u,m,p,f)=>(u.addEventListener(m,p,f),()=>u.removeEventListener(m,p,f)),c=t.watch(()=>[O_(n),gn(a)],([u,m])=>{if(l(),!u)return;const p=$_(m)?{...m}:m;r.push(...o.flatMap(f=>i.map(y=>s(u,f,y,p))))},{immediate:!0,flush:"post"}),d=()=>{c(),l()};return fi(d),d}function L_(e){return typeof e=="function"?e:typeof e=="string"?n=>n.key===e:Array.isArray(e)?n=>e.includes(n.key):()=>!0}function Lu(...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=Du,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=i,c=L_(n);return Ou(a,r,u=>{u.repeat&&gn(s)||c(u)&&o(u)},l)}function P_(e){return JSON.parse(JSON.stringify(e))}function Tl(e,n,o,i={}){var a,r,l;const{clone:s=!1,passive:c=!1,eventName:d,deep:u=!1,defaultValue:m,shouldEmit:p}=i,f=t.getCurrentInstance(),y=o||(f==null?void 0:f.emit)||((a=f==null?void 0:f.$emit)==null?void 0:a.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let _=d;n||(n="modelValue"),_=_||`update:${n.toString()}`;const g=h=>s?typeof s=="function"?s(h):P_(h):h,b=()=>R_(e[n])?g(e[n]):m,E=h=>{p?p(h)&&y(_,h):y(_,h)};if(c){const h=b(),N=t.ref(h);let w=!1;return t.watch(()=>e[n],C=>{w||(w=!0,N.value=g(C),t.nextTick(()=>w=!1))}),t.watch(N,C=>{!w&&(C!==e[n]||u)&&E(C)},{deep:u}),N}else return t.computed({get(){return b()},set(h){E(h)}})}var z_={value:()=>{}};function va(){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 Ca(o)}function Ca(e){this._=e}function F_(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}})}Ca.prototype=va.prototype={constructor:Ca,on:function(e,n){var o=this._,i=F_(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=U_(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]=Pu(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Pu(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 Ca(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 U_(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Pu(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=z_,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var Ml="http://www.w3.org/1999/xhtml";const zu={svg:"http://www.w3.org/2000/svg",xhtml:Ml,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Sa(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),zu.hasOwnProperty(n)?{space:zu[n],local:e}:e}function H_(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===Ml&&n.documentElement.namespaceURI===Ml?n.createElement(e):n.createElementNS(o,e)}}function j_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fu(e){var n=Sa(e);return(n.local?j_:H_)(n)}function K_(){}function Vl(e){return e==null?K_:function(){return this.querySelector(e)}}function G_(e){typeof e!="function"&&(e=Vl(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 Lt(i,this._parents)}function Y_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function q_(){return[]}function Uu(e){return e==null?q_:function(){return this.querySelectorAll(e)}}function W_(e){return function(){return Y_(e.apply(this,arguments))}}function J_(e){typeof e=="function"?e=W_(e):e=Uu(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 Lt(i,a)}function Hu(e){return function(){return this.matches(e)}}function ju(e){return function(n){return n.matches(e)}}var X_=Array.prototype.find;function Z_(e){return function(){return X_.call(this.children,e)}}function Q_(){return this.firstElementChild}function ek(e){return this.select(e==null?Q_:Z_(typeof e=="function"?e:ju(e)))}var tk=Array.prototype.filter;function nk(){return Array.from(this.children)}function ok(e){return function(){return tk.call(this.children,e)}}function ik(e){return this.selectAll(e==null?nk:ok(typeof e=="function"?e:ju(e)))}function ak(e){typeof e!="function"&&(e=Hu(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 Lt(i,this._parents)}function Ku(e){return new Array(e.length)}function rk(){return new Lt(this._enter||this._groups.map(Ku),this._parents)}function xa(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}xa.prototype={constructor:xa,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 lk(e){return function(){return e}}function sk(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 xa(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function ck(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new xa(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function dk(e){return e.__data__}function uk(e,n){if(!arguments.length)return Array.from(this,dk);var o=n?ck:sk,i=this._parents,a=this._groups;typeof e!="function"&&(e=lk(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],p=m.length,f=mk(e.call(u,u&&u.__data__,d,i)),y=f.length,_=s[d]=new Array(y),g=l[d]=new Array(y),b=c[d]=new Array(p);o(u,m,_,g,b,f,n);for(var E=0,h=0,N,w;E<y;++E)if(N=_[E]){for(E>=h&&(h=E+1);!(w=g[h])&&++h<y;);N._next=w||null}}return l=new Lt(l,i),l._enter=s,l._exit=c,l}function mk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fk(){return new Lt(this._exit||this._groups.map(Ku),this._parents)}function pk(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 hk(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,p=s[c]=new Array(m),f,y=0;y<m;++y)(f=d[y]||u[y])&&(p[y]=f);for(;c<a;++c)s[c]=o[c];return new Lt(s,this._parents)}function yk(){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 gk(e){e||(e=bk);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}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 Lt(a,this._parents).order()}function bk(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function _k(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function kk(){return Array.from(this)}function Ek(){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 Nk(){let e=0;for(const n of this)++e;return e}function wk(){return!this.node()}function Ik(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 vk(e){return function(){this.removeAttribute(e)}}function Ck(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Sk(e,n){return function(){this.setAttribute(e,n)}}function xk(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function Rk(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Ak(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 $k(e,n){var o=Sa(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?Ck:vk:typeof n=="function"?o.local?Ak:Rk:o.local?xk:Sk)(o,n))}function Gu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Tk(e){return function(){this.style.removeProperty(e)}}function Mk(e,n,o){return function(){this.style.setProperty(e,n,o)}}function Vk(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function Bk(e,n,o){return arguments.length>1?this.each((n==null?Tk:typeof n=="function"?Vk:Mk)(e,n,o??"")):Do(this.node(),e)}function Do(e,n){return e.style.getPropertyValue(n)||Gu(e).getComputedStyle(e,null).getPropertyValue(n)}function Dk(e){return function(){delete this[e]}}function Ok(e,n){return function(){this[e]=n}}function Lk(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function Pk(e,n){return arguments.length>1?this.each((n==null?Dk:typeof n=="function"?Lk:Ok)(e,n)):this.node()[e]}function Yu(e){return e.trim().split(/^|\s+/)}function Bl(e){return e.classList||new qu(e)}function qu(e){this._node=e,this._names=Yu(e.getAttribute("class")||"")}qu.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 Wu(e,n){for(var o=Bl(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Ju(e,n){for(var o=Bl(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function zk(e){return function(){Wu(this,e)}}function Fk(e){return function(){Ju(this,e)}}function Uk(e,n){return function(){(n.apply(this,arguments)?Wu:Ju)(this,e)}}function Hk(e,n){var o=Yu(e+"");if(arguments.length<2){for(var i=Bl(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?Uk:n?zk:Fk)(o,n))}function jk(){this.textContent=""}function Kk(e){return function(){this.textContent=e}}function Gk(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function Yk(e){return arguments.length?this.each(e==null?jk:(typeof e=="function"?Gk:Kk)(e)):this.node().textContent}function qk(){this.innerHTML=""}function Wk(e){return function(){this.innerHTML=e}}function Jk(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function Xk(e){return arguments.length?this.each(e==null?qk:(typeof e=="function"?Jk:Wk)(e)):this.node().innerHTML}function Zk(){this.nextSibling&&this.parentNode.appendChild(this)}function Qk(){return this.each(Zk)}function eE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tE(){return this.each(eE)}function nE(e){var n=typeof e=="function"?e:Fu(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function oE(){return null}function iE(e,n){var o=typeof e=="function"?e:Fu(e),i=n==null?oE:typeof n=="function"?n:Vl(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function aE(){var e=this.parentNode;e&&e.removeChild(this)}function rE(){return this.each(aE)}function lE(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function sE(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function cE(e){return this.select(e?sE:lE)}function dE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function uE(e){return function(n){e.call(this,n,this.__data__)}}function mE(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 fE(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 pE(e,n,o){return function(){var i=this.__on,a,r=uE(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 hE(e,n,o){var i=mE(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?pE:fE,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Xu(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 yE(e,n){return function(){return Xu(this,e,n)}}function gE(e,n){return function(){return Xu(this,e,n.apply(this,arguments))}}function bE(e,n){return this.each((typeof n=="function"?gE:yE)(e,n))}function*_E(){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 Zu=[null];function Lt(e,n){this._groups=e,this._parents=n}function pi(){return new Lt([[document.documentElement]],Zu)}function kE(){return this}Lt.prototype=pi.prototype={constructor:Lt,select:G_,selectAll:J_,selectChild:ek,selectChildren:ik,filter:ak,data:uk,enter:rk,exit:fk,join:pk,merge:hk,selection:kE,order:yk,sort:gk,call:_k,nodes:kk,node:Ek,size:Nk,empty:wk,each:Ik,attr:$k,style:Bk,property:Pk,classed:Hk,text:Yk,html:Xk,raise:Qk,lower:tE,append:nE,insert:iE,remove:rE,clone:cE,datum:dE,on:hE,dispatch:bE,[Symbol.iterator]:_E};function jt(e){return typeof e=="string"?new Lt([[document.querySelector(e)]],[document.documentElement]):new Lt([[e]],Zu)}function EE(e){let n;for(;n=e.sourceEvent;)e=n;return e}function an(e,n){if(e=EE(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 NE={passive:!1},hi={capture:!0,passive:!1};function Dl(e){e.stopImmediatePropagation()}function Oo(e){e.preventDefault(),e.stopImmediatePropagation()}function Qu(e){var n=e.document.documentElement,o=jt(e).on("dragstart.drag",Oo,hi);"onselectstart"in n?o.on("selectstart.drag",Oo,hi):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function em(e,n){var o=e.document.documentElement,i=jt(e).on("dragstart.drag",null);n&&(i.on("click.drag",Oo,hi),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 Ra=e=>()=>e;function Ol(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}})}Ol.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function wE(e){return!e.ctrlKey&&!e.button}function IE(){return this.parentNode}function vE(e,n){return n??{x:e.x,y:e.y}}function CE(){return navigator.maxTouchPoints||"ontouchstart"in this}function SE(){var e=wE,n=IE,o=vE,i=CE,a={},r=va("start","drag","end"),l=0,s,c,d,u,m=0;function p(N){N.on("mousedown.drag",f).filter(i).on("touchstart.drag",g).on("touchmove.drag",b,NE).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(N,w){if(!(u||!e.call(this,N,w))){var C=h(this,n.call(this,N,w),N,w,"mouse");C&&(jt(N.view).on("mousemove.drag",y,hi).on("mouseup.drag",_,hi),Qu(N.view),Dl(N),d=!1,s=N.clientX,c=N.clientY,C("start",N))}}function y(N){if(Oo(N),!d){var w=N.clientX-s,C=N.clientY-c;d=w*w+C*C>m}a.mouse("drag",N)}function _(N){jt(N.view).on("mousemove.drag mouseup.drag",null),em(N.view,d),Oo(N),a.mouse("end",N)}function g(N,w){if(e.call(this,N,w)){var C=N.changedTouches,S=n.call(this,N,w),V=C.length,$,R;for($=0;$<V;++$)(R=h(this,S,N,w,C[$].identifier,C[$]))&&(Dl(N),R("start",N,C[$]))}}function b(N){var w=N.changedTouches,C=w.length,S,V;for(S=0;S<C;++S)(V=a[w[S].identifier])&&(Oo(N),V("drag",N,w[S]))}function E(N){var w=N.changedTouches,C=w.length,S,V;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),S=0;S<C;++S)(V=a[w[S].identifier])&&(Dl(N),V("end",N,w[S]))}function h(N,w,C,S,V,$){var R=r.copy(),x=an($||C,w),T,M,k;if((k=o.call(N,new Ol("beforestart",{sourceEvent:C,target:p,identifier:V,active:l,x:x[0],y:x[1],dx:0,dy:0,dispatch:R}),S))!=null)return T=k.x-x[0]||0,M=k.y-x[1]||0,function v(I,O,A){var L=x,H;switch(I){case"start":a[V]=v,H=l++;break;case"end":delete a[V],--l;case"drag":x=an(A||O,w),H=l;break}R.call(I,N,new Ol(I,{sourceEvent:O,subject:k,target:p,identifier:V,active:H,x:x[0]+T,y:x[1]+M,dx:x[0]-L[0],dy:x[1]-L[1],dispatch:R}),S)}}return p.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Ra(!!N),p):e},p.container=function(N){return arguments.length?(n=typeof N=="function"?N:Ra(N),p):n},p.subject=function(N){return arguments.length?(o=typeof N=="function"?N:Ra(N),p):o},p.touchable=function(N){return arguments.length?(i=typeof N=="function"?N:Ra(!!N),p):i},p.on=function(){var N=r.on.apply(r,arguments);return N===r?p:N},p.clickDistance=function(N){return arguments.length?(m=(N=+N)*N,p):Math.sqrt(m)},p}function Ll(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function tm(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function yi(){}var gi=.7,Aa=1/gi,Lo="\\s*([+-]?\\d+)\\s*",bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xE=/^#([0-9a-f]{3,8})$/,RE=new RegExp(`^rgb\\(${Lo},${Lo},${Lo}\\)$`),AE=new RegExp(`^rgb\\(${rn},${rn},${rn}\\)$`),$E=new RegExp(`^rgba\\(${Lo},${Lo},${Lo},${bi}\\)$`),TE=new RegExp(`^rgba\\(${rn},${rn},${rn},${bi}\\)$`),ME=new RegExp(`^hsl\\(${bi},${rn},${rn}\\)$`),VE=new RegExp(`^hsla\\(${bi},${rn},${rn},${bi}\\)$`),nm={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};Ll(yi,eo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:om,formatHex:om,formatHex8:BE,formatHsl:DE,formatRgb:im,toString:im});function om(){return this.rgb().formatHex()}function BE(){return this.rgb().formatHex8()}function DE(){return cm(this).formatHsl()}function im(){return this.rgb().formatRgb()}function eo(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=xE.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?am(n):o===3?new Vt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?$a(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?$a(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=RE.exec(e))?new Vt(n[1],n[2],n[3],1):(n=AE.exec(e))?new Vt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=$E.exec(e))?$a(n[1],n[2],n[3],n[4]):(n=TE.exec(e))?$a(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=ME.exec(e))?sm(n[1],n[2]/100,n[3]/100,1):(n=VE.exec(e))?sm(n[1],n[2]/100,n[3]/100,n[4]):nm.hasOwnProperty(e)?am(nm[e]):e==="transparent"?new Vt(NaN,NaN,NaN,0):null}function am(e){return new Vt(e>>16&255,e>>8&255,e&255,1)}function $a(e,n,o,i){return i<=0&&(e=n=o=NaN),new Vt(e,n,o,i)}function OE(e){return e instanceof yi||(e=eo(e)),e?(e=e.rgb(),new Vt(e.r,e.g,e.b,e.opacity)):new Vt}function Pl(e,n,o,i){return arguments.length===1?OE(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}Ll(Vt,Pl,tm(yi,{brighter(e){return e=e==null?Aa:Math.pow(Aa,e),new Vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gi:Math.pow(gi,e),new Vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vt(to(this.r),to(this.g),to(this.b),Ta(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:rm,formatHex:rm,formatHex8:LE,formatRgb:lm,toString:lm}));function rm(){return`#${no(this.r)}${no(this.g)}${no(this.b)}`}function LE(){return`#${no(this.r)}${no(this.g)}${no(this.b)}${no((isNaN(this.opacity)?1:this.opacity)*255)}`}function lm(){const e=Ta(this.opacity);return`${e===1?"rgb(":"rgba("}${to(this.r)}, ${to(this.g)}, ${to(this.b)}${e===1?")":`, ${e})`}`}function Ta(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function to(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function no(e){return e=to(e),(e<16?"0":"")+e.toString(16)}function sm(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Kt(e,n,o,i)}function cm(e){if(e instanceof Kt)return new Kt(e.h,e.s,e.l,e.opacity);if(e instanceof yi||(e=eo(e)),!e)return new Kt;if(e instanceof Kt)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 Kt(l,s,c,e.opacity)}function PE(e,n,o,i){return arguments.length===1?cm(e):new Kt(e,n,o,i??1)}function Kt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}Ll(Kt,PE,tm(yi,{brighter(e){return e=e==null?Aa:Math.pow(Aa,e),new Kt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gi:Math.pow(gi,e),new Kt(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(zl(e>=240?e-240:e+120,a,i),zl(e,a,i),zl(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Kt(dm(this.h),Ma(this.s),Ma(this.l),Ta(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=Ta(this.opacity);return`${e===1?"hsl(":"hsla("}${dm(this.h)}, ${Ma(this.s)*100}%, ${Ma(this.l)*100}%${e===1?")":`, ${e})`}`}}));function dm(e){return e=(e||0)%360,e<0?e+360:e}function Ma(e){return Math.max(0,Math.min(1,e||0))}function zl(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 Fl=e=>()=>e;function zE(e,n){return function(o){return e+o*n}}function FE(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 UE(e){return(e=+e)==1?um:function(n,o){return o-n?FE(n,o,e):Fl(isNaN(n)?o:n)}}function um(e,n){var o=n-e;return o?zE(e,o):Fl(isNaN(e)?n:e)}const Va=(function e(n){var o=UE(n);function i(a,r){var l=o((a=Pl(a)).r,(r=Pl(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=um(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 HE(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 jE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function KE(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]=_i(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 ln(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}function YE(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]=_i(e[a],n[a]):i[a]=n[a];return function(r){for(a in o)i[a]=o[a](r);return i}}var Ul=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hl=new RegExp(Ul.source,"g");function qE(e){return function(){return e}}function WE(e){return function(n){return e(n)+""}}function mm(e,n){var o=Ul.lastIndex=Hl.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=Ul.exec(e))&&(a=Hl.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:ln(i,a)})),o=Hl.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?WE(c[0].x):qE(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 _i(e,n){var o=typeof n,i;return n==null||o==="boolean"?Fl(n):(o==="number"?ln:o==="string"?(i=eo(n))?(n=i,Va):mm:n instanceof eo?Va:n instanceof Date?GE:jE(n)?HE:Array.isArray(n)?KE:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?YE:ln)(e,n)}var fm=180/Math.PI,jl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pm(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)*fm,skewX:Math.atan(c)*fm,scaleX:l,scaleY:s}}var Ba;function JE(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?jl:pm(n.a,n.b,n.c,n.d,n.e,n.f)}function XE(e){return e==null||(Ba||(Ba=document.createElementNS("http://www.w3.org/2000/svg","g")),Ba.setAttribute("transform",e),!(e=Ba.transform.baseVal.consolidate()))?jl:(e=e.matrix,pm(e.a,e.b,e.c,e.d,e.e,e.f))}function hm(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,y){if(d!==m||u!==p){var _=f.push("translate(",null,n,null,o);y.push({i:_-4,x:ln(d,m)},{i:_-2,x:ln(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:ln(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:ln(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,y){if(d!==m||u!==p){var _=f.push(a(f)+"scale(",null,",",null,")");y.push({i:_-4,x:ln(d,m)},{i:_-2,x:ln(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var y=-1,_=p.length,g;++y<_;)m[(g=p[y]).i]=g.x(f);return m.join("")}}}var ZE=hm(JE,"px, ","px)","deg)"),QE=hm(XE,", ",")",")"),e1=1e-12;function ym(e){return((e=Math.exp(e))+1/e)/2}function t1(e){return((e=Math.exp(e))-1/e)/2}function n1(e){return((e=Math.exp(2*e))-1)/(e+1)}const Da=(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],p=l[2],f=u-s,y=m-c,_=f*f+y*y,g,b;if(_<e1)b=Math.log(p/d)/n,g=function(S){return[s+S*f,c+S*y,d*Math.exp(n*S*b)]};else{var E=Math.sqrt(_),h=(p*p-d*d+i*_)/(2*d*o*E),N=(p*p-d*d-i*_)/(2*p*o*E),w=Math.log(Math.sqrt(h*h+1)-h),C=Math.log(Math.sqrt(N*N+1)-N);b=(C-w)/n,g=function(S){var V=S*b,$=ym(w),R=d/(o*E)*($*n1(n*V+w)-t1(w));return[s+R*f,c+R*y,d*$/ym(n*V+w)]}}return g.duration=b*1e3*n/Math.SQRT2,g}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 Po=0,ki=0,Ei=0,gm=1e3,Oa,Ni,La=0,oo=0,Pa=0,wi=typeof performance=="object"&&performance.now?performance:Date,bm=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kl(){return oo||(bm(o1),oo=wi.now()+Pa)}function o1(){oo=0}function za(){this._call=this._time=this._next=null}za.prototype=_m.prototype={constructor:za,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Kl():+o)+(n==null?0:+n),!this._next&&Ni!==this&&(Ni?Ni._next=this:Oa=this,Ni=this),this._call=e,this._time=o,Gl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gl())}};function _m(e,n,o){var i=new za;return i.restart(e,n,o),i}function i1(){Kl(),++Po;for(var e=Oa,n;e;)(n=oo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Po}function km(){oo=(La=wi.now())+Pa,Po=ki=0;try{i1()}finally{Po=0,r1(),oo=0}}function a1(){var e=wi.now(),n=e-La;n>gm&&(Pa-=n,La=e)}function r1(){for(var e,n=Oa,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:Oa=o);Ni=e,Gl(i)}function Gl(e){if(!Po){ki&&(ki=clearTimeout(ki));var n=e-oo;n>24?(e<1/0&&(ki=setTimeout(km,e-wi.now()-Pa)),Ei&&(Ei=clearInterval(Ei))):(Ei||(La=wi.now(),Ei=setInterval(a1,gm)),Po=1,bm(km))}}function Em(e,n,o){var i=new za;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var l1=va("start","end","cancel","interrupt"),s1=[],Nm=0,wm=1,Yl=2,Fa=3,Im=4,ql=5,Ua=6;function Ha(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;c1(e,o,{name:n,index:i,group:a,on:l1,tween:s1,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Nm})}function Wl(e,n){var o=Gt(e,n);if(o.state>Nm)throw new Error("too late; already scheduled");return o}function sn(e,n){var o=Gt(e,n);if(o.state>Fa)throw new Error("too late; already running");return o}function Gt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function c1(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=_m(r,0,o.time);function r(d){o.state=wm,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==wm)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Fa)return Em(l);f.state===Im?(f.state=Ua,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Ua,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(Em(function(){o.state===Fa&&(o.state=Im,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Yl,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Yl){for(o.state=Fa,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);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=ql,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===ql&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Ua,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function ja(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>Yl&&i.state<ql,i.state=Ua,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function d1(e){return this.each(function(){ja(this,e)})}function u1(e,n){var o,i;return function(){var a=sn(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 m1(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=sn(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 f1(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Gt(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?u1:m1)(o,e,n))}function Jl(e,n,o){var i=e._id;return e.each(function(){var a=sn(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Gt(a,i).value[n]}}function vm(e,n){var o;return(typeof n=="number"?ln:n instanceof eo?Va:(o=eo(n))?(n=o,Va):mm)(e,n)}function p1(e){return function(){this.removeAttribute(e)}}function h1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function y1(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 g1(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 b1(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 _1(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 k1(e,n){var o=Sa(e),i=o==="transform"?QE:vm;return this.attrTween(e,typeof n=="function"?(o.local?_1:b1)(o,i,Jl(this,"attr."+e,n)):n==null?(o.local?h1:p1)(o):(o.local?g1:y1)(o,i,n))}function E1(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function N1(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function w1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&N1(e,r)),o}return a._value=n,a}function I1(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&E1(e,r)),o}return a._value=n,a}function v1(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=Sa(e);return this.tween(o,(i.local?w1:I1)(i,n))}function C1(e,n){return function(){Wl(this,e).delay=+n.apply(this,arguments)}}function S1(e,n){return n=+n,function(){Wl(this,e).delay=n}}function x1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?C1:S1)(n,e)):Gt(this.node(),n).delay}function R1(e,n){return function(){sn(this,e).duration=+n.apply(this,arguments)}}function A1(e,n){return n=+n,function(){sn(this,e).duration=n}}function $1(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?R1:A1)(n,e)):Gt(this.node(),n).duration}function T1(e,n){if(typeof n!="function")throw new Error;return function(){sn(this,e).ease=n}}function M1(e){var n=this._id;return arguments.length?this.each(T1(n,e)):Gt(this.node(),n).ease}function V1(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;sn(this,e).ease=o}}function B1(e){if(typeof e!="function")throw new Error;return this.each(V1(this._id,e))}function D1(e){typeof e!="function"&&(e=Hu(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 bn(i,this._parents,this._name,this._id)}function O1(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),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new bn(l,this._parents,this._name,this._id)}function L1(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 P1(e,n,o){var i,a,r=L1(n)?Wl:sn;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function z1(e,n){var o=this._id;return arguments.length<2?Gt(this.node(),o).on.on(e):this.each(P1(o,e,n))}function F1(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function U1(){return this.on("end.remove",F1(this._id))}function H1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Vl(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,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,Ha(d[p],n,o,p,d,Gt(u,o)));return new bn(r,this._parents,n,o)}function j1(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Uu(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 p=e.call(u,u.__data__,m,c),f,y=Gt(u,o),_=0,g=p.length;_<g;++_)(f=p[_])&&Ha(f,n,o,_,p,y);r.push(p),l.push(u)}return new bn(r,l,n,o)}var K1=pi.prototype.constructor;function G1(){return new K1(this._groups,this._parents)}function Y1(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 Cm(e){return function(){this.style.removeProperty(e)}}function q1(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 W1(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 J1(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=sn(this,e),d=c.on,u=c.value[r]==null?s||(s=Cm(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function X1(e,n,o){var i=(e+="")=="transform"?ZE:vm;return n==null?this.styleTween(e,Y1(e,i)).on("end.style."+e,Cm(e)):typeof n=="function"?this.styleTween(e,W1(e,i,Jl(this,"style."+e,n))).each(J1(this._id,e)):this.styleTween(e,q1(e,i,n),o).on("end.style."+e,null)}function Z1(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function Q1(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&Z1(e,l,o)),i}return r._value=n,r}function e0(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,Q1(e,n,o??""))}function t0(e){return function(){this.textContent=e}}function n0(e){return function(){var n=e(this);this.textContent=n??""}}function o0(e){return this.tween("text",typeof e=="function"?n0(Jl(this,"text",e)):t0(e==null?"":e+""))}function i0(e){return function(n){this.textContent=e.call(this,n)}}function a0(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&i0(a)),n}return i._value=e,i}function r0(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,a0(e))}function l0(){for(var e=this._name,n=this._id,o=Sm(),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=Gt(c,n);Ha(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new bn(i,this._parents,e,o)}function s0(){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=sn(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 c0=0;function bn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Sm(){return++c0}var _n=pi.prototype;bn.prototype={constructor:bn,select:H1,selectAll:j1,selectChild:_n.selectChild,selectChildren:_n.selectChildren,filter:D1,merge:O1,selection:G1,transition:l0,call:_n.call,nodes:_n.nodes,node:_n.node,size:_n.size,empty:_n.empty,each:_n.each,on:z1,attr:k1,attrTween:v1,style:X1,styleTween:e0,text:o0,textTween:r0,remove:U1,tween:f1,delay:x1,duration:$1,ease:M1,easeVarying:B1,end:s0,[Symbol.iterator]:_n[Symbol.iterator]};function d0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var u0={time:null,delay:0,duration:250,ease:d0};function m0(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 f0(e){var n,o;e instanceof bn?(n=e._id,e=e._name):(n=Sm(),(o=u0).time=Kl(),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])&&Ha(c,e,n,d,l,o||m0(c,n));return new bn(i,this._parents,e,n)}pi.prototype.interrupt=d1,pi.prototype.transition=f0;const Ka=e=>()=>e;function p0(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 kn(e,n,o){this.k=e,this.x=n,this.y=o}kn.prototype={constructor:kn,scale:function(e){return e===1?this:new kn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new kn(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 zo=new kn(1,0,0);kn.prototype;function Xl(e){e.stopImmediatePropagation()}function Ii(e){e.preventDefault(),e.stopImmediatePropagation()}function h0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function y0(){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 xm(){return this.__zoom||zo}function g0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function b0(){return navigator.maxTouchPoints||"ontouchstart"in this}function _0(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 k0(){var e=h0,n=y0,o=_0,i=g0,a=b0,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Da,d=va("start","zoom","end"),u,m,p,f=500,y=150,_=0,g=10;function b(k){k.property("__zoom",xm).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",x).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(k,v,I,O){var A=k.selection?k.selection():k;A.property("__zoom",xm),k!==A?w(k,v,I,O):A.interrupt().each(function(){C(this,arguments).event(O).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},b.scaleBy=function(k,v,I,O){b.scaleTo(k,function(){var A=this.__zoom.k,L=typeof v=="function"?v.apply(this,arguments):v;return A*L},I,O)},b.scaleTo=function(k,v,I,O){b.transform(k,function(){var A=n.apply(this,arguments),L=this.__zoom,H=I==null?N(A):typeof I=="function"?I.apply(this,arguments):I,oe=L.invert(H),ue=typeof v=="function"?v.apply(this,arguments):v;return o(h(E(L,ue),H,oe),A,l)},I,O)},b.translateBy=function(k,v,I,O){b.transform(k,function(){return o(this.__zoom.translate(typeof v=="function"?v.apply(this,arguments):v,typeof I=="function"?I.apply(this,arguments):I),n.apply(this,arguments),l)},null,O)},b.translateTo=function(k,v,I,O,A){b.transform(k,function(){var L=n.apply(this,arguments),H=this.__zoom,oe=O==null?N(L):typeof O=="function"?O.apply(this,arguments):O;return o(zo.translate(oe[0],oe[1]).scale(H.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof I=="function"?-I.apply(this,arguments):-I),L,l)},O,A)};function E(k,v){return v=Math.max(r[0],Math.min(r[1],v)),v===k.k?k:new kn(v,k.x,k.y)}function h(k,v,I){var O=v[0]-I[0]*k.k,A=v[1]-I[1]*k.k;return O===k.x&&A===k.y?k:new kn(k.k,O,A)}function N(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function w(k,v,I,O){k.on("start.zoom",function(){C(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(O).end()}).tween("zoom",function(){var A=this,L=arguments,H=C(A,L).event(O),oe=n.apply(A,L),ue=I==null?N(oe):typeof I=="function"?I.apply(A,L):I,be=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),pe=A.__zoom,he=typeof v=="function"?v.apply(A,L):v,_e=c(pe.invert(ue).concat(be/pe.k),he.invert(ue).concat(be/he.k));return function(ye){if(ye===1)ye=he;else{var Ae=_e(ye),Fe=be/Ae[2];ye=new kn(Fe,ue[0]-Ae[0]*Fe,ue[1]-Ae[1]*Fe)}H.zoom(null,ye)}})}function C(k,v,I){return!I&&k.__zooming||new S(k,v)}function S(k,v){this.that=k,this.args=v,this.active=0,this.sourceEvent=null,this.extent=n.apply(k,v),this.taps=0}S.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,v){return this.mouse&&k!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=v.invert(this.touch1[0])),this.that.__zoom=v,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var v=jt(this.that).datum();d.call(k,this.that,new p0(k,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),v)}};function V(k,...v){if(!e.apply(this,arguments))return;var I=C(this,v).event(k),O=this.__zoom,A=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),L=an(k);if(I.wheel)(I.mouse[0][0]!==L[0]||I.mouse[0][1]!==L[1])&&(I.mouse[1]=O.invert(I.mouse[0]=L)),clearTimeout(I.wheel);else{if(O.k===A)return;I.mouse=[L,O.invert(L)],ja(this),I.start()}Ii(k),I.wheel=setTimeout(H,y),I.zoom("mouse",o(h(E(O,A),I.mouse[0],I.mouse[1]),I.extent,l));function H(){I.wheel=null,I.end()}}function $(k,...v){if(p||!e.apply(this,arguments))return;var I=k.currentTarget,O=C(this,v,!0).event(k),A=jt(k.view).on("mousemove.zoom",ue,!0).on("mouseup.zoom",be,!0),L=an(k,I),H=k.clientX,oe=k.clientY;Qu(k.view),Xl(k),O.mouse=[L,this.__zoom.invert(L)],ja(this),O.start();function ue(pe){if(Ii(pe),!O.moved){var he=pe.clientX-H,_e=pe.clientY-oe;O.moved=he*he+_e*_e>_}O.event(pe).zoom("mouse",o(h(O.that.__zoom,O.mouse[0]=an(pe,I),O.mouse[1]),O.extent,l))}function be(pe){A.on("mousemove.zoom mouseup.zoom",null),em(pe.view,O.moved),Ii(pe),O.event(pe).end()}}function R(k,...v){if(e.apply(this,arguments)){var I=this.__zoom,O=an(k.changedTouches?k.changedTouches[0]:k,this),A=I.invert(O),L=I.k*(k.shiftKey?.5:2),H=o(h(E(I,L),O,A),n.apply(this,v),l);Ii(k),s>0?jt(this).transition().duration(s).call(w,H,O,k):jt(this).call(b.transform,H,O,k)}}function x(k,...v){if(e.apply(this,arguments)){var I=k.touches,O=I.length,A=C(this,v,k.changedTouches.length===O).event(k),L,H,oe,ue;for(Xl(k),H=0;H<O;++H)oe=I[H],ue=an(oe,this),ue=[ue,this.__zoom.invert(ue),oe.identifier],A.touch0?!A.touch1&&A.touch0[2]!==ue[2]&&(A.touch1=ue,A.taps=0):(A.touch0=ue,L=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),L&&(A.taps<2&&(m=ue[0],u=setTimeout(function(){u=null},f)),ja(this),A.start())}}function T(k,...v){if(this.__zooming){var I=C(this,v).event(k),O=k.changedTouches,A=O.length,L,H,oe,ue;for(Ii(k),L=0;L<A;++L)H=O[L],oe=an(H,this),I.touch0&&I.touch0[2]===H.identifier?I.touch0[0]=oe:I.touch1&&I.touch1[2]===H.identifier&&(I.touch1[0]=oe);if(H=I.that.__zoom,I.touch1){var be=I.touch0[0],pe=I.touch0[1],he=I.touch1[0],_e=I.touch1[1],ye=(ye=he[0]-be[0])*ye+(ye=he[1]-be[1])*ye,Ae=(Ae=_e[0]-pe[0])*Ae+(Ae=_e[1]-pe[1])*Ae;H=E(H,Math.sqrt(ye/Ae)),oe=[(be[0]+he[0])/2,(be[1]+he[1])/2],ue=[(pe[0]+_e[0])/2,(pe[1]+_e[1])/2]}else if(I.touch0)oe=I.touch0[0],ue=I.touch0[1];else return;I.zoom("touch",o(h(H,oe,ue),I.extent,l))}}function M(k,...v){if(this.__zooming){var I=C(this,v).event(k),O=k.changedTouches,A=O.length,L,H;for(Xl(k),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),L=0;L<A;++L)H=O[L],I.touch0&&I.touch0[2]===H.identifier?delete I.touch0:I.touch1&&I.touch1[2]===H.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(H=an(H,this),Math.hypot(m[0]-H[0],m[1]-H[1])<g)){var oe=jt(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return b.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Ka(+k),b):i},b.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ka(!!k),b):e},b.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:Ka(!!k),b):a},b.extent=function(k){return arguments.length?(n=typeof k=="function"?k:Ka([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),b):n},b.scaleExtent=function(k){return arguments.length?(r[0]=+k[0],r[1]=+k[1],b):[r[0],r[1]]},b.translateExtent=function(k){return arguments.length?(l[0][0]=+k[0][0],l[1][0]=+k[1][0],l[0][1]=+k[0][1],l[1][1]=+k[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(k){return arguments.length?(o=k,b):o},b.duration=function(k){return arguments.length?(s=+k,b):s},b.interpolate=function(k){return arguments.length?(c=k,b):c},b.on=function(){var k=d.on.apply(d,arguments);return k===d?b:k},b.clickDistance=function(k){return arguments.length?(_=(k=+k)*k,b):Math.sqrt(_)},b.tapDistance=function(k){return arguments.length?(g=+k,b):g},b}var De=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(De||{}),Zl=(e=>(e.Partial="partial",e.Full="full",e))(Zl||{}),io=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(io||{}),En=(e=>(e.Strict="strict",e.Loose="loose",e))(En||{}),Ql=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Ql||{}),vi=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(vi||{}),Rm=(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))(Rm||{});const E0=["INPUT","SELECT","TEXTAREA"],N0=typeof document<"u"?document:null;function es(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 E0.includes(i==null?void 0:i.nodeName)||a||!!r}function w0(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Am(e,n,o,i){const a=n.replace("+",`
|
|
28
28
|
`).replace(`
|
|
29
29
|
|
|
30
30
|
`,`
|
|
31
31
|
+`).split(`
|
|
32
|
-
`).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===n.toLowerCase();i||o.add(e.toLowerCase());const r=a.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),r}function b0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=_0(o.code,e);return Array.isArray(e)?e.some(a=>ym(o[i],a,n,o.type==="keyup")):ym(o[i],e,n,o.type==="keyup")}}function _0(e,n){return n.includes(e)?"code":"key"}function yi(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??y0),i=t.shallowRef(t.toValue(e)===!0);let a=!1;const r=new Set;let l=c(t.toValue(e));t.watch(()=>t.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),wu(["blur","contextmenu"],s),Iu((...d)=>l(...d),d=>{var u,m;const h=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,f=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=g0(d),(!a||a&&!h)&&Ll(d))return;const g=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,_=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";!f&&(a||!_)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Iu((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&Ll(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.clear(),i.value=t.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?b0(d,r):d}return i}const gm="vue-flow__node-desc",bm="vue-flow__edge-desc",k0="vue-flow__aria-live",_m=["Enter"," ","Escape"],Ao={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Va(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Ba(e,n){const o=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(o*i)}function Da(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Wn(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function km(e,n){return{x:Wn(e.x,n[0][0],n[1][0]),y:Wn(e.y,n[0][1],n[1][1])}}function Em(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function xn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Jn(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!xn(e)}function gi(e){return Jn(e)&&"computedPosition"in e}function Oa(e){return!Number.isNaN(e)&&Number.isFinite(e)}function E0(e){return Oa(e.width)&&Oa(e.height)&&Oa(e.x)&&Oa(e.y)}function N0(e,n,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function Nm(e,n,o){var i,a;const r={id:e.id.toString(),type:e.type??(n==null?void 0:n.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:ct(e.data)?e.data:{},events:t.markRaw(ct(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??r,e,{id:e.id.toString()})}function wm(e,n,o,i){const a=typeof e=="string"?e:e.id,r=new Set,l=i==="source"?"target":"source";for(const s of o)s[l]===a&&r.add(s[i]);return n.filter(s=>r.has(s.id))}function w0(...e){if(e.length===3){const[r,l,s]=e;return wm(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>xn(r)&&r.source===i).map(r=>o.find(l=>Jn(l)&&l.id===r.target))}function I0(...e){if(e.length===3){const[r,l,s]=e;return wm(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>xn(r)&&r.target===i).map(r=>o.find(l=>Jn(l)&&l.id===r.source))}function Im({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function v0(e,n){return n.some(o=>xn(o)&&o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle))}function bi({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function _i({x:e,y:n},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(n-i)/a};return r?Pa(s,l):s}function vm(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}}function La({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function Cm({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function C0(e,n){return Cm(vm(La(e),La(n)))}function Pl(e){let n={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const i=e[o];n=vm(n,La({...i.computedPosition,...i.dimensions}))}return Cm(n)}function xm(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={..._i(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,m=c.width??s.width??null,h=c.height??s.height??null;if(a&&!d||u)continue;const f=Ba(r,Va(s)),y=m===null||h===null,g=i&&f>0,_=(m??0)*(h??0);(y||g||f>=_||s.dragging)&&l.push(s)}return l}function Xn(e,n){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return n.filter(i=>o.has(i.source)||o.has(i.target))}function $o(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(n*o*.01)}return Ni(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function x0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=$o(e,o),a=$o(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=$o(e.top??e.y??0,o),a=$o(e.bottom??e.y??0,o),r=$o(e.left??e.x??0,n),l=$o(e.right??e.x??0,n);return{top:i,right:l,bottom:a,left:r,x:r+l,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function S0(e,n,o,i,a,r){const{x:l,y:s}=bi(e,{x:n,y:o,zoom:i}),{x:c,y:d}=bi({x:e.x+e.width,y:e.y+e.height},{x:n,y:o,zoom:i}),u=a-c,m=r-d;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(m)}}function Sm(e,n,o,i,a,r=.1){const l=x0(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=Wn(d,i,a),m=e.x+e.width/2,h=e.y+e.height/2,f=n/2-m*u,y=o/2-h*u,g=S0(e,f,y,u,n,o),_={left:Math.min(g.left-l.left,0),top:Math.min(g.top-l.top,0),right:Math.min(g.right-l.right,0),bottom:Math.min(g.bottom-l.bottom,0)};return{x:f-_.left+_.right,y:y-_.top+_.bottom,zoom:u}}function R0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function Rm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:Rm(o,n):!1}function ki(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function zl(e){const n=e.ctrlKey&&Ei()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function Am(e,n,o){return e<n?Wn(Math.abs(e-n),1,n)/n:e>o?-Wn(Math.abs(e-o),1,n)/n:0}function $m(e,n,o=15,i=40){const a=Am(e.x,i,n.width-i)*o,r=Am(e.y,i,n.height-i)*o;return[a,r]}function Fl(e,n){if(n){const o=e.position.x+e.dimensions.width-n.dimensions.width,i=e.position.y+e.dimensions.height-n.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof n.style=="function"?a={...n.style(n)}:n.style&&(a={...n.style}),a.width=a.width??`${n.dimensions.width}px`,a.height=a.height??`${n.dimensions.height}px`,o>0)if(typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+i}px`}else a.height+=i;if(e.position.x<0){const r=Math.abs(e.position.x);if(n.position.x=n.position.x-r,typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+r}px`}else a.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(n.position.y=n.position.y-r,typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+r}px`}else a.height+=r;e.position.y=0}n.dimensions.width=Number(a.width.toString().replace("px","")),n.dimensions.height=Number(a.height.toString().replace("px","")),typeof n.style=="function"?n.style=r=>{const l=n.style;return{...l(r),...a}}:n.style={...n.style,...a}}}}function Tm(e,n){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const r=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(gi(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&gi(c)&&Fl(l,c)}break;case"dimensions":if(gi(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&gi(c)&&(!!c.dimensions.width&&!!c.dimensions.height?Fl(l,c):t.nextTick(()=>{Fl(l,c)}))}break}return n}function Sn(e,n){return{id:e,type:"select",selected:n}}function Mm(e){return{item:e,type:"add"}}function Vm(e){return{id:e,type:"remove"}}function Bm(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Rn(e,n=new Set,o=!1){const i=[];for(const[a,r]of e){const l=n.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(Sn(r.id,l)))}return i}const Dm=()=>{};function Re(e){const n=new Set;let o=Dm,i=()=>!1;const a=()=>n.size>0||i(),r=h=>{o=h},l=()=>{o=Dm},s=h=>{i=h},c=()=>{i=()=>!1},d=h=>{n.delete(h)};return{on:h=>{n.add(h);const f=()=>d(h);return oi(f),{off:f}},off:d,trigger:h=>{const f=[o];return a()?f.push(...n):e&&f.push(e),Promise.allSettled(f.map(y=>y(h)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function Om(e,n,o){let i=e;do{if(i&&i.matches(n))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function A0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Rm(c,e))&&(c.draggable||n&&typeof c.draggable>"u")&&e.get(s)&&l.set(s,{id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((r=c.computedPosition)==null?void 0:r.y)||0},from:{x:c.computedPosition.x,y:c.computedPosition.y},extent:c.extent,parentNode:c.parentNode,dimensions:{...c.dimensions},expandParent:c.expandParent});return Array.from(l.values())}function Ul({id:e,dragItems:n,findNode:o}){const i=[];for(const a of n){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function Lm(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function $0(e,n,o){const[i,a,r,l]=typeof e!="string"?Lm(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+l,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-r]]:!1}function T0(e,n,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const r=$0(a,e,i);r&&(a=r)}else n(new ft(st.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=Lm(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+u+r],[a.range[1][0]+d-l,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function M0({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function Hl(e,n,o,i,a){const r=M0(e.dimensions,T0(e,o,i,a)),l=km(n,r);return{position:{x:l.x-((a==null?void 0:a.computedPosition.x)||0),y:l.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:l}}function To(e,n,o=$e.Left,i=!1){const a=((n==null?void 0:n.x)??0)+e.computedPosition.x,r=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??O0(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case $e.Top:return{x:a+l/2,y:r};case $e.Right:return{x:a+l,y:r+s/2};case $e.Bottom:return{x:a+l/2,y:r+s};case $e.Left:return{x:a,y:r+s/2}}}function Pm(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function V0({sourcePos:e,targetPos:n,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+o,n.x+a),y2:Math.max(e.y+i,n.y+r)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=La({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),m=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),h=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*h)>0}function B0(e,n,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=n(e.source),l=n(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var st=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(st||{});const zm={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
32
|
+
`).map(l=>l.trim().toLowerCase());if(a.length===1)return e.toLowerCase()===n.toLowerCase();i||o.add(e.toLowerCase());const r=a.every((l,s)=>o.has(l)&&Array.from(o.values())[s]===a[s]);return i&&o.delete(e.toLowerCase()),r}function I0(e,n){return o=>{if(!o.code&&!o.key)return!1;const i=v0(o.code,e);return Array.isArray(e)?e.some(a=>Am(o[i],a,n,o.type==="keyup")):Am(o[i],e,n,o.type==="keyup")}}function v0(e,n){return n.includes(e)?"code":"key"}function Ci(e,n){const o=t.computed(()=>t.toValue(n==null?void 0:n.target)??N0),i=t.shallowRef(t.toValue(e)===!0);let a=!1;const r=new Set;let l=c(t.toValue(e));t.watch(()=>t.toValue(e),(d,u)=>{typeof u=="boolean"&&typeof d!="boolean"&&s(),l=c(d)},{immediate:!0}),Ou(["blur","contextmenu"],s),Lu((...d)=>l(...d),d=>{var u,m;const p=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0,f=t.toValue(n==null?void 0:n.preventDefault)??!1;if(a=w0(d),(!a||a&&!p)&&es(d))return;const _=((m=(u=d.composedPath)==null?void 0:u.call(d))==null?void 0:m[0])||d.target,g=(_==null?void 0:_.nodeName)==="BUTTON"||(_==null?void 0:_.nodeName)==="A";!f&&(a||!g)&&d.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),Lu((...d)=>l(...d),d=>{const u=t.toValue(n==null?void 0:n.actInsideInputWithModifier)??!0;if(i.value){if((!a||a&&!u)&&es(d))return;a=!1,i.value=!1}},{eventName:"keyup",target:o});function s(){a=!1,r.clear(),i.value=t.toValue(e)===!0}function c(d){return d===null?(s(),()=>!1):typeof d=="boolean"?(s(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?I0(d,r):d}return i}const $m="vue-flow__node-desc",Tm="vue-flow__edge-desc",C0="vue-flow__aria-live",Mm=["Enter"," ","Escape"],Fo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Ga(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Ya(e,n){const o=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(o*i)}function qa(e){return{width:e.offsetWidth,height:e.offsetHeight}}function ao(e,n=0,o=1){return Math.min(Math.max(e,n),o)}function Vm(e,n){return{x:ao(e.x,n[0][0],n[1][0]),y:ao(e.y,n[0][1],n[1][1])}}function Bm(e){const n=e.getRootNode();return"elementFromPoint"in n?n:window.document}function Dn(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function ro(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Dn(e)}function Si(e){return ro(e)&&"computedPosition"in e}function Wa(e){return!Number.isNaN(e)&&Number.isFinite(e)}function S0(e){return Wa(e.width)&&Wa(e.height)&&Wa(e.x)&&Wa(e.y)}function x0(e,n,o){const i={id:e.id.toString(),type:e.type??"default",dimensions:t.markRaw({width:0,height:0}),computedPosition:t.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:gt(e.data)?e.data:{},events:t.markRaw(gt(e.events)?e.events:{})};return Object.assign(n??i,e,{id:e.id.toString(),parentNode:o})}function Dm(e,n,o){var i,a;const r={id:e.id.toString(),type:e.type??(n==null?void 0:n.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(i=e.sourceHandle)==null?void 0:i.toString(),targetHandle:(a=e.targetHandle)==null?void 0:a.toString(),updatable:e.updatable??(o==null?void 0:o.updatable),selectable:e.selectable??(o==null?void 0:o.selectable),focusable:e.focusable??(o==null?void 0:o.focusable),data:gt(e.data)?e.data:{},events:t.markRaw(gt(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(o==null?void 0:o.interactionWidth),...o??{}};return Object.assign(n??r,e,{id:e.id.toString()})}function Om(e,n,o,i){const a=typeof e=="string"?e:e.id,r=new Set,l=i==="source"?"target":"source";for(const s of o)s[l]===a&&r.add(s[i]);return n.filter(s=>r.has(s.id))}function R0(...e){if(e.length===3){const[r,l,s]=e;return Om(r,l,s,"target")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>Dn(r)&&r.source===i).map(r=>o.find(l=>ro(l)&&l.id===r.target))}function A0(...e){if(e.length===3){const[r,l,s]=e;return Om(r,l,s,"source")}const[n,o]=e,i=typeof n=="string"?n:n.id;return o.filter(r=>Dn(r)&&r.target===i).map(r=>o.find(l=>ro(l)&&l.id===r.source))}function Lm({source:e,sourceHandle:n,target:o,targetHandle:i}){return`vueflow__edge-${e}${n??""}-${o}${i??""}`}function $0(e,n){return n.some(o=>Dn(o)&&o.source===e.source&&o.target===e.target&&(o.sourceHandle===e.sourceHandle||!o.sourceHandle&&!e.sourceHandle)&&(o.targetHandle===e.targetHandle||!o.targetHandle&&!e.targetHandle))}function xi({x:e,y:n},{x:o,y:i,zoom:a}){return{x:e*a+o,y:n*a+i}}function Ri({x:e,y:n},{x:o,y:i,zoom:a},r=!1,l=[1,1]){const s={x:(e-o)/a,y:(n-i)/a};return r?Xa(s,l):s}function Pm(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}}function Ja({x:e,y:n,width:o,height:i}){return{x:e,y:n,x2:e+o,y2:n+i}}function zm({x:e,y:n,x2:o,y2:i}){return{x:e,y:n,width:o-e,height:i-n}}function T0(e,n){return zm(Pm(Ja(e),Ja(n)))}function ts(e){let n={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let o=0;o<e.length;o++){const i=e[o];n=Pm(n,Ja({...i.computedPosition,...i.dimensions}))}return zm(n)}function Fm(e,n,o={x:0,y:0,zoom:1},i=!1,a=!1){const r={...Ri(n,o),width:n.width/o.zoom,height:n.height/o.zoom},l=[];for(const s of e){const{dimensions:c,selectable:d=!0,hidden:u=!1}=s,m=c.width??s.width??null,p=c.height??s.height??null;if(a&&!d||u)continue;const f=Ya(r,Ga(s)),y=m===null||p===null,_=i&&f>0,g=(m??0)*(p??0);(y||_||f>=g||s.dragging)&&l.push(s)}return l}function lo(e,n){const o=new Set;if(typeof e=="string")o.add(e);else if(e.length>=1)for(const i of e)o.add(i.id);return n.filter(i=>o.has(i.source)||o.has(i.target))}function Uo(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(o)}if(typeof e=="string"&&e.endsWith("%")){const o=Number.parseFloat(e);if(!Number.isNaN(o))return Math.floor(n*o*.01)}return Ti(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function M0(e,n,o){if(typeof e=="string"||typeof e=="number"){const i=Uo(e,o),a=Uo(e,n);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Uo(e.top??e.y??0,o),a=Uo(e.bottom??e.y??0,o),r=Uo(e.left??e.x??0,n),l=Uo(e.right??e.x??0,n);return{top:i,right:l,bottom:a,left:r,x:r+l,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function V0(e,n,o,i,a,r){const{x:l,y:s}=xi(e,{x:n,y:o,zoom:i}),{x:c,y:d}=xi({x:e.x+e.width,y:e.y+e.height},{x:n,y:o,zoom:i}),u=a-c,m=r-d;return{left:Math.floor(l),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(m)}}function Um(e,n,o,i,a,r=.1){const l=M0(r,n,o),s=(n-l.x)/e.width,c=(o-l.y)/e.height,d=Math.min(s,c),u=ao(d,i,a),m=e.x+e.width/2,p=e.y+e.height/2,f=n/2-m*u,y=o/2-p*u,_=V0(e,f,y,u,n,o),g={left:Math.min(_.left-l.left,0),top:Math.min(_.top-l.top,0),right:Math.min(_.right-l.right,0),bottom:Math.min(_.bottom-l.bottom,0)};return{x:f-g.left+g.right,y:y-g.top+g.bottom,zoom:u}}function B0(e,n){return{x:n.x+e.x,y:n.y+e.y,z:(e.z>n.z?e.z:n.z)+1}}function Hm(e,n){if(!e.parentNode)return!1;const o=n.get(e.parentNode);return o?o.selected?!0:Hm(o,n):!1}function Ai(e,n){return typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`}function ns(e){const n=e.ctrlKey&&$i()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n}function jm(e,n,o){return e<n?ao(Math.abs(e-n),1,n)/n:e>o?-ao(Math.abs(e-o),1,n)/n:0}function Km(e,n,o=15,i=40){const a=jm(e.x,i,n.width-i)*o,r=jm(e.y,i,n.height-i)*o;return[a,r]}function os(e,n){if(n){const o=e.position.x+e.dimensions.width-n.dimensions.width,i=e.position.y+e.dimensions.height-n.dimensions.height;if(o>0||i>0||e.position.x<0||e.position.y<0){let a={};if(typeof n.style=="function"?a={...n.style(n)}:n.style&&(a={...n.style}),a.width=a.width??`${n.dimensions.width}px`,a.height=a.height??`${n.dimensions.height}px`,o>0)if(typeof a.width=="string"){const r=Number(a.width.replace("px",""));a.width=`${r+o}px`}else a.width+=o;if(i>0)if(typeof a.height=="string"){const r=Number(a.height.replace("px",""));a.height=`${r+i}px`}else a.height+=i;if(e.position.x<0){const r=Math.abs(e.position.x);if(n.position.x=n.position.x-r,typeof a.width=="string"){const l=Number(a.width.replace("px",""));a.width=`${l+r}px`}else a.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(n.position.y=n.position.y-r,typeof a.height=="string"){const l=Number(a.height.replace("px",""));a.height=`${l+r}px`}else a.height+=r;e.position.y=0}n.dimensions.width=Number(a.width.toString().replace("px","")),n.dimensions.height=Number(a.height.toString().replace("px","")),typeof n.style=="function"?n.style=r=>{const l=n.style;return{...l(r),...a}}:n.style={...n.style,...a}}}}function Gm(e,n){var o,i;const a=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of a)if(l.type==="add")n.findIndex(c=>c.id===l.item.id)===-1&&n.push(l.item);else if(l.type==="remove"){const s=n.findIndex(c=>c.id===l.id);s!==-1&&n.splice(s,1)}const r=n.map(l=>l.id);for(const l of n)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(Si(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&Si(c)&&os(l,c)}break;case"dimensions":if(Si(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(o=s.dimensions)==null?void 0:o.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const c=n[r.indexOf(l.parentNode)];c&&Si(c)&&(!!c.dimensions.width&&!!c.dimensions.height?os(l,c):t.nextTick(()=>{os(l,c)}))}break}return n}function On(e,n){return{id:e,type:"select",selected:n}}function Ym(e){return{item:e,type:"add"}}function qm(e){return{id:e,type:"remove"}}function Wm(e,n,o,i,a){return{id:e,source:n,target:o,sourceHandle:i||null,targetHandle:a||null,type:"remove"}}function Ln(e,n=new Set,o=!1){const i=[];for(const[a,r]of e){const l=n.has(a);!(r.selected===void 0&&!l)&&r.selected!==l&&(o&&(r.selected=l),i.push(On(r.id,l)))}return i}const Jm=()=>{};function Me(e){const n=new Set;let o=Jm,i=()=>!1;const a=()=>n.size>0||i(),r=p=>{o=p},l=()=>{o=Jm},s=p=>{i=p},c=()=>{i=()=>!1},d=p=>{n.delete(p)};return{on:p=>{n.add(p);const f=()=>d(p);return fi(f),{off:f}},off:d,trigger:p=>{const f=[o];return a()?f.push(...n):e&&f.push(e),Promise.allSettled(f.map(y=>y(p)))},hasListeners:a,listeners:n,setEmitter:r,removeEmitter:l,setHasEmitListeners:s,removeHasEmitListeners:c}}function Xm(e,n,o){let i=e;do{if(i&&i.matches(n))return!0;if(i===o)return!1;i=i.parentElement}while(i);return!1}function D0(e,n,o,i){var a,r;const l=new Map;for(const[s,c]of e)(c.selected||c.id===i)&&(!c.parentNode||!Hm(c,e))&&(c.draggable||n&&typeof c.draggable>"u")&&e.get(s)&&l.set(s,{id:c.id,position:c.position||{x:0,y:0},distance:{x:o.x-((a=c.computedPosition)==null?void 0:a.x)||0,y:o.y-((r=c.computedPosition)==null?void 0:r.y)||0},from:{x:c.computedPosition.x,y:c.computedPosition.y},extent:c.extent,parentNode:c.parentNode,dimensions:{...c.dimensions},expandParent:c.expandParent});return Array.from(l.values())}function is({id:e,dragItems:n,findNode:o}){const i=[];for(const a of n){const r=o(a.id);r&&i.push(r)}return[e?i.find(a=>a.id===e):i[0],i]}function Zm(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function O0(e,n,o){const[i,a,r,l]=typeof e!="string"?Zm(e.padding):[0,0,0,0];return o&&typeof o.computedPosition.x<"u"&&typeof o.computedPosition.y<"u"&&typeof o.dimensions.width<"u"&&typeof o.dimensions.height<"u"?[[o.computedPosition.x+l,o.computedPosition.y+i],[o.computedPosition.x+o.dimensions.width-a,o.computedPosition.y+o.dimensions.height-r]]:!1}function L0(e,n,o,i){let a=e.extent||o;if((a==="parent"||!Array.isArray(a)&&(a==null?void 0:a.range)==="parent")&&!e.expandParent)if(e.parentNode&&i&&e.dimensions.width&&e.dimensions.height){const r=O0(a,e,i);r&&(a=r)}else n(new kt(yt.NODE_EXTENT_INVALID,e.id)),a=o;else if(Array.isArray(a)){const r=(i==null?void 0:i.computedPosition.x)||0,l=(i==null?void 0:i.computedPosition.y)||0;a=[[a[0][0]+r,a[0][1]+l],[a[1][0]+r,a[1][1]+l]]}else if(a!=="parent"&&(a!=null&&a.range)&&Array.isArray(a.range)){const[r,l,s,c]=Zm(a.padding),d=(i==null?void 0:i.computedPosition.x)||0,u=(i==null?void 0:i.computedPosition.y)||0;a=[[a.range[0][0]+d+c,a.range[0][1]+u+r],[a.range[1][0]+d-l,a.range[1][1]+u-s]]}return a==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:a}function P0({width:e,height:n},o){return[o[0],[o[1][0]-(e||0),o[1][1]-(n||0)]]}function as(e,n,o,i,a){const r=P0(e.dimensions,L0(e,o,i,a)),l=Vm(n,r);return{position:{x:l.x-((a==null?void 0:a.computedPosition.x)||0),y:l.y-((a==null?void 0:a.computedPosition.y)||0)},computedPosition:l}}function Ho(e,n,o=De.Left,i=!1){const a=((n==null?void 0:n.x)??0)+e.computedPosition.x,r=((n==null?void 0:n.y)??0)+e.computedPosition.y,{width:l,height:s}=n??H0(e);if(i)return{x:a+l/2,y:r+s/2};switch((n==null?void 0:n.position)??o){case De.Top:return{x:a+l/2,y:r};case De.Right:return{x:a+l,y:r+s/2};case De.Bottom:return{x:a+l/2,y:r+s};case De.Left:return{x:a,y:r+s/2}}}function Qm(e,n){return e&&(n?e.find(o=>o.id===n):e[0])||null}function z0({sourcePos:e,targetPos:n,sourceWidth:o,sourceHeight:i,targetWidth:a,targetHeight:r,width:l,height:s,viewport:c}){const d={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+o,n.x+a),y2:Math.max(e.y+i,n.y+r)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const u=Ja({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:l/c.zoom,height:s/c.zoom}),m=Math.max(0,Math.min(u.x2,d.x2)-Math.max(u.x,d.x)),p=Math.max(0,Math.min(u.y2,d.y2)-Math.max(u.y,d.y));return Math.ceil(m*p)>0}function F0(e,n,o=!1){const i=typeof e.zIndex=="number";let a=i?e.zIndex:0;const r=n(e.source),l=n(e.target);return!r||!l?0:(o&&(a=i?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),a)}var yt=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(yt||{});const ef={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
|
|
33
33
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
34
34
|
Node: ${e}`,NODE_MISSING_PARENT:(e,n)=>`Node is missing a parent
|
|
35
35
|
Node: ${e}
|
|
@@ -49,18 +49,18 @@ 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 ft extends Error{constructor(n,...o){var i;super((i=zm[n])==null?void 0:i.call(zm,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function jl(e){return"clientX"in e}function D0(e){return"sourceEvent"in e}function Xt(e,n){const o=jl(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 Ei=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function O0(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 Pa(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const L0=()=>!0;function Kl(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function P0(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())Ba(a,Va(r))>0&&i.push(r);return i}const z0=250;function F0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=P0(e,o,n+z0);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:f}=To(d,m,m.position,!0),y=Math.sqrt((h-e.x)**2+(f-e.y)**2);y>n||(y<s?(l=[{...m,x:h,y:f}],s=y):y===s&&l.push({...m,x:h,y:f}))}}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 Fm(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=L0},u,m,h,f){const y=r==="target",g=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:_,y:E}=Xt(e),N=l.elementFromPoint(_,E),p=N!=null&&N.classList.contains(`${s}-flow__handle`)?N:g,k={handleDomNode:p,isValid:!1,connection:null,toHandle:null};if(p){const I=Um(void 0,p),A=p.getAttribute("data-nodeid"),$=p.getAttribute("data-handleid"),L=p.classList.contains("connectable"),V=p.classList.contains("connectableend");if(!A||!I)return k;const S={source:y?A:i,sourceHandle:y?$:a,target:y?i:A,targetHandle:y?a:$};k.connection=S;const T=L&&V&&(o===un.Strict?y&&I==="source"||!y&&I==="target":A!==i||$!==a);k.isValid=T&&d(S,{nodes:m,edges:u,sourceNode:h(S.source),targetNode:h(S.target)}),k.toHandle=Hm(A,I,$,f,o,!0)}return k}function Um(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function U0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function H0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function Hm(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===un.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,...To(d,m,m.position,!0)}:m}const Gl={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top},j0=["production","prod"];function Ni(e,...n){jm()&&console.warn(`[Vue Flow]: ${e}`,...n)}function jm(){return!j0.includes(process.env.NODE_ENV||"")}function Km(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,...Da(l)}}):null}function Yl(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 K0(e,n,o,i){if(!e||!e.source||!e.target)return o(new ft(st.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return xn(e)?a=e:a={...e,id:Im(e)},a=Nm(a,void 0,i),v0(a,n)?!1:a}function G0(e,n,o,i,a){if(!n.source||!n.target)return a(new ft(st.EDGE_INVALID,e.id)),!1;if(!o)return a(new ft(st.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Im(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function Gm(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Jn(l)){o(new ft(st.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=N0(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 ft(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 Ym(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 ql(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}`;Ym("source",c,u,e,a,l),Ym("target",c,d,e,r,s)}}function qm(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function Wl(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=xn(d)?d:K0(d,s,a,r);if(!u)continue;const m=o(u.source),h=o(u.target);if(!m||!h){a(new ft(st.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new ft(st.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){a(new ft(st.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:h})){a(new ft(st.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...Nm(u,f,r),sourceNode:m,targetNode:h})}return c}const Wm=Symbol("vueFlow"),Jm=Symbol("nodeId"),Xm=Symbol("nodeRef"),Y0=Symbol("edgeId"),q0=Symbol("edgeRef"),za=Symbol("slots");function Zm(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:f,multiSelectionActive:y,nodesSelectionActive:g,selectNodesOnDrag:_,removeSelectedElements:E,addSelectedNodes:N,updateNodePositions:p,emits:k}=je(),{onStart:I,onDrag:A,onStop:$,onClick:L,el:V,disabled:S,id:x,selectable:T,dragHandle:D}=e,b=t.shallowRef(!1);let w=[],v,O=null,M={x:void 0,y:void 0},z={x:0,y:0},j=null,ie=!1,pe=!1,ye=0,ge=!1;const me=X0(),se=({x:le,y:ue})=>{M={x:le,y:ue};let F=!1;if(w=w.map(P=>{const U={x:le-P.distance.x,y:ue-P.distance.y},{computedPosition:Q}=Hl(P,o.value?Pa(U,i.value):U,k.error,l.value,P.parentNode?f(P.parentNode):void 0);return F=F||P.position.x!==Q.x||P.position.y!==Q.y,P.position=Q,P}),pe=pe||F,!!F&&(p(w,!0,!0),b.value=!0,j)){const[P,U]=Ul({id:x,dragItems:w,findNode:f});A({event:j,node:P,nodes:U})}},ke=()=>{if(!O)return;const[le,ue]=$m(z,O,u.value);if(le!==0||ue!==0){const F={x:(M.x??0)-le/c.value.zoom,y:(M.y??0)-ue/c.value.zoom};h({x:le,y:ue})&&se(F)}ye=requestAnimationFrame(ke)},Se=(le,ue)=>{ie=!0;const F=f(x);!_.value&&!y.value&&F&&(F.selected||E()),F&&t.toValue(T)&&_.value&&Yl(F,y.value,N,E,g,!1,ue);const P=me(le.sourceEvent);if(M=P,w=A0(r.value,m.value,P,x),w.length){const[U,Q]=Ul({id:x,dragItems:w,findNode:f});I({event:le.sourceEvent,node:U,nodes:Q})}},ce=(le,ue)=>{var F;le.sourceEvent.type==="touchmove"&&le.sourceEvent.touches.length>1||(pe=!1,s.value===0&&Se(le,ue),M=me(le.sourceEvent),O=((F=n.value)==null?void 0:F.getBoundingClientRect())||null,z=Xt(le.sourceEvent,O))},fe=(le,ue)=>{const F=me(le.sourceEvent);if(!ge&&ie&&d.value&&(ge=!0,ke()),!ie){const P=F.xSnapped-(M.x??0),U=F.ySnapped-(M.y??0);Math.sqrt(P*P+U*U)>s.value&&Se(le,ue)}(M.x!==F.xSnapped||M.y!==F.ySnapped)&&w.length&&ie&&(j=le.sourceEvent,z=Xt(le.sourceEvent,O),se(F))},oe=le=>{let ue=!1;if(!ie&&!b.value&&!y.value){const F=le.sourceEvent,P=me(F),U=P.xSnapped-(M.x??0),Q=P.ySnapped-(M.y??0),X=Math.sqrt(U*U+Q*Q);X!==0&&X<=s.value&&(L==null||L(F),ue=!0)}if(w.length&&!ue){pe&&(p(w,!1,!1),pe=!1);const[F,P]=Ul({id:x,dragItems:w,findNode:f});$({event:le.sourceEvent,node:F,nodes:P})}w=[],b.value=!1,ge=!1,ie=!1,M={x:void 0,y:void 0},cancelAnimationFrame(ye)};return t.watch([()=>t.toValue(S),V],([le,ue],F,P)=>{if(ue){const U=Mt(ue);le||(v=EE().on("start",Q=>ce(Q,ue)).on("drag",Q=>fe(Q,ue)).on("end",Q=>oe(Q)).filter(Q=>{const X=Q.target,_e=t.toValue(D);return!Q.button&&(!a.value||!Om(X,`.${a.value}`,ue)&&(!_e||Om(X,_e,ue)))}),U.call(v)),P(()=>{U.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),b}function W0(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),updateStart:Re(),update:Re(),updateEnd:Re()}}function J0(e,n){const o=W0();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 X0(){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=D0(a)?a.sourceEvent:a,{x:c,y:d}=Xt(s,l),u=_i({x:c,y:d},e.value),{x:m,y:h}=o.value?Pa(u,n.value):u;return{xSnapped:m,ySnapped:h,...u}}}function Fa(){return!0}function Qm({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:f,autoPanOnConnect:y,autoPanSpeed:g,findNode:_,panBy:E,startConnection:N,updateConnection:p,endConnection:k,emits:I,viewport:A,edges:$,nodes:L,isValidConnection:V,nodeLookup:S}=je();let x=null,T=!1,D=null;function b(v){var O;const M=t.toValue(o)==="target",z=jl(v),j=Em(v.target),ie=v.currentTarget;if(ie&&(z&&v.button===0||!z)){let pe=function(Ie){F=Xt(Ie,oe),se=F0(_i(F,A.value,!1,[1,1]),u.value,S.value,Q),P||(U(),P=!0);const q=Fm(Ie,{handle:se,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:M?"target":"source",isValidConnection:me,doc:j,lib:"vue",flowId:s,nodeLookup:S.value},$.value,L.value,_,S.value);D=q.handleDomNode,x=q.connection,T=H0(!!se,q.isValid);const K={...we,isValid:T,to:q.toHandle&&T?bi({x:q.toHandle.x,y:q.toHandle.y},A.value):F,toHandle:q.toHandle,toPosition:T&&q.toHandle?q.toHandle.position:Gl[Q.position],toNode:q.toHandle?S.value.get(q.toHandle.nodeId):null};if(T&&se&&(we!=null&&we.toHandle)&&K.toHandle&&we.toHandle.type===K.toHandle.type&&we.toHandle.nodeId===K.toHandle.nodeId&&we.toHandle.id===K.toHandle.id&&we.to.x===K.to.x&&we.to.y===K.to.y)return;const J=se??q.toHandle;if(p(J&&T?bi({x:J.x,y:J.y},A.value):F,J,U0(!!J,T)),we=K,!se&&!T&&!D)return Kl(ue);x&&x.source!==x.target&&D&&(Kl(ue),ue=D,D.classList.add("connecting","vue-flow__handle-connecting"),D.classList.toggle("valid",!!T),D.classList.toggle("vue-flow__handle-valid",!!T))},ye=function(Ie){"touches"in Ie&&Ie.touches.length>0||((se||D)&&x&&T&&(r?r(Ie,x):I.connect(x)),I.connectEnd(Ie),a&&(l==null||l(Ie)),Kl(ue),cancelAnimationFrame(ke),k(Ie),P=!1,T=!1,x=null,D=null,j.removeEventListener("mousemove",pe),j.removeEventListener("mouseup",ye),j.removeEventListener("touchmove",pe),j.removeEventListener("touchend",ye))};const ge=_(t.toValue(n));let me=t.toValue(i)||V.value||Fa;!me&&ge&&(me=(M?ge.isValidSourcePos:ge.isValidTargetPos)||Fa);let se,ke=0;const{x:Se,y:ce}=Xt(v),fe=Um(t.toValue(a),ie),oe=(O=c.value)==null?void 0:O.getBoundingClientRect();if(!oe||!fe)return;const le=Hm(t.toValue(n),fe,t.toValue(e),S.value,d.value);if(!le)return;let ue,F=Xt(v,oe),P=!1;const U=()=>{if(!y.value)return;const[Ie,q]=$m(F,oe,g.value);E({x:Ie,y:q}),ke=requestAnimationFrame(U)},Q={...le,nodeId:t.toValue(n),type:fe,position:le.position},X=S.value.get(t.toValue(n)),he={inProgress:!0,isValid:null,from:To(X,Q,$e.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:X,to:F,toHandle:null,toPosition:Gl[Q.position],toNode:null};N({nodeId:t.toValue(n),id:t.toValue(e),type:fe,position:(ie==null?void 0:ie.getAttribute("data-handlepos"))||$e.Top,...F},{x:Se-oe.left,y:ce-oe.top}),I.connectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:fe});let we=he;j.addEventListener("mousemove",pe),j.addEventListener("mouseup",ye),j.addEventListener("touchmove",pe),j.addEventListener("touchend",ye)}}function w(v){var O,M;if(!m.value)return;const z=t.toValue(o)==="target";if(!h.value){I.clickConnectStart({event:v,nodeId:t.toValue(n),handleId:t.toValue(e)}),N({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:$e.Top,...Xt(v)},void 0,!0);return}let j=t.toValue(i)||V.value||Fa;const ie=_(t.toValue(n));if(!j&&ie&&(j=(z?ie.isValidSourcePos:ie.isValidTargetPos)||Fa),ie&&(typeof ie.connectable>"u"?f.value:ie.connectable)===!1)return;const pe=Em(v.target),ye=Fm(v,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:$e.Top,...Xt(v)},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:S.value},$.value,L.value,_,S.value),ge=((O=ye.connection)==null?void 0:O.source)===((M=ye.connection)==null?void 0:M.target);ye.isValid&&ye.connection&&!ge&&I.connect(ye.connection),I.clickConnectEnd(v),k(v,!0)}return{handlePointerDown:b,handleClick:w}}function Z0(){return t.inject(Jm,"")}function ef(e){const n=e??Z0()??"",o=t.inject(Xm,t.ref(null)),{findNode:i,edges:a,emits:r}=je(),l=i(n);return l||r.error(new ft(st.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>Xn([l],a.value))}}function Q0(){return{doubleClick:Re(),click:Re(),mouseEnter:Re(),mouseMove:Re(),mouseLeave:Re(),contextMenu:Re(),dragStart:Re(),drag:Re(),dragStop:Re()}}function eN(e,n){const o=Q0();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 tf(){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,f=c.x*u*h,y=c.y*m*h,g=[];for(const _ of e.value)if(_.draggable||l&&typeof _.draggable>"u"){const E={x:_.computedPosition.x+f,y:_.computedPosition.y+y},{position:N}=Hl(_,E,s.error,n.value,_.parentNode?i(_.parentNode):void 0);g.push({id:_.id,position:N,from:_.position,distance:{x:c.x,y:c.y},dimensions:_.dimensions})}o(g,!0,!1)}}const Ua=.1,tN=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function An(){return Ni("Viewport not initialized yet."),Promise.resolve(!1)}const nN={zoomIn:An,zoomOut:An,zoomTo:An,fitView:An,setCenter:An,fitBounds:An,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:An,setTransform:An,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function oN(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?ci:Ia).scaleBy(Jl(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}=km({x:-i,y:-a},e.translateExtent),m=Ro.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?ci:Ia).transform(Jl(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"?ci:Ia).scaleTo(Jl(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:Ua,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=Pl(s),{x:d,y:u,zoom:m}=Sm(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??Ua);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:Ua})=>{const{x:l,y:s,zoom:c}=Sm(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Ua);return o(l,s,c,r)},project:a=>_i(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 _i(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 bi(s,e.viewport)}return{x:0,y:0}}}:nN)}function Jl(e,n=0,o=tN,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function iN(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let g,_,E=!!(o.nodes.value.length||o.edges.value.length);g=Io([e.modelValue,()=>{var N,p;return(p=(N=e.modelValue)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setElements(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=Io([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([N,p])=>{var k;(k=e.modelValue)!=null&&k.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...N,...p],t.nextTick(()=>{g==null||g.resume()}))},{immediate:E}),t.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},r=()=>{i.run(()=>{let g,_,E=!!o.nodes.value.length;g=Io([e.nodes,()=>{var N,p;return(p=(N=e.nodes)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setNodes(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=Io([o.nodes,()=>o.nodes.value.length],([N])=>{var p;(p=e.nodes)!=null&&p.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...N],t.nextTick(()=>{g==null||g.resume()}))},{immediate:E}),t.onScopeDispose(()=>{g==null||g.stop(),_==null||_.stop()})})},l=()=>{i.run(()=>{let g,_,E=!!o.edges.value.length;g=Io([e.edges,()=>{var N,p;return(p=(N=e.edges)==null?void 0:N.value)==null?void 0:p.length}],([N])=>{N&&Array.isArray(N)&&(_==null||_.pause(),o.setEdges(N),!_&&!E&&N.length?E=!0:_==null||_.resume())}),_=Io([o.edges,()=>o.edges.value.length],([N])=>{var p;(p=e.edges)!=null&&p.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...N],t.nextTick(()=>{g==null||g.resume()}))},{immediate:E}),t.onScopeDispose(()=>{g==null||g.stop(),_==null||_.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 g=async _=>{let E=_;typeof n.autoConnect=="function"&&(E=await n.autoConnect(_)),E!==!1&&o.addEdges([E])};t.watch(()=>n.autoConnect,()=>{ct(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(_,E,N)=>{_?o.onConnect(g):o.hooks.value.connect.off(g),N(()=>{o.hooks.value.connect.off(g)})},{immediate:!0})})},f=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const _ of Object.keys(n)){const E=_;if(!g.includes(E)){const N=t.toRef(()=>n[E]),p=o[E];t.isRef(p)&&i.run(()=>{t.watch(N,k=>{ct(k)&&(p.value=k)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),h(),f()})()}),()=>i.stop()}function aN(){return{edgesChange:Re(),nodesChange:Re(),nodeDoubleClick:Re(),nodeClick:Re(),nodeMouseEnter:Re(),nodeMouseMove:Re(),nodeMouseLeave:Re(),nodeContextMenu:Re(),nodeDragStart:Re(),nodeDrag:Re(),nodeDragStop:Re(),nodesInitialized:Re(),miniMapNodeClick:Re(),miniMapNodeDoubleClick:Re(),miniMapNodeMouseEnter:Re(),miniMapNodeMouseMove:Re(),miniMapNodeMouseLeave:Re(),connect:Re(),connectStart:Re(),connectEnd:Re(),clickConnectStart:Re(),clickConnectEnd:Re(),paneReady:Re(),init:Re(),move:Re(),moveStart:Re(),moveEnd:Re(),selectionDragStart:Re(),selectionDrag:Re(),selectionDragStop:Re(),selectionContextMenu:Re(),selectionStart:Re(),selectionEnd:Re(),viewportChangeStart:Re(),viewportChange:Re(),viewportChangeEnd:Re(),paneScroll:Re(),paneClick:Re(),paneContextMenu:Re(),paneMouseEnter:Re(),paneMouseMove:Re(),paneMouseLeave:Re(),edgeContextMenu:Re(),edgeMouseEnter:Re(),edgeMouseMove:Re(),edgeMouseLeave:Re(),edgeDoubleClick:Re(),edgeClick:Re(),edgeUpdateStart:Re(),edgeUpdate:Re(),edgeUpdateEnd:Re(),updateNodeInternals:Re(),error:Re(e=>Ni(e.message))}}function rN(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),oi(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),oi(r.removeHasEmitListeners)}});function i(a){var r;const l=lN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function lN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function nf(){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:Dl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:hi.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:qn.Bezier,style:{}},connectionMode:un.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:Ei()?"Meta":"Control",zoomActivationKeyCode:Ei()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:aN(),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 sN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function cN(e,n,o){const i=oN(e),a=F=>{const P=F??[];e.hooks.updateNodeInternals.trigger(P)},r=F=>I0(F,e.nodes,e.edges),l=F=>w0(F,e.nodes,e.edges),s=F=>Xn(F,e.edges),c=({id:F,type:P,nodeId:U})=>{var Q;const X=F?`-${P}-${F}`:`-${P}`;return Array.from(((Q=e.connectionLookup.get(`${U}${X}`))==null?void 0:Q.values())??[])},d=F=>{if(F)return n.value.get(F)},u=F=>{if(F)return o.value.get(F)},m=(F,P,U)=>{var Q,X;const _e=[];for(const he of F){const we={id:he.id,type:"position",dragging:U,from:he.from};if(P&&(we.position=he.position,he.parentNode)){const Ie=d(he.parentNode);we.position={x:we.position.x-(((Q=Ie==null?void 0:Ie.computedPosition)==null?void 0:Q.x)??0),y:we.position.y-(((X=Ie==null?void 0:Ie.computedPosition)==null?void 0:X.y)??0)}}_e.push(we)}_e!=null&&_e.length&&e.hooks.nodesChange.trigger(_e)},h=F=>{if(!e.vueFlowRef)return;const P=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!P)return;const U=window.getComputedStyle(P),{m22:Q}=new window.DOMMatrixReadOnly(U.transform),X=[];for(const _e of F){const he=_e,we=d(he.id);if(we){const Ie=Da(he.nodeElement);if(!!(Ie.width&&Ie.height&&(we.dimensions.width!==Ie.width||we.dimensions.height!==Ie.height||he.forceUpdate))){const K=he.nodeElement.getBoundingClientRect();we.dimensions=Ie,we.handleBounds.source=Km("source",he.nodeElement,K,Q,we.id),we.handleBounds.target=Km("target",he.nodeElement,K,Q,we.id),X.push({id:we.id,type:"dimensions",dimensions:Ie})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),X.length&&e.hooks.nodesChange.trigger(X)},f=(F,P)=>{const U=new Set,Q=new Set;for(const he of F)Jn(he)?U.add(he.id):xn(he)&&Q.add(he.id);const X=Rn(n.value,U,!0),_e=Rn(o.value,Q);if(e.multiSelectionActive){for(const he of U)X.push(Sn(he,P));for(const he of Q)_e.push(Sn(he,P))}X.length&&e.hooks.nodesChange.trigger(X),_e.length&&e.hooks.edgesChange.trigger(_e)},y=F=>{if(e.multiSelectionActive){const P=F.map(U=>Sn(U.id,!0));e.hooks.nodesChange.trigger(P);return}e.hooks.nodesChange.trigger(Rn(n.value,new Set(F.map(P=>P.id)),!0)),e.hooks.edgesChange.trigger(Rn(o.value))},g=F=>{if(e.multiSelectionActive){const P=F.map(U=>Sn(U.id,!0));e.hooks.edgesChange.trigger(P);return}e.hooks.edgesChange.trigger(Rn(o.value,new Set(F.map(P=>P.id)))),e.hooks.nodesChange.trigger(Rn(n.value,new Set,!0))},_=F=>{f(F,!0)},E=F=>{const U=(F||e.nodes).map(Q=>(Q.selected=!1,Sn(Q.id,!1)));e.hooks.nodesChange.trigger(U)},N=F=>{const U=(F||e.edges).map(Q=>(Q.selected=!1,Sn(Q.id,!1)));e.hooks.edgesChange.trigger(U)},p=F=>{if(!F||!F.length)return f([],!1);const P=F.reduce((U,Q)=>{const X=Sn(Q.id,!1);return Jn(Q)?U.nodes.push(X):U.edges.push(X),U},{nodes:[],edges:[]});P.nodes.length&&e.hooks.nodesChange.trigger(P.nodes),P.edges.length&&e.hooks.edgesChange.trigger(P.edges)},k=F=>{var P;(P=e.d3Zoom)==null||P.scaleExtent([F,e.maxZoom]),e.minZoom=F},I=F=>{var P;(P=e.d3Zoom)==null||P.scaleExtent([e.minZoom,F]),e.maxZoom=F},A=F=>{var P;(P=e.d3Zoom)==null||P.translateExtent(F),e.translateExtent=F},$=F=>{e.nodeExtent=F,a()},L=F=>{var P;(P=e.d3Zoom)==null||P.clickDistance(F)},V=F=>{e.nodesDraggable=F,e.nodesConnectable=F,e.elementsSelectable=F},S=F=>{const P=F instanceof Function?F(e.nodes):F;!e.initialized&&!P.length||(e.nodes=Gm(P,d,e.hooks.error.trigger))},x=F=>{const P=F instanceof Function?F(e.edges):F;if(!e.initialized&&!P.length)return;const U=Wl(P,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ql(e.connectionLookup,o.value,U),e.edges=U},T=F=>{const P=F instanceof Function?F([...e.nodes,...e.edges]):F;!e.initialized&&!P.length||(S(P.filter(Jn)),x(P.filter(xn)))},D=F=>{let P=F instanceof Function?F(e.nodes):F;P=Array.isArray(P)?P:[P];const U=Gm(P,d,e.hooks.error.trigger),Q=[];for(const X of U)Q.push(Mm(X));Q.length&&e.hooks.nodesChange.trigger(Q)},b=F=>{let P=F instanceof Function?F(e.edges):F;P=Array.isArray(P)?P:[P];const U=Wl(P,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const X of U)Q.push(Mm(X));Q.length&&e.hooks.edgesChange.trigger(Q)},w=(F,P=!0,U=!1)=>{const Q=F instanceof Function?F(e.nodes):F,X=Array.isArray(Q)?Q:[Q],_e=[],he=[];function we(q){const K=s(q);for(const J of K)(!ct(J.deletable)||J.deletable)&&he.push(Bm(J.id,J.source,J.target,J.sourceHandle,J.targetHandle))}function Ie(q){const K=[];for(const J of e.nodes)J.parentNode===q&&K.push(J);if(K.length){for(const J of K)_e.push(Vm(J.id));P&&we(K);for(const J of K)Ie(J.id)}}for(const q of X){const K=typeof q=="string"?d(q):q;K&&(ct(K.deletable)&&!K.deletable||(_e.push(Vm(K.id)),P&&we([K]),U&&Ie(K.id)))}he.length&&e.hooks.edgesChange.trigger(he),_e.length&&e.hooks.nodesChange.trigger(_e)},v=F=>{const P=F instanceof Function?F(e.edges):F,U=Array.isArray(P)?P:[P],Q=[];for(const X of U){const _e=typeof X=="string"?u(X):X;_e&&(ct(_e.deletable)&&!_e.deletable||Q.push(Bm(typeof X=="string"?X:X.id,_e.source,_e.target,_e.sourceHandle,_e.targetHandle)))}e.hooks.edgesChange.trigger(Q)},O=(F,P,U=!0)=>{const Q=u(F.id);if(!Q)return!1;const X=e.edges.indexOf(Q),_e=G0(F,P,Q,U,e.hooks.error.trigger);if(_e){const[he]=Wl([_e],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((we,Ie)=>Ie===X?he:we),ql(e.connectionLookup,o.value,[he]),he}return!1},M=(F,P,U={replace:!1})=>{const Q=u(F);if(!Q)return;const X=typeof P=="function"?P(Q):P;Q.data=U.replace?X:{...Q.data,...X}},z=F=>Tm(F,e.nodes),j=F=>{const P=Tm(F,e.edges);return ql(e.connectionLookup,o.value,P),P},ie=(F,P,U={replace:!1})=>{const Q=d(F);if(!Q)return;const X=typeof P=="function"?P(Q):P;U.replace?e.nodes.splice(e.nodes.indexOf(Q),1,X):Object.assign(Q,X)},pe=(F,P,U={replace:!1})=>{const Q=d(F);if(!Q)return;const X=typeof P=="function"?P(Q):P;Q.data=U.replace?X:{...Q.data,...X}},ye=(F,P,U=!1)=>{U?e.connectionClickStartHandle=F:e.connectionStartHandle=F,e.connectionEndHandle=null,e.connectionStatus=null,P&&(e.connectionPosition=P)},ge=(F,P=null,U=null)=>{e.connectionStartHandle&&(e.connectionPosition=F,e.connectionEndHandle=P,e.connectionStatus=U)},me=(F,P)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,P?e.connectionClickStartHandle=null:e.connectionStartHandle=null},se=F=>{const P=E0(F),U=P?null:gi(F)?F:d(F.id);return!P&&!U?[null,null,P]:[P?F:Va(U),U,P]},ke=(F,P=!0,U=e.nodes)=>{const[Q,X,_e]=se(F);if(!Q)return[];const he=[];for(const we of U||e.nodes){if(!_e&&(we.id===X.id||!we.computedPosition))continue;const Ie=Va(we),q=Ba(Ie,Q);(P&&q>0||q>=Ie.width*Ie.height||q>=Number(Q.width)*Number(Q.height))&&he.push(we)}return he},Se=(F,P,U=!0)=>{const[Q]=se(F);if(!Q)return!1;const X=Ba(Q,P);return U&&X>0||X>=Number(Q.width)*Number(Q.height)},ce=F=>{const{viewport:P,dimensions:U,d3Zoom:Q,d3Selection:X,translateExtent:_e}=e;if(!Q||!X||!F.x&&!F.y)return!1;const he=Ro.translate(P.x+F.x,P.y+F.y).scale(P.zoom),we=[[0,0],[U.width,U.height]],Ie=Q.constrain()(he,we,_e),q=e.viewport.x!==Ie.x||e.viewport.y!==Ie.y||e.viewport.zoom!==Ie.k;return Q.transform(X,Ie),q},fe=F=>{const P=F instanceof Function?F(e):F,U=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ct(P.defaultEdgeOptions)&&(e.defaultEdgeOptions=P.defaultEdgeOptions);const Q=P.modelValue||P.nodes||P.edges?[]:void 0;Q&&(P.modelValue&&Q.push(...P.modelValue),P.nodes&&Q.push(...P.nodes),P.edges&&Q.push(...P.edges),T(Q));const X=()=>{ct(P.maxZoom)&&I(P.maxZoom),ct(P.minZoom)&&k(P.minZoom),ct(P.translateExtent)&&A(P.translateExtent)};for(const _e of Object.keys(P)){const he=_e,we=P[he];![...sN,...U].includes(he)&&ct(we)&&(e[he]=we)}hl(()=>e.d3Zoom).not.toBeNull().then(X),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:h,setElements:T,setNodes:S,setEdges:x,addNodes:D,addEdges:b,removeNodes:w,removeEdges:v,findNode:d,findEdge:u,updateEdge:O,updateEdgeData:M,updateNode:ie,updateNodeData:pe,applyEdgeChanges:j,applyNodeChanges:z,addSelectedElements:_,addSelectedNodes:y,addSelectedEdges:g,setMinZoom:k,setMaxZoom:I,setTranslateExtent:A,setNodeExtent:$,setPaneClickDistance:L,removeSelectedElements:p,removeSelectedNodes:E,removeSelectedEdges:N,startConnection:ye,updateConnection:ge,endConnection:me,setInteractive:V,setState:fe,getIntersectingNodes:ke,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Se,panBy:ce,fitView:F=>i.value.fitView(F),zoomIn:F=>i.value.zoomIn(F),zoomOut:F=>i.value.zoomOut(F),zoomTo:(F,P)=>i.value.zoomTo(F,P),setViewport:(F,P)=>i.value.setViewport(F,P),setTransform:(F,P)=>i.value.setTransform(F,P),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(F,P,U)=>i.value.setCenter(F,P,U),fitBounds:(F,P)=>i.value.fitBounds(F,P),project:F=>i.value.project(F),screenToFlowCoordinate:F=>i.value.screenToFlowCoordinate(F),flowToScreenCoordinate:F=>i.value.flowToScreenCoordinate(F),toObject:()=>{const F=[],P=[];for(const U of e.nodes){const{computedPosition:Q,handleBounds:X,selected:_e,dimensions:he,isParent:we,resizing:Ie,dragging:q,events:K,...J}=U;F.push(J)}for(const U of e.edges){const{selected:Q,sourceNode:X,targetNode:_e,events:he,...we}=U;P.push(we)}return JSON.parse(JSON.stringify({nodes:F,edges:P,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:F=>new Promise(P=>{const{nodes:U,edges:Q,position:X,zoom:_e,viewport:he}=F;U&&S(U),Q&&x(Q);const[we,Ie]=he!=null&&he.x&&(he!=null&&he.y)?[he.x,he.y]:X??[null,null];if(we&&Ie){const q=(he==null?void 0:he.zoom)||_e||e.viewport.zoom;return hl(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:we,y:Ie,zoom:q}).then(()=>{P(!0)})})}else P(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const F=nf();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const P=Ro.translate(F.defaultViewport.x??0,F.defaultViewport.y??0).scale(Wn(F.defaultViewport.zoom??1,F.minZoom,F.maxZoom)),U=e.viewportRef.getBoundingClientRect(),Q=[[0,0],[U.width,U.height]],X=e.d3Zoom.constrain()(P,Q,F.translateExtent);e.d3Zoom.transform(e.d3Selection,X)}fe(F)},$destroy:()=>{}}}const dN=["data-id","data-handleid","data-nodeid","data-handlepos"],uN={name:"Handle",compatConfig:{MODE:3}},Zn=t.defineComponent({...uN,props:{id:{default:null},type:{},position:{default:()=>$e.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:f,node:y,nodeEl:g,connectedEdges:_}=ef(),E=t.ref(),N=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),p=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),k=t.toRef(()=>{var x,T,D,b,w,v;return((x=l.value)==null?void 0:x.nodeId)===f&&((T=l.value)==null?void 0:T.id)===e.id&&((D=l.value)==null?void 0:D.type)===i.value||((b=c.value)==null?void 0:b.nodeId)===f&&((w=c.value)==null?void 0:w.id)===e.id&&((v=c.value)==null?void 0:v.type)===i.value}),I=t.toRef(()=>{var x,T,D;return((x=s.value)==null?void 0:x.nodeId)===f&&((T=s.value)==null?void 0:T.id)===e.id&&((D=s.value)==null?void 0:D.type)===i.value}),{handlePointerDown:A,handleClick:$}=Qm({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),L=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(x=>{const T=x[`${i.value}Handle`];return x[i.value]!==f?!1:T?T===e.id:!0}):typeof e.connectable=="number"?_.value.filter(x=>{const T=x[`${i.value}Handle`];return x[i.value]!==f?!1:T?T===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,_.value):ct(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var x;if(!y.dimensions.width||!y.dimensions.height)return;const T=(x=y.handleBounds[i.value])==null?void 0:x.find(z=>z.id===e.id);if(!d.value||T)return;const D=d.value.querySelector(".vue-flow__transformationpane");if(!g.value||!E.value||!D||!e.id)return;const b=g.value.getBoundingClientRect(),w=E.value.getBoundingClientRect(),v=window.getComputedStyle(D),{m22:O}=new window.DOMMatrixReadOnly(v.transform),M={id:e.id,position:e.position,x:(w.left-b.left)/O,y:(w.top-b.top)/O,type:i.value,nodeId:f,...Da(E.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],M]});function V(x){const T=jl(x);L.value&&N.value&&(T&&x.button===0||!T)&&A(x)}function S(x){!f||!s.value&&!N.value||L.value&&$(x)}return n({handleClick:$,handlePointerDown:A,onClick:S,onPointerDown:V}),(x,T)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:E,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":x.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${x.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(h),i.value,{connectable:L.value,connecting:I.value,connectablestart:N.value,connectableend:p.value,connectionindicator:L.value&&(N.value&&!k.value||p.value&&k.value)}]]),onMousedown:V,onTouchstartPassive:V,onClick:S},[t.renderSlot(x.$slots,"default",{id:x.id})],42,dN))}}),Ha=function({sourcePosition:e=$e.Bottom,targetPosition:n=$e.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(Zn,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(Zn,{type:"source",position:e,connectable:i,isValidConnection:r})]};Ha.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Ha.inheritAttrs=!1,Ha.compatConfig={MODE:3};const mN=Ha,ja=function({targetPosition:e=$e.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(Zn,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};ja.props=["targetPosition","label","isValidTargetPos","connectable","data"],ja.inheritAttrs=!1,ja.compatConfig={MODE:3};const fN=ja,Ka=function({sourcePosition:e=$e.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(Zn,{type:"source",position:e,connectable:o,isValidConnection:i})]};Ka.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ka.inheritAttrs=!1,Ka.compatConfig={MODE:3};const pN=Ka,hN=["transform"],yN=["width","height","x","y","rx","ry"],gN=["y"],bN={name:"EdgeText",compatConfig:{MODE:3}},_N=t.defineComponent({...bN,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,yN)):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,gN)],8,hN))}}),kN=["id","d","marker-end","marker-start"],EN=["d","stroke-width"],NN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ga=t.defineComponent({...NN,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,kN),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,EN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(_N,{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 of({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 af({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 Ya(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function rf({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case $e.Left:l=n-Ya(n-i,r),s=o;break;case $e.Right:l=n+Ya(i-n,r),s=o;break;case $e.Top:l=n,s=o-Ya(o-a,r);break;case $e.Bottom:l=n,s=o+Ya(a-o,r);break}return[l,s]}function lf(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,curvature:s=.25}=e,[c,d]=rf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=rf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[h,f,y,g]=af({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,f,y,g]}function sf({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case $e.Left:case $e.Right:r=.5*(n+i),l=o;break;case $e.Top:case $e.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function cf(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top}=e,[s,c]=sf({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=sf({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,h,f,y]=af({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,f,y]}const df={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}};function wN({source:e,sourcePosition:n=$e.Bottom,target:o}){return n===$e.Left||n===$e.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 uf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function IN({source:e,sourcePosition:n=$e.Bottom,target:o,targetPosition:i=$e.Top,center:a,offset:r}){const l=df[n],s=df[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=wN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",h=u[m];let f,y,g;const _={x:0,y:0},E={x:0,y:0},[N,p,k,I]=of({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??N,g=a.y??p;const $=[{x:y,y:c.y},{x:y,y:d.y}],L=[{x:c.x,y:g},{x:d.x,y:g}];l[m]===h?f=m==="x"?$:L:f=m==="x"?L:$}else{const $=[{x:c.x,y:d.y}],L=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===h?L:$:f=l.y===h?$:L,n===i){const D=Math.abs(e[m]-o[m]);if(D<=r){const b=Math.min(r-1,r-D);l[m]===h?_[m]=(c[m]>e[m]?-1:1)*b:E[m]=(d[m]>o[m]?-1:1)*b}}if(n!==i){const D=m==="x"?"y":"x",b=l[m]===s[D],w=c[D]>d[D],v=c[D]<d[D];(l[m]===1&&(!b&&w||b&&v)||l[m]!==1&&(!b&&v||b&&w))&&(f=m==="x"?$:L)}const V={x:c.x+_.x,y:c.y+_.y},S={x:d.x+E.x,y:d.y+E.y},x=Math.max(Math.abs(V.x-f[0].x),Math.abs(S.x-f[0].x)),T=Math.max(Math.abs(V.y-f[0].y),Math.abs(S.y-f[0].y));x>=T?(y=(V.x+S.x)/2,g=f[0].y):(y=f[0].x,g=(V.y+S.y)/2)}return[[e,{x:c.x+_.x,y:c.y+_.y},...f,{x:d.x+E.x,y:d.y+E.y},o],y,g,k,I]}function vN(e,n,o,i){const a=Math.min(uf(e,n)/2,uf(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 Xl(e){const{sourceX:n,sourceY:o,sourcePosition:i=$e.Bottom,targetX:a,targetY:r,targetPosition:l=$e.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,h,f,y,g]=IN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((E,N,p)=>{let k;return p>0&&p<m.length-1?k=vN(m[p-1],N,m[p+1],s):k=`${p===0?"M":"L"}${N.x} ${N.y}`,E+=k,E},""),h,f,y,g]}function CN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=of({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const xN=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]=CN(e);return t.h(Ga,{path:o,labelX:i,labelY:a,...n,...e})}}}),mf=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]=Xl({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ga,{path:o,labelX:i,labelY:a,...n,...e})}}}),SN=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(mf,{...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]=lf({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ga,{path:o,labelX:i,labelY:a,...n,...e})}}}),AN=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]=cf({...e,sourcePosition:e.sourcePosition??$e.Bottom,targetPosition:e.targetPosition??$e.Top});return t.h(Ga,{path:o,labelX:i,labelY:a,...n,...e})}}}),$N={input:pN,default:mN,output:fN},TN={default:RN,straight:xN,step:SN,smoothstep:mf,simplebezier:AN};function MN(e,n,o){const i=t.computed(()=>g=>n.value.get(g)),a=t.computed(()=>g=>o.value.get(g)),r=t.computed(()=>{const g={...TN,...e.edgeTypes},_=Object.keys(g);for(const E of e.edges)E.type&&!_.includes(E.type)&&(g[E.type]=E.type);return g}),l=t.computed(()=>{const g={...$N,...e.nodeTypes},_=Object.keys(g);for(const E of e.nodes)E.type&&!_.includes(E.type)&&(g[E.type]=E.type);return g}),s=t.computed(()=>e.onlyRenderVisibleElements?xm(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 g=[];for(const _ of e.edges){const E=n.value.get(_.source),N=n.value.get(_.target);V0({sourcePos:E.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:E.dimensions.width,sourceHeight:E.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(_)}return g}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const g=[];for(const _ of e.nodes)_.selected&&g.push(_);return g}),m=t.computed(()=>{const g=[];for(const _ of e.edges)_.selected&&g.push(_);return g}),h=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const g=[];for(const _ of e.nodes)_.dimensions.width&&_.dimensions.height&&_.handleBounds!==void 0&&g.push(_);return g}),y=t.computed(()=>s.value.length>0&&f.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:f,areNodesInitialized:y}}class Qn{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)??Qn.instance;return Qn.instance=i??new Qn,o&&(o.config.globalProperties.$vueFlowStorage=Qn.instance),Qn.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=nf(),a=t.reactive(i),r={};for(const[h,f]of Object.entries(a.hooks)){const y=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[y]=f.on}const l={};for(const[h,f]of Object.entries(a.hooks))l[h]=f.trigger;const s=t.computed(()=>{const h=new Map;for(const f of a.nodes)h.set(f.id,f);return h}),c=t.computed(()=>{const h=new Map;for(const f of a.edges)h.set(f.id,f);return h}),d=MN(a,s,c),u=cN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...A_(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=Qn.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(Wm,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,f)=>{const y=_=>{d.applyNodeChanges(_)},g=_=>{d.applyEdgeChanges(_)};m?(d.onNodesChange(y),d.onEdgesChange(g)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)),f(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(g)})},{immediate:!0}),oi(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Ni(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(Wm,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new ft(st.USEVUEFLOW_OPTIONS))}return s}function VN(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=Da(e.value);(s.width===0||s.height===0)&&n.error(new ft(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 BN={name:"UserSelection",compatConfig:{MODE:3}},DN=t.defineComponent({...BN,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))}}),ON=["tabIndex"],LN={name:"NodesSelection",compatConfig:{MODE:3}},PN=t.defineComponent({...LN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=je(),s=tf(),c=t.ref(null),d=Zm({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(()=>Pl(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 f(y){r.value||Ao[y.key]&&(y.preventDefault(),s({x:Ao[y.key].x,y:Ao[y.key].y},y.shiftKey))}return(y,g)=>!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:f},null,46,ON)],6)):t.createCommentVNode("",!0)}});function zN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const FN={name:"Pane",compatConfig:{MODE:3}},UN=t.defineComponent({...FN,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:f,selectionMode:y,deleteKeyCode:g,multiSelectionKeyCode:_,multiSelectionActive:E,edgeLookup:N,nodeLookup:p,connectionLookup:k,defaultEdgeOptions:I,connectionStartHandle:A,panOnDrag:$}=je(),L=t.shallowRef(null),V=t.shallowRef(new Set),S=t.shallowRef(new Set),x=t.shallowRef(null),T=t.toRef(()=>c.value&&(e.isSelecting||r.value)),D=t.toRef(()=>A.value!==null);let b=!1,w=!1;const v=yi(g,{actInsideInputWithModifier:!1}),O=yi(_);t.watch(v,me=>{me&&(h(m.value),f(u.value),d.value=!1)}),t.watch(O,me=>{E.value=me});function M(me,se){return ke=>{ke.target===se&&(me==null||me(ke))}}function z(me){if(b||D.value){b=!1;return}a.paneClick(me),l(),d.value=!1}function j(me){var se;if(Array.isArray($.value)&&((se=$.value)!=null&&se.includes(2))){me.preventDefault();return}a.paneContextMenu(me)}function ie(me){a.paneScroll(me)}function pe(me){var se,ke,Se;if(x.value=((se=n.value)==null?void 0:se.getBoundingClientRect())??null,!c.value||!e.isSelecting||me.button!==0||me.target!==L.value||!x.value)return;(Se=(ke=me.target)==null?void 0:ke.setPointerCapture)==null||Se.call(ke,me.pointerId);const{x:ce,y:fe}=zN(me,x.value);w=!0,b=!1,l(),s.value={width:0,height:0,startX:ce,startY:fe,x:ce,y:fe},a.selectionStart(me)}function ye(me){var se;if(!x.value||!s.value)return;b=!0;const{x:ke,y:Se}=Xt(me,x.value),{startX:ce=0,startY:fe=0}=s.value,oe={startX:ce,startY:fe,x:ke<ce?ke:ce,y:Se<fe?Se:fe,width:Math.abs(ke-ce),height:Math.abs(Se-fe)},le=V.value,ue=S.value;V.value=new Set(xm(o.value,oe,i.value,y.value===Dl.Partial,!0).map(P=>P.id)),S.value=new Set;const F=((se=I.value)==null?void 0:se.selectable)??!0;for(const P of V.value){const U=k.value.get(P);if(U)for(const{edgeId:Q}of U.values()){const X=N.value.get(Q);X&&(X.selectable??F)&&S.value.add(Q)}}if(!qm(le,V.value)){const P=Rn(p.value,V.value,!0);a.nodesChange(P)}if(!qm(ue,S.value)){const P=Rn(N.value,S.value);a.edgesChange(P)}s.value=oe,r.value=!0,d.value=!1}function ge(me){var se;me.button!==0||!w||((se=me.target)==null||se.releasePointerCapture(me.pointerId),!r.value&&s.value&&me.target===L.value&&z(me),r.value=!1,s.value=null,d.value=V.value.size>0,a.selectionEnd(me),e.selectionKeyPressed&&(b=!1),w=!1)}return(me,se)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:L,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:me.isSelecting}]),onClick:se[0]||(se[0]=ke=>T.value?void 0:M(z,L.value)(ke)),onContextmenu:se[1]||(se[1]=ke=>M(j,L.value)(ke)),onWheelPassive:se[2]||(se[2]=ke=>M(ie,L.value)(ke)),onPointerenter:se[3]||(se[3]=ke=>T.value?void 0:t.unref(a).paneMouseEnter(ke)),onPointerdown:se[4]||(se[4]=ke=>T.value?pe(ke):t.unref(a).paneMouseMove(ke)),onPointermove:se[5]||(se[5]=ke=>T.value?ye(ke):t.unref(a).paneMouseMove(ke)),onPointerup:se[6]||(se[6]=ke=>T.value?ge(ke):void 0),onPointerleave:se[7]||(se[7]=ke=>t.unref(a).paneMouseLeave(ke))},[t.renderSlot(me.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(DN,{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(PN,{key:1})):t.createCommentVNode("",!0)],34))}}),HN={name:"Transform",compatConfig:{MODE:3}},jN=t.defineComponent({...HN,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))}}),KN={name:"Viewport",compatConfig:{MODE:3}},GN=t.defineComponent({...KN,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:f,zoomOnScroll:y,preventScrolling:g,noWheelClassName:_,noPanClassName:E,emits:N,connectionStartHandle:p,userSelectionActive:k,paneDragging:I,d3Zoom:A,d3Selection:$,d3ZoomHandler:L,viewport:V,viewportRef:S,paneClickDistance:x}=je();VN(S);const T=t.shallowRef(!1),D=t.shallowRef(!1);let b=null,w=!1,v=0,O={x:0,y:0,zoom:0};const M=yi(s),z=yi(l),j=yi(r),ie=t.toRef(()=>(!z.value||z.value&&l.value===!0)&&(M.value||m.value)),pe=t.toRef(()=>M.value||c.value),ye=t.toRef(()=>l.value===!0&&ie.value!==!0),ge=t.toRef(()=>z.value&&l.value!==!0||k.value||ye.value),me=t.toRef(()=>p.value!==null);t.onMounted(()=>{if(!S.value){Ni("Viewport element is missing");return}const fe=S.value,oe=fe.getBoundingClientRect(),le=p0().clickDistance(x.value).scaleExtent([n.value,o.value]).translateExtent(a.value),ue=Mt(fe).call(le),F=ue.on("wheel.zoom"),P=Ro.translate(i.value.x??0,i.value.y??0).scale(Wn(i.value.zoom??1,n.value,o.value)),U=[[0,0],[oe.width,oe.height]],Q=le.constrain()(P,U,a.value);le.transform(ue,Q),le.wheelDelta(zl),A.value=le,$.value=ue,L.value=F,V.value={x:Q.x,y:Q.y,zoom:Q.k},le.on("start",X=>{var _e;if(!X.sourceEvent)return null;v=X.sourceEvent.button,T.value=!0;const he=Se(X.transform);((_e=X.sourceEvent)==null?void 0:_e.type)==="mousedown"&&(I.value=!0),O=he,N.viewportChangeStart(he),N.moveStart({event:X,flowTransform:he})}),le.on("end",X=>{if(!X.sourceEvent)return null;if(T.value=!1,I.value=!1,se(ie.value,v??0)&&!w&&N.paneContextMenu(X.sourceEvent),w=!1,ke(O,X.transform)){const _e=Se(X.transform);O=_e,N.viewportChangeEnd(_e),N.moveEnd({event:X,flowTransform:_e})}}),le.filter(X=>{var _e;const he=j.value||y.value,we=f.value&&X.ctrlKey,Ie=X.button,q=X.type==="wheel";if(Ie===1&&X.type==="mousedown"&&(ce(X,"vue-flow__node")||ce(X,"vue-flow__edge")))return!0;if(!ie.value&&!he&&!pe.value&&!h.value&&!f.value||k.value||me.value&&!q||!h.value&&X.type==="dblclick"||ce(X,_.value)&&q||ce(X,E.value)&&(!q||pe.value&&q&&!j.value)||!f.value&&X.ctrlKey&&q||!he&&!pe.value&&!we&&q)return!1;if(!f&&X.type==="touchstart"&&((_e=X.touches)==null?void 0:_e.length)>1)return X.preventDefault(),!1;if(!ie.value&&(X.type==="mousedown"||X.type==="touchstart")||ye.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ie===0||Array.isArray(m.value)&&!m.value.includes(Ie)&&(X.type==="mousedown"||X.type==="touchstart"))return!1;const K=Array.isArray(m.value)&&m.value.includes(Ie)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ie||Ie<=1;return(!X.ctrlKey||M.value||q)&&K}),t.watch([k,ie],()=>{k.value&&!T.value?le.on("zoom",null):k.value||le.on("zoom",X=>{V.value={x:X.transform.x,y:X.transform.y,zoom:X.transform.k};const _e=Se(X.transform);w=se(ie.value,v??0),N.viewportChange(_e),N.move({event:X,flowTransform:_e})})},{immediate:!0}),t.watch([k,pe,d,j,f,g,_],()=>{pe.value&&!j.value&&!k.value?ue.on("wheel.zoom",X=>{if(ce(X,_.value))return!1;const _e=j.value||y.value,he=f.value&&X.ctrlKey;if(!(!g.value||pe.value||_e||he))return!1;X.preventDefault(),X.stopImmediatePropagation();const Ie=ue.property("__zoom").k||1,q=Ei();if(!M.value&&X.ctrlKey&&f.value&&q){const G=Yt(X),te=zl(X),Y=Ie*2**te;le.scaleTo(ue,Y,G,X);return}const K=X.deltaMode===1?20:1;let J=d.value===hi.Vertical?0:X.deltaX*K,ve=d.value===hi.Horizontal?0:X.deltaY*K;!q&&X.shiftKey&&d.value!==hi.Vertical&&!J&&ve&&(J=ve,ve=0),le.translateBy(ue,-(J/Ie)*u.value,-(ve/Ie)*u.value);const Te=Se(ue.property("__zoom"));b&&clearTimeout(b),D.value?(N.move({event:X,flowTransform:Te}),N.viewportChange(Te),b=setTimeout(()=>{N.moveEnd({event:X,flowTransform:Te}),N.viewportChangeEnd(Te),D.value=!1},150)):(D.value=!0,N.moveStart({event:X,flowTransform:Te}),N.viewportChangeStart(Te))},{passive:!1}):typeof F<"u"&&ue.on("wheel.zoom",function(X,_e){const he=!g.value&&X.type==="wheel"&&!X.ctrlKey,we=j.value||y.value,Ie=f.value&&X.ctrlKey;if(!we&&!c.value&&!Ie&&X.type==="wheel"||he||ce(X,_.value))return null;X.preventDefault(),F.call(this,X,_e)},{passive:!1})},{immediate:!0})});function se(fe,oe){return oe===2&&Array.isArray(fe)&&fe.includes(2)}function ke(fe,oe){return fe.x!==oe.x&&!Number.isNaN(oe.x)||fe.y!==oe.y&&!Number.isNaN(oe.y)||fe.zoom!==oe.k&&!Number.isNaN(oe.k)}function Se(fe){return{x:fe.x,y:fe.y,zoom:fe.k}}function ce(fe,oe){return fe.target.closest(`.${oe}`)}return(fe,oe)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:S,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(UN,{"is-selecting":ge.value,"selection-key-pressed":t.unref(z),class:t.normalizeClass({connecting:me.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(jN,null,{default:t.withCtx(()=>[t.renderSlot(fe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),YN=["id"],qN=["id"],WN=["id"],JN={name:"A11yDescriptions",compatConfig:{MODE:3}},XN=t.defineComponent({...JN,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(gm)}-${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,YN),t.createElementVNode("div",{id:`${t.unref(bm)}-${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,qN),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(k0)}-${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,WN))],64))}});function ZN(){const e=je();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function QN(e,n,o){return o===$e.Left?e-n:o===$e.Right?e+n:e}function ew(e,n,o){return o===$e.Top?e-n:o===$e.Bottom?e+n:e}const Zl=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=$e.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:QN(n,e,i),cy:ew(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};Zl.props=["radius","centerX","centerY","position","type"],Zl.compatConfig={MODE:3};const ff=Zl,tw=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:f,disableKeyboardA11y:y,elementsSelectable:g,edgesUpdatable:_,edgesFocusable:E,hooks:N}=je(),p=t.computed(()=>u(e.id)),{emit:k,on:I}=J0(p.value,r),A=t.inject(za),$=t.getCurrentInstance(),L=t.ref(!1),V=t.ref(!1),S=t.ref(""),x=t.ref(null),T=t.ref("source"),D=t.ref(null),b=t.toRef(()=>typeof p.value.selectable>"u"?g.value:p.value.selectable),w=t.toRef(()=>typeof p.value.updatable>"u"?_.value:p.value.updatable),v=t.toRef(()=>typeof p.value.focusable>"u"?E.value:p.value.focusable);t.provide(Y0,e.id),t.provide(q0,D);const O=t.computed(()=>p.value.class instanceof Function?p.value.class(p.value):p.value.class),M=t.computed(()=>p.value.style instanceof Function?p.value.style(p.value):p.value.style),z=t.computed(()=>{const P=p.value.type||"default",U=A==null?void 0:A[`edge-${P}`];if(U)return U;let Q=p.value.template??c.value[P];if(typeof Q=="string"&&$){const X=Object.keys($.appContext.components);X&&X.includes(P)&&(Q=t.resolveComponent(P,!1))}return Q&&typeof Q!="string"?Q:(r.error(new ft(st.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:j}=Qm({nodeId:S,handleId:x,type:T,isValidConnection:h,edgeUpdaterType:T,onEdgeUpdate:ye,onEdgeUpdateEnd:ge});return()=>{const P=m(p.value.source),U=m(p.value.target),Q="pathOptions"in p.value?p.value.pathOptions:{};if(!P&&!U)return r.error(new ft(st.EDGE_SOURCE_TARGET_MISSING,p.value.id,p.value.source,p.value.target)),null;if(!P)return r.error(new ft(st.EDGE_SOURCE_MISSING,p.value.id,p.value.source)),null;if(!U)return r.error(new ft(st.EDGE_TARGET_MISSING,p.value.id,p.value.target)),null;if(!p.value||p.value.hidden||P.hidden||U.hidden)return null;let X;i.value===un.Strict?X=P.handleBounds.source:X=[...P.handleBounds.source||[],...P.handleBounds.target||[]];const _e=Pm(X,p.value.sourceHandle);let he;i.value===un.Strict?he=U.handleBounds.target:he=[...U.handleBounds.target||[],...U.handleBounds.source||[]];const we=Pm(he,p.value.targetHandle),Ie=(_e==null?void 0:_e.position)||$e.Bottom,q=(we==null?void 0:we.position)||$e.Top,{x:K,y:J}=To(P,_e,Ie),{x:ve,y:Te}=To(U,we,q);return p.value.sourceX=K,p.value.sourceY=J,p.value.targetX=ve,p.value.targetY=Te,t.h("g",{ref:D,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${z.value===!1?"default":p.value.type||"default"}`,s.value,O.value,{updating:L.value,selected:p.value.selected,animated:p.value.animated,inactive:!b.value&&!N.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":p.value.ariaLabel===null?void 0:p.value.ariaLabel??`Edge from ${p.value.source} to ${p.value.target}`,"aria-describedby":v.value?`${bm}-${n}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",...p.value.domAttributes,onClick:se,onContextmenu:ke,onDblclick:Se,onMouseenter:ce,onMousemove:fe,onMouseleave:oe,onKeyDown:v.value?F:void 0},[V.value?null:t.h(z.value===!1?c.value.default:z.value,{id:e.id,sourceNode:P,targetNode:U,source:p.value.source,target:p.value.target,type:p.value.type,updatable:w.value,selected:p.value.selected,animated:p.value.animated,label:p.value.label,labelStyle:p.value.labelStyle,labelShowBg:p.value.labelShowBg,labelBgStyle:p.value.labelBgStyle,labelBgPadding:p.value.labelBgPadding,labelBgBorderRadius:p.value.labelBgBorderRadius,data:p.value.data,events:{...p.value.events,...I},style:M.value,markerStart:`url('#${ki(p.value.markerStart,n)}')`,markerEnd:`url('#${ki(p.value.markerEnd,n)}')`,sourcePosition:Ie,targetPosition:q,sourceX:K,sourceY:J,targetX:ve,targetY:Te,sourceHandleId:p.value.sourceHandle,targetHandleId:p.value.targetHandle,interactionWidth:p.value.interactionWidth,...Q}),[w.value==="source"||w.value===!0?[t.h("g",{onMousedown:le,onMouseenter:ie,onMouseout:pe},t.h(ff,{position:Ie,centerX:K,centerY:J,radius:a.value,type:"source","data-type":"source"}))]:null,w.value==="target"||w.value===!0?[t.h("g",{onMousedown:ue,onMouseenter:ie,onMouseout:pe},t.h(ff,{position:q,centerX:ve,centerY:Te,radius:a.value,type:"target","data-type":"target"}))]:null]])};function ie(){L.value=!0}function pe(){L.value=!1}function ye(P,U){k.update({event:P,edge:p.value,connection:U})}function ge(P){k.updateEnd({event:P,edge:p.value}),V.value=!1}function me(P,U){P.button===0&&(V.value=!0,S.value=U?p.value.target:p.value.source,x.value=(U?p.value.targetHandle:p.value.sourceHandle)??null,T.value=U?"target":"source",k.updateStart({event:P,edge:p.value}),j(P))}function se(P){var U;const Q={event:P,edge:p.value};b.value&&(l.value=!1,p.value.selected&&f.value?(d([p.value]),(U=D.value)==null||U.blur()):o([p.value])),k.click(Q)}function ke(P){k.contextMenu({event:P,edge:p.value})}function Se(P){k.doubleClick({event:P,edge:p.value})}function ce(P){k.mouseEnter({event:P,edge:p.value})}function fe(P){k.mouseMove({event:P,edge:p.value})}function oe(P){k.mouseLeave({event:P,edge:p.value})}function le(P){me(P,!0)}function ue(P){me(P,!1)}function F(P){var U;!y.value&&_m.includes(P.key)&&b.value&&(P.key==="Escape"?((U=D.value)==null||U.blur(),d([u(e.id)])):o([u(e.id)]))}}}),nw=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(za))==null?void 0:e["connection-line"],f=t.computed(()=>{var N;return m((N=i.value)==null?void 0:N.nodeId)}),y=t.computed(()=>{var N;return m((N=a.value)==null?void 0:N.nodeId)??null}),g=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),_=t.computed(()=>c.value.markerStart?`url(#${ki(c.value.markerStart,n)})`:""),E=t.computed(()=>c.value.markerEnd?`url(#${ki(c.value.markerEnd,n)})`:"");return()=>{var N,p,k;if(!f.value||!i.value)return null;const I=i.value.id,A=i.value.type,$=f.value.handleBounds;let L=($==null?void 0:$[A])??[];if(o.value===un.Loose){const M=($==null?void 0:$[A==="source"?"target":"source"])??[];L=[...L,...M]}if(!L)return null;const V=(I?L.find(M=>M.id===I):L[0])??null,S=(V==null?void 0:V.position)??$e.Top,{x,y:T}=To(f.value,V,S);let D=null;y.value&&(o.value===un.Strict?D=((N=y.value.handleBounds[A==="source"?"target":"source"])==null?void 0:N.find(M=>{var z;return M.id===((z=a.value)==null?void 0:z.id)}))||null:D=((p=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:p.find(M=>{var z;return M.id===((z=a.value)==null?void 0:z.id)}))||null);const b=((k=a.value)==null?void 0:k.position)??(S?Gl[S]:null);if(!S||!b)return null;const w=l.value??c.value.type??qn.Bezier;let v="";const O={sourceX:x,sourceY:T,sourcePosition:S,targetX:g.value.x,targetY:g.value.y,targetPosition:b};return w===qn.Bezier?[v]=lf(O):w===qn.Step?[v]=Xl({...O,borderRadius:0}):w===qn.SmoothStep?[v]=Xl(O):w===qn.SimpleBezier?[v]=cf(O):v=`M${x},${T} ${g.value.x},${g.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:x,sourceY:T,sourcePosition:S,targetX:g.value.x,targetY:g.value.y,targetPosition:b,sourceNode:f.value,sourceHandle:V,targetNode:y.value,targetHandle:D,markerEnd:E.value,markerStart:_.value,connectionStatus:d.value}):t.h("path",{d:v,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":E.value,"marker-start":_.value})))}}}),ow=["id","markerWidth","markerHeight","markerUnits","orient"],iw={name:"MarkerType",compatConfig:{MODE:3}},aw=t.defineComponent({...iw,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(Ol).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(Ol).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,ow))}}),rw={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},lw={name:"MarkerDefinitions",compatConfig:{MODE:3}},sw=t.defineComponent({...lw,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=ki(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",rw,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(aw,{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))])]))}}),cw={name:"Edges",compatConfig:{MODE:3}},dw=t.defineComponent({...cw,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=je();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(sw),(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(B0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(tw),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(nw))],64))}}),uw=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:f,disableKeyboardA11y:y,ariaLiveMessage:g,snapToGrid:_,snapGrid:E,nodeDragThreshold:N,nodesDraggable:p,elementsSelectable:k,nodesConnectable:I,nodesFocusable:A,hooks:$}=je(),L=t.ref(null);t.provide(Xm,L),t.provide(Jm,e.id);const V=t.inject(za),S=t.getCurrentInstance(),x=tf(),{node:T,parentNode:D}=ef(e.id),{emit:b,on:w}=eN(T,l),v=t.toRef(()=>typeof T.draggable>"u"?p.value:T.draggable),O=t.toRef(()=>typeof T.selectable>"u"?k.value:T.selectable),M=t.toRef(()=>typeof T.connectable>"u"?I.value:T.connectable),z=t.toRef(()=>typeof T.focusable>"u"?A.value:T.focusable),j=t.computed(()=>O.value||v.value||$.value.nodeClick.hasListeners()||$.value.nodeDoubleClick.hasListeners()||$.value.nodeMouseEnter.hasListeners()||$.value.nodeMouseMove.hasListeners()||$.value.nodeMouseLeave.hasListeners()),ie=t.toRef(()=>!!T.dimensions.width&&!!T.dimensions.height),pe=t.computed(()=>{const U=T.type||"default",Q=V==null?void 0:V[`node-${U}`];if(Q)return Q;let X=T.template||m.value[U];if(typeof X=="string"&&S){const _e=Object.keys(S.appContext.components);_e&&_e.includes(U)&&(X=t.resolveComponent(U,!1))}return X&&typeof X!="string"?X:(l.error(new ft(st.NODE_TYPE_MISSING,X)),!1)}),ye=Zm({id:e.id,el:L,disabled:()=>!v.value,selectable:O,dragHandle:()=>T.dragHandle,onStart(U){b.dragStart(U)},onDrag(U){b.drag(U)},onStop(U){b.dragStop(U)},onClick(U){F(U)}}),ge=t.computed(()=>T.class instanceof Function?T.class(T):T.class),me=t.computed(()=>{const U=(T.style instanceof Function?T.style(T):T.style)||{},Q=T.width instanceof Function?T.width(T):T.width,X=T.height instanceof Function?T.height(T):T.height;return!U.width&&Q&&(U.width=typeof Q=="string"?Q:`${Q}px`),!U.height&&X&&(U.height=typeof X=="string"?X:`${X}px`),U}),se=t.toRef(()=>Number(T.zIndex??me.value.zIndex??0));return u(U=>{(U.includes(e.id)||!U.length)&&Se()}),t.onMounted(()=>{t.watch(()=>T.hidden,(U=!1,Q,X)=>{!U&&L.value&&(e.resizeObserver.observe(L.value),X(()=>{L.value&&e.resizeObserver.unobserve(L.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>T.type,()=>T.sourcePosition,()=>T.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])})}),t.watch([()=>T.position.x,()=>T.position.y,()=>{var U;return(U=D.value)==null?void 0:U.computedPosition.x},()=>{var U;return(U=D.value)==null?void 0:U.computedPosition.y},()=>{var U;return(U=D.value)==null?void 0:U.computedPosition.z},se,()=>T.selected,()=>T.dimensions.height,()=>T.dimensions.width,()=>{var U;return(U=D.value)==null?void 0:U.dimensions.height},()=>{var U;return(U=D.value)==null?void 0:U.dimensions.width}],([U,Q,X,_e,he,we])=>{const Ie={x:U,y:Q,z:we+(f.value&&T.selected?1e3:0)};typeof X<"u"&&typeof _e<"u"?T.computedPosition=R0({x:X,y:_e,z:he},Ie):T.computedPosition=Ie},{flush:"post",immediate:!0}),t.watch([()=>T.extent,h],([U,Q],[X,_e])=>{(U!==X||Q!==_e)&&ke()}),T.extent==="parent"||typeof T.extent=="object"&&"range"in T.extent&&T.extent.range==="parent"?hl(()=>ie).toBe(!0).then(ke):ke(),()=>T.hidden?null:t.h("div",{ref:L,"data-id":T.id,class:["vue-flow__node",`vue-flow__node-${pe.value===!1?"default":T.type||"default"}`,{[o.value]:v.value,dragging:ye==null?void 0:ye.value,draggable:v.value,selected:T.selected,selectable:O.value,parent:T.isParent},ge.value],style:{visibility:ie.value?"visible":"hidden",zIndex:T.computedPosition.z??se.value,transform:`translate(${T.computedPosition.x}px,${T.computedPosition.y}px)`,pointerEvents:j.value?"all":"none",...me.value},tabIndex:z.value?0:void 0,role:z.value?"group":void 0,"aria-describedby":y.value?void 0:`${gm}-${n}`,"aria-label":T.ariaLabel,"aria-roledescription":"node",...T.domAttributes,onMouseenter:ce,onMousemove:fe,onMouseleave:oe,onContextmenu:le,onClick:F,onDblclick:ue,onKeydown:P},[t.h(pe.value===!1?m.value.default:pe.value,{id:T.id,type:T.type,data:T.data,events:{...T.events,...w},selected:T.selected,resizing:T.resizing,dragging:ye.value,connectable:M.value,position:T.computedPosition,dimensions:T.dimensions,isValidTargetPos:T.isValidTargetPos,isValidSourcePos:T.isValidSourcePos,parent:T.parentNode,parentNodeId:T.parentNode,zIndex:T.computedPosition.z??se.value,targetPosition:T.targetPosition,sourcePosition:T.sourcePosition,label:T.label,dragHandle:T.dragHandle,onUpdateNodeInternals:Se})]);function ke(){const U=T.computedPosition,{computedPosition:Q,position:X}=Hl(T,_.value?Pa(U,E.value):U,l.error,h.value,D.value);(T.computedPosition.x!==Q.x||T.computedPosition.y!==Q.y)&&(T.computedPosition={...T.computedPosition,...Q}),(T.position.x!==X.x||T.position.y!==X.y)&&(T.position=X)}function Se(){L.value&&d([{id:e.id,nodeElement:L.value,forceUpdate:!0}])}function ce(U){ye!=null&&ye.value||b.mouseEnter({event:U,node:T})}function fe(U){ye!=null&&ye.value||b.mouseMove({event:U,node:T})}function oe(U){ye!=null&&ye.value||b.mouseLeave({event:U,node:T})}function le(U){return b.contextMenu({event:U,node:T})}function ue(U){return b.doubleClick({event:U,node:T})}function F(U){O.value&&(!i.value||!v.value||N.value>0)&&Yl(T,r.value,c,s,a,!1,L.value),b.click({event:U,node:T})}function P(U){if(!(Ll(U)||y.value))if(_m.includes(U.key)&&O.value){const Q=U.key==="Escape";Yl(T,r.value,c,s,a,Q,L.value)}else v.value&&T.selected&&Ao[U.key]&&(U.preventDefault(),g.value=`Moved selected node ${U.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~T.position.x}, y: ${~~T.position.y}`,x({x:Ao[U.key].x,y:Ao[U.key].y},U.shiftKey))}}});function mw(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 fw={class:"vue-flow__nodes vue-flow__container"},pw={name:"Nodes",compatConfig:{MODE:3}},hw=t.defineComponent({...pw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=je(),a=mw(),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",fw,[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 f=(t.openBlock(),t.createBlock(t.unref(uw),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=h,f},s,0),128)):t.createCommentVNode("",!0)]))}});function yw(){const{emits:e}=je();t.onMounted(()=>{if(jm()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new ft(st.MISSING_STYLES))}})}const gw=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),bw={name:"VueFlow",compatConfig:{MODE:3}},_w=t.defineComponent({...bw,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=yl(i,"modelValue",o),l=yl(i,"nodes",o),s=yl(i,"edges",o),c=je(i),d=iN({modelValue:r,nodes:l,edges:s},i,c);return rN(o,c.hooks),ZN(),yw(),t.provide(za,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(GN,null,{default:t.withCtx(()=>[t.createVNode(dw),gw,t.createVNode(hw),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(XN)],512))}}),kw={name:"Panel",compatConfig:{MODE:3}},pf=t.defineComponent({...kw,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))}}),Ew=["width","height","innerHTML"],Nw=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,Ew))}}),Ke=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ae=Ke(Nw,[["__scopeId","data-v-05aac699"]]),eo=["red","amber","green","teal","blue","indigo","violet","pink"],hf={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 ww(e){return typeof e=="string"&&e in hf}const Iw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},vw=.15;function Cw(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 xw(e){if(typeof e!="string")return null;const n=Cw(e);if(!n||n.s<vw)return null;let o=null,i=1/0;for(const a of eo){const r=Math.abs(n.h-Iw[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(ww(n))return n;const o=e==null?void 0:e.properties;return xw((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function Ql(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const Sw={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 yf(e,n=!1){return e?n?Rw[e]:Sw[e]:null}function to(e){return hf[e]}function Mo(e){return`var(--em-swatch-${e}-bar)`}function Aw(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 $w(e,n){const o=Aw(n);return o?e(o):n.split("-")[1]??n}function Tw(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-TYPE-7":return"em.check.type7";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 gf(e,n){const o=Tw(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 Mw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const Vw={class:"em-inline-issue__msgs"},no=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",Vw,[(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(gf)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Bw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],Dw={key:0,class:"em-mlang__dot"},Ow=["id","role","aria-labelledby"],Lw=["title"],mn=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 E=o.defaultLang;return E&&o.languages.includes(E)?E:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const E=o.activeLang;return E&&o.languages.includes(E)?E:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(E){var N,p;return!!((p=(N=o.modelValue)==null?void 0:N[E])!=null&&p.trim())}const d=E=>`${o.name}-tab-${E}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function h(E){var k,I;const N=o.languages,p=N[(E+N.length)%N.length];p&&(l.value=p,await t.nextTick(),(I=(k=m.value)==null?void 0:k.querySelectorAll('[role="tab"]')[N.indexOf(p)])==null||I.focus())}function f(E){h(o.languages.indexOf(s.value)+E)}const y=t.computed(()=>o.languages.filter(E=>{var N,p;return E!==s.value&&!!((p=(N=o.modelValue)==null?void 0:N[E])!=null&&p.trim())})),g=t.computed(()=>{var E;return((E=o.modelValue)==null?void 0:E[s.value])??""});function _(E){const N={...o.modelValue};E.trim()===""?delete N[s.value]:N[s.value]=E,i("update:modelValue",N)}return(E,N)=>(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,p=>(t.openBlock(),t.createElementBlock("span",{id:d(p),key:p,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===p}]),role:"tab","aria-selected":s.value===p,"aria-controls":u.value,tabindex:s.value===p?0:-1,onClick:k=>l.value=p,onKeydown:[t.withKeys(t.withModifiers(k=>l.value=p,["prevent"]),["enter"]),t.withKeys(t.withModifiers(k=>l.value=p,["prevent"]),["space"]),N[0]||(N[0]=t.withKeys(t.withModifiers(k=>f(-1),["prevent"]),["left"])),N[1]||(N[1]=t.withKeys(t.withModifiers(k=>f(1),["prevent"]),["right"])),N[2]||(N[2]=t.withKeys(t.withModifiers(k=>h(0),["prevent"]),["home"])),N[3]||(N[3]=t.withKeys(t.withModifiers(k=>h(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(p),1),c(p)?(t.openBlock(),t.createElementBlock("span",Dw,"•")):t.createCommentVNode("",!0)],42,Bw))),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(ee.BSTextArea),{key:0,name:`${e.name}-${s.value}`,width:"100%",height:e.height??"64px",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":_},null,8,["name","height","placeholder","model-value"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`${e.name}-${s.value}`,width:"100%",placeholder:e.placeholder,"model-value":g.value,"onUpdate:modelValue":_},null,8,["name","placeholder","model-value"]))],8,Ow),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,Lw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Pw=["disabled"],zw={class:"em-panel__sub-label"},Fw={class:"em-field"},Uw={class:"em-field"},Hw={class:"em-field"},jw={class:"em-class"},Kw={class:"em-field"},Gw={class:"em-field"},Yw={class:"em-field"},qw={class:"em-field"},Ww={class:"em-multilang"},Jw={class:"em-multilang"},Xw={class:"em-jpa"},Zw={class:"em-field"},Qw={class:"em-field"},eI={class:"em-field"},tI=["title"],nI={class:"em-swatch"},oI={class:"em-swatch__row"},iI=["title"],aI=["title","onClick"],bf=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(D=>D.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(D=>D.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var D;return _t(((D=l.value)==null?void 0:D.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=D=>D;function h(D){return D==="inherit"?a.t("em.common.inherit"):D}function f(D){r.value&&a.updateEntity(r.value.modelId,D)}function y(D,b,w){var O;const v=((O=r.value)==null?void 0:O.table)??{physicalName:""};f(D==="physicalName"?{table:{...v,physicalName:w}}:{table:{...v,logicalName:{...v.logicalName,[b]:w}}})}function g(D){f({description:Object.keys(D).length?D:void 0})}function _(D,b){var w;f({jpaAttrs:{...(w=r.value)==null?void 0:w.jpaAttrs,[D]:b}})}function E(D,b){_(D,b)}const N=t.computed(()=>{var D,b;return((b=(D=r.value)==null?void 0:D.jpaAttrs)==null?void 0:b.discriminatorType)??"inherit"}),p=t.computed(()=>{var D,b;return!((b=(D=r.value)==null?void 0:D.jpaAttrs)!=null&&b.useDiscriminator)});function k(D){_("discriminatorType",D==="inherit"?void 0:D)}function I(D){f({hasPersonalInfo:D})}function A(D){f({referenceOnly:D?!0:void 0})}function $(D){f({superClass:D.trim()||void 0})}function L(D){f({schema:D.trim()||void 0})}function V(D){f({abstractClass:D})}const S=t.computed(()=>{var D,b;return((b=(D=r.value)==null?void 0:D.declarationOfInterfaces)==null?void 0:b.join(", "))??""});function x(D){const b=D.split(",").map(w=>w.trim()).filter(Boolean);f({declarationOfInterfaces:b.length?b:void 0})}function T(D){r.value&&a.setEntitySwatch(r.value.modelId,D)}return(D,b)=>{var w,v,O;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:b[0]||(b[0]=M=>i("toggle"))},[t.createElementVNode("span",zw,[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(no,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",Fw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.name")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-name",width:"100%","model-value":r.value.name,"onUpdate:modelValue":b[1]||(b[1]=M=>f({name:M}))},null,8,["model-value"])]),t.createElementVNode("label",Uw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.stereotype")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":r.value.stereotype,items:c,"value-provider":m,"label-provider":t.unref(Go),"onUpdate:modelValue":b[2]||(b[2]=M=>f({stereotype:M}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Hw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-package",width:"100%","model-value":r.value.packageName??"","onUpdate:modelValue":b[3]||(b[3]=M=>f({packageName:M}))},null,8,["model-value"])]),t.createElementVNode("fieldset",jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Kw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.superClass")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-superclass",width:"100%",placeholder:t.unref(a).t("em.entity.superClassPlaceholder"),"model-value":r.value.superClass??"","onUpdate:modelValue":b[4]||(b[4]=M=>$(M))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",Gw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.interfaces")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-interfaces",width:"100%",placeholder:t.unref(a).t("em.entity.interfacesPlaceholder"),"model-value":S.value,"onUpdate:modelValue":b[5]||(b[5]=M=>x(M))},null,8,["placeholder","model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-abstract",class:"em-check",label:t.unref(a).t("em.entity.abstractClass"),"model-value":!!r.value.abstractClass,"onUpdate:modelValue":b[6]||(b[6]=M=>V(M))},null,8,["label","model-value"])]),t.createElementVNode("label",Yw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.tablePhysical")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-table",width:"100%","model-value":((w=r.value.table)==null?void 0:w.physicalName)??"","onUpdate:modelValue":b[7]||(b[7]=M=>y("physicalName",null,M))},null,8,["model-value"])]),t.createElementVNode("label",qw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.schema")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"ent-schema",width:"100%",placeholder:t.unref(a).t("em.entity.schemaPlaceholder"),"model-value":r.value.schema??"","onUpdate:modelValue":b[8]||(b[8]=M=>L(M))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",Ww,[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,M=>{var z,j;return t.openBlock(),t.createElementBlock("label",{key:M,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(M),1),t.createVNode(t.unref(ee.BSTextInput),{name:`ent-logical-${M}`,width:"100%","model-value":((j=(z=r.value.table)==null?void 0:z.logicalName)==null?void 0:j[M])??"","onUpdate:modelValue":ie=>y("logicalName",M,ie)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",Jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":g},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",Xw,[b[13]||(b[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,M=>{var z;return t.createVNode(t.unref(ee.BSCheckbox),{key:M.key,name:`jpa-${M.key}`,class:"em-check",label:M.label,"model-value":!!((z=r.value.jpaAttrs)!=null&&z[M.key]),"onUpdate:modelValue":j=>E(M.key,j)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",Zw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discColumn")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"disc-col",width:"100%",placeholder:t.unref(a).t("em.entity.discColumnPlaceholder"),disabled:p.value,"model-value":((v=r.value.jpaAttrs)==null?void 0:v.discriminatorColumnName)??"","onUpdate:modelValue":b[9]||(b[9]=M=>_("discriminatorColumnName",M.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",Qw,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(ee.BSSelect),{disabled:p.value,"model-value":N.value,items:u,"value-provider":m,"label-provider":h,"onUpdate:modelValue":b[10]||(b[10]=M=>M&&k(M))},null,8,["disabled","model-value"])]),t.createElementVNode("label",eI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discLength")),1),t.createVNode(t.unref(ee.BSNumberInput),{name:"disc-len",width:"64px",placeholder:"len",disabled:p.value,"model-value":(O=r.value.jpaAttrs)==null?void 0:O.discriminatorLength,"onUpdate:modelValue":b[11]||(b[11]=M=>_("discriminatorLength",M||void 0))},null,8,["disabled","model-value"])])]),t.createVNode(t.unref(ee.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("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(ee.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":A},null,8,["label","model-value"])],8,tI),t.createElementVNode("fieldset",nI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",oI,[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:b[12]||(b[12]=M=>T(null))},"∅",10,iI),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),M=>(t.openBlock(),t.createElementBlock("button",{key:M,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===M}]),style:t.normalizeStyle({background:t.unref(Mo)(M)}),title:t.unref(a).t(t.unref(to)(M)),onClick:z=>T(M)},null,14,aI))),128))])])],64)):t.createCommentVNode("",!0)],8,Pw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),rI=["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"],_f=["inherit","true","false"],qa="__OWN__";function kf(e,n){const o=t.computed(()=>e.state.logical.entities.find(G=>G.modelId===n())??null),i=t.computed(()=>{var G;return((G=o.value)==null?void 0:G.stereotype)==="JPA_EMBEDDABLE"}),a=t.computed(()=>new Set(e.selectedAttrIds.value));function r(G){return G==="none"?e.t("em.common.noneParen"):G}const l=G=>G;function s(G,te){o.value&&e.updateAttribute(o.value.modelId,G.modelId,te)}function c(G){return!!o.value&&!!Xi(e.state.logical,o.value.modelId,G.modelId)}function d(G,te){s(G,{naturalId:te||void 0,naturalIdMutable:te?G.naturalIdMutable:void 0})}function u(){return{naturalId:void 0,naturalIdMutable:void 0}}function m(G,te){s(G,{identifier:te,...te?u():{}})}function h(G,te){s(G,{transient:te||void 0,...te?u():{}})}function f(G){return!!G.transient||G.attrType==="RELATION_REF"}function y(G){return Li(G)}function g(G,te=0){var Y;return((Y=Pi(G,o.value,e.state.logical.entities,e.state.logical.associations,te))==null?void 0:Y.physicalName)||void 0}const _=G=>G.value,E=G=>G.label;function N(G,te){if(!te)return;const Y=x.value.find(ae=>ae.type===te);if(Y){const ae=G.dbAttrs[0]??{modelId:G.modelId+".c",physicalName:G.name,dataType:"VARCHAR"};s(G,{type:te,customType:void 0,dbAttrs:[{...ae,dataType:Y.dataType,length:Y.length,scale:Y.scale}]});return}s(G,te===an?{type:te}:{type:te,customType:void 0})}function p(G,te){s(G,{customType:te.trim()===""?void 0:te})}function k(G,te){if(G.attrType==="RELATION_REF")return;const ae={...G.dbAttrs[0]??{modelId:G.modelId+".c",physicalName:G.name,dataType:"VARCHAR"},...te};te.dataType!==void 0&&!Ar.has(ae.dataType)&&(ae.scale=void 0),s(G,{dbAttrs:[ae]})}function I(G){var te;return Ar.has(((te=G.dbAttrs[0])==null?void 0:te.dataType)??"")}function A(G){return!I(G)&&!y(G)&&!f(G)?e.t("em.attr.scaleTypeHint"):void 0}function $(G,te){k(G,{logicalName:Object.keys(te).length?te:void 0})}function L(G,te){s(G,{description:Object.keys(te).length?te:void 0})}function V(G){return G.personalInfoAttributeType??"none"}function S(G,te){s(G,{personalInfoAttributeType:te==="none"?void 0:te})}const x=t.computed(()=>e.predefinedCustomTypeCatalog.value),T=t.computed(()=>e.embeddableCatalog.value);function D(G){var te,Y,ae;return((te=G.label)==null?void 0:te[e.userLanguage.value])??((Y=G.label)==null?void 0:Y.ko)??((ae=G.label)==null?void 0:ae.en)??G.type}const b=t.computed(()=>e.groupCodeCatalog.value);function w(G){var te;return((te=b.value.find(Y=>Y.groupCode===G.groupCode))==null?void 0:te.codes)??[]}function v(G){return["none",...w(G)]}function O(G){return G==="none"?"none":G.code}function M(G){var Y,ae,Be;if(G==="none")return e.t("em.common.noneParen");const te=((Y=G.label)==null?void 0:Y[e.userLanguage.value])??((ae=G.label)==null?void 0:ae.ko)??((Be=G.label)==null?void 0:Be.en);return te?`${G.code} (${te})`:G.code}function z(G,te){o.value&&e.setAttributeGroupCode(o.value.modelId,G.modelId,te)}function j(G,te){s(G,{defaultValue:te==="none"?void 0:te})}function ie(G,te){s(G,{defaultValue:te.trim()===""?void 0:te})}function pe(G){return G.attrType.startsWith("EMBED")&&G.dbAttrs.length>0}function ye(G,te,Y){const ae=G.dbAttrs.map((Be,Ve)=>{if(Ve!==te)return Be;const H={...Be,...Y};for(const B of Object.keys(Y))Y[B]===void 0&&delete H[B];return H});o.value&&e.setEmbedColumns(o.value.modelId,G.modelId,ae)}function ge(G,te,Y){ye(G,te,{logicalName:Object.keys(Y).length?Y:void 0})}function me(G,te){var Be,Ve,H;if(G.attrType==="EMBED_PREDEF"){const B=(Be=e.embeddableCatalog.value.find(Pe=>Pe.type===G.type))==null?void 0:Be.fields[te];return B?{name:B.name,physicalName:B.physicalName,dataType:B.dataType,length:B.length,scale:B.scale,shareable:B.shareable,logicalName:B.logicalName}:void 0}const Y=(Ve=G.embedded)==null?void 0:Ve.embeddableRef;if(!Y)return;const ae=(H=e.state.logical.entities.find(B=>B.modelId===Y))==null?void 0:H.attributes.flatMap(B=>B.dbAttrs)[te];return ae?{physicalName:ae.physicalName,dataType:ae.dataType,length:ae.length,scale:ae.scale,logicalName:ae.logicalName}:void 0}function se(G,te){var Y,ae;return((Y=me(G,te))==null?void 0:Y.dataType)||((ae=G.dbAttrs[te])==null?void 0:ae.dataType)||""}function ke(G,te){var Y,ae;return((Y=me(G,te))==null?void 0:Y.length)??((ae=G.dbAttrs[te])==null?void 0:ae.length)}function Se(G,te){var Y,ae;return((Y=me(G,te))==null?void 0:Y.scale)??((ae=G.dbAttrs[te])==null?void 0:ae.scale)}const ce=_f;function fe(G){return G==="inherit"?e.t("em.common.inherit"):G}function oe(G){return(G==null?void 0:G.updatable)===void 0?"inherit":G.updatable?"true":"false"}function le(G,te,Y){ye(G,te,{updatable:Y==="inherit"?void 0:Y==="true"})}function ue(G,te){k(G,{updatable:te==="inherit"?void 0:te==="true"})}const F=_f;function P(G){return G==="inherit"?e.t("em.common.inherit"):G}function U(G){return(G==null?void 0:G.insertable)===void 0?"inherit":G.insertable?"true":"false"}function Q(G,te,Y){ye(G,te,{insertable:Y==="inherit"?void 0:Y==="true"})}function X(G,te){k(G,{insertable:te==="inherit"?void 0:te==="true"})}const _e=t.computed(()=>o.value?wr(o.value,e.state.logical.entities):[]),he=t.computed(()=>co(_e.value.flatMap(G=>G.attributes.flatMap(te=>te.dbAttrs)))),we=t.computed(()=>_e.value.flatMap(G=>G.attributes.filter(te=>te.attrType==="NORMAL"&&te.dbAttrs.length===1&&te.dbAttrs[0]).map(te=>{var Y;return{modelId:te.dbAttrs[0].modelId,physical:te.dbAttrs[0].physicalName||te.name,isCurrency:te.type==="Currency",ownerName:G.modelId===((Y=o.value)==null?void 0:Y.modelId)?void 0:G.name}})));function Ie(){const G=[...we.value].sort((te,Y)=>Number(Y.isCurrency)-Number(te.isCurrency));return[qa,...G.map(te=>te.modelId)]}function q(G){if(G===qa)return e.t("em.attr.sharedOwn");const te=we.value.find(ae=>ae.modelId===G);if(!te)return G;const Y=te.ownerName?`${te.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:Y,physical:te.physical,mode:te.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function K(G){return(G==null?void 0:G.sharedColumnRef)??qa}function J(G,te,Y){ye(G,te,{sharedColumnRef:Y===qa?void 0:Y})}function ve(G){return(G==null?void 0:G.sharedColumnRef)!=null}function Te(G){var te;return((te=Dn(G,he.value))==null?void 0:te.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:rI,piiLabel:r,idn:l,setAttr:s,isManagedFk:c,setNaturalId:d,clearNaturalIdPatch:u,setIdentifier:m,setTransient:h,dbLocked:f,fkDerived:y,fkOriginPhysical:g,typeValueOf:_,typeLabelOf:E,setAttrType:N,setAttrCustomType:p,setDb:k,scaleApplicable:I,scaleHint:A,setDbLogical:$,setAttrDescription:L,attrPiiValue:V,setAttrPii:S,predefinedCustomTypeCatalog:x,embeddableCatalog:T,predefinedLabel:D,groupCodeCatalog:b,attrGroupCodes:w,attrCodeItems:v,codeValueOf:O,codeLabelOf:M,setAttrGroupCode:z,setAttrCode:j,setAttrDefaultValue:ie,isEmbedExpanded:pe,setDbAt:ye,setDbLogicalAt:ge,embedColMeta:me,fixedDataType:se,fixedLength:ke,fixedScale:Se,updatableItems:ce,updatableLabel:fe,updatableValue:oe,setUpdatableAt:le,setUpdatable:ue,insertableItems:F,insertableLabel:P,insertableValue:U,setInsertableAt:Q,setInsertable:X,scopeEntities:_e,columnsById:he,sharedCandidates:we,sharedItems:Ie,sharedLabel:q,sharedValue:K,setSharedAt:J,isShared:ve,sharedPhysical:Te}}const Ef={"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.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","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.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","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.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","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"},Nf={"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.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","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.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","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.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと 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":"未指定"},wf={"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.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","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.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","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.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 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":"미지정"},lI=["ko","en","ja"],es={ko:wf,en:Ef,ja:Nf};function Dt(e,n,o){let a=(es[e]??es.ko)[n]??es.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const If=["ko","en","ja","zh"];function sI(e){if(e)for(const n of If){const o=e[n];if(o)return o}}function ts(e){const n=sI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function cI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:If.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const dI=["aria-expanded","placeholder"],uI=["aria-selected","onClick","onMouseenter"],mI={key:0,class:"gcc__opt gcc__opt--empty"},vf=Ke(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=(V,S)=>Dt(o.locale??"ko",V,S),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(V=>V.groupCode===o.modelValue)),f=t.computed(()=>h.value?ts(h.value):"");t.watch(f,V=>{d.value||(c.value=V)},{immediate:!0});const y=t.computed(()=>c.value===f.value?o.items:cI(o.items,c.value));function g(){var S;const V=(S=r.value)==null?void 0:S.getBoundingClientRect();V&&(m.value={left:`${V.left}px`,top:`${V.bottom}px`,width:`${V.width}px`})}function _(){d.value=!0,g(),u.value=Math.max(0,y.value.findIndex(V=>V.groupCode===o.modelValue)),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),document.addEventListener("mousedown",L)}function E(){d.value=!1,window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),document.removeEventListener("mousedown",L)}t.onBeforeUnmount(E);function N(){_(),t.nextTick(()=>{var V;return(V=l.value)==null?void 0:V.select()})}function p(){d.value||_(),u.value=0}function k(V){i("update:modelValue",V.groupCode),c.value=ts(V),E()}function I(){i("update:modelValue",void 0),c.value="",E()}function A(){c.value.trim()===""?I():(c.value=f.value,E())}function $(V){var S;if(V.key==="ArrowDown")d.value||_(),u.value=Math.min(u.value+1,y.value.length-1),V.preventDefault();else if(V.key==="ArrowUp")u.value=Math.max(u.value-1,0),V.preventDefault();else if(V.key==="Enter"){const x=y.value[u.value];x&&k(x),V.preventDefault()}else V.key==="Escape"&&(c.value=f.value,E(),(S=l.value)==null||S.blur())}function L(V){var x,T;const S=V.target;!((x=r.value)!=null&&x.contains(S))&&!((T=s.value)!=null&&T.contains(S))&&A()}return(V,S)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":S[0]||(S[0]=x=>c.value=x),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:N,onInput:p,onKeydown:$},null,40,dI),[[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:S[1]||(S[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,(x,T)=>(t.openBlock(),t.createElementBlock("li",{key:x.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":T===u.value,"is-selected":x.groupCode===e.modelValue}]),role:"option","aria-selected":x.groupCode===e.modelValue,onMousedown:S[2]||(S[2]=t.withModifiers(()=>{},["prevent"])),onClick:D=>k(x),onMouseenter:D=>u.value=T},t.toDisplayString(t.unref(ts)(x)),43,uI))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",mI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),fI=["aria-labelledby"],pI=["aria-checked","tabindex","onClick","onKeydown"],Cf=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,pI))),128))],8,fI))}}),[["__scopeId","data-v-5c793bbb"]]),hI=["disabled"],yI={class:"em-aw__toolbar"},gI={class:"em-aw__count"},bI={class:"em-aw__scroll"},_I={class:"em-aw__table"},kI={class:"c-name"},EI={class:"c-type"},NI={class:"c-logical"},wI=["id"],II={class:"c-col"},vI={class:"c-constraints"},CI={class:"c-del"},xI={class:"c-expand"},SI=["title","onClick","onKeydown"],RI=["title"],AI={key:1,class:"em-aw__muted"},$I=["title"],TI=["title"],MI=["title"],VI={class:"em-aw__cflags"},BI=["title"],DI={colspan:"8"},OI={class:"em-aw__detail"},LI={class:"em-aw__dgroup"},PI=["title"],zI={class:"em-aw__df"},FI={class:"em-aw__df"},UI={class:"em-aw__dgroup"},HI={key:0,class:"em-aw__dgroup"},jI={class:"em-aw__df"},KI={key:0,class:"em-aw__df"},GI={class:"em-aw__df"},YI={class:"em-aw__dgroup em-aw__ddesc"},qI={class:"c-expand"},WI={class:"em-aw__caret is-static","aria-hidden":"true"},JI={class:"c-del"},XI={class:"c-expand"},ZI=["title","onClick","onKeydown"],QI={class:"em-aw__embed-label"},ev=["title"],tv=["title"],nv={class:"em-aw__ro"},ov=["title"],iv={class:"em-aw__ro"},av=["title"],rv={class:"em-aw__ro"},lv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},sv={colspan:"8"},cv={class:"em-aw__detail"},dv={class:"em-aw__dgroup"},uv={key:0,class:"em-aw__df"},mv={class:"em-aw__df"},fv={class:"em-aw__df"},pv={key:0},hv={colspan:"99",class:"em-aw__empty"},yv=6,gv=5,bv=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:f,dbLocked:y,fkDerived:g,fkOriginPhysical:_,typeValueOf:E,typeLabelOf:N,setAttrType:p,setAttrCustomType:k,setDb:I,scaleApplicable:A,scaleHint:$,setDbLogical:L,attrPiiValue:V,setAttrPii:S,predefinedCustomTypeCatalog:x,embeddableCatalog:T,predefinedLabel:D,groupCodeCatalog:b,attrGroupCodes:w,attrCodeItems:v,codeValueOf:O,codeLabelOf:M,setAttrGroupCode:z,setAttrCode:j,setAttrDefaultValue:ie,setAttrDescription:pe,isEmbedExpanded:ye,setDbAt:ge,setDbLogicalAt:me,embedColMeta:se,fixedDataType:ke,fixedLength:Se,fixedScale:ce,updatableItems:fe,updatableLabel:oe,updatableValue:le,setUpdatableAt:ue,setUpdatable:F,insertableItems:P,insertableLabel:U,insertableValue:Q,setInsertableAt:X,setInsertable:_e,sharedItems:he,sharedLabel:we,sharedValue:Ie,setSharedAt:q,isShared:K,sharedPhysical:J}=kf(o,()=>n.entityId),ve=t.computed(()=>{var Ve;return[...((Ve=i.value)==null?void 0:Ve.attributes)??[]].sort((H,B)=>H.order-B.order)}),Te=t.computed(()=>{var Ve;return(((Ve=i.value)==null?void 0:Ve.attributes)??[]).filter(H=>H.attrType!=="DIVIDER").length}),G=t.ref(new Set);function te(Ve){return G.value.has(Ve)}function Y(Ve){const H=new Set(G.value);H.has(Ve)?H.delete(Ve):H.add(Ve),G.value=H}const ae=t.ref(o.userLanguage.value);function Be(Ve){!Ve||!i.value||o.addPredefinedEmbed(i.value.modelId,Ve)}return(Ve,H)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",yI,[t.createElementVNode("span",gI,t.toDisplayString(t.unref(o).t("em.attr.section",{n:Te.value})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:H[0]||(H[0]=B=>t.unref(o).addAttribute(t.unref(i).modelId))},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.attr.addDivider"),onClick:H[1]||(H[1]=B=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(T).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"140px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":void 0,items:t.unref(T),"value-provider":B=>B.type,"label-provider":t.unref(D),"onUpdate:modelValue":Be},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",bI,[t.createElementVNode("table",_I,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[H[3]||(H[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",kI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",EI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",NI,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,wI),t.createVNode(Cf,{modelValue:ae.value,"onUpdate:modelValue":H[2]||(H[2]=B=>ae.value=B),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",II,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),H[4]||(H[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),H[5]||(H[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",vI,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),H[6]||(H[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value,B=>{var Pe,Ze,Ue,Le,De,Z,dt,bn,Et,_n;return t.openBlock(),t.createElementBlock(t.Fragment,{key:B.modelId},[B.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(B.modelId)}])},[H[7]||(H[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-divlabel-${B.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":B.name,"onUpdate:modelValue":Ee=>t.unref(d)(B,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:yv,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",CI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,B.modelId)},null,8,["onClick"])])],2)):t.unref(ye)(B)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(B.modelId)}])},[t.createElementVNode("td",qI,[t.createElementVNode("span",WI,[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":Ee=>t.unref(d)(B,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-type-${B.modelId}`,width:"100%",disabled:"","model-value":B.type},null,8,["name","model-value"])]),t.createElementVNode("td",{colspan:gv,class:"em-aw__embed-note"},t.toDisplayString(t.unref(o).t("em.attr.embedChildCols",{n:B.dbAttrs.length})),1),t.createElementVNode("td",JI,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,B.modelId)},null,8,["onClick"])])],2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.dbAttrs,(Ee,at)=>{var zt,ut,en,tn,Ne,et,Ft,pt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Ee.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":te(Ee.modelId)}])},[t.createElementVNode("td",XI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":te(Ee.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(te(Ee.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:nt=>Y(Ee.modelId),onKeydown:[t.withKeys(t.withModifiers(nt=>Y(Ee.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(nt=>Y(Ee.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,ZI)]),t.createElementVNode("td",QI,"↳ "+t.toDisplayString(((zt=t.unref(se)(B,at))==null?void 0:zt.name)??((ut=t.unref(se)(B,at))==null?void 0:ut.physicalName)??t.unref(o).t("em.attr.colFallback",{n:at+1})),1),H[14]||(H[14]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(mn,{name:`aw-embed-logical-${Ee.modelId}`,languages:t.unref(o).languages.value,"active-lang":ae.value,placeholder:((tn=(en=t.unref(se)(B,at))==null?void 0:en.logicalName)==null?void 0:tn[ae.value])??((et=(Ne=t.unref(se)(B,at))==null?void 0:Ne.logicalName)==null?void 0:et.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ee.logicalName,"onUpdate:modelValue":nt=>t.unref(me)(B,at,nt)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(K)(Ee)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-embed-col-${Ee.modelId}`,width:"100%",disabled:t.unref(K)(Ee),placeholder:((Ft=t.unref(se)(B,at))==null?void 0:Ft.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(K)(Ee)?t.unref(J)(Ee):Ee.physicalName,"onUpdate:modelValue":nt=>t.unref(ge)(B,at,{physicalName:nt})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(no,{controller:t.unref(o),"ref-id":Ee.modelId},null,8,["controller","ref-id"])],8,ev),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",nv,t.toDisplayString(t.unref(ke)(B,at)),1)],8,tv),t.createElementVNode("td",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",iv,t.toDisplayString(t.unref(Se)(B,at)??""),1)],8,ov),t.createElementVNode("td",{class:"c-constraints",title:t.unref(o).t("em.attr.embedFixedHint")},[t.createElementVNode("span",rv,t.toDisplayString(t.unref(ce)(B,at)!=null?`scale ${t.unref(ce)(B,at)}`:""),1)],8,av),H[15]||(H[15]=t.createElementVNode("td",null,null,-1))],2),te(Ee.modelId)?(t.openBlock(),t.createElementBlock("tr",lv,[H[18]||(H[18]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",sv,[t.createElementVNode("div",cv,[t.createElementVNode("fieldset",dv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(pt=t.unref(se)(B,at))!=null&&pt.shareable?(t.openBlock(),t.createElementBlock("label",uv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(Ie)(Ee),items:t.unref(he)(),"value-provider":t.unref(c),"label-provider":t.unref(we),"onUpdate:modelValue":nt=>nt&&t.unref(q)(B,at,nt)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",mv,[H[16]||(H[16]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(K)(Ee),"model-value":t.unref(K)(Ee)?"false":t.unref(Q)(Ee),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(U),"onUpdate:modelValue":nt=>nt&&t.unref(X)(B,at,nt)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",fv,[H[17]||(H[17]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(K)(Ee),"model-value":t.unref(K)(Ee)?"false":t.unref(le)(Ee),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":nt=>nt&&t.unref(ue)(B,at,nt)},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(B.modelId),"em-aw__open":te(B.modelId)})},[t.createElementVNode("td",xI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":te(B.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(te(B.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:Ee=>Y(B.modelId),onKeydown:[t.withKeys(t.withModifiers(Ee=>Y(B.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Ee=>Y(B.modelId),["prevent"]),["space"])]},[t.createVNode(Ae,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,SI)]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-name-${B.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":B.name,"onUpdate:modelValue":Ee=>t.unref(d)(B,{name:Ee})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(g)(B)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-type-${B.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!B.groupCode||B.attrType==="RELATION_REF"||t.unref(g)(B),items:t.unref(oc)(B.type,t.unref(x)),"value-provider":t.unref(E),"label-provider":t.unref(N),"model-value":B.type,"onUpdate:modelValue":Ee=>t.unref(p)(B,Ee)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),B.type===t.unref(an)&&!t.unref(g)(B)?(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:0,name:`aw-customtype-${B.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":B.customType??"","onUpdate:modelValue":Ee=>t.unref(k)(B,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,RI),t.createElementVNode("td",null,[B.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(mn,{key:0,name:`aw-logical-${B.modelId}`,languages:t.unref(o).languages.value,"active-lang":ae.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Pe=B.dbAttrs[0])==null?void 0:Pe.logicalName,"onUpdate:modelValue":Ee=>t.unref(L)(B,Ee)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",AI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`aw-col-${B.modelId}`,width:"100%",placeholder:t.unref(_)(B)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(y)(B),"model-value":((Ze=B.dbAttrs[0])==null?void 0:Ze.physicalName)??"","onUpdate:modelValue":Ee=>t.unref(I)(B,{physicalName:Ee})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(no,{controller:t.unref(o),"ref-id":(Ue=B.dbAttrs[0])==null?void 0:Ue.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(g)(B)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSSelect),{name:`aw-dtype-${B.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(y)(B)||t.unref(g)(B),items:t.unref(ec)(((Le=B.dbAttrs[0])==null?void 0:Le.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Rr),"model-value":((De=B.dbAttrs[0])==null?void 0:De.dataType)??"","onUpdate:modelValue":Ee=>Ee&&t.unref(I)(B,{dataType:Ee})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,$I),t.createElementVNode("td",{title:t.unref(g)(B)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-len-${B.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(y)(B)||t.unref(g)(B),"model-value":(Z=B.dbAttrs[0])==null?void 0:Z.length,"onUpdate:modelValue":Ee=>t.unref(I)(B,{length:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,TI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(g)(B)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",VI,[t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-pk-${B.modelId}`,label:"PK","model-value":B.identifier,disabled:t.unref(a)||t.unref(y)(B)||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(h)(B,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nn-${B.modelId}`,label:"NN","model-value":B.notNull,disabled:t.unref(y)(B)||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(d)(B,{notNull:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-uq-${B.modelId}`,label:"UQ","model-value":!!((dt=B.dbAttrs[0])!=null&&dt.unique),disabled:t.unref(y)(B)||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(I)(B,{unique:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,MI),t.createElementVNode("td",{class:"c-del",title:t.unref(u)(B)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ee=>t.unref(o).removeAttribute(t.unref(i).modelId,B.modelId)},null,8,["onClick"])],8,BI)],2),te(B.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(B.modelId)}])},[H[13]||(H[13]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",DI,[t.createElementVNode("div",OI,[t.createElementVNode("fieldset",LI,[H[11]||(H[11]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref($)(B)},[H[8]||(H[8]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(ee.BSNumberInput),{name:`aw-scale-${B.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(y)(B)||t.unref(g)(B)||!t.unref(A)(B),"model-value":(bn=B.dbAttrs[0])==null?void 0:bn.scale,"onUpdate:modelValue":Ee=>t.unref(I)(B,{scale:Ee||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,PI),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-ai-${B.modelId}`,label:"Auto Increment","model-value":!!((Et=B.dbAttrs[0])!=null&&Et.autoIncrement),disabled:t.unref(y)(B)||t.unref(g)(B)||!B.identifier,"onUpdate:modelValue":Ee=>t.unref(I)(B,{autoIncrement:Ee})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",zI,[H[9]||(H[9]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-ins-${B.modelId}`,width:"110px",disabled:t.unref(y)(B),"model-value":t.unref(Q)(B.dbAttrs[0]),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(U),"onUpdate:modelValue":Ee=>Ee&&t.unref(_e)(B,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",FI,[H[10]||(H[10]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{name:`aw-upd-${B.modelId}`,width:"110px",disabled:t.unref(y)(B),"model-value":t.unref(le)(B.dbAttrs[0]),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":Ee=>Ee&&t.unref(F)(B,Ee)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",UI,[H[12]||(H[12]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-tr-${B.modelId}`,label:"@Transient","model-value":!!B.transient,disabled:B.identifier||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(f)(B,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-nid-${B.modelId}`,label:"@NaturalId","model-value":!!B.naturalId,disabled:B.identifier||t.unref(y)(B)||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(m)(B,Ee)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${B.modelId}`,label:"mutable","model-value":!!B.naturalIdMutable,disabled:t.unref(y)(B)||!B.naturalId,"onUpdate:modelValue":Ee=>t.unref(d)(B,{naturalIdMutable:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`aw-mv-${B.modelId}`,label:"Multi-Value (Set)","model-value":!!((_n=B.dbAttrs[0])!=null&&_n.multiValue),disabled:t.unref(y)(B)||t.unref(g)(B),"onUpdate:modelValue":Ee=>t.unref(I)(B,{multiValue:Ee||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(g)(B)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",HI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",jI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"150px","model-value":t.unref(V)(B),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ee=>Ee&&t.unref(S)(B,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(b).length?(t.openBlock(),t.createElementBlock("label",KI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(vf,{"model-value":B.groupCode,items:t.unref(b),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ee=>t.unref(z)(B,Ee)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",GI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(w)(B).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"150px","model-value":B.defaultValue??"none",items:t.unref(v)(B),"value-provider":t.unref(O),"label-provider":t.unref(M),"onUpdate:modelValue":Ee=>Ee&&t.unref(j)(B,Ee)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`aw-default-${B.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":B.defaultValue??"","onUpdate:modelValue":Ee=>t.unref(ie)(B,Ee)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",YI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:`aw-desc-${B.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":B.description,"onUpdate:modelValue":Ee=>t.unref(pe)(B,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",pv,[t.createElementVNode("td",hv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,hI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-559a29b3"]]);function ns(e,n){return n&&n!==e?`${e} (${n})`:e}function xf(e,n,o){const i=e.dbAttrs[n];return i?Yo(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function Sf(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}):ns(o,xf(e,0,n))}function Rf(e,n){var l;if(Bn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?ns(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 ns(i,xf(o,r<0?0:r,n))}const _v=["disabled"],kv={class:"em-idxw__list"},Ev={class:"em-idxw__list-head"},Nv=["aria-label"],wv=["aria-current","onClick","onKeydown"],Iv={class:"em-idxw__item-name"},vv={key:0,class:"em-idxw__badge"},Cv={class:"em-idxw__item-cnt"},xv={key:0,class:"em-idxw__empty"},Sv={key:0,class:"em-idxw__edit"},Rv={class:"em-idxw__form"},Av={class:"em-field em-idxw__name"},$v={class:"em-field"},Tv=["value","placeholder"],Mv={class:"em-idxw__transfer"},Vv={class:"em-idxw__pane"},Bv={class:"em-idxw__pane-head"},Dv=["aria-label"],Ov=["aria-pressed","onClick","onKeydown"],Lv=["title"],Pv={key:0,class:"em-idxw__empty"},zv={class:"em-idxw__arrows"},Fv={class:"em-idxw__pane"},Uv={class:"em-idxw__pane-head"},Hv={class:"em-idxw__col-name"},jv=["title"],Kv={class:"em-idxw__col-ops"},Gv=["title","disabled","onClick"],Yv=["title","disabled","onClick"],qv=["title","onClick"],Wv={key:0,class:"em-idxw__empty"},Jv={key:1,class:"em-idxw__edit em-idxw__edit--empty"},Xv=Ke(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(b=>b.modelId===n.entityId)??null),a=t.computed(()=>{var b;return((b=i.value)==null?void 0:b.indexes)??[]}),r=t.computed(()=>{var b;return((b=i.value)==null?void 0:b.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,b=>{var w;b.some(v=>v.modelId===s.value)||(s.value=((w=b[0])==null?void 0:w.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(b=>b.modelId===s.value)??null),d=t.computed(()=>i.value?Ko(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Vn(r.value)),m=b=>u.value.canon(b),h=t.computed(()=>{var b;return new Set((((b=c.value)==null?void 0:b.columns)??[]).map(w=>m(w.columnRef)))}),f=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(b){return Sf(b,f.value)}function g(b){return b.physicalName&&b.physicalName!==b.field?`${b.field} (${b.physicalName})`:b.field}function _(b){return Rf(b,f.value)}const E=t.computed(()=>[...r.value.filter(b=>b.dbAttrs.length>0&&!h.value.has(m(b.modelId))).map(b=>({ref:b.modelId,label:y(b),inherited:!1})),...d.value.filter(b=>!h.value.has(m(b.modelId))).map(b=>({ref:b.modelId,label:g(b),inherited:!0}))]),N=t.ref(new Set);t.watch(s,()=>N.value=new Set);function p(b){return Bn(b)}function k(b,w){i.value&&o.updateIndex(i.value.modelId,b,w)}function I(){var w;if(!i.value)return;const b=Me();o.addIndex(i.value.modelId,{modelId:b,name:`idx_${(((w=i.value.indexes)==null?void 0:w.length)??0)+1}`,unique:!1,columns:[]}),s.value=b}function A(b){i.value&&o.removeIndex(i.value.modelId,b)}function $(b){c.value&&k(c.value.modelId,{parameters:b.trim()===""?void 0:b})}function L(b){const w=new Set(N.value);w.has(b)?w.delete(b):w.add(b),N.value=w}function V(){const b=c.value;if(!b||!N.value.size)return;const w=[...N.value].map(v=>({columnRef:v,descending:!1}));k(b.modelId,{columns:[...b.columns,...w]}),N.value=new Set}function S(b){const w=c.value;w&&k(w.modelId,{columns:w.columns.filter((v,O)=>O!==b)})}function x(b,w){const v=c.value;v&&k(v.modelId,{columns:v.columns.map((O,M)=>M===b?{...O,descending:w}:O)})}function T(b,w){const v=c.value;if(!v)return;const O=b+w;if(O<0||O>=v.columns.length)return;const M=[...v.columns];[M[b],M[O]]=[M[O],M[b]],k(v.modelId,{columns:M}),D(O,w)}async function D(b,w){var j,ie;await t.nextTick();const v=(j=l.value)==null?void 0:j.querySelectorAll(".em-idxw__col--idx")[b];if(!v)return;const O=pe=>v.querySelector(`[data-move="${pe}"]`),M=O(w<0?"up":"down"),z=O(w<0?"down":"up");(ie=M&&!M.disabled?M:z)==null||ie.focus()}return(b,w)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",kv,[t.createElementVNode("div",Ev,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.section",{n:a.value.length})),1),t.createVNode(t.unref(ee.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,v=>(t.openBlock(),t.createElementBlock("li",{key:v.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":v.modelId===s.value}]),role:"button",tabindex:"0","aria-current":v.modelId===s.value?"true":void 0,onClick:O=>s.value=v.modelId,onKeydown:[t.withKeys(t.withModifiers(O=>s.value=v.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>s.value=v.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",Iv,t.toDisplayString(v.name||t.unref(o).t("em.attr.nameless")),1),v.unique?(t.openBlock(),t.createElementBlock("span",vv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",Cv,t.toDisplayString(v.columns.length),1)],42,wv))),128))],8,Nv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",xv,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",Sv,[t.createElementVNode("div",Rv,[t.createElementVNode("label",Av,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.index.namePlaceholder")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"idxw-name",width:"100%","model-value":c.value.name,"onUpdate:modelValue":w[0]||(w[0]=v=>k(c.value.modelId,{name:v}))},null,8,["model-value"]),t.createVNode(no,{controller:t.unref(o),"ref-id":c.value.modelId},null,8,["controller","ref-id"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"idxw-uq",class:"em-check em-idxw__uq",label:"unique","model-value":c.value.unique,"onUpdate:modelValue":w[1]||(w[1]=v=>k(c.value.modelId,{unique:v}))},null,8,["model-value"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn em-idxw__del",caption:t.unref(o).t("em.index.delete"),onClick:w[2]||(w[2]=v=>A(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",$v,[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]=v=>$(v.target.value))},null,40,Tv)]),t.createElementVNode("div",Mv,[t.createElementVNode("div",Vv,[t.createElementVNode("div",Bv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:E.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:E.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,v=>(t.openBlock(),t.createElementBlock("li",{key:v.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":N.value.has(v.ref)}]),role:"button",tabindex:"0","aria-pressed":N.value.has(v.ref),onClick:O=>L(v.ref),onKeydown:[t.withKeys(t.withModifiers(O=>L(v.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>L(v.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(v.label),1),v.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,Lv)):t.createCommentVNode("",!0)],42,Ov))),128))],8,Dv),E.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Pv,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",zv,[t.createVNode(t.unref(ee.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!N.value.size,onClick:V},null,8,["caption","disabled"])]),t.createElementVNode("div",Fv,[t.createElementVNode("div",Uv,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,(v,O)=>(t.openBlock(),t.createElementBlock("li",{key:O,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",Hv,[t.createTextVNode(t.toDisplayString(_(v.columnRef)),1),p(v.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,jv)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idxw-desc-${O}`,class:"em-check",label:"DESC","model-value":v.descending,"onUpdate:modelValue":M=>x(O,M)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",Kv,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:O===0,onClick:M=>T(O,-1)},"↑",8,Gv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:O===c.value.columns.length-1,onClick:M=>T(O,1)},"↓",8,Yv),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:M=>S(O)},"✕",8,qv)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",Wv,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",Jv,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,_v)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),Zv={class:"em-op-src"},Qv=["placeholder"],eC={class:"em-op-src__actions"},Af=Ke(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(l,s)=>Dt(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(ee.BSModalFrame),{title:i("em.opSource.title",{name:n.operationName})},{default:t.withCtx(()=>[t.createElementVNode("div",Zv,[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,Qv),[[t.vModelText,a.value]]),t.createElementVNode("div",eC,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.common.save"),onClick:r},null,8,["caption"]),t.createVNode(t.unref(ee.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"]]),tC=["disabled"],nC={class:"em-ow__toolbar"},oC={class:"em-ow__count"},iC={class:"em-ow__scroll"},aC={class:"em-ow__table"},rC={class:"c-name"},lC={class:"c-desc"},sC=["id"],cC={class:"c-pii"},dC={class:"c-src"},uC={class:"c-del"},mC={key:0},fC={colspan:"6",class:"em-ow__empty"},pC=Ke(t.defineComponent({__name:"EntityOperationsWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.useModal(),a=t.computed(()=>o.state.logical.entities.find(_=>_.modelId===n.entityId)??null),r=t.computed(()=>{var _;return[...((_=a.value)==null?void 0:_.operations)??[]].sort((E,N)=>E.order-N.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(_){return _==="none"?o.t("em.common.noneParen"):_}const u=_=>_;function m(_,E){a.value&&o.updateOperation(a.value.modelId,_.modelId,E)}function h(_,E){m(_,{description:Object.keys(E).length?E:void 0})}function f(_){return _.personalInfoAttributeType??"none"}function y(_,E){m(_,{personalInfoAttributeType:E==="none"?void 0:E})}function g(_){i.openModal({component:Af,bind:{operationName:_.name,sourceCode:_.sourceCode??"",locale:o.uiLocale.value,onSave:E=>m(_,{sourceCode:E})}})}return(_,E)=>{var N,p;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",nC,[t.createElementVNode("span",oC,t.toDisplayString(t.unref(o).t("em.op.section",{n:((N=a.value.operations)==null?void 0:N.length)??0})),1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:E[0]||(E[0]=k=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",iC,[t.createElementVNode("table",aC,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",rC,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),E[2]||(E[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",lC,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,sC),t.createVNode(Cf,{modelValue:l.value,"onUpdate:modelValue":E[1]||(E[1]=k=>l.value=k),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",cC,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",dC,t.toDisplayString(t.unref(o).t("em.op.body")),1),E[3]||(E[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,k=>(t.openBlock(),t.createElementBlock("tr",{key:k.modelId},[t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSTextInput),{name:`ow-name-${k.modelId}`,width:"100%",placeholder:t.unref(o).t("em.op.namePlaceholder"),"model-value":k.name,"onUpdate:modelValue":I=>m(k,{name:I})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":k.visibility??"PACKAGE",items:s,"value-provider":u,"label-provider":u,"onUpdate:modelValue":I=>I&&m(k,{visibility:I})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(mn,{name:`ow-desc-${k.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":k.description,"onUpdate:modelValue":I=>h(k,I)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":f(k),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":I=>I&&y(k,I)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t(k.sourceCode?"em.op.bodyDirty":"em.op.body"),onClick:I=>g(k)},null,8,["caption","onClick"])]),t.createElementVNode("td",uC,[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:I=>t.unref(o).removeOperation(a.value.modelId,k.modelId)},null,8,["onClick"])])]))),128)),(p=a.value.operations)!=null&&p.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",mC,[t.createElementVNode("td",fC,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,tC)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),hC={class:"em-detail__tabs"},yC=["onClick"],gC={key:0,class:"em-detail__lock"},bC=["disabled"],_C={key:0,class:"em-detail__narrow"},kC=Ke(t.defineComponent({__name:"EntityDetailModal",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=ee.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(ee.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",hC,[(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,yC)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",gC,[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",_C,[t.createVNode(bf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(bv,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(Xv,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(pC,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,bC)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function Wa(e,n,o){e.openModal({component:kC,bind:{controller:t.markRaw(n),entityId:o}})}function fn(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=>dd(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 Ud(l,r))i.push(ua(a,s.indexRef,{columns:s.columns}))}return i}function Ja(e,n,o,i){var c;const a=[];a.push(...fn(n,o.remove,i));for(const d of o.update)a.push(Kt(n,d.attributeId,d.patch));for(const d of o.add)a.push(jt(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(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,y)=>f.order-y.order)[0];h&&a.push(Tt(d.modelId,"end2",{attributeRef:h.modelId}))}return a}function Vo(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function wi(e,n,o){const i=[];for(const[a,r]of Ec(e,n,Me))i.push(...Ja(e,a,r,o));for(const a of Hd(e,n,Me))i.push(Kt(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function EC(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=qr([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return jd(e,n,r).map(l=>Kt(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function $f(e,n,o){return Kd(e,n,o).map(i=>Kt(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function NC(e,n,o){const i=new Set(o.remove);return Vo(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 Xa(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of Nc(e,r,Me)){const c=i.get(l);i.set(l,c?kc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...Ja(e,r,wC(l),o));return a}function wC(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 Tf(e){return nn(e).map(n=>({...n.col,modelId:Me()}))}function IC(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=Rt(o.attributes),h=new Set(o.attributes.map(y=>y.name));let f="id";for(let y=2;h.has(f);y++)f=`id${y}`;a={modelId:Me(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Me(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(jt(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 f=e.associations.find(E=>E.modelId===h.embedded.associationRef);if(!f)continue;const y=f.end1.entityRef===m.modelId,g=y?f.end1:f.end2,_=y?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:h.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:g.multiplicity,navigable:g.navigable,composition:!1},end2:{entityRef:n,multiplicity:_.multiplicity,navigable:_.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(f=>f.ownerId===m.modelId).map(f=>f.dispId));return h.size?{...m,attributes:m.attributes.filter(f=>!h.has(f.modelId))}:m}),associations:e.associations.map(m=>{const h=r.find(f=>f.assocId===m.modelId);return h?{...m,end1:h.end1,end2:h.end2}:m})},s=Jo(l,n,Me);for(const m of r){const h=s.add.find(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===m.assocId});h&&(m.end2.attributeRef=h.modelId)}const c=[];for(const m of r)i.push(...fn(m.ownerId,[m.dispId],c)),i.push(da(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...Ja(l,n,s,c));const d=NC(l,n,s);return i.push(...wi(d,n,c)),i.push(...Ot(e,c)),i}function vC(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(p=>p.modelId===c);if(!d||d.attributes.some(p=>{var k;return((k=p.embedded)==null?void 0:k.associationRef)===r.modelId}))continue;const u=Me(),m=Rt(d.attributes),h=new Set(d.attributes.map(p=>p.name)),f=a(o.name);let y=f;for(let p=2;h.has(y);p++)y=`${f}${p}`;const g=o.attributes.filter(p=>!p.identifier&&!p.derivedFrom).flatMap(p=>p.dbAttrs).map(p=>({...p,modelId:Me()})),_={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:g,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(jt(c,_));const E=l?"end2":"end1",N=l?"end1":"end2";i.push(da(r.modelId,{identifying:!1,[E]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Me()},[N]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function Mf(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=[rd(n,o),...i.map(u=>Eo(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(f=>f.associationRef===m.modelId);h&&h.waypoints.length&&c.push(Nd(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const h=e.layout.notes.find(f=>f.modelId===m);h&&c.push(ni(m,{x:h.geo.location.x+l,y:h.geo.location.y+s}))}}return c}function CC(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=Me(),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]},f=Jo(h,s,Me),y=f.add[0];y&&(m.end2.attributeRef=y.modelId);const g={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},_=ca(m,g),E=Ja(h,s,f,[]);return i(E.length?We("관계 추가",[_,...E]):_),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=Me(),m=Me(),h=Me(),f=Rt(c.attributes),y=Tf(d),g=A=>A&&A.charAt(0).toLowerCase()+A.slice(1),_=new Set(c.attributes.map(A=>A.name)),E=g(d.name);let N=E;for(let A=2;_.has(N);A++)N=`${E}${A}`;const p={modelId:m,name:N,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},k={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(We("임베드 추가",[jt(l,p),ca(k,I)])),u},setEmbedCardinality(l,s){var E;if(r(l))return;const c=n.logical.associations.find(N=>N.modelId===l);if(!c)return;let d,u;for(const N of n.logical.entities){const p=N.attributes.find(k=>{var I;return((I=k.embedded)==null?void 0:I.associationRef)===l&&k.attrType==="EMBED_OWN"});if(p){d=N.modelId,u=p;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,h=c.end2.entityRef===m?"end2":"end1",f=c[h];if(f.multiplicity===s)return;const y=N=>N==="ZERO_OR_MORE_INSTANCES"||N==="ONE_OR_MORE_INSTANCES",g=y(f.multiplicity),_=y(s);if(g===_){i(Tt(l,h,{multiplicity:s}));return}if(_)i(We("임베드 컬렉션 전환",[Kt(d,u.modelId,{dbAttrs:[]}),Tt(l,h,{multiplicity:s,jpa:{...f.jpa,collectionType:((E=f.jpa)==null?void 0:E.collectionType)??"LIST"}})]));else{const N=n.logical.entities.find(p=>p.modelId===m);if(!N)return;i(We("임베드 단일 전환",[Kt(d,u.modelId,{dbAttrs:Tf(N)}),Tt(l,h,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=gd(l);if(!s){i(c);return}for(const f of n.logical.entities){const y=f.attributes.find(g=>{var _;return((_=g.embedded)==null?void 0:_.associationRef)===l});if(y){const g=[];i(We("임베드 삭제",[c,...fn(f.modelId,[y.modelId],g),...Ot(n.logical,g)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],h=Xa(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(g=>g.modelId===s.end1.entityRef),y=f==null?void 0:f.attributes.find(g=>g.modelId===s.end1.attributeRef&&g.attrType==="RELATION_REF");y&&h.push(...fn(f.modelId,[y.modelId],m))}h.push(...Ot(n.logical,m)),i(h.length?We("관계 삭제",[c,...h]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(y=>y.modelId===l),d=da(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=[],f=Xa(m,[u],h);f.push(...Ot(n.logical,h)),i(f.length?We("식별 관계 변경",[d,...f]):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(f=>f.modelId===d.end1.entityRef),m=n.logical.entities.find(f=>f.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 f=Hi(d.end2.multiplicity),y=d.end1.navFieldNameHint||Ki(m.name,f),g=mo(y,new Set(u.attributes.map(p=>p.name))),_=Me(),E=Rt(u.attributes),N={modelId:_,name:g,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:E,dbAttrs:[]};i(We("inverse nav 추가",[jt(d.end1.entityRef,N),Tt(l,"end1",{...c,attributeRef:_,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,y=u.attributes.find(N=>N.modelId===f&&N.attrType==="RELATION_REF"),g=Tt(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),_=[],E=y?fn(d.end1.entityRef,[f],_):[];i(y?We("inverse nav 제거",[...E,g,...Ot(n.logical,_)]):g);return}}}i(Tt(l,s,c))}}}function xC(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 f=Kt(u,m,h),y=Vo(n.logical,u,E=>E.map(N=>N.modelId===m?{...N,...h}:N)),g=[],_=wi(y,u,g);_.push(...Ot(n.logical,g)),i(_.length?We("속성 수정",[f,..._]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const h=r.value.find(N=>N.type===m),f=n.logical.entities.find(N=>N.modelId===u);if(!h||!f)return null;const y=Rt(f.attributes),g=Me(),_=h.fields.map(()=>({modelId:Me(),physicalName:"",dataType:""})),E={modelId:g,name:h.defaultName,type:h.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:y,dbAttrs:_};return i(jt(u,E)),g},addAttribute(u,m={}){if(!o.value||a(u))return null;const h=n.logical.entities.find(I=>I.modelId===u),f=h?Rt(h.attributes):0,y=m.modelId??Me(),g=m.name??`field${f}`,_={modelId:y,name:g,type:m.type??$r,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:Me(),physicalName:g,dataType:"VARCHAR"}],...m},E=jt(u,_),N=Vo(n.logical,u,I=>[...I,_]),p=[],k=wi(N,u,p);return k.push(...Ot(n.logical,p)),i(k.length?We("속성 추가",[E,...k]):E),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(g=>g.modelId===u),h=m?Rt(m.attributes):0,f=Me();return i(jt(u,{modelId:f,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:h,dbAttrs:[]})),f},updateAttribute(u,m,h){d(u,m,h)},setAttributeGroupCode(u,m,h){d(u,m,{groupCode:h,type:h?On:$r})},setEmbedColumns(u,m,h){var N,p;if(a(u))return;const f=Kt(u,m,{dbAttrs:h}),y=(N=n.logical.entities.find(k=>k.modelId===u))==null?void 0:N.attributes.find(k=>k.modelId===m),g=(p=y==null?void 0:y.embedded)==null?void 0:p.associationRef,_=g?n.logical.associations.find(k=>k.modelId===g):void 0,E=[];_&&g&&(_.end1.legacyEmbedRaw&&E.push(Tt(g,"end1",{legacyEmbedRaw:void 0})),_.end2.legacyEmbedRaw&&E.push(Tt(g,"end2",{legacyEmbedRaw:void 0}))),i(E.length?We("임베드 컬럼 수정",[f,...E]):f)},removeAttribute(u,m){if(a(u))return;if(Xi(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const h=[],f=fn(u,[m],h),y=Vo(n.logical,u,E=>E.filter(N=>N.modelId!==m)),g=[...wi(y,u,h),...Ot(n.logical,h),...$f(n.logical,u,[m])],_=[...f,...g];i(_.length===1?_[0]:We("속성 삭제",_))},removeAttributes(u,m){var N;if(!m.length||a(u))return;const h=m.filter(p=>!Xi(n.logical,u,p));if(h.length<m.length&&s(l("em.attr.fkDeleteHint")),!h.length)return;const f=[],y=fn(u,h,f),g=new Set(h),_=Vo(n.logical,u,p=>p.filter(k=>!g.has(k.modelId))),E=[...y,...wi(_,u,f),...Ot(n.logical,f),...$f(n.logical,u,h)];i(E.length===1?E[0]:We("속성 삭제",E)),((N=c.value)==null?void 0:N.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,h){i(ra(u,m,h))},setAttributeSwatches(u,m,h){m.length&&(m.length===1?i(ra(u,m[0],h)):i(We("속성 색상",m.map(f=>ra(u,f,h)))))},reorderAttributes(u,m,h){if(!m.length||a(u))return;const f=al(u,m,h),y=EC(n.logical,u,m,h);i(y.length?We("속성 재정렬",[f,...y]):f)}}}function SC(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Me(),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=Me();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Me()}for(const a of n.indexes??[]){a.modelId=Me();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Me();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const RC=220;function AC(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||RC));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 os=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function $C(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const g=c.filter(_=>n.logical.entities.some(E=>E.modelId===_));if(g.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:g}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const g=n.logical.entities.find(E=>E.modelId===d.entityId);if(!g)return;const _=[...g.attributes].sort((E,N)=>E.order-N.order).filter(E=>d.ids.includes(E.modelId));if(!_.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:_}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(g=>g.modelId===u),h=n.layout.entityLayouts.find(g=>g.entityRef===u);if(!m)return;const f=(h==null?void 0:h.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let y;if(h){const{entityRef:g,geo:_,locked:E,...N}=h;Object.keys(N).length&&(y=N)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,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 f=a.value;if(!f)return[];const y=n.logical.entities.find(k=>k.modelId===f);if(!y)return[];const g=new Set(y.attributes.map(k=>k.name)),_=new Set(y.attributes.flatMap(k=>k.dbAttrs.map(I=>I.physicalName))),E=Rt(y.attributes),N=[],p=c.attributes.map((k,I)=>{const A=JSON.parse(JSON.stringify(k));A.modelId=Me();for(const $ of A.dbAttrs)$.modelId=Me();g.has(A.name)&&(A.name=mo(`${A.name}_copy`,g)),g.add(A.name);for(const $ of A.dbAttrs)$.physicalName&&_.has($.physicalName)&&($.physicalName=mo(`${$.physicalName}_copy`,_)),$.physicalName&&_.add($.physicalName);return A.order=E+I,N.push(A.modelId),jt(f,A)});return l(p.length===1?p[0]:We("속성 붙여넣기",p)),i.value={kind:"attribute",entityId:f,ids:N,anchor:N[N.length-1]},[]}const{clone:d,idMap:u}=SC(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 f={...c.layoutExtras},y=g=>u.get(g);f.attributeStyles&&(f.attributeStyles=na(f.attributeStyles,y)),f.operationStyles&&(f.operationStyles=na(f.operationStyles,y)),h=f}return l(aa(d,m,h)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=Uc(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",f=h==="append-right"?AC(n.layout,m.layout):h.offset,y=new Map(m.layout.entityLayouts.map(p=>[p.entityRef,p])),g=new Map(m.layout.associationLayouts.map(p=>[p.associationRef,p])),_=new Map(m.layout.groupLayouts.map(p=>[p.groupRef,p])),E=[];let N=80;for(const p of m.logical.entities){const k=y.get(p.modelId),I=k?{location:os(k.geo.location,f),size:{...k.geo.size}}:{location:{x:N+=40,y:80},size:{width:220,height:140}};let A;if(k){const{entityRef:$,geo:L,locked:V,...S}=k;A=S}E.push(aa(p,I,A))}for(const p of m.logical.associations){const k=g.get(p.modelId),I=k?{...k,waypoints:k.waypoints.map(A=>os(A,f))}:{associationRef:p.modelId,waypoints:[]};E.push(ca(p,I))}for(const p of m.logical.groups){const k=_.get(p.modelId),I=k?{location:os(k.geo.location,f),size:{...k.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let A;if(k){const{groupRef:$,geo:L,locked:V,memberNoteRefs:S,...x}=k;A=x}E.push(la(p,I,A))}return l(We("다이어그램 가져오기",E)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(p=>p.modelId)}};return s}function TC(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=Me(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:Me(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Me(),physicalName:"id",dataType:"BIGINT"}]}]};return i(aa(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(Zc(s,c))},updateEntity(s,c){if(a(s))return;const d=Xc(s,c),u=n.logical.entities.find(f=>f.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 f=u.attributes.filter(p=>p.identifier&&!p.derivedFrom).map(p=>Kt(s,p.modelId,{identifier:!1})),y=Vo({...n.logical,entities:n.logical.entities.map(p=>p.modelId===s?{...p,stereotype:"JPA_EMBEDDABLE"}:p)},s,p=>p.map(k=>k.identifier&&!k.derivedFrom?{...k,identifier:!1}:k)),g=[],_=Xa(y,[s],g);_.push(...Ot(n.logical,g));const E=vC(n.logical,s),N=[d,...f,..._,...E];i(N.length>1?We("임베더블 변환",N):d);return}if(h){const f=IC(n.logical,s),y=[d,...f];i(y.length>1?We("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(Eo(s,c))},resizeEntity(s,c){a(s)||i(Qc(s,c))},removeEntity(s){if(a(s))return;const c=Jc(s);if(!n.logical.entities.find(_=>_.modelId===s)){i(c);return}const u=n.logical.associations.filter(_=>_.end1.entityRef===s||_.end2.entityRef===s),m=new Set(u.map(_=>_.modelId)),h=[],f=[];for(const _ of n.logical.entities)if(_.modelId!==s)for(const E of _.attributes)E.embedded&&m.has(E.embedded.associationRef)&&h.push(...fn(_.modelId,[E.modelId],f));for(const _ of u){if(_.end1.entityRef===s||!_.end1.attributeRef)continue;const E=n.logical.entities.find(p=>p.modelId===_.end1.entityRef),N=E==null?void 0:E.attributes.find(p=>p.modelId===_.end1.attributeRef&&p.attrType==="RELATION_REF");N&&h.push(...fn(E.modelId,[N.modelId],f))}const y={...n.logical,entities:n.logical.entities.filter(_=>_.modelId!==s),associations:n.logical.associations.filter(_=>!m.has(_.modelId))},g=new Set(u.filter(_=>_.end1.entityRef===s&&_.end2.entityRef!==s).map(_=>_.end2.entityRef));h.push(...Xa(y,[...g],f)),h.push(...Ot(n.logical,f.filter(_=>_.entityId!==s))),i(h.length?We("엔티티 삭제",[c,...h]):c)},setEntitySwatch(s,c){i(ed(s,c))},setEntityCollapsed(s,c){i(td(s,c))},setEntityLocked(s,c){i(nd(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(il(!0))},expandAll(){i(il(!1))}}}function MC(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(E=>n.layout.entityLayouts.find(N=>N.entityRef===E)).filter(E=>!!E);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,h=1/0,f=-1/0,y=-1/0;for(const E of u){const N=E.geo.size.width||220,p=E.geo.size.height||140;m=Math.min(m,E.geo.location.x),h=Math.min(h,E.geo.location.y),f=Math.max(f,E.geo.location.x+N),y=Math.max(y,E.geo.location.y+p)}const g=40,_=28;return{location:{x:m-g,y:h-g-_},size:{width:f-m+g*2,height:y-h+g*2+_}}}return{dragGroup(d,u,m){l(d)||i(We("그룹 이동",Mf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(ld(d,u))},setGroupSwatch(d,u){i(sd(d,u))},setGroupLocked(d,u){i(cd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(od(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const g of d)y.memberEntityRefs.includes(g)&&m.push(sa(y.modelId,g));const h=Me(),f={modelId:h,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(la(f,c(d))),i(We("그룹 생성",m)),a.value=null,h},addEmptyGroup(d,u){if(!o.value)return null;const m=Me();return i(la({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(id(d))},dropEntity(d,u,m){var y;if(r(d))return;const h=((y=n.logical.groups.find(g=>g.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,f=[Eo(d,u)];h!==m&&(h&&f.push(sa(h,d)),m&&f.push(ad(m,d))),i(We("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(sa(u.modelId,d))},dropNote(d,u,m){var y;const h=((y=n.layout.groupLayouts.find(g=>{var _;return(_=g.memberNoteRefs)==null?void 0:_.includes(d)}))==null?void 0:y.groupRef)??null,f=[ni(d,u)];h!==m&&(h&&f.push($d(h,d)),m&&f.push(Ad(m,d))),i(We("이동",f))}}}function VC(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(g,_){if(d(),!o.value||!e.opTransport)return;const E=new Pd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:N=>{i.value=!1,a.value=N},onError:e.onOpError});E.seed((_==null?void 0:_.revSeed)??{}),c=E.attach(g),s=E}const m=t.computed(()=>o.value&&r!==void 0),h=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function y(g){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let _;try{_=await l(g)}catch(E){return{ok:!1,reason:E instanceof Error?E.message:String(E)}}return _.ok&&h.value++,_}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:f,restoreToSeq:y,reloadRequest:h}}function BC(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Me();return o(vd({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(Cd(i))},moveNote(i,a){o(ni(i,a))},resizeNote(i,a){o(xd(i,a))},setNoteMemo(i,a){o(Sd(i,a))},setNoteSwatch(i,a){o(Rd(i,a))},addNoteConnection(i,a){o(Td(i,a))},removeNoteConnection(i,a){o(Md(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(Vd(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Bd(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Dd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Od(i,a))}}}function DC(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,f=(h==null?void 0:h.kind)==="attribute"&&h.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const k=h.ids.includes(u),I=k?h.ids.filter($=>$!==u):[...h.ids,u];if(!I.length){o.value=null;return}const A=k&&h.anchor===u?I[I.length-1]:k?h.anchor:u;o.value={kind:"attribute",entityId:d,ids:I,anchor:A};return}const y=n.logical.entities.find(k=>k.modelId===d),g=[...(y==null?void 0:y.attributes)??[]].sort((k,I)=>k.order-I.order).map(k=>k.modelId),_=g.indexOf(h.anchor),E=g.indexOf(u);if(_<0||E<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[N,p]=_<=E?[_,E]:[E,_];o.value={kind:"attribute",entityId:d,ids:g.slice(N,p+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(g=>g.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const h=m.attributes.findIndex(g=>g.modelId===u.anchor);if(h<0)return!1;const f=Math.min(Math.max(h+d,0),m.attributes.length-1);if(f===h)return!0;const y=m.attributes[f].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(k=>k.modelId===u.entityId);if(!m)return!1;const h=m.attributes,f=new Set(u.ids),y=h.map((k,I)=>f.has(k.modelId)?I:-1).filter(k=>k>=0);if(!y.length)return!1;const g=Math.min(...y),_=h.filter(k=>!f.has(k.modelId)),E=h.slice(0,g).filter(k=>!f.has(k.modelId)).length;let N;if(d<0){if(E<=0)return!0;N=E-1}else{if(_.length-E<=0)return!0;N=E+1}if(r(u.entityId))return!0;const p=h.filter(k=>f.has(k.modelId)).map(k=>k.modelId);return a(al(u.entityId,p,N)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const h=new Set(n.logical.entities.map(N=>N.modelId)),f=new Set(n.logical.groups.map(N=>N.modelId)),y=new Set(n.layout.notes.map(N=>N.modelId)),g=new Set;for(const N of d){if(!f.has(N))continue;const p=n.logical.groups.find(k=>k.modelId===N);for(const k of(p==null?void 0:p.memberEntityRefs)??[])g.add(k)}const _=[],E=[];for(const N of d)if(f.has(N)){if(s(N))continue;const p=n.layout.groupLayouts.find($=>$.groupRef===N);if(!p)continue;const k=n.logical.groups.find($=>$.modelId===N),I=((k==null?void 0:k.memberEntityRefs)??[]).map($=>{var V;const L=((V=n.layout.entityLayouts.find(S=>S.entityRef===$))==null?void 0:V.geo.location)??{x:0,y:0};return{id:$,location:{x:L.x+u,y:L.y+m}}}),A={x:p.geo.location.x+u,y:p.geo.location.y+m};_.push(We("그룹 이동",Mf(n,N,A,I))),E.push("g:"+N)}else if(h.has(N)){if(g.has(N)||l(N))continue;const p=n.layout.entityLayouts.find(k=>k.entityRef===N);if(!p)continue;_.push(Eo(N,{x:p.geo.location.x+u,y:p.geo.location.y+m})),E.push("e:"+N)}else if(y.has(N)){const p=n.layout.notes.find(k=>k.modelId===N);if(!p)continue;_.push(ni(N,{x:p.geo.location.x+u,y:p.geo.location.y+m})),E.push("n:"+N)}return _.length?(a(We("이동",_,"nudge:"+E.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const oo=Symbol("editorController");function Vf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function OC(e=Vf(),n={}){var ae,Be,Ve;const o=t.reactive(e);let i=new ol(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=(H,B)=>Dt(u.value,H,B),h=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),y=t.ref(n.largeEntityThreshold),g=t.ref(n.flagEntitiesWithoutRelations??!1),_=t.ref(!1),E=t.ref(!1),N=t.ref(!1),p=t.ref(0),k=t.ref(null);let I=0;const A=H=>{if(n.onNotice){n.onNotice(H);return}k.value={text:H,id:++I}},$=t.ref(((ae=n.meta)==null?void 0:ae.schemaVersion)??1),L=t.ref(((Be=n.meta)==null?void 0:Be.opWriteEnabled)??!1),V=t.ref(((Ve=n.meta)==null?void 0:Ve.referenceOnly)??!1),S=t.computed(()=>$.value>=2&&L.value),x=t.ref(!($.value>=2&&L.value===!1)),T=t.ref("LOGICAL_PHYSICAL"),D=t.ref("straight"),b=t.ref(!0),w=t.ref(!0),v=t.ref(null),O=t.computed(()=>{var H;return((H=v.value)==null?void 0:H.kind)==="attribute"?{entityId:v.value.entityId,attrId:v.value.anchor}:null}),M=t.computed(()=>{var H;return((H=v.value)==null?void 0:H.kind)==="attribute"?v.value.ids:[]}),z=t.computed(()=>{var H,B;return((H=v.value)==null?void 0:H.kind)==="entity"?v.value.id:((B=v.value)==null?void 0:B.kind)==="attribute"?v.value.entityId:null}),j=t.ref(null),ie=t.ref(null),pe=t.ref(null),ye=t.ref(null),ge=VC({state:o,opMode:S,editable:x,opConflict:pe,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function me(){i.onChange(()=>{_.value=i.canUndo,E.value=i.canRedo,N.value=i.isDirty,p.value++})}me(),ge.setupOpAdapter(i,n.meta);const se=t.computed(()=>$s(o.logical,o.layout)),ke=t.computed(()=>({reservedWords:h.value,selectableDataTypes:f.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:g.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Se=()=>vr(o.logical,V.value),ce=n.validationDebounceMs??250;let fe,oe=()=>{};if(ce>0){const H=t.shallowRef(Zi(Se(),ke.value));let B;oe=()=>{B!==void 0&&(clearTimeout(B),B=void 0),H.value=Zi(Se(),ke.value)},t.watch([p,ke,V],()=>{B!==void 0&&clearTimeout(B),B=setTimeout(oe,ce)},{flush:"sync"}),fe=t.computed(()=>H.value)}else fe=t.computed(()=>Zi(Se(),ke.value));const le=t.computed(()=>{const H=new Map;for(const B of fe.value){if(!B.targetRef)continue;const Pe=H.get(B.targetRef);Pe?Pe.push(B):H.set(B.targetRef,[B])}return H}),ue=1500,F=new Map,P=H=>{const B=Date.now();B-(F.get(H)??0)<ue||(F.set(H,B),A(H))},U=H=>{if(!ye.value){if(!x.value){P(m("em.notice.readOnly"));return}try{i.execute(H)}catch(B){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${H.label}):`,B),x.value=!1,ye.value={label:H.label}}}},Q=H=>o.layout.entityLayouts.some(B=>B.entityRef===H&&!!B.locked),X=H=>o.layout.groupLayouts.some(B=>B.groupRef===H&&!!B.locked),_e=H=>{const B=o.logical.associations.find(Pe=>Pe.modelId===H);return!!B&&(Q(B.end1.entityRef)||Q(B.end2.entityRef))},he=H=>Q(H)?(P(m("em.notice.entityLocked")),!0):!1,we=H=>X(H)?(P(m("em.notice.groupLocked")),!0):!1,Ie=H=>_e(H)?(P(m("em.notice.assocLocked")),!0):!1,q=$C({state:o,clipboard:ie,selection:v,inspectedEntityId:z,editable:x,run:U}),K=DC({state:o,selection:v,focusRequest:j,run:U,gateEntityLocked:he,isEntityLockedFn:Q,isGroupLockedFn:X}),J=TC({state:o,editable:x,run:U,gateEntityLocked:he,isEntityLockedFn:Q,isAssocLockedFn:_e}),ve=xC({state:o,editable:x,run:U,gateEntityLocked:he,embeddableCatalog:a,t:m,emitGateNotice:P,selection:v}),Te=MC({state:o,editable:x,run:U,selection:v,gateEntityLocked:he,gateGroupLocked:we,isGroupLockedFn:X}),G=BC({editable:x,run:U}),te=CC({state:o,editable:x,run:U,gateEntityLocked:he,gateAssocLocked:Ie});return{state:o,resolved:se,issues:fe,issuesByRef:le,flagEntitiesWithoutRelations:g,canUndo:_,canRedo:E,dirty:N,revision:p,notice:k,editable:x,schemaVersion:$,opWriteEnabled:L,opMode:S,opConflict:pe,commandFailure:ye,historyTransport:ge.historyTransport,historyAvailable:ge.historyAvailable,restoreTransport:ge.restoreTransport,restoreAvailable:ge.restoreAvailable,restoreToSeq:ge.restoreToSeq,reloadRequest:ge.reloadRequest,displayMode:T,routingMode:D,showGrid:b,showMinimap:w,selection:v,selectedAttr:O,selectedAttrIds:M,inspectedEntityId:z,focusRequest:j,clipboard:ie,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:V,uiLocale:u,t:m,selectableDataTypes:f,setEditable(H){x.value=H&&S.value},setEmbeddableCatalog(H){a.value=H},setGroupCodeCatalog(H){r.value=H},setPredefinedCustomTypeCatalog(H){l.value=H},setSuperClassCatalog(H){s.value=H},selectAttribute:K.selectAttribute,moveAttributeFocus:K.moveAttributeFocus,nudgeSelectedAttributes:K.nudgeSelectedAttributes,nudgeNodes:K.nudgeNodes,requestFocus:K.requestFocus,deleteSelection(){if(!x.value)return!1;const H=v.value;if(!H)return!1;if(H.kind==="attribute"){if(he(H.entityId))return!1;const B=H.ids;if(!B.length)return!1;B.length===1?ve.removeAttribute(H.entityId,B[0]):ve.removeAttributes(H.entityId,B)}else if(H.kind==="entity"){if(he(H.id))return!1;J.removeEntity(H.id)}else if(H.kind==="note")G.removeNote(H.id);else if(H.kind==="group"){if(we(H.id))return!1;Te.removeGroup(H.id)}else te.removeAssociation(H.id);return v.value=null,!0},undo:()=>{x.value&&i.undo()},redo:()=>{x.value&&i.redo()},markSaved:()=>{x.value&&(ge.flush(),i.markSavePoint())},loadDiagram(H,B){ge.teardownOpAdapter(),o.logical=H.logical,o.layout=H.layout,i=new ol(o),me(),$.value=(B==null?void 0:B.schemaVersion)??1,L.value=(B==null?void 0:B.opWriteEnabled)??!1,V.value=(B==null?void 0:B.referenceOnly)??!1,x.value=!($.value>=2&&L.value===!1),pe.value=null,ye.value=null,v.value=null,_.value=i.canUndo,E.value=i.canRedo,N.value=i.isDirty,ge.setupOpAdapter(i,B),oe()},flush:ge.flush,whenOpsSettled:ge.whenOpsSettled,addEntity:J.addEntity,renameEntity:J.renameEntity,updateEntity:J.updateEntity,moveEntity:J.moveEntity,resizeEntity:J.resizeEntity,removeEntity:J.removeEntity,setEntitySwatch:J.setEntitySwatch,setEntityCollapsed:J.setEntityCollapsed,setEntityLocked:J.setEntityLocked,isEntityLocked:J.isEntityLocked,isAssociationLocked:J.isAssociationLocked,collapseAll:J.collapseAll,expandAll:J.expandAll,setAttributeSwatch:ve.setAttributeSwatch,dragGroup:Te.dragGroup,resizeGroup:Te.resizeGroup,setGroupSwatch:Te.setGroupSwatch,setGroupLocked:Te.setGroupLocked,isGroupLocked:Te.isGroupLocked,updateGroup:Te.updateGroup,createGroup:Te.createGroup,addEmptyGroup:Te.addEmptyGroup,removeGroup:Te.removeGroup,dropEntity:Te.dropEntity,ungroupEntity:Te.ungroupEntity,dropNote:Te.dropNote,addPredefinedEmbed:ve.addPredefinedEmbed,addAttribute:ve.addAttribute,addDivider:ve.addDivider,updateAttribute:ve.updateAttribute,setAttributeGroupCode:ve.setAttributeGroupCode,setEmbedColumns:ve.setEmbedColumns,removeAttribute:ve.removeAttribute,removeAttributes:ve.removeAttributes,setAttributeSwatches:ve.setAttributeSwatches,reorderAttributes:ve.reorderAttributes,addIndex(H,B){he(H)||U(bd(H,B))},updateIndex(H,B,Pe){he(H)||U(ua(H,B,Pe))},removeIndex(H,B){he(H)||U(_d(H,B))},addOperation(H,B={}){if(!x.value||he(H))return null;const Pe=o.logical.entities.find(De=>De.modelId===H),Ze=Pe!=null&&Pe.operations?Rt(Pe.operations):0,Ue=B.modelId??Me(),Le={modelId:Ue,name:B.name??`method${Ze}`,visibility:B.visibility??"PACKAGE",order:Ze,...B};return U(md(H,Le)),Ue},updateOperation(H,B,Pe){he(H)||U(fd(H,B,Pe))},removeOperation(H,B){he(H)||U(pd(H,B))},reorderOperations(H,B,Pe){!B.length||he(H)||U(hd(H,B,Pe))},setOperationSwatch(H,B,Pe){U(yd(H,B,Pe))},addAssociation:te.addAssociation,addEmbedAssociation:te.addEmbedAssociation,setEmbedCardinality:te.setEmbedCardinality,removeAssociation:te.removeAssociation,setAssociationIdentifying:te.setAssociationIdentifying,updateAssociationEnd:te.updateAssociationEnd,hasQuickFix(H){if(!x.value)return!1;const B=Hr(H,o.logical);return B?B.kind==="setEndCascades"?!_e(B.assocRef):!Q(B.entityRef):!1},applyQuickFix(H){if(!x.value)return!1;const B=Hr(H,o.logical);if(!B)return!1;if(B.kind==="setIndexColumns")return he(B.entityRef)?!1:(U(ua(B.entityRef,B.indexRef,{columns:B.columns})),!0);if(Ie(B.assocRef))return!1;const Pe=o.logical.associations.find(Ze=>Ze.modelId===B.assocRef);return Pe?(U(Tt(B.assocRef,B.which,{jpa:{...Pe[B.which].jpa,cascadeTypes:B.cascades}})),!0):!1},moveWaypoint(H,B,Pe){U(kd(H,B,Pe))},addWaypoint(H,B,Pe){U(Id(H,B,Pe))},removeWaypoint(H,B){U(Ed(H,B))},clearWaypoints(H){U(wd(H))},addNote:G.addNote,removeNote:G.removeNote,moveNote:G.moveNote,resizeNote:G.resizeNote,setNoteMemo:G.setNoteMemo,setNoteSwatch:G.setNoteSwatch,addNoteConnection:G.addNoteConnection,removeNoteConnection:G.removeNoteConnection,moveNoteConnectionWaypoint:G.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:G.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:G.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:G.clearNoteConnectionWaypoints,autoLayout(){const H=Ts(o.logical,o.layout);H.length&&U(We("자동 배치",H.map(B=>Eo(B.id,B.location))))},copy:q.copy,paste:q.paste,importEntities:q.importEntities}}const Za=Symbol("groupHover"),Bf=Symbol("groupDrag"),Bo=Symbol("relationHighlight"),Df=Symbol("diffOverlay"),Of=Symbol("nodeInternals"),Lf=Symbol("columnResolution");function LC(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 Pf(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!LC(e[o],n[o]))return!1;return!0}function PC(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(!Pf(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function zC(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function FC(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||!zC(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!PC(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!Pf(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!0}function UC(){let e;return(n,o)=>e=HC(n,o,e)}function HC(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=co(Nn(r,i)));for(const g of r.attributes){if(Li(g)){const p=g.dbAttrs[0];if(!(p!=null&&p.physicalName&&(p!=null&&p.dataType))){const k=Pi(g,r,i,e.associations);k&&l.set(g.modelId,{...g,dbAttrs:[{...p,physicalName:(p==null?void 0:p.physicalName)||k.physicalName,dataType:(p==null?void 0:p.dataType)||k.dataType,length:(p==null?void 0:p.length)??k.length,scale:(p==null?void 0:p.scale)??k.scale},...g.dbAttrs.slice(1)]})}}const _=Tr(g,e.associations);if(_&&c.set(g.modelId,_),!g.attrType.startsWith("EMBED")||g.dbAttrs.length===0)continue;if(g.attrType!=="EMBED_PREDEF"){const p=u();s.set(g.modelId,g.dbAttrs.map((k,I)=>{const A=Dn(k,p);return A?{...k,physicalName:A.physicalName}:on(g,k,I,r,e)}));continue}const E=n==null?void 0:n.find(p=>p.type===g.type);if(!E)continue;const N=u();s.set(g.modelId,g.dbAttrs.map((p,k)=>{const I=E.fields[k],A=Dn(p,N);return A?{...p,physicalName:A.physicalName,logicalName:p.logicalName??(I==null?void 0:I.logicalName),dataType:p.dataType||(I==null?void 0:I.dataType)||""}:I?{...p,physicalName:p.physicalName||I.physicalName,logicalName:p.logicalName??I.logicalName,dataType:p.dataType||I.dataType,length:p.length??I.length}:p}))}const m=new Map,h=new Map;for(const g of r.attributes){const _=s.get(g.modelId);if(_)for(let E=0;E<_.length;E++){const N=`${g.attrType}\0${g.type??""}\0${E}`,p={attrId:g.modelId,slot:E,name:_[E].physicalName??""},k=h.get(N);k?k.push(p):h.set(N,[p])}}for(const g of h.values()){if(g.length<2)continue;const _=new Map;for(const E of g)_.set(E.name,(_.get(E.name)??0)+1);for(const E of g){if((_.get(E.name)??0)<2)continue;const N=m.get(E.attrId);N?N.add(E.slot):m.set(E.attrId,new Set([E.slot]))}}const f={effectiveAttrs:l,embedCols:s,collectionTypes:c,redundantSlots:m},y=o==null?void 0:o.get(r.modelId);a.set(r.modelId,y&&FC(f,y)?y:f)}return a}const zf=Symbol("embedSlotCollapse"),Ff=(e,n)=>`${e}:${n}`,Uf="all:",Hf="one:",jf=e=>`${Uf}${e}`,Kf=(e,n)=>`${Hf}${e}:${n}`,jC=e=>!e.startsWith(Uf)&&!e.startsWith(Hf),KC=["title"],GC={key:0,class:"em-sel","aria-hidden":"true"},YC=["title","aria-expanded","disabled"],qC={class:"em-entity__stereotype"},WC={key:1,class:"em-entity__name"},JC=["title","aria-expanded"],XC={"aria-hidden":"true"},ZC=["data-attr","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],QC=["onPointerdown"],ex={key:1,class:"em-entity__divider-label"},tx=["title"],nx={class:"em-key-slot"},ox={class:"em-key-slot"},ix=["title","aria-expanded","onClick"],ax=["title","onClick"],rx=["title","aria-expanded","onClick"],lx={key:2,class:"em-entity__type"},sx=["onClick"],cx={class:"em-entity__attrname"},dx={class:"em-entity__type"},ux={key:1,class:"em-entity__embed-summary"},mx=["title"],fx=["data-op"],px=["onPointerdown"],hx={class:"em-entity__op-vis","aria-hidden":"true"},yx=["title"],gx={key:4,class:"em-entity__footer"},Gf=Ke(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(oo,null),i=(C,R)=>o?o.t(C,R):Dt("ko",C,R),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=ee.useModal();function l(){o&&Wa(r,o,n.id)}const s=t.inject(Za,null),c=t.inject(Bo,null),d=t.inject(Df,null),u=t.computed(()=>{var C;return((C=d==null?void 0:d.marks.value)==null?void 0:C.get(n.id))??null}),m=t.inject(Lf,null),h=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(zf,void 0),y=t.inject(Of,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const g=t.computed(()=>!!o&&o.editable.value);function _(){s&&(s.value=n.data.groupRef??null)}function E(){c==null||c.setEntityHover(n.id)}function N(){c==null||c.setEntityHover(null)}const p=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),k=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!p.value),I=t.computed(()=>{var C;return((C=o==null?void 0:o.selection.value)==null?void 0:C.kind)==="entity"&&o.selection.value.id===n.id}),A=t.computed(()=>!!n.selected&&!I.value),$=t.computed(()=>{var C;return o&&((C=o.selectedAttr.value)==null?void 0:C.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),L=t.computed(()=>$.value.size>0);function V(C,R){const W=R.shiftKey?"range":R.metaKey||R.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,C.modelId,W)}const S=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!I.value),x=t.computed(()=>n.data.entity),T=t.computed(()=>Ph(x.value,o==null?void 0:o.referenceOnlyDocument.value)),D=t.computed(()=>[...x.value.attributes].sort((C,R)=>C.order-R.order)),b=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),w=t.computed(()=>n.data.collapsed??!1),v=t.computed(()=>n.data.locked??!1),O=t.computed(()=>g.value&&!v.value);function M(){g.value&&(o==null||o.setEntityCollapsed(n.id,!w.value))}const z=t.computed(()=>b.value==="PHYSICAL"||b.value==="LOGICAL_PHYSICAL"),j=t.computed(()=>{const C=b.value==="PHYSICAL"||b.value==="LOGICAL_PHYSICAL",R={};for(const W of D.value){const re=W.attrType.startsWith("RELATION")&&W.dbAttrs.length>0;R[W.modelId]={pk:W.identifier,fk:re&&C,required:W.notNull&&!W.identifier}}return R});function ie(C){if(!C)return"";const R=[];return C.pk&&C.fk?R.push(i("em.node.keyPfk")):C.pk?R.push(i("em.node.keyPk")):C.fk&&R.push(i("em.node.keyFk")),C.required&&R.push(i("em.node.required")),R.join(" · ")}const pe=t.computed(()=>{const C=Ql(_t(n.data.style)),R={};return C&&(R["--em-header-bg"]=C.bar,R["--em-header-fg"]=C.barOn),R});function ye(C){var R,W;return(W=Ql(_t((R=n.data.attributeStyles)==null?void 0:R[C.modelId])))==null?void 0:W.text}const ge=t.computed(()=>[...x.value.operations??[]].sort((C,R)=>C.order-R.order)),me=t.computed(()=>b.value==="CLASS"&&ge.value.length>0),se={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function ke(C){return C?se[C]:"~"}function Se(C){var R,W;return(W=Ql(_t((R=n.data.operationStyles)==null?void 0:R[C.modelId])))==null?void 0:W.text}function ce(C,R,W){switch(b.value){case"CLASS":return[{text:C}];case"PHYSICAL":return[{text:W||C}];case"LOGICAL":return[R?{text:R}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const re=R?{text:R}:{text:i("em.node.logicalMissing"),missing:!0};return W?[re,{text:` · ${W}`}]:[re]}}}function fe(C){var R;return((R=h.value)==null?void 0:R.effectiveAttrs.get(C.modelId))??C}function oe(C){var W,re,ne;if(le(C))return[{text:C.name}];const R=fe(C);return ce(C.name,(re=(W=R.dbAttrs[0])==null?void 0:W.logicalName)==null?void 0:re[a.value],((ne=R.dbAttrs[0])==null?void 0:ne.physicalName)??"")}function le(C){return C.attrType.startsWith("EMBED")&&C.dbAttrs.length>0}function ue(C){return C.attrType==="DIVIDER"}function F(C){var R;return((R=h.value)==null?void 0:R.embedCols.get(C.modelId))??C.dbAttrs}function P(C){var R;return(R=h.value)==null?void 0:R.redundantSlots.get(C.modelId)}const U=t.computed(()=>(f==null?void 0:f.isCollapsed(jf(n.id)))??!1),Q=t.computed(()=>U.value&&z.value?D.value.reduce((C,R)=>le(R)?C+F(R).length:C,0):0),X=t.computed(()=>D.value.some(C=>le(C)));function _e(C){const R=P(C);return!R||R.size===0?!1:f?f.isCollapsed(Ff(n.id,C.modelId)):!1}function he(C){var R;return _e(C)?((R=P(C))==null?void 0:R.size)??0:0}function we(C){return f?f.isCollapsed(Kf(n.id,C.modelId)):!1}function Ie(C){var R;return!z.value||U.value?null:we(C)?"attr":(((R=P(C))==null?void 0:R.size)??0)>0?"slot":null}function q(C){return!U.value&&le(C)}function K(C){return we(C)?F(C).length:0}function J(C){if(U.value||we(C))return[];const R=F(C);if(!_e(C))return R;const W=P(C);return R.filter((re,ne)=>!W.has(ne))}function ve(C){f==null||f.toggle(Ff(n.id,C.modelId))}function Te(C){f==null||f.toggle(Kf(n.id,C.modelId))}function G(){f==null||f.toggle(jf(n.id))}function te(C){var R;return ce(C.physicalName,(R=C.logicalName)==null?void 0:R[a.value],C.physicalName)}function Y(C){var W;const R=(W=h.value)==null?void 0:W.collectionTypes.get(C.modelId);return Mr(b.value,fe(C),R)}const ae=t.computed(()=>{const C={};for(const R of D.value)C[R.modelId]=Y(R);return C}),Be=t.computed(()=>{var C,R,W;return ce(x.value.name,(R=(C=x.value.table)==null?void 0:C.logicalName)==null?void 0:R[a.value],((W=x.value.table)==null?void 0:W.physicalName)??"")}),Ve=t.ref(!1),H=t.ref(""),B=t.ref(null);async function Pe(){var C,R;O.value&&(H.value=x.value.name,Ve.value=!0,await t.nextTick(),(C=B.value)==null||C.focus(),(R=B.value)==null||R.select())}function Ze(){if(!Ve.value)return;Ve.value=!1;const C=H.value.trim();C&&C!==x.value.name&&(o==null||o.renameEntity(n.id,C))}function Ue(){o==null||o.addAttribute(n.id)}function Le(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:De,findNode:Z}=je(),dt=t.ref(null),bn=t.computed(()=>{const C=dt.value??n.data.size;return C?{width:`${C.width}px`,minHeight:`${C.height}px`}:void 0});let Et=null;function _n(C){var re,ne,Ce;if(!O.value)return;C.stopPropagation();const R=(re=Z(n.id))==null?void 0:re.dimensions,W=De({x:C.clientX,y:C.clientY});Et={fx:W.x,fy:W.y,w:(R==null?void 0:R.width)??((ne=n.data.size)==null?void 0:ne.width)??200,h:(R==null?void 0:R.height)??((Ce=n.data.size)==null?void 0:Ce.height)??120},C.target.setPointerCapture(C.pointerId)}function Ee(C){if(!Et)return;const R=De({x:C.clientX,y:C.clientY});dt.value={width:Math.max(40,Et.w+(R.x-Et.fx)),height:Math.max(40,Et.h+(R.y-Et.fy))}}function at(C){var R,W,re;if(Et&&dt.value&&o){const ne=(R=Z(n.id))==null?void 0:R.dimensions;o.resizeEntity(n.id,{width:Math.round((ne==null?void 0:ne.width)??dt.value.width),height:Math.round((ne==null?void 0:ne.height)??dt.value.height)})}Et=null,dt.value=null,(re=(W=C.target).releasePointerCapture)==null||re.call(W,C.pointerId)}const zt=t.ref(null),ut=t.ref(null);function en(C,R){if(!O.value)return;R.stopPropagation(),R.preventDefault();const W=$.value,re=W.has(C.modelId)?new Set(W):new Set([C.modelId]);ut.value={ids:re,dropIndex:-1,lineY:0},R.target.setPointerCapture(R.pointerId)}function tn(C){if(!ut.value||!zt.value)return;const R=Array.from(zt.value.querySelectorAll(".em-entity__row"));if(!R.length)return;let W=R.length;for(let Ce=0;Ce<R.length;Ce++){const de=R[Ce].getBoundingClientRect();if(C.clientY<de.top+de.height/2){W=Ce;break}}const re=R[R.length-1],ne=W<R.length?R[W].offsetTop:re.offsetTop+re.offsetHeight;ut.value={...ut.value,dropIndex:W,lineY:ne}}function Ne(){const C=ut.value;if(ut.value=null,!C||C.dropIndex<0)return;const R=D.value,W=R.filter(xe=>C.ids.has(xe.modelId)).map(xe=>xe.modelId),re=R.filter((xe,Fe)=>C.ids.has(xe.modelId)&&Fe<C.dropIndex).length,ne=C.dropIndex-re,Ce=R.filter(xe=>!C.ids.has(xe.modelId)).map(xe=>xe.modelId);[...Ce.slice(0,ne),...W,...Ce.slice(ne)].join(",")!==R.map(xe=>xe.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,W,ne))}function et(){ut.value=null}const Ft=t.ref(null),pt=t.ref(null);function nt(C,R){O.value&&(R.stopPropagation(),R.preventDefault(),pt.value={id:C.modelId,dropIndex:-1,lineY:0},R.target.setPointerCapture(R.pointerId))}function Uo(C){if(!pt.value||!Ft.value)return;const R=Array.from(Ft.value.querySelectorAll(".em-entity__op-row"));if(!R.length)return;let W=R.length;for(let Ce=0;Ce<R.length;Ce++){const de=R[Ce].getBoundingClientRect();if(C.clientY<de.top+de.height/2){W=Ce;break}}const re=R[R.length-1],ne=W<R.length?R[W].offsetTop:re.offsetTop+re.offsetHeight;pt.value={...pt.value,dropIndex:W,lineY:ne}}function Ho(){const C=pt.value;if(pt.value=null,!C||C.dropIndex<0)return;const W=ge.value.findIndex(ne=>ne.modelId===C.id);if(W<0)return;const re=C.dropIndex-(W<C.dropIndex?1:0);re!==W&&(o==null||o.reorderOperations(n.id,[C.id],re))}function jo(){pt.value=null}return(C,R)=>{var W,re;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":p.value,"is-related":k.value,"is-dimmed":S.value,"is-selected":I.value,"is-multi-selected":A.value,"has-focused-attr":L.value,"is-locked":v.value,"is-reference-only":T.value,"is-diff-added":((W=u.value)==null?void 0:W.verb)==="added","is-diff-modified":((re=u.value)==null?void 0:re.verb)==="modified"}]),tabindex:"-1",title:T.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(bn.value),onPointerdown:_,onMouseenter:E,onMouseleave:N,onDblclick:l},[I.value?(t.openBlock(),t.createElementBlock("div",GC,[...R[11]||(R[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(pe.value),onDblclick:t.withModifiers(Pe,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(w.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!w.value,disabled:!g.value,onClick:t.withModifiers(M,["stop"]),onPointerdown:R[0]||(R[0]=t.withModifiers(()=>{},["stop"])),onDblclick:R[1]||(R[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(w.value?"▸":"▾"),41,YC),t.createElementVNode("span",qC,"«"+t.toDisplayString(t.unref(Go)(x.value.stereotype))+"»",1),Ve.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:B,"onUpdate:modelValue":R[2]||(R[2]=ne=>H.value=ne),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(Ze,["enter"]),R[3]||(R[3]=t.withKeys(ne=>Ve.value=!1,["esc"]))],onBlur:Ze,onPointerdown:R[4]||(R[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,H.value]]):(t.openBlock(),t.createElementBlock("span",WC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Be.value,(ne,Ce)=>(t.openBlock(),t.createElementBlock("span",{key:Ce,class:t.normalizeClass({"em-entity__missing":ne.missing})},t.toDisplayString(ne.text),3))),128))])),!w.value&&z.value&&X.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:U.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!U.value,onClick:t.withModifiers(G,["stop"]),onPointerdown:R[5]||(R[5]=t.withModifiers(()=>{},["stop"])),onDblclick:R[6]||(R[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",XC,t.toDisplayString(U.value?"▸":"▾"),1)],40,JC)):t.createCommentVNode("",!0),v.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),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:zt,class:"em-entity__attrs"},[ut.value&&ut.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ut.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(D.value,ne=>{var Ce,de,xe,Fe,He,rt;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ne.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":$.value.has(ne.modelId),"is-dragging":(Ce=ut.value)==null?void 0:Ce.ids.has(ne.modelId),"is-embed":le(ne),"is-divider":ue(ne),"has-embed-badge":!!Ie(ne),nodrag:ue(ne)&&O.value,"is-diff-changed":!!((de=u.value)!=null&&de.changedAttributeIds.has(ne.modelId))}]),"data-attr":ne.modelId,onClick:t.withModifiers(ze=>V(ne,ze),["stop"]),onPointerdown:ze=>ue(ne)?en(ne,ze):void 0,onPointermove:ze=>ue(ne)?tn(ze):void 0,onPointerup:ze=>ue(ne)?Ne():void 0,onPointercancel:ze=>ue(ne)?et():void 0},[O.value&&!ue(ne)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:ze=>en(ne,ze),onPointermove:tn,onPointerup:Ne,onPointercancel:et,onClick:R[7]||(R[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,QC)):t.createCommentVNode("",!0),ue(ne)?(t.openBlock(),t.createElementBlock("span",ex,t.toDisplayString(ne.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(Zn),{id:`l:${ne.modelId}`,type:"target",position:t.unref($e).Left,class:"em-handle",title:O.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:ie(j.value[ne.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",nx,[(xe=j.value[ne.modelId])!=null&&xe.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Fe=j.value[ne.modelId])!=null&&Fe.required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",ox,[z.value&&q(ne)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:we(ne)?i("em.node.embedAttrShow",{count:K(ne)}):i("em.node.embedAttrHide"),"aria-expanded":!we(ne),onClick:t.withModifiers(ze=>Te(ne),["stop"]),onPointerdown:R[8]||(R[8]=t.withModifiers(()=>{},["stop"])),onDblclick:R[9]||(R[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(we(ne)?"▸":"▾"),41,ix)):le(ne)?(t.openBlock(),t.createBlock(Ae,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(He=j.value[ne.modelId])!=null&&He.fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,tx),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:ye(ne)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(oe(ne),(ze,ot)=>(t.openBlock(),t.createElementBlock("span",{key:ot,class:t.normalizeClass({"em-entity__missing":ze.missing})},t.toDisplayString(ze.text),3))),128))],4),Ie(ne)==="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:K(ne)}),onClick:t.withModifiers(ze=>Te(ne),["stop"])},"+"+t.toDisplayString(K(ne)),9,ax)):Ie(ne)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:_e(ne)?i("em.node.embedRepeatedShow",{count:((rt=P(ne))==null?void 0:rt.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!_e(ne),onClick:t.withModifiers(ze=>ve(ne),["stop"])},t.toDisplayString(_e(ne)?`+${he(ne)}`:"−"),9,rx)):t.createCommentVNode("",!0),ae.value[ne.modelId]?(t.openBlock(),t.createElementBlock("span",lx,t.toDisplayString(ae.value[ne.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(Zn),{id:`r:${ne.modelId}`,type:"source",position:t.unref($e).Right,class:"em-handle",title:O.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,ZC),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(le(ne)&&z.value?J(ne):[],ze=>(t.openBlock(),t.createElementBlock("li",{key:`${ne.modelId}:${ze.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":$.value.has(ne.modelId)}]),onClick:t.withModifiers(ot=>V(ne,ot),["stop"])},[R[12]||(R[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",cx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te(ze),(ot,tt)=>(t.openBlock(),t.createElementBlock("span",{key:tt,class:t.normalizeClass({"em-entity__missing":ot.missing})},t.toDisplayString(ot.text),3))),128))]),t.createElementVNode("span",dx,t.toDisplayString(ze.dataType),1)],10,sx))),128))],64)}),128)),Q.value?(t.openBlock(),t.createElementBlock("li",ux,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(G,["stop"])},[t.createVNode(Ae,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:Q.value})),1)],8,mx)])):t.createCommentVNode("",!0)],512)),!w.value&&me.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Ft,class:"em-entity__ops"},[pt.value&&pt.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${pt.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ge.value,ne=>{var Ce,de;return t.openBlock(),t.createElementBlock("li",{key:ne.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Ce=pt.value)==null?void 0:Ce.id)===ne.modelId,"is-diff-changed":!!((de=u.value)!=null&&de.changedOperationIds.has(ne.modelId))}]),"data-op":ne.modelId},[O.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:xe=>nt(ne,xe),onPointermove:Uo,onPointerup:Ho,onPointercancel:jo,onClick:R[10]||(R[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,px)):t.createCommentVNode("",!0),t.createElementVNode("span",hx,t.toDisplayString(ke(ne.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:Se(ne)})},t.toDisplayString(ne.name)+"()",5)],10,fx)}),128))],512)):ge.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ge.value.length})},[t.createVNode(Ae,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ge.value.length})),1)],8,yx)):t.createCommentVNode("",!0),O.value?(t.openBlock(),t.createElementBlock("footer",gx,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Ue},t.toDisplayString(i("em.node.addAttr")),1),R[13]||(R[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:Le},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),O.value&&!Ve.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:_n,onPointermove:Ee,onPointerup:at},null,32)):t.createCommentVNode("",!0)],46,KC)}}}),[["__scopeId","data-v-4dfeab79"]]),bx={key:0,class:"em-sel","aria-hidden":"true"},_x={class:"em-group__label"},kx={class:"em-group__name"},Ex={key:0,class:"em-group__pkg"},Nx={key:1,class:"em-group__flag"},Yf=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(oo,null),s=(x,T)=>l?l.t(x,T):Dt("ko",x,T),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var x;return!!n.id&&((x=l==null?void 0:l.selection.value)==null?void 0:x.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(Za,null),h=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Bo,null);function y(){n.id&&(f==null||f.setGroupHover(n.id))}function g(){f==null||f.setGroupHover(null)}const _=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),E=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:N,findNode:p}=je();let k=null,I=null;function A(x){var b;if(!n.id||!c.value)return;x.stopPropagation();const T=((b=p(n.id))==null?void 0:b.dimensions)??{width:400,height:300},D=N({x:x.clientX,y:x.clientY});k={fx:D.x,fy:D.y,w:T.width,h:T.height},x.target.setPointerCapture(x.pointerId)}function $(x){if(!k||!n.id)return;const T=N({x:x.clientX,y:x.clientY});I={width:Math.max(160,k.w+(T.x-k.fx)),height:Math.max(120,k.h+(T.y-k.fy))};const D=p(n.id);D&&(D.style={width:`${I.width}px`,height:`${I.height}px`})}function L(x){var T,D;k&&I&&n.id&&l&&l.resizeGroup(n.id,I),k=null,I=null,(D=(T=x.target).releasePointerCapture)==null||D.call(T,x.pointerId)}const V=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),S=t.computed(()=>{const x=o.value.name;return(x==null?void 0:x[V.value])||(x==null?void 0:x.ko)||(x==null?void 0:x.en)||(x==null?void 0:x.ja)||(x==null?void 0:x.zh)||o.value.packageName||s("em.group.fallback")});return(x,T)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":h.value,"is-hover-origin":_.value,"is-dimmed":E.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:g},[d.value?(t.openBlock(),t.createElementBlock("div",bx,[...T[0]||(T[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",_x,[t.createElementVNode("span",kx,t.toDisplayString(S.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",Ex,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",Nx,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:$,onPointerup:L},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),wx={key:0,class:"em-sel","aria-hidden":"true"},Ix={key:2,class:"em-note__text"},qf=Ke(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(oo,null),i=t.inject(Za,null),a=t.inject(Bo,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 b;return((b=a==null?void 0:a.source.value)==null?void 0:b.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!h.value),y=t.computed(()=>{var b;return((b=o==null?void 0:o.selection.value)==null?void 0:b.kind)==="note"&&o.selection.value.id===n.id}),g=t.computed(()=>!!n.selected&&!y.value),_=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),E=[{id:"n-top",pos:$e.Top},{id:"n-right",pos:$e.Right},{id:"n-bottom",pos:$e.Bottom},{id:"n-left",pos:$e.Left}],N=t.ref(!1),p=t.ref(""),k=t.ref(null);async function I(){var b;l.value&&(p.value=r.value.memo,N.value=!0,await t.nextTick(),(b=k.value)==null||b.focus())}function A(){N.value&&(N.value=!1,p.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,p.value)))}const{screenToFlowCoordinate:$,findNode:L}=je();let V=null,S=null;function x(b){var O;if(!l.value)return;b.stopPropagation();const w=((O=L(n.id))==null?void 0:O.dimensions)??r.value.geo.size,v=$({x:b.clientX,y:b.clientY});V={fx:v.x,fy:v.y,w:w.width,h:w.height},b.target.setPointerCapture(b.pointerId)}function T(b){if(!V)return;const w=$({x:b.clientX,y:b.clientY});S={width:Math.max(140,V.w+(w.x-V.fx)),height:Math.max(60,V.h+(w.y-V.fy))};const v=L(n.id);v&&(v.style={width:`${S.width}px`,height:`${S.height}px`})}function D(b){var w,v;V&&S&&o&&o.resizeNote(n.id,S),V=null,S=null,(v=(w=b.target).releasePointerCapture)==null||v.call(w,b.pointerId)}return(b,w)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":h.value,"is-related":f.value,"is-dimmed":_.value,"is-selected":y.value,"is-multi-selected":g.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:I,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",wx,[...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),N.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:k,"onUpdate:modelValue":w[0]||(w[0]=v=>p.value=v),class:"em-note__edit nodrag",onBlur:A,onKeydown:w[1]||(w[1]=t.withKeys(v=>N.value=!1,["esc"])),onPointerdown:w[2]||(w[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,p.value]]):(t.openBlock(),t.createElementBlock("div",Ix,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(E,v=>t.createVNode(t.unref(Zn),{id:v.id,key:v.id,type:"source",position:v.pos,class:"em-note-handle",onPointerdown:w[3]||(w[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!N.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:x,onPointermove:T,onPointerup:D},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function Qa(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 Do=.5;function Wf(e,n,o,i,a,r){const l=Qa(n),s=Qa(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 f=(_,E)=>{(Math.abs(_.x-h.x)>=Do||Math.abs(_.y-h.y)>=Do)&&(m.push({a:h,b:_,seg:E}),h=_)};f(c,0);let y=l.x!==0,g=c;for(let _=1;_<u.length;_++){const E=u[_],N=_<=o.length?_-1:o.length,p=Math.abs(E.x-g.x)<Do,k=Math.abs(E.y-g.y)<Do;p&&k||(p?(f(E,N),y=!1):k?(f(E,N),y=!0):y?(f({x:g.x,y:E.y},N),f(E,N),y=!0):(f({x:E.x,y:g.y},N),f(E,N),y=!1),g=E)}return f(i,o.length),m}function Jf(e,n,o,i,a,r=20){const l=Wf(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 vx=14;function Xf(e,n,o,i,a,r=20){return Wf(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=vx).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 Cx=36;function xx(e,n,o=Cx){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 Zf(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 Sx(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Qf(e,n){const o=Sx(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Do&&Math.abs(l)<Do)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 ep(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 tp(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 Rx=20,Ax=22,$x=7,Tx=22,np=31,op=7,Mx=20,ip=11,ap=11,Vx=np+op;function Bx(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function Dx(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function er(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 rp(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function tr(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function lp(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:rp(e,n);return[tr(o,a,r-Math.PI/2),tr(o,a,r+Math.PI/2)]}function sp(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 cp(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=er(e,n,Rx),[d,u]=lp(e,n,c,Ax);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}),Bx(o.multiplicity)){const m=er(e,n,np);r.push({cx:m.x,cy:m.y,r:op})}if(Dx(o.multiplicity)){const m=er(e,n,$x),[h,f]=lp(e,n,m,Tx);a.push({x1:c.x,y1:c.y,x2:h.x,y2:h.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.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=er(e,n,Mx),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=rp(e,n),m=tr(d,ip/2,u-Math.PI/2),h=tr(d,ip/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=sp(s,c,ap,!0),u=sp(s,c,ap,!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 dp=200,up=120,is=24;function mp(e){var a,r;if(!e)return{x:0,y:0,width:dp,height:up};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||dp,i=((r=e.dimensions)==null?void 0:r.height)||up;return{x:n.x,y:n.y,width:o,height:i}}function fp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pp(e){const n=t.computed(()=>mp(e.sourceNode())),o=t.computed(()=>mp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,y;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.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)<is){const g=(m+h)/2;m=g-is/2,h=g+is/2}return{source:{x:u,y:m},target:{x:u,y:h}}}),r=t.computed(()=>e.waypoints()[0]??fp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??fp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?ep(n.value,d,r.value.x):Qf(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?ep(o.value,d,l.value.x):Qf(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 as=Symbol("waypointController"),Ox=["d"],Lx=["d"],Px=["d"],zx=["x1","y1","x2","y2"],Fx=["cx","cy","r"],Ux=["x","y"],Hx=["x","y"],jx=["cx","cy","onDblclick"],Kx=["x","y","onPointerdown","onDblclick"],hp=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(as),a=t.inject(oo,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Bf,null),s=t.inject(Bo,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var oe;return((oe=a==null?void 0:a.selection.value)==null?void 0:oe.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 oe=l==null?void 0:l.value;if(!oe||!a)return null;const le=a.resolved.value.entities,ue=P=>{var U;return(U=le.find(Q=>Q.entity.modelId===P))==null?void 0:U.groupRef},F=n.data.association;return ue(F.end1.entityRef)===oe.groupId&&ue(F.end2.entityRef)===oe.groupId?{dx:oe.dx,dy:oe.dy}:null}),h=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),y=t.ref({x:0,y:0}),g=t.computed(()=>{const oe=m.value;return h.value.map((le,ue)=>ue===f.value?y.value:oe?{x:le.x+oe.dx,y:le.y+oe.dy}:le)}),_=t.computed(()=>{var oe;return!!((oe=n.sourceNode.data)!=null&&oe.collapsed)}),E=t.computed(()=>{var oe;return!!((oe=n.targetNode.data)!=null&&oe.collapsed)}),{source:N,target:p,sourceSide:k,targetSide:I,isSelf:A}=pp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>g.value,sourceRowY:()=>n.data.sourceColumnRef&&!_.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!E.value?n.targetY:void 0}),$=Vx+4,L=t.computed(()=>A.value?xx(N.value,p.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?Jf(N.value,k.value,g.value,p.value,I.value,$):Zf(N.value,g.value,p.value)),V=t.computed(()=>A.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?Xf(N.value,k.value,g.value,p.value,I.value,$):tp(N.value,g.value,p.value).map((oe,le)=>({point:oe,segIndex:le}))),S=t.computed(()=>A.value||!r.value?[]:g.value),x=ji;function T(oe,le){f.value=oe,y.value={...h.value[oe]},le.target.setPointerCapture(le.pointerId),le.stopPropagation()}function D(oe){if(f.value<0)return;const le=o({x:oe.clientX,y:oe.clientY});y.value={x:le.x,y:le.y}}function b(oe){var le,ue;f.value>=0&&i&&i.movePoint(n.id,f.value,{...y.value}),f.value=-1,(ue=(le=oe.target).releasePointerCapture)==null||ue.call(le,oe.pointerId)}function w(oe,le){le.stopPropagation(),i==null||i.removePoint(n.id,oe)}function v(oe,le){if(!i)return;const ue=o({x:le.clientX,y:le.clientY});i.insertPoint(n.id,oe,{x:ue.x,y:ue.y})}const O=t.computed(()=>x(n.data.association.end1.multiplicity)),M=t.computed(()=>x(n.data.association.end2.multiplicity)),z=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),j=t.computed(()=>z.value==="class"),ie=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const oe=Qa(k.value);return{x:N.value.x+oe.x*10,y:N.value.y+oe.y*10}}return g.value[0]??p.value}),pe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const le=Qa(I.value);return{x:p.value.x+le.x*10,y:p.value.y+le.y*10}}const oe=g.value;return oe[oe.length-1]??N.value}),ye=t.computed(()=>{const oe=n.data.association;return{multiplicity:oe.end1.multiplicity,navigable:oe.end1.navigable,composition:oe.end1.composition,otherNavigable:oe.end2.navigable}}),ge=t.computed(()=>{const oe=n.data.association;return{multiplicity:oe.end2.multiplicity,navigable:oe.end2.navigable,composition:oe.end2.composition,otherNavigable:oe.end1.navigable}}),me=t.computed(()=>cp(N.value,ie.value,ye.value,z.value)),se=t.computed(()=>cp(p.value,pe.value,ge.value,z.value)),ke=t.computed(()=>[...me.value.lines,...se.value.lines]),Se=t.computed(()=>[...me.value.circles,...se.value.circles]),ce=t.computed(()=>[...me.value.polygons,...se.value.polygons].map(oe=>`M${oe.points.map(le=>`${le.x},${le.y}`).join(" L")} Z`)),fe=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(oe,le)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:L.value,fill:"none",class:"em-edge__hit"},null,8,Ox),t.createElementVNode("path",{d:L.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,Lx),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ce.value,(ue,F)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${F}`,d:ue,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",fe.value])},null,10,Px))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ke.value,(ue,F)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${F}`,x1:ue.x1,y1:ue.y1,x2:ue.x2,y2:ue.y2,class:t.normalizeClass(["em-edge__marker",fe.value])},null,10,zx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value,(ue,F)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${F}`,cx:ue.cx,cy:ue.cy,r:ue.r,class:t.normalizeClass(["em-edge__marker",fe.value])},null,10,Fx))),128)),j.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(N).x+8,y:t.unref(N).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(O.value),11,Ux),t.createElementVNode("text",{x:t.unref(p).x-8,y:t.unref(p).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(M.value),11,Hx)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.value,(ue,F)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${F}`,cx:ue.point.x,cy:ue.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(P=>v(ue.segIndex,P),["stop"])},null,42,jx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(S.value,(ue,F)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${F}`,x:ue.x-5,y:ue.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:P=>T(F,P),onPointermove:D,onPointerup:b,onDblclick:P=>w(F,P)},null,42,Kx))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var pn=(e=>(e.Lines="lines",e.Dots="dots",e))(pn||{});const yp=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]}`})},gp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};pn.Lines+"",pn.Dots+"";const Gx={[pn.Dots]:"#81818a",[pn.Lines]:"#eee"},Yx=["id","x","y","width","height","patternTransform"],qx={key:2,height:"100",width:"100"},Wx=["fill"],Jx=["x","y","fill"],Xx={name:"Background",compatConfig:{MODE:3}},Zx=t.defineComponent({...Xx,props:{id:{},variant:{default:()=>pn.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],f=[m*l||1+d[0]/2,h*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||Gx[e.variant||pn.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(pn).Lines?(t.openBlock(),t.createBlock(t.unref(yp),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(pn).Dots?(t.openBlock(),t.createBlock(t.unref(gp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",qx,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,Wx)])):t.createCommentVNode("",!0)])],8,Yx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,Jx),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),Qx={name:"ControlButton",compatConfig:{MODE:3}},eS=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},tS={type:"button",class:"vue-flow__controls-button"};function nS(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",tS,[t.renderSlot(e.$slots,"default")])}const io=eS(Qx,[["render",nS]]),oS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},iS=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function aS(e,n){return t.openBlock(),t.createElementBlock("svg",oS,iS)}const rS={render:aS},lS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},sS=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function cS(e,n){return t.openBlock(),t.createElementBlock("svg",lS,sS)}const dS={render:cS},uS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},mS=[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 fS(e,n){return t.openBlock(),t.createElementBlock("svg",uS,mS)}const pS={render:fS},hS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},yS=[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 gS(e,n){return t.openBlock(),t.createElementBlock("svg",hS,yS)}const bS={render:gS},_S={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},kS=[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 ES(e,n){return t.openBlock(),t.createElementBlock("svg",_S,kS)}const NS={render:ES},wS={name:"Controls",compatConfig:{MODE:3}},IS=t.defineComponent({...wS,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>hm.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),f=t.toRef(()=>d.value.zoom<=u.value),y=t.toRef(()=>d.value.zoom>=m.value);function g(){l(),n("zoomIn")}function _(){s(),n("zoomOut")}function E(){c(e.fitViewParams),n("fitView")}function N(){r(!h.value),n("interactionChange",!h.value)}return(p,k)=>(t.openBlock(),t.createBlock(t.unref(pf),{class:"vue-flow__controls",position:p.position},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"top"),p.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(p.$slots,"control-zoom-in",{},()=>[t.createVNode(io,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(rS))))])]),_:3},8,["disabled"])]),t.renderSlot(p.$slots,"control-zoom-out",{},()=>[t.createVNode(io,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(dS))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),p.showFitView?t.renderSlot(p.$slots,"control-fit-view",{key:1},()=>[t.createVNode(io,{class:"vue-flow__controls-fitview",onClick:E},{default:t.withCtx(()=>[t.renderSlot(p.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(pS))))])]),_:3})]):t.createCommentVNode("",!0),p.showInteractive?t.renderSlot(p.$slots,"control-interactive",{key:2},()=>[p.showInteractive?(t.openBlock(),t.createBlock(io,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:t.withCtx(()=>[h.value?t.renderSlot(p.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(NS))))]):t.createCommentVNode("",!0),h.value?t.createCommentVNode("",!0):t.renderSlot(p.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(bS))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(p.$slots,"default")]),_:3},8,["position"]))}});var vS={value:()=>{}};function rs(){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 nr(o)}function nr(e){this._=e}function CS(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}})}nr.prototype=rs.prototype={constructor:nr,on:function(e,n){var o=this._,i=CS(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=xS(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]=bp(o[a],e.name,n);else if(n==null)for(a in o)o[a]=bp(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 nr(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 xS(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function bp(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=vS,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ls="http://www.w3.org/1999/xhtml";const _p={svg:"http://www.w3.org/2000/svg",xhtml:ls,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function or(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),_p.hasOwnProperty(n)?{space:_p[n],local:e}:e}function SS(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ls&&n.documentElement.namespaceURI===ls?n.createElement(e):n.createElementNS(o,e)}}function RS(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function kp(e){var n=or(e);return(n.local?RS:SS)(n)}function AS(){}function ss(e){return e==null?AS:function(){return this.querySelector(e)}}function $S(e){typeof e!="function"&&(e=ss(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 TS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function MS(){return[]}function Ep(e){return e==null?MS:function(){return this.querySelectorAll(e)}}function VS(e){return function(){return TS(e.apply(this,arguments))}}function BS(e){typeof e=="function"?e=VS(e):e=Ep(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 Np(e){return function(){return this.matches(e)}}function wp(e){return function(n){return n.matches(e)}}var DS=Array.prototype.find;function OS(e){return function(){return DS.call(this.children,e)}}function LS(){return this.firstElementChild}function PS(e){return this.select(e==null?LS:OS(typeof e=="function"?e:wp(e)))}var zS=Array.prototype.filter;function FS(){return Array.from(this.children)}function US(e){return function(){return zS.call(this.children,e)}}function HS(e){return this.selectAll(e==null?FS:US(typeof e=="function"?e:wp(e)))}function jS(e){typeof e!="function"&&(e=Np(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 Ip(e){return new Array(e.length)}function KS(){return new St(this._enter||this._groups.map(Ip),this._parents)}function ir(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}ir.prototype={constructor:ir,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 GS(e){return function(){return e}}function YS(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 ir(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function qS(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,h=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(h[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new ir(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(h[s])===c&&(a[s]=c)}function WS(e){return e.__data__}function JS(e,n){if(!arguments.length)return Array.from(this,WS);var o=n?qS:YS,i=this._parents,a=this._groups;typeof e!="function"&&(e=GS(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,f=XS(e.call(u,u&&u.__data__,d,i)),y=f.length,g=s[d]=new Array(y),_=l[d]=new Array(y),E=c[d]=new Array(h);o(u,m,g,_,E,f,n);for(var N=0,p=0,k,I;N<y;++N)if(k=g[N]){for(N>=p&&(p=N+1);!(I=_[p])&&++p<y;);k._next=I||null}}return l=new St(l,i),l._enter=s,l._exit=c,l}function XS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ZS(){return new St(this._exit||this._groups.map(Ip),this._parents)}function QS(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 eR(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),f,y=0;y<m;++y)(f=d[y]||u[y])&&(h[y]=f);for(;c<a;++c)s[c]=o[c];return new St(s,this._parents)}function tR(){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 nR(e){e||(e=oR);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 oR(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function iR(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function aR(){return Array.from(this)}function rR(){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 lR(){let e=0;for(const n of this)++e;return e}function sR(){return!this.node()}function cR(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 dR(e){return function(){this.removeAttribute(e)}}function uR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mR(e,n){return function(){this.setAttribute(e,n)}}function fR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function pR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function hR(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 yR(e,n){var o=or(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?uR:dR:typeof n=="function"?o.local?hR:pR:o.local?fR:mR)(o,n))}function vp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function gR(e){return function(){this.style.removeProperty(e)}}function bR(e,n,o){return function(){this.style.setProperty(e,n,o)}}function _R(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function kR(e,n,o){return arguments.length>1?this.each((n==null?gR:typeof n=="function"?_R:bR)(e,n,o??"")):Oo(this.node(),e)}function Oo(e,n){return e.style.getPropertyValue(n)||vp(e).getComputedStyle(e,null).getPropertyValue(n)}function ER(e){return function(){delete this[e]}}function NR(e,n){return function(){this[e]=n}}function wR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function IR(e,n){return arguments.length>1?this.each((n==null?ER:typeof n=="function"?wR:NR)(e,n)):this.node()[e]}function Cp(e){return e.trim().split(/^|\s+/)}function cs(e){return e.classList||new xp(e)}function xp(e){this._node=e,this._names=Cp(e.getAttribute("class")||"")}xp.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 Sp(e,n){for(var o=cs(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Rp(e,n){for(var o=cs(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function vR(e){return function(){Sp(this,e)}}function CR(e){return function(){Rp(this,e)}}function xR(e,n){return function(){(n.apply(this,arguments)?Sp:Rp)(this,e)}}function SR(e,n){var o=Cp(e+"");if(arguments.length<2){for(var i=cs(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?xR:n?vR:CR)(o,n))}function RR(){this.textContent=""}function AR(e){return function(){this.textContent=e}}function $R(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function TR(e){return arguments.length?this.each(e==null?RR:(typeof e=="function"?$R:AR)(e)):this.node().textContent}function MR(){this.innerHTML=""}function VR(e){return function(){this.innerHTML=e}}function BR(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function DR(e){return arguments.length?this.each(e==null?MR:(typeof e=="function"?BR:VR)(e)):this.node().innerHTML}function OR(){this.nextSibling&&this.parentNode.appendChild(this)}function LR(){return this.each(OR)}function PR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zR(){return this.each(PR)}function FR(e){var n=typeof e=="function"?e:kp(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function UR(){return null}function HR(e,n){var o=typeof e=="function"?e:kp(e),i=n==null?UR:typeof n=="function"?n:ss(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function jR(){var e=this.parentNode;e&&e.removeChild(this)}function KR(){return this.each(jR)}function GR(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function YR(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function qR(e){return this.select(e?YR:GR)}function WR(e){return arguments.length?this.property("__data__",e):this.node().__data__}function JR(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 ZR(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 QR(e,n,o){return function(){var i=this.__on,a,r=JR(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 eA(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?QR:ZR,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Ap(e,n,o){var i=vp(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 tA(e,n){return function(){return Ap(this,e,n)}}function nA(e,n){return function(){return Ap(this,e,n.apply(this,arguments))}}function oA(e,n){return this.each((typeof n=="function"?nA:tA)(e,n))}function*iA(){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 $p=[null];function St(e,n){this._groups=e,this._parents=n}function Ii(){return new St([[document.documentElement]],$p)}function aA(){return this}St.prototype=Ii.prototype={constructor:St,select:$S,selectAll:BS,selectChild:PS,selectChildren:HS,filter:jS,data:JS,enter:KS,exit:ZS,join:QS,merge:eR,selection:aA,order:tR,sort:nR,call:iR,nodes:aR,node:rR,size:lR,empty:sR,each:cR,attr:yR,style:kR,property:IR,classed:SR,text:TR,html:DR,raise:LR,lower:zR,append:FR,insert:HR,remove:KR,clone:qR,datum:WR,on:eA,dispatch:oA,[Symbol.iterator]:iA};function $n(e){return typeof e=="string"?new St([[document.querySelector(e)]],[document.documentElement]):new St([[e]],$p)}function rA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Tn(e,n){if(e=rA(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 ds={capture:!0,passive:!1};function us(e){e.preventDefault(),e.stopImmediatePropagation()}function lA(e){var n=e.document.documentElement,o=$n(e).on("dragstart.drag",us,ds);"onselectstart"in n?o.on("selectstart.drag",us,ds):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function sA(e,n){var o=e.document.documentElement,i=$n(e).on("dragstart.drag",null);n&&(i.on("click.drag",us,ds),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 ms(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function Tp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function vi(){}var Ci=.7,ar=1/Ci,Lo="\\s*([+-]?\\d+)\\s*",xi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",cA=/^#([0-9a-f]{3,8})$/,dA=new RegExp(`^rgb\\(${Lo},${Lo},${Lo}\\)$`),uA=new RegExp(`^rgb\\(${Zt},${Zt},${Zt}\\)$`),mA=new RegExp(`^rgba\\(${Lo},${Lo},${Lo},${xi}\\)$`),fA=new RegExp(`^rgba\\(${Zt},${Zt},${Zt},${xi}\\)$`),pA=new RegExp(`^hsl\\(${xi},${Zt},${Zt}\\)$`),hA=new RegExp(`^hsla\\(${xi},${Zt},${Zt},${xi}\\)$`),Mp={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};ms(vi,Si,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Vp,formatHex:Vp,formatHex8:yA,formatHsl:gA,formatRgb:Bp,toString:Bp});function Vp(){return this.rgb().formatHex()}function yA(){return this.rgb().formatHex8()}function gA(){return zp(this).formatHsl()}function Bp(){return this.rgb().formatRgb()}function Si(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=cA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Dp(n):o===3?new It(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?rr(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?rr(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=dA.exec(e))?new It(n[1],n[2],n[3],1):(n=uA.exec(e))?new It(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=mA.exec(e))?rr(n[1],n[2],n[3],n[4]):(n=fA.exec(e))?rr(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=pA.exec(e))?Pp(n[1],n[2]/100,n[3]/100,1):(n=hA.exec(e))?Pp(n[1],n[2]/100,n[3]/100,n[4]):Mp.hasOwnProperty(e)?Dp(Mp[e]):e==="transparent"?new It(NaN,NaN,NaN,0):null}function Dp(e){return new It(e>>16&255,e>>8&255,e&255,1)}function rr(e,n,o,i){return i<=0&&(e=n=o=NaN),new It(e,n,o,i)}function bA(e){return e instanceof vi||(e=Si(e)),e?(e=e.rgb(),new It(e.r,e.g,e.b,e.opacity)):new It}function fs(e,n,o,i){return arguments.length===1?bA(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}ms(It,fs,Tp(vi,{brighter(e){return e=e==null?ar:Math.pow(ar,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ci:Math.pow(Ci,e),new It(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new It(ao(this.r),ao(this.g),ao(this.b),lr(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:Op,formatHex:Op,formatHex8:_A,formatRgb:Lp,toString:Lp}));function Op(){return`#${ro(this.r)}${ro(this.g)}${ro(this.b)}`}function _A(){return`#${ro(this.r)}${ro(this.g)}${ro(this.b)}${ro((isNaN(this.opacity)?1:this.opacity)*255)}`}function Lp(){const e=lr(this.opacity);return`${e===1?"rgb(":"rgba("}${ao(this.r)}, ${ao(this.g)}, ${ao(this.b)}${e===1?")":`, ${e})`}`}function lr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ao(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ro(e){return e=ao(e),(e<16?"0":"")+e.toString(16)}function Pp(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Lt(e,n,o,i)}function zp(e){if(e instanceof Lt)return new Lt(e.h,e.s,e.l,e.opacity);if(e instanceof vi||(e=Si(e)),!e)return new Lt;if(e instanceof Lt)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 Lt(l,s,c,e.opacity)}function kA(e,n,o,i){return arguments.length===1?zp(e):new Lt(e,n,o,i??1)}function Lt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}ms(Lt,kA,Tp(vi,{brighter(e){return e=e==null?ar:Math.pow(ar,e),new Lt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ci:Math.pow(Ci,e),new Lt(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(ps(e>=240?e-240:e+120,a,i),ps(e,a,i),ps(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Lt(Fp(this.h),sr(this.s),sr(this.l),lr(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=lr(this.opacity);return`${e===1?"hsl(":"hsla("}${Fp(this.h)}, ${sr(this.s)*100}%, ${sr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Fp(e){return e=(e||0)%360,e<0?e+360:e}function sr(e){return Math.max(0,Math.min(1,e||0))}function ps(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 Up=e=>()=>e;function EA(e,n){return function(o){return e+o*n}}function NA(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 wA(e){return(e=+e)==1?Hp:function(n,o){return o-n?NA(n,o,e):Up(isNaN(n)?o:n)}}function Hp(e,n){var o=n-e;return o?EA(e,o):Up(isNaN(e)?n:e)}const jp=(function e(n){var o=wA(n);function i(a,r){var l=o((a=fs(a)).r,(r=fs(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=Hp(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 Mn(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var hs=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ys=new RegExp(hs.source,"g");function IA(e){return function(){return e}}function vA(e){return function(n){return e(n)+""}}function CA(e,n){var o=hs.lastIndex=ys.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=hs.exec(e))&&(a=ys.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:Mn(i,a)})),o=ys.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?vA(c[0].x):IA(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 Kp=180/Math.PI,gs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Gp(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)*Kp,skewX:Math.atan(c)*Kp,scaleX:l,scaleY:s}}var cr;function xA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?gs:Gp(n.a,n.b,n.c,n.d,n.e,n.f)}function SA(e){return e==null||(cr||(cr=document.createElementNS("http://www.w3.org/2000/svg","g")),cr.setAttribute("transform",e),!(e=cr.transform.baseVal.consolidate()))?gs:(e=e.matrix,Gp(e.a,e.b,e.c,e.d,e.e,e.f))}function Yp(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,h,f,y){if(d!==m||u!==h){var g=f.push("translate(",null,n,null,o);y.push({i:g-4,x:Mn(d,m)},{i:g-2,x:Mn(u,h)})}else(m||h)&&f.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:Mn(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:Mn(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,h,f,y){if(d!==m||u!==h){var g=f.push(a(f)+"scale(",null,",",null,")");y.push({i:g-4,x:Mn(d,m)},{i:g-2,x:Mn(u,h)})}else(m!==1||h!==1)&&f.push(a(f)+"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(f){for(var y=-1,g=h.length,_;++y<g;)m[(_=h[y]).i]=_.x(f);return m.join("")}}}var RA=Yp(xA,"px, ","px)","deg)"),AA=Yp(SA,", ",")",")"),$A=1e-12;function qp(e){return((e=Math.exp(e))+1/e)/2}function TA(e){return((e=Math.exp(e))-1/e)/2}function MA(e){return((e=Math.exp(2*e))-1)/(e+1)}const VA=(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],f=u-s,y=m-c,g=f*f+y*y,_,E;if(g<$A)E=Math.log(h/d)/n,_=function($){return[s+$*f,c+$*y,d*Math.exp(n*$*E)]};else{var N=Math.sqrt(g),p=(h*h-d*d+i*g)/(2*d*o*N),k=(h*h-d*d-i*g)/(2*h*o*N),I=Math.log(Math.sqrt(p*p+1)-p),A=Math.log(Math.sqrt(k*k+1)-k);E=(A-I)/n,_=function($){var L=$*E,V=qp(I),S=d/(o*N)*(V*MA(n*L+I)-TA(I));return[s+S*f,c+S*y,d*V/qp(n*L+I)]}}return _.duration=E*1e3*n/Math.SQRT2,_}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 Po=0,Ri=0,Ai=0,Wp=1e3,dr,$i,ur=0,lo=0,mr=0,Ti=typeof performance=="object"&&performance.now?performance:Date,Jp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function bs(){return lo||(Jp(BA),lo=Ti.now()+mr)}function BA(){lo=0}function fr(){this._call=this._time=this._next=null}fr.prototype=Xp.prototype={constructor:fr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?bs():+o)+(n==null?0:+n),!this._next&&$i!==this&&($i?$i._next=this:dr=this,$i=this),this._call=e,this._time=o,_s()},stop:function(){this._call&&(this._call=null,this._time=1/0,_s())}};function Xp(e,n,o){var i=new fr;return i.restart(e,n,o),i}function DA(){bs(),++Po;for(var e=dr,n;e;)(n=lo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Po}function Zp(){lo=(ur=Ti.now())+mr,Po=Ri=0;try{DA()}finally{Po=0,LA(),lo=0}}function OA(){var e=Ti.now(),n=e-ur;n>Wp&&(mr-=n,ur=e)}function LA(){for(var e,n=dr,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:dr=o);$i=e,_s(i)}function _s(e){if(!Po){Ri&&(Ri=clearTimeout(Ri));var n=e-lo;n>24?(e<1/0&&(Ri=setTimeout(Zp,e-Ti.now()-mr)),Ai&&(Ai=clearInterval(Ai))):(Ai||(ur=Ti.now(),Ai=setInterval(OA,Wp)),Po=1,Jp(Zp))}}function Qp(e,n,o){var i=new fr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var PA=rs("start","end","cancel","interrupt"),zA=[],eh=0,th=1,ks=2,pr=3,nh=4,Es=5,hr=6;function yr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;FA(e,o,{name:n,index:i,group:a,on:PA,tween:zA,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:eh})}function Ns(e,n){var o=Pt(e,n);if(o.state>eh)throw new Error("too late; already scheduled");return o}function Qt(e,n){var o=Pt(e,n);if(o.state>pr)throw new Error("too late; already running");return o}function Pt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function FA(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=Xp(r,0,o.time);function r(d){o.state=th,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,h,f;if(o.state!==th)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===pr)return Qp(l);f.state===nh?(f.state=hr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=hr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(Qp(function(){o.state===pr&&(o.state=nh,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=ks,o.on.call("start",e,e.__data__,o.index,o.group),o.state===ks){for(o.state=pr,a=new Array(h=o.tween.length),u=0,m=-1;u<h;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);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=Es,1),m=-1,h=a.length;++m<h;)a[m].call(e,u);o.state===Es&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=hr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function gr(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>ks&&i.state<Es,i.state=hr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function UA(e){return this.each(function(){gr(this,e)})}function HA(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 jA(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 KA(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Pt(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?HA:jA)(o,e,n))}function ws(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 Pt(a,i).value[n]}}function oh(e,n){var o;return(typeof n=="number"?Mn:n instanceof Si?jp:(o=Si(n))?(n=o,jp):CA)(e,n)}function GA(e){return function(){this.removeAttribute(e)}}function YA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qA(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 WA(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 JA(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 XA(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 ZA(e,n){var o=or(e),i=o==="transform"?AA:oh;return this.attrTween(e,typeof n=="function"?(o.local?XA:JA)(o,i,ws(this,"attr."+e,n)):n==null?(o.local?YA:GA)(o):(o.local?WA:qA)(o,i,n))}function QA(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function e$(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function t$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&e$(e,r)),o}return a._value=n,a}function n$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&QA(e,r)),o}return a._value=n,a}function o$(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=or(e);return this.tween(o,(i.local?t$:n$)(i,n))}function i$(e,n){return function(){Ns(this,e).delay=+n.apply(this,arguments)}}function a$(e,n){return n=+n,function(){Ns(this,e).delay=n}}function r$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?i$:a$)(n,e)):Pt(this.node(),n).delay}function l$(e,n){return function(){Qt(this,e).duration=+n.apply(this,arguments)}}function s$(e,n){return n=+n,function(){Qt(this,e).duration=n}}function c$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?l$:s$)(n,e)):Pt(this.node(),n).duration}function d$(e,n){if(typeof n!="function")throw new Error;return function(){Qt(this,e).ease=n}}function u$(e){var n=this._id;return arguments.length?this.each(d$(n,e)):Pt(this.node(),n).ease}function m$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;Qt(this,e).ease=o}}function f$(e){if(typeof e!="function")throw new Error;return this.each(m$(this._id,e))}function p$(e){typeof e!="function"&&(e=Np(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 hn(i,this._parents,this._name,this._id)}function h$(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,f=0;f<u;++f)(h=c[f]||d[f])&&(m[f]=h);for(;s<i;++s)l[s]=n[s];return new hn(l,this._parents,this._name,this._id)}function y$(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=y$(n)?Ns:Qt;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function b$(e,n){var o=this._id;return arguments.length<2?Pt(this.node(),o).on.on(e):this.each(g$(o,e,n))}function _$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function k$(){return this.on("end.remove",_$(this._id))}function E$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=ss(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,yr(d[h],n,o,h,d,Pt(u,o)));return new hn(r,this._parents,n,o)}function N$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Ep(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),f,y=Pt(u,o),g=0,_=h.length;g<_;++g)(f=h[g])&&yr(f,n,o,g,h,y);r.push(h),l.push(u)}return new hn(r,l,n,o)}var w$=Ii.prototype.constructor;function I$(){return new w$(this._groups,this._parents)}function v$(e,n){var o,i,a;return function(){var r=Oo(this,e),l=(this.style.removeProperty(e),Oo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function ih(e){return function(){this.style.removeProperty(e)}}function C$(e,n,o){var i,a=o+"",r;return function(){var l=Oo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function x$(e,n,o){var i,a,r;return function(){var l=Oo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Oo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function S$(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=ih(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function R$(e,n,o){var i=(e+="")=="transform"?RA:oh;return n==null?this.styleTween(e,v$(e,i)).on("end.style."+e,ih(e)):typeof n=="function"?this.styleTween(e,x$(e,i,ws(this,"style."+e,n))).each(S$(this._id,e)):this.styleTween(e,C$(e,i,n),o).on("end.style."+e,null)}function A$(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function $$(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&A$(e,l,o)),i}return r._value=n,r}function T$(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,$$(e,n,o??""))}function M$(e){return function(){this.textContent=e}}function V$(e){return function(){var n=e(this);this.textContent=n??""}}function B$(e){return this.tween("text",typeof e=="function"?V$(ws(this,"text",e)):M$(e==null?"":e+""))}function D$(e){return function(n){this.textContent=e.call(this,n)}}function O$(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&D$(a)),n}return i._value=e,i}function L$(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,O$(e))}function P$(){for(var e=this._name,n=this._id,o=ah(),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=Pt(c,n);yr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new hn(i,this._parents,e,o)}function z$(){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 F$=0;function hn(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function ah(){return++F$}var yn=Ii.prototype;hn.prototype={constructor:hn,select:E$,selectAll:N$,selectChild:yn.selectChild,selectChildren:yn.selectChildren,filter:p$,merge:h$,selection:I$,transition:P$,call:yn.call,nodes:yn.nodes,node:yn.node,size:yn.size,empty:yn.empty,each:yn.each,on:b$,attr:ZA,attrTween:o$,style:R$,styleTween:T$,text:B$,textTween:L$,remove:k$,tween:KA,delay:r$,duration:c$,ease:u$,easeVarying:f$,end:z$,[Symbol.iterator]:yn[Symbol.iterator]};function U$(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var H$={time:null,delay:0,duration:250,ease:U$};function j$(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 K$(e){var n,o;e instanceof hn?(n=e._id,e=e._name):(n=ah(),(o=H$).time=bs(),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])&&yr(c,e,n,d,l,o||j$(c,n));return new hn(i,this._parents,e,n)}Ii.prototype.interrupt=UA,Ii.prototype.transition=K$;const br=e=>()=>e;function G$(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 gn(e,n,o){this.k=e,this.x=n,this.y=o}gn.prototype={constructor:gn,scale:function(e){return e===1?this:new gn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new gn(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 Is=new gn(1,0,0);gn.prototype;function vs(e){e.stopImmediatePropagation()}function Mi(e){e.preventDefault(),e.stopImmediatePropagation()}function Y$(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function q$(){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 rh(){return this.__zoom||Is}function W$(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function J$(){return navigator.maxTouchPoints||"ontouchstart"in this}function X$(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 Z$(){var e=Y$,n=q$,o=X$,i=W$,a=J$,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=VA,d=rs("start","zoom","end"),u,m,h,f=500,y=150,g=0,_=10;function E(b){b.property("__zoom",rh).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",V).on("dblclick.zoom",S).filter(a).on("touchstart.zoom",x).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(b,w,v,O){var M=b.selection?b.selection():b;M.property("__zoom",rh),b!==M?I(b,w,v,O):M.interrupt().each(function(){A(this,arguments).event(O).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},E.scaleBy=function(b,w,v,O){E.scaleTo(b,function(){var M=this.__zoom.k,z=typeof w=="function"?w.apply(this,arguments):w;return M*z},v,O)},E.scaleTo=function(b,w,v,O){E.transform(b,function(){var M=n.apply(this,arguments),z=this.__zoom,j=v==null?k(M):typeof v=="function"?v.apply(this,arguments):v,ie=z.invert(j),pe=typeof w=="function"?w.apply(this,arguments):w;return o(p(N(z,pe),j,ie),M,l)},v,O)},E.translateBy=function(b,w,v,O){E.transform(b,function(){return o(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof v=="function"?v.apply(this,arguments):v),n.apply(this,arguments),l)},null,O)},E.translateTo=function(b,w,v,O,M){E.transform(b,function(){var z=n.apply(this,arguments),j=this.__zoom,ie=O==null?k(z):typeof O=="function"?O.apply(this,arguments):O;return o(Is.translate(ie[0],ie[1]).scale(j.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof v=="function"?-v.apply(this,arguments):-v),z,l)},O,M)};function N(b,w){return w=Math.max(r[0],Math.min(r[1],w)),w===b.k?b:new gn(w,b.x,b.y)}function p(b,w,v){var O=w[0]-v[0]*b.k,M=w[1]-v[1]*b.k;return O===b.x&&M===b.y?b:new gn(b.k,O,M)}function k(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function I(b,w,v,O){b.on("start.zoom",function(){A(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(O).end()}).tween("zoom",function(){var M=this,z=arguments,j=A(M,z).event(O),ie=n.apply(M,z),pe=v==null?k(ie):typeof v=="function"?v.apply(M,z):v,ye=Math.max(ie[1][0]-ie[0][0],ie[1][1]-ie[0][1]),ge=M.__zoom,me=typeof w=="function"?w.apply(M,z):w,se=c(ge.invert(pe).concat(ye/ge.k),me.invert(pe).concat(ye/me.k));return function(ke){if(ke===1)ke=me;else{var Se=se(ke),ce=ye/Se[2];ke=new gn(ce,pe[0]-Se[0]*ce,pe[1]-Se[1]*ce)}j.zoom(null,ke)}})}function A(b,w,v){return!v&&b.__zooming||new $(b,w)}function $(b,w){this.that=b,this.args=w,this.active=0,this.sourceEvent=null,this.extent=n.apply(b,w),this.taps=0}$.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,w){return this.mouse&&b!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&b!=="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(b){var w=$n(this.that).datum();d.call(b,this.that,new G$(b,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),w)}};function L(b,...w){if(!e.apply(this,arguments))return;var v=A(this,w).event(b),O=this.__zoom,M=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),z=Tn(b);if(v.wheel)(v.mouse[0][0]!==z[0]||v.mouse[0][1]!==z[1])&&(v.mouse[1]=O.invert(v.mouse[0]=z)),clearTimeout(v.wheel);else{if(O.k===M)return;v.mouse=[z,O.invert(z)],gr(this),v.start()}Mi(b),v.wheel=setTimeout(j,y),v.zoom("mouse",o(p(N(O,M),v.mouse[0],v.mouse[1]),v.extent,l));function j(){v.wheel=null,v.end()}}function V(b,...w){if(h||!e.apply(this,arguments))return;var v=b.currentTarget,O=A(this,w,!0).event(b),M=$n(b.view).on("mousemove.zoom",pe,!0).on("mouseup.zoom",ye,!0),z=Tn(b,v),j=b.clientX,ie=b.clientY;lA(b.view),vs(b),O.mouse=[z,this.__zoom.invert(z)],gr(this),O.start();function pe(ge){if(Mi(ge),!O.moved){var me=ge.clientX-j,se=ge.clientY-ie;O.moved=me*me+se*se>g}O.event(ge).zoom("mouse",o(p(O.that.__zoom,O.mouse[0]=Tn(ge,v),O.mouse[1]),O.extent,l))}function ye(ge){M.on("mousemove.zoom mouseup.zoom",null),sA(ge.view,O.moved),Mi(ge),O.event(ge).end()}}function S(b,...w){if(e.apply(this,arguments)){var v=this.__zoom,O=Tn(b.changedTouches?b.changedTouches[0]:b,this),M=v.invert(O),z=v.k*(b.shiftKey?.5:2),j=o(p(N(v,z),O,M),n.apply(this,w),l);Mi(b),s>0?$n(this).transition().duration(s).call(I,j,O,b):$n(this).call(E.transform,j,O,b)}}function x(b,...w){if(e.apply(this,arguments)){var v=b.touches,O=v.length,M=A(this,w,b.changedTouches.length===O).event(b),z,j,ie,pe;for(vs(b),j=0;j<O;++j)ie=v[j],pe=Tn(ie,this),pe=[pe,this.__zoom.invert(pe),ie.identifier],M.touch0?!M.touch1&&M.touch0[2]!==pe[2]&&(M.touch1=pe,M.taps=0):(M.touch0=pe,z=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),z&&(M.taps<2&&(m=pe[0],u=setTimeout(function(){u=null},f)),gr(this),M.start())}}function T(b,...w){if(this.__zooming){var v=A(this,w).event(b),O=b.changedTouches,M=O.length,z,j,ie,pe;for(Mi(b),z=0;z<M;++z)j=O[z],ie=Tn(j,this),v.touch0&&v.touch0[2]===j.identifier?v.touch0[0]=ie:v.touch1&&v.touch1[2]===j.identifier&&(v.touch1[0]=ie);if(j=v.that.__zoom,v.touch1){var ye=v.touch0[0],ge=v.touch0[1],me=v.touch1[0],se=v.touch1[1],ke=(ke=me[0]-ye[0])*ke+(ke=me[1]-ye[1])*ke,Se=(Se=se[0]-ge[0])*Se+(Se=se[1]-ge[1])*Se;j=N(j,Math.sqrt(ke/Se)),ie=[(ye[0]+me[0])/2,(ye[1]+me[1])/2],pe=[(ge[0]+se[0])/2,(ge[1]+se[1])/2]}else if(v.touch0)ie=v.touch0[0],pe=v.touch0[1];else return;v.zoom("touch",o(p(j,ie,pe),v.extent,l))}}function D(b,...w){if(this.__zooming){var v=A(this,w).event(b),O=b.changedTouches,M=O.length,z,j;for(vs(b),h&&clearTimeout(h),h=setTimeout(function(){h=null},f),z=0;z<M;++z)j=O[z],v.touch0&&v.touch0[2]===j.identifier?delete v.touch0:v.touch1&&v.touch1[2]===j.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(j=Tn(j,this),Math.hypot(m[0]-j[0],m[1]-j[1])<_)){var ie=$n(this).on("dblclick.zoom");ie&&ie.apply(this,arguments)}}}return E.wheelDelta=function(b){return arguments.length?(i=typeof b=="function"?b:br(+b),E):i},E.filter=function(b){return arguments.length?(e=typeof b=="function"?b:br(!!b),E):e},E.touchable=function(b){return arguments.length?(a=typeof b=="function"?b:br(!!b),E):a},E.extent=function(b){return arguments.length?(n=typeof b=="function"?b:br([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),E):n},E.scaleExtent=function(b){return arguments.length?(r[0]=+b[0],r[1]=+b[1],E):[r[0],r[1]]},E.translateExtent=function(b){return arguments.length?(l[0][0]=+b[0][0],l[1][0]=+b[1][0],l[0][1]=+b[0][1],l[1][1]=+b[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(b){return arguments.length?(o=b,E):o},E.duration=function(b){return arguments.length?(s=+b,E):s},E.interpolate=function(b){return arguments.length?(c=b,E):c},E.on=function(){var b=d.on.apply(d,arguments);return b===d?E:b},E.clickDistance=function(b){return arguments.length?(g=(b=+b)*b,E):Math.sqrt(g)},E.tapDistance=function(b){return arguments.length?(_=+b,E):_},E}const lh=Symbol("MiniMapSlots"),Q$=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],eT={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},tT=t.defineComponent({...eT,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(lh),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,Q$))],64)):t.createCommentVNode("",!0)}}),nT=["width","height","viewBox","aria-labelledby"],oT=["id"],iT=["d","fill","stroke","stroke-width"],aT={name:"MiniMap",compatConfig:{MODE:3}},rT=t.defineComponent({...aT,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:f,getNodesInitialized:y}=je(),g=t.ref();t.provide(lh,o);const _=t.toRef(()=>{var M;return e.width??((M=i.style)==null?void 0:M.width)??a}),E=t.toRef(()=>{var M;return e.height??((M=i.style)==null?void 0:M.height)??r}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",p=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),k=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(()=>Pl(y.value.filter(M=>!M.hidden))),$=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})),L=t.computed(()=>y.value&&y.value.length?C0(A.value,$.value):$.value),V=t.computed(()=>{const M=L.value.width/_.value,z=L.value.height/E.value;return Math.max(M,z)}),S=t.computed(()=>{const M=V.value*_.value,z=V.value*E.value,j=e.offsetScale*V.value;return{offset:j,x:L.value.x-(M-L.value.width)/2-j,y:L.value.y-(z-L.value.height)/2-j,width:M+j*2,height:z+j*2}}),x=t.computed(()=>!S.value.x||!S.value.y?"":`
|
|
53
|
-
M${
|
|
54
|
-
h${
|
|
55
|
-
v${
|
|
56
|
-
h${-
|
|
57
|
-
M${
|
|
58
|
-
h${
|
|
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 kt extends Error{constructor(n,...o){var i;super((i=ef[n])==null?void 0:i.call(ef,...o)),this.name="VueFlowError",this.code=n,this.args=o}}function rs(e){return"clientX"in e}function U0(e){return"sourceEvent"in e}function cn(e,n){const o=rs(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 $i=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function H0(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 Xa(e,n=[1,1]){return{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}}const j0=()=>!0;function ls(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function K0(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())Ya(a,Ga(r))>0&&i.push(r);return i}const G0=250;function Y0(e,n,o,i){var a,r;let l=[],s=Number.POSITIVE_INFINITY;const c=K0(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:p,y:f}=Ho(d,m,m.position,!0),y=Math.sqrt((p-e.x)**2+(f-e.y)**2);y>n||(y<s?(l=[{...m,x:p,y:f}],s=y):y===s&&l.push({...m,x:p,y:f}))}}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 tf(e,{handle:n,connectionMode:o,fromNodeId:i,fromHandleId:a,fromType:r,doc:l,lib:s,flowId:c,isValidConnection:d=j0},u,m,p,f){const y=r==="target",_=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:g,y:b}=cn(e),E=l.elementFromPoint(g,b),h=E!=null&&E.classList.contains(`${s}-flow__handle`)?E:_,N={handleDomNode:h,isValid:!1,connection:null,toHandle:null};if(h){const w=nf(void 0,h),C=h.getAttribute("data-nodeid"),S=h.getAttribute("data-handleid"),V=h.classList.contains("connectable"),$=h.classList.contains("connectableend");if(!C||!w)return N;const R={source:y?C:i,sourceHandle:y?S:a,target:y?i:C,targetHandle:y?a:S};N.connection=R;const T=V&&$&&(o===En.Strict?y&&w==="source"||!y&&w==="target":C!==i||S!==a);N.isValid=T&&d(R,{nodes:m,edges:u,sourceNode:p(R.source),targetNode:p(R.target)}),N.toHandle=of(C,w,S,f,o,!0)}return N}function nf(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function q0(e,n){let o=null;return n?o="valid":e&&!n&&(o="invalid"),o}function W0(e,n){let o=null;return n?o=!0:e&&!n&&(o=!1),o}function of(e,n,o,i,a,r=!1){var l,s,c;const d=i.get(e);if(!d)return null;const u=a===En.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(p=>p.id===o):u==null?void 0:u[0])??null;return m&&r?{...m,...Ho(d,m,m.position,!0)}:m}const ss={[De.Left]:De.Right,[De.Right]:De.Left,[De.Top]:De.Bottom,[De.Bottom]:De.Top},J0=["production","prod"];function Ti(e,...n){af()&&console.warn(`[Vue Flow]: ${e}`,...n)}function af(){return!J0.includes(process.env.NODE_ENV||"")}function rf(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,...qa(l)}}):null}function cs(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 gt(e){return typeof t.unref(e)<"u"}function X0(e,n,o,i){if(!e||!e.source||!e.target)return o(new kt(yt.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let a;return Dn(e)?a=e:a={...e,id:Lm(e)},a=Dm(a,void 0,i),$0(a,n)?!1:a}function Z0(e,n,o,i,a){if(!n.source||!n.target)return a(new kt(yt.EDGE_INVALID,e.id)),!1;if(!o)return a(new kt(yt.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:i?Lm(n):r,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle}}function lf(e,n,o){const i={},a=[];for(let r=0;r<e.length;++r){const l=e[r];if(!ro(l)){o(new kt(yt.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=x0(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 kt(yt.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 sf(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 ds(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}`;sf("source",c,u,e,a,l),sf("target",c,d,e,r,s)}}function cf(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function us(e,n,o,i,a,r,l,s){const c=[];for(const d of e){const u=Dn(d)?d:X0(d,s,a,r);if(!u)continue;const m=o(u.source),p=o(u.target);if(!m||!p){a(new kt(yt.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!m){a(new kt(yt.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!p){a(new kt(yt.EDGE_TARGET_MISSING,u.id,u.target));continue}if(n&&!n(u,{edges:s,nodes:l,sourceNode:m,targetNode:p})){a(new kt(yt.EDGE_INVALID,u.id));continue}const f=i(u.id);c.push({...Dm(u,f,r),sourceNode:m,targetNode:p})}return c}const df=Symbol("vueFlow"),uf=Symbol("nodeId"),mf=Symbol("nodeRef"),Q0=Symbol("edgeId"),eN=Symbol("edgeRef"),Za=Symbol("slots");function ff(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:p,findNode:f,multiSelectionActive:y,nodesSelectionActive:_,selectNodesOnDrag:g,removeSelectedElements:b,addSelectedNodes:E,updateNodePositions:h,emits:N}=et(),{onStart:w,onDrag:C,onStop:S,onClick:V,el:$,disabled:R,id:x,selectable:T,dragHandle:M}=e,k=t.shallowRef(!1);let v=[],I,O=null,A={x:void 0,y:void 0},L={x:0,y:0},H=null,oe=!1,ue=!1,be=0,pe=!1;const he=oN(),_e=({x:ae,y:me})=>{A={x:ae,y:me};let P=!1;if(v=v.map(D=>{const z={x:ae-D.distance.x,y:me-D.distance.y},{computedPosition:Q}=as(D,o.value?Xa(z,i.value):z,N.error,l.value,D.parentNode?f(D.parentNode):void 0);return P=P||D.position.x!==Q.x||D.position.y!==Q.y,D.position=Q,D}),ue=ue||P,!!P&&(h(v,!0,!0),k.value=!0,H)){const[D,z]=is({id:x,dragItems:v,findNode:f});C({event:H,node:D,nodes:z})}},ye=()=>{if(!O)return;const[ae,me]=Km(L,O,u.value);if(ae!==0||me!==0){const P={x:(A.x??0)-ae/c.value.zoom,y:(A.y??0)-me/c.value.zoom};p({x:ae,y:me})&&_e(P)}be=requestAnimationFrame(ye)},Ae=(ae,me)=>{oe=!0;const P=f(x);!g.value&&!y.value&&P&&(P.selected||b()),P&&t.toValue(T)&&g.value&&cs(P,y.value,E,b,_,!1,me);const D=he(ae.sourceEvent);if(A=D,v=D0(r.value,m.value,D,x),v.length){const[z,Q]=is({id:x,dragItems:v,findNode:f});w({event:ae.sourceEvent,node:z,nodes:Q})}},Fe=(ae,me)=>{var P;ae.sourceEvent.type==="touchmove"&&ae.sourceEvent.touches.length>1||(ue=!1,s.value===0&&Ae(ae,me),A=he(ae.sourceEvent),O=((P=n.value)==null?void 0:P.getBoundingClientRect())||null,L=cn(ae.sourceEvent,O))},se=(ae,me)=>{const P=he(ae.sourceEvent);if(!pe&&oe&&d.value&&(pe=!0,ye()),!oe){const D=P.xSnapped-(A.x??0),z=P.ySnapped-(A.y??0);Math.sqrt(D*D+z*z)>s.value&&Ae(ae,me)}(A.x!==P.xSnapped||A.y!==P.ySnapped)&&v.length&&oe&&(H=ae.sourceEvent,L=cn(ae.sourceEvent,O),_e(P))},ne=ae=>{let me=!1;if(!oe&&!k.value&&!y.value){const P=ae.sourceEvent,D=he(P),z=D.xSnapped-(A.x??0),Q=D.ySnapped-(A.y??0),ee=Math.sqrt(z*z+Q*Q);ee!==0&&ee<=s.value&&(V==null||V(P),me=!0)}if(v.length&&!me){ue&&(h(v,!1,!1),ue=!1);const[P,D]=is({id:x,dragItems:v,findNode:f});S({event:ae.sourceEvent,node:P,nodes:D})}v=[],k.value=!1,pe=!1,oe=!1,A={x:void 0,y:void 0},cancelAnimationFrame(be)};return t.watch([()=>t.toValue(R),$],([ae,me],P,D)=>{if(me){const z=jt(me);ae||(I=SE().on("start",Q=>Fe(Q,me)).on("drag",Q=>se(Q,me)).on("end",Q=>ne(Q)).filter(Q=>{const ee=Q.target,we=t.toValue(M);return!Q.button&&(!a.value||!Xm(ee,`.${a.value}`,me)&&(!we||Xm(ee,we,me)))}),z.call(I)),D(()=>{z.on(".drag",null),I&&(I.on("start",null),I.on("drag",null),I.on("end",null))})}}),k}function tN(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),updateStart:Me(),update:Me(),updateEnd:Me()}}function nN(e,n){const o=tN();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 oN(){const{viewport:e,snapGrid:n,snapToGrid:o,vueFlowRef:i}=et();return a=>{var r;const l=((r=i.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},s=U0(a)?a.sourceEvent:a,{x:c,y:d}=cn(s,l),u=Ri({x:c,y:d},e.value),{x:m,y:p}=o.value?Xa(u,n.value):u;return{xSnapped:m,ySnapped:p,...u}}}function Qa(){return!0}function pf({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:p,nodesConnectable:f,autoPanOnConnect:y,autoPanSpeed:_,findNode:g,panBy:b,startConnection:E,updateConnection:h,endConnection:N,emits:w,viewport:C,edges:S,nodes:V,isValidConnection:$,nodeLookup:R}=et();let x=null,T=!1,M=null;function k(I){var O;const A=t.toValue(o)==="target",L=rs(I),H=Bm(I.target),oe=I.currentTarget;if(oe&&(L&&I.button===0||!L)){let ue=function(Ce){P=cn(Ce,ne),_e=Y0(Ri(P,C.value,!1,[1,1]),u.value,R.value,Q),D||(z(),D=!0);const Y=tf(Ce,{handle:_e,connectionMode:d.value,fromNodeId:t.toValue(n),fromHandleId:t.toValue(e),fromType:A?"target":"source",isValidConnection:he,doc:H,lib:"vue",flowId:s,nodeLookup:R.value},S.value,V.value,g,R.value);M=Y.handleDomNode,x=Y.connection,T=W0(!!_e,Y.isValid);const X={...xe,isValid:T,to:Y.toHandle&&T?xi({x:Y.toHandle.x,y:Y.toHandle.y},C.value):P,toHandle:Y.toHandle,toPosition:T&&Y.toHandle?Y.toHandle.position:ss[Q.position],toNode:Y.toHandle?R.value.get(Y.toHandle.nodeId):null};if(T&&_e&&(xe!=null&&xe.toHandle)&&X.toHandle&&xe.toHandle.type===X.toHandle.type&&xe.toHandle.nodeId===X.toHandle.nodeId&&xe.toHandle.id===X.toHandle.id&&xe.to.x===X.to.x&&xe.to.y===X.to.y)return;const q=_e??Y.toHandle;if(h(q&&T?xi({x:q.x,y:q.y},C.value):P,q,q0(!!q,T)),xe=X,!_e&&!T&&!M)return ls(me);x&&x.source!==x.target&&M&&(ls(me),me=M,M.classList.add("connecting","vue-flow__handle-connecting"),M.classList.toggle("valid",!!T),M.classList.toggle("vue-flow__handle-valid",!!T))},be=function(Ce){"touches"in Ce&&Ce.touches.length>0||((_e||M)&&x&&T&&(r?r(Ce,x):w.connect(x)),w.connectEnd(Ce),a&&(l==null||l(Ce)),ls(me),cancelAnimationFrame(ye),N(Ce),D=!1,T=!1,x=null,M=null,H.removeEventListener("mousemove",ue),H.removeEventListener("mouseup",be),H.removeEventListener("touchmove",ue),H.removeEventListener("touchend",be))};const pe=g(t.toValue(n));let he=t.toValue(i)||$.value||Qa;!he&&pe&&(he=(A?pe.isValidSourcePos:pe.isValidTargetPos)||Qa);let _e,ye=0;const{x:Ae,y:Fe}=cn(I),se=nf(t.toValue(a),oe),ne=(O=c.value)==null?void 0:O.getBoundingClientRect();if(!ne||!se)return;const ae=of(t.toValue(n),se,t.toValue(e),R.value,d.value);if(!ae)return;let me,P=cn(I,ne),D=!1;const z=()=>{if(!y.value)return;const[Ce,Y]=Km(P,ne,_.value);b({x:Ce,y:Y}),ye=requestAnimationFrame(z)},Q={...ae,nodeId:t.toValue(n),type:se,position:ae.position},ee=R.value.get(t.toValue(n)),de={inProgress:!0,isValid:null,from:Ho(ee,Q,De.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:ee,to:P,toHandle:null,toPosition:ss[Q.position],toNode:null};E({nodeId:t.toValue(n),id:t.toValue(e),type:se,position:(oe==null?void 0:oe.getAttribute("data-handlepos"))||De.Top,...P},{x:Ae-ne.left,y:Fe-ne.top}),w.connectStart({event:I,nodeId:t.toValue(n),handleId:t.toValue(e),handleType:se});let xe=de;H.addEventListener("mousemove",ue),H.addEventListener("mouseup",be),H.addEventListener("touchmove",ue),H.addEventListener("touchend",be)}}function v(I){var O,A;if(!m.value)return;const L=t.toValue(o)==="target";if(!p.value){w.clickConnectStart({event:I,nodeId:t.toValue(n),handleId:t.toValue(e)}),E({nodeId:t.toValue(n),type:t.toValue(o),id:t.toValue(e),position:De.Top,...cn(I)},void 0,!0);return}let H=t.toValue(i)||$.value||Qa;const oe=g(t.toValue(n));if(!H&&oe&&(H=(L?oe.isValidSourcePos:oe.isValidTargetPos)||Qa),oe&&(typeof oe.connectable>"u"?f.value:oe.connectable)===!1)return;const ue=Bm(I.target),be=tf(I,{handle:{nodeId:t.toValue(n),id:t.toValue(e),type:t.toValue(o),position:De.Top,...cn(I)},connectionMode:d.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:H,doc:ue,lib:"vue",flowId:s,nodeLookup:R.value},S.value,V.value,g,R.value),pe=((O=be.connection)==null?void 0:O.source)===((A=be.connection)==null?void 0:A.target);be.isValid&&be.connection&&!pe&&w.connect(be.connection),w.clickConnectEnd(I),N(I,!0)}return{handlePointerDown:k,handleClick:v}}function iN(){return t.inject(uf,"")}function hf(e){const n=e??iN()??"",o=t.inject(mf,t.ref(null)),{findNode:i,edges:a,emits:r}=et(),l=i(n);return l||r.error(new kt(yt.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:t.computed(()=>i(l.parentNode)),connectedEdges:t.computed(()=>lo([l],a.value))}}function aN(){return{doubleClick:Me(),click:Me(),mouseEnter:Me(),mouseMove:Me(),mouseLeave:Me(),contextMenu:Me(),dragStart:Me(),drag:Me(),dragStop:Me()}}function rN(e,n){const o=aN();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 yf(){const{getSelectedNodes:e,nodeExtent:n,updateNodePositions:o,findNode:i,snapGrid:a,snapToGrid:r,nodesDraggable:l,emits:s}=et();return(c,d=!1)=>{const u=r.value?a.value[0]:5,m=r.value?a.value[1]:5,p=d?4:1,f=c.x*u*p,y=c.y*m*p,_=[];for(const g of e.value)if(g.draggable||l&&typeof g.draggable>"u"){const b={x:g.computedPosition.x+f,y:g.computedPosition.y+y},{position:E}=as(g,b,s.error,n.value,g.parentNode?i(g.parentNode):void 0);_.push({id:g.id,position:E,from:g.position,distance:{x:c.x,y:c.y},dimensions:g.dimensions})}o(_,!0,!1)}}const er=.1,lN=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Pn(){return Ti("Viewport not initialized yet."),Promise.resolve(!1)}const sN={zoomIn:Pn,zoomOut:Pn,zoomTo:Pn,fitView:Pn,setCenter:Pn,fitBounds:Pn,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Pn,setTransform:Pn,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function cN(e){function n(i,a){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((a==null?void 0:a.interpolate)==="linear"?_i:Da).scaleBy(ms(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}=Vm({x:-i,y:-a},e.translateExtent),m=zo.translate(-d,-u).scale(r);e.d3Selection&&e.d3Zoom?(c=e.d3Zoom)==null||c.interpolate((l==null?void 0:l.interpolate)==="linear"?_i:Da).transform(ms(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"?_i:Da).scaleTo(ms(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:er,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((a==null?void 0:a.includeHiddenNodes)||!p.hidden)&&(!((r=a.nodes)!=null&&r.length)||(l=a.nodes)!=null&&l.length&&a.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const c=ts(s),{x:d,y:u,zoom:m}=Um(c,e.dimensions.width,e.dimensions.height,a.minZoom??e.minZoom,a.maxZoom??e.maxZoom,a.padding??er);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:er})=>{const{x:l,y:s,zoom:c}=Um(a,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??er);return o(l,s,c,r)},project:a=>Ri(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 Ri(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 xi(s,e.viewport)}return{x:0,y:0}}}:sN)}function ms(e,n=0,o=lN,i=()=>{}){const a=typeof n=="number"&&n>0;return a||i(),a?e.transition().duration(n).ease(o).on("end",i):e}function dN(e,n,o){const i=t.effectScope(!0);return i.run(()=>{const a=()=>{i.run(()=>{let _,g,b=!!(o.nodes.value.length||o.edges.value.length);_=Bo([e.modelValue,()=>{var E,h;return(h=(E=e.modelValue)==null?void 0:E.value)==null?void 0:h.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setElements(E),!g&&!b&&E.length?b=!0:g==null||g.resume())}),g=Bo([o.nodes,o.edges,()=>o.edges.value.length,()=>o.nodes.value.length],([E,h])=>{var N;(N=e.modelValue)!=null&&N.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...E,...h],t.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},r=()=>{i.run(()=>{let _,g,b=!!o.nodes.value.length;_=Bo([e.nodes,()=>{var E,h;return(h=(E=e.nodes)==null?void 0:E.value)==null?void 0:h.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setNodes(E),!g&&!b&&E.length?b=!0:g==null||g.resume())}),g=Bo([o.nodes,()=>o.nodes.value.length],([E])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...E],t.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},l=()=>{i.run(()=>{let _,g,b=!!o.edges.value.length;_=Bo([e.edges,()=>{var E,h;return(h=(E=e.edges)==null?void 0:E.value)==null?void 0:h.length}],([E])=>{E&&Array.isArray(E)&&(g==null||g.pause(),o.setEdges(E),!g&&!b&&E.length?b=!0:g==null||g.resume())}),g=Bo([o.edges,()=>o.edges.value.length],([E])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...E],t.nextTick(()=>{_==null||_.resume()}))},{immediate:b}),t.onScopeDispose(()=>{_==null||_.stop(),g==null||g.stop()})})},s=()=>{i.run(()=>{t.watch(()=>n.maxZoom,()=>{n.maxZoom&>(n.maxZoom)&&o.setMaxZoom(n.maxZoom)},{immediate:!0})})},c=()=>{i.run(()=>{t.watch(()=>n.minZoom,()=>{n.minZoom&>(n.minZoom)&&o.setMinZoom(n.minZoom)},{immediate:!0})})},d=()=>{i.run(()=>{t.watch(()=>n.translateExtent,()=>{n.translateExtent&>(n.translateExtent)&&o.setTranslateExtent(n.translateExtent)},{immediate:!0})})},u=()=>{i.run(()=>{t.watch(()=>n.nodeExtent,()=>{n.nodeExtent&>(n.nodeExtent)&&o.setNodeExtent(n.nodeExtent)},{immediate:!0})})},m=()=>{i.run(()=>{t.watch(()=>n.applyDefault,()=>{gt(n.applyDefault)&&(o.applyDefault.value=n.applyDefault)},{immediate:!0})})},p=()=>{i.run(()=>{const _=async g=>{let b=g;typeof n.autoConnect=="function"&&(b=await n.autoConnect(g)),b!==!1&&o.addEdges([b])};t.watch(()=>n.autoConnect,()=>{gt(n.autoConnect)&&(o.autoConnect.value=n.autoConnect)},{immediate:!0}),t.watch(o.autoConnect,(g,b,E)=>{g?o.onConnect(_):o.hooks.value.connect.off(_),E(()=>{o.hooks.value.connect.off(_)})},{immediate:!0})})},f=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const g of Object.keys(n)){const b=g;if(!_.includes(b)){const E=t.toRef(()=>n[b]),h=o[b];t.isRef(h)&&i.run(()=>{t.watch(E,N=>{gt(N)&&(h.value=N)},{immediate:!0})})}}};(()=>{a(),r(),l(),c(),s(),d(),u(),m(),p(),f()})()}),()=>i.stop()}function uN(){return{edgesChange:Me(),nodesChange:Me(),nodeDoubleClick:Me(),nodeClick:Me(),nodeMouseEnter:Me(),nodeMouseMove:Me(),nodeMouseLeave:Me(),nodeContextMenu:Me(),nodeDragStart:Me(),nodeDrag:Me(),nodeDragStop:Me(),nodesInitialized:Me(),miniMapNodeClick:Me(),miniMapNodeDoubleClick:Me(),miniMapNodeMouseEnter:Me(),miniMapNodeMouseMove:Me(),miniMapNodeMouseLeave:Me(),connect:Me(),connectStart:Me(),connectEnd:Me(),clickConnectStart:Me(),clickConnectEnd:Me(),paneReady:Me(),init:Me(),move:Me(),moveStart:Me(),moveEnd:Me(),selectionDragStart:Me(),selectionDrag:Me(),selectionDragStop:Me(),selectionContextMenu:Me(),selectionStart:Me(),selectionEnd:Me(),viewportChangeStart:Me(),viewportChange:Me(),viewportChangeEnd:Me(),paneScroll:Me(),paneClick:Me(),paneContextMenu:Me(),paneMouseEnter:Me(),paneMouseMove:Me(),paneMouseLeave:Me(),edgeContextMenu:Me(),edgeMouseEnter:Me(),edgeMouseMove:Me(),edgeMouseLeave:Me(),edgeDoubleClick:Me(),edgeClick:Me(),edgeUpdateStart:Me(),edgeUpdate:Me(),edgeUpdateEnd:Me(),updateNodeInternals:Me(),error:Me(e=>Ti(e.message))}}function mN(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),fi(r.removeEmitter),r.setHasEmitListeners(()=>i(a)),fi(r.removeHasEmitListeners)}});function i(a){var r;const l=fN(a);return!!((r=o==null?void 0:o.vnode.props)==null?void 0:r[l])}}function fN(e){const[n,...o]=e.split(":");return`on${n.replace(/(?:^|-)(\w)/g,(a,r)=>r.toUpperCase())}${o.length?`:${o.join(":")}`:""}`}function gf(){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:Zl.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:vi.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:io.Bezier,style:{}},connectionMode:En.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:$i()?"Meta":"Control",zoomActivationKeyCode:$i()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:uN(),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 pN=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function hN(e,n,o){const i=cN(e),a=P=>{const D=P??[];e.hooks.updateNodeInternals.trigger(D)},r=P=>A0(P,e.nodes,e.edges),l=P=>R0(P,e.nodes,e.edges),s=P=>lo(P,e.edges),c=({id:P,type:D,nodeId:z})=>{var Q;const ee=P?`-${D}-${P}`:`-${D}`;return Array.from(((Q=e.connectionLookup.get(`${z}${ee}`))==null?void 0:Q.values())??[])},d=P=>{if(P)return n.value.get(P)},u=P=>{if(P)return o.value.get(P)},m=(P,D,z)=>{var Q,ee;const we=[];for(const de of P){const xe={id:de.id,type:"position",dragging:z,from:de.from};if(D&&(xe.position=de.position,de.parentNode)){const Ce=d(de.parentNode);xe.position={x:xe.position.x-(((Q=Ce==null?void 0:Ce.computedPosition)==null?void 0:Q.x)??0),y:xe.position.y-(((ee=Ce==null?void 0:Ce.computedPosition)==null?void 0:ee.y)??0)}}we.push(xe)}we!=null&&we.length&&e.hooks.nodesChange.trigger(we)},p=P=>{if(!e.vueFlowRef)return;const D=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!D)return;const z=window.getComputedStyle(D),{m22:Q}=new window.DOMMatrixReadOnly(z.transform),ee=[];for(const we of P){const de=we,xe=d(de.id);if(xe){const Ce=qa(de.nodeElement);if(!!(Ce.width&&Ce.height&&(xe.dimensions.width!==Ce.width||xe.dimensions.height!==Ce.height||de.forceUpdate))){const X=de.nodeElement.getBoundingClientRect();xe.dimensions=Ce,xe.handleBounds.source=rf("source",de.nodeElement,X,Q,xe.id),xe.handleBounds.target=rf("target",de.nodeElement,X,Q,xe.id),ee.push({id:xe.id,type:"dimensions",dimensions:Ce})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&i.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),ee.length&&e.hooks.nodesChange.trigger(ee)},f=(P,D)=>{const z=new Set,Q=new Set;for(const de of P)ro(de)?z.add(de.id):Dn(de)&&Q.add(de.id);const ee=Ln(n.value,z,!0),we=Ln(o.value,Q);if(e.multiSelectionActive){for(const de of z)ee.push(On(de,D));for(const de of Q)we.push(On(de,D))}ee.length&&e.hooks.nodesChange.trigger(ee),we.length&&e.hooks.edgesChange.trigger(we)},y=P=>{if(e.multiSelectionActive){const D=P.map(z=>On(z.id,!0));e.hooks.nodesChange.trigger(D);return}e.hooks.nodesChange.trigger(Ln(n.value,new Set(P.map(D=>D.id)),!0)),e.hooks.edgesChange.trigger(Ln(o.value))},_=P=>{if(e.multiSelectionActive){const D=P.map(z=>On(z.id,!0));e.hooks.edgesChange.trigger(D);return}e.hooks.edgesChange.trigger(Ln(o.value,new Set(P.map(D=>D.id)))),e.hooks.nodesChange.trigger(Ln(n.value,new Set,!0))},g=P=>{f(P,!0)},b=P=>{const z=(P||e.nodes).map(Q=>(Q.selected=!1,On(Q.id,!1)));e.hooks.nodesChange.trigger(z)},E=P=>{const z=(P||e.edges).map(Q=>(Q.selected=!1,On(Q.id,!1)));e.hooks.edgesChange.trigger(z)},h=P=>{if(!P||!P.length)return f([],!1);const D=P.reduce((z,Q)=>{const ee=On(Q.id,!1);return ro(Q)?z.nodes.push(ee):z.edges.push(ee),z},{nodes:[],edges:[]});D.nodes.length&&e.hooks.nodesChange.trigger(D.nodes),D.edges.length&&e.hooks.edgesChange.trigger(D.edges)},N=P=>{var D;(D=e.d3Zoom)==null||D.scaleExtent([P,e.maxZoom]),e.minZoom=P},w=P=>{var D;(D=e.d3Zoom)==null||D.scaleExtent([e.minZoom,P]),e.maxZoom=P},C=P=>{var D;(D=e.d3Zoom)==null||D.translateExtent(P),e.translateExtent=P},S=P=>{e.nodeExtent=P,a()},V=P=>{var D;(D=e.d3Zoom)==null||D.clickDistance(P)},$=P=>{e.nodesDraggable=P,e.nodesConnectable=P,e.elementsSelectable=P},R=P=>{const D=P instanceof Function?P(e.nodes):P;!e.initialized&&!D.length||(e.nodes=lf(D,d,e.hooks.error.trigger))},x=P=>{const D=P instanceof Function?P(e.edges):P;if(!e.initialized&&!D.length)return;const z=us(D,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ds(e.connectionLookup,o.value,z),e.edges=z},T=P=>{const D=P instanceof Function?P([...e.nodes,...e.edges]):P;!e.initialized&&!D.length||(R(D.filter(ro)),x(D.filter(Dn)))},M=P=>{let D=P instanceof Function?P(e.nodes):P;D=Array.isArray(D)?D:[D];const z=lf(D,d,e.hooks.error.trigger),Q=[];for(const ee of z)Q.push(Ym(ee));Q.length&&e.hooks.nodesChange.trigger(Q)},k=P=>{let D=P instanceof Function?P(e.edges):P;D=Array.isArray(D)?D:[D];const z=us(D,e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),Q=[];for(const ee of z)Q.push(Ym(ee));Q.length&&e.hooks.edgesChange.trigger(Q)},v=(P,D=!0,z=!1)=>{const Q=P instanceof Function?P(e.nodes):P,ee=Array.isArray(Q)?Q:[Q],we=[],de=[];function xe(Y){const X=s(Y);for(const q of X)(!gt(q.deletable)||q.deletable)&&de.push(Wm(q.id,q.source,q.target,q.sourceHandle,q.targetHandle))}function Ce(Y){const X=[];for(const q of e.nodes)q.parentNode===Y&&X.push(q);if(X.length){for(const q of X)we.push(qm(q.id));D&&xe(X);for(const q of X)Ce(q.id)}}for(const Y of ee){const X=typeof Y=="string"?d(Y):Y;X&&(gt(X.deletable)&&!X.deletable||(we.push(qm(X.id)),D&&xe([X]),z&&Ce(X.id)))}de.length&&e.hooks.edgesChange.trigger(de),we.length&&e.hooks.nodesChange.trigger(we)},I=P=>{const D=P instanceof Function?P(e.edges):P,z=Array.isArray(D)?D:[D],Q=[];for(const ee of z){const we=typeof ee=="string"?u(ee):ee;we&&(gt(we.deletable)&&!we.deletable||Q.push(Wm(typeof ee=="string"?ee:ee.id,we.source,we.target,we.sourceHandle,we.targetHandle)))}e.hooks.edgesChange.trigger(Q)},O=(P,D,z=!0)=>{const Q=u(P.id);if(!Q)return!1;const ee=e.edges.indexOf(Q),we=Z0(P,D,Q,z,e.hooks.error.trigger);if(we){const[de]=us([we],e.isValidConnection,d,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((xe,Ce)=>Ce===ee?de:xe),ds(e.connectionLookup,o.value,[de]),de}return!1},A=(P,D,z={replace:!1})=>{const Q=u(P);if(!Q)return;const ee=typeof D=="function"?D(Q):D;Q.data=z.replace?ee:{...Q.data,...ee}},L=P=>Gm(P,e.nodes),H=P=>{const D=Gm(P,e.edges);return ds(e.connectionLookup,o.value,D),D},oe=(P,D,z={replace:!1})=>{const Q=d(P);if(!Q)return;const ee=typeof D=="function"?D(Q):D;z.replace?e.nodes.splice(e.nodes.indexOf(Q),1,ee):Object.assign(Q,ee)},ue=(P,D,z={replace:!1})=>{const Q=d(P);if(!Q)return;const ee=typeof D=="function"?D(Q):D;Q.data=z.replace?ee:{...Q.data,...ee}},be=(P,D,z=!1)=>{z?e.connectionClickStartHandle=P:e.connectionStartHandle=P,e.connectionEndHandle=null,e.connectionStatus=null,D&&(e.connectionPosition=D)},pe=(P,D=null,z=null)=>{e.connectionStartHandle&&(e.connectionPosition=P,e.connectionEndHandle=D,e.connectionStatus=z)},he=(P,D)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,D?e.connectionClickStartHandle=null:e.connectionStartHandle=null},_e=P=>{const D=S0(P),z=D?null:Si(P)?P:d(P.id);return!D&&!z?[null,null,D]:[D?P:Ga(z),z,D]},ye=(P,D=!0,z=e.nodes)=>{const[Q,ee,we]=_e(P);if(!Q)return[];const de=[];for(const xe of z||e.nodes){if(!we&&(xe.id===ee.id||!xe.computedPosition))continue;const Ce=Ga(xe),Y=Ya(Ce,Q);(D&&Y>0||Y>=Ce.width*Ce.height||Y>=Number(Q.width)*Number(Q.height))&&de.push(xe)}return de},Ae=(P,D,z=!0)=>{const[Q]=_e(P);if(!Q)return!1;const ee=Ya(Q,D);return z&&ee>0||ee>=Number(Q.width)*Number(Q.height)},Fe=P=>{const{viewport:D,dimensions:z,d3Zoom:Q,d3Selection:ee,translateExtent:we}=e;if(!Q||!ee||!P.x&&!P.y)return!1;const de=zo.translate(D.x+P.x,D.y+P.y).scale(D.zoom),xe=[[0,0],[z.width,z.height]],Ce=Q.constrain()(de,xe,we),Y=e.viewport.x!==Ce.x||e.viewport.y!==Ce.y||e.viewport.zoom!==Ce.k;return Q.transform(ee,Ce),Y},se=P=>{const D=P instanceof Function?P(e):P,z=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];gt(D.defaultEdgeOptions)&&(e.defaultEdgeOptions=D.defaultEdgeOptions);const Q=D.modelValue||D.nodes||D.edges?[]:void 0;Q&&(D.modelValue&&Q.push(...D.modelValue),D.nodes&&Q.push(...D.nodes),D.edges&&Q.push(...D.edges),T(Q));const ee=()=>{gt(D.maxZoom)&&w(D.maxZoom),gt(D.minZoom)&&N(D.minZoom),gt(D.translateExtent)&&C(D.translateExtent)};for(const we of Object.keys(D)){const de=we,xe=D[de];![...pN,...z].includes(de)&>(xe)&&(e[de]=xe)}$l(()=>e.d3Zoom).not.toBeNull().then(ee),e.initialized||(e.initialized=!0)};return{updateNodePositions:m,updateNodeDimensions:p,setElements:T,setNodes:R,setEdges:x,addNodes:M,addEdges:k,removeNodes:v,removeEdges:I,findNode:d,findEdge:u,updateEdge:O,updateEdgeData:A,updateNode:oe,updateNodeData:ue,applyEdgeChanges:H,applyNodeChanges:L,addSelectedElements:g,addSelectedNodes:y,addSelectedEdges:_,setMinZoom:N,setMaxZoom:w,setTranslateExtent:C,setNodeExtent:S,setPaneClickDistance:V,removeSelectedElements:h,removeSelectedNodes:b,removeSelectedEdges:E,startConnection:be,updateConnection:pe,endConnection:he,setInteractive:$,setState:se,getIntersectingNodes:ye,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:Ae,panBy:Fe,fitView:P=>i.value.fitView(P),zoomIn:P=>i.value.zoomIn(P),zoomOut:P=>i.value.zoomOut(P),zoomTo:(P,D)=>i.value.zoomTo(P,D),setViewport:(P,D)=>i.value.setViewport(P,D),setTransform:(P,D)=>i.value.setTransform(P,D),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(P,D,z)=>i.value.setCenter(P,D,z),fitBounds:(P,D)=>i.value.fitBounds(P,D),project:P=>i.value.project(P),screenToFlowCoordinate:P=>i.value.screenToFlowCoordinate(P),flowToScreenCoordinate:P=>i.value.flowToScreenCoordinate(P),toObject:()=>{const P=[],D=[];for(const z of e.nodes){const{computedPosition:Q,handleBounds:ee,selected:we,dimensions:de,isParent:xe,resizing:Ce,dragging:Y,events:X,...q}=z;P.push(q)}for(const z of e.edges){const{selected:Q,sourceNode:ee,targetNode:we,events:de,...xe}=z;D.push(xe)}return JSON.parse(JSON.stringify({nodes:P,edges:D,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:P=>new Promise(D=>{const{nodes:z,edges:Q,position:ee,zoom:we,viewport:de}=P;z&&R(z),Q&&x(Q);const[xe,Ce]=de!=null&&de.x&&(de!=null&&de.y)?[de.x,de.y]:ee??[null,null];if(xe&&Ce){const Y=(de==null?void 0:de.zoom)||we||e.viewport.zoom;return $l(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:xe,y:Ce,zoom:Y}).then(()=>{D(!0)})})}else D(!0)}),updateNodeInternals:a,viewportHelper:i,$reset:()=>{const P=gf();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const D=zo.translate(P.defaultViewport.x??0,P.defaultViewport.y??0).scale(ao(P.defaultViewport.zoom??1,P.minZoom,P.maxZoom)),z=e.viewportRef.getBoundingClientRect(),Q=[[0,0],[z.width,z.height]],ee=e.d3Zoom.constrain()(D,Q,P.translateExtent);e.d3Zoom.transform(e.d3Selection,ee)}se(P)},$destroy:()=>{}}}const yN=["data-id","data-handleid","data-nodeid","data-handlepos"],gN={name:"Handle",compatConfig:{MODE:3}},so=t.defineComponent({...gN,props:{id:{default:null},type:{},position:{default:()=>De.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:p}=et(),{id:f,node:y,nodeEl:_,connectedEdges:g}=hf(),b=t.ref(),E=t.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),h=t.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),N=t.toRef(()=>{var x,T,M,k,v,I;return((x=l.value)==null?void 0:x.nodeId)===f&&((T=l.value)==null?void 0:T.id)===e.id&&((M=l.value)==null?void 0:M.type)===i.value||((k=c.value)==null?void 0:k.nodeId)===f&&((v=c.value)==null?void 0:v.id)===e.id&&((I=c.value)==null?void 0:I.type)===i.value}),w=t.toRef(()=>{var x,T,M;return((x=s.value)==null?void 0:x.nodeId)===f&&((T=s.value)==null?void 0:T.id)===e.id&&((M=s.value)==null?void 0:M.type)===i.value}),{handlePointerDown:C,handleClick:S}=pf({nodeId:f,handleId:e.id,isValidConnection:a,type:i}),V=t.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(x=>{const T=x[`${i.value}Handle`];return x[i.value]!==f?!1:T?T===e.id:!0}):typeof e.connectable=="number"?g.value.filter(x=>{const T=x[`${i.value}Handle`];return x[i.value]!==f?!1:T?T===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,g.value):gt(e.connectable)?e.connectable:u.value);t.onMounted(()=>{var x;if(!y.dimensions.width||!y.dimensions.height)return;const T=(x=y.handleBounds[i.value])==null?void 0:x.find(L=>L.id===e.id);if(!d.value||T)return;const M=d.value.querySelector(".vue-flow__transformationpane");if(!_.value||!b.value||!M||!e.id)return;const k=_.value.getBoundingClientRect(),v=b.value.getBoundingClientRect(),I=window.getComputedStyle(M),{m22:O}=new window.DOMMatrixReadOnly(I.transform),A={id:e.id,position:e.position,x:(v.left-k.left)/O,y:(v.top-k.top)/O,type:i.value,nodeId:f,...qa(b.value)};y.handleBounds[i.value]=[...y.handleBounds[i.value]??[],A]});function $(x){const T=rs(x);V.value&&E.value&&(T&&x.button===0||!T)&&C(x)}function R(x){!f||!s.value&&!E.value||V.value&&S(x)}return n({handleClick:S,handlePointerDown:C,onClick:R,onPointerDown:$}),(x,T)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handle",ref:b,"data-id":`${t.unref(r)}-${t.unref(f)}-${e.id}-${i.value}`,"data-handleid":e.id,"data-nodeid":t.unref(f),"data-handlepos":x.position,class:t.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${x.position}`,`vue-flow__handle-${e.id}`,t.unref(m),t.unref(p),i.value,{connectable:V.value,connecting:w.value,connectablestart:E.value,connectableend:h.value,connectionindicator:V.value&&(E.value&&!N.value||h.value&&N.value)}]]),onMousedown:$,onTouchstartPassive:$,onClick:R},[t.renderSlot(x.$slots,"default",{id:x.id})],42,yN))}}),tr=function({sourcePosition:e=De.Bottom,targetPosition:n=De.Top,label:o,connectable:i=!0,isValidTargetPos:a,isValidSourcePos:r,data:l}){const s=l.label??o;return[t.h(so,{type:"target",position:n,connectable:i,isValidConnection:a}),typeof s!="string"&&s?t.h(s):t.h(t.Fragment,[s]),t.h(so,{type:"source",position:e,connectable:i,isValidConnection:r})]};tr.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],tr.inheritAttrs=!1,tr.compatConfig={MODE:3};const bN=tr,nr=function({targetPosition:e=De.Top,label:n,connectable:o=!0,isValidTargetPos:i,data:a}){const r=a.label??n;return[t.h(so,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof r!="string"&&r?t.h(r):t.h(t.Fragment,[r])]};nr.props=["targetPosition","label","isValidTargetPos","connectable","data"],nr.inheritAttrs=!1,nr.compatConfig={MODE:3};const _N=nr,or=function({sourcePosition:e=De.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(so,{type:"source",position:e,connectable:o,isValidConnection:i})]};or.props=["sourcePosition","label","isValidSourcePos","connectable","data"],or.inheritAttrs=!1,or.compatConfig={MODE:3};const kN=or,EN=["transform"],NN=["width","height","x","y","rx","ry"],wN=["y"],IN={name:"EdgeText",compatConfig:{MODE:3}},vN=t.defineComponent({...IN,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,NN)):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,wN)],8,EN))}}),CN=["id","d","marker-end","marker-start"],SN=["d","stroke-width"],xN={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},ir=t.defineComponent({...xN,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,CN),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,SN)):t.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(t.openBlock(),t.createBlock(vN,{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 bf({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 _f({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 ar(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function kf({pos:e,x1:n,y1:o,x2:i,y2:a,c:r}){let l,s;switch(e){case De.Left:l=n-ar(n-i,r),s=o;break;case De.Right:l=n+ar(i-n,r),s=o;break;case De.Top:l=n,s=o-ar(o-a,r);break;case De.Bottom:l=n,s=o+ar(a-o,r);break}return[l,s]}function Ef(e){const{sourceX:n,sourceY:o,sourcePosition:i=De.Bottom,targetX:a,targetY:r,targetPosition:l=De.Top,curvature:s=.25}=e,[c,d]=kf({pos:i,x1:n,y1:o,x2:a,y2:r,c:s}),[u,m]=kf({pos:l,x1:a,y1:r,x2:n,y2:o,c:s}),[p,f,y,_]=_f({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}`,p,f,y,_]}function Nf({pos:e,x1:n,y1:o,x2:i,y2:a}){let r,l;switch(e){case De.Left:case De.Right:r=.5*(n+i),l=o;break;case De.Top:case De.Bottom:r=n,l=.5*(o+a);break}return[r,l]}function wf(e){const{sourceX:n,sourceY:o,sourcePosition:i=De.Bottom,targetX:a,targetY:r,targetPosition:l=De.Top}=e,[s,c]=Nf({pos:i,x1:n,y1:o,x2:a,y2:r}),[d,u]=Nf({pos:l,x1:a,y1:r,x2:n,y2:o}),[m,p,f,y]=_f({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,p,f,y]}const If={[De.Left]:{x:-1,y:0},[De.Right]:{x:1,y:0},[De.Top]:{x:0,y:-1},[De.Bottom]:{x:0,y:1}};function RN({source:e,sourcePosition:n=De.Bottom,target:o}){return n===De.Left||n===De.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 vf(e,n){return Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)}function AN({source:e,sourcePosition:n=De.Bottom,target:o,targetPosition:i=De.Top,center:a,offset:r}){const l=If[n],s=If[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=RN({source:c,sourcePosition:n,target:d}),m=u.x!==0?"x":"y",p=u[m];let f,y,_;const g={x:0,y:0},b={x:0,y:0},[E,h,N,w]=bf({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(l[m]*s[m]===-1){y=a.x??E,_=a.y??h;const S=[{x:y,y:c.y},{x:y,y:d.y}],V=[{x:c.x,y:_},{x:d.x,y:_}];l[m]===p?f=m==="x"?S:V:f=m==="x"?V:S}else{const S=[{x:c.x,y:d.y}],V=[{x:d.x,y:c.y}];if(m==="x"?f=l.x===p?V:S:f=l.y===p?S:V,n===i){const M=Math.abs(e[m]-o[m]);if(M<=r){const k=Math.min(r-1,r-M);l[m]===p?g[m]=(c[m]>e[m]?-1:1)*k:b[m]=(d[m]>o[m]?-1:1)*k}}if(n!==i){const M=m==="x"?"y":"x",k=l[m]===s[M],v=c[M]>d[M],I=c[M]<d[M];(l[m]===1&&(!k&&v||k&&I)||l[m]!==1&&(!k&&I||k&&v))&&(f=m==="x"?S:V)}const $={x:c.x+g.x,y:c.y+g.y},R={x:d.x+b.x,y:d.y+b.y},x=Math.max(Math.abs($.x-f[0].x),Math.abs(R.x-f[0].x)),T=Math.max(Math.abs($.y-f[0].y),Math.abs(R.y-f[0].y));x>=T?(y=($.x+R.x)/2,_=f[0].y):(y=f[0].x,_=($.y+R.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...f,{x:d.x+b.x,y:d.y+b.y},o],y,_,N,w]}function $N(e,n,o,i){const a=Math.min(vf(e,n)/2,vf(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 fs(e){const{sourceX:n,sourceY:o,sourcePosition:i=De.Bottom,targetX:a,targetY:r,targetPosition:l=De.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20}=e,[m,p,f,y,_]=AN({source:{x:n,y:o},sourcePosition:i,target:{x:a,y:r},targetPosition:l,center:{x:c,y:d},offset:u});return[m.reduce((b,E,h)=>{let N;return h>0&&h<m.length-1?N=$N(m[h-1],E,m[h+1],s):N=`${h===0?"M":"L"}${E.x} ${E.y}`,b+=N,b},""),p,f,y,_]}function TN(e){const{sourceX:n,sourceY:o,targetX:i,targetY:a}=e,[r,l,s,c]=bf({sourceX:n,sourceY:o,targetX:i,targetY:a});return[`M ${n},${o}L ${i},${a}`,r,l,s,c]}const MN=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]=TN(e);return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),Cf=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]=fs({...e,sourcePosition:e.sourcePosition??De.Bottom,targetPosition:e.targetPosition??De.Top});return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),VN=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(Cf,{...e,...n,borderRadius:0})}}),BN=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]=Ef({...e,sourcePosition:e.sourcePosition??De.Bottom,targetPosition:e.targetPosition??De.Top});return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),DN=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]=wf({...e,sourcePosition:e.sourcePosition??De.Bottom,targetPosition:e.targetPosition??De.Top});return t.h(ir,{path:o,labelX:i,labelY:a,...n,...e})}}}),ON={input:kN,default:bN,output:_N},LN={default:BN,straight:MN,step:VN,smoothstep:Cf,simplebezier:DN};function PN(e,n,o){const i=t.computed(()=>_=>n.value.get(_)),a=t.computed(()=>_=>o.value.get(_)),r=t.computed(()=>{const _={...LN,...e.edgeTypes},g=Object.keys(_);for(const b of e.edges)b.type&&!g.includes(b.type)&&(_[b.type]=b.type);return _}),l=t.computed(()=>{const _={...ON,...e.nodeTypes},g=Object.keys(_);for(const b of e.nodes)b.type&&!g.includes(b.type)&&(_[b.type]=b.type);return _}),s=t.computed(()=>e.onlyRenderVisibleElements?Fm(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 _=[];for(const g of e.edges){const b=n.value.get(g.source),E=n.value.get(g.target);z0({sourcePos:b.computedPosition||{x:0,y:0},targetPos:E.computedPosition||{x:0,y:0},sourceWidth:b.dimensions.width,sourceHeight:b.dimensions.height,targetWidth:E.dimensions.width,targetHeight:E.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(g)}return _}return e.edges}),d=t.computed(()=>[...s.value,...c.value]),u=t.computed(()=>{const _=[];for(const g of e.nodes)g.selected&&_.push(g);return _}),m=t.computed(()=>{const _=[];for(const g of e.edges)g.selected&&_.push(g);return _}),p=t.computed(()=>[...u.value,...m.value]),f=t.computed(()=>{const _=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&g.handleBounds!==void 0&&_.push(g);return _}),y=t.computed(()=>s.value.length>0&&f.value.length===s.value.length);return{getNode:i,getEdge:a,getElements:d,getEdgeTypes:r,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:p,getSelectedNodes:u,getSelectedEdges:m,getNodesInitialized:f,areNodesInitialized:y}}class co{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)??co.instance;return co.instance=i??new co,o&&(o.config.globalProperties.$vueFlowStorage=co.instance),co.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=gf(),a=t.reactive(i),r={};for(const[p,f]of Object.entries(a.hooks)){const y=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[y]=f.on}const l={};for(const[p,f]of Object.entries(a.hooks))l[p]=f.trigger;const s=t.computed(()=>{const p=new Map;for(const f of a.nodes)p.set(f.id,f);return p}),c=t.computed(()=>{const p=new Map;for(const f of a.edges)p.set(f.id,f);return p}),d=PN(a,s,c),u=hN(a,s,c);u.setState({...a,...o});const m={...r,...d,...u,...D_(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 et(e){const n=co.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(df,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,p,f)=>{const y=g=>{d.applyNodeChanges(g)},_=g=>{d.applyEdgeChanges(g)};m?(d.onNodesChange(y),d.onEdgesChange(_)):(d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(_)),f(()=>{d.hooks.value.nodesChange.off(y),d.hooks.value.edgesChange.off(_)})},{immediate:!0}),fi(()=>{if(s){const m=n.get(s.id);m?m.$destroy():Ti(`No store instance found for id ${s.id} in storage.`)}})})}else i&&s.setState(a);if(o&&(t.provide(df,s),o.vueFlowId=s.id),i){const c=t.getCurrentInstance();(c==null?void 0:c.type.name)!=="VueFlow"&&s.emits.error(new kt(yt.USEVUEFLOW_OPTIONS))}return s}function zN(e){const{emits:n,dimensions:o}=et();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=qa(e.value);(s.width===0||s.height===0)&&n.error(new kt(yt.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 FN={name:"UserSelection",compatConfig:{MODE:3}},UN=t.defineComponent({...FN,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))}}),HN=["tabIndex"],jN={name:"NodesSelection",compatConfig:{MODE:3}},KN=t.defineComponent({...jN,setup(e){const{emits:n,viewport:o,getSelectedNodes:i,noPanClassName:a,disableKeyboardA11y:r,userSelectionActive:l}=et(),s=yf(),c=t.ref(null),d=ff({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(()=>ts(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 p(y){n.selectionContextMenu({event:y,nodes:i.value})}function f(y){r.value||Fo[y.key]&&(y.preventDefault(),s({x:Fo[y.key].x,y:Fo[y.key].y},y.shiftKey))}return(y,_)=>!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:p,onKeydown:f},null,46,HN)],6)):t.createCommentVNode("",!0)}});function GN(e,n){return{x:e.clientX-n.left,y:e.clientY-n.top}}const YN={name:"Pane",compatConfig:{MODE:3}},qN=t.defineComponent({...YN,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:p,removeEdges:f,selectionMode:y,deleteKeyCode:_,multiSelectionKeyCode:g,multiSelectionActive:b,edgeLookup:E,nodeLookup:h,connectionLookup:N,defaultEdgeOptions:w,connectionStartHandle:C,panOnDrag:S}=et(),V=t.shallowRef(null),$=t.shallowRef(new Set),R=t.shallowRef(new Set),x=t.shallowRef(null),T=t.toRef(()=>c.value&&(e.isSelecting||r.value)),M=t.toRef(()=>C.value!==null);let k=!1,v=!1;const I=Ci(_,{actInsideInputWithModifier:!1}),O=Ci(g);t.watch(I,he=>{he&&(p(m.value),f(u.value),d.value=!1)}),t.watch(O,he=>{b.value=he});function A(he,_e){return ye=>{ye.target===_e&&(he==null||he(ye))}}function L(he){if(k||M.value){k=!1;return}a.paneClick(he),l(),d.value=!1}function H(he){var _e;if(Array.isArray(S.value)&&((_e=S.value)!=null&&_e.includes(2))){he.preventDefault();return}a.paneContextMenu(he)}function oe(he){a.paneScroll(he)}function ue(he){var _e,ye,Ae;if(x.value=((_e=n.value)==null?void 0:_e.getBoundingClientRect())??null,!c.value||!e.isSelecting||he.button!==0||he.target!==V.value||!x.value)return;(Ae=(ye=he.target)==null?void 0:ye.setPointerCapture)==null||Ae.call(ye,he.pointerId);const{x:Fe,y:se}=GN(he,x.value);v=!0,k=!1,l(),s.value={width:0,height:0,startX:Fe,startY:se,x:Fe,y:se},a.selectionStart(he)}function be(he){var _e;if(!x.value||!s.value)return;k=!0;const{x:ye,y:Ae}=cn(he,x.value),{startX:Fe=0,startY:se=0}=s.value,ne={startX:Fe,startY:se,x:ye<Fe?ye:Fe,y:Ae<se?Ae:se,width:Math.abs(ye-Fe),height:Math.abs(Ae-se)},ae=$.value,me=R.value;$.value=new Set(Fm(o.value,ne,i.value,y.value===Zl.Partial,!0).map(D=>D.id)),R.value=new Set;const P=((_e=w.value)==null?void 0:_e.selectable)??!0;for(const D of $.value){const z=N.value.get(D);if(z)for(const{edgeId:Q}of z.values()){const ee=E.value.get(Q);ee&&(ee.selectable??P)&&R.value.add(Q)}}if(!cf(ae,$.value)){const D=Ln(h.value,$.value,!0);a.nodesChange(D)}if(!cf(me,R.value)){const D=Ln(E.value,R.value);a.edgesChange(D)}s.value=ne,r.value=!0,d.value=!1}function pe(he){var _e;he.button!==0||!v||((_e=he.target)==null||_e.releasePointerCapture(he.pointerId),!r.value&&s.value&&he.target===V.value&&L(he),r.value=!1,s.value=null,d.value=$.value.size>0,a.selectionEnd(he),e.selectionKeyPressed&&(k=!1),v=!1)}return(he,_e)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:V,class:t.normalizeClass(["vue-flow__pane vue-flow__container",{selection:he.isSelecting}]),onClick:_e[0]||(_e[0]=ye=>T.value?void 0:A(L,V.value)(ye)),onContextmenu:_e[1]||(_e[1]=ye=>A(H,V.value)(ye)),onWheelPassive:_e[2]||(_e[2]=ye=>A(oe,V.value)(ye)),onPointerenter:_e[3]||(_e[3]=ye=>T.value?void 0:t.unref(a).paneMouseEnter(ye)),onPointerdown:_e[4]||(_e[4]=ye=>T.value?ue(ye):t.unref(a).paneMouseMove(ye)),onPointermove:_e[5]||(_e[5]=ye=>T.value?be(ye):t.unref(a).paneMouseMove(ye)),onPointerup:_e[6]||(_e[6]=ye=>T.value?pe(ye):void 0),onPointerleave:_e[7]||(_e[7]=ye=>t.unref(a).paneMouseLeave(ye))},[t.renderSlot(he.$slots,"default"),t.unref(r)&&t.unref(s)?(t.openBlock(),t.createBlock(UN,{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(KN,{key:1})):t.createCommentVNode("",!0)],34))}}),WN={name:"Transform",compatConfig:{MODE:3}},JN=t.defineComponent({...WN,setup(e){const{viewport:n,fitViewOnInit:o,fitViewOnInitDone:i}=et(),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))}}),XN={name:"Viewport",compatConfig:{MODE:3}},ZN=t.defineComponent({...XN,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:p,zoomOnPinch:f,zoomOnScroll:y,preventScrolling:_,noWheelClassName:g,noPanClassName:b,emits:E,connectionStartHandle:h,userSelectionActive:N,paneDragging:w,d3Zoom:C,d3Selection:S,d3ZoomHandler:V,viewport:$,viewportRef:R,paneClickDistance:x}=et();zN(R);const T=t.shallowRef(!1),M=t.shallowRef(!1);let k=null,v=!1,I=0,O={x:0,y:0,zoom:0};const A=Ci(s),L=Ci(l),H=Ci(r),oe=t.toRef(()=>(!L.value||L.value&&l.value===!0)&&(A.value||m.value)),ue=t.toRef(()=>A.value||c.value),be=t.toRef(()=>l.value===!0&&oe.value!==!0),pe=t.toRef(()=>L.value&&l.value!==!0||N.value||be.value),he=t.toRef(()=>h.value!==null);t.onMounted(()=>{if(!R.value){Ti("Viewport element is missing");return}const se=R.value,ne=se.getBoundingClientRect(),ae=k0().clickDistance(x.value).scaleExtent([n.value,o.value]).translateExtent(a.value),me=jt(se).call(ae),P=me.on("wheel.zoom"),D=zo.translate(i.value.x??0,i.value.y??0).scale(ao(i.value.zoom??1,n.value,o.value)),z=[[0,0],[ne.width,ne.height]],Q=ae.constrain()(D,z,a.value);ae.transform(me,Q),ae.wheelDelta(ns),C.value=ae,S.value=me,V.value=P,$.value={x:Q.x,y:Q.y,zoom:Q.k},ae.on("start",ee=>{var we;if(!ee.sourceEvent)return null;I=ee.sourceEvent.button,T.value=!0;const de=Ae(ee.transform);((we=ee.sourceEvent)==null?void 0:we.type)==="mousedown"&&(w.value=!0),O=de,E.viewportChangeStart(de),E.moveStart({event:ee,flowTransform:de})}),ae.on("end",ee=>{if(!ee.sourceEvent)return null;if(T.value=!1,w.value=!1,_e(oe.value,I??0)&&!v&&E.paneContextMenu(ee.sourceEvent),v=!1,ye(O,ee.transform)){const we=Ae(ee.transform);O=we,E.viewportChangeEnd(we),E.moveEnd({event:ee,flowTransform:we})}}),ae.filter(ee=>{var we;const de=H.value||y.value,xe=f.value&&ee.ctrlKey,Ce=ee.button,Y=ee.type==="wheel";if(Ce===1&&ee.type==="mousedown"&&(Fe(ee,"vue-flow__node")||Fe(ee,"vue-flow__edge")))return!0;if(!oe.value&&!de&&!ue.value&&!p.value&&!f.value||N.value||he.value&&!Y||!p.value&&ee.type==="dblclick"||Fe(ee,g.value)&&Y||Fe(ee,b.value)&&(!Y||ue.value&&Y&&!H.value)||!f.value&&ee.ctrlKey&&Y||!de&&!ue.value&&!xe&&Y)return!1;if(!f&&ee.type==="touchstart"&&((we=ee.touches)==null?void 0:we.length)>1)return ee.preventDefault(),!1;if(!oe.value&&(ee.type==="mousedown"||ee.type==="touchstart")||be.value&&Array.isArray(m.value)&&m.value.includes(0)&&Ce===0||Array.isArray(m.value)&&!m.value.includes(Ce)&&(ee.type==="mousedown"||ee.type==="touchstart"))return!1;const X=Array.isArray(m.value)&&m.value.includes(Ce)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!Ce||Ce<=1;return(!ee.ctrlKey||A.value||Y)&&X}),t.watch([N,oe],()=>{N.value&&!T.value?ae.on("zoom",null):N.value||ae.on("zoom",ee=>{$.value={x:ee.transform.x,y:ee.transform.y,zoom:ee.transform.k};const we=Ae(ee.transform);v=_e(oe.value,I??0),E.viewportChange(we),E.move({event:ee,flowTransform:we})})},{immediate:!0}),t.watch([N,ue,d,H,f,_,g],()=>{ue.value&&!H.value&&!N.value?me.on("wheel.zoom",ee=>{if(Fe(ee,g.value))return!1;const we=H.value||y.value,de=f.value&&ee.ctrlKey;if(!(!_.value||ue.value||we||de))return!1;ee.preventDefault(),ee.stopImmediatePropagation();const Ce=me.property("__zoom").k||1,Y=$i();if(!A.value&&ee.ctrlKey&&f.value&&Y){const ze=an(ee),Ue=ns(ee),ie=Ce*2**Ue;ae.scaleTo(me,ie,ze,ee);return}const X=ee.deltaMode===1?20:1;let q=d.value===vi.Vertical?0:ee.deltaX*X,Ie=d.value===vi.Horizontal?0:ee.deltaY*X;!Y&&ee.shiftKey&&d.value!==vi.Vertical&&!q&&Ie&&(q=Ie,Ie=0),ae.translateBy(me,-(q/Ce)*u.value,-(Ie/Ce)*u.value);const Be=Ae(me.property("__zoom"));k&&clearTimeout(k),M.value?(E.move({event:ee,flowTransform:Be}),E.viewportChange(Be),k=setTimeout(()=>{E.moveEnd({event:ee,flowTransform:Be}),E.viewportChangeEnd(Be),M.value=!1},150)):(M.value=!0,E.moveStart({event:ee,flowTransform:Be}),E.viewportChangeStart(Be))},{passive:!1}):typeof P<"u"&&me.on("wheel.zoom",function(ee,we){const de=!_.value&&ee.type==="wheel"&&!ee.ctrlKey,xe=H.value||y.value,Ce=f.value&&ee.ctrlKey;if(!xe&&!c.value&&!Ce&&ee.type==="wheel"||de||Fe(ee,g.value))return null;ee.preventDefault(),P.call(this,ee,we)},{passive:!1})},{immediate:!0})});function _e(se,ne){return ne===2&&Array.isArray(se)&&se.includes(2)}function ye(se,ne){return se.x!==ne.x&&!Number.isNaN(ne.x)||se.y!==ne.y&&!Number.isNaN(ne.y)||se.zoom!==ne.k&&!Number.isNaN(ne.k)}function Ae(se){return{x:se.x,y:se.y,zoom:se.k}}function Fe(se,ne){return se.target.closest(`.${ne}`)}return(se,ne)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"viewportRef",ref:R,class:"vue-flow__viewport vue-flow__container"},[t.createVNode(qN,{"is-selecting":pe.value,"selection-key-pressed":t.unref(L),class:t.normalizeClass({connecting:he.value,dragging:t.unref(w),draggable:t.unref(m)===!0||Array.isArray(t.unref(m))&&t.unref(m).includes(0)})},{default:t.withCtx(()=>[t.createVNode(JN,null,{default:t.withCtx(()=>[t.renderSlot(se.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),QN=["id"],ew=["id"],tw=["id"],nw={name:"A11yDescriptions",compatConfig:{MODE:3}},ow=t.defineComponent({...nw,setup(e){const{id:n,disableKeyboardA11y:o,ariaLiveMessage:i}=et();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{id:`${t.unref($m)}-${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,QN),t.createElementVNode("div",{id:`${t.unref(Tm)}-${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,ew),t.unref(o)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,id:`${t.unref(C0)}-${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,tw))],64))}});function iw(){const e=et();t.watch(()=>e.viewportHelper.value.viewportInitialized,n=>{n&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function aw(e,n,o){return o===De.Left?e-n:o===De.Right?e+n:e}function rw(e,n,o){return o===De.Top?e-n:o===De.Bottom?e+n:e}const ps=function({radius:e=10,centerX:n=0,centerY:o=0,position:i=De.Top,type:a}){return t.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${a}`,cx:aw(n,e,i),cy:rw(o,e,i),r:e,stroke:"transparent",fill:"transparent"})};ps.props=["radius","centerX","centerY","position","type"],ps.compatConfig={MODE:3};const Sf=ps,lw=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:p,multiSelectionActive:f,disableKeyboardA11y:y,elementsSelectable:_,edgesUpdatable:g,edgesFocusable:b,hooks:E}=et(),h=t.computed(()=>u(e.id)),{emit:N,on:w}=nN(h.value,r),C=t.inject(Za),S=t.getCurrentInstance(),V=t.ref(!1),$=t.ref(!1),R=t.ref(""),x=t.ref(null),T=t.ref("source"),M=t.ref(null),k=t.toRef(()=>typeof h.value.selectable>"u"?_.value:h.value.selectable),v=t.toRef(()=>typeof h.value.updatable>"u"?g.value:h.value.updatable),I=t.toRef(()=>typeof h.value.focusable>"u"?b.value:h.value.focusable);t.provide(Q0,e.id),t.provide(eN,M);const O=t.computed(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),A=t.computed(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),L=t.computed(()=>{const D=h.value.type||"default",z=C==null?void 0:C[`edge-${D}`];if(z)return z;let Q=h.value.template??c.value[D];if(typeof Q=="string"&&S){const ee=Object.keys(S.appContext.components);ee&&ee.includes(D)&&(Q=t.resolveComponent(D,!1))}return Q&&typeof Q!="string"?Q:(r.error(new kt(yt.EDGE_TYPE_MISSING,Q)),!1)}),{handlePointerDown:H}=pf({nodeId:R,handleId:x,type:T,isValidConnection:p,edgeUpdaterType:T,onEdgeUpdate:be,onEdgeUpdateEnd:pe});return()=>{const D=m(h.value.source),z=m(h.value.target),Q="pathOptions"in h.value?h.value.pathOptions:{};if(!D&&!z)return r.error(new kt(yt.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!D)return r.error(new kt(yt.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!z)return r.error(new kt(yt.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||D.hidden||z.hidden)return null;let ee;i.value===En.Strict?ee=D.handleBounds.source:ee=[...D.handleBounds.source||[],...D.handleBounds.target||[]];const we=Qm(ee,h.value.sourceHandle);let de;i.value===En.Strict?de=z.handleBounds.target:de=[...z.handleBounds.target||[],...z.handleBounds.source||[]];const xe=Qm(de,h.value.targetHandle),Ce=(we==null?void 0:we.position)||De.Bottom,Y=(xe==null?void 0:xe.position)||De.Top,{x:X,y:q}=Ho(D,we,Ce),{x:Ie,y:Be}=Ho(z,xe,Y);return h.value.sourceX=X,h.value.sourceY=q,h.value.targetX=Ie,h.value.targetY=Be,t.h("g",{ref:M,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${L.value===!1?"default":h.value.type||"default"}`,s.value,O.value,{updating:V.value,selected:h.value.selected,animated:h.value.animated,inactive:!k.value&&!E.value.edgeClick.hasListeners()}],tabIndex:I.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel??`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":I.value?`${Tm}-${n}`:void 0,"aria-roledescription":"edge",role:I.value?"group":"img",...h.value.domAttributes,onClick:_e,onContextmenu:ye,onDblclick:Ae,onMouseenter:Fe,onMousemove:se,onMouseleave:ne,onKeyDown:I.value?P:void 0},[$.value?null:t.h(L.value===!1?c.value.default:L.value,{id:e.id,sourceNode:D,targetNode:z,source:h.value.source,target:h.value.target,type:h.value.type,updatable:v.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...w},style:A.value,markerStart:`url('#${Ai(h.value.markerStart,n)}')`,markerEnd:`url('#${Ai(h.value.markerEnd,n)}')`,sourcePosition:Ce,targetPosition:Y,sourceX:X,sourceY:q,targetX:Ie,targetY:Be,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...Q}),[v.value==="source"||v.value===!0?[t.h("g",{onMousedown:ae,onMouseenter:oe,onMouseout:ue},t.h(Sf,{position:Ce,centerX:X,centerY:q,radius:a.value,type:"source","data-type":"source"}))]:null,v.value==="target"||v.value===!0?[t.h("g",{onMousedown:me,onMouseenter:oe,onMouseout:ue},t.h(Sf,{position:Y,centerX:Ie,centerY:Be,radius:a.value,type:"target","data-type":"target"}))]:null]])};function oe(){V.value=!0}function ue(){V.value=!1}function be(D,z){N.update({event:D,edge:h.value,connection:z})}function pe(D){N.updateEnd({event:D,edge:h.value}),$.value=!1}function he(D,z){D.button===0&&($.value=!0,R.value=z?h.value.target:h.value.source,x.value=(z?h.value.targetHandle:h.value.sourceHandle)??null,T.value=z?"target":"source",N.updateStart({event:D,edge:h.value}),H(D))}function _e(D){var z;const Q={event:D,edge:h.value};k.value&&(l.value=!1,h.value.selected&&f.value?(d([h.value]),(z=M.value)==null||z.blur()):o([h.value])),N.click(Q)}function ye(D){N.contextMenu({event:D,edge:h.value})}function Ae(D){N.doubleClick({event:D,edge:h.value})}function Fe(D){N.mouseEnter({event:D,edge:h.value})}function se(D){N.mouseMove({event:D,edge:h.value})}function ne(D){N.mouseLeave({event:D,edge:h.value})}function ae(D){he(D,!0)}function me(D){he(D,!1)}function P(D){var z;!y.value&&Mm.includes(D.key)&&k.value&&(D.key==="Escape"?((z=M.value)==null||z.blur(),d([u(e.id)])):o([u(e.id)]))}}}),sw=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}=et(),p=(e=t.inject(Za))==null?void 0:e["connection-line"],f=t.computed(()=>{var E;return m((E=i.value)==null?void 0:E.nodeId)}),y=t.computed(()=>{var E;return m((E=a.value)==null?void 0:E.nodeId)??null}),_=t.computed(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),g=t.computed(()=>c.value.markerStart?`url(#${Ai(c.value.markerStart,n)})`:""),b=t.computed(()=>c.value.markerEnd?`url(#${Ai(c.value.markerEnd,n)})`:"");return()=>{var E,h,N;if(!f.value||!i.value)return null;const w=i.value.id,C=i.value.type,S=f.value.handleBounds;let V=(S==null?void 0:S[C])??[];if(o.value===En.Loose){const A=(S==null?void 0:S[C==="source"?"target":"source"])??[];V=[...V,...A]}if(!V)return null;const $=(w?V.find(A=>A.id===w):V[0])??null,R=($==null?void 0:$.position)??De.Top,{x,y:T}=Ho(f.value,$,R);let M=null;y.value&&(o.value===En.Strict?M=((E=y.value.handleBounds[C==="source"?"target":"source"])==null?void 0:E.find(A=>{var L;return A.id===((L=a.value)==null?void 0:L.id)}))||null:M=((h=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:h.find(A=>{var L;return A.id===((L=a.value)==null?void 0:L.id)}))||null);const k=((N=a.value)==null?void 0:N.position)??(R?ss[R]:null);if(!R||!k)return null;const v=l.value??c.value.type??io.Bezier;let I="";const O={sourceX:x,sourceY:T,sourcePosition:R,targetX:_.value.x,targetY:_.value.y,targetPosition:k};return v===io.Bezier?[I]=Ef(O):v===io.Step?[I]=fs({...O,borderRadius:0}):v===io.SmoothStep?[I]=fs(O):v===io.SimpleBezier?[I]=wf(O):I=`M${x},${T} ${_.value.x},${_.value.y}`,t.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},t.h("g",{class:"vue-flow__connection"},p?t.h(p,{sourceX:x,sourceY:T,sourcePosition:R,targetX:_.value.x,targetY:_.value.y,targetPosition:k,sourceNode:f.value,sourceHandle:$,targetNode:y.value,targetHandle:M,markerEnd:b.value,markerStart:g.value,connectionStatus:d.value}):t.h("path",{d:I,class:[c.value.class,d.value,"vue-flow__connection-path"],style:{...s.value,...c.value.style},"marker-end":b.value,"marker-start":g.value})))}}}),cw=["id","markerWidth","markerHeight","markerUnits","orient"],dw={name:"MarkerType",compatConfig:{MODE:3}},uw=t.defineComponent({...dw,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(Ql).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(Ql).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,cw))}}),mw={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},fw={name:"MarkerDefinitions",compatConfig:{MODE:3}},pw=t.defineComponent({...fw,setup(e){const{id:n,edges:o,connectionLineOptions:i,defaultMarkerColor:a}=et(),r=t.computed(()=>{const l=new Set,s=[],c=d=>{if(d){const u=Ai(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",mw,[t.createElementVNode("defs",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,c=>(t.openBlock(),t.createBlock(uw,{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))])]))}}),hw={name:"Edges",compatConfig:{MODE:3}},yw=t.defineComponent({...hw,setup(e){const{findNode:n,getEdges:o,elevateEdgesOnSelect:i}=et();return(a,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(pw),(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(F0)(l,t.unref(n),t.unref(i))})},[t.createVNode(t.unref(lw),{id:l.id},null,8,["id"])],4))),128)),t.createVNode(t.unref(sw))],64))}}),gw=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:p,elevateNodesOnSelect:f,disableKeyboardA11y:y,ariaLiveMessage:_,snapToGrid:g,snapGrid:b,nodeDragThreshold:E,nodesDraggable:h,elementsSelectable:N,nodesConnectable:w,nodesFocusable:C,hooks:S}=et(),V=t.ref(null);t.provide(mf,V),t.provide(uf,e.id);const $=t.inject(Za),R=t.getCurrentInstance(),x=yf(),{node:T,parentNode:M}=hf(e.id),{emit:k,on:v}=rN(T,l),I=t.toRef(()=>typeof T.draggable>"u"?h.value:T.draggable),O=t.toRef(()=>typeof T.selectable>"u"?N.value:T.selectable),A=t.toRef(()=>typeof T.connectable>"u"?w.value:T.connectable),L=t.toRef(()=>typeof T.focusable>"u"?C.value:T.focusable),H=t.computed(()=>O.value||I.value||S.value.nodeClick.hasListeners()||S.value.nodeDoubleClick.hasListeners()||S.value.nodeMouseEnter.hasListeners()||S.value.nodeMouseMove.hasListeners()||S.value.nodeMouseLeave.hasListeners()),oe=t.toRef(()=>!!T.dimensions.width&&!!T.dimensions.height),ue=t.computed(()=>{const z=T.type||"default",Q=$==null?void 0:$[`node-${z}`];if(Q)return Q;let ee=T.template||m.value[z];if(typeof ee=="string"&&R){const we=Object.keys(R.appContext.components);we&&we.includes(z)&&(ee=t.resolveComponent(z,!1))}return ee&&typeof ee!="string"?ee:(l.error(new kt(yt.NODE_TYPE_MISSING,ee)),!1)}),be=ff({id:e.id,el:V,disabled:()=>!I.value,selectable:O,dragHandle:()=>T.dragHandle,onStart(z){k.dragStart(z)},onDrag(z){k.drag(z)},onStop(z){k.dragStop(z)},onClick(z){P(z)}}),pe=t.computed(()=>T.class instanceof Function?T.class(T):T.class),he=t.computed(()=>{const z=(T.style instanceof Function?T.style(T):T.style)||{},Q=T.width instanceof Function?T.width(T):T.width,ee=T.height instanceof Function?T.height(T):T.height;return!z.width&&Q&&(z.width=typeof Q=="string"?Q:`${Q}px`),!z.height&&ee&&(z.height=typeof ee=="string"?ee:`${ee}px`),z}),_e=t.toRef(()=>Number(T.zIndex??he.value.zIndex??0));return u(z=>{(z.includes(e.id)||!z.length)&&Ae()}),t.onMounted(()=>{t.watch(()=>T.hidden,(z=!1,Q,ee)=>{!z&&V.value&&(e.resizeObserver.observe(V.value),ee(()=>{V.value&&e.resizeObserver.unobserve(V.value)}))},{immediate:!0,flush:"post"})}),t.watch([()=>T.type,()=>T.sourcePosition,()=>T.targetPosition],()=>{t.nextTick(()=>{d([{id:e.id,nodeElement:V.value,forceUpdate:!0}])})}),t.watch([()=>T.position.x,()=>T.position.y,()=>{var z;return(z=M.value)==null?void 0:z.computedPosition.x},()=>{var z;return(z=M.value)==null?void 0:z.computedPosition.y},()=>{var z;return(z=M.value)==null?void 0:z.computedPosition.z},_e,()=>T.selected,()=>T.dimensions.height,()=>T.dimensions.width,()=>{var z;return(z=M.value)==null?void 0:z.dimensions.height},()=>{var z;return(z=M.value)==null?void 0:z.dimensions.width}],([z,Q,ee,we,de,xe])=>{const Ce={x:z,y:Q,z:xe+(f.value&&T.selected?1e3:0)};typeof ee<"u"&&typeof we<"u"?T.computedPosition=B0({x:ee,y:we,z:de},Ce):T.computedPosition=Ce},{flush:"post",immediate:!0}),t.watch([()=>T.extent,p],([z,Q],[ee,we])=>{(z!==ee||Q!==we)&&ye()}),T.extent==="parent"||typeof T.extent=="object"&&"range"in T.extent&&T.extent.range==="parent"?$l(()=>oe).toBe(!0).then(ye):ye(),()=>T.hidden?null:t.h("div",{ref:V,"data-id":T.id,class:["vue-flow__node",`vue-flow__node-${ue.value===!1?"default":T.type||"default"}`,{[o.value]:I.value,dragging:be==null?void 0:be.value,draggable:I.value,selected:T.selected,selectable:O.value,parent:T.isParent},pe.value],style:{visibility:oe.value?"visible":"hidden",zIndex:T.computedPosition.z??_e.value,transform:`translate(${T.computedPosition.x}px,${T.computedPosition.y}px)`,pointerEvents:H.value?"all":"none",...he.value},tabIndex:L.value?0:void 0,role:L.value?"group":void 0,"aria-describedby":y.value?void 0:`${$m}-${n}`,"aria-label":T.ariaLabel,"aria-roledescription":"node",...T.domAttributes,onMouseenter:Fe,onMousemove:se,onMouseleave:ne,onContextmenu:ae,onClick:P,onDblclick:me,onKeydown:D},[t.h(ue.value===!1?m.value.default:ue.value,{id:T.id,type:T.type,data:T.data,events:{...T.events,...v},selected:T.selected,resizing:T.resizing,dragging:be.value,connectable:A.value,position:T.computedPosition,dimensions:T.dimensions,isValidTargetPos:T.isValidTargetPos,isValidSourcePos:T.isValidSourcePos,parent:T.parentNode,parentNodeId:T.parentNode,zIndex:T.computedPosition.z??_e.value,targetPosition:T.targetPosition,sourcePosition:T.sourcePosition,label:T.label,dragHandle:T.dragHandle,onUpdateNodeInternals:Ae})]);function ye(){const z=T.computedPosition,{computedPosition:Q,position:ee}=as(T,g.value?Xa(z,b.value):z,l.error,p.value,M.value);(T.computedPosition.x!==Q.x||T.computedPosition.y!==Q.y)&&(T.computedPosition={...T.computedPosition,...Q}),(T.position.x!==ee.x||T.position.y!==ee.y)&&(T.position=ee)}function Ae(){V.value&&d([{id:e.id,nodeElement:V.value,forceUpdate:!0}])}function Fe(z){be!=null&&be.value||k.mouseEnter({event:z,node:T})}function se(z){be!=null&&be.value||k.mouseMove({event:z,node:T})}function ne(z){be!=null&&be.value||k.mouseLeave({event:z,node:T})}function ae(z){return k.contextMenu({event:z,node:T})}function me(z){return k.doubleClick({event:z,node:T})}function P(z){O.value&&(!i.value||!I.value||E.value>0)&&cs(T,r.value,c,s,a,!1,V.value),k.click({event:z,node:T})}function D(z){if(!(es(z)||y.value))if(Mm.includes(z.key)&&O.value){const Q=z.key==="Escape";cs(T,r.value,c,s,a,Q,V.value)}else I.value&&T.selected&&Fo[z.key]&&(z.preventDefault(),_.value=`Moved selected node ${z.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~T.position.x}, y: ${~~T.position.y}`,x({x:Fo[z.key].x,y:Fo[z.key].y},z.shiftKey))}}});function bw(e={includeHiddenNodes:!1}){const{nodes:n}=et();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 _w={class:"vue-flow__nodes vue-flow__container"},kw={name:"Nodes",compatConfig:{MODE:3}},Ew=t.defineComponent({...kw,setup(e){const{getNodes:n,updateNodeDimensions:o,emits:i}=et(),a=bw(),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",_w,[r.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(n),(c,d,u,m)=>{const p=[c.id];if(m&&m.key===c.id&&t.isMemoSame(m,p))return m;const f=(t.openBlock(),t.createBlock(t.unref(gw),{id:c.id,key:c.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return f.memo=p,f},s,0),128)):t.createCommentVNode("",!0)]))}});function Nw(){const{emits:e}=et();t.onMounted(()=>{if(af()){const n=document.querySelector(".vue-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.error(new kt(yt.MISSING_STYLES))}})}const ww=t.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Iw={name:"VueFlow",compatConfig:{MODE:3}},vw=t.defineComponent({...Iw,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=Tl(i,"modelValue",o),l=Tl(i,"nodes",o),s=Tl(i,"edges",o),c=et(i),d=dN({modelValue:r,nodes:l,edges:s},i,c);return mN(o,c.hooks),iw(),Nw(),t.provide(Za,a),t.onUnmounted(d),n(c),(u,m)=>(t.openBlock(),t.createElementBlock("div",{ref:t.unref(c).vueFlowRef,class:"vue-flow"},[t.createVNode(ZN,null,{default:t.withCtx(()=>[t.createVNode(yw),ww,t.createVNode(Ew),t.renderSlot(u.$slots,"zoom-pane")]),_:3}),t.renderSlot(u.$slots,"default"),t.createVNode(ow)],512))}}),Cw={name:"Panel",compatConfig:{MODE:3}},xf=t.defineComponent({...Cw,props:{position:{}},setup(e){const n=e,{userSelectionActive:o}=et(),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))}}),Sw=["width","height","innerHTML"],xw=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,Sw))}}),tt=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ve=tt(xw,[["__scopeId","data-v-05aac699"]]),uo=["red","amber","green","teal","blue","indigo","violet","pink"],Rf={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 Rw(e){return typeof e=="string"&&e in Rf}const Aw={red:0,amber:32,green:145,teal:173,blue:221,indigo:244,violet:262,pink:330},$w=.15;function Tw(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 Mw(e){if(typeof e!="string")return null;const n=Tw(e);if(!n||n.s<$w)return null;let o=null,i=1/0;for(const a of uo){const r=Math.abs(n.h-Aw[a]),l=Math.min(r,360-r);l<i&&(i=l,o=a)}return o}function St(e){var i;const n=(i=e==null?void 0:e.properties)==null?void 0:i.swatch;if(Rw(n))return n;const o=e==null?void 0:e.properties;return Mw((o==null?void 0:o["background-color"])??(o==null?void 0:o["font-color"])??(o==null?void 0:o.color))}function hs(e){return e?{bar:`var(--em-swatch-${e}-bar)`,barOn:`var(--em-swatch-${e}-on)`,text:`var(--em-swatch-${e}-text)`}:null}const Vw={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)"},Bw={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 Af(e,n=!1){return e?n?Bw[e]:Vw[e]:null}function mo(e){return Rf[e]}function jo(e){return`var(--em-swatch-${e}-bar)`}function Dw(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 Ow(e,n){const o=Dw(n);return o?e(o):n.split("-")[1]??n}function Lw(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-TYPE-7":return"em.check.type7";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 $f(e,n){const o=Lw(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 Pw(e){return e.targetKind==="entity"?e.targetRef:e.contextRef}const zw={class:"em-inline-issue__msgs"},fo=tt(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(Ve,{name:i[r.value].icon,size:13,class:"em-inline-issue__icon"},null,8,["name"]),t.createElementVNode("span",zw,[(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($f)(t.unref(o).t,c)),1))),128))])],2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-9f959cc0"]]),Fw=["id","aria-selected","aria-controls","tabindex","onClick","onKeydown"],Uw={key:0,class:"em-mlang__dot"},Hw=["id","role","aria-labelledby"],jw=["title"],Yt=tt(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 b=o.defaultLang;return b&&o.languages.includes(b)?b:o.languages[0]??"ko"}const r=t.computed(()=>o.activeLang!==void 0),l=t.ref(a()),s=t.computed(()=>{const b=o.activeLang;return b&&o.languages.includes(b)?b:r.value?o.languages[0]??"ko":l.value});t.watch(()=>[o.languages,o.defaultLang],()=>{o.languages.includes(l.value)||(l.value=a())});function c(b){var E,h;return!!((h=(E=o.modelValue)==null?void 0:E[b])!=null&&h.trim())}const d=b=>`${o.name}-tab-${b}`,u=t.computed(()=>`${o.name}-panel`),m=t.ref(null);async function p(b){var N,w;const E=o.languages,h=E[(b+E.length)%E.length];h&&(l.value=h,await t.nextTick(),(w=(N=m.value)==null?void 0:N.querySelectorAll('[role="tab"]')[E.indexOf(h)])==null||w.focus())}function f(b){p(o.languages.indexOf(s.value)+b)}const y=t.computed(()=>o.languages.filter(b=>{var E,h;return b!==s.value&&!!((h=(E=o.modelValue)==null?void 0:E[b])!=null&&h.trim())})),_=t.computed(()=>{var b;return((b=o.modelValue)==null?void 0:b[s.value])??""});function g(b){const E={...o.modelValue};b.trim()===""?delete E[s.value]:E[s.value]=b,i("update:modelValue",E)}return(b,E)=>(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,h=>(t.openBlock(),t.createElementBlock("span",{id:d(h),key:h,class:t.normalizeClass(["em-mlang__tab",{"is-active":s.value===h}]),role:"tab","aria-selected":s.value===h,"aria-controls":u.value,tabindex:s.value===h?0:-1,onClick:N=>l.value=h,onKeydown:[t.withKeys(t.withModifiers(N=>l.value=h,["prevent"]),["enter"]),t.withKeys(t.withModifiers(N=>l.value=h,["prevent"]),["space"]),E[0]||(E[0]=t.withKeys(t.withModifiers(N=>f(-1),["prevent"]),["left"])),E[1]||(E[1]=t.withKeys(t.withModifiers(N=>f(1),["prevent"]),["right"])),E[2]||(E[2]=t.withKeys(t.withModifiers(N=>p(0),["prevent"]),["home"])),E[3]||(E[3]=t.withKeys(t.withModifiers(N=>p(e.languages.length-1),["prevent"]),["end"]))]},[t.createTextVNode(t.toDisplayString(h),1),c(h)?(t.openBlock(),t.createElementBlock("span",Uw,"•")):t.createCommentVNode("",!0)],42,Fw))),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":_.value,"onUpdate:modelValue":g},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":_.value,"onUpdate:modelValue":g},null,8,["name","placeholder","model-value"]))],8,Hw),r.value&&y.value.length?(t.openBlock(),t.createElementBlock("span",{key:1,class:"em-mlang__others",title:y.value.join(", "),"aria-hidden":"true"},"•",8,jw)):t.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-9cb21667"]]),Kw=["disabled"],Gw={class:"em-panel__sub-label"},Yw={class:"em-field"},qw={class:"em-field"},Ww={class:"em-field"},Jw={class:"em-class"},Xw={class:"em-field"},Zw={class:"em-field"},Qw={class:"em-field"},eI={class:"em-field"},tI={class:"em-multilang"},nI={class:"em-multilang"},oI={class:"em-jpa"},iI={class:"em-field"},aI={class:"em-field"},rI={class:"em-field"},lI=["title"],sI={class:"em-swatch"},cI={class:"em-swatch__row"},dI=["title"],uI=["title","onClick"],Tf=tt(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(M=>M.modelId===o.entityId)??null),l=t.computed(()=>r.value?a.state.layout.entityLayouts.find(M=>M.entityRef===r.value.modelId)??null:null),s=t.computed(()=>{var M;return St(((M=l.value)==null?void 0:M.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=M=>M;function p(M){return M==="inherit"?a.t("em.common.inherit"):M}function f(M){r.value&&a.updateEntity(r.value.modelId,M)}function y(M,k,v){var O;const I=((O=r.value)==null?void 0:O.table)??{physicalName:""};f(M==="physicalName"?{table:{...I,physicalName:v}}:{table:{...I,logicalName:{...I.logicalName,[k]:v}}})}function _(M){f({description:Object.keys(M).length?M:void 0})}function g(M,k){var v;f({jpaAttrs:{...(v=r.value)==null?void 0:v.jpaAttrs,[M]:k}})}function b(M,k){g(M,k)}const E=t.computed(()=>{var M,k;return((k=(M=r.value)==null?void 0:M.jpaAttrs)==null?void 0:k.discriminatorType)??"inherit"}),h=t.computed(()=>{var M,k;return!((k=(M=r.value)==null?void 0:M.jpaAttrs)!=null&&k.useDiscriminator)});function N(M){g("discriminatorType",M==="inherit"?void 0:M)}function w(M){f({hasPersonalInfo:M})}function C(M){f({referenceOnly:M?!0:void 0})}function S(M){f({superClass:M.trim()||void 0})}function V(M){f({schema:M.trim()||void 0})}function $(M){f({abstractClass:M})}const R=t.computed(()=>{var M,k;return((k=(M=r.value)==null?void 0:M.declarationOfInterfaces)==null?void 0:k.join(", "))??""});function x(M){const k=M.split(",").map(v=>v.trim()).filter(Boolean);f({declarationOfInterfaces:k.length?k:void 0})}function T(M){r.value&&a.setEntitySwatch(r.value.modelId,M)}return(M,k)=>{var v,I,O;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:k[0]||(k[0]=A=>i("toggle"))},[t.createElementVNode("span",Gw,[t.createVNode(Ve,{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(fo,{controller:t.unref(a),"ref-id":e.entityId,class:"em-section__issues"},null,8,["controller","ref-id"]),t.createElementVNode("label",Yw,[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":k[1]||(k[1]=A=>f({name:A}))},null,8,["model-value"])]),t.createElementVNode("label",qw,[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(ei),"onUpdate:modelValue":k[2]||(k[2]=A=>f({stereotype:A}))},null,8,["model-value","label-provider"])]),t.createElementVNode("label",Ww,[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":k[3]||(k[3]=A=>f({packageName:A}))},null,8,["model-value"])]),t.createElementVNode("fieldset",Jw,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.classLegend")),1),t.createElementVNode("label",Xw,[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":k[4]||(k[4]=A=>S(A))},null,8,["placeholder","model-value"])]),t.createElementVNode("label",Zw,[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":R.value,"onUpdate:modelValue":k[5]||(k[5]=A=>x(A))},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":k[6]||(k[6]=A=>$(A))},null,8,["label","model-value"])]),t.createElementVNode("label",Qw,[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":((v=r.value.table)==null?void 0:v.physicalName)??"","onUpdate:modelValue":k[7]||(k[7]=A=>y("physicalName",null,A))},null,8,["model-value"])]),t.createElementVNode("label",eI,[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":k[8]||(k[8]=A=>V(A))},null,8,["placeholder","model-value"])]),t.createElementVNode("fieldset",tI,[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,A=>{var L,H;return t.openBlock(),t.createElementBlock("label",{key:A,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(A),1),t.createVNode(t.unref(te.BSTextInput),{name:`ent-logical-${A}`,width:"100%","model-value":((H=(L=r.value.table)==null?void 0:L.logicalName)==null?void 0:H[A])??"","onUpdate:modelValue":oe=>y("logicalName",A,oe)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("fieldset",nI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:"ent-desc",languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":r.value.description,"onUpdate:modelValue":_},null,8,["languages","default-lang","model-value"])]),t.createElementVNode("fieldset",oI,[k[13]||(k[13]=t.createElementVNode("legend",null,"JPA",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,A=>{var L;return t.createVNode(t.unref(te.BSCheckbox),{key:A.key,name:`jpa-${A.key}`,class:"em-check",label:A.label,"model-value":!!((L=r.value.jpaAttrs)!=null&&L[A.key]),"onUpdate:modelValue":H=>b(A.key,H)},null,8,["name","label","model-value","onUpdate:modelValue"])}),64)),t.createElementVNode("label",iI,[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:h.value,"model-value":((I=r.value.jpaAttrs)==null?void 0:I.discriminatorColumnName)??"","onUpdate:modelValue":k[9]||(k[9]=A=>g("discriminatorColumnName",A.trim()||void 0))},null,8,["placeholder","disabled","model-value"])]),t.createElementVNode("label",aI,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.entity.discType")),1),t.createVNode(t.unref(te.BSSelect),{disabled:h.value,"model-value":E.value,items:u,"value-provider":m,"label-provider":p,"onUpdate:modelValue":k[10]||(k[10]=A=>A&&N(A))},null,8,["disabled","model-value"])]),t.createElementVNode("label",rI,[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:h.value,"model-value":(O=r.value.jpaAttrs)==null?void 0:O.discriminatorLength,"onUpdate:modelValue":k[11]||(k[11]=A=>g("discriminatorLength",A||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":w},null,8,["label","model-value"]),t.createElementVNode("div",{class:"em-check--block",title:t.unref(a).t("em.entity.referenceOnlyHint"),"data-ref-only-row":""},[t.createVNode(t.unref(te.BSCheckbox),{name:"ent-reference-only",class:"em-check",label:t.unref(a).t("em.entity.referenceOnly"),"model-value":!!r.value.referenceOnly,"onUpdate:modelValue":C},null,8,["label","model-value"])],8,lI),t.createElementVNode("fieldset",sI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.entity.headerColor")),1),t.createElementVNode("div",cI,[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:k[12]||(k[12]=A=>T(null))},"∅",10,dI),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),A=>(t.openBlock(),t.createElementBlock("button",{key:A,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":s.value===A}]),style:t.normalizeStyle({background:t.unref(jo)(A)}),title:t.unref(a).t(t.unref(mo)(A)),onClick:L=>T(A)},null,14,uI))),128))])])],64)):t.createCommentVNode("",!0)],8,Kw)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-81de178e"]]),mI=["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"],Mf=["inherit","true","false"],rr="__OWN__";function Vf(e,n){const o=t.computed(()=>e.state.logical.entities.find(K=>K.modelId===n())??null),i=t.computed(()=>{var K;return((K=o.value)==null?void 0:K.stereotype)==="JPA_EMBEDDABLE"}),a=t.computed(()=>new Set(e.selectedAttrIds.value));function r(K){return K==="none"?e.t("em.common.noneParen"):K}const l=K=>K;function s(K,le){o.value&&e.updateAttribute(o.value.modelId,K.modelId,le)}const c=t.computed(()=>Dr(e.state.logical.associations));function d(K){if(!o.value)return;const le=So(e.state.logical,o.value.modelId,K.modelId);return le&&ua(K,le)?le:void 0}function u(K){return!!d(K)}function m(K){return u(K)?K.derivedIdFieldName??"":K.name??""}function p(K){const le=d(K);if(!le)return e.t("em.attr.namePlaceholder");const Re=new Map(e.state.logical.entities.map(ke=>[ke.modelId,ke]));return rl({...K,derivedIdFieldName:void 0},le,Re)||e.t("em.attr.namePlaceholder")}function f(K,le){u(K)?s(K,{derivedIdFieldName:le||void 0}):s(K,{name:le})}function y(K){return K.name??""}function _(K,le){s(K,{name:le})}function g(K){return!!o.value&&Or(K,o.value,c.value)}function b(K){var ke,U;const le=(ke=K.derivedFrom)==null?void 0:ke.associationRef,Re=(U=o.value)==null?void 0:U.attributes.find(bt=>{var vt;return bt.attrType==="RELATION_OWN"&&((vt=bt.derivedFrom)==null?void 0:vt.associationRef)===le&&c.value.has(bt.modelId)});return e.t("em.attr.joinColumnOnlyNote",{anchor:(Re==null?void 0:Re.name)||e.t("em.attr.nameless")})}function E(K){return!!o.value&&!!So(e.state.logical,o.value.modelId,K.modelId)}function h(K,le){s(K,{naturalId:le||void 0,naturalIdMutable:le?K.naturalIdMutable:void 0})}function N(){return{naturalId:void 0,naturalIdMutable:void 0}}function w(K,le){s(K,{identifier:le,...le?N():{}})}function C(K,le){s(K,{transient:le||void 0,...le?N():{}})}function S(K){return!!K.transient||K.attrType==="RELATION_REF"}function V(K){return Wi(K)}function $(K,le=0){var Re;return((Re=Kn(K,o.value,e.state.logical.entities,e.state.logical.associations,le))==null?void 0:Re.physicalName)||void 0}const R=K=>K.value,x=K=>K.label;function T(K,le){if(!le)return;const Re=oe.value.find(ke=>ke.type===le);if(Re){const ke=K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"};s(K,{type:le,customType:void 0,dbAttrs:[{...ke,dataType:Re.dataType,length:Re.length,scale:Re.scale}]});return}s(K,le===hn?{type:le}:{type:le,customType:void 0})}function M(K,le){s(K,{customType:le.trim()===""?void 0:le})}function k(K,le){if(K.attrType==="RELATION_REF")return;const ke={...K.dbAttrs[0]??{modelId:K.modelId+".c",physicalName:K.name,dataType:"VARCHAR"},...le};le.dataType!==void 0&&!Kr.has(ke.dataType)&&(ke.scale=void 0),s(K,{dbAttrs:[ke]})}function v(K){var le;return Kr.has(((le=K.dbAttrs[0])==null?void 0:le.dataType)??"")}function I(K){return!v(K)&&!V(K)&&!S(K)?e.t("em.attr.scaleTypeHint"):void 0}function O(K,le){k(K,{logicalName:Object.keys(le).length?le:void 0})}function A(K,le){s(K,{description:Object.keys(le).length?le:void 0})}function L(K){return K.personalInfoAttributeType??"none"}function H(K,le){s(K,{personalInfoAttributeType:le==="none"?void 0:le})}const oe=t.computed(()=>e.predefinedCustomTypeCatalog.value),ue=t.computed(()=>e.embeddableCatalog.value);function be(K){var le,Re,ke;return((le=K.label)==null?void 0:le[e.userLanguage.value])??((Re=K.label)==null?void 0:Re.ko)??((ke=K.label)==null?void 0:ke.en)??K.type}const pe=t.computed(()=>e.groupCodeCatalog.value);function he(K){var le;return((le=pe.value.find(Re=>Re.groupCode===K.groupCode))==null?void 0:le.codes)??[]}function _e(K){return["none",...he(K)]}function ye(K){return K==="none"?"none":K.code}function Ae(K){var Re,ke,U;if(K==="none")return e.t("em.common.noneParen");const le=((Re=K.label)==null?void 0:Re[e.userLanguage.value])??((ke=K.label)==null?void 0:ke.ko)??((U=K.label)==null?void 0:U.en);return le?`${K.code} (${le})`:K.code}function Fe(K,le){o.value&&e.setAttributeGroupCode(o.value.modelId,K.modelId,le)}function se(K,le){s(K,{defaultValue:le==="none"?void 0:le})}function ne(K,le){s(K,{defaultValue:le.trim()===""?void 0:le})}function ae(K){return K.attrType.startsWith("EMBED")&&K.dbAttrs.length>0}const me=mn;function P(K){return ae(K)||me(K)}function D(K,le,Re){const ke=K.dbAttrs.map((U,bt)=>{if(bt!==le)return U;const vt={...U,...Re};for(const ot of Object.keys(Re))Re[ot]===void 0&&delete vt[ot];return vt});o.value&&e.setEmbedColumns(o.value.modelId,K.modelId,ke)}function z(K,le,Re){D(K,le,{logicalName:Object.keys(Re).length?Re:void 0})}function Q(K,le){var U,bt,vt;if(me(K)){const ot=Kn(K,o.value,e.state.logical.entities,e.state.logical.associations,le);return ot?{physicalName:ot.physicalName,dataType:ot.dataType,length:ot.length,scale:ot.scale,logicalName:ot.logicalName}:void 0}if(K.attrType==="EMBED_PREDEF"){const ot=(U=e.embeddableCatalog.value.find(Ge=>Ge.type===K.type))==null?void 0:U.fields[le];return ot?{name:ot.name,physicalName:ot.physicalName,dataType:ot.dataType,length:ot.length,scale:ot.scale,shareable:ot.shareable,logicalName:ot.logicalName}:void 0}const Re=(bt=K.embedded)==null?void 0:bt.embeddableRef;if(!Re)return;const ke=(vt=e.state.logical.entities.find(ot=>ot.modelId===Re))==null?void 0:vt.attributes.flatMap(ot=>ot.dbAttrs)[le];return ke?{physicalName:ke.physicalName,dataType:ke.dataType,length:ke.length,scale:ke.scale,logicalName:ke.logicalName}:void 0}function ee(K,le){var Re,ke;return((Re=Q(K,le))==null?void 0:Re.dataType)||((ke=K.dbAttrs[le])==null?void 0:ke.dataType)||""}function we(K,le){var Re,ke;return((Re=Q(K,le))==null?void 0:Re.length)??((ke=K.dbAttrs[le])==null?void 0:ke.length)}function de(K,le){var Re,ke;return((Re=Q(K,le))==null?void 0:Re.scale)??((ke=K.dbAttrs[le])==null?void 0:ke.scale)}function xe(K){return e.t(me(K)?"em.attr.fkFixedHint":"em.attr.embedFixedHint")}const Ce=Mf;function Y(K){return K==="inherit"?e.t("em.common.inherit"):K}function X(K){return(K==null?void 0:K.updatable)===void 0?"inherit":K.updatable?"true":"false"}function q(K,le,Re){D(K,le,{updatable:Re==="inherit"?void 0:Re==="true"})}function Ie(K,le){k(K,{updatable:le==="inherit"?void 0:le==="true"})}const Be=Mf;function ze(K){return K==="inherit"?e.t("em.common.inherit"):K}function Ue(K){return(K==null?void 0:K.insertable)===void 0?"inherit":K.insertable?"true":"false"}function ie(K,le,Re){D(K,le,{insertable:Re==="inherit"?void 0:Re==="true"})}function Se(K,le){k(K,{insertable:le==="inherit"?void 0:le==="true"})}const je=t.computed(()=>o.value?Lr(o.value,e.state.logical.entities):[]),Ze=t.computed(()=>ko(je.value.flatMap(K=>K.attributes.flatMap(le=>le.dbAttrs)))),J=t.computed(()=>je.value.flatMap(K=>K.attributes.filter(le=>le.attrType==="NORMAL"&&le.dbAttrs.length===1&&le.dbAttrs[0]).map(le=>{var Re;return{modelId:le.dbAttrs[0].modelId,physical:le.dbAttrs[0].physicalName||le.name,isCurrency:le.type==="Currency",ownerName:K.modelId===((Re=o.value)==null?void 0:Re.modelId)?void 0:K.name}})));function re(){const K=[...J.value].sort((le,Re)=>Number(Re.isCurrency)-Number(le.isCurrency));return[rr,...K.map(le=>le.modelId)]}function Ke(K){if(K===rr)return e.t("em.attr.sharedOwn");const le=J.value.find(ke=>ke.modelId===K);if(!le)return K;const Re=le.ownerName?`${le.ownerName}.`:"";return e.t("em.attr.sharedRef",{owner:Re,physical:le.physical,mode:le.isCurrency?e.t("em.attr.currencyMode"):e.t("em.attr.sharedMode")})}function st(K){return(K==null?void 0:K.sharedColumnRef)??rr}function qe(K,le,Re){D(K,le,{sharedColumnRef:Re===rr?void 0:Re})}function nt(K){return(K==null?void 0:K.sharedColumnRef)!=null}function We(K){var le;return((le=Gn(K,Ze.value))==null?void 0:le.physicalName)??""}return{entity:o,isEmbeddable:i,focusedAttrIds:a,personalInfoItems:mI,piiLabel:r,idn:l,setAttr:s,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:p,setRowName:f,assocFieldName:y,setAssocFieldName:_,nameLocked:g,nameLockedHint:b,isManagedFk:E,setNaturalId:h,clearNaturalIdPatch:N,setIdentifier:w,setTransient:C,dbLocked:S,fkDerived:V,fkOriginPhysical:$,typeValueOf:R,typeLabelOf:x,setAttrType:T,setAttrCustomType:M,setDb:k,scaleApplicable:v,scaleHint:I,setDbLogical:O,setAttrDescription:A,attrPiiValue:L,setAttrPii:H,predefinedCustomTypeCatalog:oe,embeddableCatalog:ue,predefinedLabel:be,groupCodeCatalog:pe,attrGroupCodes:he,attrCodeItems:_e,codeValueOf:ye,codeLabelOf:Ae,setAttrGroupCode:Fe,setAttrCode:se,setAttrDefaultValue:ne,isEmbedExpanded:ae,isMultiColFk:me,hasColumnSlots:P,setDbAt:D,setDbLogicalAt:z,colSlotMeta:Q,fixedDataType:ee,fixedLength:we,fixedScale:de,slotFixedHint:xe,updatableItems:Ce,updatableLabel:Y,updatableValue:X,setUpdatableAt:q,setUpdatable:Ie,insertableItems:Be,insertableLabel:ze,insertableValue:Ue,setInsertableAt:ie,setInsertable:Se,scopeEntities:je,columnsById:Ze,sharedCandidates:J,sharedItems:re,sharedLabel:Ke,sharedValue:st,setSharedAt:qe,isShared:nt,sharedPhysical:We}}const Bf={"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.referenceOnly":"Reference only (not a generation or validation target)","em.entity.referenceOnlyHint":"For entities that are not deliverables — background material, scratch drafts. No DDL, Java code or mermaid is generated and validation skips them (they stay in the AI input text). Different from a group’s “Exclude from DDL generation”, which is for real tables owned by another service and still generates Java classes.","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.fkFixedHint":"Inherited from the parent PK column — its shape follows the parent.","em.attr.embedSharedHint":"Currency column shared with another column — derived from the target (read-only).","em.attr.derivedIdField":"Derived @Id field","em.attr.assocField":"Association field (@MapsId)","em.attr.derivedIdNote":"This attribute emits **two Java fields** — the name box above is the scalar @Id field (leave empty to derive it from the parent PK column), and this is the @MapsId association field. The same value is also editable from the relationship inspector.","em.attr.joinColumnOnlyNote":"Sibling column of a composite foreign key — JPA emits one field per association, so this name is never generated. Edit the field name on «{anchor}».","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.fkChildCols":"Composite foreign key — {n} 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.derivedIdRow":"Scalar @Id field emitted by a derived identifier (@MapsId). The model stores a single association attribute; edit it from that attribute’s inspector.","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 sub-column in this entity","em.node.embedAllShow":"Expand all collapsed sub-columns","em.node.embedAllSummary":"{n} sub-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.toolbar.referenceOnlyBadge":"Reference-only document","em.toolbar.referenceOnlyDocHint":"This entire document is not a generation or validation target. DDL, Java and mermaid exports come out empty and no validation signals appear — because it is out of scope, not because the model is empty (it stays in the AI input text). The dashed node borders on the canvas mean the same thing.","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.type7":"The Java type ({type}) and the column type ({dataType}) are not compatible — the codegen field and the DDL column are emitted with different types","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"},Df={"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.referenceOnly":"参考専用(生成・検証の対象外)","em.entity.referenceOnlyHint":"成果物ではないエンティティ(理解のための資料・テスト下書きなど)。DDL・Java コード・mermaid を生成せず、検証の対象からも外れます(AI 入力テキストには残ります)。グループの「DDL 生成から除外」とは別です — あちらは他サービスが所有する実在テーブル向けで、Java クラスは生成され続けます。","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.fkFixedHint":"親のPKカラムから継承された値です — 形状は親に従います。","em.attr.embedSharedHint":"他のカラムと共有する通貨カラムです — 対象から派生(読み取り専用)。","em.attr.derivedIdField":"派生識別 @Id フィールド","em.attr.assocField":"関連フィールド名(@MapsId)","em.attr.derivedIdNote":"この属性は**2つの Java フィールド**を出力します — 上の名前欄はスカラー @Id のフィールド名(空欄なら親 PK の物理名から派生)で、こちらは @MapsId 関連フィールド名です。同じ値は関連線のインスペクタからも編集できます。","em.attr.joinColumnOnlyNote":"複合外部キーの兄弟カラムです — JPAのフィールドは関連ごとに1つだけなので、この名前は出力されません。フィールド名は«{anchor}»で編集してください。","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.fkChildCols":"複合外部キー — カラム {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.derivedIdRow":"派生識別(@MapsId)が出力するスカラー @Id フィールドです — モデルには関連属性ひとつとして保存され、編集はその属性のインスペクタで行います。","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.toolbar.referenceOnlyBadge":"参考専用ドキュメント","em.toolbar.referenceOnlyDocHint":"このドキュメント全体が生成・検証の対象ではありません。DDL・Java・mermaid の書き出しは空になり検証シグナルも出ません — モデルが空だからではなく対象外だからです(AI 入力テキストには残ります)。キャンバスの破線枠も同じ意味です。","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.type7":"Java型({type})とカラム型({dataType})が互換ではありません — コード生成のフィールドと 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":"未指定"},Of={"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.referenceOnly":"참고 전용 (산출·검증 대상 외)","em.entity.referenceOnlyHint":"문서 이해용 자료·테스트 초안 등 산출물이 아닌 엔티티. DDL·Java 코드·mermaid 를 생성하지 않고 검증 대상에서도 빠집니다(AI 입력 텍스트에는 남습니다). 그룹의 「DDL 생성 제외」와 다릅니다 — 그쪽은 타 서비스가 소유한 실재 테이블용으로 Java 클래스는 계속 생성됩니다.","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.fkFixedHint":"부모 PK 컬럼에서 상속된 값입니다 — 형상은 부모를 따릅니다.","em.attr.embedSharedHint":"다른 컬럼과 공유하는 통화 컬럼입니다 — 대상에서 파생(읽기 전용).","em.attr.derivedIdField":"파생 식별 @Id 필드","em.attr.assocField":"연관 필드명(@MapsId)","em.attr.derivedIdNote":"이 속성은 **두 Java 필드**를 냅니다 — 위 이름 칸은 스칼라 @Id 필드명(비우면 부모 PK 물리명에서 파생)이고, 여기는 @MapsId 연관 필드명입니다. 같은 값을 관계선 인스펙터에서도 편집할 수 있습니다.","em.attr.joinColumnOnlyNote":"복합 외래키의 형제 컬럼입니다 — JPA 필드는 관계당 하나뿐이라 이 이름은 방출되지 않습니다. 필드명은 «{anchor}»에서 편집하세요.","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.fkChildCols":"복합 외래키 — 컬럼 {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.derivedIdRow":"파생 식별(@MapsId)이 방출하는 스칼라 @Id 필드입니다 — 모델에는 연관 속성 하나로 저장되며, 편집은 그 속성의 인스펙터에서 합니다.","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.toolbar.referenceOnlyBadge":"참고 전용 문서","em.toolbar.referenceOnlyDocHint":"이 문서 전체가 산출·검증 대상이 아닙니다. DDL·Java 코드·mermaid 내보내기가 비고 검증 신호도 나오지 않습니다 — 모델이 비어서가 아니라 대상 외이기 때문입니다(AI 입력 텍스트에는 남습니다). 캔버스의 파선 테두리가 같은 뜻입니다.","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.type7":"자바 타입({type})과 컬럼 타입({dataType})이 호환되지 않습니다 — 코드젠 필드와 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":"미지정"},fI=["ko","en","ja"],ys={ko:Of,en:Bf,ja:Df};function qt(e,n,o){let a=(ys[e]??ys.ko)[n]??ys.ko[n]??n;return o&&(a=a.replace(/\{(\w+)\}/g,(r,l)=>l in o?String(o[l]):r)),a}const Lf=["ko","en","ja","zh"];function pI(e){if(e)for(const n of Lf){const o=e[n];if(o)return o}}function gs(e){const n=pI(e.label);return n?`${e.groupCode} (${n})`:e.groupCode}function hI(e,n){const o=n.trim().toLowerCase();return o?e.filter(i=>i.groupCode.toLowerCase().includes(o)?!0:Lf.some(a=>{var r,l;return(l=(r=i.label)==null?void 0:r[a])==null?void 0:l.toLowerCase().includes(o)})):e}const yI=["aria-expanded","placeholder"],gI=["aria-selected","onClick","onMouseenter"],bI={key:0,class:"gcc__opt gcc__opt--empty"},Pf=tt(t.defineComponent({__name:"GroupCodeCombobox",props:{modelValue:{},items:{},locale:{}},emits:["update:modelValue"],setup(e,{emit:n}){const o=e,i=n,a=($,R)=>qt(o.locale??"ko",$,R),r=t.ref(),l=t.ref(),s=t.ref(),c=t.ref(""),d=t.ref(!1),u=t.ref(-1),m=t.ref({}),p=t.computed(()=>o.items.find($=>$.groupCode===o.modelValue)),f=t.computed(()=>p.value?gs(p.value):"");t.watch(f,$=>{d.value||(c.value=$)},{immediate:!0});const y=t.computed(()=>c.value===f.value?o.items:hI(o.items,c.value));function _(){var R;const $=(R=r.value)==null?void 0:R.getBoundingClientRect();$&&(m.value={left:`${$.left}px`,top:`${$.bottom}px`,width:`${$.width}px`})}function g(){d.value=!0,_(),u.value=Math.max(0,y.value.findIndex($=>$.groupCode===o.modelValue)),window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),document.addEventListener("mousedown",V)}function b(){d.value=!1,window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_),document.removeEventListener("mousedown",V)}t.onBeforeUnmount(b);function E(){g(),t.nextTick(()=>{var $;return($=l.value)==null?void 0:$.select()})}function h(){d.value||g(),u.value=0}function N($){i("update:modelValue",$.groupCode),c.value=gs($),b()}function w(){i("update:modelValue",void 0),c.value="",b()}function C(){c.value.trim()===""?w():(c.value=f.value,b())}function S($){var R;if($.key==="ArrowDown")d.value||g(),u.value=Math.min(u.value+1,y.value.length-1),$.preventDefault();else if($.key==="ArrowUp")u.value=Math.max(u.value-1,0),$.preventDefault();else if($.key==="Enter"){const x=y.value[u.value];x&&N(x),$.preventDefault()}else $.key==="Escape"&&(c.value=f.value,b(),(R=l.value)==null||R.blur())}function V($){var x,T;const R=$.target;!((x=r.value)!=null&&x.contains(R))&&!((T=s.value)!=null&&T.contains(R))&&C()}return($,R)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"root",ref:r,class:"gcc"},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:l,"onUpdate:modelValue":R[0]||(R[0]=x=>c.value=x),class:"gcc__input",type:"text",role:"combobox",autocomplete:"off","aria-expanded":d.value,placeholder:a("em.groupCode.searchPlaceholder"),onFocus:E,onInput:h,onKeydown:S},null,40,yI),[[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:R[1]||(R[1]=t.withModifiers(()=>{},["prevent"])),onClick:w},t.toDisplayString(a("em.common.noneParen")),33),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,(x,T)=>(t.openBlock(),t.createElementBlock("li",{key:x.groupCode,class:t.normalizeClass(["gcc__opt",{"is-active":T===u.value,"is-selected":x.groupCode===e.modelValue}]),role:"option","aria-selected":x.groupCode===e.modelValue,onMousedown:R[2]||(R[2]=t.withModifiers(()=>{},["prevent"])),onClick:M=>N(x),onMouseenter:M=>u.value=T},t.toDisplayString(t.unref(gs)(x)),43,gI))),128)),y.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",bI,t.toDisplayString(a("em.groupCode.noMatch")),1))],4)):t.createCommentVNode("",!0)]))],512))}}),[["__scopeId","data-v-431f9333"]]),_I=["aria-labelledby"],kI=["aria-checked","tabindex","onClick","onKeydown"],zf=tt(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,kI))),128))],8,_I))}}),[["__scopeId","data-v-5c793bbb"]]),EI=["disabled"],NI={class:"em-aw__toolbar"},wI={class:"em-aw__count"},II={class:"em-aw__scroll"},vI={class:"em-aw__table"},CI={class:"c-name"},SI={class:"c-type"},xI={class:"c-logical"},RI=["id"],AI={class:"c-col"},$I={class:"c-constraints"},TI={class:"c-del"},MI={class:"c-expand"},VI=["title","onClick","onKeydown"],BI=["title"],DI=["title"],OI={key:1,class:"em-aw__muted"},LI=["title"],PI=["title"],zI=["title"],FI={class:"em-aw__cflags"},UI=["title"],HI={key:0,class:"em-aw__embed-col"},jI={class:"em-aw__embed-label"},KI=["title"],GI={colspan:"8"},YI={class:"em-aw__detail"},qI={class:"em-aw__dgroup"},WI=["title"],JI={class:"em-aw__df"},XI={class:"em-aw__df"},ZI={class:"em-aw__dgroup"},QI={key:0,class:"em-aw__dgroup"},ev={class:"em-aw__df"},tv={key:0,class:"em-aw__df"},nv={class:"em-aw__df"},ov={class:"em-aw__dgroup em-aw__ddesc"},iv={class:"c-expand"},av=["title","onClick","onKeydown"],rv={key:1,class:"em-aw__caret is-static","aria-hidden":"true"},lv=["title"],sv=["title"],cv=["colspan"],dv=["title"],uv={class:"em-aw__cflags"},mv=["title"],fv={colspan:"8"},pv={class:"em-aw__detail"},hv={class:"em-aw__dgroup em-aw__ddesc"},yv={class:"c-expand"},gv=["title","onClick","onKeydown"],bv={class:"em-aw__embed-label"},_v=["title"],kv=["title"],Ev={class:"em-aw__ro"},Nv=["title"],wv={class:"em-aw__ro"},Iv=["title"],vv={class:"em-aw__ro"},Cv={key:0,class:"em-aw__detail-row em-aw__embed-detail"},Sv={colspan:"8"},xv={class:"em-aw__detail"},Rv={class:"em-aw__dgroup"},Av={key:0,class:"em-aw__df"},$v={class:"em-aw__df"},Tv={class:"em-aw__df"},Mv={key:0},Vv={colspan:"99",class:"em-aw__empty"},Bv=6,Ff=5,Dv=tt(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,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:p,setRowName:f,assocFieldName:y,setAssocFieldName:_,nameLocked:g,nameLockedHint:b,isManagedFk:E,setNaturalId:h,setIdentifier:N,setTransient:w,dbLocked:C,fkDerived:S,fkOriginPhysical:V,typeValueOf:$,typeLabelOf:R,setAttrType:x,setAttrCustomType:T,setDb:M,scaleApplicable:k,scaleHint:v,setDbLogical:I,attrPiiValue:O,setAttrPii:A,predefinedCustomTypeCatalog:L,embeddableCatalog:H,predefinedLabel:oe,groupCodeCatalog:ue,attrGroupCodes:be,attrCodeItems:pe,codeValueOf:he,codeLabelOf:_e,setAttrGroupCode:ye,setAttrCode:Ae,setAttrDefaultValue:Fe,setAttrDescription:se,hasColumnSlots:ne,isMultiColFk:ae,setDbAt:me,setDbLogicalAt:P,colSlotMeta:D,fixedDataType:z,fixedLength:Q,fixedScale:ee,slotFixedHint:we,updatableItems:de,updatableLabel:xe,updatableValue:Ce,setUpdatableAt:Y,setUpdatable:X,insertableItems:q,insertableLabel:Ie,insertableValue:Be,setInsertableAt:ze,setInsertable:Ue,sharedItems:ie,sharedLabel:Se,sharedValue:je,setSharedAt:Ze,isShared:J,sharedPhysical:re}=Vf(o,()=>n.entityId),Ke=t.computed(()=>{var Re;return[...((Re=i.value)==null?void 0:Re.attributes)??[]].sort((ke,U)=>ke.order-U.order)}),st=t.computed(()=>{var Re;return(((Re=i.value)==null?void 0:Re.attributes)??[]).filter(ke=>ke.attrType!=="DIVIDER").length}),qe=t.ref(new Set);function nt(Re){return qe.value.has(Re)}function We(Re){const ke=new Set(qe.value);ke.has(Re)?ke.delete(Re):ke.add(Re),qe.value=ke}const K=t.ref(o.userLanguage.value);function le(Re){!Re||!i.value||o.addPredefinedEmbed(i.value.modelId,Re)}return(Re,ke)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-aw",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",NI,[t.createElementVNode("span",wI,t.toDisplayString(t.unref(o).t("em.attr.section",{n:st.value})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:ke[0]||(ke[0]=U=>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:ke[1]||(ke[1]=U=>t.unref(o).addDivider(t.unref(i).modelId))},null,8,["caption"]),t.unref(H).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(H),"value-provider":U=>U.type,"label-provider":t.unref(oe),"onUpdate:modelValue":le},null,8,["placeholder","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",II,[t.createElementVNode("table",vI,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[ke[3]||(ke[3]=t.createElementVNode("th",{class:"c-expand"},null,-1)),t.createElementVNode("th",CI,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),t.createElementVNode("th",SI,t.toDisplayString(t.unref(o).t("em.attr.typePlaceholder")),1),t.createElementVNode("th",xI,[t.createElementVNode("span",{id:`aw-logical-head-${t.unref(i).modelId}`},t.toDisplayString(t.unref(o).t("em.attr.logicalPlaceholder")),9,RI),t.createVNode(zf,{modelValue:K.value,"onUpdate:modelValue":ke[2]||(ke[2]=U=>K.value=U),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",AI,t.toDisplayString(t.unref(o).t("em.attr.columnPhysical")),1),ke[4]||(ke[4]=t.createElementVNode("th",{class:"c-dtype"},"dataType",-1)),ke[5]||(ke[5]=t.createElementVNode("th",{class:"c-len"},"len",-1)),t.createElementVNode("th",$I,t.toDisplayString(t.unref(o).t("em.attr.constraints")),1),ke[6]||(ke[6]=t.createElementVNode("th",{class:"c-del"},null,-1))])]),t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ke.value,U=>{var bt,vt,ot,Ge,Xe,Z,Rt,$t,Sn,At;return t.openBlock(),t.createElementBlock(t.Fragment,{key:U.modelId},[U.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__divider-row",{"is-focused":t.unref(r).has(U.modelId)}])},[ke[7]||(ke[7]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-divlabel-${U.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.dividerLabelPlaceholder"),"model-value":U.name,"onUpdate:modelValue":ge=>t.unref(d)(U,{name:ge})},null,8,["name","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{colspan:Bv,class:"em-aw__divider-note"},t.toDisplayString(t.unref(o).t("em.attr.dividerNote")),1),t.createElementVNode("td",TI,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,U.modelId)},null,8,["onClick"])])],2)):t.unref(ne)(U)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-parent",{"is-focused":t.unref(r).has(U.modelId)}])},[t.createElementVNode("td",iv,[t.unref(ae)(U)?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["em-aw__caret",{"is-open":nt(U.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(nt(U.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>We(U.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>We(U.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>We(U.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,av)):(t.openBlock(),t.createElementBlock("span",rv,[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})]))]),t.createElementVNode("td",{title:t.unref(g)(U)?t.unref(b)(U):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${U.modelId}`,width:"100%",disabled:t.unref(g)(U),placeholder:t.unref(p)(U),"model-value":t.unref(m)(U),"onUpdate:modelValue":ge=>t.unref(f)(U,ge)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,lv),t.createElementVNode("td",{title:t.unref(S)(U)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-type-${U.modelId}`,width:"100%",disabled:"","model-value":U.type},null,8,["name","model-value"])],8,sv),t.createElementVNode("td",{colspan:t.unref(ae)(U)?Ff-1:Ff,class:"em-aw__embed-note"},t.toDisplayString(t.unref(ae)(U)?t.unref(o).t("em.attr.fkChildCols",{n:U.dbAttrs.length}):t.unref(o).t("em.attr.embedChildCols",{n:U.dbAttrs.length})),9,cv),t.unref(ae)(U)?(t.openBlock(),t.createElementBlock("td",{key:0,class:"c-constraints",title:t.unref(o).t("em.attr.fkDerivedNote")},[t.createElementVNode("div",uv,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${U.modelId}`,label:"PK","model-value":U.identifier,disabled:"","onUpdate:modelValue":ge=>t.unref(N)(U,ge)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${U.modelId}`,label:"NN","model-value":U.notNull,disabled:"","onUpdate:modelValue":ge=>t.unref(d)(U,{notNull:ge})},null,8,["name","model-value","onUpdate:modelValue"])])],8,dv)):t.createCommentVNode("",!0),t.createElementVNode("td",{class:"c-del",title:t.unref(E)(U)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,U.modelId)},null,8,["onClick"])],8,mv)],2),t.unref(ae)(U)&&nt(U.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(U.modelId)}])},[ke[15]||(ke[15]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",fv,[t.createElementVNode("div",pv,[t.createElementVNode("fieldset",hv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`aw-desc-${U.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":U.description,"onUpdate:modelValue":ge=>t.unref(se)(U,ge)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])])])],2)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(U.dbAttrs,(ge,ft)=>{var xn,Zt,B,F,j,fe,Te,Oe;return t.openBlock(),t.createElementBlock(t.Fragment,{key:ge.modelId},[t.createElementVNode("tr",{class:t.normalizeClass(["em-aw__embed-col",{"em-aw__open":nt(ge.modelId)}])},[t.createElementVNode("td",yv,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":nt(ge.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(nt(ge.modelId)?"em.attr.overrideCollapse":"em.attr.overrideExpand"),onClick:ce=>We(ge.modelId),onKeydown:[t.withKeys(t.withModifiers(ce=>We(ge.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ce=>We(ge.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,gv)]),t.createElementVNode("td",bv,"↳ "+t.toDisplayString(((xn=t.unref(D)(U,ft))==null?void 0:xn.name)??((Zt=t.unref(D)(U,ft))==null?void 0:Zt.physicalName)??t.unref(o).t("em.attr.colFallback",{n:ft+1})),1),ke[16]||(ke[16]=t.createElementVNode("td",null,null,-1)),t.createElementVNode("td",null,[t.createVNode(Yt,{name:`aw-embed-logical-${ge.modelId}`,languages:t.unref(o).languages.value,"active-lang":K.value,placeholder:((F=(B=t.unref(D)(U,ft))==null?void 0:B.logicalName)==null?void 0:F[K.value])??((fe=(j=t.unref(D)(U,ft))==null?void 0:j.logicalName)==null?void 0:fe.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":ge.logicalName,"onUpdate:modelValue":ce=>t.unref(P)(U,ft,ce)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",{title:t.unref(J)(ge)?t.unref(o).t("em.attr.embedSharedHint"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-embed-col-${ge.modelId}`,width:"100%",disabled:t.unref(J)(ge),placeholder:((Te=t.unref(D)(U,ft))==null?void 0:Te.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(J)(ge)?t.unref(re)(ge):ge.physicalName,"onUpdate:modelValue":ce=>t.unref(me)(U,ft,{physicalName:ce})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(fo,{controller:t.unref(o),"ref-id":ge.modelId},null,8,["controller","ref-id"])],8,_v),t.createElementVNode("td",{title:t.unref(we)(U)},[t.createElementVNode("span",Ev,t.toDisplayString(t.unref(z)(U,ft)),1)],8,kv),t.createElementVNode("td",{title:t.unref(we)(U)},[t.createElementVNode("span",wv,t.toDisplayString(t.unref(Q)(U,ft)??""),1)],8,Nv),t.createElementVNode("td",{class:"c-constraints",title:t.unref(we)(U)},[t.createElementVNode("span",vv,t.toDisplayString(t.unref(ee)(U,ft)!=null?`scale ${t.unref(ee)(U,ft)}`:""),1)],8,Iv),ke[17]||(ke[17]=t.createElementVNode("td",null,null,-1))],2),nt(ge.modelId)?(t.openBlock(),t.createElementBlock("tr",Cv,[ke[20]||(ke[20]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",Sv,[t.createElementVNode("div",xv,[t.createElementVNode("fieldset",Rv,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.overrideLegend")),1),(Oe=t.unref(D)(U,ft))!=null&&Oe.shareable?(t.openBlock(),t.createElementBlock("label",Av,[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(je)(ge),items:t.unref(ie)(),"value-provider":t.unref(c),"label-provider":t.unref(Se),"onUpdate:modelValue":ce=>ce&&t.unref(Ze)(U,ft,ce)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",$v,[ke[18]||(ke[18]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(J)(ge),"model-value":t.unref(J)(ge)?"false":t.unref(Be)(ge),items:t.unref(q),"value-provider":t.unref(c),"label-provider":t.unref(Ie),"onUpdate:modelValue":ce=>ce&&t.unref(ze)(U,ft,ce)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",Tv,[ke[19]||(ke[19]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(J)(ge),"model-value":t.unref(J)(ge)?"false":t.unref(Ce)(ge),items:t.unref(de),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":ce=>ce&&t.unref(Y)(U,ft,ce)},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(U.modelId),"em-aw__open":nt(U.modelId)})},[t.createElementVNode("td",MI,[t.createElementVNode("span",{class:t.normalizeClass(["em-aw__caret",{"is-open":nt(U.modelId)}]),role:"button",tabindex:"0",title:t.unref(o).t(nt(U.modelId)?"em.attr.detailCollapse":"em.attr.detailExpand"),onClick:ge=>We(U.modelId),onKeydown:[t.withKeys(t.withModifiers(ge=>We(U.modelId),["prevent"]),["enter"]),t.withKeys(t.withModifiers(ge=>We(U.modelId),["prevent"]),["space"])]},[t.createVNode(Ve,{name:"chevron",size:14,class:"em-aw__caret-ic"})],42,VI)]),t.createElementVNode("td",{title:t.unref(g)(U)?t.unref(b)(U):t.unref(u)(U)?t.unref(o).t("em.attr.derivedIdNote"):void 0},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-name-${U.modelId}`,width:"100%",disabled:t.unref(g)(U),placeholder:t.unref(p)(U),"model-value":t.unref(m)(U),"onUpdate:modelValue":ge=>t.unref(f)(U,ge)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])],8,BI),t.createElementVNode("td",{title:t.unref(S)(U)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-type-${U.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:!!U.groupCode||U.attrType==="RELATION_REF"||t.unref(S)(U),items:t.unref(_c)(U.type,t.unref(L)),"value-provider":t.unref($),"label-provider":t.unref(R),"model-value":U.type,"onUpdate:modelValue":ge=>t.unref(x)(U,ge)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),U.type===t.unref(hn)&&!t.unref(S)(U)?(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:0,name:`aw-customtype-${U.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":U.customType??"","onUpdate:modelValue":ge=>t.unref(T)(U,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])):t.createCommentVNode("",!0)],8,DI),t.createElementVNode("td",null,[U.attrType!=="RELATION_REF"?(t.openBlock(),t.createBlock(Yt,{key:0,name:`aw-logical-${U.modelId}`,languages:t.unref(o).languages.value,"active-lang":K.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(bt=U.dbAttrs[0])==null?void 0:bt.logicalName,"onUpdate:modelValue":ge=>t.unref(I)(U,ge)},null,8,["name","languages","active-lang","placeholder","model-value","onUpdate:modelValue"])):(t.openBlock(),t.createElementBlock("span",OI,"—"))]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSTextInput),{name:`aw-col-${U.modelId}`,width:"100%",placeholder:t.unref(V)(U)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(C)(U),"model-value":((vt=U.dbAttrs[0])==null?void 0:vt.physicalName)??"","onUpdate:modelValue":ge=>t.unref(M)(U,{physicalName:ge})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(fo,{controller:t.unref(o),"ref-id":(ot=U.dbAttrs[0])==null?void 0:ot.modelId},null,8,["controller","ref-id"])]),t.createElementVNode("td",{title:t.unref(S)(U)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSSelect),{name:`aw-dtype-${U.modelId}`,width:"100%",placeholder:"dataType",disabled:t.unref(C)(U)||t.unref(S)(U),items:t.unref(yc)(((Ge=U.dbAttrs[0])==null?void 0:Ge.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(jr),"model-value":((Xe=U.dbAttrs[0])==null?void 0:Xe.dataType)??"","onUpdate:modelValue":ge=>ge&&t.unref(M)(U,{dataType:ge})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"])],8,LI),t.createElementVNode("td",{title:t.unref(S)(U)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createVNode(t.unref(te.BSNumberInput),{name:`aw-len-${U.modelId}`,width:"100%",placeholder:"len",disabled:t.unref(C)(U)||t.unref(S)(U),"model-value":(Z=U.dbAttrs[0])==null?void 0:Z.length,"onUpdate:modelValue":ge=>t.unref(M)(U,{length:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,PI),t.createElementVNode("td",{class:"c-constraints",title:t.unref(S)(U)?t.unref(o).t("em.attr.fkDerivedNote"):void 0},[t.createElementVNode("div",FI,[t.createVNode(t.unref(te.BSCheckbox),{name:`aw-pk-${U.modelId}`,label:"PK","model-value":U.identifier,disabled:t.unref(a)||t.unref(C)(U)||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(N)(U,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nn-${U.modelId}`,label:"NN","model-value":U.notNull,disabled:t.unref(C)(U)||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(d)(U,{notNull:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-uq-${U.modelId}`,label:"UQ","model-value":!!((Rt=U.dbAttrs[0])!=null&&Rt.unique),disabled:t.unref(C)(U)||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(M)(U,{unique:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"])])],8,zI),t.createElementVNode("td",{class:"c-del",title:t.unref(E)(U)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:ge=>t.unref(o).removeAttribute(t.unref(i).modelId,U.modelId)},null,8,["onClick"])],8,UI)],2),t.unref(u)(U)?(t.openBlock(),t.createElementBlock("tr",HI,[ke[8]||(ke[8]=t.createElementVNode("td",{class:"c-expand"},null,-1)),t.createElementVNode("td",jI,"↳ "+t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("td",{colspan:"7",title:t.unref(o).t("em.attr.derivedIdNote")},[t.createVNode(t.unref(te.BSTextInput),{name:`aw-assocname-${U.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(y)(U),"onUpdate:modelValue":ge=>t.unref(_)(U,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])],8,KI)])):t.createCommentVNode("",!0),nt(U.modelId)?(t.openBlock(),t.createElementBlock("tr",{key:1,class:t.normalizeClass(["em-aw__detail-row",{"is-focused":t.unref(r).has(U.modelId)}])},[ke[14]||(ke[14]=t.createElementVNode("td",{class:"em-aw__detail-gutter"},null,-1)),t.createElementVNode("td",GI,[t.createElementVNode("div",YI,[t.createElementVNode("fieldset",qI,[ke[12]||(ke[12]=t.createElementVNode("legend",null,"DB",-1)),t.createElementVNode("label",{class:"em-aw__df",title:t.unref(v)(U)},[ke[9]||(ke[9]=t.createElementVNode("span",null,"scale",-1)),t.createVNode(t.unref(te.BSNumberInput),{name:`aw-scale-${U.modelId}`,width:"72px",placeholder:"scale",disabled:t.unref(C)(U)||t.unref(S)(U)||!t.unref(k)(U),"model-value":($t=U.dbAttrs[0])==null?void 0:$t.scale,"onUpdate:modelValue":ge=>t.unref(M)(U,{scale:ge||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,WI),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-ai-${U.modelId}`,label:"Auto Increment","model-value":!!((Sn=U.dbAttrs[0])!=null&&Sn.autoIncrement),disabled:t.unref(C)(U)||t.unref(S)(U)||!U.identifier,"onUpdate:modelValue":ge=>t.unref(M)(U,{autoIncrement:ge})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createElementVNode("label",JI,[ke[10]||(ke[10]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-ins-${U.modelId}`,width:"110px",disabled:t.unref(C)(U),"model-value":t.unref(Be)(U.dbAttrs[0]),items:t.unref(q),"value-provider":t.unref(c),"label-provider":t.unref(Ie),"onUpdate:modelValue":ge=>ge&&t.unref(Ue)(U,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",XI,[ke[11]||(ke[11]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{name:`aw-upd-${U.modelId}`,width:"110px",disabled:t.unref(C)(U),"model-value":t.unref(Ce)(U.dbAttrs[0]),items:t.unref(de),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":ge=>ge&&t.unref(X)(U,ge)},null,8,["name","disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])]),t.createElementVNode("fieldset",ZI,[ke[13]||(ke[13]=t.createElementVNode("legend",null,"JPA",-1)),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-tr-${U.modelId}`,label:"@Transient","model-value":!!U.transient,disabled:U.identifier||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(w)(U,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-nid-${U.modelId}`,label:"@NaturalId","model-value":!!U.naturalId,disabled:U.identifier||t.unref(C)(U)||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(h)(U,ge)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-aw__dsub",name:`aw-nidm-${U.modelId}`,label:"mutable","model-value":!!U.naturalIdMutable,disabled:t.unref(C)(U)||!U.naturalId,"onUpdate:modelValue":ge=>t.unref(d)(U,{naturalIdMutable:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`aw-mv-${U.modelId}`,label:"Multi-Value (Set)","model-value":!!((At=U.dbAttrs[0])!=null&&At.multiValue),disabled:t.unref(C)(U)||t.unref(S)(U),"onUpdate:modelValue":ge=>t.unref(M)(U,{multiValue:ge||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.unref(S)(U)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("fieldset",QI,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.attr.semanticLegend")),1),t.createElementVNode("label",ev,[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(O)(U),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":ge=>ge&&t.unref(A)(U,ge)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(ue).length?(t.openBlock(),t.createElementBlock("label",tv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Pf,{"model-value":U.groupCode,items:t.unref(ue),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":ge=>t.unref(ye)(U,ge)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("label",nv,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(be)(U).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"150px","model-value":U.defaultValue??"none",items:t.unref(pe)(U),"value-provider":t.unref(he),"label-provider":t.unref(_e),"onUpdate:modelValue":ge=>ge&&t.unref(Ae)(U,ge)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`aw-default-${U.modelId}`,width:"150px",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":U.defaultValue??"","onUpdate:modelValue":ge=>t.unref(Fe)(U,ge)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))])])),t.createElementVNode("fieldset",ov,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`aw-desc-${U.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":U.description,"onUpdate:modelValue":ge=>t.unref(se)(U,ge)},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",Mv,[t.createElementVNode("td",Vv,t.toDisplayString(t.unref(o).t("em.attr.empty")),1)]))])])])],8,EI)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-36c8c727"]]);function bs(e,n){return n&&n!==e?`${e} (${n})`:e}function Uf(e,n,o){const i=e.dbAttrs[n];return i?ni(e,i,n,o.entity,o.logical,{embeddableCatalog:o.embeddableCatalog}):""}function Hf(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}):bs(o,Uf(e,0,n))}function jf(e,n){var l;if(jn(e)){const s=(l=n.inherited)==null?void 0:l.find(c=>c.modelId===e);return s?bs(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 bs(i,Uf(o,r<0?0:r,n))}const Ov=["disabled"],Lv={class:"em-idxw__list"},Pv={class:"em-idxw__list-head"},zv=["aria-label"],Fv=["aria-current","onClick","onKeydown"],Uv={class:"em-idxw__item-name"},Hv={key:0,class:"em-idxw__badge"},jv={class:"em-idxw__item-cnt"},Kv={key:0,class:"em-idxw__empty"},Gv={key:0,class:"em-idxw__edit"},Yv={class:"em-idxw__form"},qv={class:"em-field em-idxw__name"},Wv={class:"em-field"},Jv=["value","placeholder"],Xv={class:"em-idxw__transfer"},Zv={class:"em-idxw__pane"},Qv={class:"em-idxw__pane-head"},eC=["aria-label"],tC=["aria-pressed","onClick","onKeydown"],nC=["title"],oC={key:0,class:"em-idxw__empty"},iC={class:"em-idxw__arrows"},aC={class:"em-idxw__pane"},rC={class:"em-idxw__pane-head"},lC={class:"em-idxw__col-name"},sC=["title"],cC={class:"em-idxw__col-ops"},dC=["title","disabled","onClick"],uC=["title","disabled","onClick"],mC=["title","onClick"],fC={key:0,class:"em-idxw__empty"},pC={key:1,class:"em-idxw__edit em-idxw__edit--empty"},hC=tt(t.defineComponent({__name:"EntityIndexesWide",props:{controller:{},entityId:{}},setup(e){const n=e,o=n.controller,i=t.computed(()=>o.state.logical.entities.find(k=>k.modelId===n.entityId)??null),a=t.computed(()=>{var k;return((k=i.value)==null?void 0:k.indexes)??[]}),r=t.computed(()=>{var k;return((k=i.value)==null?void 0:k.attributes)??[]}),l=t.ref(null),s=t.ref(null);t.watch(a,k=>{var v;k.some(I=>I.modelId===s.value)||(s.value=((v=k[0])==null?void 0:v.modelId)??null)},{immediate:!0});const c=t.computed(()=>a.value.find(k=>k.modelId===s.value)??null),d=t.computed(()=>i.value?Qo(i.value,o.superClassCatalog.value):[]),u=t.computed(()=>Hn(r.value)),m=k=>u.value.canon(k),p=t.computed(()=>{var k;return new Set((((k=c.value)==null?void 0:k.columns)??[]).map(v=>m(v.columnRef)))}),f=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(k){return Hf(k,f.value)}function _(k){return k.physicalName&&k.physicalName!==k.field?`${k.field} (${k.physicalName})`:k.field}function g(k){return jf(k,f.value)}const b=t.computed(()=>[...r.value.filter(k=>k.dbAttrs.length>0&&!p.value.has(m(k.modelId))).map(k=>({ref:k.modelId,label:y(k),inherited:!1})),...d.value.filter(k=>!p.value.has(m(k.modelId))).map(k=>({ref:k.modelId,label:_(k),inherited:!0}))]),E=t.ref(new Set);t.watch(s,()=>E.value=new Set);function h(k){return jn(k)}function N(k,v){i.value&&o.updateIndex(i.value.modelId,k,v)}function w(){var v;if(!i.value)return;const k=Pe();o.addIndex(i.value.modelId,{modelId:k,name:`idx_${(((v=i.value.indexes)==null?void 0:v.length)??0)+1}`,unique:!1,columns:[]}),s.value=k}function C(k){i.value&&o.removeIndex(i.value.modelId,k)}function S(k){c.value&&N(c.value.modelId,{parameters:k.trim()===""?void 0:k})}function V(k){const v=new Set(E.value);v.has(k)?v.delete(k):v.add(k),E.value=v}function $(){const k=c.value;if(!k||!E.value.size)return;const v=[...E.value].map(I=>({columnRef:I,descending:!1}));N(k.modelId,{columns:[...k.columns,...v]}),E.value=new Set}function R(k){const v=c.value;v&&N(v.modelId,{columns:v.columns.filter((I,O)=>O!==k)})}function x(k,v){const I=c.value;I&&N(I.modelId,{columns:I.columns.map((O,A)=>A===k?{...O,descending:v}:O)})}function T(k,v){const I=c.value;if(!I)return;const O=k+v;if(O<0||O>=I.columns.length)return;const A=[...I.columns];[A[k],A[O]]=[A[O],A[k]],N(I.modelId,{columns:A}),M(O,v)}async function M(k,v){var H,oe;await t.nextTick();const I=(H=l.value)==null?void 0:H.querySelectorAll(".em-idxw__col--idx")[k];if(!I)return;const O=ue=>I.querySelector(`[data-move="${ue}"]`),A=O(v<0?"up":"down"),L=O(v<0?"down":"up");(oe=A&&!A.disabled?A:L)==null||oe.focus()}return(k,v)=>i.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-idxw",disabled:!t.unref(o).editable.value},[t.createElementVNode("aside",Lv,[t.createElementVNode("div",Pv,[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:w},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,I=>(t.openBlock(),t.createElementBlock("li",{key:I.modelId,class:t.normalizeClass(["em-idxw__item",{"is-active":I.modelId===s.value}]),role:"button",tabindex:"0","aria-current":I.modelId===s.value?"true":void 0,onClick:O=>s.value=I.modelId,onKeydown:[t.withKeys(t.withModifiers(O=>s.value=I.modelId,["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>s.value=I.modelId,["prevent"]),["space"])]},[t.createElementVNode("span",Uv,t.toDisplayString(I.name||t.unref(o).t("em.attr.nameless")),1),I.unique?(t.openBlock(),t.createElementBlock("span",Hv,"UQ")):t.createCommentVNode("",!0),t.createElementVNode("span",jv,t.toDisplayString(I.columns.length),1)],42,Fv))),128))],8,zv),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Kv,t.toDisplayString(t.unref(o).t("em.index.empty")),1))]),c.value?(t.openBlock(),t.createElementBlock("section",Gv,[t.createElementVNode("div",Yv,[t.createElementVNode("label",qv,[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":v[0]||(v[0]=I=>N(c.value.modelId,{name:I}))},null,8,["model-value"]),t.createVNode(fo,{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":v[1]||(v[1]=I=>N(c.value.modelId,{unique:I}))},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:v[2]||(v[2]=I=>C(c.value.modelId))},null,8,["caption"])]),t.createElementVNode("label",Wv,[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:v[3]||(v[3]=I=>S(I.target.value))},null,40,Jv)]),t.createElementVNode("div",Xv,[t.createElementVNode("div",Zv,[t.createElementVNode("div",Qv,t.toDisplayString(t.unref(o).t("em.index.availColumns",{n:b.value.length})),1),t.createElementVNode("ul",{class:"em-idxw__cols",role:"group","aria-label":t.unref(o).t("em.index.availColumns",{n:b.value.length})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,I=>(t.openBlock(),t.createElementBlock("li",{key:I.ref,class:t.normalizeClass(["em-idxw__col",{"is-sel":E.value.has(I.ref)}]),role:"button",tabindex:"0","aria-pressed":E.value.has(I.ref),onClick:O=>V(I.ref),onKeydown:[t.withKeys(t.withModifiers(O=>V(I.ref),["prevent"]),["enter"]),t.withKeys(t.withModifiers(O=>V(I.ref),["prevent"]),["space"])]},[t.createTextVNode(t.toDisplayString(I.label),1),I.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,nC)):t.createCommentVNode("",!0)],42,tC))),128))],8,eC),b.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",oC,t.toDisplayString(t.unref(o).t("em.index.allColumnsUsed")),1))]),t.createElementVNode("div",iC,[t.createVNode(t.unref(te.BSButton),{caption:t.unref(o).t("em.index.addArrow"),disabled:!E.value.size,onClick:$},null,8,["caption","disabled"])]),t.createElementVNode("div",aC,[t.createElementVNode("div",rC,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,(I,O)=>(t.openBlock(),t.createElementBlock("li",{key:O,class:"em-idxw__col em-idxw__col--idx"},[t.createElementVNode("span",lC,[t.createTextVNode(t.toDisplayString(g(I.columnRef)),1),h(I.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,sC)):t.createCommentVNode("",!0)]),t.createVNode(t.unref(te.BSCheckbox),{name:`idxw-desc-${O}`,class:"em-check",label:"DESC","model-value":I.descending,"onUpdate:modelValue":A=>x(O,A)},null,8,["name","model-value","onUpdate:modelValue"]),t.createElementVNode("span",cC,[t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"up",title:t.unref(o).t("em.index.moveUp"),disabled:O===0,onClick:A=>T(O,-1)},"↑",8,dC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn","data-move":"down",title:t.unref(o).t("em.index.moveDown"),disabled:O===c.value.columns.length-1,onClick:A=>T(O,1)},"↓",8,uC),t.createElementVNode("button",{type:"button",class:"em-idxw__opbtn em-idxw__opbtn--del",title:t.unref(o).t("em.index.removeColumn"),onClick:A=>R(O)},"✕",8,mC)])]))),128)),c.value.columns.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("li",fC,t.toDisplayString(t.unref(o).t("em.index.noColumns")),1))],512)])])])):(t.openBlock(),t.createElementBlock("section",pC,t.toDisplayString(t.unref(o).t("em.index.selectPrompt")),1))],8,Ov)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0093668f"]]),yC={class:"em-op-src"},gC=["placeholder"],bC={class:"em-op-src__actions"},Kf=tt(t.defineComponent({__name:"OperationSourceEditor",props:{operationName:{},sourceCode:{},onSave:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(l,s)=>qt(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",yC,[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,gC),[[t.vModelText,a.value]]),t.createElementVNode("div",bC,[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"]]),_C=["disabled"],kC={class:"em-ow__toolbar"},EC={class:"em-ow__count"},NC={class:"em-ow__scroll"},wC={class:"em-ow__table"},IC={class:"c-name"},vC={class:"c-desc"},CC=["id"],SC={class:"c-pii"},xC={class:"c-src"},RC={class:"c-del"},AC={key:0},$C={colspan:"6",class:"em-ow__empty"},TC=tt(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(g=>g.modelId===n.entityId)??null),r=t.computed(()=>{var g;return[...((g=a.value)==null?void 0:g.operations)??[]].sort((b,E)=>b.order-E.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(g){return g==="none"?o.t("em.common.noneParen"):g}const u=g=>g;function m(g,b){a.value&&o.updateOperation(a.value.modelId,g.modelId,b)}function p(g,b){m(g,{description:Object.keys(b).length?b:void 0})}function f(g){return g.personalInfoAttributeType??"none"}function y(g,b){m(g,{personalInfoAttributeType:b==="none"?void 0:b})}function _(g){i.openModal({component:Kf,bind:{operationName:g.name,sourceCode:g.sourceCode??"",locale:o.uiLocale.value,onSave:b=>m(g,{sourceCode:b})}})}return(g,b)=>{var E,h;return a.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-ow",disabled:!t.unref(o).editable.value},[t.createElementVNode("div",kC,[t.createElementVNode("span",EC,t.toDisplayString(t.unref(o).t("em.op.section",{n:((E=a.value.operations)==null?void 0:E.length)??0})),1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:b[0]||(b[0]=N=>t.unref(o).addOperation(a.value.modelId))},null,8,["caption"])]),t.createElementVNode("div",NC,[t.createElementVNode("table",wC,[t.createElementVNode("thead",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",IC,t.toDisplayString(t.unref(o).t("em.attr.namePlaceholder")),1),b[2]||(b[2]=t.createElementVNode("th",{class:"c-vis"},"visibility",-1)),t.createElementVNode("th",vC,[t.createElementVNode("span",{id:`ow-desc-head-${a.value.modelId}`},t.toDisplayString(t.unref(o).t("em.common.description")),9,CC),t.createVNode(zf,{modelValue:l.value,"onUpdate:modelValue":b[1]||(b[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",SC,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createElementVNode("th",xC,t.toDisplayString(t.unref(o).t("em.op.body")),1),b[3]||(b[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":w=>m(N,{name:w})},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":w=>w&&m(N,{visibility:w})},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(Yt,{name:`ow-desc-${N.modelId}`,languages:t.unref(o).languages.value,"active-lang":l.value,"model-value":N.description,"onUpdate:modelValue":w=>p(N,w)},null,8,["name","languages","active-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("td",null,[t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":f(N),items:c,"value-provider":u,"label-provider":d,"onUpdate:modelValue":w=>w&&y(N,w)},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:w=>_(N)},null,8,["caption","onClick"])]),t.createElementVNode("td",RC,[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:w=>t.unref(o).removeOperation(a.value.modelId,N.modelId)},null,8,["onClick"])])]))),128)),(h=a.value.operations)!=null&&h.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("tr",AC,[t.createElementVNode("td",$C,t.toDisplayString(t.unref(o).t("em.op.empty")),1)]))])])])],8,_C)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-743b04a6"]]),MC={class:"em-detail__tabs"},VC=["onClick"],BC={key:0,class:"em-detail__lock"},DC=["disabled"],OC={key:0,class:"em-detail__narrow"},LC=tt(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",MC,[(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:p=>s.value=m.key},t.toDisplayString(t.unref(o).t(m.labelKey)),11,VC)),64))]),a.value?(t.openBlock(),t.createElementBlock("div",BC,[t.createVNode(Ve,{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",OC,[t.createVNode(Tf,{controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])])):s.value==="columns"?(t.openBlock(),t.createBlock(Dv,{key:1,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):s.value==="indexes"?(t.openBlock(),t.createBlock(hC,{key:2,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"])):(t.openBlock(),t.createBlock(TC,{key:3,controller:t.unref(o),"entity-id":r.value.modelId},null,8,["controller","entity-id"]))],10,DC)],2)):t.createCommentVNode("",!0)]),_:1},8,["title"])}}}),[["__scopeId","data-v-328396cc"]]);function lr(e,n,o){e.openModal({component:LC,bind:{controller:t.markRaw(n),entityId:o}})}function Nn(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=>Id(e,r))}function Wt(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 nu(l,r))i.push(wa(a,s.indexRef,{columns:s.columns}))}return i}function sr(e,n,o,i){var c;const a=[];a.push(...Nn(n,o.remove,i));for(const d of o.update)a.push(nn(n,d.attributeId,d.patch));for(const d of o.add)a.push(tn(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 p=l.filter(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===d.modelId&&f.dbAttrs.length>0}).sort((f,y)=>f.order-y.order)[0];p&&a.push(Ht(d.modelId,"end2",{attributeRef:p.modelId}))}return a}function Ko(e,n,o){return{...e,entities:e.entities.map(i=>i.modelId===n?{...i,attributes:o(i.attributes)}:i)}}function Mi(e,n,o){const i=[];for(const[a,r]of Dc(e,n,Pe))i.push(...sr(e,a,r,o));for(const a of ou(e,n,Pe))i.push(nn(a.entityId,a.attributeId,{dbAttrs:a.dbAttrs}));return i}function PC(e,n,o,i){const a=e.entities.find(l=>l.modelId===n);if(!a)return[];const r=dl([...a.attributes].sort((l,s)=>l.order-s.order),o,i).map(l=>l.modelId);return iu(e,n,r).map(l=>nn(l.entityId,l.attributeId,{dbAttrs:l.dbAttrs}))}function Gf(e,n,o){return au(e,n,o).map(i=>nn(i.entityId,i.attributeId,{dbAttrs:i.dbAttrs}))}function zC(e,n,o){const i=new Set(o.remove);return Ko(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 cr(e,n,o){const i=new Map;for(const r of n)for(const{entityId:l,plan:s}of Oc(e,r,Pe)){const c=i.get(l);i.set(l,c?Bc(c,s):s)}const a=[];for(const[r,l]of i)a.push(...sr(e,r,FC(l),o));return a}function FC(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 fn(e).map(n=>({...n.col,modelId:Pe()}))}function UC(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=zt(o.attributes),p=new Set(o.attributes.map(y=>y.name));let f="id";for(let y=2;p.has(f);y++)f=`id${y}`;a={modelId:Pe(),name:f,type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:m,dbAttrs:[{modelId:Pe(),physicalName:f.toLowerCase(),dataType:"BIGINT"}]},i.push(tn(n,a))}const r=[];for(const m of e.entities)for(const p of m.attributes){if(((u=p.embedded)==null?void 0:u.embeddableRef)!==n)continue;const f=e.associations.find(b=>b.modelId===p.embedded.associationRef);if(!f)continue;const y=f.end1.entityRef===m.modelId,_=y?f.end1:f.end2,g=y?f.end2:f.end1;r.push({ownerId:m.modelId,dispId:p.modelId,assocId:f.modelId,end1:{entityRef:m.modelId,multiplicity:_.multiplicity,navigable:_.navigable,composition:!1},end2:{entityRef:n,multiplicity:g.multiplicity,navigable:g.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 p=new Set(r.filter(f=>f.ownerId===m.modelId).map(f=>f.dispId));return p.size?{...m,attributes:m.attributes.filter(f=>!p.has(f.modelId))}:m}),associations:e.associations.map(m=>{const p=r.find(f=>f.assocId===m.modelId);return p?{...m,end1:p.end1,end2:p.end2}:m})},s=ai(l,n,Pe);for(const m of r){const p=s.add.find(f=>{var y;return((y=f.derivedFrom)==null?void 0:y.associationRef)===m.assocId});p&&(m.end2.attributeRef=p.modelId)}const c=[];for(const m of r)i.push(...Nn(m.ownerId,[m.dispId],c)),i.push(Na(m.assocId,{end1:m.end1,end2:m.end2}));i.push(...sr(l,n,s,c));const d=zC(l,n,s);return i.push(...Mi(d,n,c)),i.push(...Wt(e,c)),i}function HC(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(h=>h.modelId===c);if(!d||d.attributes.some(h=>{var N;return((N=h.embedded)==null?void 0:N.associationRef)===r.modelId}))continue;const u=Pe(),m=zt(d.attributes),p=new Set(d.attributes.map(h=>h.name)),f=a(o.name);let y=f;for(let h=2;p.has(y);h++)y=`${f}${h}`;const _=o.attributes.filter(h=>!h.identifier&&!h.derivedFrom).flatMap(h=>h.dbAttrs).map(h=>({...h,modelId:Pe()})),g={modelId:u,name:y,type:o.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:m,dbAttrs:_,embedded:{associationRef:r.modelId,embeddableRef:n}};i.push(tn(c,g));const b=l?"end2":"end1",E=l?"end1":"end2";i.push(Na(r.modelId,{identifying:!1,[b]:{entityRef:c,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:Pe()},[E]:{entityRef:n,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:u}}))}return i}function qf(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=[kd(n,o),...i.map(u=>To(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 p=e.layout.associationLayouts.find(f=>f.associationRef===m.modelId);p&&p.waypoints.length&&c.push(Dd(m.modelId,l,s))}for(const m of(a==null?void 0:a.memberNoteRefs)??[]){const p=e.layout.notes.find(f=>f.modelId===m);p&&c.push(mi(m,{x:p.geo.location.x+l,y:p.geo.location.y+s}))}}return c}function jC(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=Pe(),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}},p={...n.logical,associations:[...n.logical.associations,m]},f=ai(p,s,Pe),y=f.add[0];y&&(m.end2.attributeRef=y.modelId);const _={associationRef:u,waypoints:[],sourceColumnRef:c,targetColumnRef:(y==null?void 0:y.modelId)??d},g=Ea(m,_),b=sr(p,s,f,[]);return i(b.length?rt("관계 추가",[g,...b]):g),u},addEmbedAssociation(l,s){if(!o.value||a(l))return null;const c=n.logical.entities.find(C=>C.modelId===l),d=n.logical.entities.find(C=>C.modelId===s);if(!c||!d||d.stereotype!=="JPA_EMBEDDABLE")return null;const u=Pe(),m=Pe(),p=Pe(),f=zt(c.attributes),y=Yf(d),_=C=>C&&C.charAt(0).toLowerCase()+C.slice(1),g=new Set(c.attributes.map(C=>C.name)),b=_(d.name);let E=b;for(let C=2;g.has(E);C++)E=`${b}${C}`;const h={modelId:m,name:E,type:d.name,attrType:"EMBED_OWN",identifier:!1,notNull:!1,order:f,dbAttrs:y,embedded:{associationRef:u,embeddableRef:s}},N={modelId:u,end1:{entityRef:l,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!1,attributeRef:p},end2:{entityRef:s,multiplicity:"EXACTLY_ONE_INSTANCE",navigable:!0,composition:!0,attributeRef:m}},w={associationRef:u,waypoints:[],sourceColumnRef:m,targetColumnRef:void 0};return i(rt("임베드 추가",[tn(l,h),Ea(N,w)])),u},setEmbedCardinality(l,s){var b;if(r(l))return;const c=n.logical.associations.find(E=>E.modelId===l);if(!c)return;let d,u;for(const E of n.logical.entities){const h=E.attributes.find(N=>{var w;return((w=N.embedded)==null?void 0:w.associationRef)===l&&N.attrType==="EMBED_OWN"});if(h){d=E.modelId,u=h;break}}if(!d||!u)return;const m=u.embedded.embeddableRef,p=c.end2.entityRef===m?"end2":"end1",f=c[p];if(f.multiplicity===s)return;const y=E=>E==="ZERO_OR_MORE_INSTANCES"||E==="ONE_OR_MORE_INSTANCES",_=y(f.multiplicity),g=y(s);if(_===g){i(Ht(l,p,{multiplicity:s}));return}if(g)i(rt("임베드 컬렉션 전환",[nn(d,u.modelId,{dbAttrs:[]}),Ht(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:((b=f.jpa)==null?void 0:b.collectionType)??"LIST"}})]));else{const E=n.logical.entities.find(h=>h.modelId===m);if(!E)return;i(rt("임베드 단일 전환",[nn(d,u.modelId,{dbAttrs:Yf(E)}),Ht(l,p,{multiplicity:s,jpa:{...f.jpa,collectionType:void 0,collectionTable:void 0,orderColumn:void 0}})]))}},removeAssociation(l){if(r(l))return;const s=n.logical.associations.find(f=>f.modelId===l),c=$d(l);if(!s){i(c);return}for(const f of n.logical.entities){const y=f.attributes.find(_=>{var g;return((g=_.embedded)==null?void 0:g.associationRef)===l});if(y){const _=[];i(rt("임베드 삭제",[c,...Nn(f.modelId,[y.modelId],_),...Wt(n.logical,_)]));return}}const d=s.end2.entityRef,u={...n.logical,associations:n.logical.associations.filter(f=>f.modelId!==l)},m=[],p=cr(u,[d],m);if(s.end1.attributeRef){const f=n.logical.entities.find(_=>_.modelId===s.end1.entityRef),y=f==null?void 0:f.attributes.find(_=>_.modelId===s.end1.attributeRef&&_.attrType==="RELATION_REF");y&&p.push(...Nn(f.modelId,[y.modelId],m))}p.push(...Wt(n.logical,m)),i(p.length?rt("관계 삭제",[c,...p]):c)},setAssociationIdentifying(l,s){if(r(l))return;const c=n.logical.associations.find(y=>y.modelId===l),d=Na(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)},p=[],f=cr(m,[u],p);f.push(...Wt(n.logical,p)),i(f.length?rt("식별 관계 변경",[d,...f]):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(f=>f.modelId===d.end1.entityRef),m=n.logical.entities.find(f=>f.modelId===d.end2.entityRef),p=(u==null?void 0:u.stereotype)==="JPA_EMBEDDABLE"||(m==null?void 0:m.stereotype)==="JPA_EMBEDDABLE";if(u&&m&&!p){if(c.navigable===!0&&!d.end1.attributeRef){const f=Qi(d.end2.multiplicity),y=d.end1.navFieldNameHint||ta(m.name,f),_=No(y,new Set(u.attributes.map(h=>h.name))),g=Pe(),b=zt(u.attributes),E={modelId:g,name:_,type:m.name,attrType:"RELATION_REF",identifier:!1,notNull:!1,order:b,dbAttrs:[]};i(rt("inverse nav 추가",[tn(d.end1.entityRef,E),Ht(l,"end1",{...c,attributeRef:g,navFieldNameHint:void 0})]));return}if(c.navigable===!1&&d.end1.attributeRef){const f=d.end1.attributeRef,y=u.attributes.find(E=>E.modelId===f&&E.attrType==="RELATION_REF"),_=Ht(l,"end1",{...c,attributeRef:void 0,navFieldNameHint:(y==null?void 0:y.name)??d.end1.navFieldNameHint}),g=[],b=y?Nn(d.end1.entityRef,[f],g):[];i(y?rt("inverse nav 제거",[...b,_,...Wt(n.logical,g)]):_);return}}}i(Ht(l,s,c))}}}function KC(e){const{state:n,editable:o,run:i,gateEntityLocked:a,embeddableCatalog:r,t:l,emitGateNotice:s,selection:c}=e,d=(u,m,p)=>{if(a(u))return;const f=nn(u,m,p),y=Ko(n.logical,u,b=>b.map(E=>E.modelId===m?{...E,...p}:E)),_=[],g=Mi(y,u,_);g.push(...Wt(n.logical,_)),i(g.length?rt("속성 수정",[f,...g]):f)};return{addPredefinedEmbed(u,m){if(!o.value||a(u))return null;const p=r.value.find(E=>E.type===m),f=n.logical.entities.find(E=>E.modelId===u);if(!p||!f)return null;const y=zt(f.attributes),_=Pe(),g=p.fields.map(()=>({modelId:Pe(),physicalName:"",dataType:""})),b={modelId:_,name:p.defaultName,type:p.type,attrType:"EMBED_PREDEF",identifier:!1,notNull:!1,order:y,dbAttrs:g};return i(tn(u,b)),_},addAttribute(u,m={}){if(!o.value||a(u))return null;const p=n.logical.entities.find(w=>w.modelId===u),f=p?zt(p.attributes):0,y=m.modelId??Pe(),_=m.name??`field${f}`,g={modelId:y,name:_,type:m.type??Gr,attrType:m.attrType??"NORMAL",identifier:m.identifier??!1,notNull:m.notNull??!1,order:f,dbAttrs:m.dbAttrs??[{modelId:Pe(),physicalName:_,dataType:"VARCHAR"}],...m},b=tn(u,g),E=Ko(n.logical,u,w=>[...w,g]),h=[],N=Mi(E,u,h);return N.push(...Wt(n.logical,h)),i(N.length?rt("속성 추가",[b,...N]):b),y},addDivider(u){if(!o.value||a(u))return null;const m=n.logical.entities.find(_=>_.modelId===u),p=m?zt(m.attributes):0,f=Pe();return i(tn(u,{modelId:f,name:"",type:"",attrType:"DIVIDER",identifier:!1,notNull:!1,order:p,dbAttrs:[]})),f},updateAttribute(u,m,p){d(u,m,p)},setAttributeGroupCode(u,m,p){d(u,m,{groupCode:p,type:p?Yn:Gr})},setEmbedColumns(u,m,p){var E,h;if(a(u))return;const f=nn(u,m,{dbAttrs:p}),y=(E=n.logical.entities.find(N=>N.modelId===u))==null?void 0:E.attributes.find(N=>N.modelId===m),_=(h=y==null?void 0:y.embedded)==null?void 0:h.associationRef,g=_?n.logical.associations.find(N=>N.modelId===_):void 0,b=[];g&&_&&(g.end1.legacyEmbedRaw&&b.push(Ht(_,"end1",{legacyEmbedRaw:void 0})),g.end2.legacyEmbedRaw&&b.push(Ht(_,"end2",{legacyEmbedRaw:void 0}))),i(b.length?rt("임베드 컬럼 수정",[f,...b]):f)},removeAttribute(u,m){if(a(u))return;if(So(n.logical,u,m)){s(l("em.attr.fkDeleteHint"));return}const p=[],f=Nn(u,[m],p),y=Ko(n.logical,u,b=>b.filter(E=>E.modelId!==m)),_=[...Mi(y,u,p),...Wt(n.logical,p),...Gf(n.logical,u,[m])],g=[...f,..._];i(g.length===1?g[0]:rt("속성 삭제",g))},removeAttributes(u,m){var E;if(!m.length||a(u))return;const p=m.filter(h=>!So(n.logical,u,h));if(p.length<m.length&&s(l("em.attr.fkDeleteHint")),!p.length)return;const f=[],y=Nn(u,p,f),_=new Set(p),g=Ko(n.logical,u,h=>h.filter(N=>!_.has(N.modelId))),b=[...y,...Mi(g,u,f),...Wt(n.logical,f),...Gf(n.logical,u,p)];i(b.length===1?b[0]:rt("속성 삭제",b)),((E=c.value)==null?void 0:E.kind)==="attribute"&&c.value.entityId===u&&(c.value=null)},setAttributeSwatch(u,m,p){i(ba(u,m,p))},setAttributeSwatches(u,m,p){m.length&&(m.length===1?i(ba(u,m[0],p)):i(rt("속성 색상",m.map(f=>ba(u,f,p)))))},reorderAttributes(u,m,p){if(!m.length||a(u))return;const f=El(u,m,p),y=PC(n.logical,u,m,p);i(y.length?rt("속성 재정렬",[f,...y]):f)}}}function GC(e){var i;const n=JSON.parse(JSON.stringify(e));n.modelId=Pe(),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=Pe();o.set(a.modelId,r),a.modelId=r;for(const l of a.dbAttrs)l.modelId=Pe()}for(const a of n.indexes??[]){a.modelId=Pe();for(const r of a.columns)r.columnRef=o.get(r.columnRef)??r.columnRef}for(const a of n.operations??[]){const r=Pe();o.set(a.modelId,r),a.modelId=r}return{clone:n,idMap:o}}const YC=220;function qC(e,n){let i=-1/0;for(const r of e.entityLayouts)i=Math.max(i,r.geo.location.x+(r.geo.size.width||YC));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 _s=(e,n)=>({x:e.x+n.x,y:e.y+n.y});function WC(e){const{state:n,clipboard:o,selection:i,inspectedEntityId:a,editable:r,run:l}=e,s={copy(c){if(c&&c.length){const _=c.filter(g=>n.logical.entities.some(b=>b.modelId===g));if(_.length){o.value=JSON.parse(JSON.stringify({kind:"entities",source:{logical:n.logical,layout:n.layout},selectedIds:_}));return}}const d=i.value;if((d==null?void 0:d.kind)==="attribute"){const _=n.logical.entities.find(b=>b.modelId===d.entityId);if(!_)return;const g=[..._.attributes].sort((b,E)=>b.order-E.order).filter(b=>d.ids.includes(b.modelId));if(!g.length)return;o.value=JSON.parse(JSON.stringify({kind:"attribute",attributes:g}));return}const u=a.value;if(!u)return;const m=n.logical.entities.find(_=>_.modelId===u),p=n.layout.entityLayouts.find(_=>_.entityRef===u);if(!m)return;const f=(p==null?void 0:p.geo)??{location:{x:80,y:80},size:{width:220,height:140}};let y;if(p){const{entityRef:_,geo:g,locked:b,...E}=p;Object.keys(E).length&&(y=E)}o.value=JSON.parse(JSON.stringify({kind:"entity",entity:m,geo:f,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 f=a.value;if(!f)return[];const y=n.logical.entities.find(N=>N.modelId===f);if(!y)return[];const _=new Set(y.attributes.map(N=>N.name)),g=new Set(y.attributes.flatMap(N=>N.dbAttrs.map(w=>w.physicalName))),b=zt(y.attributes),E=[],h=c.attributes.map((N,w)=>{const C=JSON.parse(JSON.stringify(N));C.modelId=Pe();for(const S of C.dbAttrs)S.modelId=Pe();_.has(C.name)&&(C.name=No(`${C.name}_copy`,_)),_.add(C.name);for(const S of C.dbAttrs)S.physicalName&&g.has(S.physicalName)&&(S.physicalName=No(`${S.physicalName}_copy`,g)),S.physicalName&&g.add(S.physicalName);return C.order=b+w,E.push(C.modelId),tn(f,C)});return l(h.length===1?h[0]:rt("속성 붙여넣기",h)),i.value={kind:"attribute",entityId:f,ids:E,anchor:E[E.length-1]},[]}const{clone:d,idMap:u}=GC(c.entity),m={location:{x:c.geo.location.x+40,y:c.geo.location.y+40},size:{...c.geo.size}};let p;if(c.layoutExtras){const f={...c.layoutExtras},y=_=>u.get(_);f.attributeStyles&&(f.attributeStyles=pa(f.attributeStyles,y)),f.operationStyles&&(f.operationStyles=pa(f.operationStyles,y)),p=f}return l(ga(d,m,p)),i.value={kind:"entity",id:d.modelId},[d.modelId]},importEntities(c,d,u){if(!r.value)return[];const m=nd(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 p=(u==null?void 0:u.placement)??"append-right",f=p==="append-right"?qC(n.layout,m.layout):p.offset,y=new Map(m.layout.entityLayouts.map(h=>[h.entityRef,h])),_=new Map(m.layout.associationLayouts.map(h=>[h.associationRef,h])),g=new Map(m.layout.groupLayouts.map(h=>[h.groupRef,h])),b=[];let E=80;for(const h of m.logical.entities){const N=y.get(h.modelId),w=N?{location:_s(N.geo.location,f),size:{...N.geo.size}}:{location:{x:E+=40,y:80},size:{width:220,height:140}};let C;if(N){const{entityRef:S,geo:V,locked:$,...R}=N;C=R}b.push(ga(h,w,C))}for(const h of m.logical.associations){const N=_.get(h.modelId),w=N?{...N,waypoints:N.waypoints.map(C=>_s(C,f))}:{associationRef:h.modelId,waypoints:[]};b.push(Ea(h,w))}for(const h of m.logical.groups){const N=g.get(h.modelId),w=N?{location:_s(N.geo.location,f),size:{...N.geo.size}}:{location:{x:80,y:80},size:{width:320,height:200}};let C;if(N){const{groupRef:S,geo:V,locked:$,memberNoteRefs:R,...x}=N;C=x}b.push(_a(h,w,C))}return l(rt("다이어그램 가져오기",b)),i.value={kind:"entity",id:m.logical.entities[0].modelId},m.logical.entities.map(h=>h.modelId)}};return s}function JC(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=Pe(),u={modelId:d,name:s,stereotype:"JPA_ENTITY",table:{physicalName:s.toLowerCase()},attributes:[{modelId:Pe(),name:"id",type:"Long",attrType:"NORMAL",identifier:!0,notNull:!0,order:0,dbAttrs:[{modelId:Pe(),physicalName:"id",dataType:"BIGINT"}]}]};return i(ga(u,{location:{...c},size:{width:220,height:140}})),d},renameEntity(s,c){a(s)||i(md(s,c))},updateEntity(s,c){if(a(s))return;const d=ud(s,c),u=n.logical.entities.find(f=>f.modelId===s),m=c.stereotype==="JPA_EMBEDDABLE"&&!!u&&u.stereotype!=="JPA_EMBEDDABLE",p=!!c.stereotype&&c.stereotype!=="JPA_EMBEDDABLE"&&!!u&&u.stereotype==="JPA_EMBEDDABLE";if(m&&u){const f=u.attributes.filter(h=>h.identifier&&!h.derivedFrom).map(h=>nn(s,h.modelId,{identifier:!1})),y=Ko({...n.logical,entities:n.logical.entities.map(h=>h.modelId===s?{...h,stereotype:"JPA_EMBEDDABLE"}:h)},s,h=>h.map(N=>N.identifier&&!N.derivedFrom?{...N,identifier:!1}:N)),_=[],g=cr(y,[s],_);g.push(...Wt(n.logical,_));const b=HC(n.logical,s),E=[d,...f,...g,...b];i(E.length>1?rt("임베더블 변환",E):d);return}if(p){const f=UC(n.logical,s),y=[d,...f];i(y.length>1?rt("엔터티 전환",y):d);return}i(d)},moveEntity(s,c){a(s)||i(To(s,c))},resizeEntity(s,c){a(s)||i(fd(s,c))},removeEntity(s){if(a(s))return;const c=dd(s);if(!n.logical.entities.find(g=>g.modelId===s)){i(c);return}const u=n.logical.associations.filter(g=>g.end1.entityRef===s||g.end2.entityRef===s),m=new Set(u.map(g=>g.modelId)),p=[],f=[];for(const g of n.logical.entities)if(g.modelId!==s)for(const b of g.attributes)b.embedded&&m.has(b.embedded.associationRef)&&p.push(...Nn(g.modelId,[b.modelId],f));for(const g of u){if(g.end1.entityRef===s||!g.end1.attributeRef)continue;const b=n.logical.entities.find(h=>h.modelId===g.end1.entityRef),E=b==null?void 0:b.attributes.find(h=>h.modelId===g.end1.attributeRef&&h.attrType==="RELATION_REF");E&&p.push(...Nn(b.modelId,[E.modelId],f))}const y={...n.logical,entities:n.logical.entities.filter(g=>g.modelId!==s),associations:n.logical.associations.filter(g=>!m.has(g.modelId))},_=new Set(u.filter(g=>g.end1.entityRef===s&&g.end2.entityRef!==s).map(g=>g.end2.entityRef));p.push(...cr(y,[..._],f)),p.push(...Wt(n.logical,f.filter(g=>g.entityId!==s))),i(p.length?rt("엔티티 삭제",[c,...p]):c)},setEntitySwatch(s,c){i(pd(s,c))},setEntityCollapsed(s,c){i(hd(s,c))},setEntityLocked(s,c){i(yd(s,c))},isEntityLocked(s){return r(s)},isAssociationLocked(s){return l(s)},collapseAll(){i(kl(!0))},expandAll(){i(kl(!1))}}}function XC(e){const{state:n,editable:o,run:i,selection:a,gateEntityLocked:r,gateGroupLocked:l,isGroupLockedFn:s}=e;function c(d){const u=d.map(b=>n.layout.entityLayouts.find(E=>E.entityRef===b)).filter(b=>!!b);if(!u.length)return{location:{x:40,y:40},size:{width:400,height:300}};let m=1/0,p=1/0,f=-1/0,y=-1/0;for(const b of u){const E=b.geo.size.width||220,h=b.geo.size.height||140;m=Math.min(m,b.geo.location.x),p=Math.min(p,b.geo.location.y),f=Math.max(f,b.geo.location.x+E),y=Math.max(y,b.geo.location.y+h)}const _=40,g=28;return{location:{x:m-_,y:p-_-g},size:{width:f-m+_*2,height:y-p+_*2+g}}}return{dragGroup(d,u,m){l(d)||i(rt("그룹 이동",qf(n,d,u,m)))},resizeGroup(d,u){l(d)||i(Ed(d,u))},setGroupSwatch(d,u){i(Nd(d,u))},setGroupLocked(d,u){i(wd(d,u))},isGroupLocked(d){return s(d)},updateGroup(d,u){l(d)||i(gd(d,u))},createGroup(d,u){if(!o.value||!d.length)return null;const m=[];for(const y of n.logical.groups)for(const _ of d)y.memberEntityRefs.includes(_)&&m.push(ka(y.modelId,_));const p=Pe(),f={modelId:p,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[...d]};return m.push(_a(f,c(d))),i(rt("그룹 생성",m)),a.value=null,p},addEmptyGroup(d,u){if(!o.value)return null;const m=Pe();return i(_a({modelId:m,name:u?{ko:u}:void 0,excludeDDLGeneration:!1,memberEntityRefs:[]},{location:{...d},size:{width:360,height:260}})),m},removeGroup(d){l(d)||i(bd(d))},dropEntity(d,u,m){var y;if(r(d))return;const p=((y=n.logical.groups.find(_=>_.memberEntityRefs.includes(d)))==null?void 0:y.modelId)??null,f=[To(d,u)];p!==m&&(p&&f.push(ka(p,d)),m&&f.push(_d(m,d))),i(rt("이동",f))},ungroupEntity(d){const u=n.logical.groups.find(m=>m.memberEntityRefs.includes(d));u&&i(ka(u.modelId,d))},dropNote(d,u,m){var y;const p=((y=n.layout.groupLayouts.find(_=>{var g;return(g=_.memberNoteRefs)==null?void 0:g.includes(d)}))==null?void 0:y.groupRef)??null,f=[mi(d,u)];p!==m&&(p&&f.push(Kd(p,d)),m&&f.push(jd(m,d))),i(rt("이동",f))}}}function ZC(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(_,g){if(d(),!o.value||!e.opTransport)return;const b=new Qd({diagramId:n.layout.diagramId,state:n,transport:e.opTransport,origin:"gui",onFreeze:E=>{i.value=!1,a.value=E},onError:e.onOpError});b.seed((g==null?void 0:g.revSeed)??{}),c=b.attach(_),s=b}const m=t.computed(()=>o.value&&r!==void 0),p=t.ref(0),f=t.computed(()=>o.value&&i.value&&l!==void 0);async function y(_){if(!l||!i.value)return{ok:!1,reason:"unavailable"};let g;try{g=await l(_)}catch(b){return{ok:!1,reason:b instanceof Error?b.message:String(b)}}return g.ok&&p.value++,g}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:f,restoreToSeq:y,reloadRequest:p}}function QC(e){const{editable:n,run:o}=e;return{addNote(i="메모",a={x:80,y:80}){if(!n.value)return null;const r=Pe();return o(Pd({modelId:r,memo:i,geo:{location:{...a},size:{width:200,height:120}}})),r},removeNote(i){o(zd(i))},moveNote(i,a){o(mi(i,a))},resizeNote(i,a){o(Fd(i,a))},setNoteMemo(i,a){o(Ud(i,a))},setNoteSwatch(i,a){o(Hd(i,a))},addNoteConnection(i,a){o(Gd(i,a))},removeNoteConnection(i,a){o(Yd(i,a))},moveNoteConnectionWaypoint(i,a,r,l){o(qd(i,a,r,l))},addNoteConnectionWaypoint(i,a,r,l){o(Wd(i,a,r,l))},removeNoteConnectionWaypoint(i,a,r){o(Jd(i,a,r))},clearNoteConnectionWaypoints(i,a){o(Xd(i,a))}}}function eS(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 p=o.value,f=(p==null?void 0:p.kind)==="attribute"&&p.entityId===d;if(m==="replace"||!f){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}if(m==="toggle"){const N=p.ids.includes(u),w=N?p.ids.filter(S=>S!==u):[...p.ids,u];if(!w.length){o.value=null;return}const C=N&&p.anchor===u?w[w.length-1]:N?p.anchor:u;o.value={kind:"attribute",entityId:d,ids:w,anchor:C};return}const y=n.logical.entities.find(N=>N.modelId===d),_=[...(y==null?void 0:y.attributes)??[]].sort((N,w)=>N.order-w.order).map(N=>N.modelId),g=_.indexOf(p.anchor),b=_.indexOf(u);if(g<0||b<0){o.value={kind:"attribute",entityId:d,ids:[u],anchor:u};return}const[E,h]=g<=b?[g,b]:[b,g];o.value={kind:"attribute",entityId:d,ids:_.slice(E,h+1),anchor:p.anchor}},moveAttributeFocus(d){const u=o.value;if((u==null?void 0:u.kind)!=="attribute")return!1;const m=n.logical.entities.find(_=>_.modelId===u.entityId);if(!m||!m.attributes.length)return!1;const p=m.attributes.findIndex(_=>_.modelId===u.anchor);if(p<0)return!1;const f=Math.min(Math.max(p+d,0),m.attributes.length-1);if(f===p)return!0;const y=m.attributes[f].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 p=m.attributes,f=new Set(u.ids),y=p.map((N,w)=>f.has(N.modelId)?w:-1).filter(N=>N>=0);if(!y.length)return!1;const _=Math.min(...y),g=p.filter(N=>!f.has(N.modelId)),b=p.slice(0,_).filter(N=>!f.has(N.modelId)).length;let E;if(d<0){if(b<=0)return!0;E=b-1}else{if(g.length-b<=0)return!0;E=b+1}if(r(u.entityId))return!0;const h=p.filter(N=>f.has(N.modelId)).map(N=>N.modelId);return a(El(u.entityId,h,E)),!0},nudgeNodes(d,u,m){if(!d.length||u===0&&m===0)return!1;const p=new Set(n.logical.entities.map(E=>E.modelId)),f=new Set(n.logical.groups.map(E=>E.modelId)),y=new Set(n.layout.notes.map(E=>E.modelId)),_=new Set;for(const E of d){if(!f.has(E))continue;const h=n.logical.groups.find(N=>N.modelId===E);for(const N of(h==null?void 0:h.memberEntityRefs)??[])_.add(N)}const g=[],b=[];for(const E of d)if(f.has(E)){if(s(E))continue;const h=n.layout.groupLayouts.find(S=>S.groupRef===E);if(!h)continue;const N=n.logical.groups.find(S=>S.modelId===E),w=((N==null?void 0:N.memberEntityRefs)??[]).map(S=>{var $;const V=(($=n.layout.entityLayouts.find(R=>R.entityRef===S))==null?void 0:$.geo.location)??{x:0,y:0};return{id:S,location:{x:V.x+u,y:V.y+m}}}),C={x:h.geo.location.x+u,y:h.geo.location.y+m};g.push(rt("그룹 이동",qf(n,E,C,w))),b.push("g:"+E)}else if(p.has(E)){if(_.has(E)||l(E))continue;const h=n.layout.entityLayouts.find(N=>N.entityRef===E);if(!h)continue;g.push(To(E,{x:h.geo.location.x+u,y:h.geo.location.y+m})),b.push("e:"+E)}else if(y.has(E)){const h=n.layout.notes.find(N=>N.modelId===E);if(!h)continue;g.push(mi(E,{x:h.geo.location.x+u,y:h.geo.location.y+m})),b.push("n:"+E)}return g.length?(a(rt("이동",g,"nudge:"+b.sort().join(","))),!0):!1},requestFocus(d){i.value={id:d,nonce:++c}}}}const po=Symbol("editorController");function Wf(e="m1",n="d1"){return{logical:{modelId:e,entities:[],associations:[],groups:[]},layout:{diagramId:n,logicalModelRef:e,entityLayouts:[],associationLayouts:[],groupLayouts:[],notes:[]}}}function tS(e=Wf(),n={}){var Se,je,Ze;const o=t.reactive(e);let i=new _l(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=(J,re)=>qt(u.value,J,re),p=t.ref(n.reservedWords),f=t.ref(n.selectableDataTypes),y=t.ref(n.largeEntityThreshold),_=t.ref(n.flagEntitiesWithoutRelations??!1),g=t.ref(!1),b=t.ref(!1),E=t.ref(!1),h=t.ref(0),N=t.ref(null);let w=0;const C=J=>{if(n.onNotice){n.onNotice(J);return}N.value={text:J,id:++w}},S=t.ref(((Se=n.meta)==null?void 0:Se.schemaVersion)??1),V=t.ref(((je=n.meta)==null?void 0:je.opWriteEnabled)??!1),$=t.ref(((Ze=n.meta)==null?void 0:Ze.referenceOnly)??!1),R=t.computed(()=>S.value>=2&&V.value),x=t.ref(!(S.value>=2&&V.value===!1)),T=t.ref("LOGICAL_PHYSICAL"),M=t.ref("straight"),k=t.ref(!0),v=t.ref(!0),I=t.ref(null),O=t.computed(()=>{var J;return((J=I.value)==null?void 0:J.kind)==="attribute"?{entityId:I.value.entityId,attrId:I.value.anchor}:null}),A=t.computed(()=>{var J;return((J=I.value)==null?void 0:J.kind)==="attribute"?I.value.ids:[]}),L=t.computed(()=>{var J,re;return((J=I.value)==null?void 0:J.kind)==="entity"?I.value.id:((re=I.value)==null?void 0:re.kind)==="attribute"?I.value.entityId:null}),H=t.ref(null),oe=t.ref(null),ue=t.ref(null),be=t.ref(null),pe=ZC({state:o,opMode:R,editable:x,opConflict:ue,opTransport:n.opTransport,onOpError:n.onOpError,historyTransport:n.historyTransport,restoreTransport:n.restoreTransport});function he(){i.onChange(()=>{g.value=i.canUndo,b.value=i.canRedo,E.value=i.isDirty,h.value++})}he(),pe.setupOpAdapter(i,n.meta);const _e=t.computed(()=>Ys(o.logical,o.layout)),ye=t.computed(()=>({reservedWords:p.value,selectableDataTypes:f.value,largeEntityThreshold:y.value,flagEntitiesWithoutRelations:_.value,embeddableCatalog:a.value,superClassCatalog:s.value})),Ae=()=>zr(o.logical,$.value),Fe=n.validationDebounceMs??250;let se,ne=()=>{};if(Fe>0){const J=t.shallowRef(sa(Ae(),ye.value));let re;ne=()=>{re!==void 0&&(clearTimeout(re),re=void 0),J.value=sa(Ae(),ye.value)},t.watch([h,ye,$],()=>{re!==void 0&&clearTimeout(re),re=setTimeout(ne,Fe)},{flush:"sync"}),se=t.computed(()=>J.value)}else se=t.computed(()=>sa(Ae(),ye.value));const ae=t.computed(()=>{const J=new Map;for(const re of se.value){if(!re.targetRef)continue;const Ke=J.get(re.targetRef);Ke?Ke.push(re):J.set(re.targetRef,[re])}return J}),me=1500,P=new Map,D=J=>{const re=Date.now();re-(P.get(J)??0)<me||(P.set(J,re),C(J))},z=J=>{if(!be.value){if(!x.value){D(m("em.notice.readOnly"));return}try{i.execute(J)}catch(re){console.error(`[command] 적용 실패 — 로컬 상태가 부분 변형됐을 수 있다 (${J.label}):`,re),x.value=!1,be.value={label:J.label}}}},Q=J=>o.layout.entityLayouts.some(re=>re.entityRef===J&&!!re.locked),ee=J=>o.layout.groupLayouts.some(re=>re.groupRef===J&&!!re.locked),we=J=>{const re=o.logical.associations.find(Ke=>Ke.modelId===J);return!!re&&(Q(re.end1.entityRef)||Q(re.end2.entityRef))},de=J=>Q(J)?(D(m("em.notice.entityLocked")),!0):!1,xe=J=>ee(J)?(D(m("em.notice.groupLocked")),!0):!1,Ce=J=>we(J)?(D(m("em.notice.assocLocked")),!0):!1,Y=WC({state:o,clipboard:oe,selection:I,inspectedEntityId:L,editable:x,run:z}),X=eS({state:o,selection:I,focusRequest:H,run:z,gateEntityLocked:de,isEntityLockedFn:Q,isGroupLockedFn:ee}),q=JC({state:o,editable:x,run:z,gateEntityLocked:de,isEntityLockedFn:Q,isAssocLockedFn:we}),Ie=KC({state:o,editable:x,run:z,gateEntityLocked:de,embeddableCatalog:a,t:m,emitGateNotice:D,selection:I}),Be=XC({state:o,editable:x,run:z,selection:I,gateEntityLocked:de,gateGroupLocked:xe,isGroupLockedFn:ee}),ze=QC({editable:x,run:z}),Ue=jC({state:o,editable:x,run:z,gateEntityLocked:de,gateAssocLocked:Ce});return{state:o,resolved:_e,issues:se,issuesByRef:ae,flagEntitiesWithoutRelations:_,canUndo:g,canRedo:b,dirty:E,revision:h,notice:N,editable:x,schemaVersion:S,opWriteEnabled:V,opMode:R,opConflict:ue,commandFailure:be,historyTransport:pe.historyTransport,historyAvailable:pe.historyAvailable,restoreTransport:pe.restoreTransport,restoreAvailable:pe.restoreAvailable,restoreToSeq:pe.restoreToSeq,reloadRequest:pe.reloadRequest,displayMode:T,routingMode:M,showGrid:k,showMinimap:v,selection:I,selectedAttr:O,selectedAttrIds:A,inspectedEntityId:L,focusRequest:H,clipboard:oe,embeddableCatalog:a,groupCodeCatalog:r,predefinedCustomTypeCatalog:l,superClassCatalog:s,languages:c,userLanguage:d,referenceOnlyDocument:$,uiLocale:u,t:m,selectableDataTypes:f,setEditable(J){x.value=J&&R.value},setEmbeddableCatalog(J){a.value=J},setGroupCodeCatalog(J){r.value=J},setPredefinedCustomTypeCatalog(J){l.value=J},setSuperClassCatalog(J){s.value=J},selectAttribute:X.selectAttribute,moveAttributeFocus:X.moveAttributeFocus,nudgeSelectedAttributes:X.nudgeSelectedAttributes,nudgeNodes:X.nudgeNodes,requestFocus:X.requestFocus,deleteSelection(){if(!x.value)return!1;const J=I.value;if(!J)return!1;if(J.kind==="attribute"){if(de(J.entityId))return!1;const re=J.ids;if(!re.length)return!1;re.length===1?Ie.removeAttribute(J.entityId,re[0]):Ie.removeAttributes(J.entityId,re)}else if(J.kind==="entity"){if(de(J.id))return!1;q.removeEntity(J.id)}else if(J.kind==="note")ze.removeNote(J.id);else if(J.kind==="group"){if(xe(J.id))return!1;Be.removeGroup(J.id)}else Ue.removeAssociation(J.id);return I.value=null,!0},undo:()=>{x.value&&i.undo()},redo:()=>{x.value&&i.redo()},markSaved:()=>{x.value&&(pe.flush(),i.markSavePoint())},loadDiagram(J,re){pe.teardownOpAdapter(),o.logical=J.logical,o.layout=J.layout,i=new _l(o),he(),S.value=(re==null?void 0:re.schemaVersion)??1,V.value=(re==null?void 0:re.opWriteEnabled)??!1,$.value=(re==null?void 0:re.referenceOnly)??!1,x.value=!(S.value>=2&&V.value===!1),ue.value=null,be.value=null,I.value=null,g.value=i.canUndo,b.value=i.canRedo,E.value=i.isDirty,pe.setupOpAdapter(i,re),ne()},flush:pe.flush,whenOpsSettled:pe.whenOpsSettled,addEntity:q.addEntity,renameEntity:q.renameEntity,updateEntity:q.updateEntity,moveEntity:q.moveEntity,resizeEntity:q.resizeEntity,removeEntity:q.removeEntity,setEntitySwatch:q.setEntitySwatch,setEntityCollapsed:q.setEntityCollapsed,setEntityLocked:q.setEntityLocked,isEntityLocked:q.isEntityLocked,isAssociationLocked:q.isAssociationLocked,collapseAll:q.collapseAll,expandAll:q.expandAll,setAttributeSwatch:Ie.setAttributeSwatch,dragGroup:Be.dragGroup,resizeGroup:Be.resizeGroup,setGroupSwatch:Be.setGroupSwatch,setGroupLocked:Be.setGroupLocked,isGroupLocked:Be.isGroupLocked,updateGroup:Be.updateGroup,createGroup:Be.createGroup,addEmptyGroup:Be.addEmptyGroup,removeGroup:Be.removeGroup,dropEntity:Be.dropEntity,ungroupEntity:Be.ungroupEntity,dropNote:Be.dropNote,addPredefinedEmbed:Ie.addPredefinedEmbed,addAttribute:Ie.addAttribute,addDivider:Ie.addDivider,updateAttribute:Ie.updateAttribute,setAttributeGroupCode:Ie.setAttributeGroupCode,setEmbedColumns:Ie.setEmbedColumns,removeAttribute:Ie.removeAttribute,removeAttributes:Ie.removeAttributes,setAttributeSwatches:Ie.setAttributeSwatches,reorderAttributes:Ie.reorderAttributes,addIndex(J,re){de(J)||z(Td(J,re))},updateIndex(J,re,Ke){de(J)||z(wa(J,re,Ke))},removeIndex(J,re){de(J)||z(Md(J,re))},addOperation(J,re={}){if(!x.value||de(J))return null;const Ke=o.logical.entities.find(We=>We.modelId===J),st=Ke!=null&&Ke.operations?zt(Ke.operations):0,qe=re.modelId??Pe(),nt={modelId:qe,name:re.name??`method${st}`,visibility:re.visibility??"PACKAGE",order:st,...re};return z(Cd(J,nt)),qe},updateOperation(J,re,Ke){de(J)||z(Sd(J,re,Ke))},removeOperation(J,re){de(J)||z(xd(J,re))},reorderOperations(J,re,Ke){!re.length||de(J)||z(Rd(J,re,Ke))},setOperationSwatch(J,re,Ke){z(Ad(J,re,Ke))},addAssociation:Ue.addAssociation,addEmbedAssociation:Ue.addEmbedAssociation,setEmbedCardinality:Ue.setEmbedCardinality,removeAssociation:Ue.removeAssociation,setAssociationIdentifying:Ue.setAssociationIdentifying,updateAssociationEnd:Ue.updateAssociationEnd,hasQuickFix(J){if(!x.value)return!1;const re=ol(J,o.logical);return re?re.kind==="setEndCascades"?!we(re.assocRef):!Q(re.entityRef):!1},applyQuickFix(J){if(!x.value)return!1;const re=ol(J,o.logical);if(!re)return!1;if(re.kind==="setIndexColumns")return de(re.entityRef)?!1:(z(wa(re.entityRef,re.indexRef,{columns:re.columns})),!0);if(Ce(re.assocRef))return!1;const Ke=o.logical.associations.find(st=>st.modelId===re.assocRef);return Ke?(z(Ht(re.assocRef,re.which,{jpa:{...Ke[re.which].jpa,cascadeTypes:re.cascades}})),!0):!1},moveWaypoint(J,re,Ke){z(Vd(J,re,Ke))},addWaypoint(J,re,Ke){z(Ld(J,re,Ke))},removeWaypoint(J,re){z(Bd(J,re))},clearWaypoints(J){z(Od(J))},addNote:ze.addNote,removeNote:ze.removeNote,moveNote:ze.moveNote,resizeNote:ze.resizeNote,setNoteMemo:ze.setNoteMemo,setNoteSwatch:ze.setNoteSwatch,addNoteConnection:ze.addNoteConnection,removeNoteConnection:ze.removeNoteConnection,moveNoteConnectionWaypoint:ze.moveNoteConnectionWaypoint,addNoteConnectionWaypoint:ze.addNoteConnectionWaypoint,removeNoteConnectionWaypoint:ze.removeNoteConnectionWaypoint,clearNoteConnectionWaypoints:ze.clearNoteConnectionWaypoints,autoLayout(){const J=qs(o.logical,o.layout);J.length&&z(rt("자동 배치",J.map(re=>To(re.id,re.location))))},copy:Y.copy,paste:Y.paste,importEntities:Y.importEntities}}const dr=Symbol("groupHover"),Jf=Symbol("groupDrag"),Go=Symbol("relationHighlight"),Xf=Symbol("diffOverlay"),Zf=Symbol("nodeInternals"),Qf=Symbol("columnResolution");function nS(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 ep(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let o=0;o<e.length;o++)if(!nS(e[o],n[o]))return!1;return!0}function tp(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(!ep(e.dbAttrs,n.dbAttrs))return!1}else if(i[r]!==a[r])return!1;return!0}function oS(e,n){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}function iS(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||!oS(i,a))return!1}for(const[o,i]of e.effectiveAttrs){const a=n.effectiveAttrs.get(o);if(!a||!tp(i,a))return!1}for(const[o,i]of e.embedCols){const a=n.embedCols.get(o);if(!a||!ep(i,a))return!1}for(const[o,i]of e.collectionTypes)if(n.collectionTypes.get(o)!==i)return!1;return!!aS(e.classRows,n.classRows)}function aS(e,n){if(e===n)return!0;if(!e||!n||e.length!==n.length)return!1;for(let o=0;o<e.length;o++){const i=e[o],a=n[o];if(i.synthetic!==a.synthetic||i.sourceAttrId!==a.sourceAttrId||i.targetName!==a.targetName||i.collection!==a.collection||i.attr!==a.attr&&!tp(i.attr,a.attr))return!1}return!0}function rS(){let e;return(n,o)=>e=lS(n,o,e)}function lS(e,n,o){const i=e.entities,a=new Map;let r=null;const l=()=>r??(r=new Map(i.map(s=>[s.modelId,s])));for(const s of i){const c=new Map,d=new Map,u=new Map;let m=null;const p=()=>m??(m=ko($n(s,i)));for(const E of s.attributes){if(Wi(E)){const C=E.dbAttrs[0];if(!(C!=null&&C.physicalName&&(C!=null&&C.dataType))){const S=Kn(E,s,i,e.associations);S&&c.set(E.modelId,{...E,dbAttrs:[{...C,physicalName:(C==null?void 0:C.physicalName)||S.physicalName,dataType:(C==null?void 0:C.dataType)||S.dataType,length:(C==null?void 0:C.length)??S.length,scale:(C==null?void 0:C.scale)??S.scale},...E.dbAttrs.slice(1)]})}}if(E.identifier&&E.attrType==="RELATION_OWN"){const C=So(e,s.modelId,E.modelId);if(C&&ua(E,C)){const S=c.get(E.modelId)??E,V=E.derivedIdFieldName||rl({...E,derivedIdFieldName:void 0},C,l());V&&c.set(E.modelId,{...S,derivedIdFieldName:V})}}const h=na(E,e.associations);if(h&&u.set(E.modelId,h),mn(E)){d.set(E.modelId,E.dbAttrs.map((C,S)=>{const V=Kn(E,s,i,e.associations,S);return V?{...C,physicalName:C.physicalName||V.physicalName,dataType:C.dataType||V.dataType,length:C.length??V.length,scale:C.scale??V.scale}:C}));continue}if(!E.attrType.startsWith("EMBED")||E.dbAttrs.length===0)continue;if(E.attrType!=="EMBED_PREDEF"){const C=p();d.set(E.modelId,E.dbAttrs.map((S,V)=>{const $=Gn(S,C);return $?{...S,physicalName:$.physicalName}:pn(E,S,V,s,e)}));continue}const N=n==null?void 0:n.find(C=>C.type===E.type);if(!N)continue;const w=p();d.set(E.modelId,E.dbAttrs.map((C,S)=>{const V=N.fields[S],$=Gn(C,w);return $?{...C,physicalName:$.physicalName,logicalName:C.logicalName??(V==null?void 0:V.logicalName),dataType:C.dataType||(V==null?void 0:V.dataType)||""}:V?{...C,physicalName:C.physicalName||V.physicalName,logicalName:C.logicalName??V.logicalName,dataType:C.dataType||V.dataType,length:C.length??V.length}:C}))}const f=new Map,y=new Map;for(const E of s.attributes){const h=d.get(E.modelId);if(h)for(let N=0;N<h.length;N++){const w=`${E.attrType}\0${E.type??""}\0${N}`,C={attrId:E.modelId,slot:N,name:h[N].physicalName??""},S=y.get(w);S?S.push(C):y.set(w,[C])}}for(const E of y.values()){if(E.length<2)continue;const h=new Map;for(const N of E)h.set(N.name,(h.get(N.name)??0)+1);for(const N of E){if((h.get(N.name)??0)<2)continue;const w=f.get(N.attrId);w?w.add(N.slot):f.set(N.attrId,new Set([N.slot]))}}const _=ll(s,e).fields.map(E=>{var h;return{attr:E.attr,synthetic:E.synthetic,sourceAttrId:E.sourceAttr.modelId,targetName:(h=E.target)==null?void 0:h.name,collection:E.collection}}),g={effectiveAttrs:c,embedCols:d,collectionTypes:u,redundantSlots:f,classRows:_},b=o==null?void 0:o.get(s.modelId);a.set(s.modelId,b&&iS(g,b)?b:g)}return a}const np=Symbol("embedSlotCollapse"),op=(e,n)=>`${e}:${n}`,ip="all:",ap="one:",rp="fk:",lp=e=>`${ip}${e}`,sS=(e,n)=>`${ap}${e}:${n}`,cS=(e,n)=>`${rp}${e}:${n}`,dS=e=>e.startsWith(rp)||!e.startsWith(ip)&&!e.startsWith(ap),uS=["title"],mS={key:0,class:"em-sel","aria-hidden":"true"},fS=["title","aria-expanded","disabled"],pS={class:"em-entity__stereotype"},hS={key:1,class:"em-entity__name"},yS=["title","aria-expanded"],gS={"aria-hidden":"true"},bS=["data-attr","title","onClick","onPointerdown","onPointermove","onPointerup","onPointercancel"],_S=["onPointerdown"],kS={key:1,class:"em-entity__divider-label"},ES=["title"],NS={class:"em-key-slot"},wS={class:"em-key-slot"},IS=["title","aria-expanded","onClick"],vS=["title","onClick"],CS=["title","aria-expanded","onClick"],SS={key:2,class:"em-entity__type"},xS=["onClick"],RS={class:"em-entity__attrname"},AS={class:"em-entity__type"},$S={key:1,class:"em-entity__embed-summary"},TS=["title"],MS=["data-op"],VS=["onPointerdown"],BS={class:"em-entity__op-vis","aria-hidden":"true"},DS=["title"],OS={key:4,class:"em-entity__footer"},sp=tt(t.defineComponent({__name:"EntityNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(po,null),i=(G,W)=>o?o.t(G,W):qt("ko",G,W),a=t.computed(()=>(o==null?void 0:o.userLanguage.value)??"ko"),r=te.useModal();function l(){o&&lr(r,o,n.id)}const s=t.inject(dr,null),c=t.inject(Go,null),d=t.inject(Xf,null),u=t.computed(()=>{var G;return((G=d==null?void 0:d.marks.value)==null?void 0:G.get(n.id))??null}),m=t.inject(Qf,null),p=t.computed(()=>m==null?void 0:m.value.get(n.id)),f=t.inject(np,void 0),y=t.inject(Zf,null);t.onUpdated(()=>y==null?void 0:y.mark(n.id));const _=t.computed(()=>!!o&&o.editable.value);function g(){s&&(s.value=n.data.groupRef??null)}function b(){c==null||c.setEntityHover(n.id)}function E(){c==null||c.setEntityHover(null)}const h=t.computed(()=>!!c&&c.primaryEntityIds.value.has(n.id)),N=t.computed(()=>!!c&&c.relatedEntityIds.value.has(n.id)&&!h.value),w=t.computed(()=>{var G;return((G=o==null?void 0:o.selection.value)==null?void 0:G.kind)==="entity"&&o.selection.value.id===n.id}),C=t.computed(()=>!!n.selected&&!w.value),S=t.computed(()=>{var G;return o&&((G=o.selectedAttr.value)==null?void 0:G.entityId)===n.id?new Set(o.selectedAttrIds.value):new Set}),V=t.computed(()=>S.value.size>0);function $(G,W){const ve=W.shiftKey?"range":W.metaKey||W.ctrlKey?"toggle":"replace";o==null||o.selectAttribute(n.id,O(G),ve)}const R=t.computed(()=>!!c&&c.active.value&&!c.relatedEntityIds.value.has(n.id)&&!w.value),x=t.computed(()=>n.data.entity),T=t.computed(()=>qh(x.value,o==null?void 0:o.referenceOnlyDocument.value)),M=t.computed(()=>n.data.displayMode??"LOGICAL_PHYSICAL"),k=t.computed(()=>{var G;if(M.value==="CLASS"){const W=(G=p.value)==null?void 0:G.classRows;if(W)return W.map(ve=>ve.attr)}return[...x.value.attributes].sort((W,ve)=>W.order-ve.order)}),v=t.computed(()=>{var W;const G=M.value==="CLASS"?(W=p.value)==null?void 0:W.classRows:void 0;return new Set((G??[]).filter(ve=>ve.synthetic).map(ve=>ve.attr.modelId))});function I(G){return v.value.has(G.modelId)}function O(G){return H.value.get(G.modelId)??G.modelId}function A(G){return S.value.has(O(G))}function L(G){var W;return!!((W=u.value)!=null&&W.changedAttributeIds.has(O(G)))}const H=t.computed(()=>{var W;const G=new Map;if(M.value!=="CLASS")return G;for(const ve of((W=p.value)==null?void 0:W.classRows)??[])ve.synthetic&&G.set(ve.attr.modelId,ve.sourceAttrId);return G}),oe=t.computed(()=>{var ve;const G=new Map,W=M.value==="CLASS";for(const $e of((ve=p.value)==null?void 0:ve.classRows)??[])!W&&!mn($e.attr)||($e.targetName||$e.collection)&&G.set($e.attr.modelId,{targetName:$e.targetName,collection:$e.collection});return G}),ue=t.computed(()=>n.data.collapsed??!1),be=t.computed(()=>n.data.locked??!1),pe=t.computed(()=>_.value&&!be.value);function he(){_.value&&(o==null||o.setEntityCollapsed(n.id,!ue.value))}const _e=t.computed(()=>M.value==="PHYSICAL"||M.value==="LOGICAL_PHYSICAL"),ye=t.computed(()=>{const G=M.value==="PHYSICAL"||M.value==="LOGICAL_PHYSICAL",W={};for(const ve of k.value){const $e=ve.attrType.startsWith("RELATION")&&ve.dbAttrs.length>0;W[ve.modelId]={pk:ve.identifier,fk:$e&&G,required:ve.notNull&&!ve.identifier}}return W});function Ae(G){if(!G)return"";const W=[];return G.pk&&G.fk?W.push(i("em.node.keyPfk")):G.pk?W.push(i("em.node.keyPk")):G.fk&&W.push(i("em.node.keyFk")),G.required&&W.push(i("em.node.required")),W.join(" · ")}const Fe=t.computed(()=>{const G=hs(St(n.data.style)),W={};return G&&(W["--em-header-bg"]=G.bar,W["--em-header-fg"]=G.barOn),W});function se(G){var W,ve;return(ve=hs(St((W=n.data.attributeStyles)==null?void 0:W[G.modelId])))==null?void 0:ve.text}const ne=t.computed(()=>[...x.value.operations??[]].sort((G,W)=>G.order-W.order)),ae=t.computed(()=>M.value==="CLASS"&&ne.value.length>0),me={PUBLIC:"+",PRIVATE:"-",PROTECTED:"#",PACKAGE:"~"};function P(G){return G?me[G]:"~"}function D(G){var W,ve;return(ve=hs(St((W=n.data.operationStyles)==null?void 0:W[G.modelId])))==null?void 0:ve.text}function z(G,W,ve){switch(M.value){case"CLASS":return[{text:G}];case"PHYSICAL":return[{text:ve||G}];case"LOGICAL":return[W?{text:W}:{text:i("em.node.logicalMissing"),missing:!0}];default:{const $e=W?{text:W}:{text:i("em.node.logicalMissing"),missing:!0};return ve?[$e,{text:` · ${ve}`}]:[$e]}}}function Q(G){var W;return((W=p.value)==null?void 0:W.effectiveAttrs.get(G.modelId))??G}function ee(G){var ve,$e,Ee;if(Ce(G))return[{text:G.name}];const W=Q(G);return z(we(G),($e=(ve=W.dbAttrs[0])==null?void 0:ve.logicalName)==null?void 0:$e[a.value],((Ee=W.dbAttrs[0])==null?void 0:Ee.physicalName)??"")}function we(G){return M.value==="CLASS"?G.name:Q(G).derivedIdFieldName||G.name}function de(G){return G.attrType.startsWith("EMBED")&&G.dbAttrs.length>0}const xe=mn;function Ce(G){return de(G)||xe(G)}function Y(G){return xe(G)?cS(n.id,G.modelId):sS(n.id,G.modelId)}function X(G){return G.attrType==="DIVIDER"}function q(G){var W;return((W=p.value)==null?void 0:W.embedCols.get(G.modelId))??G.dbAttrs}function Ie(G){var W;return(W=p.value)==null?void 0:W.redundantSlots.get(G.modelId)}const Be=t.computed(()=>(f==null?void 0:f.isCollapsed(lp(n.id)))??!1),ze=t.computed(()=>Be.value&&_e.value?k.value.reduce((G,W)=>Ce(W)?G+q(W).length:G,0):0),Ue=t.computed(()=>k.value.some(G=>Ce(G)));function ie(G){const W=Ie(G);return!W||W.size===0?!1:f?f.isCollapsed(op(n.id,G.modelId)):!1}function Se(G){var W;return ie(G)?((W=Ie(G))==null?void 0:W.size)??0:0}function je(G){return f?f.isCollapsed(Y(G)):!1}function Ze(G){var W;return!_e.value||Be.value?null:je(G)?"attr":(((W=Ie(G))==null?void 0:W.size)??0)>0?"slot":null}function J(G){return!Be.value&&Ce(G)}function re(G){return je(G)?q(G).length:0}function Ke(G){if(Be.value||je(G))return[];const W=q(G);if(!ie(G))return W;const ve=Ie(G);return W.filter(($e,Ee)=>!ve.has(Ee))}function st(G){f==null||f.toggle(op(n.id,G.modelId))}function qe(G){f==null||f.toggle(Y(G))}function nt(){f==null||f.toggle(lp(n.id))}function We(G){var W;return z(G.physicalName,(W=G.logicalName)==null?void 0:W[a.value],G.physicalName)}function K(G){var $e;const W=oe.value.get(G.modelId),ve=(W==null?void 0:W.collection)??(($e=p.value)==null?void 0:$e.collectionTypes.get(G.modelId));return Yr(M.value,Q(G),ve,W==null?void 0:W.targetName)}const le=t.computed(()=>{const G={};for(const W of k.value)G[W.modelId]=K(W);return G}),Re=t.computed(()=>{var G,W,ve;return z(x.value.name,(W=(G=x.value.table)==null?void 0:G.logicalName)==null?void 0:W[a.value],((ve=x.value.table)==null?void 0:ve.physicalName)??"")}),ke=t.ref(!1),U=t.ref(""),bt=t.ref(null);async function vt(){var G,W;pe.value&&(U.value=x.value.name,ke.value=!0,await t.nextTick(),(G=bt.value)==null||G.focus(),(W=bt.value)==null||W.select())}function ot(){if(!ke.value)return;ke.value=!1;const G=U.value.trim();G&&G!==x.value.name&&(o==null||o.renameEntity(n.id,G))}function Ge(){o==null||o.addAttribute(n.id)}function Xe(){o==null||o.addDivider(n.id)}const{screenToFlowCoordinate:Z,findNode:Rt}=et(),$t=t.ref(null),Sn=t.computed(()=>{const G=$t.value??n.data.size;return G?{width:`${G.width}px`,minHeight:`${G.height}px`}:void 0});let At=null;function ge(G){var $e,Ee,Qe;if(!pe.value)return;G.stopPropagation();const W=($e=Rt(n.id))==null?void 0:$e.dimensions,ve=Z({x:G.clientX,y:G.clientY});At={fx:ve.x,fy:ve.y,w:(W==null?void 0:W.width)??((Ee=n.data.size)==null?void 0:Ee.width)??200,h:(W==null?void 0:W.height)??((Qe=n.data.size)==null?void 0:Qe.height)??120},G.target.setPointerCapture(G.pointerId)}function ft(G){if(!At)return;const W=Z({x:G.clientX,y:G.clientY});$t.value={width:Math.max(40,At.w+(W.x-At.fx)),height:Math.max(40,At.h+(W.y-At.fy))}}function xn(G){var W,ve,$e;if(At&&$t.value&&o){const Ee=(W=Rt(n.id))==null?void 0:W.dimensions;o.resizeEntity(n.id,{width:Math.round((Ee==null?void 0:Ee.width)??$t.value.width),height:Math.round((Ee==null?void 0:Ee.height)??$t.value.height)})}At=null,$t.value=null,($e=(ve=G.target).releasePointerCapture)==null||$e.call(ve,G.pointerId)}const Zt=t.ref(null),B=t.ref(null);function F(G,W){if(!pe.value)return;W.stopPropagation(),W.preventDefault();const ve=S.value,$e=ve.has(G.modelId)?new Set(ve):new Set([G.modelId]);B.value={ids:$e,dropIndex:-1,lineY:0},W.target.setPointerCapture(W.pointerId)}function j(G){if(!B.value||!Zt.value)return;const W=Array.from(Zt.value.querySelectorAll(".em-entity__row"));if(!W.length)return;let ve=W.length;for(let Qe=0;Qe<W.length;Qe++){const Tt=W[Qe].getBoundingClientRect();if(G.clientY<Tt.top+Tt.height/2){ve=Qe;break}}const $e=W[W.length-1],Ee=ve<W.length?W[ve].offsetTop:$e.offsetTop+$e.offsetHeight;B.value={...B.value,dropIndex:ve,lineY:Ee}}function fe(){const G=B.value;if(B.value=null,!G||G.dropIndex<0)return;const W=k.value,ve=W.filter(Et=>G.ids.has(Et.modelId)).map(Et=>Et.modelId),$e=W.filter((Et,_o)=>G.ids.has(Et.modelId)&&_o<G.dropIndex).length,Ee=G.dropIndex-$e,Qe=W.filter(Et=>!G.ids.has(Et.modelId)).map(Et=>Et.modelId);[...Qe.slice(0,Ee),...ve,...Qe.slice(Ee)].join(",")!==W.map(Et=>Et.modelId).join(",")&&(o==null||o.reorderAttributes(n.id,ve,Ee))}function Te(){B.value=null}const Oe=t.ref(null),ce=t.ref(null);function Le(G,W){pe.value&&(W.stopPropagation(),W.preventDefault(),ce.value={id:G.modelId,dropIndex:-1,lineY:0},W.target.setPointerCapture(W.pointerId))}function Ye(G){if(!ce.value||!Oe.value)return;const W=Array.from(Oe.value.querySelectorAll(".em-entity__op-row"));if(!W.length)return;let ve=W.length;for(let Qe=0;Qe<W.length;Qe++){const Tt=W[Qe].getBoundingClientRect();if(G.clientY<Tt.top+Tt.height/2){ve=Qe;break}}const $e=W[W.length-1],Ee=ve<W.length?W[ve].offsetTop:$e.offsetTop+$e.offsetHeight;ce.value={...ce.value,dropIndex:ve,lineY:Ee}}function Je(){const G=ce.value;if(ce.value=null,!G||G.dropIndex<0)return;const ve=ne.value.findIndex(Ee=>Ee.modelId===G.id);if(ve<0)return;const $e=G.dropIndex-(ve<G.dropIndex?1:0);$e!==ve&&(o==null||o.reorderOperations(n.id,[G.id],$e))}function ut(){ce.value=null}return(G,W)=>{var ve,$e;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-entity",{"is-hover-origin":h.value,"is-related":N.value,"is-dimmed":R.value,"is-selected":w.value,"is-multi-selected":C.value,"has-focused-attr":V.value,"is-locked":be.value,"is-reference-only":T.value,"is-diff-added":((ve=u.value)==null?void 0:ve.verb)==="added","is-diff-modified":(($e=u.value)==null?void 0:$e.verb)==="modified"}]),tabindex:"-1",title:T.value?i("em.entity.referenceOnlyHint"):void 0,style:t.normalizeStyle(Sn.value),onPointerdown:g,onMouseenter:b,onMouseleave:E,onDblclick:l},[w.value?(t.openBlock(),t.createElementBlock("div",mS,[...W[11]||(W[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(Fe.value),onDblclick:t.withModifiers(vt,["stop"])},[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__caret nodrag",title:i(ue.value?"em.panel.expand":"em.panel.collapse"),"aria-expanded":!ue.value,disabled:!_.value,onClick:t.withModifiers(he,["stop"]),onPointerdown:W[0]||(W[0]=t.withModifiers(()=>{},["stop"])),onDblclick:W[1]||(W[1]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(ue.value?"▸":"▾"),41,fS),t.createElementVNode("span",pS,"«"+t.toDisplayString(t.unref(ei)(x.value.stereotype))+"»",1),ke.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputEl",ref:bt,"onUpdate:modelValue":W[2]||(W[2]=Ee=>U.value=Ee),class:"em-entity__name-input nodrag",onKeyup:[t.withKeys(ot,["enter"]),W[3]||(W[3]=t.withKeys(Ee=>ke.value=!1,["esc"]))],onBlur:ot,onPointerdown:W[4]||(W[4]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,U.value]]):(t.openBlock(),t.createElementBlock("span",hS,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Re.value,(Ee,Qe)=>(t.openBlock(),t.createElementBlock("span",{key:Qe,class:t.normalizeClass({"em-entity__missing":Ee.missing})},t.toDisplayString(Ee.text),3))),128))])),!ue.value&&_e.value&&Ue.value?(t.openBlock(),t.createElementBlock("button",{key:2,tabindex:"-1",type:"button",class:"em-entity__embed-all nodrag",title:Be.value?i("em.node.embedAllShow"):i("em.node.embedAllHide"),"aria-expanded":!Be.value,onClick:t.withModifiers(nt,["stop"]),onPointerdown:W[5]||(W[5]=t.withModifiers(()=>{},["stop"])),onDblclick:W[6]||(W[6]=t.withModifiers(()=>{},["stop"]))},[t.createVNode(Ve,{name:"table",size:11}),t.createElementVNode("span",gS,t.toDisplayString(Be.value?"▸":"▾"),1)],40,yS)):t.createCommentVNode("",!0),be.value?(t.openBlock(),t.createBlock(Ve,{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),ue.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("ul",{key:1,ref_key:"attrsUl",ref:Zt,class:"em-entity__attrs"},[B.value&&B.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${B.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,Ee=>{var Qe,Tt,Et,_o,Gi;return t.openBlock(),t.createElementBlock(t.Fragment,{key:Ee.modelId},[t.createElementVNode("li",{class:t.normalizeClass(["em-entity__row",{"is-attr-selected":A(Ee),"is-dragging":(Qe=B.value)==null?void 0:Qe.ids.has(Ee.modelId),"is-embed":Ce(Ee),"is-divider":X(Ee),"has-embed-badge":!!Ze(Ee),nodrag:X(Ee)&&pe.value,"is-diff-changed":L(Ee),"is-synthetic":I(Ee)}]),"data-attr":Ee.modelId,title:I(Ee)?i("em.node.derivedIdRow"):void 0,onClick:t.withModifiers(pt=>$(Ee,pt),["stop"]),onPointerdown:pt=>X(Ee)?F(Ee,pt):void 0,onPointermove:pt=>X(Ee)?j(pt):void 0,onPointerup:pt=>X(Ee)?fe():void 0,onPointercancel:pt=>X(Ee)?Te():void 0},[pe.value&&!X(Ee)&&!I(Ee)?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:pt=>F(Ee,pt),onPointermove:j,onPointerup:fe,onPointercancel:Te,onClick:W[7]||(W[7]=t.withModifiers(()=>{},["stop"]))},"⠿",40,_S)):t.createCommentVNode("",!0),X(Ee)?(t.openBlock(),t.createElementBlock("span",kS,t.toDisplayString(Ee.name),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createVNode(t.unref(so),{id:`l:${Ee.modelId}`,type:"target",position:t.unref(De).Left,class:"em-handle",title:pe.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"]),t.createElementVNode("span",{class:"em-entity__keys",title:Ae(ye.value[Ee.modelId]),"aria-hidden":"true"},[t.createElementVNode("span",NS,[(Tt=ye.value[Ee.modelId])!=null&&Tt.pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:12,class:"em-key is-pk"})):(Et=ye.value[Ee.modelId])!=null&&Et.required?(t.openBlock(),t.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-key is-required"})):t.createCommentVNode("",!0)]),t.createElementVNode("span",wS,[_e.value&&J(Ee)?(t.openBlock(),t.createElementBlock("button",{key:0,tabindex:"-1",type:"button",class:"em-embed-caret nodrag",title:je(Ee)?i("em.node.embedAttrShow",{count:re(Ee)}):i("em.node.embedAttrHide"),"aria-expanded":!je(Ee),onClick:t.withModifiers(pt=>qe(Ee),["stop"]),onPointerdown:W[8]||(W[8]=t.withModifiers(()=>{},["stop"])),onDblclick:W[9]||(W[9]=t.withModifiers(()=>{},["stop"]))},t.toDisplayString(je(Ee)?"▸":"▾"),41,IS)):Ce(Ee)?(t.openBlock(),t.createBlock(Ve,{key:1,name:"table",size:11,class:"em-embed-glyph"})):(_o=ye.value[Ee.modelId])!=null&&_o.fk?(t.openBlock(),t.createBlock(Ve,{key:2,name:"key",size:12,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,ES),t.createElementVNode("span",{class:"em-entity__attrname",style:t.normalizeStyle({color:se(Ee)})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ee(Ee),(pt,Rn)=>(t.openBlock(),t.createElementBlock("span",{key:Rn,class:t.normalizeClass({"em-entity__missing":pt.missing})},t.toDisplayString(pt.text),3))),128))],4),Ze(Ee)==="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:re(Ee)}),onClick:t.withModifiers(pt=>qe(Ee),["stop"])},"+"+t.toDisplayString(re(Ee)),9,vS)):Ze(Ee)==="slot"?(t.openBlock(),t.createElementBlock("button",{key:1,tabindex:"-1",type:"button",class:"em-entity__embed-fold nodrag","data-axis":"slot",title:ie(Ee)?i("em.node.embedRepeatedShow",{count:((Gi=Ie(Ee))==null?void 0:Gi.size)??0}):i("em.node.embedRepeatedHide"),"aria-expanded":!ie(Ee),onClick:t.withModifiers(pt=>st(Ee),["stop"])},t.toDisplayString(ie(Ee)?`+${Se(Ee)}`:"−"),9,CS)):t.createCommentVNode("",!0),le.value[Ee.modelId]?(t.openBlock(),t.createElementBlock("span",SS,t.toDisplayString(le.value[Ee.modelId]),1)):t.createCommentVNode("",!0),t.createVNode(t.unref(so),{id:`r:${Ee.modelId}`,type:"source",position:t.unref(De).Right,class:"em-handle",title:pe.value?i("em.node.connectHint"):void 0},null,8,["id","position","title"])],64))],42,bS),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ce(Ee)&&_e.value?Ke(Ee):[],pt=>(t.openBlock(),t.createElementBlock("li",{key:`${Ee.modelId}:${pt.modelId}`,class:t.normalizeClass(["em-entity__embed-col",{"is-group-selected":A(Ee)}]),onClick:t.withModifiers(Rn=>$(Ee,Rn),["stop"])},[W[12]||(W[12]=t.createElementVNode("span",{class:"em-entity__embed-rail","aria-hidden":"true"},null,-1)),t.createElementVNode("span",RS,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(We(pt),(Rn,Mr)=>(t.openBlock(),t.createElementBlock("span",{key:Mr,class:t.normalizeClass({"em-entity__missing":Rn.missing})},t.toDisplayString(Rn.text),3))),128))]),t.createElementVNode("span",AS,t.toDisplayString(pt.dataType),1)],10,xS))),128))],64)}),128)),ze.value?(t.openBlock(),t.createElementBlock("li",$S,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__embed-summary-btn nodrag",title:i("em.node.embedAllShow"),onClick:t.withModifiers(nt,["stop"])},[t.createVNode(Ve,{name:"table",size:11}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.embedAllSummary",{n:ze.value})),1)],8,TS)])):t.createCommentVNode("",!0)],512)),!ue.value&&ae.value?(t.openBlock(),t.createElementBlock("ul",{key:2,ref_key:"opsUl",ref:Oe,class:"em-entity__ops"},[ce.value&&ce.value.dropIndex>=0?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-entity__drop-line",style:t.normalizeStyle({top:`${ce.value.lineY}px`}),"aria-hidden":"true"},null,4)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ne.value,Ee=>{var Qe,Tt;return t.openBlock(),t.createElementBlock("li",{key:Ee.modelId,class:t.normalizeClass(["em-entity__op-row",{"is-dragging":((Qe=ce.value)==null?void 0:Qe.id)===Ee.modelId,"is-diff-changed":!!((Tt=u.value)!=null&&Tt.changedOperationIds.has(Ee.modelId))}]),"data-op":Ee.modelId},[pe.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-entity__grip nodrag","aria-hidden":"true",onPointerdown:Et=>Le(Ee,Et),onPointermove:Ye,onPointerup:Je,onPointercancel:ut,onClick:W[10]||(W[10]=t.withModifiers(()=>{},["stop"]))},"⠿",40,VS)):t.createCommentVNode("",!0),t.createElementVNode("span",BS,t.toDisplayString(P(Ee.visibility)),1),t.createElementVNode("span",{class:"em-entity__op-name",style:t.normalizeStyle({color:D(Ee)})},t.toDisplayString(Ee.name)+"()",5)],10,MS)}),128))],512)):ne.value.length?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-entity__ops-summary",title:i("em.node.opsSummaryTitle",{n:ne.value.length})},[t.createVNode(Ve,{name:"method",size:12}),t.createElementVNode("span",null,t.toDisplayString(i("em.node.opsSummary",{n:ne.value.length})),1)],8,DS)):t.createCommentVNode("",!0),pe.value?(t.openBlock(),t.createElementBlock("footer",OS,[t.createElementVNode("button",{tabindex:"-1",type:"button",class:"em-entity__add nodrag",onClick:Ge},t.toDisplayString(i("em.node.addAttr")),1),W[13]||(W[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:Xe},t.toDisplayString(i("em.node.addDivider")),1)])):t.createCommentVNode("",!0),pe.value&&!ke.value?(t.openBlock(),t.createElementBlock("div",{key:5,class:"em-entity__resize nodrag nopan",onPointerdown:ge,onPointermove:ft,onPointerup:xn},null,32)):t.createCommentVNode("",!0)],46,uS)}}}),[["__scopeId","data-v-79399400"]]),LS={key:0,class:"em-sel","aria-hidden":"true"},PS={class:"em-group__label"},zS={class:"em-group__name"},FS={key:0,class:"em-group__pkg"},US={key:1,class:"em-group__flag"},cp=tt(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(()=>St(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(po,null),s=(x,T)=>l?l.t(x,T):qt("ko",x,T),c=t.computed(()=>!!l&&l.editable.value),d=t.computed(()=>{var x;return!!n.id&&((x=l==null?void 0:l.selection.value)==null?void 0:x.kind)==="group"&&l.selection.value.id===n.id}),u=t.computed(()=>!!n.selected&&!d.value),m=t.inject(dr,null),p=t.computed(()=>!!n.id&&(m==null?void 0:m.value)===n.id),f=t.inject(Go,null);function y(){n.id&&(f==null||f.setGroupHover(n.id))}function _(){f==null||f.setGroupHover(null)}const g=t.computed(()=>!!f&&f.hoverGroupId.value===n.id),b=t.computed(()=>!!f&&f.hoverGroupId.value!==null&&f.hoverGroupId.value!==n.id),{screenToFlowCoordinate:E,findNode:h}=et();let N=null,w=null;function C(x){var k;if(!n.id||!c.value)return;x.stopPropagation();const T=((k=h(n.id))==null?void 0:k.dimensions)??{width:400,height:300},M=E({x:x.clientX,y:x.clientY});N={fx:M.x,fy:M.y,w:T.width,h:T.height},x.target.setPointerCapture(x.pointerId)}function S(x){if(!N||!n.id)return;const T=E({x:x.clientX,y:x.clientY});w={width:Math.max(160,N.w+(T.x-N.fx)),height:Math.max(120,N.h+(T.y-N.fy))};const M=h(n.id);M&&(M.style={width:`${w.width}px`,height:`${w.height}px`})}function V(x){var T,M;N&&w&&n.id&&l&&l.resizeGroup(n.id,w),N=null,w=null,(M=(T=x.target).releasePointerCapture)==null||M.call(T,x.pointerId)}const $=t.computed(()=>(l==null?void 0:l.userLanguage.value)??"ko"),R=t.computed(()=>{const x=o.value.name;return(x==null?void 0:x[$.value])||(x==null?void 0:x.ko)||(x==null?void 0:x.en)||(x==null?void 0:x.ja)||(x==null?void 0:x.zh)||o.value.packageName||s("em.group.fallback")});return(x,T)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-group",{"is-drop-target":p.value,"is-hover-origin":g.value,"is-dimmed":b.value,"is-selected":d.value,"is-multi-selected":u.value,"is-locked":i.value}]),tabindex:"-1",style:t.normalizeStyle(r.value),onMouseenter:y,onMouseleave:_},[d.value?(t.openBlock(),t.createElementBlock("div",LS,[...T[0]||(T[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",PS,[t.createElementVNode("span",zS,t.toDisplayString(R.value),1),o.value.packageName?(t.openBlock(),t.createElementBlock("span",FS,t.toDisplayString(o.value.packageName),1)):t.createCommentVNode("",!0),o.value.excludeDDLGeneration?(t.openBlock(),t.createElementBlock("span",US,t.toDisplayString(s("em.group.ddlExcludeBadge")),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(Ve,{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:C,onPointermove:S,onPointerup:V},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-27b80057"]]),HS={key:0,class:"em-sel","aria-hidden":"true"},jS={key:2,class:"em-note__text"},dp=tt(t.defineComponent({__name:"NoteNode",props:{id:{},selected:{type:Boolean},data:{}},setup(e){const n=e,o=t.inject(po,null),i=t.inject(dr,null),a=t.inject(Go,null),r=t.computed(()=>n.data.note),l=t.computed(()=>!!o&&o.editable.value),s=t.computed(()=>St(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 p=t.computed(()=>{var k;return((k=a==null?void 0:a.source.value)==null?void 0:k.kind)==="note"&&a.source.value.id===n.id}),f=t.computed(()=>!!a&&a.relatedNoteIds.value.has(n.id)&&!p.value),y=t.computed(()=>{var k;return((k=o==null?void 0:o.selection.value)==null?void 0:k.kind)==="note"&&o.selection.value.id===n.id}),_=t.computed(()=>!!n.selected&&!y.value),g=t.computed(()=>!!a&&a.active.value&&!a.relatedNoteIds.value.has(n.id)&&!y.value),b=[{id:"n-top",pos:De.Top},{id:"n-right",pos:De.Right},{id:"n-bottom",pos:De.Bottom},{id:"n-left",pos:De.Left}],E=t.ref(!1),h=t.ref(""),N=t.ref(null);async function w(){var k;l.value&&(h.value=r.value.memo,E.value=!0,await t.nextTick(),(k=N.value)==null||k.focus())}function C(){E.value&&(E.value=!1,h.value!==r.value.memo&&(o==null||o.setNoteMemo(n.id,h.value)))}const{screenToFlowCoordinate:S,findNode:V}=et();let $=null,R=null;function x(k){var O;if(!l.value)return;k.stopPropagation();const v=((O=V(n.id))==null?void 0:O.dimensions)??r.value.geo.size,I=S({x:k.clientX,y:k.clientY});$={fx:I.x,fy:I.y,w:v.width,h:v.height},k.target.setPointerCapture(k.pointerId)}function T(k){if(!$)return;const v=S({x:k.clientX,y:k.clientY});R={width:Math.max(140,$.w+(v.x-$.fx)),height:Math.max(60,$.h+(v.y-$.fy))};const I=V(n.id);I&&(I.style={width:`${R.width}px`,height:`${R.height}px`})}function M(k){var v,I;$&&R&&o&&o.resizeNote(n.id,R),$=null,R=null,(I=(v=k.target).releasePointerCapture)==null||I.call(v,k.pointerId)}return(k,v)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["em-note",{"is-hover-origin":p.value,"is-related":f.value,"is-dimmed":g.value,"is-selected":y.value,"is-multi-selected":_.value}]),tabindex:"-1",style:t.normalizeStyle(c.value),onDblclick:w,onPointerdown:d,onMouseenter:u,onMouseleave:m},[y.value?(t.openBlock(),t.createElementBlock("div",HS,[...v[4]||(v[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),E.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:1,ref_key:"area",ref:N,"onUpdate:modelValue":v[0]||(v[0]=I=>h.value=I),class:"em-note__edit nodrag",onBlur:C,onKeydown:v[1]||(v[1]=t.withKeys(I=>E.value=!1,["esc"])),onPointerdown:v[2]||(v[2]=t.withModifiers(()=>{},["stop"]))},null,544)),[[t.vModelText,h.value]]):(t.openBlock(),t.createElementBlock("div",jS,t.toDisplayString(r.value.memo),1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(b,I=>t.createVNode(t.unref(so),{id:I.id,key:I.id,type:"source",position:I.pos,class:"em-note-handle",onPointerdown:v[3]||(v[3]=t.withModifiers(()=>{},["stop"]))},null,8,["id","position"])),64)),l.value&&!E.value?(t.openBlock(),t.createElementBlock("div",{key:3,class:"em-note__resize nodrag nopan",onPointerdown:x,onPointermove:T,onPointerup:M},null,32)):t.createCommentVNode("",!0)],38))}}),[["__scopeId","data-v-62a09d8c"]]);function ur(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 Yo=.5;function up(e,n,o,i,a,r){const l=ur(n),s=ur(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 p=e;const f=(g,b)=>{(Math.abs(g.x-p.x)>=Yo||Math.abs(g.y-p.y)>=Yo)&&(m.push({a:p,b:g,seg:b}),p=g)};f(c,0);let y=l.x!==0,_=c;for(let g=1;g<u.length;g++){const b=u[g],E=g<=o.length?g-1:o.length,h=Math.abs(b.x-_.x)<Yo,N=Math.abs(b.y-_.y)<Yo;h&&N||(h?(f(b,E),y=!1):N?(f(b,E),y=!0):y?(f({x:_.x,y:b.y},E),f(b,E),y=!0):(f({x:b.x,y:_.y},E),f(b,E),y=!1),_=b)}return f(i,o.length),m}function mp(e,n,o,i,a,r=20){const l=up(e,n,o,i,a,r);let s=`M ${xt(e.x)},${xt(e.y)}`;for(const c of l)s+=` L ${xt(c.b.x)},${xt(c.b.y)}`;return s}const KS=14;function fp(e,n,o,i,a,r=20){return up(e,n,o,i,a,r).filter(l=>Math.hypot(l.b.x-l.a.x,l.b.y-l.a.y)>=KS).map(l=>({point:{x:(l.a.x+l.b.x)/2,y:(l.a.y+l.b.y)/2},segIndex:l.seg}))}function xt(e){return Math.round(e*100)/100}const GS=36;function YS(e,n,o=GS){const i=Math.max(e.x,n.x)+o;return`M ${xt(e.x)},${xt(e.y)} L ${xt(i)},${xt(e.y)} L ${xt(i)},${xt(n.y)} L ${xt(n.x)},${xt(n.y)}`}function pp(e,n,o){const i=[e,...n,o];let a=`M ${xt(i[0].x)},${xt(i[0].y)}`;for(let r=1;r<i.length;r++)a+=` L ${xt(i[r].x)},${xt(i[r].y)}`;return a}function qS(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function hp(e,n){const o=qS(e),i=e.width/2,a=e.height/2,r=n.x-o.x,l=n.y-o.y;if(Math.abs(r)<Yo&&Math.abs(l)<Yo)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 yp(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 gp(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 WS=20,JS=22,XS=7,ZS=22,bp=31,_p=7,QS=20,kp=11,Ep=11,ex=bp+_p;function tx(e){return e==="NO_INSTANCE_OR_ONE_INSTANCE"||e==="ZERO_OR_MORE_INSTANCES"}function nx(e){return e==="ZERO_OR_MORE_INSTANCES"||e==="ONE_OR_MORE_INSTANCES"}function mr(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 Np(e,n){return Math.atan2(n.y-e.y,n.x-e.x)}function fr(e,n,o){return{x:Math.cos(o)*n+e.x,y:Math.sin(o)*n+e.y}}function wp(e,n,o,i){const a=i/2,r=e.x===n.x&&e.y===n.y?Math.PI/2:Np(e,n);return[fr(o,a,r-Math.PI/2),fr(o,a,r+Math.PI/2)]}function Ip(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 vp(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=mr(e,n,WS),[d,u]=wp(e,n,c,JS);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}),tx(o.multiplicity)){const m=mr(e,n,bp);r.push({cx:m.x,cy:m.y,r:_p})}if(nx(o.multiplicity)){const m=mr(e,n,XS),[p,f]=wp(e,n,m,ZS);a.push({x1:c.x,y1:c.y,x2:p.x,y2:p.y}),a.push({x1:c.x,y1:c.y,x2:f.x,y2:f.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=mr(e,n,QS),d={x:(e.x+c.x)/2,y:(e.y+c.y)/2},u=Np(e,n),m=fr(d,kp/2,u-Math.PI/2),p=fr(d,kp/2,u+Math.PI/2);l.push({points:[e,m,c,p]}),s=c}if(o.navigable&&!o.otherNavigable){const c=Math.atan2(n.x-e.x,n.y-e.y),d=Ip(s,c,Ep,!0),u=Ip(s,c,Ep,!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 Cp=200,Sp=120,ks=24;function xp(e){var a,r;if(!e)return{x:0,y:0,width:Cp,height:Sp};const n=e.computedPosition??e.position??{x:0,y:0},o=((a=e.dimensions)==null?void 0:a.width)||Cp,i=((r=e.dimensions)==null?void 0:r.height)||Sp;return{x:n.x,y:n.y,width:o,height:i}}function Rp(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ap(e){const n=t.computed(()=>xp(e.sourceNode())),o=t.computed(()=>xp(e.targetNode())),i=t.computed(()=>{const d=e.sourceNode(),u=e.targetNode();return!!d&&!!u&&d.id===u.id}),a=t.computed(()=>{var f,y;const d=n.value,u=d.x+d.width;let m=((f=e.sourceRowY)==null?void 0:f.call(e))??d.y+d.height/3,p=((y=e.targetRowY)==null?void 0:y.call(e))??d.y+d.height*2/3;if(Math.abs(p-m)<ks){const _=(m+p)/2;m=_-ks/2,p=_+ks/2}return{source:{x:u,y:m},target:{x:u,y:p}}}),r=t.computed(()=>e.waypoints()[0]??Rp(o.value)),l=t.computed(()=>{const d=e.waypoints();return d[d.length-1]??Rp(n.value)}),s=t.computed(()=>{var u;const d=(u=e.sourceRowY)==null?void 0:u.call(e);return d!=null?yp(n.value,d,r.value.x):hp(n.value,r.value)}),c=t.computed(()=>{var u;const d=(u=e.targetRowY)==null?void 0:u.call(e);return d!=null?yp(o.value,d,l.value.x):hp(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 Es=Symbol("waypointController"),ox=["d"],ix=["d"],ax=["d"],rx=["x1","y1","x2","y2"],lx=["cx","cy","r"],sx=["x","y"],cx=["x","y"],dx=["cx","cy","onDblclick"],ux=["x","y","onPointerdown","onDblclick"],$p=tt(t.defineComponent({inheritAttrs:!1,__name:"AssociationEdge",props:{id:{},sourceY:{},targetY:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=et(),i=t.inject(Es),a=t.inject(po,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Jf,null),s=t.inject(Go,null),c=t.computed(()=>!!s&&s.relatedEdgeIds.value.has(n.id)),d=t.computed(()=>{var ne;return((ne=a==null?void 0:a.selection.value)==null?void 0:ne.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 ne=l==null?void 0:l.value;if(!ne||!a)return null;const ae=a.resolved.value.entities,me=D=>{var z;return(z=ae.find(Q=>Q.entity.modelId===D))==null?void 0:z.groupRef},P=n.data.association;return me(P.end1.entityRef)===ne.groupId&&me(P.end2.entityRef)===ne.groupId?{dx:ne.dx,dy:ne.dy}:null}),p=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),f=t.ref(-1),y=t.ref({x:0,y:0}),_=t.computed(()=>{const ne=m.value;return p.value.map((ae,me)=>me===f.value?y.value:ne?{x:ae.x+ne.dx,y:ae.y+ne.dy}:ae)}),g=t.computed(()=>{var ne;return!!((ne=n.sourceNode.data)!=null&&ne.collapsed)}),b=t.computed(()=>{var ne;return!!((ne=n.targetNode.data)!=null&&ne.collapsed)}),{source:E,target:h,sourceSide:N,targetSide:w,isSelf:C}=Ap({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>_.value,sourceRowY:()=>n.data.sourceColumnRef&&!g.value?n.sourceY:void 0,targetRowY:()=>n.data.targetColumnRef&&!b.value?n.targetY:void 0}),S=ex+4,V=t.computed(()=>C.value?YS(E.value,h.value):(a==null?void 0:a.routingMode.value)==="orthogonal"?mp(E.value,N.value,_.value,h.value,w.value,S):pp(E.value,_.value,h.value)),$=t.computed(()=>C.value||!r.value?[]:(a==null?void 0:a.routingMode.value)==="orthogonal"?fp(E.value,N.value,_.value,h.value,w.value,S):gp(E.value,_.value,h.value).map((ne,ae)=>({point:ne,segIndex:ae}))),R=t.computed(()=>C.value||!r.value?[]:_.value),x=ea;function T(ne,ae){f.value=ne,y.value={...p.value[ne]},ae.target.setPointerCapture(ae.pointerId),ae.stopPropagation()}function M(ne){if(f.value<0)return;const ae=o({x:ne.clientX,y:ne.clientY});y.value={x:ae.x,y:ae.y}}function k(ne){var ae,me;f.value>=0&&i&&i.movePoint(n.id,f.value,{...y.value}),f.value=-1,(me=(ae=ne.target).releasePointerCapture)==null||me.call(ae,ne.pointerId)}function v(ne,ae){ae.stopPropagation(),i==null||i.removePoint(n.id,ne)}function I(ne,ae){if(!i)return;const me=o({x:ae.clientX,y:ae.clientY});i.insertPoint(n.id,ne,{x:me.x,y:me.y})}const O=t.computed(()=>x(n.data.association.end1.multiplicity)),A=t.computed(()=>x(n.data.association.end2.multiplicity)),L=t.computed(()=>(a==null?void 0:a.displayMode.value)==="CLASS"?"class":"db"),H=t.computed(()=>L.value==="class"),oe=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ne=ur(N.value);return{x:E.value.x+ne.x*10,y:E.value.y+ne.y*10}}return _.value[0]??h.value}),ue=t.computed(()=>{if((a==null?void 0:a.routingMode.value)==="orthogonal"){const ae=ur(w.value);return{x:h.value.x+ae.x*10,y:h.value.y+ae.y*10}}const ne=_.value;return ne[ne.length-1]??E.value}),be=t.computed(()=>{const ne=n.data.association;return{multiplicity:ne.end1.multiplicity,navigable:ne.end1.navigable,composition:ne.end1.composition,otherNavigable:ne.end2.navigable}}),pe=t.computed(()=>{const ne=n.data.association;return{multiplicity:ne.end2.multiplicity,navigable:ne.end2.navigable,composition:ne.end2.composition,otherNavigable:ne.end1.navigable}}),he=t.computed(()=>vp(E.value,oe.value,be.value,L.value)),_e=t.computed(()=>vp(h.value,ue.value,pe.value,L.value)),ye=t.computed(()=>[...he.value.lines,..._e.value.lines]),Ae=t.computed(()=>[...he.value.circles,..._e.value.circles]),Fe=t.computed(()=>[...he.value.polygons,..._e.value.polygons].map(ne=>`M${ne.points.map(ae=>`${ae.x},${ae.y}`).join(" L")} Z`)),se=t.computed(()=>({"is-highlighted":c.value,"is-dimmed":u.value,"is-selected":d.value}));return(ne,ae)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:V.value,fill:"none",class:"em-edge__hit"},null,8,ox),t.createElementVNode("path",{d:V.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,ix),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Fe.value,(me,P)=>(t.openBlock(),t.createElementBlock("path",{key:`mpoly-${P}`,d:me,class:t.normalizeClass(["em-edge__marker em-edge__marker--fill",se.value])},null,10,ax))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ye.value,(me,P)=>(t.openBlock(),t.createElementBlock("line",{key:`mline-${P}`,x1:me.x1,y1:me.y1,x2:me.x2,y2:me.y2,class:t.normalizeClass(["em-edge__marker",se.value])},null,10,rx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ae.value,(me,P)=>(t.openBlock(),t.createElementBlock("circle",{key:`mcirc-${P}`,cx:me.cx,cy:me.cy,r:me.r,class:t.normalizeClass(["em-edge__marker",se.value])},null,10,lx))),128)),H.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("text",{x:t.unref(E).x+8,y:t.unref(E).y-6,class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(O.value),11,sx),t.createElementVNode("text",{x:t.unref(h).x-8,y:t.unref(h).y-6,"text-anchor":"end",class:t.normalizeClass(["em-edge__mult",{"is-dimmed":u.value}])},t.toDisplayString(A.value),11,cx)],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList($.value,(me,P)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${P}`,cx:me.point.x,cy:me.point.y,r:"4",class:t.normalizeClass(["em-edge__mid",{"is-dimmed":u.value}]),onDblclick:t.withModifiers(D=>I(me.segIndex,D),["stop"])},null,42,dx))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(R.value,(me,P)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${P}`,x:me.x-5,y:me.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-edge__waypoint",{"is-dimmed":u.value}]),onPointerdown:D=>T(P,D),onPointermove:M,onPointerup:k,onDblclick:D=>v(P,D)},null,42,ux))),128))],64))}}),[["__scopeId","data-v-5468806a"]]);var wn=(e=>(e.Lines="lines",e.Dots="dots",e))(wn||{});const Tp=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]}`})},Mp=function({radius:e,color:n}){return t.h("circle",{cx:e,cy:e,r:e,fill:n})};wn.Lines+"",wn.Dots+"";const mx={[wn.Dots]:"#81818a",[wn.Lines]:"#eee"},fx=["id","x","y","width","height","patternTransform"],px={key:2,height:"100",width:"100"},hx=["fill"],yx=["x","y","fill"],gx={name:"Background",compatConfig:{MODE:3}},bx=t.defineComponent({...gx,props:{id:{},variant:{default:()=>wn.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}=et(),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,p]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],f=[m*l||1+d[0]/2,p*l||1+d[1]/2];return{scaledGap:d,offset:f,size:u}}),a=t.toRef(()=>`pattern-${n}${e.id?`-${e.id}`:""}`),r=t.toRef(()=>e.color||e.patternColor||mx[e.variant||wn.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(wn).Lines?(t.openBlock(),t.createBlock(t.unref(Tp),{key:0,size:l.lineWidth,color:r.value,dimensions:i.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===t.unref(wn).Dots?(t.openBlock(),t.createBlock(t.unref(Mp),{key:1,color:r.value,radius:i.value.size/2},null,8,["color","radius"])):t.createCommentVNode("",!0),l.bgColor?(t.openBlock(),t.createElementBlock("svg",px,[t.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,hx)])):t.createCommentVNode("",!0)])],8,fx)]),t.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,yx),t.renderSlot(l.$slots,"default",{id:a.value})],4))}}),_x={name:"ControlButton",compatConfig:{MODE:3}},kx=(e,n)=>{const o=e.__vccOpts||e;for(const[i,a]of n)o[i]=a;return o},Ex={type:"button",class:"vue-flow__controls-button"};function Nx(e,n,o,i,a,r){return t.openBlock(),t.createElementBlock("button",Ex,[t.renderSlot(e.$slots,"default")])}const ho=kx(_x,[["render",Nx]]),wx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Ix=[t.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function vx(e,n){return t.openBlock(),t.createElementBlock("svg",wx,Ix)}const Cx={render:vx},Sx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},xx=[t.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Rx(e,n){return t.openBlock(),t.createElementBlock("svg",Sx,xx)}const Ax={render:Rx},$x={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Tx=[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 Mx(e,n){return t.openBlock(),t.createElementBlock("svg",$x,Tx)}const Vx={render:Mx},Bx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Dx=[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 Ox(e,n){return t.openBlock(),t.createElementBlock("svg",Bx,Dx)}const Lx={render:Ox},Px={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},zx=[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 Fx(e,n){return t.openBlock(),t.createElementBlock("svg",Px,zx)}const Ux={render:Fx},Hx={name:"Controls",compatConfig:{MODE:3}},jx=t.defineComponent({...Hx,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Rm.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}=et(),p=t.toRef(()=>o.value||i.value||a.value),f=t.toRef(()=>d.value.zoom<=u.value),y=t.toRef(()=>d.value.zoom>=m.value);function _(){l(),n("zoomIn")}function g(){s(),n("zoomOut")}function b(){c(e.fitViewParams),n("fitView")}function E(){r(!p.value),n("interactionChange",!p.value)}return(h,N)=>(t.openBlock(),t.createBlock(t.unref(xf),{class:"vue-flow__controls",position:h.position},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"top"),h.showZoom?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.renderSlot(h.$slots,"control-zoom-in",{},()=>[t.createVNode(ho,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:_},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-zoom-in",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Cx))))])]),_:3},8,["disabled"])]),t.renderSlot(h.$slots,"control-zoom-out",{},()=>[t.createVNode(ho,{class:"vue-flow__controls-zoomout",disabled:f.value,onClick:g},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-zoom-out",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Ax))))])]),_:3},8,["disabled"])])],64)):t.createCommentVNode("",!0),h.showFitView?t.renderSlot(h.$slots,"control-fit-view",{key:1},()=>[t.createVNode(ho,{class:"vue-flow__controls-fitview",onClick:b},{default:t.withCtx(()=>[t.renderSlot(h.$slots,"icon-fit-view",{},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Vx))))])]),_:3})]):t.createCommentVNode("",!0),h.showInteractive?t.renderSlot(h.$slots,"control-interactive",{key:2},()=>[h.showInteractive?(t.openBlock(),t.createBlock(ho,{key:0,class:"vue-flow__controls-interactive",onClick:E},{default:t.withCtx(()=>[p.value?t.renderSlot(h.$slots,"icon-unlock",{key:0},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Ux))))]):t.createCommentVNode("",!0),p.value?t.createCommentVNode("",!0):t.renderSlot(h.$slots,"icon-lock",{key:1},()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Lx))))])]),_:3})):t.createCommentVNode("",!0)]):t.createCommentVNode("",!0),t.renderSlot(h.$slots,"default")]),_:3},8,["position"]))}});var Kx={value:()=>{}};function Ns(){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 pr(o)}function pr(e){this._=e}function Gx(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}})}pr.prototype=Ns.prototype={constructor:pr,on:function(e,n){var o=this._,i=Gx(e+"",o),a,r=-1,l=i.length;if(arguments.length<2){for(;++r<l;)if((a=(e=i[r]).type)&&(a=Yx(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]=Vp(o[a],e.name,n);else if(n==null)for(a in o)o[a]=Vp(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 pr(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 Yx(e,n){for(var o=0,i=e.length,a;o<i;++o)if((a=e[o]).name===n)return a.value}function Vp(e,n,o){for(var i=0,a=e.length;i<a;++i)if(e[i].name===n){e[i]=Kx,e=e.slice(0,i).concat(e.slice(i+1));break}return o!=null&&e.push({name:n,value:o}),e}var ws="http://www.w3.org/1999/xhtml";const Bp={svg:"http://www.w3.org/2000/svg",xhtml:ws,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function hr(e){var n=e+="",o=n.indexOf(":");return o>=0&&(n=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Bp.hasOwnProperty(n)?{space:Bp[n],local:e}:e}function qx(e){return function(){var n=this.ownerDocument,o=this.namespaceURI;return o===ws&&n.documentElement.namespaceURI===ws?n.createElement(e):n.createElementNS(o,e)}}function Wx(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Dp(e){var n=hr(e);return(n.local?Wx:qx)(n)}function Jx(){}function Is(e){return e==null?Jx:function(){return this.querySelector(e)}}function Xx(e){typeof e!="function"&&(e=Is(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 Pt(i,this._parents)}function Zx(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Qx(){return[]}function Op(e){return e==null?Qx:function(){return this.querySelectorAll(e)}}function eR(e){return function(){return Zx(e.apply(this,arguments))}}function tR(e){typeof e=="function"?e=eR(e):e=Op(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 Pt(i,a)}function Lp(e){return function(){return this.matches(e)}}function Pp(e){return function(n){return n.matches(e)}}var nR=Array.prototype.find;function oR(e){return function(){return nR.call(this.children,e)}}function iR(){return this.firstElementChild}function aR(e){return this.select(e==null?iR:oR(typeof e=="function"?e:Pp(e)))}var rR=Array.prototype.filter;function lR(){return Array.from(this.children)}function sR(e){return function(){return rR.call(this.children,e)}}function cR(e){return this.selectAll(e==null?lR:sR(typeof e=="function"?e:Pp(e)))}function dR(e){typeof e!="function"&&(e=Lp(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 Pt(i,this._parents)}function zp(e){return new Array(e.length)}function uR(){return new Pt(this._enter||this._groups.map(zp),this._parents)}function yr(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}yr.prototype={constructor:yr,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 mR(e){return function(){return e}}function fR(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 yr(e,r[l]);for(;l<c;++l)(s=n[l])&&(a[l]=s)}function pR(e,n,o,i,a,r,l){var s,c,d=new Map,u=n.length,m=r.length,p=new Array(u),f;for(s=0;s<u;++s)(c=n[s])&&(p[s]=f=l.call(c,c.__data__,s,n)+"",d.has(f)?a[s]=c:d.set(f,c));for(s=0;s<m;++s)f=l.call(e,r[s],s,r)+"",(c=d.get(f))?(i[s]=c,c.__data__=r[s],d.delete(f)):o[s]=new yr(e,r[s]);for(s=0;s<u;++s)(c=n[s])&&d.get(p[s])===c&&(a[s]=c)}function hR(e){return e.__data__}function yR(e,n){if(!arguments.length)return Array.from(this,hR);var o=n?pR:fR,i=this._parents,a=this._groups;typeof e!="function"&&(e=mR(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],p=m.length,f=gR(e.call(u,u&&u.__data__,d,i)),y=f.length,_=s[d]=new Array(y),g=l[d]=new Array(y),b=c[d]=new Array(p);o(u,m,_,g,b,f,n);for(var E=0,h=0,N,w;E<y;++E)if(N=_[E]){for(E>=h&&(h=E+1);!(w=g[h])&&++h<y;);N._next=w||null}}return l=new Pt(l,i),l._enter=s,l._exit=c,l}function gR(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function bR(){return new Pt(this._exit||this._groups.map(zp),this._parents)}function _R(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 kR(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,p=s[c]=new Array(m),f,y=0;y<m;++y)(f=d[y]||u[y])&&(p[y]=f);for(;c<a;++c)s[c]=o[c];return new Pt(s,this._parents)}function ER(){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 NR(e){e||(e=wR);function n(m,p){return m&&p?e(m.__data__,p.__data__):!m-!p}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 Pt(a,this._parents).order()}function wR(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function IR(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function vR(){return Array.from(this)}function CR(){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 SR(){let e=0;for(const n of this)++e;return e}function xR(){return!this.node()}function RR(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 AR(e){return function(){this.removeAttribute(e)}}function $R(e){return function(){this.removeAttributeNS(e.space,e.local)}}function TR(e,n){return function(){this.setAttribute(e,n)}}function MR(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function VR(e,n){return function(){var o=n.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function BR(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 DR(e,n){var o=hr(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?$R:AR:typeof n=="function"?o.local?BR:VR:o.local?MR:TR)(o,n))}function Fp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function OR(e){return function(){this.style.removeProperty(e)}}function LR(e,n,o){return function(){this.style.setProperty(e,n,o)}}function PR(e,n,o){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,o)}}function zR(e,n,o){return arguments.length>1?this.each((n==null?OR:typeof n=="function"?PR:LR)(e,n,o??"")):qo(this.node(),e)}function qo(e,n){return e.style.getPropertyValue(n)||Fp(e).getComputedStyle(e,null).getPropertyValue(n)}function FR(e){return function(){delete this[e]}}function UR(e,n){return function(){this[e]=n}}function HR(e,n){return function(){var o=n.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function jR(e,n){return arguments.length>1?this.each((n==null?FR:typeof n=="function"?HR:UR)(e,n)):this.node()[e]}function Up(e){return e.trim().split(/^|\s+/)}function vs(e){return e.classList||new Hp(e)}function Hp(e){this._node=e,this._names=Up(e.getAttribute("class")||"")}Hp.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 jp(e,n){for(var o=vs(e),i=-1,a=n.length;++i<a;)o.add(n[i])}function Kp(e,n){for(var o=vs(e),i=-1,a=n.length;++i<a;)o.remove(n[i])}function KR(e){return function(){jp(this,e)}}function GR(e){return function(){Kp(this,e)}}function YR(e,n){return function(){(n.apply(this,arguments)?jp:Kp)(this,e)}}function qR(e,n){var o=Up(e+"");if(arguments.length<2){for(var i=vs(this.node()),a=-1,r=o.length;++a<r;)if(!i.contains(o[a]))return!1;return!0}return this.each((typeof n=="function"?YR:n?KR:GR)(o,n))}function WR(){this.textContent=""}function JR(e){return function(){this.textContent=e}}function XR(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function ZR(e){return arguments.length?this.each(e==null?WR:(typeof e=="function"?XR:JR)(e)):this.node().textContent}function QR(){this.innerHTML=""}function eA(e){return function(){this.innerHTML=e}}function tA(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function nA(e){return arguments.length?this.each(e==null?QR:(typeof e=="function"?tA:eA)(e)):this.node().innerHTML}function oA(){this.nextSibling&&this.parentNode.appendChild(this)}function iA(){return this.each(oA)}function aA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rA(){return this.each(aA)}function lA(e){var n=typeof e=="function"?e:Dp(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function sA(){return null}function cA(e,n){var o=typeof e=="function"?e:Dp(e),i=n==null?sA:typeof n=="function"?n:Is(n);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function dA(){var e=this.parentNode;e&&e.removeChild(this)}function uA(){return this.each(dA)}function mA(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function fA(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function pA(e){return this.select(e?fA:mA)}function hA(e){return arguments.length?this.property("__data__",e):this.node().__data__}function yA(e){return function(n){e.call(this,n,this.__data__)}}function gA(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 bA(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 _A(e,n,o){return function(){var i=this.__on,a,r=yA(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 kA(e,n,o){var i=gA(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?_A:bA,a=0;a<r;++a)this.each(s(i[a],n,o));return this}function Gp(e,n,o){var i=Fp(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 EA(e,n){return function(){return Gp(this,e,n)}}function NA(e,n){return function(){return Gp(this,e,n.apply(this,arguments))}}function wA(e,n){return this.each((typeof n=="function"?NA:EA)(e,n))}function*IA(){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 Yp=[null];function Pt(e,n){this._groups=e,this._parents=n}function Vi(){return new Pt([[document.documentElement]],Yp)}function vA(){return this}Pt.prototype=Vi.prototype={constructor:Pt,select:Xx,selectAll:tR,selectChild:aR,selectChildren:cR,filter:dR,data:yR,enter:uR,exit:bR,join:_R,merge:kR,selection:vA,order:ER,sort:NR,call:IR,nodes:vR,node:CR,size:SR,empty:xR,each:RR,attr:DR,style:zR,property:jR,classed:qR,text:ZR,html:nA,raise:iA,lower:rA,append:lA,insert:cA,remove:uA,clone:pA,datum:hA,on:kA,dispatch:wA,[Symbol.iterator]:IA};function zn(e){return typeof e=="string"?new Pt([[document.querySelector(e)]],[document.documentElement]):new Pt([[e]],Yp)}function CA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Fn(e,n){if(e=CA(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 Cs={capture:!0,passive:!1};function Ss(e){e.preventDefault(),e.stopImmediatePropagation()}function SA(e){var n=e.document.documentElement,o=zn(e).on("dragstart.drag",Ss,Cs);"onselectstart"in n?o.on("selectstart.drag",Ss,Cs):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function xA(e,n){var o=e.document.documentElement,i=zn(e).on("dragstart.drag",null);n&&(i.on("click.drag",Ss,Cs),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 xs(e,n,o){e.prototype=n.prototype=o,o.constructor=e}function qp(e,n){var o=Object.create(e.prototype);for(var i in n)o[i]=n[i];return o}function Bi(){}var Di=.7,gr=1/Di,Wo="\\s*([+-]?\\d+)\\s*",Oi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",dn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",RA=/^#([0-9a-f]{3,8})$/,AA=new RegExp(`^rgb\\(${Wo},${Wo},${Wo}\\)$`),$A=new RegExp(`^rgb\\(${dn},${dn},${dn}\\)$`),TA=new RegExp(`^rgba\\(${Wo},${Wo},${Wo},${Oi}\\)$`),MA=new RegExp(`^rgba\\(${dn},${dn},${dn},${Oi}\\)$`),VA=new RegExp(`^hsl\\(${Oi},${dn},${dn}\\)$`),BA=new RegExp(`^hsla\\(${Oi},${dn},${dn},${Oi}\\)$`),Wp={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};xs(Bi,Li,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Jp,formatHex:Jp,formatHex8:DA,formatHsl:OA,formatRgb:Xp,toString:Xp});function Jp(){return this.rgb().formatHex()}function DA(){return this.rgb().formatHex8()}function OA(){return nh(this).formatHsl()}function Xp(){return this.rgb().formatRgb()}function Li(e){var n,o;return e=(e+"").trim().toLowerCase(),(n=RA.exec(e))?(o=n[1].length,n=parseInt(n[1],16),o===6?Zp(n):o===3?new Bt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):o===8?br(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):o===4?br(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=AA.exec(e))?new Bt(n[1],n[2],n[3],1):(n=$A.exec(e))?new Bt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=TA.exec(e))?br(n[1],n[2],n[3],n[4]):(n=MA.exec(e))?br(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=VA.exec(e))?th(n[1],n[2]/100,n[3]/100,1):(n=BA.exec(e))?th(n[1],n[2]/100,n[3]/100,n[4]):Wp.hasOwnProperty(e)?Zp(Wp[e]):e==="transparent"?new Bt(NaN,NaN,NaN,0):null}function Zp(e){return new Bt(e>>16&255,e>>8&255,e&255,1)}function br(e,n,o,i){return i<=0&&(e=n=o=NaN),new Bt(e,n,o,i)}function LA(e){return e instanceof Bi||(e=Li(e)),e?(e=e.rgb(),new Bt(e.r,e.g,e.b,e.opacity)):new Bt}function Rs(e,n,o,i){return arguments.length===1?LA(e):new Bt(e,n,o,i??1)}function Bt(e,n,o,i){this.r=+e,this.g=+n,this.b=+o,this.opacity=+i}xs(Bt,Rs,qp(Bi,{brighter(e){return e=e==null?gr:Math.pow(gr,e),new Bt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Di:Math.pow(Di,e),new Bt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Bt(yo(this.r),yo(this.g),yo(this.b),_r(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:Qp,formatHex:Qp,formatHex8:PA,formatRgb:eh,toString:eh}));function Qp(){return`#${go(this.r)}${go(this.g)}${go(this.b)}`}function PA(){return`#${go(this.r)}${go(this.g)}${go(this.b)}${go((isNaN(this.opacity)?1:this.opacity)*255)}`}function eh(){const e=_r(this.opacity);return`${e===1?"rgb(":"rgba("}${yo(this.r)}, ${yo(this.g)}, ${yo(this.b)}${e===1?")":`, ${e})`}`}function _r(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function go(e){return e=yo(e),(e<16?"0":"")+e.toString(16)}function th(e,n,o,i){return i<=0?e=n=o=NaN:o<=0||o>=1?e=n=NaN:n<=0&&(e=NaN),new Jt(e,n,o,i)}function nh(e){if(e instanceof Jt)return new Jt(e.h,e.s,e.l,e.opacity);if(e instanceof Bi||(e=Li(e)),!e)return new Jt;if(e instanceof Jt)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 Jt(l,s,c,e.opacity)}function zA(e,n,o,i){return arguments.length===1?nh(e):new Jt(e,n,o,i??1)}function Jt(e,n,o,i){this.h=+e,this.s=+n,this.l=+o,this.opacity=+i}xs(Jt,zA,qp(Bi,{brighter(e){return e=e==null?gr:Math.pow(gr,e),new Jt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Di:Math.pow(Di,e),new Jt(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 Bt(As(e>=240?e-240:e+120,a,i),As(e,a,i),As(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new Jt(oh(this.h),kr(this.s),kr(this.l),_r(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=_r(this.opacity);return`${e===1?"hsl(":"hsla("}${oh(this.h)}, ${kr(this.s)*100}%, ${kr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function oh(e){return e=(e||0)%360,e<0?e+360:e}function kr(e){return Math.max(0,Math.min(1,e||0))}function As(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 ih=e=>()=>e;function FA(e,n){return function(o){return e+o*n}}function UA(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 HA(e){return(e=+e)==1?ah:function(n,o){return o-n?UA(n,o,e):ih(isNaN(n)?o:n)}}function ah(e,n){var o=n-e;return o?FA(e,o):ih(isNaN(e)?n:e)}const rh=(function e(n){var o=HA(n);function i(a,r){var l=o((a=Rs(a)).r,(r=Rs(r)).r),s=o(a.g,r.g),c=o(a.b,r.b),d=ah(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 Un(e,n){return e=+e,n=+n,function(o){return e*(1-o)+n*o}}var $s=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ts=new RegExp($s.source,"g");function jA(e){return function(){return e}}function KA(e){return function(n){return e(n)+""}}function GA(e,n){var o=$s.lastIndex=Ts.lastIndex=0,i,a,r,l=-1,s=[],c=[];for(e=e+"",n=n+"";(i=$s.exec(e))&&(a=Ts.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:Un(i,a)})),o=Ts.lastIndex;return o<n.length&&(r=n.slice(o),s[l]?s[l]+=r:s[++l]=r),s.length<2?c[0]?KA(c[0].x):jA(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 lh=180/Math.PI,Ms={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function sh(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)*lh,skewX:Math.atan(c)*lh,scaleX:l,scaleY:s}}var Er;function YA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Ms:sh(n.a,n.b,n.c,n.d,n.e,n.f)}function qA(e){return e==null||(Er||(Er=document.createElementNS("http://www.w3.org/2000/svg","g")),Er.setAttribute("transform",e),!(e=Er.transform.baseVal.consolidate()))?Ms:(e=e.matrix,sh(e.a,e.b,e.c,e.d,e.e,e.f))}function ch(e,n,o,i){function a(d){return d.length?d.pop()+" ":""}function r(d,u,m,p,f,y){if(d!==m||u!==p){var _=f.push("translate(",null,n,null,o);y.push({i:_-4,x:Un(d,m)},{i:_-2,x:Un(u,p)})}else(m||p)&&f.push("translate("+m+n+p+o)}function l(d,u,m,p){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),p.push({i:m.push(a(m)+"rotate(",null,i)-2,x:Un(d,u)})):u&&m.push(a(m)+"rotate("+u+i)}function s(d,u,m,p){d!==u?p.push({i:m.push(a(m)+"skewX(",null,i)-2,x:Un(d,u)}):u&&m.push(a(m)+"skewX("+u+i)}function c(d,u,m,p,f,y){if(d!==m||u!==p){var _=f.push(a(f)+"scale(",null,",",null,")");y.push({i:_-4,x:Un(d,m)},{i:_-2,x:Un(u,p)})}else(m!==1||p!==1)&&f.push(a(f)+"scale("+m+","+p+")")}return function(d,u){var m=[],p=[];return d=e(d),u=e(u),r(d.translateX,d.translateY,u.translateX,u.translateY,m,p),l(d.rotate,u.rotate,m,p),s(d.skewX,u.skewX,m,p),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,m,p),d=u=null,function(f){for(var y=-1,_=p.length,g;++y<_;)m[(g=p[y]).i]=g.x(f);return m.join("")}}}var WA=ch(YA,"px, ","px)","deg)"),JA=ch(qA,", ",")",")"),XA=1e-12;function dh(e){return((e=Math.exp(e))+1/e)/2}function ZA(e){return((e=Math.exp(e))-1/e)/2}function QA(e){return((e=Math.exp(2*e))-1)/(e+1)}const e$=(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],p=l[2],f=u-s,y=m-c,_=f*f+y*y,g,b;if(_<XA)b=Math.log(p/d)/n,g=function(S){return[s+S*f,c+S*y,d*Math.exp(n*S*b)]};else{var E=Math.sqrt(_),h=(p*p-d*d+i*_)/(2*d*o*E),N=(p*p-d*d-i*_)/(2*p*o*E),w=Math.log(Math.sqrt(h*h+1)-h),C=Math.log(Math.sqrt(N*N+1)-N);b=(C-w)/n,g=function(S){var V=S*b,$=dh(w),R=d/(o*E)*($*QA(n*V+w)-ZA(w));return[s+R*f,c+R*y,d*$/dh(n*V+w)]}}return g.duration=b*1e3*n/Math.SQRT2,g}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 Jo=0,Pi=0,zi=0,uh=1e3,Nr,Fi,wr=0,bo=0,Ir=0,Ui=typeof performance=="object"&&performance.now?performance:Date,mh=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vs(){return bo||(mh(t$),bo=Ui.now()+Ir)}function t$(){bo=0}function vr(){this._call=this._time=this._next=null}vr.prototype=fh.prototype={constructor:vr,restart:function(e,n,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Vs():+o)+(n==null?0:+n),!this._next&&Fi!==this&&(Fi?Fi._next=this:Nr=this,Fi=this),this._call=e,this._time=o,Bs()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bs())}};function fh(e,n,o){var i=new vr;return i.restart(e,n,o),i}function n$(){Vs(),++Jo;for(var e=Nr,n;e;)(n=bo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Jo}function ph(){bo=(wr=Ui.now())+Ir,Jo=Pi=0;try{n$()}finally{Jo=0,i$(),bo=0}}function o$(){var e=Ui.now(),n=e-wr;n>uh&&(Ir-=n,wr=e)}function i$(){for(var e,n=Nr,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:Nr=o);Fi=e,Bs(i)}function Bs(e){if(!Jo){Pi&&(Pi=clearTimeout(Pi));var n=e-bo;n>24?(e<1/0&&(Pi=setTimeout(ph,e-Ui.now()-Ir)),zi&&(zi=clearInterval(zi))):(zi||(wr=Ui.now(),zi=setInterval(o$,uh)),Jo=1,mh(ph))}}function hh(e,n,o){var i=new vr;return n=n==null?0:+n,i.restart(a=>{i.stop(),e(a+n)},n,o),i}var a$=Ns("start","end","cancel","interrupt"),r$=[],yh=0,gh=1,Ds=2,Cr=3,bh=4,Os=5,Sr=6;function xr(e,n,o,i,a,r){var l=e.__transition;if(!l)e.__transition={};else if(o in l)return;l$(e,o,{name:n,index:i,group:a,on:a$,tween:r$,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:yh})}function Ls(e,n){var o=Xt(e,n);if(o.state>yh)throw new Error("too late; already scheduled");return o}function un(e,n){var o=Xt(e,n);if(o.state>Cr)throw new Error("too late; already running");return o}function Xt(e,n){var o=e.__transition;if(!o||!(o=o[n]))throw new Error("transition not found");return o}function l$(e,n,o){var i=e.__transition,a;i[n]=o,o.timer=fh(r,0,o.time);function r(d){o.state=gh,o.timer.restart(l,o.delay,o.time),o.delay<=d&&l(d-o.delay)}function l(d){var u,m,p,f;if(o.state!==gh)return c();for(u in i)if(f=i[u],f.name===o.name){if(f.state===Cr)return hh(l);f.state===bh?(f.state=Sr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[u]):+u<n&&(f.state=Sr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete i[u])}if(hh(function(){o.state===Cr&&(o.state=bh,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Ds,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Ds){for(o.state=Cr,a=new Array(p=o.tween.length),u=0,m=-1;u<p;++u)(f=o.tween[u].value.call(e,e.__data__,o.index,o.group))&&(a[++m]=f);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=Os,1),m=-1,p=a.length;++m<p;)a[m].call(e,u);o.state===Os&&(o.on.call("end",e,e.__data__,o.index,o.group),c())}function c(){o.state=Sr,o.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Rr(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>Ds&&i.state<Os,i.state=Sr,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete o[l]}r&&delete e.__transition}}function s$(e){return this.each(function(){Rr(this,e)})}function c$(e,n){var o,i;return function(){var a=un(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 d$(e,n,o){var i,a;if(typeof o!="function")throw new Error;return function(){var r=un(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 u$(e,n){var o=this._id;if(e+="",arguments.length<2){for(var i=Xt(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?c$:d$)(o,e,n))}function Ps(e,n,o){var i=e._id;return e.each(function(){var a=un(this,i);(a.value||(a.value={}))[n]=o.apply(this,arguments)}),function(a){return Xt(a,i).value[n]}}function _h(e,n){var o;return(typeof n=="number"?Un:n instanceof Li?rh:(o=Li(n))?(n=o,rh):GA)(e,n)}function m$(e){return function(){this.removeAttribute(e)}}function f$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function p$(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 h$(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 y$(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 g$(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 b$(e,n){var o=hr(e),i=o==="transform"?JA:_h;return this.attrTween(e,typeof n=="function"?(o.local?g$:y$)(o,i,Ps(this,"attr."+e,n)):n==null?(o.local?f$:m$)(o):(o.local?h$:p$)(o,i,n))}function _$(e,n){return function(o){this.setAttribute(e,n.call(this,o))}}function k$(e,n){return function(o){this.setAttributeNS(e.space,e.local,n.call(this,o))}}function E$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&k$(e,r)),o}return a._value=n,a}function N$(e,n){var o,i;function a(){var r=n.apply(this,arguments);return r!==i&&(o=(i=r)&&_$(e,r)),o}return a._value=n,a}function w$(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=hr(e);return this.tween(o,(i.local?E$:N$)(i,n))}function I$(e,n){return function(){Ls(this,e).delay=+n.apply(this,arguments)}}function v$(e,n){return n=+n,function(){Ls(this,e).delay=n}}function C$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?I$:v$)(n,e)):Xt(this.node(),n).delay}function S$(e,n){return function(){un(this,e).duration=+n.apply(this,arguments)}}function x$(e,n){return n=+n,function(){un(this,e).duration=n}}function R$(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?S$:x$)(n,e)):Xt(this.node(),n).duration}function A$(e,n){if(typeof n!="function")throw new Error;return function(){un(this,e).ease=n}}function $$(e){var n=this._id;return arguments.length?this.each(A$(n,e)):Xt(this.node(),n).ease}function T$(e,n){return function(){var o=n.apply(this,arguments);if(typeof o!="function")throw new Error;un(this,e).ease=o}}function M$(e){if(typeof e!="function")throw new Error;return this.each(T$(this._id,e))}function V$(e){typeof e!="function"&&(e=Lp(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 In(i,this._parents,this._name,this._id)}function B$(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),p,f=0;f<u;++f)(p=c[f]||d[f])&&(m[f]=p);for(;s<i;++s)l[s]=n[s];return new In(l,this._parents,this._name,this._id)}function D$(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 O$(e,n,o){var i,a,r=D$(n)?Ls:un;return function(){var l=r(this,e),s=l.on;s!==i&&(a=(i=s).copy()).on(n,o),l.on=a}}function L$(e,n){var o=this._id;return arguments.length<2?Xt(this.node(),o).on.on(e):this.each(O$(o,e,n))}function P$(e){return function(){var n=this.parentNode;for(var o in this.__transition)if(+o!==e)return;n&&n.removeChild(this)}}function z$(){return this.on("end.remove",P$(this._id))}function F$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Is(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,p=0;p<c;++p)(u=s[p])&&(m=e.call(u,u.__data__,p,s))&&("__data__"in u&&(m.__data__=u.__data__),d[p]=m,xr(d[p],n,o,p,d,Xt(u,o)));return new In(r,this._parents,n,o)}function U$(e){var n=this._name,o=this._id;typeof e!="function"&&(e=Op(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 p=e.call(u,u.__data__,m,c),f,y=Xt(u,o),_=0,g=p.length;_<g;++_)(f=p[_])&&xr(f,n,o,_,p,y);r.push(p),l.push(u)}return new In(r,l,n,o)}var H$=Vi.prototype.constructor;function j$(){return new H$(this._groups,this._parents)}function K$(e,n){var o,i,a;return function(){var r=qo(this,e),l=(this.style.removeProperty(e),qo(this,e));return r===l?null:r===o&&l===i?a:a=n(o=r,i=l)}}function kh(e){return function(){this.style.removeProperty(e)}}function G$(e,n,o){var i,a=o+"",r;return function(){var l=qo(this,e);return l===a?null:l===i?r:r=n(i=l,o)}}function Y$(e,n,o){var i,a,r;return function(){var l=qo(this,e),s=o(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),qo(this,e))),l===c?null:l===i&&c===a?r:(a=c,r=n(i=l,s))}}function q$(e,n){var o,i,a,r="style."+n,l="end."+r,s;return function(){var c=un(this,e),d=c.on,u=c.value[r]==null?s||(s=kh(n)):void 0;(d!==o||a!==u)&&(i=(o=d).copy()).on(l,a=u),c.on=i}}function W$(e,n,o){var i=(e+="")=="transform"?WA:_h;return n==null?this.styleTween(e,K$(e,i)).on("end.style."+e,kh(e)):typeof n=="function"?this.styleTween(e,Y$(e,i,Ps(this,"style."+e,n))).each(q$(this._id,e)):this.styleTween(e,G$(e,i,n),o).on("end.style."+e,null)}function J$(e,n,o){return function(i){this.style.setProperty(e,n.call(this,i),o)}}function X$(e,n,o){var i,a;function r(){var l=n.apply(this,arguments);return l!==a&&(i=(a=l)&&J$(e,l,o)),i}return r._value=n,r}function Z$(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,X$(e,n,o??""))}function Q$(e){return function(){this.textContent=e}}function eT(e){return function(){var n=e(this);this.textContent=n??""}}function tT(e){return this.tween("text",typeof e=="function"?eT(Ps(this,"text",e)):Q$(e==null?"":e+""))}function nT(e){return function(n){this.textContent=e.call(this,n)}}function oT(e){var n,o;function i(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&nT(a)),n}return i._value=e,i}function iT(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,oT(e))}function aT(){for(var e=this._name,n=this._id,o=Eh(),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=Xt(c,n);xr(c,e,o,d,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new In(i,this._parents,e,o)}function rT(){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=un(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 lT=0;function In(e,n,o,i){this._groups=e,this._parents=n,this._name=o,this._id=i}function Eh(){return++lT}var vn=Vi.prototype;In.prototype={constructor:In,select:F$,selectAll:U$,selectChild:vn.selectChild,selectChildren:vn.selectChildren,filter:V$,merge:B$,selection:j$,transition:aT,call:vn.call,nodes:vn.nodes,node:vn.node,size:vn.size,empty:vn.empty,each:vn.each,on:L$,attr:b$,attrTween:w$,style:W$,styleTween:Z$,text:tT,textTween:iT,remove:z$,tween:u$,delay:C$,duration:R$,ease:$$,easeVarying:M$,end:rT,[Symbol.iterator]:vn[Symbol.iterator]};function sT(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cT={time:null,delay:0,duration:250,ease:sT};function dT(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 uT(e){var n,o;e instanceof In?(n=e._id,e=e._name):(n=Eh(),(o=cT).time=Vs(),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])&&xr(c,e,n,d,l,o||dT(c,n));return new In(i,this._parents,e,n)}Vi.prototype.interrupt=s$,Vi.prototype.transition=uT;const Ar=e=>()=>e;function mT(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 Cn(e,n,o){this.k=e,this.x=n,this.y=o}Cn.prototype={constructor:Cn,scale:function(e){return e===1?this:new Cn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Cn(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 zs=new Cn(1,0,0);Cn.prototype;function Fs(e){e.stopImmediatePropagation()}function Hi(e){e.preventDefault(),e.stopImmediatePropagation()}function fT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pT(){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 Nh(){return this.__zoom||zs}function hT(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yT(){return navigator.maxTouchPoints||"ontouchstart"in this}function gT(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 bT(){var e=fT,n=pT,o=gT,i=hT,a=yT,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,c=e$,d=Ns("start","zoom","end"),u,m,p,f=500,y=150,_=0,g=10;function b(k){k.property("__zoom",Nh).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",x).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(k,v,I,O){var A=k.selection?k.selection():k;A.property("__zoom",Nh),k!==A?w(k,v,I,O):A.interrupt().each(function(){C(this,arguments).event(O).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},b.scaleBy=function(k,v,I,O){b.scaleTo(k,function(){var A=this.__zoom.k,L=typeof v=="function"?v.apply(this,arguments):v;return A*L},I,O)},b.scaleTo=function(k,v,I,O){b.transform(k,function(){var A=n.apply(this,arguments),L=this.__zoom,H=I==null?N(A):typeof I=="function"?I.apply(this,arguments):I,oe=L.invert(H),ue=typeof v=="function"?v.apply(this,arguments):v;return o(h(E(L,ue),H,oe),A,l)},I,O)},b.translateBy=function(k,v,I,O){b.transform(k,function(){return o(this.__zoom.translate(typeof v=="function"?v.apply(this,arguments):v,typeof I=="function"?I.apply(this,arguments):I),n.apply(this,arguments),l)},null,O)},b.translateTo=function(k,v,I,O,A){b.transform(k,function(){var L=n.apply(this,arguments),H=this.__zoom,oe=O==null?N(L):typeof O=="function"?O.apply(this,arguments):O;return o(zs.translate(oe[0],oe[1]).scale(H.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof I=="function"?-I.apply(this,arguments):-I),L,l)},O,A)};function E(k,v){return v=Math.max(r[0],Math.min(r[1],v)),v===k.k?k:new Cn(v,k.x,k.y)}function h(k,v,I){var O=v[0]-I[0]*k.k,A=v[1]-I[1]*k.k;return O===k.x&&A===k.y?k:new Cn(k.k,O,A)}function N(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function w(k,v,I,O){k.on("start.zoom",function(){C(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(O).end()}).tween("zoom",function(){var A=this,L=arguments,H=C(A,L).event(O),oe=n.apply(A,L),ue=I==null?N(oe):typeof I=="function"?I.apply(A,L):I,be=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),pe=A.__zoom,he=typeof v=="function"?v.apply(A,L):v,_e=c(pe.invert(ue).concat(be/pe.k),he.invert(ue).concat(be/he.k));return function(ye){if(ye===1)ye=he;else{var Ae=_e(ye),Fe=be/Ae[2];ye=new Cn(Fe,ue[0]-Ae[0]*Fe,ue[1]-Ae[1]*Fe)}H.zoom(null,ye)}})}function C(k,v,I){return!I&&k.__zooming||new S(k,v)}function S(k,v){this.that=k,this.args=v,this.active=0,this.sourceEvent=null,this.extent=n.apply(k,v),this.taps=0}S.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,v){return this.mouse&&k!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=v.invert(this.touch1[0])),this.that.__zoom=v,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var v=zn(this.that).datum();d.call(k,this.that,new mT(k,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:d}),v)}};function V(k,...v){if(!e.apply(this,arguments))return;var I=C(this,v).event(k),O=this.__zoom,A=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,i.apply(this,arguments)))),L=Fn(k);if(I.wheel)(I.mouse[0][0]!==L[0]||I.mouse[0][1]!==L[1])&&(I.mouse[1]=O.invert(I.mouse[0]=L)),clearTimeout(I.wheel);else{if(O.k===A)return;I.mouse=[L,O.invert(L)],Rr(this),I.start()}Hi(k),I.wheel=setTimeout(H,y),I.zoom("mouse",o(h(E(O,A),I.mouse[0],I.mouse[1]),I.extent,l));function H(){I.wheel=null,I.end()}}function $(k,...v){if(p||!e.apply(this,arguments))return;var I=k.currentTarget,O=C(this,v,!0).event(k),A=zn(k.view).on("mousemove.zoom",ue,!0).on("mouseup.zoom",be,!0),L=Fn(k,I),H=k.clientX,oe=k.clientY;SA(k.view),Fs(k),O.mouse=[L,this.__zoom.invert(L)],Rr(this),O.start();function ue(pe){if(Hi(pe),!O.moved){var he=pe.clientX-H,_e=pe.clientY-oe;O.moved=he*he+_e*_e>_}O.event(pe).zoom("mouse",o(h(O.that.__zoom,O.mouse[0]=Fn(pe,I),O.mouse[1]),O.extent,l))}function be(pe){A.on("mousemove.zoom mouseup.zoom",null),xA(pe.view,O.moved),Hi(pe),O.event(pe).end()}}function R(k,...v){if(e.apply(this,arguments)){var I=this.__zoom,O=Fn(k.changedTouches?k.changedTouches[0]:k,this),A=I.invert(O),L=I.k*(k.shiftKey?.5:2),H=o(h(E(I,L),O,A),n.apply(this,v),l);Hi(k),s>0?zn(this).transition().duration(s).call(w,H,O,k):zn(this).call(b.transform,H,O,k)}}function x(k,...v){if(e.apply(this,arguments)){var I=k.touches,O=I.length,A=C(this,v,k.changedTouches.length===O).event(k),L,H,oe,ue;for(Fs(k),H=0;H<O;++H)oe=I[H],ue=Fn(oe,this),ue=[ue,this.__zoom.invert(ue),oe.identifier],A.touch0?!A.touch1&&A.touch0[2]!==ue[2]&&(A.touch1=ue,A.taps=0):(A.touch0=ue,L=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),L&&(A.taps<2&&(m=ue[0],u=setTimeout(function(){u=null},f)),Rr(this),A.start())}}function T(k,...v){if(this.__zooming){var I=C(this,v).event(k),O=k.changedTouches,A=O.length,L,H,oe,ue;for(Hi(k),L=0;L<A;++L)H=O[L],oe=Fn(H,this),I.touch0&&I.touch0[2]===H.identifier?I.touch0[0]=oe:I.touch1&&I.touch1[2]===H.identifier&&(I.touch1[0]=oe);if(H=I.that.__zoom,I.touch1){var be=I.touch0[0],pe=I.touch0[1],he=I.touch1[0],_e=I.touch1[1],ye=(ye=he[0]-be[0])*ye+(ye=he[1]-be[1])*ye,Ae=(Ae=_e[0]-pe[0])*Ae+(Ae=_e[1]-pe[1])*Ae;H=E(H,Math.sqrt(ye/Ae)),oe=[(be[0]+he[0])/2,(be[1]+he[1])/2],ue=[(pe[0]+_e[0])/2,(pe[1]+_e[1])/2]}else if(I.touch0)oe=I.touch0[0],ue=I.touch0[1];else return;I.zoom("touch",o(h(H,oe,ue),I.extent,l))}}function M(k,...v){if(this.__zooming){var I=C(this,v).event(k),O=k.changedTouches,A=O.length,L,H;for(Fs(k),p&&clearTimeout(p),p=setTimeout(function(){p=null},f),L=0;L<A;++L)H=O[L],I.touch0&&I.touch0[2]===H.identifier?delete I.touch0:I.touch1&&I.touch1[2]===H.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(H=Fn(H,this),Math.hypot(m[0]-H[0],m[1]-H[1])<g)){var oe=zn(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return b.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Ar(+k),b):i},b.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Ar(!!k),b):e},b.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:Ar(!!k),b):a},b.extent=function(k){return arguments.length?(n=typeof k=="function"?k:Ar([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),b):n},b.scaleExtent=function(k){return arguments.length?(r[0]=+k[0],r[1]=+k[1],b):[r[0],r[1]]},b.translateExtent=function(k){return arguments.length?(l[0][0]=+k[0][0],l[1][0]=+k[1][0],l[0][1]=+k[0][1],l[1][1]=+k[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(k){return arguments.length?(o=k,b):o},b.duration=function(k){return arguments.length?(s=+k,b):s},b.interpolate=function(k){return arguments.length?(c=k,b):c},b.on=function(){var k=d.on.apply(d,arguments);return k===d?b:k},b.clickDistance=function(k){return arguments.length?(_=(k=+k)*k,b):Math.sqrt(_)},b.tapDistance=function(k){return arguments.length?(g=+k,b):g},b}const wh=Symbol("MiniMapSlots"),_T=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],kT={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},ET=t.defineComponent({...kT,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(wh),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,p)=>!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,_T))],64)):t.createCommentVNode("",!0)}}),NT=["width","height","viewBox","aria-labelledby"],wT=["id"],IT=["d","fill","stroke","stroke-width"],vT={name:"MiniMap",compatConfig:{MODE:3}},CT=t.defineComponent({...vT,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:p,d3Zoom:f,getNodesInitialized:y}=et(),_=t.ref();t.provide(wh,o);const g=t.toRef(()=>{var A;return e.width??((A=i.style)==null?void 0:A.width)??a}),b=t.toRef(()=>{var A;return e.height??((A=i.style)==null?void 0:A.height)??r}),E=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",h=t.computed(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),N=t.computed(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),w=t.computed(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),C=t.computed(()=>ts(y.value.filter(A=>!A.hidden))),S=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})),V=t.computed(()=>y.value&&y.value.length?T0(C.value,S.value):S.value),$=t.computed(()=>{const A=V.value.width/g.value,L=V.value.height/b.value;return Math.max(A,L)}),R=t.computed(()=>{const A=$.value*g.value,L=$.value*b.value,H=e.offsetScale*$.value;return{offset:H,x:V.value.x-(A-V.value.width)/2-H,y:V.value.y-(L-V.value.height)/2-H,width:A+H*2,height:L+H*2}}),x=t.computed(()=>!R.value.x||!R.value.y?"":`
|
|
53
|
+
M${R.value.x-R.value.offset},${R.value.y-R.value.offset}
|
|
54
|
+
h${R.value.width+R.value.offset*2}
|
|
55
|
+
v${R.value.height+R.value.offset*2}
|
|
56
|
+
h${-R.value.width-R.value.offset*2}z
|
|
57
|
+
M${S.value.x+e.maskBorderRadius},${S.value.y}
|
|
58
|
+
h${S.value.width-2*e.maskBorderRadius}
|
|
59
59
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
|
|
60
|
-
v${
|
|
60
|
+
v${S.value.height-2*e.maskBorderRadius}
|
|
61
61
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
|
|
62
|
-
h${-(
|
|
62
|
+
h${-(S.value.width-2*e.maskBorderRadius)}
|
|
63
63
|
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
|
|
64
|
-
v${-(
|
|
65
|
-
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(M=>{if(g.value){const z=$n(g.value),j=ye=>{if(ye.sourceEvent.type!=="wheel"||!h.value||!f.value)return;const ge=ye.sourceEvent.ctrlKey&&Ei()?10:1,me=-ye.sourceEvent.deltaY*(ye.sourceEvent.deltaMode===1?.05:ye.sourceEvent.deltaMode?1:.002)*e.zoomStep,se=c.value.zoom*2**(me*ge);f.value.scaleTo(h.value,se)},ie=ye=>{if(ye.sourceEvent.type!=="mousemove"||!h.value||!f.value)return;const ge=V.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),me={x:c.value.x-ye.sourceEvent.movementX*ge,y:c.value.y-ye.sourceEvent.movementY*ge},se=[[0,0],[u.value.width,u.value.height]],ke=Is.translate(me.x,me.y).scale(c.value.zoom),Se=f.value.constrain()(ke,se,d.value);f.value.transform(h.value,Se)},pe=Z$().wheelDelta(ye=>zl(ye)*(e.zoomStep/10)).on("zoom",e.pannable?ie:()=>{}).on("zoom.wheel",e.zoomable?j:()=>{});z.call(pe),M(()=>{z.on("zoom",null)})}},{flush:"post"});function T(M){const[z,j]=Tn(M);n("click",{event:M,position:{x:z,y:j}})}function D(M,z){const j={event:M,node:z,connectedEdges:Xn([z],s.value)};m.miniMapNodeClick(j),n("nodeClick",j)}function b(M,z){const j={event:M,node:z,connectedEdges:Xn([z],s.value)};m.miniMapNodeDoubleClick(j),n("nodeDblclick",j)}function w(M,z){const j={event:M,node:z,connectedEdges:Xn([z],s.value)};m.miniMapNodeMouseEnter(j),n("nodeMouseenter",j)}function v(M,z){const j={event:M,node:z,connectedEdges:Xn([z],s.value)};m.miniMapNodeMouseMove(j),n("nodeMousemove",j)}function O(M,z){const j={event:M,node:z,connectedEdges:Xn([z],s.value)};m.miniMapNodeMouseLeave(j),n("nodeMouseleave",j)}return(M,z)=>(t.openBlock(),t.createBlock(t.unref(pf),{position:M.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:M.pannable,zoomable:M.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:g,width:_.value,height:E.value,viewBox:[S.value.x,S.value.y,S.value.width,S.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:T},[M.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(M.ariaLabel),9,oT)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(y),j=>(t.openBlock(),t.createBlock(tT,{id:j.id,key:j.id,f:"",position:j.computedPosition,dimensions:j.dimensions,selected:j.selected,dragging:j.dragging,style:t.normalizeStyle(j.style),class:t.normalizeClass(I.value(j)),color:p.value(j),"border-radius":M.nodeBorderRadius,"stroke-color":k.value(j),"stroke-width":M.nodeStrokeWidth,"shape-rendering":t.unref(N),type:j.type,hidden:j.hidden,onClick:ie=>D(ie,j),onDblclick:ie=>b(ie,j),onMouseenter:ie=>w(ie,j),onMousemove:ie=>v(ie,j),onMouseleave:ie=>O(ie,j)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),t.createElementVNode("path",{class:"vue-flow__minimap-mask",d:x.value,fill:M.maskColor,stroke:M.maskStrokeColor,"stroke-width":M.maskStrokeWidth,"fill-rule":"evenodd"},null,8,iT)],8,nT))]),_:1},8,["position","class"]))}}),lT=["d"],sT=["cx","cy","onDblclick"],cT=["x","y","onPointerdown","onDblclick"],dT=Ke(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=je(),i=t.inject(as),a=t.inject(oo,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Bo,null),s=t.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(n.data.targetRef)||!l.relatedNoteIds.value.has(n.data.noteRef))),c=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),d=t.ref(-1),u=t.ref({x:0,y:0}),m=t.computed(()=>c.value.map((L,V)=>V===d.value?u.value:L)),{source:h,target:f,sourceSide:y,targetSide:g}=pp({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),_=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?Jf(h.value,y.value,m.value,f.value,g.value):Zf(h.value,m.value,f.value)),E=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?Xf(h.value,y.value,m.value,f.value,g.value):tp(h.value,m.value,f.value).map((L,V)=>({point:L,segIndex:V})):[]),N=t.computed(()=>r.value?m.value:[]);function p(L,V){d.value=L,u.value={...c.value[L]},V.target.setPointerCapture(V.pointerId),V.stopPropagation()}function k(L){if(d.value<0)return;const V=o({x:L.clientX,y:L.clientY});u.value={x:V.x,y:V.y}}function I(L){var V,S;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(S=(V=L.target).releasePointerCapture)==null||S.call(V,L.pointerId)}function A(L,V){V.stopPropagation(),i==null||i.removePoint(n.id,L)}function $(L,V){if(!i)return;const S=o({x:V.clientX,y:V.clientY});i.insertPoint(n.id,L,{x:S.x,y:S.y})}return(L,V)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:_.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,lT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,(S,x)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${x}`,cx:S.point.x,cy:S.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(T=>$(S.segIndex,T),["stop"])},null,42,sT))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.value,(S,x)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${x}`,x:S.x-5,y:S.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:T=>p(x,T),onPointermove:k,onPointerup:I,onDblclick:T=>A(x,T)},null,42,cT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),uT=["data-theme"],mT={key:0,class:"em-ctx__sep",role:"separator"},fT=["aria-label"],pT={class:"em-ctx__swatches-label","aria-hidden":"true"},hT={class:"em-ctx__chips",role:"none"},yT=["aria-checked","aria-label","title","onClick"],gT=["aria-checked","aria-label","title","onClick"],bT=["disabled","onClick"],_T={class:"em-ctx__icon"},kT={class:"em-ctx__caption"},ET=Ke(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(p,k)=>Dt(o.locale??"ko",p,k),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(p,k){var $,L;r.value=k,l.value=($=p.target)!=null&&$.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=p.clientX,c.y=p.clientY,a.value=!0,window.addEventListener("keydown",_),window.addEventListener("resize",h),await t.nextTick();const I=s.value;if(!I)return;const A=I.getBoundingClientRect();c.x+A.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-A.width)),c.y+A.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-A.height)),(L=f()[0])==null||L.focus()}function h(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",_),window.removeEventListener("resize",h);const p=d;d=null,p!=null&&p.isConnected&&p.focus()}function f(){const p=s.value;if(!p)return[];const k=[];for(const I of Array.from(p.children))if(I.classList.contains("em-ctx__item"))I.disabled||k.push(I);else if(I.classList.contains("em-ctx__swatches")){const A=Array.from(I.querySelectorAll(".em-ctx__chip"));A.length&&k.push(A.find($=>$===document.activeElement)??A[0])}return k}function y(p){var $;const k=f();if(!k.length)return;const I=k.indexOf(document.activeElement),A=I<0?p>0?0:k.length-1:(I+p+k.length)%k.length;($=k[A])==null||$.focus()}function g(p){var $,L;const k=($=document.activeElement)==null?void 0:$.closest(".em-ctx__swatches");if(!k)return!1;const I=Array.from(k.querySelectorAll(".em-ctx__chip")),A=I.indexOf(document.activeElement);return A<0?!1:((L=I[(A+p+I.length)%I.length])==null||L.focus(),!0)}function _(p){var k,I;switch(p.key){case"Escape":p.stopPropagation(),h();return;case"ArrowDown":p.preventDefault(),y(1);return;case"ArrowUp":p.preventDefault(),y(-1);return;case"ArrowRight":g(1)&&p.preventDefault();return;case"ArrowLeft":g(-1)&&p.preventDefault();return;case"Home":p.preventDefault(),(k=f()[0])==null||k.focus();return;case"End":{p.preventDefault();const A=f();(I=A[A.length-1])==null||I.focus();return}case"Tab":p.preventDefault(),y(p.shiftKey?-1:1)}}function E(p){p.disabled||(p.handler(),h())}function N(p,k){p.onPick(k),h()}return t.onBeforeUnmount(h),n({open:m,close:h}),(p,k)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:h,onContextmenu:t.withModifiers(h,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:k[0]||(k[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(I,A)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:A},[I.type==="separator"?(t.openBlock(),t.createElementBlock("div",mT)):I.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":I.caption},[t.createElementVNode("span",pT,t.toDisplayString(I.caption),1),t.createElementVNode("div",hT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":I.current===null}]),role:"menuitemradio","aria-checked":I.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:$=>N(I,null)},null,10,yT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":I.current===$}]),style:t.normalizeStyle({background:t.unref(Mo)($)}),role:"menuitemradio","aria-checked":I.current===$,"aria-label":i(t.unref(to)($)),title:i(t.unref(to)($)),onClick:L=>N(I,$)},null,14,gT))),128))])],8,fT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":I.danger,"is-disabled":I.disabled}]),disabled:I.disabled,role:"menuitem",onClick:$=>E(I)},[t.createElementVNode("span",_T,[I.icon?(t.openBlock(),t.createBlock(Ae,{key:0,name:I.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",kT,t.toDisplayString(I.caption),1)],10,bT))],64))),128))],36)],8,uT)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function sh(e,n){return n?`${e}:${n}`:e}function ch(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(sh(e,n));if(!i)return{};const a=JSON.parse(i);if(!a||typeof a!="object"||Array.isArray(a))return{};const r={};for(const[l,s]of Object.entries(a))typeof s=="boolean"&&(r[l]=s);return r}catch{return{}}}function NT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=sh(e,n);Object.keys(o).length?(a=window.sessionStorage)==null||a.setItem(r,JSON.stringify(o)):(i=window.sessionStorage)==null||i.removeItem(r)}catch{}}function dh(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(ch(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=ch(e.storageKey,s)),t.watch(o,s=>NT(e.storageKey,n(),s),{deep:!0});const i=s=>o.value[s]??e.defaultCollapsed(s);function a(s){o.value={...o.value,[s]:!i(s)}}const r=t.computed(()=>!e.expandableKeys().some(s=>i(s)));function l(){const s=r.value,c={...o.value};for(const d of e.expandableKeys())c[d]=s;o.value=c}return{isCollapsed:i,toggle:a,toggleAll:l,allExpanded:r}}const Cs=[".em-entity__grip",".em-entity__add",".em-entity__footer",".em-sel",".em-handle",".em-note-handle",".vue-flow__handle",".em-group__resize",".em-note__resize",".em-edge__waypoint",".em-edge__mid",".em-note-edge__waypoint",".em-note-edge__mid"].join(",");function zo(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function wT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function IT(e,n){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const y=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const g=n(y.left,y.top+y.height/2);return[{...i,x:g.x,y:g.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,h=0;const f=()=>{const y=d.trim();if(y){const g=n(m,(u+h)/2);c.push({...i,x:g.x,y:g.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const g=a.getBoundingClientRect();u===null||Math.abs(g.top-u)>1?(f(),u=g.top,m=g.left,h=g.bottom,d=s[y]):(d+=s[y],h=Math.max(h,g.bottom))}return f(),c}function _r(e,n){const o=[];for(const i of e.querySelectorAll("*"))wT(i)&&(i.closest(Cs)||zo(i)&&o.push(...IT(i,n)));return o}function Vi(e){return Math.round(e*100)/100}function vT(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Cs)||!zo(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=n(a.left,a.top),l=n(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${Vi(r.x)}" y="${Vi(r.y)}" width="${Vi(l.x-r.x)}" height="${Vi(l.y-r.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function CT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!zo(o))continue;const i=getComputedStyle(o),a=i.stroke,r=parseFloat(i.strokeWidth)||1.5,l=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>Vi(parseFloat(o.getAttribute(d)??"0"));s==="line"?n.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?n.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&n.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return n}function uh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Cs)||!zo(a))continue;const r=getComputedStyle(a),l=parseFloat(r.borderTopWidth);if(!l)continue;const s=a.getBoundingClientRect();if(s.width===0)continue;const c=o(s.left,s.top),d=o(s.right,s.top);i.push({x1:c.x,x2:d.x,y:c.y,stroke:r.borderTopColor,strokeWidth:l})}return i}function Bi(e,n){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=n(o.left,o.top),r=n(o.right,o.bottom),l=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:a.x,y:a.y,w:r.x-a.x,h:r.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:l?"6 4":void 0,radius:s}}function xs(e,n){e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x+n.w),e.maxY=Math.max(e.maxY,n.y+n.h)}function xT(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,y)=>e.screenToFlowCoordinate({x:f,y}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const f of e.nodes.value){const y=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!y||!zo(y))continue;const g=y.firstElementChild;if(g)if(f.type==="group"){const _=Bi(g,o);xs(s,_),i.push({..._,texts:[]});const E=g.querySelector(".em-group__label");E&&i.push({...Bi(E,o),stroke:"none",texts:[]}),i.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:_r(g,o)})}else if(f.type==="note"){const _={...Bi(g,o),texts:_r(g,o),lines:uh(g,g,o)};xs(s,_),r.push(_)}else{const _=Bi(g,o);xs(s,_);const E=_.radius??{tl:0,tr:0};a.push({..._,stroke:"none",texts:[]});const N=g.querySelector(".em-entity__header");if(N){const p=Bi(N,o);a.push({x:_.x,y:_.y,w:_.w,h:p.y+p.h-_.y,fill:p.fill,stroke:"none",radius:{tl:E.tl,tr:E.tr,br:0,bl:0},texts:[]})}a.push({..._,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:_r(g,o),lines:uh(g,g,o),icons:vT(g,o)}),a.push({..._,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const y=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!zo(y))continue;const g=y.getAttribute("d");if(!g)continue;const _=getComputedStyle(y),E=_.strokeDasharray,N=CT(f);l.push({d:g,stroke:_.stroke,strokeWidth:parseFloat(_.strokeWidth)||1.5,strokeDasharray:E&&E!=="none"?E:void 0,labels:_r(f,o),markers:N.length?N:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function Ss(e){return hc(xT(e))}function mh(e,n){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=n,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function fh(e,n="diagram.svg"){const o=Ss(e);mh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function ST(e){var i,a;const n=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:n>0?n:1,h:o>0?o:1}}async function ph(e,n="diagram.png",o=2){const i=Ss(e),{w:a,h:r}=ST(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,h)=>{s.onload=()=>m(),s.onerror=()=>h(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");mh(u,n)}finally{URL.revokeObjectURL(l)}}const RT={class:"em-shortcuts"},AT={class:"em-shortcuts__list"},$T={class:"em-shortcuts__title"},TT={class:"em-shortcuts__keys"},MT={class:"em-shortcuts__kbd"},VT={key:0,class:"em-shortcuts__plus"},BT={class:"em-shortcuts__desc"},DT={class:"em-shortcuts__actions"},hh=Ke(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(s,c)=>Dt(n.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=t.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",RT,[t.createElementVNode("div",AT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,d=>(t.openBlock(),t.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[t.createElementVNode("h4",$T,t.toDisplayString(d.title),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.items,u=>(t.openBlock(),t.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[t.createElementVNode("span",TT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,h)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+h},[t.createElementVNode("kbd",MT,t.toDisplayString(m),1),h<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",VT,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",BT,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",DT,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-38f2450f"]]);function Fo(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function OT(e,n){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(n);let l=!1;for(const c of a.children)i(c)&&(l=!0);const s=r||l;return s&&o.add(a.key),s};return i(e),o}const LT=["aria-label"],PT=["aria-activedescendant","aria-label","placeholder"],zT={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},FT=["aria-label"],UT={class:"em-cmdk__section","aria-hidden":"true"},HT=["id","aria-selected","onMouseenter","onClick"],jT={class:"em-cmdk__label"},KT={key:0,class:"em-cmdk__tag"},GT={key:1,class:"em-cmdk__sub"},YT=["aria-label"],qT={class:"em-cmdk__section","aria-hidden":"true"},WT=["id","aria-selected","aria-disabled","onMouseenter","onClick"],JT={class:"em-cmdk__label"},XT={key:1,class:"em-cmdk__empty"},ZT=Ke(t.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref(""),l=t.ref(0),s=t.ref(null),c=t.computed(()=>a.userLanguage.value),d=t.computed(()=>{const I=c.value,A=a.state.logical.entities.map(L=>{var V,S,x,T,D,b;return{type:"goto",kind:"entity",id:L.modelId,label:((S=(V=L.table)==null?void 0:V.logicalName)==null?void 0:S[I])||L.name,sub:(x=L.table)==null?void 0:x.physicalName,match:Fo(L.name,(D=(T=L.table)==null?void 0:T.logicalName)==null?void 0:D[I],(b=L.table)==null?void 0:b.physicalName)??""}}),$=a.state.logical.groups.map(L=>{var V,S,x,T;return{type:"goto",kind:"group",id:L.modelId,label:((V=L.name)==null?void 0:V[I])||((S=L.name)==null?void 0:S.ko)||L.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:Fo((x=L.name)==null?void 0:x[I],(T=L.name)==null?void 0:T.ko,L.packageName)??""}});return[...A,...$]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const I=[];a.editable.value&&(I.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),I.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),I.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),I.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),I.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),I.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),I.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),I.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const A of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])I.push({type:"action",id:`dm-${A}`,label:a.t(u[A]),run:()=>a.displayMode.value=A});return I});function h(I,A){return I.label.toLowerCase().includes(A)}const f=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?d.value.filter(A=>A.match.includes(I)):d.value}),y=t.computed(()=>{const I=r.value.trim().toLowerCase();return I?m.value.filter(A=>h(A,I)):m.value}),g=t.computed(()=>[...f.value,...y.value]);t.watch([f,y],()=>{l.value=0});function _(I){return g.value.indexOf(I)}const E=I=>`em-cmdk-opt-${I}`,N=t.computed(()=>g.value[l.value]?E(l.value):void 0);t.watch(l,async()=>{var A;await t.nextTick();const I=N.value;I&&((A=document.getElementById(I))==null||A.scrollIntoView({block:"nearest"}))});function p(I){if(I.type==="goto")a.selection.value={kind:I.kind,id:I.id},a.requestFocus(I.id);else{if(I.disabled)return;I.run()}i("close")}function k(I){if(I.key==="Escape"){i("close"),I.preventDefault();return}if(I.key==="ArrowDown"){l.value=Math.min(l.value+1,g.value.length-1),I.preventDefault();return}if(I.key==="ArrowUp"){l.value=Math.max(l.value-1,0),I.preventDefault();return}if(I.key==="Enter"){const A=g.value[l.value];A&&p(A),I.preventDefault();return}I.key==="Tab"&&I.preventDefault()}return t.nextTick(()=>{var I;return(I=s.value)==null?void 0:I.focus()}),(I,A)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:A[1]||(A[1]=t.withModifiers($=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":A[0]||(A[0]=$=>r.value=$),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":N.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:k},null,40,PT),[[t.vModelText,r.value]]),t.createElementVNode("div",zT,[g.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[f.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",UT,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,$=>(t.openBlock(),t.createElementBlock("button",{id:E(_($)),key:$.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":_($)===l.value}]),role:"option","aria-selected":_($)===l.value,onMouseenter:L=>l.value=_($),onClick:L=>p($)},[t.createElementVNode("span",jT,t.toDisplayString($.label),1),$.tag?(t.openBlock(),t.createElementBlock("span",KT,t.toDisplayString($.tag),1)):$.sub?(t.openBlock(),t.createElementBlock("span",GT,t.toDisplayString($.sub),1)):t.createCommentVNode("",!0)],42,HT))),128))],8,FT)):t.createCommentVNode("",!0),y.value.length?(t.openBlock(),t.createElementBlock("div",{key:1,role:"group","aria-label":t.unref(a).t("em.cmd.sectionActions")},[t.createElementVNode("div",qT,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,$=>(t.openBlock(),t.createElementBlock("button",{id:E(_($)),key:$.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":_($)===l.value,"is-disabled":$.disabled}]),role:"option","aria-selected":_($)===l.value,"aria-disabled":$.disabled||void 0,onMouseenter:L=>l.value=_($),onClick:L=>p($)},[t.createElementVNode("span",JT,t.toDisplayString($.label),1)],42,WT))),128))],8,YT)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",XT,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,LT)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function QT(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const eM={key:0,class:"em-canvas__empty","aria-hidden":"true"},tM={class:"em-canvas__empty-title"},nM=["innerHTML"],oM=["innerHTML"],iM=["innerHTML"],aM={key:1,class:"em-canvas__empty-title"},rM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},lM={class:"em-conflict-banner__body"},sM={class:"em-conflict-banner__title"},cM={class:"em-conflict-banner__detail"},dM={key:0,class:"em-toast",role:"status","aria-live":"polite"},Rs="nc:",yh=Ke(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(C){l.value=C,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,C=>{C&&c(C.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const C=QT(i.opConflict.value);return C?{title:i.t(C.titleKey),detail:i.t(C.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),h={x:0,y:0};function f(C){h.x=C.clientX,h.y=C.clientY}const y=t.ref(null);t.provide(Za,y);const g=t.ref(null);t.provide(Bf,g);const _=t.ref(null),E=t.computed(()=>{const C=_.value,R=new Set;if(!C)return R;if(C.kind==="entity")R.add(C.id);else if(C.kind==="group"){const W=i.resolved.value.groups.find(re=>re.group.modelId===C.id);for(const re of(W==null?void 0:W.group.memberEntityRefs)??[])R.add(re)}return R}),N=t.computed(()=>{const C=_.value,R=new Set(E.value),W=new Set,re=new Set;if(!C)return{related:R,edges:W,notes:re};if(C.kind==="note"){re.add(C.id);for(const Ce of i.resolved.value.noteConnections)Ce.noteRef===C.id&&R.add(Ce.targetRef);return{related:R,edges:W,notes:re}}const ne=E.value;if(!ne.size)return{related:R,edges:W,notes:re};for(const Ce of i.resolved.value.associations){const{end1:de,end2:xe}=Ce.association;(ne.has(de.entityRef)||ne.has(xe.entityRef))&&(W.add(Ce.association.modelId),R.add(de.entityRef),R.add(xe.entityRef))}for(const Ce of i.resolved.value.noteConnections)R.has(Ce.targetRef)&&re.add(Ce.noteRef);return{related:R,edges:W,notes:re}});t.provide(Bo,{source:_,active:t.computed(()=>_.value!==null),primaryEntityIds:E,relatedEntityIds:t.computed(()=>N.value.related),relatedEdgeIds:t.computed(()=>N.value.edges),relatedNoteIds:t.computed(()=>N.value.notes),hoverGroupId:t.computed(()=>{var C;return((C=_.value)==null?void 0:C.kind)==="group"?_.value.id:null}),setEntityHover:C=>{g.value||m.value||(_.value=C?{kind:"entity",id:C}:null)},setGroupHover:C=>{g.value||m.value||(_.value=C?{kind:"group",id:C}:null)},setNoteHover:C=>{g.value||m.value||(_.value=C?{kind:"note",id:C}:null)}}),t.provide(oo,i);const p=UC(),k=t.computed(()=>p(i.state.logical,i.embeddableCatalog.value));t.provide(Lf,k);const I=dh({expandableKeys:()=>[],defaultCollapsed:jC,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(zf,{isCollapsed:I.isCollapsed,toggle:I.toggle}),t.provide(Df,{marks:t.toRef(o,"diffMarks")});function A(C,R){return`${Rs}${C}:${R}`}function $(C){if(!C.startsWith(Rs))return null;const[R,W]=C.slice(Rs.length).split(":");return R&&W?{noteRef:R,targetRef:W}:null}t.provide(as,{points:C=>{var W,re;const R=$(C);return R?((W=i.resolved.value.noteConnections.find(ne=>ne.noteRef===R.noteRef&&ne.targetRef===R.targetRef))==null?void 0:W.waypoints)??[]:((re=i.resolved.value.associations.find(ne=>ne.association.modelId===C))==null?void 0:re.waypoints)??[]},movePoint:(C,R,W)=>{const re=$(C);re?i.moveNoteConnectionWaypoint(re.noteRef,re.targetRef,R,W):i.moveWaypoint(C,R,W)},insertPoint:(C,R,W)=>{const re=$(C);re?i.addNoteConnectionWaypoint(re.noteRef,re.targetRef,R,W):i.addWaypoint(C,R,W)},removePoint:(C,R)=>{const W=$(C);W?i.removeNoteConnectionWaypoint(W.noteRef,W.targetRef,R):i.removeWaypoint(C,R)}});const L=je(),{nodes:V,edges:S,findNode:x,findEdge:T,addNodes:D,addEdges:b,removeNodes:w,removeEdges:v,fitView:O,setCenter:M,getViewport:z,screenToFlowCoordinate:j,getSelectedNodes:ie,updateNodeInternals:pe}=L,ye=t.ref(!1);async function ge(C){ye.value=!0,await t.nextTick(),await new Promise(R=>requestAnimationFrame(()=>R(null)));try{return await C()}finally{ye.value=!1}}async function me(){try{await ge(()=>fh(L))}catch(C){console.error("[entity-modeler] SVG export failed",C),c(i.t("em.canvas.exportFailed"))}}async function se(){try{await ge(()=>ph(L))}catch(C){console.error("[entity-modeler] PNG export failed",C),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:me,exportPng:se,fitView:O});const ke=t.computed(()=>i.resolved.value.entities.length===0);function Se(){const C=z(),{width:R,height:W}=L.dimensions.value;return{x:(R/2-C.x)/C.zoom,y:(W/2-C.y)/C.zoom}}function ce(){const C=Se();i.addEntity("NewEntity",{x:C.x,y:C.y})}function fe(){const C=Se();i.addNote("메모",{x:C.x,y:C.y})}function oe(C){for(const R of i.resolved.value.groups){const{location:W,size:re}=R.geo;if(C.x>=W.x&&C.x<=W.x+re.width&&C.y>=W.y&&C.y<=W.y+re.height)return R.group.modelId}return null}function le(C,R){return C.x===R.x&&C.y===R.y}function ue(C,R){return(C==null?void 0:C.width)===(R==null?void 0:R.width)&&(C==null?void 0:C.height)===(R==null?void 0:R.height)}function F(C,R){return C.entity===R.entity&&C.displayMode===R.displayMode&&C.collapsed===R.collapsed&&C.locked===R.locked&&C.groupRef===R.groupRef&&ue(C.size,R.size)&&C.style===R.style&&C.attributeStyles===R.attributeStyles&&C.operationStyles===R.operationStyles}function P(C,R){const W=Object.keys(C);if(W.length!==Object.keys(R).length)return!1;for(const re of W)if(re==="geo"){const ne=C.geo,Ce=R.geo;if(!le(ne.location,Ce.location)||!ue(ne.size,Ce.size))return!1}else if(C[re]!==R[re])return!1;return!0}function U(){const C=i.resolved.value,R=new Map(C.groups.map(de=>[de.group.modelId,de.geo])),W=new Set(C.groups.map(de=>de.group.modelId)),re=new Set([...W,...C.entities.map(de=>de.entity.modelId),...C.notes.map(de=>de.note.modelId)]);for(const de of[...V.value])re.has(de.id)||w([de.id]);for(const de of C.groups){const xe=de.group.modelId,Fe={width:`${de.geo.size.width}px`,height:`${de.geo.size.height}px`},He={group:de.group,style:de.style,locked:de.locked},rt=de.locked?!1:void 0,ze=x(xe);if(ze){le(ze.position,de.geo.location)||(ze.position={...de.geo.location});const ot=ze.data;(ot.group!==He.group||ot.style!==He.style||ot.locked!==He.locked)&&(ze.data=He);const tt=ze.style;((tt==null?void 0:tt.width)!==Fe.width||(tt==null?void 0:tt.height)!==Fe.height)&&(ze.style=Fe),ze.draggable!==rt&&(ze.draggable=rt)}else D([{id:xe,type:"group",position:{...de.geo.location},draggable:rt,style:Fe,data:He}])}for(const de of C.entities){const xe=de.entity.modelId,Fe=de.groupRef&&W.has(de.groupRef)?de.groupRef:void 0,He={entity:de.entity,displayMode:i.displayMode.value,collapsed:de.collapsed,locked:de.locked,groupRef:Fe,size:de.geo.size,style:de.style,attributeStyles:de.attributeStyles,operationStyles:de.operationStyles},rt=de.locked?!1:void 0,ze=de.locked?!1:void 0,ot=Fe?R.get(Fe):void 0,tt=ot?{x:de.geo.location.x-ot.location.x,y:de.geo.location.y-ot.location.y}:{...de.geo.location},Ge=x(xe);Ge?(le(Ge.position,tt)||(Ge.position=tt),F(Ge.data,He)||(Ge.data=He),Ge.parentNode!==Fe&&(Ge.parentNode=Fe),Ge.draggable!==rt&&(Ge.draggable=rt),Ge.connectable!==ze&&(Ge.connectable=ze)):D([{id:xe,type:"entity",position:tt,parentNode:Fe,draggable:rt,connectable:ze,data:He}])}for(const de of C.notes){const xe=de.note,Fe=xe.modelId,He=de.groupRef&&W.has(de.groupRef)?de.groupRef:void 0,rt={note:xe,groupRef:He},ze={width:`${xe.geo.size.width}px`,height:`${xe.geo.size.height}px`},ot=He?R.get(He):void 0,tt=ot?{x:xe.geo.location.x-ot.location.x,y:xe.geo.location.y-ot.location.y}:{...xe.geo.location},Ge=x(Fe);if(Ge){le(Ge.position,tt)||(Ge.position=tt);const so=Ge.data;(so.groupRef!==He||!P(so.note,xe))&&(Ge.data=rt);const kn=Ge.style;((kn==null?void 0:kn.width)!==ze.width||(kn==null?void 0:kn.height)!==ze.height)&&(Ge.style=ze),Ge.parentNode!==He&&(Ge.parentNode=He)}else D([{id:Fe,type:"note",position:tt,parentNode:He,style:ze,data:rt}])}const ne=new Map(C.associations.map(de=>[de.association.modelId,de])),Ce=new Set(C.noteConnections.map(de=>A(de.noteRef,de.targetRef)));for(const de of[...S.value])!ne.has(de.id)&&!Ce.has(de.id)&&v([de.id]);for(const[de,xe]of ne){const Fe={id:de,type:"association",source:xe.association.end1.entityRef,target:xe.association.end2.entityRef,sourceHandle:xe.sourceColumnRef?`r:${xe.sourceColumnRef}`:void 0,targetHandle:xe.targetColumnRef?`l:${xe.targetColumnRef}`:void 0,data:{association:xe.association,sourceColumnRef:xe.sourceColumnRef,targetColumnRef:xe.targetColumnRef}},He=T(de);if(He){const rt=He.data;(rt.association!==Fe.data.association||rt.sourceColumnRef!==Fe.data.sourceColumnRef||rt.targetColumnRef!==Fe.data.targetColumnRef)&&(He.data=Fe.data),He.sourceHandle!==Fe.sourceHandle&&(He.sourceHandle=Fe.sourceHandle),He.targetHandle!==Fe.targetHandle&&(He.targetHandle=Fe.targetHandle)}else b([Fe])}for(const de of C.noteConnections){const xe=A(de.noteRef,de.targetRef),Fe={noteRef:de.noteRef,targetRef:de.targetRef};T(xe)||b([{id:xe,type:"note-connection",source:de.noteRef,target:de.targetRef,data:Fe}])}}const Q=new Set;let X=!1,_e=!1;const he=new Map;function we(C){const R=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(C)}"]`);if(!R)return null;let W=`${R.offsetHeight}`;for(const re of R.querySelectorAll(".em-entity__row"))W+=`|${re.dataset.attr}:${re.offsetTop}`;return W}function Ie(){_e=!1;const C=X;X=!1;const R=[...Q];if(Q.clear(),C){pe();for(const re of V.value){const ne=we(re.id);ne!==null&&he.set(re.id,ne)}return}const W=[];for(const re of R){const ne=we(re);if(ne===null){he.delete(re);continue}he.get(re)!==ne&&(he.set(re,ne),W.push(re))}W.length&&pe(W)}function q(C){if(C)for(const R of C)Q.add(R);else X=!0;_e||(_e=!0,t.nextTick(()=>requestAnimationFrame(Ie)))}t.provide(Of,{mark:C=>q([C])});function K(){const C=ie.value.map(W=>W.id);if(C.length)return C;const R=i.selection.value;return R&&(R.kind==="entity"||R.kind==="note"||R.kind==="group")?[R.id]:[]}function J(){return ie.value.filter(C=>C.type==="entity").map(C=>C.id)}function ve(){return ie.value.filter(C=>C.type==="group").map(C=>C.id)}function Te(C){var R;return[...((R=i.state.logical.groups.find(W=>W.modelId===C))==null?void 0:R.memberEntityRefs)??[]]}function G(){const C=ve().flatMap(Te);return[...new Set([...J(),...C])]}function te(){return ve().length>0||J().length>1}function Y(){te()?i.copy(G()):i.copy()}async function ae(C){if(!C.length)return;await t.nextTick();const R=ie.value;R.length&&L.removeSelectedNodes(R);const W=C.map(re=>x(re)).filter(re=>!!re);W.length&&L.addSelectedNodes(W)}function Be(C){if(te()&&J().includes(C)){const R=G();return{caption:i.t("em.ctx.copyN",{n:R.length}),icon:"copy",handler:()=>i.copy(R)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:C},i.copy()}}}function Ve(C){var ne;const R=C.target;if(R&&(R.tagName==="INPUT"||R.tagName==="TEXTAREA"||R.isContentEditable))return;if(C.key==="?"){a.openModal({component:hh,bind:{locale:i.uiLocale.value}}),C.preventDefault();return}if((C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="k"){r.value=!0,C.preventDefault();return}if(!i.editable.value){(C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="c"&&(Y(),C.preventDefault());return}if(C.key==="Delete"||C.key==="Backspace"){i.deleteSelection()&&C.preventDefault();return}if(C.key==="ArrowUp"||C.key==="ArrowDown"||C.key==="ArrowLeft"||C.key==="ArrowRight"){if(((ne=i.selection.value)==null?void 0:ne.kind)==="attribute"){if(C.key==="ArrowUp"||C.key==="ArrowDown"){const Fe=C.key==="ArrowDown"?1:-1;(C.altKey?i.nudgeSelectedAttributes(Fe):i.moveAttributeFocus(Fe))&&C.preventDefault()}return}const Ce=C.shiftKey?10:1,de=C.key==="ArrowLeft"?-Ce:C.key==="ArrowRight"?Ce:0,xe=C.key==="ArrowUp"?-Ce:C.key==="ArrowDown"?Ce:0;i.nudgeNodes(K(),de,xe)&&C.preventDefault();return}if(!(C.metaKey||C.ctrlKey))return;const re=C.key.toLowerCase();re==="c"?(Y(),C.preventDefault()):re==="v"?(ae(i.paste()),C.preventDefault()):re==="z"&&(C.shiftKey?i.redo():i.undo(),C.preventDefault())}t.onMounted(async()=>{U(),await t.nextTick(),O(),q(),window.addEventListener("keydown",Ve),window.addEventListener("pointerup",H),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",Ve),window.removeEventListener("pointerup",H),window.removeEventListener("pointermove",f)});function H(){y.value=null}function B(){m.value=!0,_.value=null}function Pe(){var re;m.value=!1;const C=(re=document.elementFromPoint(h.x,h.y))==null?void 0:re.closest(".vue-flow__node"),R=C==null?void 0:C.dataset.id;if(!R){_.value=null;return}const W=C.classList.contains("vue-flow__node-group")?"group":C.classList.contains("vue-flow__node-note")?"note":"entity";_.value={kind:W,id:R}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],U),t.watch(()=>i.resolved.value,C=>{const R=_.value;if(!R)return;(R.kind==="entity"?C.entities.some(re=>re.entity.modelId===R.id):R.kind==="group"?C.groups.some(re=>re.group.modelId===R.id):C.notes.some(re=>re.note.modelId===R.id))||(_.value=null)});function Ze(C){const R=C.computedPosition??C.position,W=C.dimensions??{width:0,height:0};return{x:R.x+W.width/2,y:R.y+W.height/2}}function Ue(C){const R=C.node;if(R){if(_.value=null,R.type==="group"){const W=i.resolved.value.groups.find(re=>re.group.modelId===R.id);g.value=W?{groupId:R.id,dx:R.position.x-W.geo.location.x,dy:R.position.y-W.geo.location.y}:null,y.value=null;return}if(R.type!=="entity"&&R.type!=="note"){y.value=null;return}y.value=oe(Ze(R))}}function Le(C){var re;y.value=null,g.value=null;const R=(re=C.nodes)!=null&&re.length?C.nodes:[C.node],W=R.filter(ne=>(ne==null?void 0:ne.type)==="group");if(W.length){for(const ne of W){if(!ne)continue;const Ce=i.resolved.value.entities.filter(de=>de.groupRef===ne.id).map(de=>{const xe=x(de.entity.modelId),Fe=(xe==null?void 0:xe.computedPosition)??(xe==null?void 0:xe.position)??{x:0,y:0};return{id:de.entity.modelId,location:{x:Fe.x,y:Fe.y}}});i.dragGroup(ne.id,{x:ne.position.x,y:ne.position.y},Ce)}return}for(const ne of R){if(!ne||ne.type==="group")continue;const Ce=ne.computedPosition??ne.position,de=ne.dimensions??{width:0,height:0},xe={x:Ce.x+de.width/2,y:Ce.y+de.height/2};ne.type==="note"?i.dropNote(ne.id,{x:Ce.x,y:Ce.y},oe(xe)):i.dropEntity(ne.id,{x:Ce.x,y:Ce.y},oe(xe))}}function De(C){var Fe,He,rt,ze,ot;if(!i.editable.value||!C.source||!C.target)return;const R=((Fe=x(C.source))==null?void 0:Fe.type)==="note",W=((He=x(C.target))==null?void 0:He.type)==="note";if(R||W){if(R&&W)return;const tt=R?C.source:C.target,Ge=R?C.target:C.source;((rt=x(Ge))==null?void 0:rt.type)==="entity"&&i.addNoteConnection(tt,Ge);return}const re=tt=>{var Ge;return(Ge=i.state.logical.entities.find(so=>so.modelId===tt))==null?void 0:Ge.stereotype},ne=re(C.source)==="JPA_EMBEDDABLE",Ce=re(C.target)==="JPA_EMBEDDABLE";if(ne||Ce){if(ne&&Ce)return;const tt=ne?C.source:C.target,Ge=ne?C.target:C.source;i.addEmbedAssociation(Ge,tt);return}const de=(ze=C.sourceHandle)!=null&&ze.startsWith("r:")?C.sourceHandle.slice(2):void 0,xe=(ot=C.targetHandle)!=null&&ot.startsWith("l:")?C.targetHandle.slice(2):void 0;i.addAssociation(C.source,C.target,de,xe)}const Z=t.ref(null);function dt(C,R){var re;const W=i.state.layout.entityLayouts.find(ne=>ne.entityRef===C);return _t((re=W==null?void 0:W.attributeStyles)==null?void 0:re[R])}function bn(C,R){var re;const W=i.state.layout.entityLayouts.find(ne=>ne.entityRef===C);return _t((re=W==null?void 0:W.operationStyles)==null?void 0:re[R])}function Et(C){var R;return _t((R=i.state.layout.groupLayouts.find(W=>W.groupRef===C))==null?void 0:R.style)}function _n(C){var R;return _t((R=i.state.layout.notes.find(W=>W.modelId===C))==null?void 0:R.style)}function Ee(C){var ne,Ce;if(C.preventDefault(),!i.editable.value)return;const R=()=>j({x:C.clientX,y:C.clientY}),W=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const de=R();i.addEntity("NewEntity",{x:de.x,y:de.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const de=R();i.addNote("메모",{x:de.x,y:de.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const de=R();i.addEmptyGroup({x:de.x,y:de.y})}}],re=(ne=i.clipboard.value)==null?void 0:ne.kind;(re==="entity"||re==="entities")&&W.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>ae(i.paste())}),i.resolved.value.entities.length>0&&W.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(Ce=Z.value)==null||Ce.open(C,W)}function at({event:C,node:R}){var Fe,He,rt,ze,ot,tt,Ge,so,kn,Eh,Nh,wh,Ih,vh,Ch,xh,Sh,Rh,Ah;const W=C;if(W.preventDefault(),!i.editable.value){if(R.type==="group"||R.type==="note")return;const Ye=(He=(Fe=W.target)==null?void 0:Fe.closest("[data-attr]"))==null?void 0:He.dataset.attr;if(Ye){const lt=i.selection.value;(lt==null?void 0:lt.kind)==="attribute"&<.entityId===R.id&<.ids.includes(Ye)||i.selectAttribute(R.id,Ye);const En=((rt=i.selection.value)==null?void 0:rt.kind)==="attribute"&&i.selection.value.entityId===R.id?[...i.selection.value.ids]:[Ye];(ze=Z.value)==null||ze.open(W,[{caption:En.length>1?i.t("em.ctx.copyN",{n:En.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(ot=Z.value)==null||ot.open(W,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Wa(a,i,R.id)},Be(R.id)]);return}if(R.type==="group"){const Ye=i.isGroupLocked(R.id),lt=[];Ye||lt.push({type:"swatches",caption:i.t("em.common.color"),current:Et(R.id),onPick:En=>i.setGroupSwatch(R.id,En)},{type:"separator"});const ht=te()&&ve().includes(R.id)?G():Te(R.id);ht.length&<.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(ht)}),lt.push({caption:Ye?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:Ye?"unlock":"lock",handler:()=>i.setGroupLocked(R.id,!Ye)}),Ye||lt.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(R.id)}),(tt=Z.value)==null||tt.open(W,lt);return}if(R.type==="note"){(Ge=Z.value)==null||Ge.open(W,[{type:"swatches",caption:i.t("em.common.color"),current:_n(R.id),onPick:Ye=>i.setNoteSwatch(R.id,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(R.id)}]);return}const re=(kn=(so=W.target)==null?void 0:so.closest("[data-attr]"))==null?void 0:kn.dataset.attr;if(re){const Ye=i.selection.value;(Ye==null?void 0:Ye.kind)==="attribute"&&Ye.entityId===R.id&&Ye.ids.includes(re)||i.selectAttribute(R.id,re);const ht=((Eh=i.selection.value)==null?void 0:Eh.kind)==="attribute"&&i.selection.value.entityId===R.id?[...i.selection.value.ids]:[re];if(i.isEntityLocked(R.id)){(Nh=Z.value)==null||Nh.open(W,[{caption:ht.length>1?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const En=ht.length>1,As=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(R.id)},{type:"swatches",caption:En?i.t("em.ctx.colorN",{n:ht.length}):i.t("em.common.color"),current:En?null:dt(R.id,re),onPick:hD=>i.setAttributeSwatches(R.id,ht,hD)},{type:"separator"},{caption:En?i.t("em.ctx.copyN",{n:ht.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],Di=i.clipboard.value;(Di==null?void 0:Di.kind)==="attribute"&&As.push({caption:Di.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Di.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:R.id},i.paste()}}),As.push({type:"separator"},{caption:En?i.t("em.ctx.deleteAttrN",{n:ht.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(R.id,ht)}),(wh=Z.value)==null||wh.open(W,As);return}const ne=(vh=(Ih=W.target)==null?void 0:Ih.closest("[data-op]"))==null?void 0:vh.dataset.op;if(ne){if(i.isEntityLocked(R.id))return;(Ch=Z.value)==null||Ch.open(W,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(R.id)},{type:"swatches",caption:i.t("em.common.color"),current:bn(R.id,ne),onPick:Ye=>i.setOperationSwatch(R.id,ne,Ye)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(R.id,ne)}]);return}const Ce=i.resolved.value.entities.find(Ye=>Ye.entity.modelId===R.id),de=!!(Ce!=null&&Ce.locked),xe=[{caption:de?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>Wa(a,i,R.id)}];if(!de){xe.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(R.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(R.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const lt=ie.value.filter(ht=>ht.type==="entity").map(ht=>ht.id);i.createGroup(lt.includes(R.id)&<.length?lt:[R.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(R.id,R.id)});const Ye=i.embeddableCatalog.value;if(Ye.length){xe.push({type:"separator"});for(const lt of Ye){const ht=((xh=lt.label)==null?void 0:xh[i.userLanguage.value])??((Sh=lt.label)==null?void 0:Sh.ko)??((Rh=lt.label)==null?void 0:Rh.en)??lt.type;xe.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:ht}),icon:"link",handler:()=>i.addPredefinedEmbed(R.id,lt.type)})}}}if(xe.push({type:"separator"}),xe.push({caption:Ce!=null&&Ce.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Ce!=null&&Ce.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(R.id,!(Ce!=null&&Ce.collapsed))}),Ce!=null&&Ce.groupRef&&!de&&xe.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(R.id)}),xe.push({caption:de?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:de?"unlock":"lock",handler:()=>i.setEntityLocked(R.id,!de)}),xe.push(Be(R.id)),!de){const Ye=i.clipboard.value;(Ye==null?void 0:Ye.kind)==="attribute"&&xe.push({caption:Ye.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Ye.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:R.id},i.paste()}}),xe.push({type:"separator"}),xe.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(R.id)})}(Ah=Z.value)==null||Ah.open(W,xe)}function zt({event:C,edge:R}){var Ce,de;const W=C;if(W.preventDefault(),!i.editable.value)return;const re=$(R.id);if(re){(Ce=Z.value)==null||Ce.open(W,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(re.noteRef,re.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(re.noteRef,re.targetRef)}]);return}const ne=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(R.id)}];i.isAssociationLocked(R.id)||ne.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(R.id)}),(de=Z.value)==null||de.open(W,ne)}function ut(C){return C==="group"?"group":C==="note"?"note":"entity"}function en({node:C}){if(ie.value.length>1){i.selection.value=null;return}i.selection.value={kind:ut(C.type),id:C.id}}function tn({nodes:C}){C.length>1&&(i.selection.value=null)}function Ne({edge:C}){const R=$(C.id);i.selection.value=R?{kind:"note",id:R.noteRef}:{kind:"association",id:C.id}}function et(C){const R=i.selection.value;return!!R&&R.kind!=="attribute"&&R.id===C.id}function Ft(C){var R,W;return et(C)?C.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":C.type==="note"?"var(--em-note-soft)":C.type==="group"?yf(_t((R=C.data)==null?void 0:R.style),!0)??"var(--em-mm-group)":yf(_t((W=C.data)==null?void 0:W.style))??"var(--em-mm-entity)"}function pt(C){return et(C)?"var(--em-selection)":C.type==="note"?"var(--em-note-accent)":C.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function nt(C,R){M(C,R,{zoom:z().zoom,duration:350})}t.watch(()=>i.focusRequest.value,C=>{if(!C)return;const R=x(C.id);if(!R)return;const W=R.computedPosition??R.position,re=R.dimensions??{width:0,height:0};nt(W.x+re.width/2,W.y+re.height/2)});function Uo({position:C}){nt(C.x,C.y)}function Ho({node:C}){i.selection.value={kind:ut(C.type),id:C.id};const R=C.computedPosition??C.position,W=C.dimensions??{width:0,height:0};nt(R.x+W.width/2,R.y+W.height/2)}function jo({node:C}){O({nodes:[C.id],duration:350,maxZoom:1.2,padding:.6})}return(C,R)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(_w),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!ye.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(un).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:B,onMoveEnd:Pe,onConnect:De,onConnectStart:R[1]||(R[1]=W=>u.value=!0),onConnectEnd:R[2]||(R[2]=W=>u.value=!1),onNodeDrag:Ue,onNodeDragStop:Le,onNodeClick:en,onEdgeClick:Ne,onSelectionChange:tn,onPaneClick:R[3]||(R[3]=W=>t.unref(i).selection.value=null),onPaneContextMenu:Ee,onNodeContextMenu:at,onEdgeContextMenu:zt},{"node-group":t.withCtx(W=>[t.createVNode(Yf,t.normalizeProps(t.guardReactiveProps(W)),null,16)]),"node-entity":t.withCtx(W=>[t.createVNode(Gf,t.normalizeProps(t.guardReactiveProps(W)),null,16)]),"node-note":t.withCtx(W=>[t.createVNode(qf,t.normalizeProps(t.guardReactiveProps(W)),null,16)]),"edge-association":t.withCtx(W=>[t.createVNode(hp,t.normalizeProps(t.guardReactiveProps(W)),null,16)]),"edge-note-connection":t.withCtx(W=>[t.createVNode(dT,t.normalizeProps(t.guardReactiveProps(W)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(Zx),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(IS),{"show-interactive":!1,position:"bottom-left"},{default:t.withCtx(()=>[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(t.unref(io),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:ce},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(io),{title:t.unref(i).t("em.ctx.addNote"),onClick:fe},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(io),{title:t.unref(i).t("em.palette.autoLayout"),onClick:R[0]||(R[0]=W=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(Ae,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(rT),{key:1,pannable:"",width:224,height:160,"node-color":Ft,"node-stroke-color":pt,"node-border-radius":4,"node-stroke-width":2,"mask-color":"var(--em-minimap-mask)","mask-stroke-color":"var(--em-accent)","mask-stroke-width":1.5,"mask-border-radius":4,"offset-scale":3,onClick:Uo,onNodeClick:Ho,onNodeDblclick:jo})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ke.value?(t.openBlock(),t.createElementBlock("div",eM,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",tM,t.toDisplayString(t.unref(i).t("em.canvas.emptyTitle")),1),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyHint")},null,8,nM),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,oM),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,iM)],64)):(t.openBlock(),t.createElementBlock("p",aM,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(ZT,{key:1,controller:t.unref(i),onClose:R[4]||(R[4]=W=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",rM,[t.createVNode(Ae,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",lM,[t.createElementVNode("strong",sM,t.toDisplayString(d.value.title),1),t.createElementVNode("span",cM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(ET,{ref_key:"menuRef",ref:Z,locale:t.unref(i).uiLocale.value},null,8,["locale"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"em-toast-fade"},{default:t.withCtx(()=>[l.value?(t.openBlock(),t.createElementBlock("div",dM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),uM={class:"em-explorer em-scroll-overlay"},mM={class:"em-explorer__search"},fM=["placeholder","aria-label"],pM=["aria-label","title"],hM={key:0,class:"em-explorer__empty"},yM=["aria-label"],gM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],bM=["onClick"],_M=["title"],kM={class:"em-key-slot"},EM={class:"em-key-slot"},NM={class:"em-explorer__label"},wM={key:2,class:"em-explorer__sr"},gh=Ke(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=ee.useModal(),r=t.computed(()=>{var ke,Se;const D=i.resolved.value,b=i.displayMode.value,w=i.userLanguage.value,v=ce=>{var fe,oe,le;return zi(b,ce.name,(oe=(fe=ce.table)==null?void 0:fe.logicalName)==null?void 0:oe[w],(le=ce.table)==null?void 0:le.physicalName,i.t("em.node.logicalMissing"))},O=b==="PHYSICAL"||b==="LOGICAL_PHYSICAL",M=ce=>{const fe=ce.attrType.startsWith("RELATION")&&ce.dbAttrs.length>0;return{icon:ce.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:ce.identifier,fk:fe&&O}}},z=ce=>ce.attrType.startsWith("EMBED")&&ce.dbAttrs.length>0,j=b==="PHYSICAL"||b==="LOGICAL_PHYSICAL",ie=ce=>{if(ce.attrType!=="EMBED_PREDEF")return ce.dbAttrs;const fe=i.embeddableCatalog.value.find(oe=>oe.type===ce.type);return fe?ce.dbAttrs.map((oe,le)=>{const ue=fe.fields[le];return ue?{...oe,physicalName:oe.physicalName||ue.physicalName,logicalName:oe.logicalName??ue.logicalName,dataType:oe.dataType||ue.dataType,length:oe.length??ue.length}:oe}):ce.dbAttrs},pe=(ce,fe)=>{var F,P,U,Q,X,_e,he,we,Ie;const oe={entityId:fe,attrId:ce.modelId};if(z(ce)){const q=Mr(b,ce);return{key:`attr:${ce.modelId}`,label:ce.name+(q?` : ${q}`:""),icon:"table",attrRef:oe,focusId:fe,matchText:Fo(ce.name,(P=(F=ce.dbAttrs[0])==null?void 0:F.logicalName)==null?void 0:P[w],(U=ce.dbAttrs[0])==null?void 0:U.physicalName),children:j?ie(ce).map(K=>{var J,ve;return{key:`attr:${ce.modelId}:col:${K.modelId}`,label:zi(b,K.physicalName,(J=K.logicalName)==null?void 0:J[w],K.physicalName,i.t("em.node.logicalMissing"))+(K.dataType?` : ${K.dataType}`:""),icon:"field",attrRef:oe,focusId:fe,matchText:Fo(K.physicalName,(ve=K.logicalName)==null?void 0:ve[w]),children:[]}}):[]}}const le=Tr(ce,i.state.logical.associations),ue=Mr(b,ce,le);return{key:`attr:${ce.modelId}`,label:zi(b,ce.name,(X=(Q=ce.dbAttrs[0])==null?void 0:Q.logicalName)==null?void 0:X[w],(_e=ce.dbAttrs[0])==null?void 0:_e.physicalName,i.t("em.node.logicalMissing"))+(ue?` : ${ue}`:""),...M(ce),attrRef:oe,focusId:fe,matchText:Fo(ce.name,(we=(he=ce.dbAttrs[0])==null?void 0:he.logicalName)==null?void 0:we[w],(Ie=ce.dbAttrs[0])==null?void 0:Ie.physicalName),children:[]}},ye=ce=>{var le,ue,F;const fe=ce.entity,oe=[...fe.attributes].sort((P,U)=>P.order-U.order);return{key:`entity:${fe.modelId}`,label:v(fe),icon:"table",selectKind:"entity",selectId:fe.modelId,focusId:fe.modelId,matchText:Fo(fe.name,(ue=(le=fe.table)==null?void 0:le.logicalName)==null?void 0:ue[w],(F=fe.table)==null?void 0:F.physicalName),children:oe.map(P=>pe(P,fe.modelId))}},ge=new Map,me=[];for(const ce of D.entities)if(ce.groupRef){const fe=ge.get(ce.groupRef)??[];fe.push(ce),ge.set(ce.groupRef,fe)}else me.push(ce);const se=[];for(const ce of D.groups){const fe=ce.group;se.push({key:`group:${fe.modelId}`,label:((ke=fe.name)==null?void 0:ke[w])||((Se=fe.name)==null?void 0:Se.ko)||fe.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:fe.modelId,children:(ge.get(fe.modelId)??[]).map(ye)})}for(const ce of me)se.push(ye(ce));if(D.associations.length){const ce=new Map(D.entities.map(fe=>[fe.entity.modelId,v(fe.entity)]));se.push({key:"section:associations",label:i.t("em.explorer.associations",{n:D.associations.length}),icon:"arrow-lr",children:D.associations.map(fe=>{const oe=fe.association,le=ce.get(oe.end1.entityRef)??oe.end1.entityRef,ue=ce.get(oe.end2.entityRef)??oe.end2.entityRef;return{key:`assoc:${oe.modelId}`,label:`${le} — ${ue}`,icon:"arrow-lr",selectKind:"association",selectId:oe.modelId,children:[]}})})}return D.notes.length&&se.push({key:"section:notes",label:i.t("em.explorer.notes",{n:D.notes.length}),icon:"note",children:D.notes.map(({note:ce})=>{var fe;return{key:`note:${ce.modelId}`,label:((fe=ce.memo.split(`
|
|
66
|
-
`)[0])==null?void 0:fe.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:ce.modelId,focusId:ce.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:se}});function l(D){return D?D.pk&&D.fk?i.t("em.node.keyPfk"):D.pk?i.t("em.node.keyPk"):D.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const D=[],b=w=>{if(w.children.length){w.key!=="root"&&D.push(w.key);for(const v of w.children)b(v)}};return b(r.value),D}),c=D=>D.startsWith("entity:")||D==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:h}=dh({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),y=t.ref(null),g=t.computed(()=>f.value.trim().length>0),_=t.computed(()=>{const D=[];if(g.value){const w=OT(r.value,f.value.trim().toLowerCase()),v=(O,M,z,j,ie)=>{if(!w.has(O.key))return;D.push({node:O,depth:M,parentKey:z,posinset:j,setsize:ie});const pe=O.children.filter(ye=>w.has(ye.key));pe.forEach((ye,ge)=>v(ye,M+1,O.key,ge+1,pe.length))};return v(r.value,0,null,1,1),D}const b=(w,v,O,M,z)=>{D.push({node:w,depth:v,parentKey:O,posinset:M,setsize:z}),d(w.key)||w.children.forEach((j,ie)=>b(j,v+1,w.key,ie+1,w.children.length))};return b(r.value,0,null,1,1),D}),E=t.ref(null),N=t.ref(null),p=t.computed(()=>{var b;const D=_.value;return N.value&&D.some(w=>w.node.key===N.value)?N.value:((b=D[0])==null?void 0:b.node.key)??null}),k=D=>!g.value&&d(D);async function I(D){var b,w;D&&(N.value=D,await t.nextTick(),(w=(b=E.value)==null?void 0:b.querySelector(`[data-key="${D}"]`))==null||w.focus())}function A(D,b){var O,M,z,j,ie;const w=_.value,v=w.findIndex(pe=>pe.node.key===b.node.key);switch(D.key){case"ArrowDown":D.preventDefault(),I((O=w[v+1])==null?void 0:O.node.key);return;case"ArrowUp":D.preventDefault(),I((M=w[v-1])==null?void 0:M.node.key);return;case"Home":D.preventDefault(),I((z=w[0])==null?void 0:z.node.key);return;case"End":D.preventDefault(),I((j=w[w.length-1])==null?void 0:j.node.key);return;case"ArrowRight":if(D.preventDefault(),!b.node.children.length)return;k(b.node.key)?u(b.node.key):I((ie=w[v+1])==null?void 0:ie.node.key);return;case"ArrowLeft":D.preventDefault(),b.node.children.length&&!k(b.node.key)?u(b.node.key):I(b.parentKey);return;case"Enter":case" ":D.preventDefault(),x(b.node,D);return;case"F2":D.preventDefault(),T(b.node)}}const $=t.computed(()=>g.value&&_.value.length<=1);function L(D){var v;if(D.key!=="/"||D.metaKey||D.ctrlKey||D.altKey||D.shiftKey)return;const b=D.target,w=b==null?void 0:b.tagName;w==="INPUT"||w==="TEXTAREA"||w==="SELECT"||b!=null&&b.isContentEditable||(D.preventDefault(),(v=y.value)==null||v.focus())}t.onMounted(()=>window.addEventListener("keydown",L)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",L)),n({toggleAll:m,allExpanded:h,hasExpandable:t.computed(()=>s.value.length>0)});function V(D){const b=i.selection.value;return D.attrRef?(b==null?void 0:b.kind)==="attribute"&&b.entityId===D.attrRef.entityId&&b.ids.includes(D.attrRef.attrId):!!b&&b.kind!=="attribute"&&!!D.selectId&&D.selectKind===b.kind&&D.selectId===b.id}function S(D){const b=i.selection.value;return D.selectKind==="entity"&&(b==null?void 0:b.kind)==="attribute"&&b.entityId===D.selectId}function x(D,b){if(D.attrRef){const w=b.shiftKey?"range":b.metaKey||b.ctrlKey?"toggle":"replace";i.selectAttribute(D.attrRef.entityId,D.attrRef.attrId,w)}else D.selectKind&&D.selectId&&(i.selection.value={kind:D.selectKind,id:D.selectId});D.focusId&&i.requestFocus(D.focusId)}function T(D){D.selectKind==="entity"&&D.selectId&&Wa(a,i,D.selectId)}return(D,b)=>(t.openBlock(),t.createElementBlock("section",uM,[t.createElementVNode("div",mM,[t.createVNode(Ae,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:y,"onUpdate:modelValue":b[0]||(b[0]=w=>f.value=w),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:b[1]||(b[1]=t.withKeys(w=>f.value="",["esc"]))},null,40,fM),[[t.vModelText,f.value]]),f.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":t.unref(i).t("em.explorer.clearSearchAria"),title:t.unref(i).t("em.explorer.clearSearchTitle"),onClick:b[2]||(b[2]=w=>f.value="")},[t.createVNode(Ae,{name:"x",size:13})],8,pM)):t.createCommentVNode("",!0)]),$.value?(t.openBlock(),t.createElementBlock("p",hM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:E,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,w=>(t.openBlock(),t.createElementBlock("div",{key:w.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":V(w.node),"is-focus-parent":S(w.node),"is-selectable":!!w.node.selectKind||!!w.node.attrRef||!!w.node.focusId}]),"data-key":w.node.key,role:"treeitem","aria-level":w.depth+1,"aria-posinset":w.posinset,"aria-setsize":w.setsize,"aria-expanded":w.node.children.length?!k(w.node.key):void 0,"aria-selected":V(w.node),tabindex:w.node.key===p.value?0:-1,style:t.normalizeStyle({paddingLeft:4+w.depth*14+"px"}),onClick:v=>x(w.node,v),onDblclick:v=>T(w.node),onFocus:v=>N.value=w.node.key,onKeydown:v=>A(v,w)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!w.node.children.length,"is-open":!k(w.node.key)}]),onClick:t.withModifiers(v=>w.node.children.length&&t.unref(u)(w.node.key),["stop"])},[w.node.children.length?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,bM),w.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(w.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",kM,[w.node.keyMarks.pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:14,class:"em-key is-pk"})):w.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(Ae,{key:1,class:"em-explorer__icon",name:w.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",EM,[w.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,_M)):(t.openBlock(),t.createBlock(Ae,{key:1,class:"em-explorer__icon",name:w.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",NM,t.toDisplayString(w.node.label),1),l(w.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",wM,t.toDisplayString(l(w.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,gM))),128))],8,yM)]))}}),[["__scopeId","data-v-e5303c65"]]),IM={class:"em-text-export"},vM=["id","aria-selected","tabindex","onClick"],CM=["aria-labelledby"],xM={class:"em-text-export__actions"},SM=Ke(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(m,h)=>Dt(n.locale??"ko",m,h),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var h,f;a.value=m,await t.nextTick(),(f=(h=l.value)==null?void 0:h.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const h=n.formats.length;h&&s((a.value+m+h)%h)}async function d(){try{await navigator.clipboard.writeText(r().content),ee.showNotification(i("em.export.copied"),"info")}catch{ee.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),h=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(h);try{const y=document.createElement("a");y.href=f,y.download=m.filename,document.body.appendChild(y),y.click(),y.remove()}finally{URL.revokeObjectURL(f)}}return(m,h)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",IM,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(f,y)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${y}`,key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":y===a.value}]),"aria-selected":y===a.value,"aria-controls":"em-text-export-panel",tabindex:y===a.value?0:-1,onClick:g=>a.value=y,onKeydown:[h[0]||(h[0]=t.withKeys(t.withModifiers(g=>c(-1),["prevent"]),["left"])),h[1]||(h[1]=t.withKeys(t.withModifiers(g=>c(1),["prevent"]),["right"])),h[2]||(h[2]=t.withKeys(t.withModifiers(g=>s(0),["prevent"]),["home"])),h[3]||(h[3]=t.withKeys(t.withModifiers(g=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,vM))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,CM),t.createElementVNode("div",xM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:h[4]||(h[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),RM={class:"em-text-import"},AM=["aria-label"],$M=["aria-checked","tabindex","onClick"],TM=["placeholder"],MM={class:"em-text-import__status"},VM={class:"em-text-import__ok"},BM={key:0,class:"em-text-import__warn"},DM={key:1,class:"em-text-import__err"},OM={key:2,class:"em-text-import__err"},LM={key:3,class:"em-text-import__err"},PM={class:"em-text-import__actions"},zM=Ke(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=ee.useModalHandle(),i=(g,_)=>Dt(n.locale??"ko",g,_),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}],s=t.ref(null);async function c(g){var E,N;const _=l[(g+l.length)%l.length];_&&(r.value=_.key,await t.nextTick(),(N=(E=s.value)==null?void 0:E.querySelectorAll('[role="radio"]')[l.indexOf(_)])==null||N.focus())}function d(g){c(l.findIndex(_=>_.key===r.value)+g)}function u(g){return g?g.startsWith("{")?"json":/\berdiagram\b/i.test(g)?"mermaid":/\bcreate\s+table\b/i.test(g)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),h=t.computed(()=>{const g=a.value.trim();if(!g)return{status:"empty"};const _=m.value;if(!_)return{status:"unknown"};try{let E,N=[];return _==="json"?E=fc(g):_==="mermaid"?E=ac(g):(E=cc(g),N=Vr(g).warnings),E.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:E,warnings:N}}catch(E){return{status:"error",message:E instanceof Error?E.message:String(E)}}}),f=t.computed(()=>h.value.status==="ok");function y(){const g=h.value;g.status!=="ok"||!g.source||(n.onImport(g.source),o.close())}return(g,_)=>(t.openBlock(),t.createBlock(t.unref(ee.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",RM,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,E=>t.createElementVNode("button",{key:E.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":E.key===r.value}]),"aria-checked":E.key===r.value,tabindex:E.key===r.value?0:-1,onClick:N=>r.value=E.key,onKeydown:[_[0]||(_[0]=t.withKeys(t.withModifiers(N=>d(-1),["prevent"]),["left"])),_[1]||(_[1]=t.withKeys(t.withModifiers(N=>d(1),["prevent"]),["right"])),_[2]||(_[2]=t.withKeys(t.withModifiers(N=>c(0),["prevent"]),["home"])),_[3]||(_[3]=t.withKeys(t.withModifiers(N=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(E.labelKey)),43,$M)),64))],8,AM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":_[4]||(_[4]=E=>a.value=E),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,TM),[[t.vModelText,a.value]]),t.createElementVNode("div",MM,[h.value.status==="ok"&&h.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",VM,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:h.value.source.logical.entities.length,relations:h.value.source.logical.associations.length})),1),h.value.warnings&&h.value.warnings.length?(t.openBlock(),t.createElementBlock("span",BM," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:h.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):h.value.status==="error"?(t.openBlock(),t.createElementBlock("span",DM,t.toDisplayString(i("em.import.error",{message:h.value.message??""})),1)):h.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",OM,t.toDisplayString(i("em.import.unknownFormat")),1)):h.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",LM,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",PM,[t.createVNode(t.unref(ee.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:y},null,8,["caption","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:i("em.common.close"),onClick:_[5]||(_[5]=E=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),FM={class:"em-toolbar"},UM=["title"],HM={class:"em-toolbar__mode"},bh=Ke(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=ee.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:y=>i.displayMode.value=y});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const y=i.resolved.value.entities;return y.length>0&&y.every(g=>g.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=vr(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:SM,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:Ks(y,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Cr(y,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Cr(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:dc(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:mc(y,i.state.layout),filename:"diagram.json"}]}})}function h(){r.openModal({component:zM,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(g=>g.modelId))}}})}function f(){r.openModal({component:hh,bind:{locale:i.uiLocale.value}})}return(y,g)=>(t.openBlock(),t.createElementBlock("div",FM,[t.unref(i).referenceOnlyDocument.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-toolbar__refonly",title:t.unref(i).t("em.toolbar.referenceOnlyDocHint")},t.toDisplayString(t.unref(i).t("em.toolbar.referenceOnlyBadge")),9,UM)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:g[0]||(g[0]=_=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:g[1]||(g[1]=_=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),g[9]||(g[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",HM,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(ee.BSSelect),{modelValue:s.value,"onUpdate:modelValue":g[2]||(g[2]=_=>s.value=_),items:l,"value-provider":_=>_.v,"label-provider":_=>t.unref(i).t(_.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:g[3]||(g[3]=_=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:g[4]||(g[4]=_=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode(Ae,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),g[10]||(g[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:h},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:g[5]||(g[5]=_=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:g[6]||(g[6]=_=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"camera",size:16})]),_:1},8,["tooltip"]),g[11]||(g[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:g[7]||(g[7]=_=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),g[8]||(g[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(Ae,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),jM=["title"],KM=["title"],GM=["disabled","aria-pressed"],YM=["disabled","aria-pressed"],qM=Ke(t.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=l=>Dt(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[t.createVNode(Ae,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,jM)):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[t.createVNode(Ae,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,GM),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[t.createVNode(Ae,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,YM)],10,KM))}}),[["__scopeId","data-v-2b5162b7"]]),WM=["disabled"],JM={class:"em-panel__sub"},XM={class:"em-nav"},ZM={key:0,class:"em-nav__divider","aria-hidden":"true"},QM={key:1},e2=["onClick","onKeydown"],t2={class:"em-nav__name"},n2=["title"],o2={key:0,class:"em-panel__note"},i2=["data-attr-block"],a2={class:"em-attr__row"},r2=["title"],l2={key:0,class:"em-attr__row"},s2={key:1,class:"em-attr__navhint"},c2={key:0,class:"em-attr__navhint"},d2={class:"em-attr__row"},u2={class:"em-attr__row"},m2=["title"],f2={class:"em-attr__flags"},p2={class:"em-attr__pii"},h2={class:"em-attr__pii"},y2={key:1,class:"em-attr__pii"},g2={key:2,class:"em-attr__pii em-attr__codetop"},b2={class:"em-multilang"},_2={key:3,class:"em-embed-cols"},k2={class:"em-embed-col__label"},E2={class:"em-attr__row"},N2=["title"],w2=["title"],I2=["title"],v2={class:"em-attr__row"},C2={key:0,class:"em-embed-upd"},x2={key:1,class:"em-attr__navhint"},S2={class:"em-embed-upd"},R2={class:"em-embed-upd"},A2={class:"em-swatch__row em-attr__swatch"},$2=["title","onClick"],T2=["title","onClick"],M2={key:0,class:"em-attr__swatch-hint"},V2=Ke(t.defineComponent({__name:"EntityColumnsSection",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:f,dbLocked:y,fkDerived:g,fkOriginPhysical:_,typeValueOf:E,typeLabelOf:N,setAttrType:p,setAttrCustomType:k,setDb:I,scaleApplicable:A,scaleHint:$,setDbLogical:L,setAttrDescription:V,attrPiiValue:S,setAttrPii:x,predefinedCustomTypeCatalog:T,embeddableCatalog:D,predefinedLabel:b,groupCodeCatalog:w,attrGroupCodes:v,attrCodeItems:O,codeValueOf:M,codeLabelOf:z,setAttrGroupCode:j,setAttrCode:ie,setAttrDefaultValue:pe,isEmbedExpanded:ye,setDbAt:ge,setDbLogicalAt:me,embedColMeta:se,fixedDataType:ke,fixedLength:Se,fixedScale:ce,updatableItems:fe,updatableLabel:oe,updatableValue:le,setUpdatableAt:ue,setUpdatable:F,insertableItems:P,insertableLabel:U,insertableValue:Q,setInsertableAt:X,setInsertable:_e,sharedItems:he,sharedLabel:we,sharedValue:Ie,setSharedAt:q,isShared:K,sharedPhysical:J}=kf(o,()=>n.entityId),ve=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Le=>Le.entityRef===i.value.modelId)??null:null),Te=t.computed(()=>{var Le;return((Le=i.value)==null?void 0:Le.attributes.filter(De=>De.attrType!=="DIVIDER"))??[]}),G=t.computed(()=>{var Le;return((Le=i.value)==null?void 0:Le.attributes)??[]}),te=t.computed(()=>Te.value.filter(Le=>r.value.has(Le.modelId)));function Y(Le){return{pk:Le.identifier,fk:Le.attrType.startsWith("RELATION")&&Le.dbAttrs.length>0,required:Le.notNull&&!Le.identifier}}function ae(Le){const De=Y(Le),Z=[De.pk&&"PK",De.fk&&"FK",De.required&&"NOT NULL"].filter(Boolean);return Z.length?Z.join(" · "):void 0}function Be(Le,De){i.value&&o.selectAttribute(i.value.modelId,Le.modelId,De.shiftKey?"range":De.metaKey||De.ctrlKey?"toggle":"replace")}function Ve(Le){var De,Z;return _t((Z=(De=ve.value)==null?void 0:De.attributeStyles)==null?void 0:Z[Le.modelId])}function H(Le){return r.value.size>1&&r.value.has(Le.modelId)}function B(Le,De){if(!i.value)return;const Z=H(Le)?o.selectedAttrIds.value:[Le.modelId];o.setAttributeSwatches(i.value.modelId,Z,De)}const Pe=t.ref(void 0);function Ze(Le){if(!Le||!i.value)return;const De=o.addPredefinedEmbed(i.value.modelId,Le);De&&o.selectAttribute(i.value.modelId,De),Pe.value=void 0}function Ue(){if(!i.value)return;const Le=o.addAttribute(i.value.modelId);Le&&o.selectAttribute(i.value.modelId,Le)}return(Le,De)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",JM,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:Te.value.length}))+" ",1),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:Ue},null,8,["caption"]),t.unref(D).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":Pe.value,items:t.unref(D),"value-provider":Z=>Z.type,"label-provider":t.unref(b),"onUpdate:modelValue":Ze},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",XM,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(G.value,Z=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Z.modelId},[Z.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",ZM,[...De[0]||(De[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",QM,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(r).has(Z.modelId)}]),role:"button",tabindex:"0",onClick:dt=>Be(Z,dt),onKeydown:[t.withKeys(t.withModifiers(dt=>Be(Z,dt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(dt=>Be(Z,dt),["prevent"]),["space"])]},[t.createElementVNode("span",t2,t.toDisplayString(Z.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:ae(Z)},[Y(Z).pk?(t.openBlock(),t.createBlock(Ae,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):Y(Z).required?(t.openBlock(),t.createBlock(Ae,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),Y(Z).fk?(t.openBlock(),t.createBlock(Ae,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,n2)],42,e2)]))],64))),128))]),Te.value.length&&!te.value.length?(t.openBlock(),t.createElementBlock("p",o2,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(te.value,Z=>{var dt,bn,Et,_n,Ee,at,zt,ut,en,tn;return t.openBlock(),t.createElementBlock("div",{key:Z.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(r).has(Z.modelId)}]),"data-attr-block":Z.modelId},[t.createElementVNode("div",a2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-name-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":Z.name,"onUpdate:modelValue":Ne=>t.unref(d)(Z,{name:Ne})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-type-${Z.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:Z.attrType.startsWith("EMBED")||!!Z.groupCode||Z.attrType==="RELATION_REF"||t.unref(g)(Z),items:t.unref(oc)(Z.type,t.unref(T)),"value-provider":t.unref(E),"label-provider":t.unref(N),"model-value":Z.type,"onUpdate:modelValue":Ne=>t.unref(p)(Z,Ne)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(u)(Z)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:Ne=>t.unref(o).removeAttribute(t.unref(i).modelId,Z.modelId)},null,8,["onClick"])],8,r2)]),Z.type===t.unref(an)&&!t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("div",l2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-customtype-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Z.customType??"","onUpdate:modelValue":Ne=>t.unref(k)(Z,Ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),Z.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",s2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(ye)(Z)?(t.openBlock(),t.createElementBlock("div",_2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.dbAttrs,(Ne,et)=>{var Ft,pt,nt,Uo,Ho,jo,C,R;return t.openBlock(),t.createElementBlock("div",{key:Ne.modelId,class:"em-embed-col"},[t.createElementVNode("span",k2,t.toDisplayString(((Ft=t.unref(se)(Z,et))==null?void 0:Ft.name)??((pt=t.unref(se)(Z,et))==null?void 0:pt.physicalName)??t.unref(o).t("em.attr.colFallback",{n:et+1})),1),t.createElementVNode("div",E2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`embed-col-${Ne.modelId}`,width:"100%",disabled:t.unref(K)(Ne),placeholder:((nt=t.unref(se)(Z,et))==null?void 0:nt.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(K)(Ne)?t.unref(J)(Ne):Ne.physicalName,"onUpdate:modelValue":W=>t.unref(ge)(Z,et,{physicalName:W})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSTextInput),{name:`embed-dtype-${Ne.modelId}`,width:"84px",disabled:"","model-value":t.unref(ke)(Z,et)},null,8,["name","model-value"])],8,N2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-len-${Ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(Se)(Z,et)},null,8,["name","model-value"])],8,w2),t.createElementVNode("span",{title:t.unref(o).t("em.attr.embedFixedHint")},[t.createVNode(t.unref(ee.BSNumberInput),{name:`embed-scale-${Ne.modelId}`,width:"48px",disabled:"","model-value":t.unref(ce)(Z,et)},null,8,["name","model-value"])],8,I2)]),t.createVNode(no,{controller:t.unref(o),"ref-id":Ne.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",v2,[t.createVNode(mn,{class:"grow",name:`embed-logical-${Ne.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((Ho=(Uo=t.unref(se)(Z,et))==null?void 0:Uo.logicalName)==null?void 0:Ho[t.unref(o).userLanguage.value])??((C=(jo=t.unref(se)(Z,et))==null?void 0:jo.logicalName)==null?void 0:C.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":Ne.logicalName,"onUpdate:modelValue":W=>t.unref(me)(Z,et,W)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(R=t.unref(se)(Z,et))!=null&&R.shareable?(t.openBlock(),t.createElementBlock("label",C2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(ee.BSSelect),{width:"110px","model-value":t.unref(Ie)(Ne),items:t.unref(he)(),"value-provider":t.unref(c),"label-provider":t.unref(we),"onUpdate:modelValue":W=>W&&t.unref(q)(Z,et,W)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(K)(Ne)?(t.openBlock(),t.createElementBlock("p",x2,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",S2,[De[3]||(De[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(K)(Ne),"model-value":t.unref(K)(Ne)?"false":t.unref(Q)(Ne),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(U),"onUpdate:modelValue":W=>W&&t.unref(X)(Z,et,W)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",R2,[De[4]||(De[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"110px",disabled:t.unref(K)(Ne),"model-value":t.unref(K)(Ne)?"false":t.unref(le)(Ne),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":W=>W&&t.unref(ue)(Z,et,W)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("p",c2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",d2,[t.createVNode(mn,{class:"grow",name:`attr-logical-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(dt=Z.dbAttrs[0])==null?void 0:dt.logicalName,"onUpdate:modelValue":Ne=>t.unref(L)(Z,Ne)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",u2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`attr-col-${Z.modelId}`,width:"100%",placeholder:t.unref(_)(Z)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(y)(Z),"model-value":((bn=Z.dbAttrs[0])==null?void 0:bn.physicalName)??"","onUpdate:modelValue":Ne=>t.unref(I)(Z,{physicalName:Ne})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{name:`attr-dtype-${Z.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(y)(Z)||t.unref(g)(Z),items:t.unref(ec)(((Et=Z.dbAttrs[0])==null?void 0:Et.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(Rr),"model-value":((_n=Z.dbAttrs[0])==null?void 0:_n.dataType)??"","onUpdate:modelValue":Ne=>Ne&&t.unref(I)(Z,{dataType:Ne})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-len-${Z.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(y)(Z)||t.unref(g)(Z),"model-value":(Ee=Z.dbAttrs[0])==null?void 0:Ee.length,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{length:Ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref($)(Z)},[t.createVNode(t.unref(ee.BSNumberInput),{name:`attr-scale-${Z.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(y)(Z)||t.unref(g)(Z)||!t.unref(A)(Z),"model-value":(at=Z.dbAttrs[0])==null?void 0:at.scale,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{scale:Ne||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,m2)]),t.createVNode(no,{controller:t.unref(o),"ref-id":(zt=Z.dbAttrs[0])==null?void 0:zt.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",f2,[t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:t.unref(a)||t.unref(y)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(h)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nn-${Z.modelId}`,label:"Not Null","model-value":Z.notNull,disabled:t.unref(y)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(d)(Z,{notNull:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-uq-${Z.modelId}`,label:"Unique","model-value":!!((ut=Z.dbAttrs[0])!=null&&ut.unique),disabled:t.unref(y)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(I)(Z,{unique:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-ai-${Z.modelId}`,label:"Auto Increment","model-value":!!((en=Z.dbAttrs[0])!=null&&en.autoIncrement),disabled:t.unref(y)(Z)||t.unref(g)(Z)||!Z.identifier,"onUpdate:modelValue":Ne=>t.unref(I)(Z,{autoIncrement:Ne})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-tr-${Z.modelId}`,label:"@Transient","model-value":!!Z.transient,disabled:Z.identifier||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(f)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-nid-${Z.modelId}`,label:"@NaturalId","model-value":!!Z.naturalId,disabled:Z.identifier||t.unref(y)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(m)(Z,Ne)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Z.modelId}`,label:"mutable","model-value":!!Z.naturalIdMutable,disabled:t.unref(y)(Z)||!Z.naturalId,"onUpdate:modelValue":Ne=>t.unref(d)(Z,{naturalIdMutable:Ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`attr-mv-${Z.modelId}`,label:"Multi-Value (Set)","model-value":!!((tn=Z.dbAttrs[0])!=null&&tn.multiValue),disabled:t.unref(y)(Z)||t.unref(g)(Z),"onUpdate:modelValue":Ne=>t.unref(I)(Z,{multiValue:Ne||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",p2,[De[1]||(De[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(y)(Z),"model-value":t.unref(Q)(Z.dbAttrs[0]),items:t.unref(P),"value-provider":t.unref(c),"label-provider":t.unref(U),"onUpdate:modelValue":Ne=>Ne&&t.unref(_e)(Z,Ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",h2,[De[2]||(De[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(ee.BSSelect),{width:"100%",disabled:t.unref(y)(Z),"model-value":t.unref(le)(Z.dbAttrs[0]),items:t.unref(fe),"value-provider":t.unref(c),"label-provider":t.unref(oe),"onUpdate:modelValue":Ne=>Ne&&t.unref(F)(Z,Ne)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(g)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",y2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":t.unref(S)(Z),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":Ne=>Ne&&t.unref(x)(Z,Ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(w).length&&!t.unref(g)(Z)?(t.openBlock(),t.createElementBlock("label",g2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(vf,{"model-value":Z.groupCode,items:t.unref(w),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":Ne=>t.unref(j)(Z,Ne)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(g)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(w).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(v)(Z).length?(t.openBlock(),t.createBlock(t.unref(ee.BSSelect),{key:0,width:"100%","model-value":Z.defaultValue??"none",items:t.unref(O)(Z),"value-provider":t.unref(M),"label-provider":t.unref(z),"onUpdate:modelValue":Ne=>Ne&&t.unref(ie)(Z,Ne)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(ee.BSTextInput),{key:1,name:`attr-default-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Z.defaultValue??"","onUpdate:modelValue":Ne=>t.unref(pe)(Z,Ne)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",b2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:`attr-desc-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Z.description,"onUpdate:modelValue":Ne=>t.unref(V)(Z,Ne)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",A2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Ve(Z)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:Ne=>B(Z,null)},"∅",10,$2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),Ne=>(t.openBlock(),t.createElementBlock("button",{key:Ne,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Ve(Z)===Ne}]),style:t.normalizeStyle({background:t.unref(Mo)(Ne)}),title:t.unref(o).t(t.unref(to)(Ne)),onClick:et=>B(Z,Ne)},null,14,T2))),128)),H(Z)?(t.openBlock(),t.createElementBlock("span",M2,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,i2)}),128))],8,WM)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-2c47fef2"]]),B2=["disabled"],D2={class:"em-panel__sub-label"},O2={class:"em-attr__row"},L2={class:"em-field em-idx-params"},P2=["value","placeholder","onChange"],z2=Ke(t.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(I=>I.modelId===o.entityId)??null),l=t.computed(()=>r.value?Ko(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var I;return Vn(((I=r.value)==null?void 0:I.attributes)??[])}),c=I=>s.value.canon(I),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>{var I;return[...(((I=r.value)==null?void 0:I.attributes)??[]).filter(A=>A.dbAttrs.length>0).map(A=>({value:A.modelId,label:Sf(A,d.value)})),...l.value.map(A=>({value:A.modelId,label:a.t("em.index.inherited",{field:A.field})}))]});function m(I,A){var S;const $=new Set(I.columns.filter((x,T)=>T!==A).map(x=>c(x.columnRef))),L=u.value.filter(x=>!$.has(c(x.value))),V=(S=I.columns[A])==null?void 0:S.columnRef;return V&&!L.some(x=>x.value===V)&&L.push({value:V,label:h(V)}),L}function h(I){return Rf(I,d.value)}function f(I){const A=new Set(I.columns.map($=>c($.columnRef)));return u.value.filter($=>!A.has(c($.value)))}function y(){var A;if(!r.value)return;const I=u.value[0];a.addIndex(r.value.modelId,{modelId:Me(),name:`idx_${(((A=r.value.indexes)==null?void 0:A.length)??0)+1}`,unique:!1,columns:I?[{columnRef:I.value,descending:!1}]:[]})}function g(I,A){r.value&&a.updateIndex(r.value.modelId,I,A)}function _(I){const A=f(I)[0];A&&g(I.modelId,{columns:[...I.columns,{columnRef:A.value,descending:!1}]})}function E(I,A,$){g(I.modelId,{columns:I.columns.map((L,V)=>V===A?{...L,columnRef:$}:L)})}function N(I,A,$){g(I.modelId,{columns:I.columns.map((L,V)=>V===A?{...L,descending:$}:L)})}function p(I,A){g(I.modelId,{columns:I.columns.filter(($,L)=>L!==A)})}function k(I,A){g(I.modelId,{parameters:A.trim()===""?void 0:A})}return(I,A)=>{var $;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:A[0]||(A[0]=L=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",D2,[e.collapsible?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:(($=r.value.indexes)==null?void 0:$.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(y,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],L=>(t.openBlock(),t.createElementBlock("div",{key:L.modelId,class:"em-attr"},[t.createElementVNode("div",O2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`idx-name-${L.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":L.name,"onUpdate:modelValue":V=>g(L.modelId,{name:V})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-uq-${L.modelId}`,class:"em-check",label:"UQ","model-value":L.unique,"onUpdate:modelValue":V=>g(L.modelId,{unique:V})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:V=>t.unref(a).removeIndex(r.value.modelId,L.modelId)},null,8,["onClick"])]),t.createVNode(no,{controller:t.unref(a),"ref-id":L.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(L.columns,(V,S)=>(t.openBlock(),t.createElementBlock("div",{key:S,class:"em-attr__row"},[t.createVNode(t.unref(ee.BSSelect),{class:"grow","model-value":V.columnRef,items:m(L,S),"value-provider":x=>x.value,"label-provider":x=>x.label,"onUpdate:modelValue":x=>x&&E(L,S,x)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSCheckbox),{name:`idx-${L.modelId}-desc-${S}`,class:"em-check",label:"DESC","model-value":V.descending,"onUpdate:modelValue":x=>N(L,S,x)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:"−",onClick:x=>p(L,S)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(L).length,onClick:V=>_(L)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",L2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:L.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:V=>k(L,V.target.value)},null,40,P2)])]))),128)):t.createCommentVNode("",!0)],8,B2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1d31212a"]]),F2=["disabled"],U2={class:"em-panel__sub-label"},H2={class:"em-attr__row"},j2={class:"em-attr__row"},K2={class:"em-multilang"},G2={class:"em-attr__pii"},Y2={class:"em-swatch__row em-attr__swatch"},q2=["title","onClick"],W2=["title","onClick"],J2=Ke(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=ee.useModal(),l=t.computed(()=>a.state.logical.entities.find(p=>p.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(p=>p.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["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 u(p){return p==="none"?a.t("em.common.noneParen"):p}const m=p=>p;function h(p,k){l.value&&a.updateOperation(l.value.modelId,p.modelId,k)}function f(p,k){h(p,{description:Object.keys(k).length?k:void 0})}function y(p){return p.personalInfoAttributeType??"none"}function g(p,k){h(p,{personalInfoAttributeType:k==="none"?void 0:k})}function _(p){var k,I;return _t((I=(k=s.value)==null?void 0:k.operationStyles)==null?void 0:I[p.modelId])}function E(p,k){l.value&&a.setOperationSwatch(l.value.modelId,p.modelId,k)}function N(p){r.openModal({component:Af,bind:{operationName:p.name,sourceCode:p.sourceCode??"",locale:a.uiLocale.value,onSave:k=>h(p,{sourceCode:k})}})}return(p,k)=>{var I;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:k[1]||(k[1]=A=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",U2,[e.collapsible?(t.openBlock(),t.createBlock(Ae,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.op.section",{n:((I=l.value.operations)==null?void 0:I.length)??0})),1)]),t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:k[0]||(k[0]=t.withModifiers(A=>t.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(l.value.operations??[],A=>(t.openBlock(),t.createElementBlock("div",{key:A.modelId,class:"em-attr"},[t.createElementVNode("div",H2,[t.createVNode(t.unref(ee.BSTextInput),{class:"grow",name:`op-name-${A.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":A.name,"onUpdate:modelValue":$=>h(A,{name:$})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSSelect),{width:"96px","model-value":A.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":$=>$&&h(A,{visibility:$})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(ee.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:$=>t.unref(a).removeOperation(l.value.modelId,A.modelId)},null,8,["onClick"])]),t.createElementVNode("div",j2,[t.createVNode(t.unref(ee.BSButton),{variant:"text",caption:t.unref(a).t(A.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:$=>N(A)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",K2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(mn,{multiline:"",name:`op-desc-${A.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":A.description,"onUpdate:modelValue":$=>f(A,$)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",G2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(ee.BSSelect),{width:"100%","model-value":y(A),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":$=>$&&g(A,$)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",Y2,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":_(A)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:$=>E(A,null)},"∅",10,q2),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),$=>(t.openBlock(),t.createElementBlock("button",{key:$,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":_(A)===$}]),style:t.normalizeStyle({background:t.unref(Mo)($)}),title:t.unref(a).t(t.unref(to)($)),onClick:L=>E(A,$)},null,14,W2))),128))])]))),128)):t.createCommentVNode("",!0)],8,F2)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),X2=["title"],Z2={class:"em-panel__head"},Q2={class:"em-panel__head-row"},eV=["title"],tV={class:"em-panel__context"},nV={key:0,class:"em-panel__lock"},oV=["disabled"],iV={key:0,class:"em-panel__note"},aV={key:1,class:"em-panel__note"},rV={key:2,class:"em-jpa"},lV={class:"em-field"},sV={class:"em-field"},cV={class:"em-field"},dV={key:0,class:"em-field"},uV={class:"em-panel__note"},mV={class:"em-panel__sub"},fV={class:"em-field"},pV={class:"em-field"},hV={class:"em-jpa"},yV={key:0,class:"em-panel__note"},gV={key:1,class:"em-panel__note"},bV={class:"em-jpa"},_V={class:"em-field"},kV={key:0,class:"em-panel__note"},EV={class:"em-field"},NV={class:"em-multilang"},wV={class:"em-field"},IV=["value"],vV={class:"em-field"},CV={class:"em-swatch"},xV={class:"em-swatch__row"},SV=["title"],RV=["title","onClick"],AV={class:"em-panel__note"},$V={class:"em-field"},TV=["value"],MV={class:"em-swatch"},VV={class:"em-swatch__row"},BV=["title"],DV=["title","onClick"],_h=Ke(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var q;return(q=r.value)==null?void 0:q.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const q=c.value;return q?l.state.logical.entities.find(K=>K.modelId===q)??null:null}),u=t.computed(()=>{const q=s.value;if((q==null?void 0:q.kind)==="association")return l.isAssociationLocked(q.id);const K=c.value;return!!K&&l.isEntityLocked(K)}),m=t.computed(()=>{var q;return((q=l.selectedAttr.value)==null?void 0:q.attrId)??null}),h=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),y=t.ref({});t.watch(f,()=>{y.value={}});function g(q){return y.value[q]??f.value}function _(q){y.value={...y.value,[q]:!g(q)}}const E=t.computed(()=>{var J;const q=d.value;if(!q)return l.t("em.entity.fallback");const K=(J=q.table)==null?void 0:J.physicalName;return K?`${q.name} (${K})`:q.name}),N=t.computed(()=>{const q=s.value;return(q==null?void 0:q.kind)==="association"?l.state.logical.associations.find(K=>K.modelId===q.id)??null:null}),p=t.computed(()=>{const q=s.value;return(q==null?void 0:q.kind)==="group"?l.state.logical.groups.find(K=>K.modelId===q.id)??null:null}),k=t.computed(()=>{const q=s.value;return(q==null?void 0:q.kind)==="note"?l.state.layout.notes.find(K=>K.modelId===q.id)??null:null}),I=t.computed(()=>{var K,J;const q=(K=p.value)==null?void 0:K.name;return(q==null?void 0:q[l.userLanguage.value])||(q==null?void 0:q.ko)||(q==null?void 0:q.en)||(q==null?void 0:q.ja)||(q==null?void 0:q.zh)||((J=p.value)==null?void 0:J.packageName)||l.t("em.group.fallback")}),A=t.computed(()=>{if(d.value){const q=h.value.size;if(q>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:q});if(m.value){const K=d.value.attributes.find(J=>J.modelId===m.value);return(K==null?void 0:K.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(K==null?void 0:K.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(N.value){const q=K=>{var J;return((J=l.state.logical.entities.find(ve=>ve.modelId===K))==null?void 0:J.name)??K};return l.t("em.inspector.ctxAssoc",{a:q(N.value.end1.entityRef),b:q(N.value.end2.entityRef)})}return p.value?l.t("em.inspector.ctxGroup",{name:I.value}):k.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),$=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],L=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],V={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},S=q=>{const K=V[q];return K?l.t(K):q},x=q=>{var K;return((K=l.state.logical.entities.find(J=>J.modelId===q))==null?void 0:K.name)??q},T=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],D=["LIST","SET"],b=["inherit","LAZY","EAGER"],w=q=>q;function v(q){return q==="inherit"?l.t("em.common.inherit"):q}const O=t.computed(()=>!!N.value&&N.value.end1.entityRef===N.value.end2.entityRef);function M(q,K){N.value&&l.updateAssociationEnd(N.value.modelId,q,K)}function z(q){return oe.value?q:q==="end1"?"end2":"end1"}function j(q){var Te;const K=(Te=N.value)==null?void 0:Te[q];if(!(K!=null&&K.attributeRef))return;const J=l.state.logical.entities.find(G=>G.modelId===K.entityRef),ve=J==null?void 0:J.attributes.find(G=>G.modelId===K.attributeRef);return ve&&(ve.attrType==="RELATION_OWN"||ve.attrType==="RELATION_REF")?ve.name:void 0}function ie(q,K){var ve;const J=(ve=N.value)==null?void 0:ve[q];J!=null&&J.attributeRef&&l.updateAttribute(J.entityRef,J.attributeRef,{name:K})}function pe(q){var G;const K=j(q);if(K!==void 0)return K;const J=(G=N.value)==null?void 0:G[q];if(J!=null&&J.navFieldNameHint)return J.navFieldNameHint;const ve=q==="end1"?"end2":"end1",Te=l.state.logical.entities.find(te=>{var Y;return te.modelId===((Y=N.value)==null?void 0:Y[ve].entityRef)});return Te?Ki(Te.name,Hi(N.value[ve].multiplicity)):""}function ye(q){return!!oe.value||j(q)!==void 0}function ge(q){N.value&&!O.value&&l.setAssociationIdentifying(N.value.modelId,q)}function me(q){var K,J,ve;return!!((ve=(J=(K=N.value)==null?void 0:K[q].jpa)==null?void 0:J.cascadeTypes)!=null&&ve.includes("ALL"))}function se(q,K,J){var G,te;const ve=(G=N.value)==null?void 0:G[q];if(K==="ALL"&&J){M(q,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:["ALL"]}});return}const Te=new Set(((te=ve==null?void 0:ve.jpa)==null?void 0:te.cascadeTypes)??[]);J?Te.add(K):Te.delete(K),M(q,{jpa:{...ve==null?void 0:ve.jpa,cascadeTypes:[...Te]}})}function ke(q,K){var ve;const J=(ve=N.value)==null?void 0:ve[q];M(q,{jpa:{...J==null?void 0:J.jpa,...K}})}function Se(q){var K,J;return((J=(K=N.value)==null?void 0:K[q].jpa)==null?void 0:J.fetchType)??"inherit"}function ce(q,K){ke(q,{fetchType:K==="inherit"?void 0:K})}function fe(q){var J;const K=(J=N.value)==null?void 0:J[q==="end1"?"end2":"end1"];return(K==null?void 0:K.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(K==null?void 0:K.multiplicity)==="ONE_OR_MORE_INSTANCES"}const oe=t.computed(()=>{const q=N.value;if(!q)return null;for(const K of l.state.logical.entities){const J=K.attributes.find(te=>{var Y;return((Y=te.embedded)==null?void 0:Y.associationRef)===q.modelId&&te.attrType==="EMBED_OWN"});if(!J)continue;const ve=q.end2.entityRef===J.embedded.embeddableRef?"end2":"end1",Te=q[ve].multiplicity,G=q[ve].jpa;return{which:ve,cardinality:Te,isCollection:Te==="ZERO_OR_MORE_INSTANCES"||Te==="ONE_OR_MORE_INSTANCES",collectionType:(G==null?void 0:G.collectionType)??"LIST",collectionTable:(G==null?void 0:G.collectionTable)??"",orderColumn:(G==null?void 0:G.orderColumn)??""}}return null});function le(q){N.value&&l.setEmbedCardinality(N.value.modelId,q)}function ue(q){const K=oe.value;K&&ke(K.which,q==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function F(q){const K=oe.value;K&&ke(K.which,{collectionTable:q.trim()||void 0})}function P(q){const K=oe.value;K&&ke(K.which,{orderColumn:q.trim()||void 0})}function U(q){p.value&&l.updateGroup(p.value.modelId,q)}function Q(q,K){var J;U({name:{...(J=p.value)==null?void 0:J.name,[q]:K}})}const X=t.computed(()=>{var q;return p.value?_t((q=l.state.layout.groupLayouts.find(K=>K.groupRef===p.value.modelId))==null?void 0:q.style):null});function _e(q){p.value&&l.setGroupSwatch(p.value.modelId,q)}function he(q){k.value&&l.setNoteMemo(k.value.modelId,q)}const we=t.computed(()=>{var q;return _t((q=k.value)==null?void 0:q.style)});function Ie(q){k.value&&l.setNoteSwatch(k.value.modelId,q)}return(q,K)=>(t.openBlock(),t.createElementBlock("aside",{class:"em-panel",style:t.normalizeStyle({width:e.width+"px"})},[t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:t.unref(l).t("em.panel.resizeWidth"),onPointerdown:K[0]||(K[0]=(...J)=>e.startResize&&e.startResize(...J))},null,42,X2),t.createElementVNode("header",Z2,[t.createElementVNode("div",Q2,[K[14]||(K[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:K[1]||(K[1]=J=>a("collapse"))},[t.createVNode(Ae,{name:"panel-right-close",size:16})],8,eV)]),t.createElementVNode("p",tV,t.toDisplayString(A.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",nV,[t.createVNode(Ae,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:K[2]||(K[2]=J=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(bf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("basics"),title:E.value,onToggle:K[3]||(K[3]=J=>_("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(V2,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(z2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("index"),onToggle:K[4]||(K[4]=J=>_("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(J2,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:g("ops"),onToggle:K[5]||(K[5]=J=>_("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(ee.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!N.value.identifying,disabled:O.value||!!oe.value,"onUpdate:modelValue":ge},null,8,["label","model-value","disabled"]),O.value?(t.openBlock(),t.createElementBlock("p",iV,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):oe.value?(t.openBlock(),t.createElementBlock("p",aV,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),oe.value?(t.openBlock(),t.createElementBlock("fieldset",rV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",lV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":oe.value.cardinality,items:L,"value-provider":w,"label-provider":S,"onUpdate:modelValue":K[6]||(K[6]=J=>J&&le(J))},null,8,["model-value"])]),oe.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",sV,[K[15]||(K[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(ee.BSSelect),{"model-value":oe.value.collectionType,items:D,"value-provider":w,"label-provider":w,"onUpdate:modelValue":K[7]||(K[7]=J=>J&&ue(J))},null,8,["model-value"])]),t.createElementVNode("label",cV,[K[16]||(K[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":oe.value.collectionTable,"onUpdate:modelValue":F},null,8,["placeholder","model-value"])]),oe.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",dV,[K[17]||(K[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":oe.value.orderColumn,"onUpdate:modelValue":P},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",uV,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],J=>{var ve,Te,G;return t.withDirectives(t.createElementVNode("div",{key:J,class:"em-end"},[t.createElementVNode("h4",mV,t.toDisplayString(J)+" → "+t.toDisplayString(x(N.value[J].entityRef)),1),oe.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",fV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(ee.BSSelect),{"model-value":N.value[J].multiplicity,items:$,"value-provider":w,"label-provider":t.unref(ji),"onUpdate:modelValue":te=>M(J,{multiplicity:te})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(J)}-navigable`,class:"em-check",label:"navigable",title:z(J)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:z(J)==="end2","model-value":z(J)==="end2"?!0:N.value[z(J)].navigable,"onUpdate:modelValue":te=>M(z(J),{navigable:te})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",pV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(ee.BSTextInput),{name:`${z(J)}-navname`,width:"100%",disabled:!ye(z(J)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":pe(z(J)),"onUpdate:modelValue":te=>ie(z(J),te)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(J)}-composition`,class:"em-check",label:"composition","model-value":N.value[z(J)].composition,"onUpdate:modelValue":te=>M(z(J),{composition:te})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",hV,[K[18]||(K[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(T,te=>{var Y,ae;return t.createVNode(t.unref(ee.BSCheckbox),{key:te,name:`${z(J)}-cascade-${te}`,class:"em-check",label:te,"model-value":!!((ae=(Y=N.value[z(J)].jpa)==null?void 0:Y.cascadeTypes)!=null&&ae.includes(te)),disabled:!ye(z(J))||te!=="ALL"&&me(z(J)),"onUpdate:modelValue":Be=>se(z(J),te,Be)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),ye(z(J))?me(z(J))?(t.openBlock(),t.createElementBlock("p",gV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",yV,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",bV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",_V,[K[19]||(K[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(ee.BSSelect),{disabled:!ye(z(J)),"model-value":Se(z(J)),items:b,"value-provider":w,"label-provider":v,"onUpdate:modelValue":te=>te&&ce(z(J),te)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:`${z(J)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((ve=N.value[z(J)].jpa)!=null&&ve.orphanRemoval),disabled:!ye(z(J))||fe(J),"onUpdate:modelValue":te=>ke(z(J),{orphanRemoval:te})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),fe(J)&&((Te=N.value[z(J)].jpa)!=null&&Te.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",kV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",EV,[K[20]||(K[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(ee.BSTextInput),{name:`${z(J)}-orderby`,width:"100%",disabled:!ye(z(J)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((G=N.value[z(J)].jpa)==null?void 0:G.orderBy)??"","onUpdate:modelValue":te=>ke(z(J),{orderBy:te.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!oe.value||J===oe.value.which]])}),64))],64)):t.createCommentVNode("",!0),p.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",NV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,J=>{var ve;return t.openBlock(),t.createElementBlock("label",{key:J,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(J),1),t.createVNode(t.unref(ee.BSTextInput),{name:`grp-name-${J}`,width:"100%","model-value":((ve=p.value.name)==null?void 0:ve[J])??"","onUpdate:modelValue":Te=>Q(J,Te)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",wV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:p.value.description??"",rows:"3",onChange:K[8]||(K[8]=J=>U({description:J.target.value}))},null,40,IV)]),t.createElementVNode("label",vV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(ee.BSTextInput),{name:"grp-package",width:"100%","model-value":p.value.packageName??"","onUpdate:modelValue":K[9]||(K[9]=J=>U({packageName:J}))},null,8,["model-value"])]),t.createVNode(t.unref(ee.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":p.value.excludeDDLGeneration,"onUpdate:modelValue":K[10]||(K[10]=J=>U({excludeDDLGeneration:J}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",CV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",xV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":X.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:K[11]||(K[11]=J=>_e(null))},"∅",10,SV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),J=>(t.openBlock(),t.createElementBlock("button",{key:J,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":X.value===J}]),style:t.normalizeStyle({background:t.unref(Mo)(J)}),title:t.unref(l).t(t.unref(to)(J)),onClick:ve=>_e(J)},null,14,RV))),128))])]),t.createElementVNode("p",AV,t.toDisplayString(t.unref(l).t("em.group.members",{n:p.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),k.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",$V,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:k.value.memo,rows:"6",onChange:K[12]||(K[12]=J=>he(J.target.value))},null,40,TV)]),t.createElementVNode("fieldset",MV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",VV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":we.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:K[13]||(K[13]=J=>Ie(null))},"∅",10,BV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(eo),J=>(t.openBlock(),t.createElementBlock("button",{key:J,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":we.value===J}]),style:t.normalizeStyle({background:t.unref(Mo)(J)}),title:t.unref(l).t(t.unref(to)(J)),onClick:ve=>Ie(J)},null,14,DV))),128))])])],64)):t.createCommentVNode("",!0)],8,oV)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),OV=["title"],LV={class:"em-validation__title"},PV=["title","onClick"],zV={key:0,class:"em-validation__body"},FV={class:"em-validation__opt"},UV={key:0,class:"em-validation__empty"},HV={key:1,class:"em-validation__empty"},jV={key:2,class:"em-validation__list"},KV=["onClick"],GV={class:"em-validation__item-msg"},YV={key:0,class:"em-validation__item-entity"},qV=["title","onClick"],WV=["title"],JV=Ke(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const g=new Map;for(const _ of o.state.logical.entities)g.set(_.modelId,_.name);return g});function r(g){const _=Mw(g);if(!_)return null;const E=a.value.get(_);return E===void 0?null:E.trim()===""?o.t("em.validation.nameless"):E}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const g={error:0,warning:0,info:0};for(const _ of i.value)g[_.severity]++;return g}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(g=>c.value[g.severity]).slice().sort((g,_)=>l[g.severity].order-l[_.severity].order)),u=t.computed(()=>d.value.map(g=>({issue:g,entityName:r(g),message:gf(o.t,g),category:$w(o.t,g.ruleId)}))),m=t.ref(!1);function h(g){c.value[g]=!c.value[g]}function f(g){if(!m.value){m.value=!0;return}h(g)}function y(g){g.targetRef&&o.requestFocus(g.targetRef)}return(g,_)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:_[1]||(_[1]=E=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode(Ae,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",LV,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,OV),t.createElementVNode("div",{class:"em-validation__counts",onClick:_[0]||(_[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],E=>t.createElementVNode("button",{key:E,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${E}`,{"is-off":!c.value[E]}]]),title:m.value?t.unref(o).t(c.value[E]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[E].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:N=>f(E)},[t.createVNode(Ae,{name:l[E].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[E]),1)],10,PV)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",zV,[t.createElementVNode("label",FV,[t.createVNode(t.unref(ee.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":_[2]||(_[2]=E=>t.unref(o).flagEntitiesWithoutRelations.value=E)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",UV,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",HV,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",jV,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:E,entityName:N,message:p,category:k},I)=>(t.openBlock(),t.createElementBlock("li",{key:`${E.ruleId}:${E.targetRef??"model"}:${I}`,class:t.normalizeClass(["em-validation__item",[`is-${E.severity}`,{"is-clickable":!!E.targetRef}]]),onClick:A=>y(E)},[t.createVNode(Ae,{name:l[E.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",GV,[N?(t.openBlock(),t.createElementBlock("span",YV,t.toDisplayString(N),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(p),1)]),t.unref(o).hasQuickFix(E)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:t.unref(o).t("em.validation.quickFixTip"),onClick:t.withModifiers(A=>t.unref(o).applyQuickFix(E),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,qV)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:E.ruleId},t.toDisplayString(k),9,WV)],10,KV))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),XV={class:"em-history"},ZV={class:"em-history__head"},QV={class:"em-history__title"},eB={class:"em-history__head-actions"},tB=["title","disabled"],nB=["title"],oB={class:"em-history__filters"},iB={class:"em-history__filter"},aB={class:"em-history__filters em-history__filters--period"},rB={class:"em-history__filter-label"},lB=["title","aria-label","max"],sB=["title","aria-label","min"],cB=["title"],dB={key:0,class:"em-history__diffbar"},uB={class:"em-history__diffbar-range"},mB={class:"em-history__diffbar-count"},fB={class:"em-history__body"},pB={key:0,class:"em-history__empty"},hB={key:1,class:"em-history__diff-list"},yB=["onClick"],gB={class:"em-history__action-head"},bB={class:"em-history__action-name"},_B={key:0,class:"em-history__fields"},kB={class:"em-history__fname"},EB={key:0,class:"em-history__old"},NB={class:"em-history__val"},wB={key:1,class:"em-history__empty"},IB={key:2,class:"em-history__empty is-error"},vB={key:3,class:"em-history__empty"},CB={key:4,class:"em-history__list"},xB=["onClick"],SB={class:"em-history__summary"},RB={class:"em-history__seq"},AB={class:"em-history__gmeta"},$B={class:"em-history__who"},TB={key:0,class:"em-history__time"},MB={key:1,class:"em-history__restored-from"},VB=["onClick"],BB={key:0,class:"em-history__detail"},DB={class:"em-history__action-head"},OB={class:"em-history__action-name"},LB={key:0,class:"em-history__fields"},PB={class:"em-history__fname"},zB={key:0,class:"em-history__old"},FB={class:"em-history__val"},UB={class:"em-history__preview"},HB=["disabled"],jB={key:0,class:"em-history__diff-list is-preview"},KB={class:"em-history__action-head"},GB={class:"em-history__action-name"},YB={key:0,class:"em-history__fields"},qB={class:"em-history__fname"},WB={key:0,class:"em-history__old"},JB={class:"em-history__val"},XB={class:"em-history__confirm-row"},ZB={class:"em-history__confirm-msg"},QB=["disabled","onClick"],eD=["disabled"],tD=["onClick"],kr=50,nD=Ke(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1),d=t.computed(()=>r.value.reduce((Y,ae)=>ae.seq>Y?ae.seq:Y,-1/0));async function u(Y){if(a.historyTransport){l.value=!0,s.value=null;try{const ae=!(Y!=null&&Y.full)&&r.value.length>0&&Number.isFinite(d.value),Be=await a.historyTransport(ae?d.value:void 0);if(!ae)r.value=Be;else if(Be.length){const Ve=new Set(r.value.map(B=>B.seq)),H=Be.filter(B=>!Ve.has(B.seq));H.length&&(r.value=[...r.value,...H])}c.value=!0}catch(ae){s.value=ae instanceof Error?ae.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const h=t.ref(null),f=t.ref(null);t.watch(()=>o.open,Y=>{Y?m():(h.value=null,f.value=null)},{immediate:!0});let y=null;t.watch(()=>a.revision.value,()=>{o.open&&(y&&clearTimeout(y),y=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const g=t.computed(()=>new Map(a.state.logical.entities.map(Y=>[Y.modelId,Y]))),_=t.computed(()=>new Map(a.state.logical.associations.map(Y=>[Y.modelId,Y]))),E=t.computed(()=>{const Y=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(ae=>{var Be,Ve;return[ae.modelId,ae.packageName||((Be=ae.name)==null?void 0:Be[Y])||((Ve=ae.name)==null?void 0:Ve.ko)||ae.modelId]}))});function N(Y){var H,B,Pe,Ze,Ue,Le,De;const ae=_.value.get(Y);if(!ae)return a.t("em.history.assocFallback");if((H=ae.description)!=null&&H.trim())return ae.description.trim();const Be=(Ze=(Pe=g.value.get((B=ae.end1)==null?void 0:B.entityRef))==null?void 0:Pe.name)==null?void 0:Ze.trim(),Ve=(De=(Le=g.value.get((Ue=ae.end2)==null?void 0:Ue.entityRef))==null?void 0:Le.name)==null?void 0:De.trim();return Be&&Ve?`${Be}→${Ve}`:a.t("em.history.assocFallback")}function p(Y){var ae,Be,Ve,H;if(Y.kind==="entity")return((Be=(ae=g.value.get(Y.ref))==null?void 0:ae.name)==null?void 0:Be.trim())||a.t("em.attr.nameless");if(Y.kind==="attribute"||Y.kind==="operation"||Y.kind==="index"){const B=Y.entityRef?g.value.get(Y.entityRef):void 0,Ze=((Y.kind==="attribute"?B==null?void 0:B.attributes:Y.kind==="operation"?B==null?void 0:B.operations:B==null?void 0:B.indexes)??[]).find(Le=>Le.modelId===Y.ref),Ue=(Ve=B==null?void 0:B.name)==null?void 0:Ve.trim();return`${Ue?Ue+".":""}${((H=Ze==null?void 0:Ze.name)==null?void 0:H.trim())||Y.ref}`}return Y.kind==="association"?N(Y.ref):Y.kind==="associationEnd"?`${N(Y.ref)}(${Y.end})`:Y.kind==="group"?a.t("em.history.groupSubject",{name:E.value.get(Y.ref)??Y.ref}):Y.ref}const k={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},I={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},A=t.ref("all"),$=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],L=t.computed({get:()=>A.value,set:Y=>{Y&&(A.value=Y)}}),V=t.computed(()=>tl(r.value)),S=t.computed(()=>V.value.length?V.value[0].seq:null),x=t.computed(()=>A.value==="all"?V.value:V.value.filter(Y=>(Y.kind??"edit")===A.value)),T=t.ref(kr),D=t.ref(""),b=t.ref(""),w=t.computed(()=>!!D.value||!!b.value);function v(){D.value="",b.value=""}const O=t.computed(()=>{const Y=D.value?new Date(`${D.value}T00:00:00`).getTime():null,ae=b.value?new Date(`${b.value}T23:59:59.999`).getTime():null;return Y==null&&ae==null?x.value:x.value.filter(Be=>{if(Be.ts==null)return!1;const Ve=new Date(Be.ts).getTime();return!(isNaN(Ve)||Y!=null&&Ve<Y||ae!=null&&Ve>ae)})}),M=t.computed(()=>O.value.slice(0,T.value)),z=t.computed(()=>Math.max(0,O.value.length-T.value));function j(){T.value+=kr}t.watch([A,D,b],()=>{T.value=kr}),t.watch(()=>o.open,Y=>{Y&&(T.value=kr,v())});function ie(Y){return Y===void 0?"—":Y===null?a.t("em.history.emptyValue"):typeof Y=="object"?JSON.stringify(Y):String(Y)}function pe(Y){const ae=p(Y.subject);if(Y.verb==="add")return a.t("em.history.summaryAdd",{name:ae});if(Y.verb==="remove")return a.t("em.history.summaryRemove",{name:ae});if(Y.fields.length===1){const Be=Y.fields[0];return`${ae}.${Be.field} ${Be.oldValue!==void 0?ie(Be.oldValue)+"→":""}${ie(Be.value)}`}return a.t("em.history.summaryFields",{name:ae,n:Y.fields.length})}function ye(Y){return Y.actions.length===0?a.t("em.history.noChange"):Y.actions.length===1?pe(Y.actions[0]):a.t("em.history.summaryMore",{summary:pe(Y.actions[0]),n:Y.actions.length-1})}const ge=t.ref(new Set);function me(Y){const ae=new Set(ge.value);ae.has(Y)?ae.delete(Y):ae.add(Y),ge.value=ae}function se(Y){if(Y==null)return"";const ae=new Date(Y);return isNaN(ae.getTime())?String(Y):ae.toLocaleString()}function ke(Y){const ae=Y.author,Be=Y.origin;return ae&&Be?`${ae}(${Be})`:ae||(Be?`(${Be})`:"—")}const Se=t.computed(()=>h.value==null?null:nl(r.value,{fromSeq:h.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Se.value?qc(Se.value):null,Y=>i("diffChange",Y));function ce(Y){h.value=Y,f.value=null,K.value=null}function fe(){h.value=null,f.value=null}const oe=t.computed(()=>V.value.map(Y=>Y.seq)),le=t.computed(()=>S.value??1/0),ue=t.computed(()=>f.value??le.value),F=t.computed(()=>f.value??le.value),P=t.computed(()=>oe.value.filter(Y=>Y<ue.value).map(Y=>({v:Y}))),U=t.computed(()=>oe.value.filter(Y=>h.value!=null&&Y>h.value).map(Y=>({v:Y})));function Q(Y){Y!=null&&(h.value=Y,f.value!=null&&f.value<=Y&&(f.value=null))}function X(Y){Y!=null&&(f.value=Y>=le.value?null:Y)}function _e(Y){return Y>=le.value?a.t("em.history.diff.current"):`#${Y}`}function he(Y){return Y.kind==="entity"?g.value.has(Y.ref)?Y.ref:null:(Y.kind==="attribute"||Y.kind==="operation"||Y.kind==="index")&&Y.entityRef?g.value.has(Y.entityRef)?Y.entityRef:null:Y.kind==="group"&&E.value.has(Y.ref)?Y.ref:null}function we(Y){const ae=he(Y);ae&&a.requestFocus(ae)}const Ie={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},q={added:"add",modified:"update",removed:"remove"},K=t.ref(null),J=t.ref(!1),ve=t.computed(()=>K.value==null?null:nl(r.value,{fromSeq:K.value})),Te=t.ref(!1);function G(Y){K.value=Y,Te.value=!1}async function te(Y){J.value=!0;try{const ae=await a.restoreToSeq(Y);ae.ok?(h.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:ae.reason??a.t("em.history.unknown")})}finally{J.value=!1,K.value=null}}return(Y,ae)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var Be,Ve;return[t.withDirectives(t.createElementVNode("section",XV,[t.createElementVNode("header",ZV,[t.createElementVNode("div",QV,[t.createVNode(Ae,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",eB,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:ae[0]||(ae[0]=H=>u({full:!0}))},[t.createVNode(Ae,{name:"redo",size:15})],8,tB),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:ae[1]||(ae[1]=H=>i("close"))},[t.createVNode(Ae,{name:"panel-close",size:15})],8,nB)])]),t.createElementVNode("div",oB,[t.createElementVNode("label",iB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(ee.BSSelect),{modelValue:L.value,"onUpdate:modelValue":ae[2]||(ae[2]=H=>L.value=H),items:$,"value-provider":H=>H.v,"label-provider":H=>t.unref(a).t(H.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",aB,[t.createElementVNode("span",rB,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:b.value||void 0,"onUpdate:modelValue":ae[3]||(ae[3]=H=>D.value=H)},null,8,lB),[[t.vModelText,D.value]]),ae[9]||(ae[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:D.value||void 0,"onUpdate:modelValue":ae[4]||(ae[4]=H=>b.value=H)},null,8,sB),[[t.vModelText,b.value]]),w.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:v},[t.createVNode(Ae,{name:"x",size:12})],8,cB)):t.createCommentVNode("",!0)]),h.value!=null?(t.openBlock(),t.createElementBlock("div",dB,[t.createElementVNode("div",uB,[t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":h.value??void 0,items:P.value,"value-provider":H=>H.v,"label-provider":H=>`#${H.v}`,"onUpdate:modelValue":ae[5]||(ae[5]=H=>Q(H??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(Ae,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(ee.BSSelect),{class:"em-history__range-sel","model-value":F.value,items:U.value,"value-provider":H=>H.v,"label-provider":H=>_e(H.v),"onUpdate:modelValue":ae[6]||(ae[6]=H=>X(H??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",mB,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((Be=Se.value)==null?void 0:Be.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:fe},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",fB,[h.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(Ve=Se.value)!=null&&Ve.entries.length?(t.openBlock(),t.createElementBlock("ul",hB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value.entries,(H,B)=>(t.openBlock(),t.createElementBlock("li",{key:B,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!he(H.subject)}]),onClick:Pe=>we(H.subject)},[t.createElementVNode("div",gB,[t.createVNode(Ae,{name:k[H.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",bB,t.toDisplayString(p(H.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${q[H.verb]}`])},t.toDisplayString(t.unref(a).t(Ie[H.verb])),3)]),H.fields.length?(t.openBlock(),t.createElementBlock("ul",_B,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.fields,(Pe,Ze)=>(t.openBlock(),t.createElementBlock("li",{key:Ze,class:"em-history__field"},[t.createElementVNode("span",kB,t.toDisplayString(Pe.field),1),Pe.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",EB,t.toDisplayString(ie(Pe.oldValue)),1)):t.createCommentVNode("",!0),Pe.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",NB,t.toDisplayString(ie(Pe.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,yB))),128))])):(t.openBlock(),t.createElementBlock("p",pB,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",wB,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",IB,t.toDisplayString(s.value),1)):O.value.length===0?(t.openBlock(),t.createElementBlock("p",vB,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",CB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(M.value,H=>{var B,Pe,Ze;return t.openBlock(),t.createElementBlock("li",{key:H.seq,class:t.normalizeClass(["em-history__group",[`is-${H.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:Ue=>me(H.seq)},[t.createVNode(Ae,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":ge.value.has(H.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${H.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(H.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",SB,t.toDisplayString(ye(H)),1),t.createElementVNode("span",RB,"#"+t.toDisplayString(H.seq),1)],8,xB),t.createElementVNode("div",AB,[t.createElementVNode("span",$B,t.toDisplayString(ke(H)),1),H.ts?(t.openBlock(),t.createElementBlock("span",TB,t.toDisplayString(se(H.ts)),1)):t.createCommentVNode("",!0),H.kind==="restore"&&H.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",MB,"← #"+t.toDisplayString(H.restoredFromSeq),1)):t.createCommentVNode("",!0),H.seq!==S.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(Ue=>ce(H.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,VB)):t.createCommentVNode("",!0)]),ge.value.has(H.seq)?(t.openBlock(),t.createElementBlock("div",BB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(H.actions,(Ue,Le)=>(t.openBlock(),t.createElementBlock("div",{key:Le,class:"em-history__action"},[t.createElementVNode("div",DB,[t.createVNode(Ae,{name:k[Ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",OB,t.toDisplayString(p(Ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Ue.verb}`])},t.toDisplayString(t.unref(a).t(I[Ue.verb])),3)]),Ue.fields.length?(t.openBlock(),t.createElementBlock("ul",LB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ue.fields,(De,Z)=>(t.openBlock(),t.createElementBlock("li",{key:Z,class:"em-history__field"},[t.createElementVNode("span",PB,t.toDisplayString(De.field),1),De.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",zB,t.toDisplayString(ie(De.oldValue)),1)):t.createCommentVNode("",!0),De.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",FB,t.toDisplayString(ie(De.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&H.seq!==S.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":K.value===H.seq}])},[K.value===H.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",UB,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((B=ve.value)!=null&&B.entries.length),onClick:ae[7]||(ae[7]=Ue=>Te.value=!Te.value)},[t.createVNode(Ae,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Te.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Pe=ve.value)!=null&&Pe.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:ve.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,HB),Te.value&&((Ze=ve.value)!=null&&Ze.entries.length)?(t.openBlock(),t.createElementBlock("ul",jB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(ve.value.entries,(Ue,Le)=>(t.openBlock(),t.createElementBlock("li",{key:Le,class:"em-history__diff-entry"},[t.createElementVNode("div",KB,[t.createVNode(Ae,{name:k[Ue.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",GB,t.toDisplayString(p(Ue.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${q[Ue.verb]}`])},t.toDisplayString(t.unref(a).t(Ie[Ue.verb])),3)]),Ue.fields.length?(t.openBlock(),t.createElementBlock("ul",YB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ue.fields,(De,Z)=>(t.openBlock(),t.createElementBlock("li",{key:Z,class:"em-history__field"},[t.createElementVNode("span",qB,t.toDisplayString(De.field),1),De.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",WB,t.toDisplayString(ie(De.oldValue)),1)):t.createCommentVNode("",!0),De.oldValue!==void 0?(t.openBlock(),t.createBlock(Ae,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",JB,t.toDisplayString(ie(De.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",XB,[t.createElementVNode("span",ZB,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:J.value,onClick:Ue=>te(H.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,QB),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:J.value,onClick:ae[8]||(ae[8]=Ue=>K.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,eD)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:Ue=>G(H.seq)},[t.createVNode(Ae,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,tD))],2)):t.createCommentVNode("",!0)],2)}),128))])),h.value==null&&z.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:j},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:z.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function oD(e,n){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=n?i:null}function kh(e){const n=t.ref(oD(e.storageKey,e.min)??e.initial),o=t.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=n.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?r-d.clientX:d.clientX-r;let m=l+u;m=Math.max(e.min,m),e.max!=null&&(m=Math.min(e.max,m)),n.value=m},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(n.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:n,dragging:o,startResize:i}}const iD={class:"em-modeler"},aD={class:"em-modeler__body"},rD={class:"em-drawer__inner"},lD={class:"em-drawer__head"},sD={class:"em-drawer__actions"},cD=["title"],dD=["title"],uD=["title"],mD=["title"],fD=["title"],pD=Ke(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(k){t.nextTick(()=>{const I=k();I&&("focusCollapse"in I?I.focusCollapse():I.focus())})}function c(k){n.value=k,s(()=>k?i.value:a.value)}function d(k){o.value=k,s(()=>k?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:h,dragging:f,startResize:y}=kh({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:g,dragging:_,startResize:E}=kh({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),N=t.ref(null),p=t.ref(null);return(k,I)=>{var A,$,L;return t.openBlock(),t.createElementBlock("div",iD,[t.createVNode(bh,{controller:e.controller,"history-open":u.value,onExportSvg:I[0]||(I[0]=V=>{var S;return(S=N.value)==null?void 0:S.exportSvg()}),onExportPng:I[1]||(I[1]=V=>{var S;return(S=N.value)==null?void 0:S.exportPng()}),onToggleHistory:I[2]||(I[2]=V=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",aD,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(h)+"px"})},[t.createElementVNode("div",rD,[t.createElementVNode("header",lD,[I[11]||(I[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",sD,[(A=p.value)!=null&&A.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t(($=p.value)!=null&&$.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:I[3]||(I[3]=V=>{var S;return(S=p.value)==null?void 0:S.toggleAll()})},[t.createVNode(Ae,{name:(L=p.value)!=null&&L.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,cD)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:I[4]||(I[4]=V=>c(!1))},[t.createVNode(Ae,{name:"panel-close",size:16})],8,dD)])]),t.createVNode(gh,{ref_key:"explorer",ref:p,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:I[5]||(I[5]=(...V)=>t.unref(y)&&t.unref(y)(...V))},null,42,uD),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:I[6]||(I[6]=V=>c(!0))},[t.createVNode(Ae,{name:"panel-open",size:18})],8,mD),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(h)-6+"px"})},[t.createVNode(yh,{ref_key:"canvas",ref:N,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(_h,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(g),resizing:t.unref(_),"start-resize":t.unref(E),onCollapse:I[7]||(I[7]=V=>d(!1))},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:I[8]||(I[8]=V=>d(!0))},[t.createVNode(Ae,{name:"panel-right-open",size:18})],8,fD),[[t.vShow,!o.value]])]),_:1}),t.createVNode(nD,{controller:e.controller,open:u.value,onClose:I[9]||(I[9]=V=>u.value=!1),onDiffChange:I[10]||(I[10]=V=>m.value=V)},null,8,["controller","open"])]),t.createVNode(JV,{controller:e.controller,"panel-width":t.unref(g),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);be.APPLY_MODEL_OPS_INPUT_SCHEMA=zb,be.AssociationEdge=hp,be.CUSTOM_TYPE_VALUE=an,be.CommandStack=ol,be.DEFAULT_JAVA_TYPE=$r,be.DIAGRAM_JSON_FORMAT=Dr,be.DIAGRAM_JSON_VERSION=Or,be.DiagramCanvas=yh,be.DiagramExplorer=gh,be.EDITOR=oo,be.EditModeToggle=qM,be.EditorToolbar=bh,be.EntityModeler=pD,be.EntityNode=Gf,be.GROUP_CODE_ENUM_VALUE=On,be.GroupNode=Yf,be.INHERITED_REF_PREFIX=Oi,be.InvalidDiagramJsonError=Pn,be.JAVA_TYPES=Wo,be.NoteNode=qf,be.OpSyncAdapter=Pd,be.PHYSICAL_NAME_MAX_LENGTH=Xo,be.PropertyPanel=_h,be.RevCache=Ld,be.SELECTABLE_JAVA_TYPES=nc,be.SYMBOLIC_OP_KINDS=zd,be.SYMBOLIC_OP_SCHEMA=au,be.UI_LOCALES=lI,be.applyDocumentReferenceOnly=vr,be.buildAgentBatch=Fb,be.buildDiagramSvg=Ss,be.buildDiffMarks=qc,be.collectSharedColumns=Nn,be.commands=Yg,be.computeAutoLayout=Ts,be.createEditorController=OC,be.dedupeModelIds=Eg,be.defaultMermaidDialect=Uh,be.defaultSqlDialect=ky,be.diagramToJson=mc,be.displayLabel=zi,be.emptyState=Vf,be.entityModelToDdl=dc,be.entityModelToMermaid=Cr,be.entityModelToText=Ks,be.exportDiagramPng=ph,be.exportDiagramSvg=fh,be.fromPersisted=hu,be.isGeneratable=xc,be.isInheritedColumnRef=Bn,be.javaTypeLabel=fo,be.makeInheritedColumnRef=Bs,be.mergeDiagram=Uc,be.mermaidErToImportSource=ac,be.migrateLegacyMoney=kg,be.multiplicityLabel=ji,be.newId=Me,be.packEntityBoxes=Er,be.parseDiagramJson=fc,be.parseInheritedColumnRef=Nr,be.parseMermaidEr=ic,be.parseSqlDdl=Vr,be.planHealBackfillOps=E_,be.projectActionLog=tl,be.projectEntityAudit=Gc,be.projectFieldAudit=wn,be.projectInheritedColumns=Ko,be.projectSeqDiff=nl,be.renderDiagramSvg=hc,be.resolveColumnPhysicalName=Yo,be.resolveDiagram=$s,be.resolveEffectiveColumn=on,be.resolveQuickFix=Hr,be.resolveSharedColumn=Dn,be.resolveSymbolicOps=Eb,be.restoreDeepEqual=zn,be.scaffoldEntityJava=Yy,be.sharedColumnScopeEntities=wr,be.sqlDdlToImportSource=cc,be.stereotypeLabel=Go,be.synthesizeRestoreOps=Mg,be.toPersisted=b_,be.toPersistedV2=__,be.translate=Dt,be.uiMessagesEn=Ef,be.uiMessagesJa=Nf,be.uiMessagesKo=wf,be.validateModel=Zi,Object.defineProperty(be,Symbol.toStringTag,{value:"Module"})}));
|
|
64
|
+
v${-(S.value.height-2*e.maskBorderRadius)}
|
|
65
|
+
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);t.watchEffect(A=>{if(_.value){const L=zn(_.value),H=be=>{if(be.sourceEvent.type!=="wheel"||!p.value||!f.value)return;const pe=be.sourceEvent.ctrlKey&&$i()?10:1,he=-be.sourceEvent.deltaY*(be.sourceEvent.deltaMode===1?.05:be.sourceEvent.deltaMode?1:.002)*e.zoomStep,_e=c.value.zoom*2**(he*pe);f.value.scaleTo(p.value,_e)},oe=be=>{if(be.sourceEvent.type!=="mousemove"||!p.value||!f.value)return;const pe=$.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),he={x:c.value.x-be.sourceEvent.movementX*pe,y:c.value.y-be.sourceEvent.movementY*pe},_e=[[0,0],[u.value.width,u.value.height]],ye=zs.translate(he.x,he.y).scale(c.value.zoom),Ae=f.value.constrain()(ye,_e,d.value);f.value.transform(p.value,Ae)},ue=bT().wheelDelta(be=>ns(be)*(e.zoomStep/10)).on("zoom",e.pannable?oe:()=>{}).on("zoom.wheel",e.zoomable?H:()=>{});L.call(ue),A(()=>{L.on("zoom",null)})}},{flush:"post"});function T(A){const[L,H]=Fn(A);n("click",{event:A,position:{x:L,y:H}})}function M(A,L){const H={event:A,node:L,connectedEdges:lo([L],s.value)};m.miniMapNodeClick(H),n("nodeClick",H)}function k(A,L){const H={event:A,node:L,connectedEdges:lo([L],s.value)};m.miniMapNodeDoubleClick(H),n("nodeDblclick",H)}function v(A,L){const H={event:A,node:L,connectedEdges:lo([L],s.value)};m.miniMapNodeMouseEnter(H),n("nodeMouseenter",H)}function I(A,L){const H={event:A,node:L,connectedEdges:lo([L],s.value)};m.miniMapNodeMouseMove(H),n("nodeMousemove",H)}function O(A,L){const H={event:A,node:L,connectedEdges:lo([L],s.value)};m.miniMapNodeMouseLeave(H),n("nodeMouseleave",H)}return(A,L)=>(t.openBlock(),t.createBlock(t.unref(xf),{position:A.position,class:t.normalizeClass(["vue-flow__minimap",{pannable:A.pannable,zoomable:A.zoomable}])},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{ref_key:"el",ref:_,width:g.value,height:b.value,viewBox:[R.value.x,R.value.y,R.value.width,R.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${t.unref(l)}`,onClick:T},[A.ariaLabel?(t.openBlock(),t.createElementBlock("title",{key:0,id:`vue-flow__minimap-${t.unref(l)}`},t.toDisplayString(A.ariaLabel),9,wT)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(y),H=>(t.openBlock(),t.createBlock(ET,{id:H.id,key:H.id,f:"",position:H.computedPosition,dimensions:H.dimensions,selected:H.selected,dragging:H.dragging,style:t.normalizeStyle(H.style),class:t.normalizeClass(w.value(H)),color:h.value(H),"border-radius":A.nodeBorderRadius,"stroke-color":N.value(H),"stroke-width":A.nodeStrokeWidth,"shape-rendering":t.unref(E),type:H.type,hidden:H.hidden,onClick:oe=>M(oe,H),onDblclick:oe=>k(oe,H),onMouseenter:oe=>v(oe,H),onMousemove:oe=>I(oe,H),onMouseleave:oe=>O(oe,H)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),t.createElementVNode("path",{class:"vue-flow__minimap-mask",d:x.value,fill:A.maskColor,stroke:A.maskStrokeColor,"stroke-width":A.maskStrokeWidth,"fill-rule":"evenodd"},null,8,IT)],8,NT))]),_:1},8,["position","class"]))}}),ST=["d"],xT=["cx","cy","onDblclick"],RT=["x","y","onPointerdown","onDblclick"],AT=tt(t.defineComponent({inheritAttrs:!1,__name:"NoteConnectionEdge",props:{id:{},sourceNode:{},targetNode:{},data:{}},setup(e){const n=e,{screenToFlowCoordinate:o}=et(),i=t.inject(Es),a=t.inject(po,null),r=t.computed(()=>!!a&&a.editable.value),l=t.inject(Go,null),s=t.computed(()=>!!l&&l.active.value&&(!l.relatedEntityIds.value.has(n.data.targetRef)||!l.relatedNoteIds.value.has(n.data.noteRef))),c=t.computed(()=>(i==null?void 0:i.points(n.id))??[]),d=t.ref(-1),u=t.ref({x:0,y:0}),m=t.computed(()=>c.value.map((V,$)=>$===d.value?u.value:V)),{source:p,target:f,sourceSide:y,targetSide:_}=Ap({sourceNode:()=>n.sourceNode,targetNode:()=>n.targetNode,waypoints:()=>m.value}),g=t.computed(()=>(a==null?void 0:a.routingMode.value)==="orthogonal"?mp(p.value,y.value,m.value,f.value,_.value):pp(p.value,m.value,f.value)),b=t.computed(()=>r.value?(a==null?void 0:a.routingMode.value)==="orthogonal"?fp(p.value,y.value,m.value,f.value,_.value):gp(p.value,m.value,f.value).map((V,$)=>({point:V,segIndex:$})):[]),E=t.computed(()=>r.value?m.value:[]);function h(V,$){d.value=V,u.value={...c.value[V]},$.target.setPointerCapture($.pointerId),$.stopPropagation()}function N(V){if(d.value<0)return;const $=o({x:V.clientX,y:V.clientY});u.value={x:$.x,y:$.y}}function w(V){var $,R;d.value>=0&&i&&i.movePoint(n.id,d.value,{...u.value}),d.value=-1,(R=($=V.target).releasePointerCapture)==null||R.call($,V.pointerId)}function C(V,$){$.stopPropagation(),i==null||i.removePoint(n.id,V)}function S(V,$){if(!i)return;const R=o({x:$.clientX,y:$.clientY});i.insertPoint(n.id,V,{x:R.x,y:R.y})}return(V,$)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("path",{d:g.value,fill:"none","stroke-width":"1.5","stroke-dasharray":"6 4",class:t.normalizeClass(["em-note-edge__path",{"is-dimmed":s.value}])},null,10,ST),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,(R,x)=>(t.openBlock(),t.createElementBlock("circle",{key:`mid-${x}`,cx:R.point.x,cy:R.point.y,r:"4",class:t.normalizeClass(["em-note-edge__mid",{"is-dimmed":s.value}]),onDblclick:t.withModifiers(T=>S(R.segIndex,T),["stop"])},null,42,xT))),128)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,(R,x)=>(t.openBlock(),t.createElementBlock("rect",{key:`wp-${x}`,x:R.x-5,y:R.y-5,width:"10",height:"10",rx:"2",class:t.normalizeClass(["em-note-edge__waypoint",{"is-dimmed":s.value}]),onPointerdown:T=>h(x,T),onPointermove:N,onPointerup:w,onDblclick:T=>C(x,T)},null,42,RT))),128))],64))}}),[["__scopeId","data-v-8515def1"]]),$T=["data-theme"],TT={key:0,class:"em-ctx__sep",role:"separator"},MT=["aria-label"],VT={class:"em-ctx__swatches-label","aria-hidden":"true"},BT={class:"em-ctx__chips",role:"none"},DT=["aria-checked","aria-label","title","onClick"],OT=["aria-checked","aria-label","title","onClick"],LT=["disabled","onClick"],PT={class:"em-ctx__icon"},zT={class:"em-ctx__caption"},FT=tt(t.defineComponent({__name:"EmContextMenu",props:{locale:{}},setup(e,{expose:n}){const o=e,i=(h,N)=>qt(o.locale??"ko",h,N),a=t.ref(!1),r=t.ref([]),l=t.ref(void 0),s=t.ref(null),c=t.reactive({x:0,y:0});let d=null;const u=8;async function m(h,N){var S,V;r.value=N,l.value=(S=h.target)!=null&&S.closest('[data-theme="dark"]')?"dark":void 0,d=document.activeElement,c.x=h.clientX,c.y=h.clientY,a.value=!0,window.addEventListener("keydown",g),window.addEventListener("resize",p),await t.nextTick();const w=s.value;if(!w)return;const C=w.getBoundingClientRect();c.x+C.width>window.innerWidth-u&&(c.x=Math.max(u,window.innerWidth-u-C.width)),c.y+C.height>window.innerHeight-u&&(c.y=Math.max(u,window.innerHeight-u-C.height)),(V=f()[0])==null||V.focus()}function p(){if(!a.value)return;a.value=!1,r.value=[],window.removeEventListener("keydown",g),window.removeEventListener("resize",p);const h=d;d=null,h!=null&&h.isConnected&&h.focus()}function f(){const h=s.value;if(!h)return[];const N=[];for(const w of Array.from(h.children))if(w.classList.contains("em-ctx__item"))w.disabled||N.push(w);else if(w.classList.contains("em-ctx__swatches")){const C=Array.from(w.querySelectorAll(".em-ctx__chip"));C.length&&N.push(C.find(S=>S===document.activeElement)??C[0])}return N}function y(h){var S;const N=f();if(!N.length)return;const w=N.indexOf(document.activeElement),C=w<0?h>0?0:N.length-1:(w+h+N.length)%N.length;(S=N[C])==null||S.focus()}function _(h){var S,V;const N=(S=document.activeElement)==null?void 0:S.closest(".em-ctx__swatches");if(!N)return!1;const w=Array.from(N.querySelectorAll(".em-ctx__chip")),C=w.indexOf(document.activeElement);return C<0?!1:((V=w[(C+h+w.length)%w.length])==null||V.focus(),!0)}function g(h){var N,w;switch(h.key){case"Escape":h.stopPropagation(),p();return;case"ArrowDown":h.preventDefault(),y(1);return;case"ArrowUp":h.preventDefault(),y(-1);return;case"ArrowRight":_(1)&&h.preventDefault();return;case"ArrowLeft":_(-1)&&h.preventDefault();return;case"Home":h.preventDefault(),(N=f()[0])==null||N.focus();return;case"End":{h.preventDefault();const C=f();(w=C[C.length-1])==null||w.focus();return}case"Tab":h.preventDefault(),y(h.shiftKey?-1:1)}}function b(h){h.disabled||(h.handler(),p())}function E(h,N){h.onPick(N),p()}return t.onBeforeUnmount(p),n({open:m,close:p}),(h,N)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[a.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-ctx-layer","data-theme":l.value},[t.createElementVNode("div",{class:"em-ctx__scrim",onPointerdown:p,onContextmenu:t.withModifiers(p,["prevent"])},null,32),t.createElementVNode("div",{ref_key:"menuEl",ref:s,class:"em-ctx",style:t.normalizeStyle({left:c.x+"px",top:c.y+"px"}),role:"menu",onContextmenu:N[0]||(N[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(w,C)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:C},[w.type==="separator"?(t.openBlock(),t.createElementBlock("div",TT)):w.type==="swatches"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"em-ctx__swatches",role:"group","aria-label":w.caption},[t.createElementVNode("span",VT,t.toDisplayString(w.caption),1),t.createElementVNode("div",BT,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-ctx__chip em-ctx__chip--none",{"is-on":w.current===null}]),role:"menuitemradio","aria-checked":w.current===null,"aria-label":i("em.swatch.none"),title:i("em.swatch.none"),onClick:S=>E(w,null)},null,10,DT),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),S=>(t.openBlock(),t.createElementBlock("button",{key:S,type:"button",class:t.normalizeClass(["em-ctx__chip",{"is-on":w.current===S}]),style:t.normalizeStyle({background:t.unref(jo)(S)}),role:"menuitemradio","aria-checked":w.current===S,"aria-label":i(t.unref(mo)(S)),title:i(t.unref(mo)(S)),onClick:V=>E(w,S)},null,14,OT))),128))])],8,MT)):(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:t.normalizeClass(["em-ctx__item",{"is-danger":w.danger,"is-disabled":w.disabled}]),disabled:w.disabled,role:"menuitem",onClick:S=>b(w)},[t.createElementVNode("span",PT,[w.icon?(t.openBlock(),t.createBlock(Ve,{key:0,name:w.icon,size:15},null,8,["name"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",zT,t.toDisplayString(w.caption),1)],10,LT))],64))),128))],36)],8,$T)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2f05239a"]]);function Ih(e,n){return n?`${e}:${n}`:e}function vh(e,n){var o;if(!e||typeof window>"u")return{};try{const i=(o=window.sessionStorage)==null?void 0:o.getItem(Ih(e,n));if(!i)return{};const a=JSON.parse(i);if(!a||typeof a!="object"||Array.isArray(a))return{};const r={};for(const[l,s]of Object.entries(a))typeof s=="boolean"&&(r[l]=s);return r}catch{return{}}}function UT(e,n,o){var i,a;if(!(!e||typeof window>"u"))try{const r=Ih(e,n);Object.keys(o).length?(a=window.sessionStorage)==null||a.setItem(r,JSON.stringify(o)):(i=window.sessionStorage)==null||i.removeItem(r)}catch{}}function Ch(e){const n=()=>{var s;return(s=e.scope)==null?void 0:s.call(e)},o=t.ref(vh(e.storageKey,n()));e.scope&&t.watch(()=>e.scope(),s=>o.value=vh(e.storageKey,s)),t.watch(o,s=>UT(e.storageKey,n(),s),{deep:!0});const i=s=>o.value[s]??e.defaultCollapsed(s);function a(s){o.value={...o.value,[s]:!i(s)}}const r=t.computed(()=>!e.expandableKeys().some(s=>i(s)));function l(){const s=r.value,c={...o.value};for(const d of e.expandableKeys())c[d]=s;o.value=c}return{isCollapsed:i,toggle:a,toggleAll:l,allExpanded:r}}const Us=[".em-entity__grip",".em-entity__add",".em-entity__footer",".em-sel",".em-handle",".em-note-handle",".vue-flow__handle",".em-group__resize",".em-note__resize",".em-edge__waypoint",".em-edge__mid",".em-note-edge__waypoint",".em-note-edge__mid"].join(",");function Xo(e){const n=getComputedStyle(e);return!(n.display==="none"||n.visibility==="hidden"||parseFloat(n.opacity)===0)}function HT(e){return e.childElementCount>0?!1:(e.textContent??"").trim().length>0}function jT(e,n){const o=getComputedStyle(e),i={fill:o.color,fontSize:parseFloat(o.fontSize),fontFamily:o.fontFamily,fontWeight:o.fontWeight,fontStyle:o.fontStyle},a=document.createRange();a.selectNodeContents(e);const r=e.firstChild,l=a.getClientRects();if(!r||r.nodeType!==3||l.length<=1){const y=l.length?a.getBoundingClientRect():e.getBoundingClientRect();if(y.width===0&&y.height===0)return[];const _=n(y.left,y.top+y.height/2);return[{...i,x:_.x,y:_.y,text:(e.textContent??"").trim()}]}const s=r.textContent??"",c=[];let d="",u=null,m=0,p=0;const f=()=>{const y=d.trim();if(y){const _=n(m,(u+p)/2);c.push({...i,x:_.x,y:_.y,text:y})}d=""};for(let y=0;y<s.length;y++){a.setStart(r,y),a.setEnd(r,y+1);const _=a.getBoundingClientRect();u===null||Math.abs(_.top-u)>1?(f(),u=_.top,m=_.left,p=_.bottom,d=s[y]):(d+=s[y],p=Math.max(p,_.bottom))}return f(),c}function $r(e,n){const o=[];for(const i of e.querySelectorAll("*"))HT(i)&&(i.closest(Us)||Xo(i)&&o.push(...jT(i,n)));return o}function ji(e){return Math.round(e*100)/100}function KT(e,n){const o=[];for(const i of e.querySelectorAll("svg.em-icon")){if(i.closest(Us)||!Xo(i))continue;const a=i.getBoundingClientRect();if(a.width===0||a.height===0)continue;const r=n(a.left,a.top),l=n(a.right,a.bottom),s=getComputedStyle(i),c=i.getAttribute("viewBox")??"0 0 24 24",d=parseFloat(s.strokeWidth)||1.75;o.push(`<svg x="${ji(r.x)}" y="${ji(r.y)}" width="${ji(l.x-r.x)}" height="${ji(l.y-r.y)}" viewBox="${c}" fill="none" stroke="${s.color}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${i.innerHTML}</svg>`)}return o}function GT(e){const n=[];for(const o of e.querySelectorAll(".em-edge__marker")){if(!Xo(o))continue;const i=getComputedStyle(o),a=i.stroke,r=parseFloat(i.strokeWidth)||1.5,l=i.fill&&i.fill!=="none"?i.fill:"none",s=o.tagName.toLowerCase(),c=d=>ji(parseFloat(o.getAttribute(d)??"0"));s==="line"?n.push(`<line x1="${c("x1")}" y1="${c("y1")}" x2="${c("x2")}" y2="${c("y2")}" stroke="${a}" stroke-width="${r}" stroke-linecap="round" />`):s==="circle"?n.push(`<circle cx="${c("cx")}" cy="${c("cy")}" r="${c("r")}" fill="none" stroke="${a}" stroke-width="${r}" />`):s==="path"&&n.push(`<path d="${o.getAttribute("d")}" fill="${l}" stroke="${a}" stroke-width="${r}" stroke-linejoin="round" />`)}return n}function Sh(e,n,o){const i=[];for(const a of e.querySelectorAll("*")){if(a===n||a.closest(Us)||!Xo(a))continue;const r=getComputedStyle(a),l=parseFloat(r.borderTopWidth);if(!l)continue;const s=a.getBoundingClientRect();if(s.width===0)continue;const c=o(s.left,s.top),d=o(s.right,s.top);i.push({x1:c.x,x2:d.x,y:c.y,stroke:r.borderTopColor,strokeWidth:l})}return i}function Ki(e,n){const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=n(o.left,o.top),r=n(o.right,o.bottom),l=i.borderTopStyle==="dashed",s={tl:parseFloat(i.borderTopLeftRadius)||0,tr:parseFloat(i.borderTopRightRadius)||0,br:parseFloat(i.borderBottomRightRadius)||0,bl:parseFloat(i.borderBottomLeftRadius)||0};return{x:a.x,y:a.y,w:r.x-a.x,h:r.y-a.y,fill:i.backgroundColor,stroke:i.borderTopColor,strokeWidth:parseFloat(i.borderTopWidth)||void 0,strokeDasharray:l?"6 4":void 0,radius:s}}function Hs(e,n){e.minX=Math.min(e.minX,n.x),e.minY=Math.min(e.minY,n.y),e.maxX=Math.max(e.maxX,n.x+n.w),e.maxY=Math.max(e.maxY,n.y+n.h)}function YT(e){const n=e.vueFlowRef.value;if(!n)throw new Error("캔버스가 렌더되지 않아 SVG로 내보낼 수 없습니다.");const o=(f,y)=>e.screenToFlowCoordinate({x:f,y}),i=[],a=[],r=[],l=[],s={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const f of e.nodes.value){const y=n.querySelector(`.vue-flow__node[data-id="${CSS.escape(f.id)}"]`);if(!y||!Xo(y))continue;const _=y.firstElementChild;if(_)if(f.type==="group"){const g=Ki(_,o);Hs(s,g),i.push({...g,texts:[]});const b=_.querySelector(".em-group__label");b&&i.push({...Ki(b,o),stroke:"none",texts:[]}),i.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:$r(_,o)})}else if(f.type==="note"){const g={...Ki(_,o),texts:$r(_,o),lines:Sh(_,_,o)};Hs(s,g),r.push(g)}else{const g=Ki(_,o);Hs(s,g);const b=g.radius??{tl:0,tr:0};a.push({...g,stroke:"none",texts:[]});const E=_.querySelector(".em-entity__header");if(E){const h=Ki(E,o);a.push({x:g.x,y:g.y,w:g.w,h:h.y+h.h-g.y,fill:h.fill,stroke:"none",radius:{tl:b.tl,tr:b.tr,br:0,bl:0},texts:[]})}a.push({...g,fill:"none",stroke:"none",strokeWidth:void 0,strokeDasharray:void 0,radius:void 0,texts:$r(_,o),lines:Sh(_,_,o),icons:KT(_,o)}),a.push({...g,fill:"none",texts:[]})}}for(const f of n.querySelectorAll(".vue-flow__edge")){const y=f.querySelector("path.em-edge__path, path.em-note-edge__path");if(!y||!Xo(y))continue;const _=y.getAttribute("d");if(!_)continue;const g=getComputedStyle(y),b=g.strokeDasharray,E=GT(f);l.push({d:_,stroke:g.stroke,strokeWidth:parseFloat(g.strokeWidth)||1.5,strokeDasharray:b&&b!=="none"?b:void 0,labels:$r(f,o),markers:E.length?E:void 0})}const c=n.closest(".em-canvas")??n,d=getComputedStyle(c).backgroundColor,u=24;return{viewBox:Number.isFinite(s.minX)?{x:s.minX-u,y:s.minY-u,w:s.maxX-s.minX+u*2,h:s.maxY-s.minY+u*2}:{x:0,y:0,w:100,h:100},background:d,groups:i,edges:l,entities:a,notes:r}}function js(e){return $c(YT(e))}function xh(e,n){const o=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=o,i.download=n,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function Rh(e,n="diagram.svg"){const o=js(e);xh(new Blob([o],{type:"image/svg+xml;charset=utf-8"}),n)}function qT(e){var i,a;const n=Number((i=e.match(/width="([\d.]+)"/))==null?void 0:i[1]),o=Number((a=e.match(/height="([\d.]+)"/))==null?void 0:a[1]);return{w:n>0?n:1,h:o>0?o:1}}async function Ah(e,n="diagram.png",o=2){const i=js(e),{w:a,h:r}=qT(i),l=URL.createObjectURL(new Blob([i],{type:"image/svg+xml;charset=utf-8"}));try{const s=new Image;s.width=a,s.height=r,await new Promise((m,p)=>{s.onload=()=>m(),s.onerror=()=>p(new Error("SVG 이미지 로드 실패")),s.src=l});const c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*o)),c.height=Math.max(1,Math.round(r*o));const d=c.getContext("2d");if(!d)throw new Error("2D 캔버스 컨텍스트를 얻을 수 없습니다");d.scale(o,o),d.drawImage(s,0,0,a,r);const u=await new Promise(m=>c.toBlob(m,"image/png"));if(!u)throw new Error("PNG 변환 실패");xh(u,n)}finally{URL.revokeObjectURL(l)}}const WT={class:"em-shortcuts"},JT={class:"em-shortcuts__list"},XT={class:"em-shortcuts__title"},ZT={class:"em-shortcuts__keys"},QT={class:"em-shortcuts__kbd"},eM={key:0,class:"em-shortcuts__plus"},tM={class:"em-shortcuts__desc"},nM={class:"em-shortcuts__actions"},$h=tt(t.defineComponent({__name:"ShortcutHelpModal",props:{locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(s,c)=>qt(n.locale??"ko",s,c),r=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"⌘":"Ctrl",l=t.computed(()=>[{title:i("em.shortcuts.groupEdit"),items:[{keys:[r,"Z"],desc:i("em.shortcuts.descUndo")},{keys:[r,"Shift","Z"],desc:i("em.shortcuts.descRedo")},{keys:[r,"C"],desc:i("em.shortcuts.descCopy")},{keys:[r,"V"],desc:i("em.shortcuts.descPaste")},{keys:["Delete"],desc:i("em.shortcuts.descDelete")}]},{title:i("em.shortcuts.groupMove"),items:[{keys:["←","↑","→","↓"],desc:i("em.shortcuts.descMove1")},{keys:["Shift",i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descMove10")},{keys:["↑","↓"],desc:i("em.shortcuts.descAttrFocus")},{keys:["Alt","↑","↓"],desc:i("em.shortcuts.descAttrReorder")}]},{title:i("em.shortcuts.groupExplorer"),items:[{keys:["/"],desc:i("em.shortcuts.descExplorerSearch")},{keys:[i("em.shortcuts.keyArrows")],desc:i("em.shortcuts.descExplorerNav")},{keys:["Enter"],desc:i("em.shortcuts.descExplorerSelect")},{keys:["F2"],desc:i("em.shortcuts.descExplorerDetail")}]},{title:i("em.shortcuts.groupOther"),items:[{keys:[r,"K"],desc:i("em.shortcuts.descCommandPalette")},{keys:[i("em.shortcuts.keyRightClick")],desc:i("em.shortcuts.descContextMenu")},{keys:["Enter"],desc:i("em.shortcuts.descInlineConfirm")},{keys:["Esc"],desc:i("em.shortcuts.descCloseEdit")},{keys:["?"],desc:i("em.shortcuts.descOpenHelp")}]}]);return(s,c)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.shortcuts.title")},{default:t.withCtx(()=>[t.createElementVNode("div",WT,[t.createElementVNode("div",JT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,d=>(t.openBlock(),t.createElementBlock("section",{key:d.title,class:"em-shortcuts__group"},[t.createElementVNode("h4",XT,t.toDisplayString(d.title),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.items,u=>(t.openBlock(),t.createElementBlock("div",{key:u.desc,class:"em-shortcuts__row"},[t.createElementVNode("span",ZT,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.keys,(m,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m+p},[t.createElementVNode("kbd",QT,t.toDisplayString(m),1),p<u.keys.length-1?(t.openBlock(),t.createElementBlock("span",eM,"+")):t.createCommentVNode("",!0)],64))),128))]),t.createElementVNode("span",tM,t.toDisplayString(u.desc),1)]))),128))]))),128))]),t.createElementVNode("div",nM,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:c[0]||(c[0]=d=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-38f2450f"]]);function Zo(...e){return e.filter(o=>!!o).join(" ").toLowerCase().trim()||void 0}function oM(e,n){const o=new Set,i=a=>{const r=!!a.matchText&&a.matchText.includes(n);let l=!1;for(const c of a.children)i(c)&&(l=!0);const s=r||l;return s&&o.add(a.key),s};return i(e),o}const iM=["aria-label"],aM=["aria-activedescendant","aria-label","placeholder"],rM={id:"em-cmdk-listbox",class:"em-cmdk__results",role:"listbox"},lM=["aria-label"],sM={class:"em-cmdk__section","aria-hidden":"true"},cM=["id","aria-selected","onMouseenter","onClick"],dM={class:"em-cmdk__label"},uM={key:0,class:"em-cmdk__tag"},mM={key:1,class:"em-cmdk__sub"},fM=["aria-label"],pM={class:"em-cmdk__section","aria-hidden":"true"},hM=["id","aria-selected","aria-disabled","onMouseenter","onClick"],yM={class:"em-cmdk__label"},gM={key:1,class:"em-cmdk__empty"},bM=tt(t.defineComponent({__name:"CommandPalette",props:{controller:{}},emits:["close"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref(""),l=t.ref(0),s=t.ref(null),c=t.computed(()=>a.userLanguage.value),d=t.computed(()=>{const w=c.value,C=a.state.logical.entities.map(V=>{var $,R,x,T,M,k;return{type:"goto",kind:"entity",id:V.modelId,label:((R=($=V.table)==null?void 0:$.logicalName)==null?void 0:R[w])||V.name,sub:(x=V.table)==null?void 0:x.physicalName,match:Zo(V.name,(M=(T=V.table)==null?void 0:T.logicalName)==null?void 0:M[w],(k=V.table)==null?void 0:k.physicalName)??""}}),S=a.state.logical.groups.map(V=>{var $,R,x,T;return{type:"goto",kind:"group",id:V.modelId,label:(($=V.name)==null?void 0:$[w])||((R=V.name)==null?void 0:R.ko)||V.packageName||a.t("em.cmd.groupTag"),tag:a.t("em.cmd.groupTag"),match:Zo((x=V.name)==null?void 0:x[w],(T=V.name)==null?void 0:T.ko,V.packageName)??""}});return[...C,...S]}),u={LOGICAL:"em.displayMode.logical",PHYSICAL:"em.displayMode.physical",LOGICAL_PHYSICAL:"em.displayMode.logicalPhysical",CLASS:"em.displayMode.class"},m=t.computed(()=>{const w=[];a.editable.value&&(w.push({type:"action",id:"undo",label:a.t("em.toolbar.undo"),run:()=>a.undo(),disabled:!a.canUndo.value}),w.push({type:"action",id:"redo",label:a.t("em.toolbar.redo"),run:()=>a.redo(),disabled:!a.canRedo.value}),w.push({type:"action",id:"autolayout",label:a.t("em.palette.autoLayout"),run:()=>a.autoLayout()}),w.push({type:"action",id:"collapseAll",label:a.t("em.panel.collapseAll"),run:()=>a.collapseAll()}),w.push({type:"action",id:"expandAll",label:a.t("em.panel.expandAll"),run:()=>a.expandAll()})),w.push({type:"action",id:"grid",label:a.t("em.toolbar.grid"),run:()=>a.showGrid.value=!a.showGrid.value}),w.push({type:"action",id:"minimap",label:a.t("em.toolbar.minimap"),run:()=>a.showMinimap.value=!a.showMinimap.value}),w.push({type:"action",id:"routing",label:a.t("em.toolbar.routingToggle"),run:()=>a.routingMode.value=a.routingMode.value==="straight"?"orthogonal":"straight"});for(const C of["LOGICAL","PHYSICAL","LOGICAL_PHYSICAL","CLASS"])w.push({type:"action",id:`dm-${C}`,label:a.t(u[C]),run:()=>a.displayMode.value=C});return w});function p(w,C){return w.label.toLowerCase().includes(C)}const f=t.computed(()=>{const w=r.value.trim().toLowerCase();return w?d.value.filter(C=>C.match.includes(w)):d.value}),y=t.computed(()=>{const w=r.value.trim().toLowerCase();return w?m.value.filter(C=>p(C,w)):m.value}),_=t.computed(()=>[...f.value,...y.value]);t.watch([f,y],()=>{l.value=0});function g(w){return _.value.indexOf(w)}const b=w=>`em-cmdk-opt-${w}`,E=t.computed(()=>_.value[l.value]?b(l.value):void 0);t.watch(l,async()=>{var C;await t.nextTick();const w=E.value;w&&((C=document.getElementById(w))==null||C.scrollIntoView({block:"nearest"}))});function h(w){if(w.type==="goto")a.selection.value={kind:w.kind,id:w.id},a.requestFocus(w.id);else{if(w.disabled)return;w.run()}i("close")}function N(w){if(w.key==="Escape"){i("close"),w.preventDefault();return}if(w.key==="ArrowDown"){l.value=Math.min(l.value+1,_.value.length-1),w.preventDefault();return}if(w.key==="ArrowUp"){l.value=Math.max(l.value-1,0),w.preventDefault();return}if(w.key==="Enter"){const C=_.value[l.value];C&&h(C),w.preventDefault();return}w.key==="Tab"&&w.preventDefault()}return t.nextTick(()=>{var w;return(w=s.value)==null?void 0:w.focus()}),(w,C)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createElementVNode("div",{class:"em-cmdk__backdrop",onPointerdown:C[1]||(C[1]=t.withModifiers(S=>i("close"),["self"]))},[t.createElementVNode("div",{class:"em-cmdk",role:"dialog","aria-modal":"true","aria-label":t.unref(a).t("em.cmd.title")},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":C[0]||(C[0]=S=>r.value=S),class:"em-cmdk__input",type:"text",role:"combobox","aria-expanded":"true","aria-autocomplete":"list",autocomplete:"off","aria-controls":"em-cmdk-listbox","aria-activedescendant":E.value,"aria-label":t.unref(a).t("em.cmd.placeholder"),placeholder:t.unref(a).t("em.cmd.placeholder"),onKeydown:N},null,40,aM),[[t.vModelText,r.value]]),t.createElementVNode("div",rM,[_.value.length?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[f.value.length?(t.openBlock(),t.createElementBlock("div",{key:0,role:"group","aria-label":t.unref(a).t("em.cmd.sectionGoto")},[t.createElementVNode("div",sM,t.toDisplayString(t.unref(a).t("em.cmd.sectionGoto")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,S=>(t.openBlock(),t.createElementBlock("button",{id:b(g(S)),key:S.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":g(S)===l.value}]),role:"option","aria-selected":g(S)===l.value,onMouseenter:V=>l.value=g(S),onClick:V=>h(S)},[t.createElementVNode("span",dM,t.toDisplayString(S.label),1),S.tag?(t.openBlock(),t.createElementBlock("span",uM,t.toDisplayString(S.tag),1)):S.sub?(t.openBlock(),t.createElementBlock("span",mM,t.toDisplayString(S.sub),1)):t.createCommentVNode("",!0)],42,cM))),128))],8,lM)):t.createCommentVNode("",!0),y.value.length?(t.openBlock(),t.createElementBlock("div",{key:1,role:"group","aria-label":t.unref(a).t("em.cmd.sectionActions")},[t.createElementVNode("div",pM,t.toDisplayString(t.unref(a).t("em.cmd.sectionActions")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,S=>(t.openBlock(),t.createElementBlock("button",{id:b(g(S)),key:S.id,type:"button",tabindex:"-1",class:t.normalizeClass(["em-cmdk__item",{"is-active":g(S)===l.value,"is-disabled":S.disabled}]),role:"option","aria-selected":g(S)===l.value,"aria-disabled":S.disabled||void 0,onMouseenter:V=>l.value=g(S),onClick:V=>h(S)},[t.createElementVNode("span",yM,t.toDisplayString(S.label),1)],42,hM))),128))],8,fM)):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock("div",gM,t.toDisplayString(t.unref(a).t("em.cmd.empty")),1))])],8,iM)],32)]))}}),[["__scopeId","data-v-fcf574c4"]]);function _M(e){return e?e.kind==="missing"?{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.missingDetail"}:{titleKey:"em.conflict.lockedTitle",detailKey:"em.conflict.changedDetail"}:null}const kM={key:0,class:"em-canvas__empty","aria-hidden":"true"},EM={class:"em-canvas__empty-title"},NM=["innerHTML"],wM=["innerHTML"],IM=["innerHTML"],vM={key:1,class:"em-canvas__empty-title"},CM={key:0,class:"em-conflict-banner",role:"alert","aria-live":"assertive"},SM={class:"em-conflict-banner__body"},xM={class:"em-conflict-banner__title"},RM={class:"em-conflict-banner__detail"},AM={key:0,class:"em-toast",role:"status","aria-live":"polite"},Ks="nc:",Th=tt(t.defineComponent({__name:"DiagramCanvas",props:{controller:{},diffMarks:{},embedCollapseStorageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=te.useModal(),r=t.ref(!1),l=t.ref(null);let s;function c(B){l.value=B,s&&clearTimeout(s),s=setTimeout(()=>l.value=null,3200)}t.watch(()=>i.notice.value,B=>{B&&c(B.text)}),t.onBeforeUnmount(()=>s&&clearTimeout(s));const d=t.computed(()=>{if(i.commandFailure.value)return{title:i.t("em.conflict.lockedTitle"),detail:i.t("em.conflict.commandFailedDetail")};const B=_M(i.opConflict.value);return B?{title:i.t(B.titleKey),detail:i.t(B.detailKey)}:null}),u=t.ref(!1),m=t.ref(!1),p={x:0,y:0};function f(B){p.x=B.clientX,p.y=B.clientY}const y=t.ref(null);t.provide(dr,y);const _=t.ref(null);t.provide(Jf,_);const g=t.ref(null),b=t.computed(()=>{const B=g.value,F=new Set;if(!B)return F;if(B.kind==="entity")F.add(B.id);else if(B.kind==="group"){const j=i.resolved.value.groups.find(fe=>fe.group.modelId===B.id);for(const fe of(j==null?void 0:j.group.memberEntityRefs)??[])F.add(fe)}return F}),E=t.computed(()=>{const B=g.value,F=new Set(b.value),j=new Set,fe=new Set;if(!B)return{related:F,edges:j,notes:fe};if(B.kind==="note"){fe.add(B.id);for(const Oe of i.resolved.value.noteConnections)Oe.noteRef===B.id&&F.add(Oe.targetRef);return{related:F,edges:j,notes:fe}}const Te=b.value;if(!Te.size)return{related:F,edges:j,notes:fe};for(const Oe of i.resolved.value.associations){const{end1:ce,end2:Le}=Oe.association;(Te.has(ce.entityRef)||Te.has(Le.entityRef))&&(j.add(Oe.association.modelId),F.add(ce.entityRef),F.add(Le.entityRef))}for(const Oe of i.resolved.value.noteConnections)F.has(Oe.targetRef)&&fe.add(Oe.noteRef);return{related:F,edges:j,notes:fe}});t.provide(Go,{source:g,active:t.computed(()=>g.value!==null),primaryEntityIds:b,relatedEntityIds:t.computed(()=>E.value.related),relatedEdgeIds:t.computed(()=>E.value.edges),relatedNoteIds:t.computed(()=>E.value.notes),hoverGroupId:t.computed(()=>{var B;return((B=g.value)==null?void 0:B.kind)==="group"?g.value.id:null}),setEntityHover:B=>{_.value||m.value||(g.value=B?{kind:"entity",id:B}:null)},setGroupHover:B=>{_.value||m.value||(g.value=B?{kind:"group",id:B}:null)},setNoteHover:B=>{_.value||m.value||(g.value=B?{kind:"note",id:B}:null)}}),t.provide(po,i);const h=rS(),N=t.computed(()=>h(i.state.logical,i.embeddableCatalog.value));t.provide(Qf,N);const w=Ch({expandableKeys:()=>[],defaultCollapsed:dS,storageKey:o.embedCollapseStorageKey,scope:()=>i.state.layout.diagramId});t.provide(np,{isCollapsed:w.isCollapsed,toggle:w.toggle}),t.provide(Xf,{marks:t.toRef(o,"diffMarks")});function C(B,F){return`${Ks}${B}:${F}`}function S(B){if(!B.startsWith(Ks))return null;const[F,j]=B.slice(Ks.length).split(":");return F&&j?{noteRef:F,targetRef:j}:null}t.provide(Es,{points:B=>{var j,fe;const F=S(B);return F?((j=i.resolved.value.noteConnections.find(Te=>Te.noteRef===F.noteRef&&Te.targetRef===F.targetRef))==null?void 0:j.waypoints)??[]:((fe=i.resolved.value.associations.find(Te=>Te.association.modelId===B))==null?void 0:fe.waypoints)??[]},movePoint:(B,F,j)=>{const fe=S(B);fe?i.moveNoteConnectionWaypoint(fe.noteRef,fe.targetRef,F,j):i.moveWaypoint(B,F,j)},insertPoint:(B,F,j)=>{const fe=S(B);fe?i.addNoteConnectionWaypoint(fe.noteRef,fe.targetRef,F,j):i.addWaypoint(B,F,j)},removePoint:(B,F)=>{const j=S(B);j?i.removeNoteConnectionWaypoint(j.noteRef,j.targetRef,F):i.removeWaypoint(B,F)}});const V=et(),{nodes:$,edges:R,findNode:x,findEdge:T,addNodes:M,addEdges:k,removeNodes:v,removeEdges:I,fitView:O,setCenter:A,getViewport:L,screenToFlowCoordinate:H,getSelectedNodes:oe,updateNodeInternals:ue}=V,be=t.ref(!1);async function pe(B){be.value=!0,await t.nextTick(),await new Promise(F=>requestAnimationFrame(()=>F(null)));try{return await B()}finally{be.value=!1}}async function he(){try{await pe(()=>Rh(V))}catch(B){console.error("[entity-modeler] SVG export failed",B),c(i.t("em.canvas.exportFailed"))}}async function _e(){try{await pe(()=>Ah(V))}catch(B){console.error("[entity-modeler] PNG export failed",B),c(i.t("em.canvas.exportFailed"))}}n({exportSvg:he,exportPng:_e,fitView:O});const ye=t.computed(()=>i.resolved.value.entities.length===0);function Ae(){const B=L(),{width:F,height:j}=V.dimensions.value;return{x:(F/2-B.x)/B.zoom,y:(j/2-B.y)/B.zoom}}function Fe(){const B=Ae();i.addEntity("NewEntity",{x:B.x,y:B.y})}function se(){const B=Ae();i.addNote("메모",{x:B.x,y:B.y})}function ne(B){for(const F of i.resolved.value.groups){const{location:j,size:fe}=F.geo;if(B.x>=j.x&&B.x<=j.x+fe.width&&B.y>=j.y&&B.y<=j.y+fe.height)return F.group.modelId}return null}function ae(B,F){return B.x===F.x&&B.y===F.y}function me(B,F){return(B==null?void 0:B.width)===(F==null?void 0:F.width)&&(B==null?void 0:B.height)===(F==null?void 0:F.height)}function P(B,F){return B.entity===F.entity&&B.displayMode===F.displayMode&&B.collapsed===F.collapsed&&B.locked===F.locked&&B.groupRef===F.groupRef&&me(B.size,F.size)&&B.style===F.style&&B.attributeStyles===F.attributeStyles&&B.operationStyles===F.operationStyles}function D(B,F){const j=Object.keys(B);if(j.length!==Object.keys(F).length)return!1;for(const fe of j)if(fe==="geo"){const Te=B.geo,Oe=F.geo;if(!ae(Te.location,Oe.location)||!me(Te.size,Oe.size))return!1}else if(B[fe]!==F[fe])return!1;return!0}function z(){const B=i.resolved.value,F=new Map(B.groups.map(ce=>[ce.group.modelId,ce.geo])),j=new Set(B.groups.map(ce=>ce.group.modelId)),fe=new Set([...j,...B.entities.map(ce=>ce.entity.modelId),...B.notes.map(ce=>ce.note.modelId)]);for(const ce of[...$.value])fe.has(ce.id)||v([ce.id]);for(const ce of B.groups){const Le=ce.group.modelId,Ye={width:`${ce.geo.size.width}px`,height:`${ce.geo.size.height}px`},Je={group:ce.group,style:ce.style,locked:ce.locked},ut=ce.locked?!1:void 0,G=x(Le);if(G){ae(G.position,ce.geo.location)||(G.position={...ce.geo.location});const W=G.data;(W.group!==Je.group||W.style!==Je.style||W.locked!==Je.locked)&&(G.data=Je);const ve=G.style;((ve==null?void 0:ve.width)!==Ye.width||(ve==null?void 0:ve.height)!==Ye.height)&&(G.style=Ye),G.draggable!==ut&&(G.draggable=ut)}else M([{id:Le,type:"group",position:{...ce.geo.location},draggable:ut,style:Ye,data:Je}])}for(const ce of B.entities){const Le=ce.entity.modelId,Ye=ce.groupRef&&j.has(ce.groupRef)?ce.groupRef:void 0,Je={entity:ce.entity,displayMode:i.displayMode.value,collapsed:ce.collapsed,locked:ce.locked,groupRef:Ye,size:ce.geo.size,style:ce.style,attributeStyles:ce.attributeStyles,operationStyles:ce.operationStyles},ut=ce.locked?!1:void 0,G=ce.locked?!1:void 0,W=Ye?F.get(Ye):void 0,ve=W?{x:ce.geo.location.x-W.location.x,y:ce.geo.location.y-W.location.y}:{...ce.geo.location},$e=x(Le);$e?(ae($e.position,ve)||($e.position=ve),P($e.data,Je)||($e.data=Je),$e.parentNode!==Ye&&($e.parentNode=Ye),$e.draggable!==ut&&($e.draggable=ut),$e.connectable!==G&&($e.connectable=G)):M([{id:Le,type:"entity",position:ve,parentNode:Ye,draggable:ut,connectable:G,data:Je}])}for(const ce of B.notes){const Le=ce.note,Ye=Le.modelId,Je=ce.groupRef&&j.has(ce.groupRef)?ce.groupRef:void 0,ut={note:Le,groupRef:Je},G={width:`${Le.geo.size.width}px`,height:`${Le.geo.size.height}px`},W=Je?F.get(Je):void 0,ve=W?{x:Le.geo.location.x-W.location.x,y:Le.geo.location.y-W.location.y}:{...Le.geo.location},$e=x(Ye);if($e){ae($e.position,ve)||($e.position=ve);const Ee=$e.data;(Ee.groupRef!==Je||!D(Ee.note,Le))&&($e.data=ut);const Qe=$e.style;((Qe==null?void 0:Qe.width)!==G.width||(Qe==null?void 0:Qe.height)!==G.height)&&($e.style=G),$e.parentNode!==Je&&($e.parentNode=Je)}else M([{id:Ye,type:"note",position:ve,parentNode:Je,style:G,data:ut}])}const Te=new Map(B.associations.map(ce=>[ce.association.modelId,ce])),Oe=new Set(B.noteConnections.map(ce=>C(ce.noteRef,ce.targetRef)));for(const ce of[...R.value])!Te.has(ce.id)&&!Oe.has(ce.id)&&I([ce.id]);for(const[ce,Le]of Te){const Ye={id:ce,type:"association",source:Le.association.end1.entityRef,target:Le.association.end2.entityRef,sourceHandle:Le.sourceColumnRef?`r:${Le.sourceColumnRef}`:void 0,targetHandle:Le.targetColumnRef?`l:${Le.targetColumnRef}`:void 0,data:{association:Le.association,sourceColumnRef:Le.sourceColumnRef,targetColumnRef:Le.targetColumnRef}},Je=T(ce);if(Je){const ut=Je.data;(ut.association!==Ye.data.association||ut.sourceColumnRef!==Ye.data.sourceColumnRef||ut.targetColumnRef!==Ye.data.targetColumnRef)&&(Je.data=Ye.data),Je.sourceHandle!==Ye.sourceHandle&&(Je.sourceHandle=Ye.sourceHandle),Je.targetHandle!==Ye.targetHandle&&(Je.targetHandle=Ye.targetHandle)}else k([Ye])}for(const ce of B.noteConnections){const Le=C(ce.noteRef,ce.targetRef),Ye={noteRef:ce.noteRef,targetRef:ce.targetRef};T(Le)||k([{id:Le,type:"note-connection",source:ce.noteRef,target:ce.targetRef,data:Ye}])}}const Q=new Set;let ee=!1,we=!1;const de=new Map;function xe(B){const F=document.querySelector(`.vue-flow__node[data-id="${CSS.escape(B)}"]`);if(!F)return null;let j=`${F.offsetHeight}`;for(const fe of F.querySelectorAll(".em-entity__row"))j+=`|${fe.dataset.attr}:${fe.offsetTop}`;return j}function Ce(){we=!1;const B=ee;ee=!1;const F=[...Q];if(Q.clear(),B){ue();for(const fe of $.value){const Te=xe(fe.id);Te!==null&&de.set(fe.id,Te)}return}const j=[];for(const fe of F){const Te=xe(fe);if(Te===null){de.delete(fe);continue}de.get(fe)!==Te&&(de.set(fe,Te),j.push(fe))}j.length&&ue(j)}function Y(B){if(B)for(const F of B)Q.add(F);else ee=!0;we||(we=!0,t.nextTick(()=>requestAnimationFrame(Ce)))}t.provide(Zf,{mark:B=>Y([B])});function X(){const B=oe.value.map(j=>j.id);if(B.length)return B;const F=i.selection.value;return F&&(F.kind==="entity"||F.kind==="note"||F.kind==="group")?[F.id]:[]}function q(){return oe.value.filter(B=>B.type==="entity").map(B=>B.id)}function Ie(){return oe.value.filter(B=>B.type==="group").map(B=>B.id)}function Be(B){var F;return[...((F=i.state.logical.groups.find(j=>j.modelId===B))==null?void 0:F.memberEntityRefs)??[]]}function ze(){const B=Ie().flatMap(Be);return[...new Set([...q(),...B])]}function Ue(){return Ie().length>0||q().length>1}function ie(){Ue()?i.copy(ze()):i.copy()}async function Se(B){if(!B.length)return;await t.nextTick();const F=oe.value;F.length&&V.removeSelectedNodes(F);const j=B.map(fe=>x(fe)).filter(fe=>!!fe);j.length&&V.addSelectedNodes(j)}function je(B){if(Ue()&&q().includes(B)){const F=ze();return{caption:i.t("em.ctx.copyN",{n:F.length}),icon:"copy",handler:()=>i.copy(F)}}return{caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>{i.selection.value={kind:"entity",id:B},i.copy()}}}function Ze(B){var Te;const F=B.target;if(F&&(F.tagName==="INPUT"||F.tagName==="TEXTAREA"||F.isContentEditable))return;if(B.key==="?"){a.openModal({component:$h,bind:{locale:i.uiLocale.value}}),B.preventDefault();return}if((B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="k"){r.value=!0,B.preventDefault();return}if(!i.editable.value){(B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="c"&&(ie(),B.preventDefault());return}if(B.key==="Delete"||B.key==="Backspace"){i.deleteSelection()&&B.preventDefault();return}if(B.key==="ArrowUp"||B.key==="ArrowDown"||B.key==="ArrowLeft"||B.key==="ArrowRight"){if(((Te=i.selection.value)==null?void 0:Te.kind)==="attribute"){if(B.key==="ArrowUp"||B.key==="ArrowDown"){const Ye=B.key==="ArrowDown"?1:-1;(B.altKey?i.nudgeSelectedAttributes(Ye):i.moveAttributeFocus(Ye))&&B.preventDefault()}return}const Oe=B.shiftKey?10:1,ce=B.key==="ArrowLeft"?-Oe:B.key==="ArrowRight"?Oe:0,Le=B.key==="ArrowUp"?-Oe:B.key==="ArrowDown"?Oe:0;i.nudgeNodes(X(),ce,Le)&&B.preventDefault();return}if(!(B.metaKey||B.ctrlKey))return;const fe=B.key.toLowerCase();fe==="c"?(ie(),B.preventDefault()):fe==="v"?(Se(i.paste()),B.preventDefault()):fe==="z"&&(B.shiftKey?i.redo():i.undo(),B.preventDefault())}t.onMounted(async()=>{z(),await t.nextTick(),O(),Y(),window.addEventListener("keydown",Ze),window.addEventListener("pointerup",J),window.addEventListener("pointermove",f,{passive:!0})}),t.onBeforeUnmount(()=>{window.removeEventListener("keydown",Ze),window.removeEventListener("pointerup",J),window.removeEventListener("pointermove",f)});function J(){y.value=null}function re(){m.value=!0,g.value=null}function Ke(){var fe;m.value=!1;const B=(fe=document.elementFromPoint(p.x,p.y))==null?void 0:fe.closest(".vue-flow__node"),F=B==null?void 0:B.dataset.id;if(!F){g.value=null;return}const j=B.classList.contains("vue-flow__node-group")?"group":B.classList.contains("vue-flow__node-note")?"note":"entity";g.value={kind:j,id:F}}t.watch([()=>i.resolved.value,()=>i.displayMode.value],z),t.watch(()=>i.resolved.value,B=>{const F=g.value;if(!F)return;(F.kind==="entity"?B.entities.some(fe=>fe.entity.modelId===F.id):F.kind==="group"?B.groups.some(fe=>fe.group.modelId===F.id):B.notes.some(fe=>fe.note.modelId===F.id))||(g.value=null)});function st(B){const F=B.computedPosition??B.position,j=B.dimensions??{width:0,height:0};return{x:F.x+j.width/2,y:F.y+j.height/2}}function qe(B){const F=B.node;if(F){if(g.value=null,F.type==="group"){const j=i.resolved.value.groups.find(fe=>fe.group.modelId===F.id);_.value=j?{groupId:F.id,dx:F.position.x-j.geo.location.x,dy:F.position.y-j.geo.location.y}:null,y.value=null;return}if(F.type!=="entity"&&F.type!=="note"){y.value=null;return}y.value=ne(st(F))}}function nt(B){var fe;y.value=null,_.value=null;const F=(fe=B.nodes)!=null&&fe.length?B.nodes:[B.node],j=F.filter(Te=>(Te==null?void 0:Te.type)==="group");if(j.length){for(const Te of j){if(!Te)continue;const Oe=i.resolved.value.entities.filter(ce=>ce.groupRef===Te.id).map(ce=>{const Le=x(ce.entity.modelId),Ye=(Le==null?void 0:Le.computedPosition)??(Le==null?void 0:Le.position)??{x:0,y:0};return{id:ce.entity.modelId,location:{x:Ye.x,y:Ye.y}}});i.dragGroup(Te.id,{x:Te.position.x,y:Te.position.y},Oe)}return}for(const Te of F){if(!Te||Te.type==="group")continue;const Oe=Te.computedPosition??Te.position,ce=Te.dimensions??{width:0,height:0},Le={x:Oe.x+ce.width/2,y:Oe.y+ce.height/2};Te.type==="note"?i.dropNote(Te.id,{x:Oe.x,y:Oe.y},ne(Le)):i.dropEntity(Te.id,{x:Oe.x,y:Oe.y},ne(Le))}}function We(B){var Ye,Je,ut,G,W;if(!i.editable.value||!B.source||!B.target)return;const F=((Ye=x(B.source))==null?void 0:Ye.type)==="note",j=((Je=x(B.target))==null?void 0:Je.type)==="note";if(F||j){if(F&&j)return;const ve=F?B.source:B.target,$e=F?B.target:B.source;((ut=x($e))==null?void 0:ut.type)==="entity"&&i.addNoteConnection(ve,$e);return}const fe=ve=>{var $e;return($e=i.state.logical.entities.find(Ee=>Ee.modelId===ve))==null?void 0:$e.stereotype},Te=fe(B.source)==="JPA_EMBEDDABLE",Oe=fe(B.target)==="JPA_EMBEDDABLE";if(Te||Oe){if(Te&&Oe)return;const ve=Te?B.source:B.target,$e=Te?B.target:B.source;i.addEmbedAssociation($e,ve);return}const ce=(G=B.sourceHandle)!=null&&G.startsWith("r:")?B.sourceHandle.slice(2):void 0,Le=(W=B.targetHandle)!=null&&W.startsWith("l:")?B.targetHandle.slice(2):void 0;i.addAssociation(B.source,B.target,ce,Le)}const K=t.ref(null);function le(B,F){var fe;const j=i.state.layout.entityLayouts.find(Te=>Te.entityRef===B);return St((fe=j==null?void 0:j.attributeStyles)==null?void 0:fe[F])}function Re(B,F){var fe;const j=i.state.layout.entityLayouts.find(Te=>Te.entityRef===B);return St((fe=j==null?void 0:j.operationStyles)==null?void 0:fe[F])}function ke(B){var F;return St((F=i.state.layout.groupLayouts.find(j=>j.groupRef===B))==null?void 0:F.style)}function U(B){var F;return St((F=i.state.layout.notes.find(j=>j.modelId===B))==null?void 0:F.style)}function bt(B){var Te,Oe;if(B.preventDefault(),!i.editable.value)return;const F=()=>H({x:B.clientX,y:B.clientY}),j=[{caption:i.t("em.ctx.addEntity"),icon:"add-entity",handler:()=>{const ce=F();i.addEntity("NewEntity",{x:ce.x,y:ce.y})}},{caption:i.t("em.ctx.addNote"),icon:"note",handler:()=>{const ce=F();i.addNote("메모",{x:ce.x,y:ce.y})}},{caption:i.t("em.ctx.addGroup"),icon:"folder",handler:()=>{const ce=F();i.addEmptyGroup({x:ce.x,y:ce.y})}}],fe=(Te=i.clipboard.value)==null?void 0:Te.kind;(fe==="entity"||fe==="entities")&&j.push({caption:i.t("em.ctx.paste"),icon:"clipboard",handler:()=>Se(i.paste())}),i.resolved.value.entities.length>0&&j.push({type:"separator"},{caption:i.t("em.panel.collapseAll"),icon:"collapse-all",handler:()=>i.collapseAll()},{caption:i.t("em.panel.expandAll"),icon:"expand-all",handler:()=>i.expandAll()}),(Oe=K.value)==null||Oe.open(B,j)}function vt({event:B,node:F}){var Ye,Je,ut,G,W,ve,$e,Ee,Qe,Tt,Et,_o,Gi,pt,Rn,Mr,Oh,Lh,Ph;const j=B;if(j.preventDefault(),!i.editable.value){if(F.type==="group"||F.type==="note")return;const it=(Je=(Ye=j.target)==null?void 0:Ye.closest("[data-attr]"))==null?void 0:Je.dataset.attr;if(it){const ht=i.selection.value;(ht==null?void 0:ht.kind)==="attribute"&&ht.entityId===F.id&&ht.ids.includes(it)||i.selectAttribute(F.id,it);const An=((ut=i.selection.value)==null?void 0:ut.kind)==="attribute"&&i.selection.value.entityId===F.id?[...i.selection.value.ids]:[it];(G=K.value)==null||G.open(j,[{caption:An.length>1?i.t("em.ctx.copyN",{n:An.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}(W=K.value)==null||W.open(j,[{caption:i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>lr(a,i,F.id)},je(F.id)]);return}if(F.type==="group"){const it=i.isGroupLocked(F.id),ht=[];it||ht.push({type:"swatches",caption:i.t("em.common.color"),current:ke(F.id),onPick:An=>i.setGroupSwatch(F.id,An)},{type:"separator"});const Nt=Ue()&&Ie().includes(F.id)?ze():Be(F.id);Nt.length&&ht.push({caption:i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy(Nt)}),ht.push({caption:it?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:it?"unlock":"lock",handler:()=>i.setGroupLocked(F.id,!it)}),it||ht.push({type:"separator"},{caption:i.t("em.ctx.ungroup"),icon:"trash",danger:!0,handler:()=>i.removeGroup(F.id)}),(ve=K.value)==null||ve.open(j,ht);return}if(F.type==="note"){($e=K.value)==null||$e.open(j,[{type:"swatches",caption:i.t("em.common.color"),current:U(F.id),onPick:it=>i.setNoteSwatch(F.id,it)},{type:"separator"},{caption:i.t("em.ctx.deleteNote"),icon:"trash",danger:!0,handler:()=>i.removeNote(F.id)}]);return}const fe=(Qe=(Ee=j.target)==null?void 0:Ee.closest("[data-attr]"))==null?void 0:Qe.dataset.attr;if(fe){const it=i.selection.value;(it==null?void 0:it.kind)==="attribute"&&it.entityId===F.id&&it.ids.includes(fe)||i.selectAttribute(F.id,fe);const Nt=((Tt=i.selection.value)==null?void 0:Tt.kind)==="attribute"&&i.selection.value.entityId===F.id?[...i.selection.value.ids]:[fe];if(i.isEntityLocked(F.id)){(Et=K.value)==null||Et.open(j,[{caption:Nt.length>1?i.t("em.ctx.copyN",{n:Nt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}]);return}const An=Nt.length>1,Gs=[{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(F.id)},{type:"swatches",caption:An?i.t("em.ctx.colorN",{n:Nt.length}):i.t("em.common.color"),current:An?null:le(F.id,fe),onPick:jD=>i.setAttributeSwatches(F.id,Nt,jD)},{type:"separator"},{caption:An?i.t("em.ctx.copyN",{n:Nt.length}):i.t("em.ctx.copy"),icon:"copy",handler:()=>i.copy()}],Yi=i.clipboard.value;(Yi==null?void 0:Yi.kind)==="attribute"&&Gs.push({caption:Yi.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:Yi.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:F.id},i.paste()}}),Gs.push({type:"separator"},{caption:An?i.t("em.ctx.deleteAttrN",{n:Nt.length}):i.t("em.ctx.deleteAttr"),icon:"trash",danger:!0,handler:()=>i.removeAttributes(F.id,Nt)}),(_o=K.value)==null||_o.open(j,Gs);return}const Te=(pt=(Gi=j.target)==null?void 0:Gi.closest("[data-op]"))==null?void 0:pt.dataset.op;if(Te){if(i.isEntityLocked(F.id))return;(Rn=K.value)==null||Rn.open(j,[{caption:i.t("em.ctx.addOperation"),icon:"method",handler:()=>i.addOperation(F.id)},{type:"swatches",caption:i.t("em.common.color"),current:Re(F.id,Te),onPick:it=>i.setOperationSwatch(F.id,Te,it)},{type:"separator"},{caption:i.t("em.ctx.deleteOperation"),icon:"trash",danger:!0,handler:()=>i.removeOperation(F.id,Te)}]);return}const Oe=i.resolved.value.entities.find(it=>it.entity.modelId===F.id),ce=!!(Oe!=null&&Oe.locked),Le=[{caption:ce?i.t("em.ctx.viewDetail"):i.t("em.ctx.editDetail"),icon:"pencil",handler:()=>lr(a,i,F.id)}];if(!ce){Le.push({type:"separator"},{caption:i.t("em.ctx.addAttr"),icon:"field",handler:()=>i.addAttribute(F.id)},{caption:i.t("em.ctx.addMethod"),icon:"method",handler:()=>i.addOperation(F.id)},{caption:i.t("em.ctx.groupInto"),icon:"folder",handler:()=>{const ht=oe.value.filter(Nt=>Nt.type==="entity").map(Nt=>Nt.id);i.createGroup(ht.includes(F.id)&&ht.length?ht:[F.id])}},{caption:i.t("em.ctx.addSelfAssoc"),icon:"arrow-lr",handler:()=>i.addAssociation(F.id,F.id)});const it=i.embeddableCatalog.value;if(it.length){Le.push({type:"separator"});for(const ht of it){const Nt=((Mr=ht.label)==null?void 0:Mr[i.userLanguage.value])??((Oh=ht.label)==null?void 0:Oh.ko)??((Lh=ht.label)==null?void 0:Lh.en)??ht.type;Le.push({caption:i.t("em.ctx.addEmbeddableNamed",{label:Nt}),icon:"link",handler:()=>i.addPredefinedEmbed(F.id,ht.type)})}}}if(Le.push({type:"separator"}),Le.push({caption:Oe!=null&&Oe.collapsed?i.t("em.panel.expand"):i.t("em.panel.collapse"),icon:Oe!=null&&Oe.collapsed?"expand-all":"collapse-all",handler:()=>i.setEntityCollapsed(F.id,!(Oe!=null&&Oe.collapsed))}),Oe!=null&&Oe.groupRef&&!ce&&Le.push({caption:i.t("em.ctx.ungroupEntity"),icon:"folder",handler:()=>i.ungroupEntity(F.id)}),Le.push({caption:ce?i.t("em.panel.unlock"):i.t("em.ctx.lock"),icon:ce?"unlock":"lock",handler:()=>i.setEntityLocked(F.id,!ce)}),Le.push(je(F.id)),!ce){const it=i.clipboard.value;(it==null?void 0:it.kind)==="attribute"&&Le.push({caption:it.attributes.length>1?i.t("em.ctx.pasteAttrN",{n:it.attributes.length}):i.t("em.ctx.pasteAttr"),icon:"clipboard",handler:()=>{i.selection.value={kind:"entity",id:F.id},i.paste()}}),Le.push({type:"separator"}),Le.push({caption:i.t("em.ctx.deleteEntity"),icon:"trash",danger:!0,handler:()=>i.removeEntity(F.id)})}(Ph=K.value)==null||Ph.open(j,Le)}function ot({event:B,edge:F}){var Oe,ce;const j=B;if(j.preventDefault(),!i.editable.value)return;const fe=S(F.id);if(fe){(Oe=K.value)==null||Oe.open(j,[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearNoteConnectionWaypoints(fe.noteRef,fe.targetRef)},{type:"separator"},{caption:i.t("em.ctx.deleteConnection"),icon:"trash",danger:!0,handler:()=>i.removeNoteConnection(fe.noteRef,fe.targetRef)}]);return}const Te=[{caption:i.t("em.ctx.clearWaypoints"),icon:"route",handler:()=>i.clearWaypoints(F.id)}];i.isAssociationLocked(F.id)||Te.push({type:"separator"},{caption:i.t("em.ctx.deleteAssociation"),icon:"trash",danger:!0,handler:()=>i.removeAssociation(F.id)}),(ce=K.value)==null||ce.open(j,Te)}function Ge(B){return B==="group"?"group":B==="note"?"note":"entity"}function Xe({node:B}){if(oe.value.length>1){i.selection.value=null;return}i.selection.value={kind:Ge(B.type),id:B.id}}function Z({nodes:B}){B.length>1&&(i.selection.value=null)}function Rt({edge:B}){const F=S(B.id);i.selection.value=F?{kind:"note",id:F.noteRef}:{kind:"association",id:B.id}}function $t(B){const F=i.selection.value;return!!F&&F.kind!=="attribute"&&F.id===B.id}function Sn(B){var F,j;return $t(B)?B.type==="group"?"color-mix(in srgb, var(--em-selection) 22%, transparent)":"var(--em-selection)":B.type==="note"?"var(--em-note-soft)":B.type==="group"?Af(St((F=B.data)==null?void 0:F.style),!0)??"var(--em-mm-group)":Af(St((j=B.data)==null?void 0:j.style))??"var(--em-mm-entity)"}function At(B){return $t(B)?"var(--em-selection)":B.type==="note"?"var(--em-note-accent)":B.type==="group"?"var(--em-node-border)":"var(--em-on-surface-muted)"}function ge(B,F){A(B,F,{zoom:L().zoom,duration:350})}t.watch(()=>i.focusRequest.value,B=>{if(!B)return;const F=x(B.id);if(!F)return;const j=F.computedPosition??F.position,fe=F.dimensions??{width:0,height:0};ge(j.x+fe.width/2,j.y+fe.height/2)});function ft({position:B}){ge(B.x,B.y)}function xn({node:B}){i.selection.value={kind:Ge(B.type),id:B.id};const F=B.computedPosition??B.position,j=B.dimensions??{width:0,height:0};ge(F.x+j.width/2,F.y+j.height/2)}function Zt({node:B}){O({nodes:[B.id],duration:350,maxZoom:1.2,padding:.6})}return(B,F)=>(t.openBlock(),t.createElementBlock("div",{tabindex:"-1",class:t.normalizeClass(["em-canvas",{"is-connecting":u.value,"is-panning":m.value}])},[t.createVNode(t.unref(vw),{"min-zoom":.2,"max-zoom":2,"only-render-visible-elements":!be.value,"delete-key-code":null,"disable-keyboard-a11y":!0,"nodes-focusable":!1,"edges-focusable":!1,"nodes-draggable":t.unref(i).editable.value,"nodes-connectable":t.unref(i).editable.value,"connection-mode":t.unref(En).Loose,"pan-on-scroll":"","zoom-on-scroll":!1,"zoom-on-pinch":!0,"zoom-on-double-click":!1,"zoom-activation-key-code":["Meta","Control"],onMoveStart:re,onMoveEnd:Ke,onConnect:We,onConnectStart:F[1]||(F[1]=j=>u.value=!0),onConnectEnd:F[2]||(F[2]=j=>u.value=!1),onNodeDrag:qe,onNodeDragStop:nt,onNodeClick:Xe,onEdgeClick:Rt,onSelectionChange:Z,onPaneClick:F[3]||(F[3]=j=>t.unref(i).selection.value=null),onPaneContextMenu:bt,onNodeContextMenu:vt,onEdgeContextMenu:ot},{"node-group":t.withCtx(j=>[t.createVNode(cp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"node-entity":t.withCtx(j=>[t.createVNode(sp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"node-note":t.withCtx(j=>[t.createVNode(dp,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"edge-association":t.withCtx(j=>[t.createVNode($p,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),"edge-note-connection":t.withCtx(j=>[t.createVNode(AT,t.normalizeProps(t.guardReactiveProps(j)),null,16)]),default:t.withCtx(()=>[t.unref(i).showGrid.value?(t.openBlock(),t.createBlock(t.unref(bx),{key:0,gap:16,"pattern-color":"var(--em-border)"})):t.createCommentVNode("",!0),t.createVNode(t.unref(jx),{"show-interactive":!1,position:"bottom-left"},{default:t.withCtx(()=>[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(t.unref(ho),{class:"em-palette__group-start",title:t.unref(i).t("em.ctx.addEntity"),onClick:Fe},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"add-entity",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(ho),{title:t.unref(i).t("em.ctx.addNote"),onClick:se},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"note",size:14})]),_:1},8,["title"]),t.createVNode(t.unref(ho),{title:t.unref(i).t("em.palette.autoLayout"),onClick:F[0]||(F[0]=j=>t.unref(i).autoLayout())},{default:t.withCtx(()=>[t.createVNode(Ve,{name:"auto-layout",size:14})]),_:1},8,["title"])],64)):t.createCommentVNode("",!0)]),_:1}),t.unref(i).showMinimap.value?(t.openBlock(),t.createBlock(t.unref(CT),{key:1,pannable:"",width:224,height:160,"node-color":Sn,"node-stroke-color":At,"node-border-radius":4,"node-stroke-width":2,"mask-color":"var(--em-minimap-mask)","mask-stroke-color":"var(--em-accent)","mask-stroke-width":1.5,"mask-border-radius":4,"offset-scale":3,onClick:ft,onNodeClick:xn,onNodeDblclick:Zt})):t.createCommentVNode("",!0)]),_:1},8,["only-render-visible-elements","nodes-draggable","nodes-connectable","connection-mode"]),ye.value?(t.openBlock(),t.createElementBlock("div",kM,[t.unref(i).editable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("p",EM,t.toDisplayString(t.unref(i).t("em.canvas.emptyTitle")),1),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyHint")},null,8,NM),t.createElementVNode("p",{class:"em-canvas__empty-hint",innerHTML:t.unref(i).t("em.canvas.emptyConnectHint")},null,8,wM),t.createElementVNode("p",{class:"em-canvas__empty-hint em-canvas__empty-sub",innerHTML:t.unref(i).t("em.canvas.emptyShortcutHint")},null,8,IM)],64)):(t.openBlock(),t.createElementBlock("p",vM,t.toDisplayString(t.unref(i).t("em.canvas.emptyReadonly")),1))])):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createBlock(bM,{key:1,controller:t.unref(i),onClose:F[4]||(F[4]=j=>r.value=!1)},null,8,["controller"])):t.createCommentVNode("",!0),t.createVNode(t.Transition,{name:"em-conflict-fade"},{default:t.withCtx(()=>[d.value?(t.openBlock(),t.createElementBlock("div",CM,[t.createVNode(Ve,{name:"alert-triangle",size:16,class:"em-conflict-banner__icon"}),t.createElementVNode("div",SM,[t.createElementVNode("strong",xM,t.toDisplayString(d.value.title),1),t.createElementVNode("span",RM,t.toDisplayString(d.value.detail),1)])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(FT,{ref_key:"menuRef",ref:K,locale:t.unref(i).uiLocale.value},null,8,["locale"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.Transition,{name:"em-toast-fade"},{default:t.withCtx(()=>[l.value?(t.openBlock(),t.createElementBlock("div",AM,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)]),_:1})]))],2))}}),[["__scopeId","data-v-03d6bf61"]]),$M={class:"em-explorer em-scroll-overlay"},TM={class:"em-explorer__search"},MM=["placeholder","aria-label"],VM=["aria-label","title"],BM={key:0,class:"em-explorer__empty"},DM=["aria-label"],OM=["data-key","aria-level","aria-posinset","aria-setsize","aria-expanded","aria-selected","tabindex","onClick","onDblclick","onFocus","onKeydown"],LM=["onClick"],PM=["title"],zM={class:"em-key-slot"},FM={class:"em-key-slot"},UM={class:"em-explorer__label"},HM={key:2,class:"em-explorer__sr"},Mh=tt(t.defineComponent({__name:"DiagramExplorer",props:{controller:{},storageKey:{}},setup(e,{expose:n}){const o=e,i=o.controller,a=te.useModal(),r=t.computed(()=>{var Ae,Fe;const M=i.resolved.value,k=i.displayMode.value,v=i.userLanguage.value,I=se=>{var ne,ae,me;return Ji(k,se.name,(ae=(ne=se.table)==null?void 0:ne.logicalName)==null?void 0:ae[v],(me=se.table)==null?void 0:me.physicalName,i.t("em.node.logicalMissing"))},O=k==="PHYSICAL"||k==="LOGICAL_PHYSICAL",A=se=>{const ne=se.attrType.startsWith("RELATION")&&se.dbAttrs.length>0;return{icon:se.attrType.startsWith("RELATION")?"link":"field",keyMarks:{pk:se.identifier,fk:ne&&O}}},L=se=>se.attrType.startsWith("EMBED")&&se.dbAttrs.length>0,H=se=>L(se)||mn(se),oe=k==="PHYSICAL"||k==="LOGICAL_PHYSICAL",ue=(se,ne)=>{if(mn(se)){const me=i.state.logical.entities,P=me.find(D=>D.modelId===ne);return se.dbAttrs.map((D,z)=>{const Q=Kn(se,P,me,i.state.logical.associations,z);return Q?{...D,physicalName:D.physicalName||Q.physicalName,logicalName:D.logicalName??Q.logicalName,dataType:D.dataType||Q.dataType}:D})}if(se.attrType!=="EMBED_PREDEF")return se.dbAttrs;const ae=i.embeddableCatalog.value.find(me=>me.type===se.type);return ae?se.dbAttrs.map((me,P)=>{const D=ae.fields[P];return D?{...me,physicalName:me.physicalName||D.physicalName,logicalName:me.logicalName??D.logicalName,dataType:me.dataType||D.dataType,length:me.length??D.length}:me}):se.dbAttrs},be=(se,ne,ae)=>{var z,Q,ee,we,de,xe,Ce,Y,X;const me={entityId:ne,attrId:se.modelId};if(H(se)){const q=Yr(k,se,ae==null?void 0:ae.collection,ae==null?void 0:ae.targetName);return{key:`attr:${se.modelId}`,label:se.name+(q?` : ${q}`:""),icon:"table",attrRef:me,focusId:ne,matchText:Zo(se.name,(Q=(z=se.dbAttrs[0])==null?void 0:z.logicalName)==null?void 0:Q[v],(ee=se.dbAttrs[0])==null?void 0:ee.physicalName),children:oe?ue(se,ne).map(Ie=>{var Be,ze;return{key:`attr:${se.modelId}:col:${Ie.modelId}`,label:Ji(k,Ie.physicalName,(Be=Ie.logicalName)==null?void 0:Be[v],Ie.physicalName,i.t("em.node.logicalMissing"))+(Ie.dataType?` : ${Ie.dataType}`:""),icon:"field",attrRef:me,focusId:ne,matchText:Zo(Ie.physicalName,(ze=Ie.logicalName)==null?void 0:ze[v]),children:[]}}):[]}}const P=(ae==null?void 0:ae.collection)??na(se,i.state.logical.associations),D=Yr(k,se,P,ae==null?void 0:ae.targetName);return{key:`attr:${se.modelId}`,label:Ji(k,se.name,(de=(we=se.dbAttrs[0])==null?void 0:we.logicalName)==null?void 0:de[v],(xe=se.dbAttrs[0])==null?void 0:xe.physicalName,i.t("em.node.logicalMissing"))+(D?` : ${D}`:""),...A(se),attrRef:me,focusId:ne,matchText:Zo(se.name,(Y=(Ce=se.dbAttrs[0])==null?void 0:Ce.logicalName)==null?void 0:Y[v],(X=se.dbAttrs[0])==null?void 0:X.physicalName),children:[]}},pe=se=>{var Q,ee,we;const ne=se.entity,ae=k==="CLASS",P=ae||ne.attributes.some(mn)?ll(ne,i.state.logical):void 0,D=ae&&P?P.fields.map(de=>de.attr):[...ne.attributes].sort((de,xe)=>de.order-xe.order),z=new Map(((P==null?void 0:P.fields)??[]).filter(de=>(ae||mn(de.attr))&&(de.target||de.collection)).map(de=>{var xe;return[de.attr.modelId,{targetName:(xe=de.target)==null?void 0:xe.name,collection:de.collection}]}));return{key:`entity:${ne.modelId}`,label:I(ne),icon:"table",selectKind:"entity",selectId:ne.modelId,focusId:ne.modelId,matchText:Zo(ne.name,(ee=(Q=ne.table)==null?void 0:Q.logicalName)==null?void 0:ee[v],(we=ne.table)==null?void 0:we.physicalName),children:D.map(de=>be(de,ne.modelId,z.get(de.modelId)))}},he=new Map,_e=[];for(const se of M.entities)if(se.groupRef){const ne=he.get(se.groupRef)??[];ne.push(se),he.set(se.groupRef,ne)}else _e.push(se);const ye=[];for(const se of M.groups){const ne=se.group;ye.push({key:`group:${ne.modelId}`,label:((Ae=ne.name)==null?void 0:Ae[v])||((Fe=ne.name)==null?void 0:Fe.ko)||ne.packageName||i.t("em.explorer.groupFallback"),icon:"folder",focusId:ne.modelId,children:(he.get(ne.modelId)??[]).map(pe)})}for(const se of _e)ye.push(pe(se));if(M.associations.length){const se=new Map(M.entities.map(ne=>[ne.entity.modelId,I(ne.entity)]));ye.push({key:"section:associations",label:i.t("em.explorer.associations",{n:M.associations.length}),icon:"arrow-lr",children:M.associations.map(ne=>{const ae=ne.association,me=se.get(ae.end1.entityRef)??ae.end1.entityRef,P=se.get(ae.end2.entityRef)??ae.end2.entityRef;return{key:`assoc:${ae.modelId}`,label:`${me} — ${P}`,icon:"arrow-lr",selectKind:"association",selectId:ae.modelId,children:[]}})})}return M.notes.length&&ye.push({key:"section:notes",label:i.t("em.explorer.notes",{n:M.notes.length}),icon:"note",children:M.notes.map(({note:se})=>{var ne;return{key:`note:${se.modelId}`,label:((ne=se.memo.split(`
|
|
66
|
+
`)[0])==null?void 0:ne.slice(0,30))||i.t("em.explorer.emptyNote"),icon:"note",selectKind:"note",selectId:se.modelId,focusId:se.modelId,children:[]}})}),{key:"root",label:i.state.layout.name||i.t("em.explorer.diagram"),icon:"network",children:ye}});function l(M){return M?M.pk&&M.fk?i.t("em.node.keyPfk"):M.pk?i.t("em.node.keyPk"):M.fk?i.t("em.node.keyFk"):"":""}const s=t.computed(()=>{const M=[],k=v=>{if(v.children.length){v.key!=="root"&&M.push(v.key);for(const I of v.children)k(I)}};return k(r.value),M}),c=M=>M.startsWith("entity:")||M==="section:associations",{isCollapsed:d,toggle:u,toggleAll:m,allExpanded:p}=Ch({expandableKeys:()=>s.value,defaultCollapsed:c,storageKey:o.storageKey,scope:()=>i.state.layout.diagramId}),f=t.ref(""),y=t.ref(null),_=t.computed(()=>f.value.trim().length>0),g=t.computed(()=>{const M=[];if(_.value){const v=oM(r.value,f.value.trim().toLowerCase()),I=(O,A,L,H,oe)=>{if(!v.has(O.key))return;M.push({node:O,depth:A,parentKey:L,posinset:H,setsize:oe});const ue=O.children.filter(be=>v.has(be.key));ue.forEach((be,pe)=>I(be,A+1,O.key,pe+1,ue.length))};return I(r.value,0,null,1,1),M}const k=(v,I,O,A,L)=>{M.push({node:v,depth:I,parentKey:O,posinset:A,setsize:L}),d(v.key)||v.children.forEach((H,oe)=>k(H,I+1,v.key,oe+1,v.children.length))};return k(r.value,0,null,1,1),M}),b=t.ref(null),E=t.ref(null),h=t.computed(()=>{var k;const M=g.value;return E.value&&M.some(v=>v.node.key===E.value)?E.value:((k=M[0])==null?void 0:k.node.key)??null}),N=M=>!_.value&&d(M);async function w(M){var k,v;M&&(E.value=M,await t.nextTick(),(v=(k=b.value)==null?void 0:k.querySelector(`[data-key="${M}"]`))==null||v.focus())}function C(M,k){var O,A,L,H,oe;const v=g.value,I=v.findIndex(ue=>ue.node.key===k.node.key);switch(M.key){case"ArrowDown":M.preventDefault(),w((O=v[I+1])==null?void 0:O.node.key);return;case"ArrowUp":M.preventDefault(),w((A=v[I-1])==null?void 0:A.node.key);return;case"Home":M.preventDefault(),w((L=v[0])==null?void 0:L.node.key);return;case"End":M.preventDefault(),w((H=v[v.length-1])==null?void 0:H.node.key);return;case"ArrowRight":if(M.preventDefault(),!k.node.children.length)return;N(k.node.key)?u(k.node.key):w((oe=v[I+1])==null?void 0:oe.node.key);return;case"ArrowLeft":M.preventDefault(),k.node.children.length&&!N(k.node.key)?u(k.node.key):w(k.parentKey);return;case"Enter":case" ":M.preventDefault(),x(k.node,M);return;case"F2":M.preventDefault(),T(k.node)}}const S=t.computed(()=>_.value&&g.value.length<=1);function V(M){var I;if(M.key!=="/"||M.metaKey||M.ctrlKey||M.altKey||M.shiftKey)return;const k=M.target,v=k==null?void 0:k.tagName;v==="INPUT"||v==="TEXTAREA"||v==="SELECT"||k!=null&&k.isContentEditable||(M.preventDefault(),(I=y.value)==null||I.focus())}t.onMounted(()=>window.addEventListener("keydown",V)),t.onBeforeUnmount(()=>window.removeEventListener("keydown",V)),n({toggleAll:m,allExpanded:p,hasExpandable:t.computed(()=>s.value.length>0)});function $(M){const k=i.selection.value;return M.attrRef?(k==null?void 0:k.kind)==="attribute"&&k.entityId===M.attrRef.entityId&&k.ids.includes(M.attrRef.attrId):!!k&&k.kind!=="attribute"&&!!M.selectId&&M.selectKind===k.kind&&M.selectId===k.id}function R(M){const k=i.selection.value;return M.selectKind==="entity"&&(k==null?void 0:k.kind)==="attribute"&&k.entityId===M.selectId}function x(M,k){if(M.attrRef){const v=k.shiftKey?"range":k.metaKey||k.ctrlKey?"toggle":"replace";i.selectAttribute(M.attrRef.entityId,M.attrRef.attrId,v)}else M.selectKind&&M.selectId&&(i.selection.value={kind:M.selectKind,id:M.selectId});M.focusId&&i.requestFocus(M.focusId)}function T(M){M.selectKind==="entity"&&M.selectId&&lr(a,i,M.selectId)}return(M,k)=>(t.openBlock(),t.createElementBlock("section",$M,[t.createElementVNode("div",TM,[t.createVNode(Ve,{name:"search",size:14,class:"em-explorer__search-icon"}),t.withDirectives(t.createElementVNode("input",{ref_key:"searchInput",ref:y,"onUpdate:modelValue":k[0]||(k[0]=v=>f.value=v),class:"em-explorer__search-input",type:"text",placeholder:t.unref(i).t("em.explorer.searchPlaceholder"),"aria-label":t.unref(i).t("em.explorer.searchAria"),onKeydown:k[1]||(k[1]=t.withKeys(v=>f.value="",["esc"]))},null,40,MM),[[t.vModelText,f.value]]),f.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-explorer__search-clear","aria-label":t.unref(i).t("em.explorer.clearSearchAria"),title:t.unref(i).t("em.explorer.clearSearchTitle"),onClick:k[2]||(k[2]=v=>f.value="")},[t.createVNode(Ve,{name:"x",size:13})],8,VM)):t.createCommentVNode("",!0)]),S.value?(t.openBlock(),t.createElementBlock("p",BM,t.toDisplayString(t.unref(i).t("em.explorer.noMatches")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"rowsEl",ref:b,class:"em-explorer__rows",role:"tree","aria-label":t.unref(i).t("em.explorer.treeAria")},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,v=>(t.openBlock(),t.createElementBlock("div",{key:v.node.key,class:t.normalizeClass(["em-explorer__row",{"is-active":$(v.node),"is-focus-parent":R(v.node),"is-selectable":!!v.node.selectKind||!!v.node.attrRef||!!v.node.focusId}]),"data-key":v.node.key,role:"treeitem","aria-level":v.depth+1,"aria-posinset":v.posinset,"aria-setsize":v.setsize,"aria-expanded":v.node.children.length?!N(v.node.key):void 0,"aria-selected":$(v.node),tabindex:v.node.key===h.value?0:-1,style:t.normalizeStyle({paddingLeft:4+v.depth*14+"px"}),onClick:I=>x(v.node,I),onDblclick:I=>T(v.node),onFocus:I=>E.value=v.node.key,onKeydown:I=>C(I,v)},[t.createElementVNode("span",{class:t.normalizeClass(["em-explorer__chevron",{"is-leaf":!v.node.children.length,"is-open":!N(v.node.key)}]),onClick:t.withModifiers(I=>v.node.children.length&&t.unref(u)(v.node.key),["stop"])},[v.node.children.length?(t.openBlock(),t.createBlock(Ve,{key:0,name:"chevron",size:14})):t.createCommentVNode("",!0)],10,LM),v.node.keyMarks?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-explorer__keys",title:l(v.node.keyMarks),"aria-hidden":"true"},[t.createElementVNode("span",zM,[v.node.keyMarks.pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-pk"})):v.node.keyMarks.fk?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(Ve,{key:1,class:"em-explorer__icon",name:v.node.icon,size:14},null,8,["name"]))]),t.createElementVNode("span",FM,[v.node.keyMarks.fk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:14,class:"em-key is-fk"})):t.createCommentVNode("",!0)])],8,PM)):(t.openBlock(),t.createBlock(Ve,{key:1,class:"em-explorer__icon",name:v.node.icon,size:15},null,8,["name"])),t.createElementVNode("span",UM,t.toDisplayString(v.node.label),1),l(v.node.keyMarks)?(t.openBlock(),t.createElementBlock("span",HM,t.toDisplayString(l(v.node.keyMarks)),1)):t.createCommentVNode("",!0)],46,OM))),128))],8,DM)]))}}),[["__scopeId","data-v-63b45532"]]),jM={class:"em-text-export"},KM=["id","aria-selected","tabindex","onClick"],GM=["aria-labelledby"],YM={class:"em-text-export__actions"},qM=tt(t.defineComponent({__name:"TextExportModal",props:{formats:{},title:{},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(m,p)=>qt(n.locale??"ko",m,p),a=t.ref(0);function r(){return n.formats[a.value]??n.formats[0]}const l=t.ref(null);async function s(m){var p,f;a.value=m,await t.nextTick(),(f=(p=l.value)==null?void 0:p.querySelectorAll('[role="tab"]')[m])==null||f.focus()}function c(m){const p=n.formats.length;p&&s((a.value+m+p)%p)}async function d(){try{await navigator.clipboard.writeText(r().content),te.showNotification(i("em.export.copied"),"info")}catch{te.showNotification(i("em.export.copyFailed"),"error")}}function u(){const m=r(),p=new Blob([m.content],{type:"text/plain;charset=utf-8"}),f=URL.createObjectURL(p);try{const y=document.createElement("a");y.href=f,y.download=m.filename,document.body.appendChild(y),y.click(),y.remove()}finally{URL.revokeObjectURL(f)}}return(m,p)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:n.title??i("em.export.title")},{default:t.withCtx(()=>[t.createElementVNode("div",jM,[n.formats.length>1?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tabsEl",ref:l,class:"em-text-export__tabs",role:"tablist"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.formats,(f,y)=>(t.openBlock(),t.createElementBlock("button",{id:`em-text-export-tab-${y}`,key:f.key,type:"button",role:"tab",class:t.normalizeClass(["em-text-export__tab",{"is-active":y===a.value}]),"aria-selected":y===a.value,"aria-controls":"em-text-export-panel",tabindex:y===a.value?0:-1,onClick:_=>a.value=y,onKeydown:[p[0]||(p[0]=t.withKeys(t.withModifiers(_=>c(-1),["prevent"]),["left"])),p[1]||(p[1]=t.withKeys(t.withModifiers(_=>c(1),["prevent"]),["right"])),p[2]||(p[2]=t.withKeys(t.withModifiers(_=>s(0),["prevent"]),["home"])),p[3]||(p[3]=t.withKeys(t.withModifiers(_=>s(n.formats.length-1),["prevent"]),["end"]))]},t.toDisplayString(f.label),43,KM))),128))],512)):t.createCommentVNode("",!0),t.createElementVNode("pre",{id:"em-text-export-panel",class:"em-text-export__pre",role:"tabpanel",tabindex:"0","aria-labelledby":n.formats.length>1?`em-text-export-tab-${a.value}`:void 0},t.toDisplayString(r().content),9,GM),t.createElementVNode("div",YM,[t.createVNode(t.unref(te.BSButton),{caption:i("em.export.copy"),onClick:d},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{caption:i("em.export.download"),onClick:u},null,8,["caption"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:p[4]||(p[4]=f=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-74551f98"]]),WM={class:"em-text-import"},JM=["aria-label"],XM=["aria-checked","tabindex","onClick"],ZM=["placeholder"],QM={class:"em-text-import__status"},e2={class:"em-text-import__ok"},t2={key:0,class:"em-text-import__warn"},n2={key:1,class:"em-text-import__err"},o2={key:2,class:"em-text-import__err"},i2={key:3,class:"em-text-import__err"},a2={class:"em-text-import__actions"},r2=tt(t.defineComponent({__name:"TextImportModal",props:{onImport:{type:Function},locale:{}},setup(e){const n=e,o=te.useModalHandle(),i=(_,g)=>qt(n.locale??"ko",_,g),a=t.ref(""),r=t.ref("auto"),l=[{key:"auto",labelKey:"em.import.formatAuto"},{key:"mermaid",labelKey:"em.import.formatMermaid"},{key:"ddl",labelKey:"em.import.formatDdl"},{key:"json",labelKey:"em.import.formatJson"}],s=t.ref(null);async function c(_){var b,E;const g=l[(_+l.length)%l.length];g&&(r.value=g.key,await t.nextTick(),(E=(b=s.value)==null?void 0:b.querySelectorAll('[role="radio"]')[l.indexOf(g)])==null||E.focus())}function d(_){c(l.findIndex(g=>g.key===r.value)+_)}function u(_){return _?_.startsWith("{")?"json":/\berdiagram\b/i.test(_)?"mermaid":/\bcreate\s+table\b/i.test(_)?"ddl":null:null}const m=t.computed(()=>r.value==="auto"?u(a.value.trim()):r.value),p=t.computed(()=>{const _=a.value.trim();if(!_)return{status:"empty"};const g=m.value;if(!g)return{status:"unknown"};try{let b,E=[];return g==="json"?b=Rc(_):g==="mermaid"?b=Ec(_):(b=vc(_),E=qr(_).warnings),b.logical.entities.length===0?{status:"emptyParse"}:{status:"ok",source:b,warnings:E}}catch(b){return{status:"error",message:b instanceof Error?b.message:String(b)}}}),f=t.computed(()=>p.value.status==="ok");function y(){const _=p.value;_.status!=="ok"||!_.source||(n.onImport(_.source),o.close())}return(_,g)=>(t.openBlock(),t.createBlock(t.unref(te.BSModalFrame),{title:i("em.import.title")},{default:t.withCtx(()=>[t.createElementVNode("div",WM,[t.createElementVNode("div",{ref_key:"fmtEl",ref:s,class:"em-text-import__formats",role:"radiogroup","aria-label":i("em.import.formatGroup")},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(l,b=>t.createElementVNode("button",{key:b.key,type:"button",role:"radio",class:t.normalizeClass(["em-text-import__fmt",{"is-active":b.key===r.value}]),"aria-checked":b.key===r.value,tabindex:b.key===r.value?0:-1,onClick:E=>r.value=b.key,onKeydown:[g[0]||(g[0]=t.withKeys(t.withModifiers(E=>d(-1),["prevent"]),["left"])),g[1]||(g[1]=t.withKeys(t.withModifiers(E=>d(1),["prevent"]),["right"])),g[2]||(g[2]=t.withKeys(t.withModifiers(E=>c(0),["prevent"]),["home"])),g[3]||(g[3]=t.withKeys(t.withModifiers(E=>c(l.length-1),["prevent"]),["end"]))]},t.toDisplayString(i(b.labelKey)),43,XM)),64))],8,JM),t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":g[4]||(g[4]=b=>a.value=b),class:"em-text-import__input",placeholder:i("em.import.placeholder"),spellcheck:"false"},null,8,ZM),[[t.vModelText,a.value]]),t.createElementVNode("div",QM,[p.value.status==="ok"&&p.value.source?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("span",e2,t.toDisplayString(i("em.import.detected",{format:i(`em.import.format${m.value==="json"?"Json":m.value==="ddl"?"Ddl":"Mermaid"}`)}))+" · "+t.toDisplayString(i("em.import.summary",{entities:p.value.source.logical.entities.length,relations:p.value.source.logical.associations.length})),1),p.value.warnings&&p.value.warnings.length?(t.openBlock(),t.createElementBlock("span",t2," ⚠ "+t.toDisplayString(i("em.import.warnings",{n:p.value.warnings.length})),1)):t.createCommentVNode("",!0)],64)):p.value.status==="error"?(t.openBlock(),t.createElementBlock("span",n2,t.toDisplayString(i("em.import.error",{message:p.value.message??""})),1)):p.value.status==="unknown"?(t.openBlock(),t.createElementBlock("span",o2,t.toDisplayString(i("em.import.unknownFormat")),1)):p.value.status==="emptyParse"?(t.openBlock(),t.createElementBlock("span",i2,t.toDisplayString(i("em.import.emptyParse")),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",a2,[t.createVNode(t.unref(te.BSButton),{caption:i("em.import.confirm"),disabled:!f.value,onClick:y},null,8,["caption","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:i("em.common.close"),onClick:g[5]||(g[5]=b=>t.unref(o).close())},null,8,["caption"])])])]),_:1},8,["title"]))}}),[["__scopeId","data-v-1059c939"]]),l2={class:"em-toolbar"},s2=["title"],c2={class:"em-toolbar__mode"},Vh=tt(t.defineComponent({__name:"EditorToolbar",props:{controller:{},historyOpen:{type:Boolean}},emits:["exportSvg","exportPng","toggleHistory"],setup(e,{emit:n}){const i=e.controller,a=n,r=te.useModal(),l=[{v:"LOGICAL",labelKey:"em.displayMode.logical"},{v:"PHYSICAL",labelKey:"em.displayMode.physical"},{v:"LOGICAL_PHYSICAL",labelKey:"em.displayMode.logicalPhysical"},{v:"CLASS",labelKey:"em.displayMode.class"}],s=t.computed({get:()=>i.displayMode.value,set:y=>i.displayMode.value=y});function c(){i.routingMode.value=i.routingMode.value==="straight"?"orthogonal":"straight"}const d=t.computed(()=>{const y=i.resolved.value.entities;return y.length>0&&y.every(_=>_.collapsed)});function u(){d.value?i.expandAll():i.collapseAll()}function m(){const y=zr(i.state.logical,i.referenceOnlyDocument.value);r.openModal({component:qM,bind:{title:i.t("em.toolbar.exportText"),locale:i.uiLocale.value,formats:[{key:"text",label:i.t("em.export.formatText"),content:lc(y,{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.txt"},{key:"mermaid-er",label:i.t("em.export.formatMermaidEr"),content:Fr(y,"er",{embeddableCatalog:i.embeddableCatalog.value}),filename:"diagram.er.mmd"},{key:"mermaid-class",label:i.t("em.export.formatMermaidClass"),content:Fr(y,"class"),filename:"diagram.class.mmd"},{key:"ddl",label:i.t("em.export.formatDdl"),content:Cc(y,"postgres",{embeddableCatalog:i.embeddableCatalog.value}),filename:"schema.sql"},{key:"json",label:i.t("em.export.formatJson"),content:xc(y,i.state.layout),filename:"diagram.json"}]}})}function p(){r.openModal({component:r2,bind:{locale:i.uiLocale.value,onImport:y=>{i.importEntities(y,y.logical.entities.map(_=>_.modelId))}}})}function f(){r.openModal({component:$h,bind:{locale:i.uiLocale.value}})}return(y,_)=>(t.openBlock(),t.createElementBlock("div",l2,[t.unref(i).referenceOnlyDocument.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"em-toolbar__refonly",title:t.unref(i).t("em.toolbar.referenceOnlyDocHint")},t.toDisplayString(t.unref(i).t("em.toolbar.referenceOnlyBadge")),9,s2)):t.createCommentVNode("",!0),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.undo"),disabled:!t.unref(i).canUndo.value||!t.unref(i).editable.value,onClick:_[0]||(_[0]=g=>t.unref(i).undo())},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"undo",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.redo"),disabled:!t.unref(i).canRedo.value||!t.unref(i).editable.value,onClick:_[1]||(_[1]=g=>t.unref(i).redo())},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"redo",size:16})]),_:1},8,["tooltip","disabled"]),_[9]||(_[9]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createElementVNode("label",c2,[t.createTextVNode(t.toDisplayString(t.unref(i).t("em.toolbar.displayLabel"))+" ",1),t.createVNode(t.unref(te.BSSelect),{modelValue:s.value,"onUpdate:modelValue":_[2]||(_[2]=g=>s.value=g),items:l,"value-provider":g=>g.v,"label-provider":g=>t.unref(i).t(g.labelKey)},null,8,["modelValue","value-provider","label-provider"])]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(i).t(t.unref(i).routingMode.value==="orthogonal"?"em.toolbar.routingOrthogonal":"em.toolbar.routingStraight"),tooltip:t.unref(i).t("em.toolbar.routingToggle"),onClick:c},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"route",size:16})]),_:1},8,["caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showGrid.value}]),caption:t.unref(i).t("em.toolbar.grid"),tooltip:t.unref(i).t(t.unref(i).showGrid.value?"em.toolbar.gridOff":"em.toolbar.gridOn"),onClick:_[3]||(_[3]=g=>t.unref(i).showGrid.value=!t.unref(i).showGrid.value)},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"grid",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":t.unref(i).showMinimap.value}]),caption:t.unref(i).t("em.toolbar.minimap"),tooltip:t.unref(i).t(t.unref(i).showMinimap.value?"em.toolbar.minimapOff":"em.toolbar.minimapOn"),onClick:_[4]||(_[4]=g=>t.unref(i).showMinimap.value=!t.unref(i).showMinimap.value)},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"map",size:16})]),_:1},8,["class","caption","tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(i).t(d.value?"em.panel.expandAll":"em.panel.collapseAll"),disabled:!t.unref(i).editable.value,onClick:u},{left:t.withCtx(()=>[t.createVNode(Ve,{name:d.value?"expand-all":"collapse-all",size:16},null,8,["name"])]),_:1},8,["caption","disabled"]),_[10]||(_[10]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1)),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.import"),disabled:!t.unref(i).editable.value,onClick:p},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"clipboard",size:16})]),_:1},8,["tooltip","disabled"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportText"),onClick:m},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"file-text",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportSvg"),onClick:_[5]||(_[5]=g=>a("exportSvg"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"image",size:16})]),_:1},8,["tooltip"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn",tooltip:t.unref(i).t("em.toolbar.exportPng"),onClick:_[6]||(_[6]=g=>a("exportPng"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"camera",size:16})]),_:1},8,["tooltip"]),_[11]||(_[11]=t.createElementVNode("span",{class:"em-toolbar__spacer"},null,-1)),t.unref(i).historyAvailable.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:t.normalizeClass(["em-toolbar__toggle",{"is-active":e.historyOpen}]),caption:t.unref(i).t("em.toolbar.history"),tooltip:t.unref(i).t(e.historyOpen?"em.toolbar.historyClose":"em.toolbar.historyOpen"),onClick:_[7]||(_[7]=g=>a("toggleHistory"))},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"history",size:16})]),_:1},8,["class","caption","tooltip"]),_[8]||(_[8]=t.createElementVNode("span",{class:"em-toolbar__sep"},null,-1))],64)):t.createCommentVNode("",!0),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-toolbar__icon-btn em-toolbar__help",tooltip:t.unref(i).t("em.toolbar.shortcuts"),onClick:f},{left:t.withCtx(()=>[t.createVNode(Ve,{name:"help",size:16})]),_:1},8,["tooltip"])]))}}),[["__scopeId","data-v-ba562aa2"]]),d2=["title"],u2=["title"],m2=["disabled","aria-pressed"],f2=["disabled","aria-pressed"],p2=tt(t.defineComponent({__name:"EditModeToggle",props:{editable:{type:Boolean},opMode:{type:Boolean},frozen:{type:Boolean},locale:{}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=l=>qt(o.locale??"ko",l);function r(l){o.frozen||!o.opMode||l!==o.editable&&i("toggle")}return(l,s)=>e.frozen?(t.openBlock(),t.createElementBlock("div",{key:0,class:"em-mode-toggle em-mode-frozen",role:"status",title:a("em.mode.frozenTitle")},[t.createVNode(Ve,{name:"lock",size:14}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.frozen")),1)],8,d2)):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-mode-toggle em-mode-segment",{"is-readonly":!e.opMode}]),role:"group",title:e.opMode?void 0:a("em.mode.readonlyTitle")},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":!e.editable}]),disabled:!e.opMode,"aria-pressed":!e.editable,onClick:s[0]||(s[0]=c=>r(!1))},[t.createVNode(Ve,{name:"eye",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.view")),1)],10,m2),t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-seg",{"is-active":e.editable}]),disabled:!e.opMode,"aria-pressed":e.editable,onClick:s[1]||(s[1]=c=>r(!0))},[t.createVNode(Ve,{name:"pencil",size:13}),t.createElementVNode("span",null,t.toDisplayString(a("em.mode.edit")),1)],10,f2)],10,u2))}}),[["__scopeId","data-v-2b5162b7"]]),h2=["disabled"],y2={class:"em-panel__sub"},g2={class:"em-nav"},b2={key:0,class:"em-nav__divider","aria-hidden":"true"},_2={key:1},k2=["onClick","onKeydown"],E2={class:"em-nav__name"},N2=["title"],w2={key:0,class:"em-panel__note"},I2=["data-attr-block"],v2={key:0,class:"em-embed-col__label"},C2={class:"em-attr__row"},S2=["title"],x2={key:1,class:"em-attr__row"},R2={key:2,class:"em-embed-cols"},A2={class:"em-embed-col"},$2={class:"em-embed-col__label"},T2={class:"em-attr__row"},M2={class:"em-attr__navhint"},V2={key:3,class:"em-attr__navhint"},B2={key:0,class:"em-attr__navhint"},D2={class:"em-attr__row"},O2={class:"em-attr__row"},L2=["title"],P2={class:"em-attr__flags"},z2={class:"em-attr__pii"},F2={class:"em-attr__pii"},U2={key:1,class:"em-attr__pii"},H2={key:2,class:"em-attr__pii em-attr__codetop"},j2={class:"em-multilang"},K2={key:5,class:"em-embed-cols"},G2={key:0,class:"em-attr__navhint"},Y2={class:"em-embed-col__label"},q2={class:"em-attr__row"},W2=["title"],J2=["title"],X2=["title"],Z2={class:"em-attr__row"},Q2={key:0,class:"em-embed-upd"},eV={key:1,class:"em-attr__navhint"},tV={class:"em-embed-upd"},nV={class:"em-embed-upd"},oV={class:"em-attr__flags"},iV={class:"em-multilang"},aV={class:"em-swatch__row em-attr__swatch"},rV=["title","onClick"],lV=["title","onClick"],sV={key:0,class:"em-attr__swatch-hint"},cV=tt(t.defineComponent({__name:"EntityColumnsSection",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,isDerivedIdRow:u,rowName:m,rowNamePlaceholder:p,setRowName:f,assocFieldName:y,setAssocFieldName:_,nameLocked:g,nameLockedHint:b,isManagedFk:E,setNaturalId:h,setIdentifier:N,setTransient:w,dbLocked:C,fkDerived:S,fkOriginPhysical:V,typeValueOf:$,typeLabelOf:R,setAttrType:x,setAttrCustomType:T,setDb:M,scaleApplicable:k,scaleHint:v,setDbLogical:I,setAttrDescription:O,attrPiiValue:A,setAttrPii:L,predefinedCustomTypeCatalog:H,embeddableCatalog:oe,predefinedLabel:ue,groupCodeCatalog:be,attrGroupCodes:pe,attrCodeItems:he,codeValueOf:_e,codeLabelOf:ye,setAttrGroupCode:Ae,setAttrCode:Fe,setAttrDefaultValue:se,hasColumnSlots:ne,isMultiColFk:ae,setDbAt:me,setDbLogicalAt:P,colSlotMeta:D,fixedDataType:z,fixedLength:Q,fixedScale:ee,slotFixedHint:we,updatableItems:de,updatableLabel:xe,updatableValue:Ce,setUpdatableAt:Y,setUpdatable:X,insertableItems:q,insertableLabel:Ie,insertableValue:Be,setInsertableAt:ze,setInsertable:Ue,sharedItems:ie,sharedLabel:Se,sharedValue:je,setSharedAt:Ze,isShared:J,sharedPhysical:re}=Vf(o,()=>n.entityId),Ke=t.computed(()=>i.value?o.state.layout.entityLayouts.find(Ge=>Ge.entityRef===i.value.modelId)??null:null),st=t.computed(()=>{var Ge;return((Ge=i.value)==null?void 0:Ge.attributes.filter(Xe=>Xe.attrType!=="DIVIDER"))??[]}),qe=t.computed(()=>{var Ge;return((Ge=i.value)==null?void 0:Ge.attributes)??[]}),nt=t.computed(()=>st.value.filter(Ge=>r.value.has(Ge.modelId)));function We(Ge){return{pk:Ge.identifier,fk:Ge.attrType.startsWith("RELATION")&&Ge.dbAttrs.length>0,required:Ge.notNull&&!Ge.identifier}}function K(Ge){const Xe=We(Ge),Z=[Xe.pk&&"PK",Xe.fk&&"FK",Xe.required&&"NOT NULL"].filter(Boolean);return Z.length?Z.join(" · "):void 0}function le(Ge,Xe){i.value&&o.selectAttribute(i.value.modelId,Ge.modelId,Xe.shiftKey?"range":Xe.metaKey||Xe.ctrlKey?"toggle":"replace")}function Re(Ge){var Xe,Z;return St((Z=(Xe=Ke.value)==null?void 0:Xe.attributeStyles)==null?void 0:Z[Ge.modelId])}function ke(Ge){return r.value.size>1&&r.value.has(Ge.modelId)}function U(Ge,Xe){if(!i.value)return;const Z=ke(Ge)?o.selectedAttrIds.value:[Ge.modelId];o.setAttributeSwatches(i.value.modelId,Z,Xe)}const bt=t.ref(void 0);function vt(Ge){if(!Ge||!i.value)return;const Xe=o.addPredefinedEmbed(i.value.modelId,Ge);Xe&&o.selectAttribute(i.value.modelId,Xe),bt.value=void 0}function ot(){if(!i.value)return;const Ge=o.addAttribute(i.value.modelId);Ge&&o.selectAttribute(i.value.modelId,Ge)}return(Ge,Xe)=>t.unref(i)?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(o).editable.value},[t.createElementVNode("h4",y2,[t.createTextVNode(t.toDisplayString(t.unref(o).t("em.attr.section",{n:st.value.length}))+" ",1),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(o).t("em.common.add"),onClick:ot},null,8,["caption"]),t.unref(oe).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"120px",placeholder:t.unref(o).t("em.attr.addEmbeddable"),"model-value":bt.value,items:t.unref(oe),"value-provider":Z=>Z.type,"label-provider":t.unref(ue),"onUpdate:modelValue":vt},null,8,["placeholder","model-value","items","value-provider","label-provider"])):t.createCommentVNode("",!0)]),t.createElementVNode("ul",g2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(qe.value,Z=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Z.modelId},[Z.attrType==="DIVIDER"?(t.openBlock(),t.createElementBlock("li",b2,[...Xe[0]||(Xe[0]=[t.createElementVNode("hr",null,null,-1)])])):(t.openBlock(),t.createElementBlock("li",_2,[t.createElementVNode("div",{class:t.normalizeClass(["em-nav__item",{"is-selected":t.unref(r).has(Z.modelId)}]),role:"button",tabindex:"0",onClick:Rt=>le(Z,Rt),onKeydown:[t.withKeys(t.withModifiers(Rt=>le(Z,Rt),["prevent"]),["enter"]),t.withKeys(t.withModifiers(Rt=>le(Z,Rt),["prevent"]),["space"])]},[t.createElementVNode("span",E2,t.toDisplayString(Z.name||t.unref(o).t("em.attr.nameless")),1),t.createElementVNode("span",{class:"em-nav__marks",title:K(Z)},[We(Z).pk?(t.openBlock(),t.createBlock(Ve,{key:0,name:"key",size:12,class:"em-nav-key is-pk"})):We(Z).required?(t.openBlock(),t.createBlock(Ve,{key:1,name:"asterisk",size:14,class:"em-nav-key is-required"})):t.createCommentVNode("",!0),We(Z).fk?(t.openBlock(),t.createBlock(Ve,{key:2,name:"key",size:12,class:"em-nav-key is-fk"})):t.createCommentVNode("",!0)],8,N2)],42,k2)]))],64))),128))]),st.value.length&&!nt.value.length?(t.openBlock(),t.createElementBlock("p",w2,t.toDisplayString(t.unref(o).t("em.attr.selectHint")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(nt.value,Z=>{var Rt,$t,Sn,At,ge,ft,xn,Zt,B,F;return t.openBlock(),t.createElementBlock("div",{key:Z.modelId,class:t.normalizeClass(["em-attr",{"is-focused":t.unref(r).has(Z.modelId)}]),"data-attr-block":Z.modelId},[t.unref(u)(Z)?(t.openBlock(),t.createElementBlock("span",v2,t.toDisplayString(t.unref(o).t("em.attr.derivedIdField")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",C2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-name-${Z.modelId}`,width:"100%",disabled:t.unref(g)(Z),title:t.unref(g)(Z)?t.unref(b)(Z):t.unref(u)(Z)?t.unref(o).t("em.attr.derivedIdNote"):void 0,placeholder:t.unref(p)(Z),"model-value":t.unref(m)(Z),"onUpdate:modelValue":j=>t.unref(f)(Z,j)},null,8,["name","disabled","title","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{name:`attr-type-${Z.modelId}`,width:"84px",placeholder:t.unref(o).t("em.attr.typePlaceholder"),disabled:Z.attrType.startsWith("EMBED")||!!Z.groupCode||Z.attrType==="RELATION_REF"||t.unref(S)(Z),items:t.unref(_c)(Z.type,t.unref(H)),"value-provider":t.unref($),"label-provider":t.unref(R),"model-value":Z.type,"onUpdate:modelValue":j=>t.unref(x)(Z,j)},null,8,["name","placeholder","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(E)(Z)?t.unref(o).t("em.attr.fkDeleteHint"):void 0},[t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:j=>t.unref(o).removeAttribute(t.unref(i).modelId,Z.modelId)},null,8,["onClick"])],8,S2)]),Z.type===t.unref(hn)&&!t.unref(S)(Z)?(t.openBlock(),t.createElementBlock("div",x2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-customtype-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.customTypePlaceholder"),"model-value":Z.customType??"","onUpdate:modelValue":j=>t.unref(T)(Z,j)},null,8,["name","placeholder","model-value","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(u)(Z)?(t.openBlock(),t.createElementBlock("div",R2,[t.createElementVNode("div",A2,[t.createElementVNode("span",$2,t.toDisplayString(t.unref(o).t("em.attr.assocField")),1),t.createElementVNode("div",T2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-assocname-${Z.modelId}`,width:"100%",title:t.unref(o).t("em.attr.derivedIdNote"),placeholder:t.unref(o).t("em.attr.namePlaceholder"),"model-value":t.unref(y)(Z),"onUpdate:modelValue":j=>t.unref(_)(Z,j)},null,8,["name","title","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("p",M2,t.toDisplayString(t.unref(o).t("em.attr.derivedIdNote")),1)])])):t.createCommentVNode("",!0),Z.attrType==="RELATION_REF"?(t.openBlock(),t.createElementBlock("p",V2,t.toDisplayString(t.unref(o).t("em.attr.inverseNavHint")),1)):t.unref(ne)(Z)?(t.openBlock(),t.createElementBlock("div",K2,[t.unref(ae)(Z)?(t.openBlock(),t.createElementBlock("p",G2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Z.dbAttrs,(j,fe)=>{var Te,Oe,ce,Le,Ye,Je,ut,G;return t.openBlock(),t.createElementBlock("div",{key:j.modelId,class:"em-embed-col"},[t.createElementVNode("span",Y2,t.toDisplayString(((Te=t.unref(D)(Z,fe))==null?void 0:Te.name)??((Oe=t.unref(D)(Z,fe))==null?void 0:Oe.physicalName)??t.unref(o).t("em.attr.colFallback",{n:fe+1})),1),t.createElementVNode("div",q2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`embed-col-${j.modelId}`,width:"100%",disabled:t.unref(J)(j),placeholder:((ce=t.unref(D)(Z,fe))==null?void 0:ce.physicalName)??t.unref(o).t("em.attr.columnPlaceholder"),"model-value":t.unref(J)(j)?t.unref(re)(j):j.physicalName,"onUpdate:modelValue":W=>t.unref(me)(Z,fe,{physicalName:W})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(we)(Z)},[t.createVNode(t.unref(te.BSTextInput),{name:`embed-dtype-${j.modelId}`,width:"84px",disabled:"","model-value":t.unref(z)(Z,fe)},null,8,["name","model-value"])],8,W2),t.createElementVNode("span",{title:t.unref(we)(Z)},[t.createVNode(t.unref(te.BSNumberInput),{name:`embed-len-${j.modelId}`,width:"48px",disabled:"","model-value":t.unref(Q)(Z,fe)},null,8,["name","model-value"])],8,J2),t.createElementVNode("span",{title:t.unref(we)(Z)},[t.createVNode(t.unref(te.BSNumberInput),{name:`embed-scale-${j.modelId}`,width:"48px",disabled:"","model-value":t.unref(ee)(Z,fe)},null,8,["name","model-value"])],8,X2)]),t.createVNode(fo,{controller:t.unref(o),"ref-id":j.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",Z2,[t.createVNode(Yt,{class:"grow",name:`embed-logical-${j.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:((Ye=(Le=t.unref(D)(Z,fe))==null?void 0:Le.logicalName)==null?void 0:Ye[t.unref(o).userLanguage.value])??((ut=(Je=t.unref(D)(Z,fe))==null?void 0:Je.logicalName)==null?void 0:ut.ko)??t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":j.logicalName,"onUpdate:modelValue":W=>t.unref(P)(Z,fe,W)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),(G=t.unref(D)(Z,fe))!=null&&G.shareable?(t.openBlock(),t.createElementBlock("label",Q2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.currencyColumn")),1),t.createVNode(t.unref(te.BSSelect),{width:"110px","model-value":t.unref(je)(j),items:t.unref(ie)(),"value-provider":t.unref(c),"label-provider":t.unref(Se),"onUpdate:modelValue":W=>W&&t.unref(Ze)(Z,fe,W)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(J)(j)?(t.openBlock(),t.createElementBlock("p",eV,t.toDisplayString(t.unref(o).t("em.attr.embedSharedHint")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",tV,[Xe[3]||(Xe[3]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(J)(j),"model-value":t.unref(J)(j)?"false":t.unref(Be)(j),items:t.unref(q),"value-provider":t.unref(c),"label-provider":t.unref(Ie),"onUpdate:modelValue":W=>W&&t.unref(ze)(Z,fe,W)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",nV,[Xe[4]||(Xe[4]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"110px",disabled:t.unref(J)(j),"model-value":t.unref(J)(j)?"false":t.unref(Ce)(j),items:t.unref(de),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":W=>W&&t.unref(Y)(Z,fe,W)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])])])}),128)),t.unref(ae)(Z)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",oV,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:"","onUpdate:modelValue":j=>t.unref(N)(Z,j)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nn-${Z.modelId}`,label:"Not Null","model-value":Z.notNull,disabled:"","onUpdate:modelValue":j=>t.unref(d)(Z,{notNull:j})},null,8,["name","model-value","onUpdate:modelValue"])]),t.createElementVNode("fieldset",iV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`attr-desc-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Z.description,"onUpdate:modelValue":j=>t.unref(O)(Z,j)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[t.unref(S)(Z)?(t.openBlock(),t.createElementBlock("p",B2,t.toDisplayString(t.unref(o).t("em.attr.fkDerivedNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("div",D2,[t.createVNode(Yt,{class:"grow",name:`attr-logical-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,placeholder:t.unref(o).t("em.attr.logicalPlaceholder"),"model-value":(Rt=Z.dbAttrs[0])==null?void 0:Rt.logicalName,"onUpdate:modelValue":j=>t.unref(I)(Z,j)},null,8,["name","languages","default-lang","placeholder","model-value","onUpdate:modelValue"])]),t.createElementVNode("div",O2,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`attr-col-${Z.modelId}`,width:"100%",placeholder:t.unref(V)(Z)??t.unref(o).t("em.attr.columnPlaceholder"),disabled:t.unref(C)(Z),"model-value":(($t=Z.dbAttrs[0])==null?void 0:$t.physicalName)??"","onUpdate:modelValue":j=>t.unref(M)(Z,{physicalName:j})},null,8,["name","placeholder","disabled","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{name:`attr-dtype-${Z.modelId}`,width:"84px",placeholder:"dataType",disabled:t.unref(C)(Z)||t.unref(S)(Z),items:t.unref(yc)(((Sn=Z.dbAttrs[0])==null?void 0:Sn.dataType)??"",t.unref(o).selectableDataTypes.value),"value-provider":t.unref(c),"label-provider":t.unref(jr),"model-value":((At=Z.dbAttrs[0])==null?void 0:At.dataType)??"","onUpdate:modelValue":j=>j&&t.unref(M)(Z,{dataType:j})},null,8,["name","disabled","items","value-provider","label-provider","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSNumberInput),{name:`attr-len-${Z.modelId}`,width:"48px",placeholder:"len",disabled:t.unref(C)(Z)||t.unref(S)(Z),"model-value":(ge=Z.dbAttrs[0])==null?void 0:ge.length,"onUpdate:modelValue":j=>t.unref(M)(Z,{length:j||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("span",{title:t.unref(v)(Z)},[t.createVNode(t.unref(te.BSNumberInput),{name:`attr-scale-${Z.modelId}`,width:"48px",placeholder:"scale",disabled:t.unref(C)(Z)||t.unref(S)(Z)||!t.unref(k)(Z),"model-value":(ft=Z.dbAttrs[0])==null?void 0:ft.scale,"onUpdate:modelValue":j=>t.unref(M)(Z,{scale:j||void 0})},null,8,["name","disabled","model-value","onUpdate:modelValue"])],8,L2)]),t.createVNode(fo,{controller:t.unref(o),"ref-id":(xn=Z.dbAttrs[0])==null?void 0:xn.modelId},null,8,["controller","ref-id"]),t.createElementVNode("div",P2,[t.createVNode(t.unref(te.BSCheckbox),{name:`attr-pk-${Z.modelId}`,label:"Primary Key","model-value":Z.identifier,disabled:t.unref(a)||t.unref(C)(Z)||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(N)(Z,j)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nn-${Z.modelId}`,label:"Not Null","model-value":Z.notNull,disabled:t.unref(C)(Z)||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(d)(Z,{notNull:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-uq-${Z.modelId}`,label:"Unique","model-value":!!((Zt=Z.dbAttrs[0])!=null&&Zt.unique),disabled:t.unref(C)(Z)||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(M)(Z,{unique:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-ai-${Z.modelId}`,label:"Auto Increment","model-value":!!((B=Z.dbAttrs[0])!=null&&B.autoIncrement),disabled:t.unref(C)(Z)||t.unref(S)(Z)||!Z.identifier,"onUpdate:modelValue":j=>t.unref(M)(Z,{autoIncrement:j})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-tr-${Z.modelId}`,label:"@Transient","model-value":!!Z.transient,disabled:Z.identifier||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(w)(Z,j)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-nid-${Z.modelId}`,label:"@NaturalId","model-value":!!Z.naturalId,disabled:Z.identifier||t.unref(C)(Z)||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(h)(Z,j)},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{class:"em-attr__flag-sub",name:`attr-nidm-${Z.modelId}`,label:"mutable","model-value":!!Z.naturalIdMutable,disabled:t.unref(C)(Z)||!Z.naturalId,"onUpdate:modelValue":j=>t.unref(d)(Z,{naturalIdMutable:j||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`attr-mv-${Z.modelId}`,label:"Multi-Value (Set)","model-value":!!((F=Z.dbAttrs[0])!=null&&F.multiValue),disabled:t.unref(C)(Z)||t.unref(S)(Z),"onUpdate:modelValue":j=>t.unref(M)(Z,{multiValue:j||void 0})},null,8,["name","model-value","disabled","onUpdate:modelValue"])]),t.createElementVNode("label",z2,[Xe[1]||(Xe[1]=t.createElementVNode("span",null,"insertable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"100%",disabled:t.unref(C)(Z),"model-value":t.unref(Be)(Z.dbAttrs[0]),items:t.unref(q),"value-provider":t.unref(c),"label-provider":t.unref(Ie),"onUpdate:modelValue":j=>j&&t.unref(Ue)(Z,j)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.createElementVNode("label",F2,[Xe[2]||(Xe[2]=t.createElementVNode("span",null,"updatable",-1)),t.createVNode(t.unref(te.BSSelect),{width:"100%",disabled:t.unref(C)(Z),"model-value":t.unref(Ce)(Z.dbAttrs[0]),items:t.unref(de),"value-provider":t.unref(c),"label-provider":t.unref(xe),"onUpdate:modelValue":j=>j&&t.unref(X)(Z,j)},null,8,["disabled","model-value","items","value-provider","label-provider","onUpdate:modelValue"])]),t.unref(S)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",U2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":t.unref(A)(Z),items:t.unref(l),"value-provider":t.unref(c),"label-provider":t.unref(s),"onUpdate:modelValue":j=>j&&t.unref(L)(Z,j)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])])),t.unref(be).length&&!t.unref(S)(Z)?(t.openBlock(),t.createElementBlock("label",H2,[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.codeGroup")),1),t.createVNode(Pf,{"model-value":Z.groupCode,items:t.unref(be),locale:t.unref(o).uiLocale.value,"onUpdate:modelValue":j=>t.unref(Ae)(Z,j)},null,8,["model-value","items","locale","onUpdate:modelValue"])])):t.createCommentVNode("",!0),t.unref(S)(Z)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("label",{key:3,class:t.normalizeClass(["em-attr__pii",{"em-attr__codetop":!t.unref(be).length}])},[t.createElementVNode("span",null,t.toDisplayString(t.unref(o).t("em.attr.defaultValue")),1),t.unref(pe)(Z).length?(t.openBlock(),t.createBlock(t.unref(te.BSSelect),{key:0,width:"100%","model-value":Z.defaultValue??"none",items:t.unref(he)(Z),"value-provider":t.unref(_e),"label-provider":t.unref(ye),"onUpdate:modelValue":j=>j&&t.unref(Fe)(Z,j)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"])):(t.openBlock(),t.createBlock(t.unref(te.BSTextInput),{key:1,name:`attr-default-${Z.modelId}`,width:"100%",placeholder:t.unref(o).t("em.attr.defaultValue"),"model-value":Z.defaultValue??"","onUpdate:modelValue":j=>t.unref(se)(Z,j)},null,8,["name","placeholder","model-value","onUpdate:modelValue"]))],2)),t.createElementVNode("fieldset",j2,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(o).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`attr-desc-${Z.modelId}`,languages:t.unref(o).languages.value,"default-lang":t.unref(o).userLanguage.value,"model-value":Z.description,"onUpdate:modelValue":j=>t.unref(O)(Z,j)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])])],64)),t.createElementVNode("div",aV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":Re(Z)===null}]),title:t.unref(o).t("em.swatch.none"),onClick:j=>U(Z,null)},"∅",10,rV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),j=>(t.openBlock(),t.createElementBlock("button",{key:j,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":Re(Z)===j}]),style:t.normalizeStyle({background:t.unref(jo)(j)}),title:t.unref(o).t(t.unref(mo)(j)),onClick:fe=>U(Z,j)},null,14,lV))),128)),ke(Z)?(t.openBlock(),t.createElementBlock("span",sV,t.toDisplayString(t.unref(o).t("em.attr.batchHint",{n:t.unref(r).size})),1)):t.createCommentVNode("",!0)])],10,I2)}),128))],8,h2)):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-af496d06"]]),dV=["disabled"],uV={class:"em-panel__sub-label"},mV={class:"em-attr__row"},fV={class:"em-field em-idx-params"},pV=["value","placeholder","onChange"],hV=tt(t.defineComponent({__name:"EntityIndexSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.computed(()=>a.state.logical.entities.find(w=>w.modelId===o.entityId)??null),l=t.computed(()=>r.value?Qo(r.value,a.superClassCatalog.value):[]),s=t.computed(()=>{var w;return Hn(((w=r.value)==null?void 0:w.attributes)??[])}),c=w=>s.value.canon(w),d=t.computed(()=>({entity:r.value??{modelId:"",name:"",stereotype:"JPA_ENTITY",attributes:[]},logical:a.state.logical,resolver:s.value,inherited:l.value,embeddableCatalog:a.embeddableCatalog.value,t:a.t})),u=t.computed(()=>{var w;return[...(((w=r.value)==null?void 0:w.attributes)??[]).filter(C=>C.dbAttrs.length>0).map(C=>({value:C.modelId,label:Hf(C,d.value)})),...l.value.map(C=>({value:C.modelId,label:a.t("em.index.inherited",{field:C.field})}))]});function m(w,C){var R;const S=new Set(w.columns.filter((x,T)=>T!==C).map(x=>c(x.columnRef))),V=u.value.filter(x=>!S.has(c(x.value))),$=(R=w.columns[C])==null?void 0:R.columnRef;return $&&!V.some(x=>x.value===$)&&V.push({value:$,label:p($)}),V}function p(w){return jf(w,d.value)}function f(w){const C=new Set(w.columns.map(S=>c(S.columnRef)));return u.value.filter(S=>!C.has(c(S.value)))}function y(){var C;if(!r.value)return;const w=u.value[0];a.addIndex(r.value.modelId,{modelId:Pe(),name:`idx_${(((C=r.value.indexes)==null?void 0:C.length)??0)+1}`,unique:!1,columns:w?[{columnRef:w.value,descending:!1}]:[]})}function _(w,C){r.value&&a.updateIndex(r.value.modelId,w,C)}function g(w){const C=f(w)[0];C&&_(w.modelId,{columns:[...w.columns,{columnRef:C.value,descending:!1}]})}function b(w,C,S){_(w.modelId,{columns:w.columns.map((V,$)=>$===C?{...V,columnRef:S}:V)})}function E(w,C,S){_(w.modelId,{columns:w.columns.map((V,$)=>$===C?{...V,descending:S}:V)})}function h(w,C){_(w.modelId,{columns:w.columns.filter((S,V)=>V!==C)})}function N(w,C){_(w.modelId,{parameters:C.trim()===""?void 0:C})}return(w,C)=>{var S;return r.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section em-idx-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:C[0]||(C[0]=V=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",uV,[e.collapsible?(t.openBlock(),t.createBlock(Ve,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.index.section",{n:((S=r.value.indexes)==null?void 0:S.length)??0})),1)]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:t.withModifiers(y,["stop"])},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(r.value.indexes??[],V=>(t.openBlock(),t.createElementBlock("div",{key:V.modelId,class:"em-attr"},[t.createElementVNode("div",mV,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`idx-name-${V.modelId}`,width:"100%",placeholder:t.unref(a).t("em.index.namePlaceholder"),"model-value":V.name,"onUpdate:modelValue":$=>_(V.modelId,{name:$})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-uq-${V.modelId}`,class:"em-check",label:"UQ","model-value":V.unique,"onUpdate:modelValue":$=>_(V.modelId,{unique:$})},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:$=>t.unref(a).removeIndex(r.value.modelId,V.modelId)},null,8,["onClick"])]),t.createVNode(fo,{controller:t.unref(a),"ref-id":V.modelId},null,8,["controller","ref-id"]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.columns,($,R)=>(t.openBlock(),t.createElementBlock("div",{key:R,class:"em-attr__row"},[t.createVNode(t.unref(te.BSSelect),{class:"grow","model-value":$.columnRef,items:m(V,R),"value-provider":x=>x.value,"label-provider":x=>x.label,"onUpdate:modelValue":x=>x&&b(V,R,x)},null,8,["model-value","items","value-provider","label-provider","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSCheckbox),{name:`idx-${V.modelId}-desc-${R}`,class:"em-check",label:"DESC","model-value":$.descending,"onUpdate:modelValue":x=>E(V,R,x)},null,8,["name","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:"−",onClick:x=>h(V,R)},null,8,["onClick"])]))),128)),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.index.addColumn"),disabled:!f(V).length,onClick:$=>g(V)},null,8,["caption","disabled","onClick"]),t.createElementVNode("label",fV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.index.condition")),1),t.createElementVNode("textarea",{class:"em-textarea",value:V.parameters??"",rows:"2",placeholder:t.unref(a).t("em.index.conditionPlaceholder"),onChange:$=>N(V,$.target.value)},null,40,pV)])]))),128)):t.createCommentVNode("",!0)],8,dV)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-1d31212a"]]),yV=["disabled"],gV={class:"em-panel__sub-label"},bV={class:"em-attr__row"},_V={class:"em-attr__row"},kV={class:"em-multilang"},EV={class:"em-attr__pii"},NV={class:"em-swatch__row em-attr__swatch"},wV=["title","onClick"],IV=["title","onClick"],vV=tt(t.defineComponent({__name:"EntityOperationsSection",props:{controller:{},entityId:{},collapsible:{type:Boolean},collapsed:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=te.useModal(),l=t.computed(()=>a.state.logical.entities.find(h=>h.modelId===o.entityId)??null),s=t.computed(()=>l.value?a.state.layout.entityLayouts.find(h=>h.entityRef===l.value.modelId)??null:null),c=["PUBLIC","PROTECTED","PACKAGE","PRIVATE"],d=["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 u(h){return h==="none"?a.t("em.common.noneParen"):h}const m=h=>h;function p(h,N){l.value&&a.updateOperation(l.value.modelId,h.modelId,N)}function f(h,N){p(h,{description:Object.keys(N).length?N:void 0})}function y(h){return h.personalInfoAttributeType??"none"}function _(h,N){p(h,{personalInfoAttributeType:N==="none"?void 0:N})}function g(h){var N,w;return St((w=(N=s.value)==null?void 0:N.operationStyles)==null?void 0:w[h.modelId])}function b(h,N){l.value&&a.setOperationSwatch(l.value.modelId,h.modelId,N)}function E(h){r.openModal({component:Kf,bind:{operationName:h.name,sourceCode:h.sourceCode??"",locale:a.uiLocale.value,onSave:N=>p(h,{sourceCode:N})}})}return(h,N)=>{var w;return l.value?(t.openBlock(),t.createElementBlock("fieldset",{key:0,class:"em-section",disabled:!t.unref(a).editable.value},[t.createElementVNode("h4",{class:t.normalizeClass(["em-panel__sub",{"em-panel__sub--toggle":e.collapsible}]),onClick:N[1]||(N[1]=C=>e.collapsible&&i("toggle"))},[t.createElementVNode("span",gV,[e.collapsible?(t.openBlock(),t.createBlock(Ve,{key:0,name:"chevron",size:13,class:t.normalizeClass(["em-sub-caret",{"is-open":!e.collapsed}])},null,8,["class"])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.op.section",{n:((w=l.value.operations)==null?void 0:w.length)??0})),1)]),t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t("em.common.add"),onClick:N[0]||(N[0]=t.withModifiers(C=>t.unref(a).addOperation(l.value.modelId),["stop"]))},null,8,["caption"])],2),!e.collapsible||!e.collapsed?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(l.value.operations??[],C=>(t.openBlock(),t.createElementBlock("div",{key:C.modelId,class:"em-attr"},[t.createElementVNode("div",bV,[t.createVNode(t.unref(te.BSTextInput),{class:"grow",name:`op-name-${C.modelId}`,width:"100%",placeholder:t.unref(a).t("em.op.namePlaceholder"),"model-value":C.name,"onUpdate:modelValue":S=>p(C,{name:S})},null,8,["name","placeholder","model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSSelect),{width:"96px","model-value":C.visibility??"PACKAGE",items:c,"value-provider":m,"label-provider":m,"onUpdate:modelValue":S=>S&&p(C,{visibility:S})},null,8,["model-value","onUpdate:modelValue"]),t.createVNode(t.unref(te.BSButton),{variant:"text",class:"em-del-btn",caption:"✕",onClick:S=>t.unref(a).removeOperation(l.value.modelId,C.modelId)},null,8,["onClick"])]),t.createElementVNode("div",_V,[t.createVNode(t.unref(te.BSButton),{variant:"text",caption:t.unref(a).t(C.sourceCode?"em.op.editBodyDirty":"em.op.editBody"),onClick:S=>E(C)},null,8,["caption","onClick"])]),t.createElementVNode("fieldset",kV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(a).t("em.common.description")),1),t.createVNode(Yt,{multiline:"",name:`op-desc-${C.modelId}`,languages:t.unref(a).languages.value,"default-lang":t.unref(a).userLanguage.value,"model-value":C.description,"onUpdate:modelValue":S=>f(C,S)},null,8,["name","languages","default-lang","model-value","onUpdate:modelValue"])]),t.createElementVNode("label",EV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.attr.pii")),1),t.createVNode(t.unref(te.BSSelect),{width:"100%","model-value":y(C),items:d,"value-provider":m,"label-provider":u,"onUpdate:modelValue":S=>S&&_(C,S)},null,8,["model-value","onUpdate:modelValue"])]),t.createElementVNode("div",NV,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":g(C)===null}]),title:t.unref(a).t("em.swatch.none"),onClick:S=>b(C,null)},"∅",10,wV),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),S=>(t.openBlock(),t.createElementBlock("button",{key:S,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":g(C)===S}]),style:t.normalizeStyle({background:t.unref(jo)(S)}),title:t.unref(a).t(t.unref(mo)(S)),onClick:V=>b(C,S)},null,14,IV))),128))])]))),128)):t.createCommentVNode("",!0)],8,yV)):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-04208206"]]),CV=["title"],SV={class:"em-panel__head"},xV={class:"em-panel__head-row"},RV=["title"],AV={class:"em-panel__context"},$V={key:0,class:"em-panel__lock"},TV=["disabled"],MV={key:0,class:"em-panel__note"},VV={key:1,class:"em-panel__note"},BV={key:2,class:"em-jpa"},DV={class:"em-field"},OV={class:"em-field"},LV={class:"em-field"},PV={key:0,class:"em-field"},zV={class:"em-panel__note"},FV={class:"em-panel__sub"},UV={class:"em-field"},HV={class:"em-field"},jV={class:"em-jpa"},KV={key:0,class:"em-panel__note"},GV={key:1,class:"em-panel__note"},YV={class:"em-jpa"},qV={class:"em-field"},WV={key:0,class:"em-panel__note"},JV={class:"em-field"},XV={class:"em-multilang"},ZV={class:"em-field"},QV=["value"],eB={class:"em-field"},tB={class:"em-swatch"},nB={class:"em-swatch__row"},oB=["title"],iB=["title","onClick"],aB={class:"em-panel__note"},rB={class:"em-field"},lB=["value"],sB={class:"em-swatch"},cB={class:"em-swatch__row"},dB=["title"],uB=["title","onClick"],Bh=tt(t.defineComponent({__name:"PropertyPanel",props:{controller:{},width:{},resizing:{type:Boolean},startResize:{type:Function}},emits:["collapse"],setup(e,{expose:n,emit:o}){const i=e,a=o,r=t.ref(null);n({focusCollapse:()=>{var Y;return(Y=r.value)==null?void 0:Y.focus()}});const l=i.controller,s=t.computed(()=>l.selection.value),c=t.computed(()=>l.inspectedEntityId.value),d=t.computed(()=>{const Y=c.value;return Y?l.state.logical.entities.find(X=>X.modelId===Y)??null:null}),u=t.computed(()=>{const Y=s.value;if((Y==null?void 0:Y.kind)==="association")return l.isAssociationLocked(Y.id);const X=c.value;return!!X&&l.isEntityLocked(X)}),m=t.computed(()=>{var Y;return((Y=l.selectedAttr.value)==null?void 0:Y.attrId)??null}),p=t.computed(()=>new Set(l.selectedAttrIds.value)),f=t.computed(()=>m.value!==null),y=t.ref({});t.watch(f,()=>{y.value={}});function _(Y){return y.value[Y]??f.value}function g(Y){y.value={...y.value,[Y]:!_(Y)}}const b=t.computed(()=>{var q;const Y=d.value;if(!Y)return l.t("em.entity.fallback");const X=(q=Y.table)==null?void 0:q.physicalName;return X?`${Y.name} (${X})`:Y.name}),E=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="association"?l.state.logical.associations.find(X=>X.modelId===Y.id)??null:null}),h=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="group"?l.state.logical.groups.find(X=>X.modelId===Y.id)??null:null}),N=t.computed(()=>{const Y=s.value;return(Y==null?void 0:Y.kind)==="note"?l.state.layout.notes.find(X=>X.modelId===Y.id)??null:null}),w=t.computed(()=>{var X,q;const Y=(X=h.value)==null?void 0:X.name;return(Y==null?void 0:Y[l.userLanguage.value])||(Y==null?void 0:Y.ko)||(Y==null?void 0:Y.en)||(Y==null?void 0:Y.ja)||(Y==null?void 0:Y.zh)||((q=h.value)==null?void 0:q.packageName)||l.t("em.group.fallback")}),C=t.computed(()=>{if(d.value){const Y=p.value.size;if(Y>1)return l.t("em.inspector.ctxEntityAttrs",{name:d.value.name,n:Y});if(m.value){const X=d.value.attributes.find(q=>q.modelId===m.value);return(X==null?void 0:X.attrType)==="DIVIDER"?l.t("em.inspector.ctxEntityDivider",{name:d.value.name}):l.t("em.inspector.ctxEntityAttr",{name:d.value.name,attr:(X==null?void 0:X.name)??""})}return l.t("em.inspector.ctxEntity",{name:d.value.name})}if(E.value){const Y=X=>{var q;return((q=l.state.logical.entities.find(Ie=>Ie.modelId===X))==null?void 0:q.name)??X};return l.t("em.inspector.ctxAssoc",{a:Y(E.value.end1.entityRef),b:Y(E.value.end2.entityRef)})}return h.value?l.t("em.inspector.ctxGroup",{name:w.value}):N.value?l.t("em.inspector.ctxNote"):l.t("em.inspector.ctxNone")}),S=["NO_INSTANCE_OR_ONE_INSTANCE","EXACTLY_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES","ONE_OR_MORE_INSTANCES"],V=["EXACTLY_ONE_INSTANCE","NO_INSTANCE_OR_ONE_INSTANCE","ZERO_OR_MORE_INSTANCES"],$={EXACTLY_ONE_INSTANCE:"em.embed.card1",NO_INSTANCE_OR_ONE_INSTANCE:"em.embed.card01",ZERO_OR_MORE_INSTANCES:"em.embed.card0N"},R=Y=>{const X=$[Y];return X?l.t(X):Y},x=Y=>{var X;return((X=l.state.logical.entities.find(q=>q.modelId===Y))==null?void 0:X.name)??Y},T=["ALL","PERSIST","MERGE","REMOVE","REFRESH","DETACH"],M=["LIST","SET"],k=["inherit","LAZY","EAGER"],v=Y=>Y;function I(Y){return Y==="inherit"?l.t("em.common.inherit"):Y}const O=t.computed(()=>!!E.value&&E.value.end1.entityRef===E.value.end2.entityRef);function A(Y,X){E.value&&l.updateAssociationEnd(E.value.modelId,Y,X)}function L(Y){return ne.value?Y:Y==="end1"?"end2":"end1"}function H(Y){var Be;const X=(Be=E.value)==null?void 0:Be[Y];if(!(X!=null&&X.attributeRef))return;const q=l.state.logical.entities.find(ze=>ze.modelId===X.entityRef),Ie=q==null?void 0:q.attributes.find(ze=>ze.modelId===X.attributeRef);return Ie&&(Ie.attrType==="RELATION_OWN"||Ie.attrType==="RELATION_REF")?Ie.name:void 0}function oe(Y,X){var Ie;const q=(Ie=E.value)==null?void 0:Ie[Y];q!=null&&q.attributeRef&&l.updateAttribute(q.entityRef,q.attributeRef,{name:X})}function ue(Y){var ze;const X=H(Y);if(X!==void 0)return X;const q=(ze=E.value)==null?void 0:ze[Y];if(q!=null&&q.navFieldNameHint)return q.navFieldNameHint;const Ie=Y==="end1"?"end2":"end1",Be=l.state.logical.entities.find(Ue=>{var ie;return Ue.modelId===((ie=E.value)==null?void 0:ie[Ie].entityRef)});return Be?ta(Be.name,Qi(E.value[Ie].multiplicity)):""}function be(Y){return!!ne.value||H(Y)!==void 0}function pe(Y){E.value&&!O.value&&l.setAssociationIdentifying(E.value.modelId,Y)}function he(Y){var X,q,Ie;return!!((Ie=(q=(X=E.value)==null?void 0:X[Y].jpa)==null?void 0:q.cascadeTypes)!=null&&Ie.includes("ALL"))}function _e(Y,X,q){var ze,Ue;const Ie=(ze=E.value)==null?void 0:ze[Y];if(X==="ALL"&&q){A(Y,{jpa:{...Ie==null?void 0:Ie.jpa,cascadeTypes:["ALL"]}});return}const Be=new Set(((Ue=Ie==null?void 0:Ie.jpa)==null?void 0:Ue.cascadeTypes)??[]);q?Be.add(X):Be.delete(X),A(Y,{jpa:{...Ie==null?void 0:Ie.jpa,cascadeTypes:[...Be]}})}function ye(Y,X){var Ie;const q=(Ie=E.value)==null?void 0:Ie[Y];A(Y,{jpa:{...q==null?void 0:q.jpa,...X}})}function Ae(Y){var X,q;return((q=(X=E.value)==null?void 0:X[Y].jpa)==null?void 0:q.fetchType)??"inherit"}function Fe(Y,X){ye(Y,{fetchType:X==="inherit"?void 0:X})}function se(Y){var q;const X=(q=E.value)==null?void 0:q[Y==="end1"?"end2":"end1"];return(X==null?void 0:X.multiplicity)==="ZERO_OR_MORE_INSTANCES"||(X==null?void 0:X.multiplicity)==="ONE_OR_MORE_INSTANCES"}const ne=t.computed(()=>{const Y=E.value;if(!Y)return null;for(const X of l.state.logical.entities){const q=X.attributes.find(Ue=>{var ie;return((ie=Ue.embedded)==null?void 0:ie.associationRef)===Y.modelId&&Ue.attrType==="EMBED_OWN"});if(!q)continue;const Ie=Y.end2.entityRef===q.embedded.embeddableRef?"end2":"end1",Be=Y[Ie].multiplicity,ze=Y[Ie].jpa;return{which:Ie,cardinality:Be,isCollection:Be==="ZERO_OR_MORE_INSTANCES"||Be==="ONE_OR_MORE_INSTANCES",collectionType:(ze==null?void 0:ze.collectionType)??"LIST",collectionTable:(ze==null?void 0:ze.collectionTable)??"",orderColumn:(ze==null?void 0:ze.orderColumn)??""}}return null});function ae(Y){E.value&&l.setEmbedCardinality(E.value.modelId,Y)}function me(Y){const X=ne.value;X&&ye(X.which,Y==="SET"?{collectionType:"SET",orderColumn:void 0}:{collectionType:"LIST"})}function P(Y){const X=ne.value;X&&ye(X.which,{collectionTable:Y.trim()||void 0})}function D(Y){const X=ne.value;X&&ye(X.which,{orderColumn:Y.trim()||void 0})}function z(Y){h.value&&l.updateGroup(h.value.modelId,Y)}function Q(Y,X){var q;z({name:{...(q=h.value)==null?void 0:q.name,[Y]:X}})}const ee=t.computed(()=>{var Y;return h.value?St((Y=l.state.layout.groupLayouts.find(X=>X.groupRef===h.value.modelId))==null?void 0:Y.style):null});function we(Y){h.value&&l.setGroupSwatch(h.value.modelId,Y)}function de(Y){N.value&&l.setNoteMemo(N.value.modelId,Y)}const xe=t.computed(()=>{var Y;return St((Y=N.value)==null?void 0:Y.style)});function Ce(Y){N.value&&l.setNoteSwatch(N.value.modelId,Y)}return(Y,X)=>(t.openBlock(),t.createElementBlock("aside",{class:"em-panel",style:t.normalizeStyle({width:e.width+"px"})},[t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--left",{"is-dragging":e.resizing}]),title:t.unref(l).t("em.panel.resizeWidth"),onPointerdown:X[0]||(X[0]=(...q)=>e.startResize&&e.startResize(...q))},null,42,CV),t.createElementVNode("header",SV,[t.createElementVNode("div",xV,[X[14]||(X[14]=t.createElementVNode("h3",{class:"em-panel__title"},"Inspector",-1)),t.createElementVNode("button",{ref_key:"collapseBtn",ref:r,type:"button",class:"em-panel__btn",title:t.unref(l).t("em.panel.collapse"),onClick:X[1]||(X[1]=q=>a("collapse"))},[t.createVNode(Ve,{name:"panel-right-close",size:16})],8,RV)]),t.createElementVNode("p",AV,t.toDisplayString(C.value),1),u.value&&c.value?(t.openBlock(),t.createElementBlock("div",$V,[t.createVNode(Ve,{name:"lock",size:13}),t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.panel.lockedBanner")),1),t.unref(l).editable.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-panel__unlock",onClick:X[2]||(X[2]=q=>t.unref(l).setEntityLocked(c.value,!1))},t.toDisplayString(t.unref(l).t("em.panel.unlock")),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("fieldset",{class:"em-panel__body em-scroll-overlay",disabled:!t.unref(l).editable.value||u.value},[d.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createVNode(Tf,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("basics"),title:b.value,onToggle:X[3]||(X[3]=q=>g("basics"))},null,8,["controller","entity-id","collapsed","title"]),t.createVNode(cV,{controller:t.unref(l),"entity-id":d.value.modelId},null,8,["controller","entity-id"]),t.createVNode(hV,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("index"),onToggle:X[4]||(X[4]=q=>g("index"))},null,8,["controller","entity-id","collapsed"]),t.createVNode(vV,{controller:t.unref(l),"entity-id":d.value.modelId,collapsible:"",collapsed:_("ops"),onToggle:X[5]||(X[5]=q=>g("ops"))},null,8,["controller","entity-id","collapsed"])],64)):t.createCommentVNode("",!0),E.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createVNode(t.unref(te.BSCheckbox),{name:"assoc-identifying",class:"em-check",label:t.unref(l).t("em.assoc.identifying"),"model-value":!!E.value.identifying,disabled:O.value||!!ne.value,"onUpdate:modelValue":pe},null,8,["label","model-value","disabled"]),O.value?(t.openBlock(),t.createElementBlock("p",MV,t.toDisplayString(t.unref(l).t("em.assoc.selfNoIdentifying")),1)):ne.value?(t.openBlock(),t.createElementBlock("p",VV,t.toDisplayString(t.unref(l).t("em.assoc.embedNoIdentifying")),1)):t.createCommentVNode("",!0),ne.value?(t.openBlock(),t.createElementBlock("fieldset",BV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.embed.legend")),1),t.createElementVNode("label",DV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.embed.cardinality")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":ne.value.cardinality,items:V,"value-provider":v,"label-provider":R,"onUpdate:modelValue":X[6]||(X[6]=q=>q&&ae(q))},null,8,["model-value"])]),ne.value.isCollection?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",OV,[X[15]||(X[15]=t.createElementVNode("span",null,"collectionType",-1)),t.createVNode(t.unref(te.BSSelect),{"model-value":ne.value.collectionType,items:M,"value-provider":v,"label-provider":v,"onUpdate:modelValue":X[7]||(X[7]=q=>q&&me(q))},null,8,["model-value"])]),t.createElementVNode("label",LV,[X[16]||(X[16]=t.createElementVNode("span",null,"collectionTable",-1)),t.createVNode(t.unref(te.BSTextInput),{name:"embed-coll-table",width:"100%",placeholder:t.unref(l).t("em.embed.collectionTablePlaceholder"),"model-value":ne.value.collectionTable,"onUpdate:modelValue":P},null,8,["placeholder","model-value"])]),ne.value.collectionType==="LIST"?(t.openBlock(),t.createElementBlock("label",PV,[X[17]||(X[17]=t.createElementVNode("span",null,"orderColumn",-1)),t.createVNode(t.unref(te.BSTextInput),{name:"embed-order-col",width:"100%",placeholder:t.unref(l).t("em.embed.orderColumnPlaceholder"),"model-value":ne.value.orderColumn,"onUpdate:modelValue":D},null,8,["placeholder","model-value"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),t.createElementVNode("p",zV,t.toDisplayString(t.unref(l).t("em.embed.ownerFixedNote")),1)])):t.createCommentVNode("",!0),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["end1","end2"],q=>{var Ie,Be,ze;return t.withDirectives(t.createElementVNode("div",{key:q,class:"em-end"},[t.createElementVNode("h4",FV,t.toDisplayString(q)+" → "+t.toDisplayString(x(E.value[q].entityRef)),1),ne.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("label",UV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.multiplicity")),1),t.createVNode(t.unref(te.BSSelect),{"model-value":E.value[q].multiplicity,items:S,"value-provider":v,"label-provider":t.unref(ea),"onUpdate:modelValue":Ue=>A(q,{multiplicity:Ue})},null,8,["model-value","label-provider","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${L(q)}-navigable`,class:"em-check",label:"navigable",title:L(q)==="end2"?t.unref(l).t("em.assoc.ownerNavFixed"):void 0,disabled:L(q)==="end2","model-value":L(q)==="end2"?!0:E.value[L(q)].navigable,"onUpdate:modelValue":Ue=>A(L(q),{navigable:Ue})},null,8,["name","title","disabled","model-value","onUpdate:modelValue"]),t.createElementVNode("label",HV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.assoc.navFieldName")),1),t.createVNode(t.unref(te.BSTextInput),{name:`${L(q)}-navname`,width:"100%",disabled:!be(L(q)),placeholder:t.unref(l).t("em.attr.namePlaceholder"),"model-value":ue(L(q)),"onUpdate:modelValue":Ue=>oe(L(q),Ue)},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${L(q)}-composition`,class:"em-check",label:"composition","model-value":E.value[L(q)].composition,"onUpdate:modelValue":Ue=>A(L(q),{composition:Ue})},null,8,["name","model-value","onUpdate:modelValue"])],64)),t.createElementVNode("fieldset",jV,[X[18]||(X[18]=t.createElementVNode("legend",null,"cascade",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(T,Ue=>{var ie,Se;return t.createVNode(t.unref(te.BSCheckbox),{key:Ue,name:`${L(q)}-cascade-${Ue}`,class:"em-check",label:Ue,"model-value":!!((Se=(ie=E.value[L(q)].jpa)==null?void 0:ie.cascadeTypes)!=null&&Se.includes(Ue)),disabled:!be(L(q))||Ue!=="ALL"&&he(L(q)),"onUpdate:modelValue":je=>_e(L(q),Ue,je)},null,8,["name","label","model-value","disabled","onUpdate:modelValue"])}),64)),be(L(q))?he(L(q))?(t.openBlock(),t.createElementBlock("p",GV,t.toDisplayString(t.unref(l).t("em.assoc.cascadeAllNote")),1)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("p",KV,t.toDisplayString(t.unref(l).t("em.assoc.navRequiredNote")),1))]),t.createElementVNode("fieldset",YV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.assoc.jpaDetails")),1),t.createElementVNode("label",qV,[X[19]||(X[19]=t.createElementVNode("span",null,"fetchType",-1)),t.createVNode(t.unref(te.BSSelect),{disabled:!be(L(q)),"model-value":Ae(L(q)),items:k,"value-provider":v,"label-provider":I,"onUpdate:modelValue":Ue=>Ue&&Fe(L(q),Ue)},null,8,["disabled","model-value","onUpdate:modelValue"])]),t.createVNode(t.unref(te.BSCheckbox),{name:`${L(q)}-orphan`,class:"em-check",label:"orphanRemoval","model-value":!!((Ie=E.value[L(q)].jpa)!=null&&Ie.orphanRemoval),disabled:!be(L(q))||se(q),"onUpdate:modelValue":Ue=>ye(L(q),{orphanRemoval:Ue})},null,8,["name","model-value","disabled","onUpdate:modelValue"]),se(q)&&((Be=E.value[L(q)].jpa)!=null&&Be.orphanRemoval)?(t.openBlock(),t.createElementBlock("p",WV,t.toDisplayString(t.unref(l).t("em.assoc.orphanRemovalNote")),1)):t.createCommentVNode("",!0),t.createElementVNode("label",JV,[X[20]||(X[20]=t.createElementVNode("span",null,"orderBy",-1)),t.createVNode(t.unref(te.BSTextInput),{name:`${L(q)}-orderby`,width:"100%",disabled:!be(L(q)),placeholder:t.unref(l).t("em.assoc.orderByPlaceholder"),"model-value":((ze=E.value[L(q)].jpa)==null?void 0:ze.orderBy)??"","onUpdate:modelValue":Ue=>ye(L(q),{orderBy:Ue.trim()||void 0})},null,8,["name","disabled","placeholder","model-value","onUpdate:modelValue"])])])]),[[t.vShow,!ne.value||q===ne.value.which]])}),64))],64)):t.createCommentVNode("",!0),h.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("fieldset",XV,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.group.nameLegend")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(l).languages.value,q=>{var Ie;return t.openBlock(),t.createElementBlock("label",{key:q,class:"em-lang"},[t.createElementVNode("span",null,t.toDisplayString(q),1),t.createVNode(t.unref(te.BSTextInput),{name:`grp-name-${q}`,width:"100%","model-value":((Ie=h.value.name)==null?void 0:Ie[q])??"","onUpdate:modelValue":Be=>Q(q,Be)},null,8,["name","model-value","onUpdate:modelValue"])])}),128))]),t.createElementVNode("label",ZV,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.description")),1),t.createElementVNode("textarea",{class:"em-textarea",value:h.value.description??"",rows:"3",onChange:X[8]||(X[8]=q=>z({description:q.target.value}))},null,40,QV)]),t.createElementVNode("label",eB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.entity.package")),1),t.createVNode(t.unref(te.BSTextInput),{name:"grp-package",width:"100%","model-value":h.value.packageName??"","onUpdate:modelValue":X[9]||(X[9]=q=>z({packageName:q}))},null,8,["model-value"])]),t.createVNode(t.unref(te.BSCheckbox),{name:"grp-exclude-ddl",class:"em-check",label:t.unref(l).t("em.group.excludeDDL"),"model-value":h.value.excludeDDLGeneration,"onUpdate:modelValue":X[10]||(X[10]=q=>z({excludeDDLGeneration:q}))},null,8,["label","model-value"]),t.createElementVNode("fieldset",tB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",nB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":ee.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:X[11]||(X[11]=q=>we(null))},"∅",10,oB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),q=>(t.openBlock(),t.createElementBlock("button",{key:q,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":ee.value===q}]),style:t.normalizeStyle({background:t.unref(jo)(q)}),title:t.unref(l).t(t.unref(mo)(q)),onClick:Ie=>we(q)},null,14,iB))),128))])]),t.createElementVNode("p",aB,t.toDisplayString(t.unref(l).t("em.group.members",{n:h.value.memberEntityRefs.length})),1)],64)):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("label",rB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(l).t("em.common.memo")),1),t.createElementVNode("textarea",{class:"em-textarea",value:N.value.memo,rows:"6",onChange:X[12]||(X[12]=q=>de(q.target.value))},null,40,lB)]),t.createElementVNode("fieldset",sB,[t.createElementVNode("legend",null,t.toDisplayString(t.unref(l).t("em.common.color")),1),t.createElementVNode("div",cB,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["em-swatch__chip em-swatch__none",{"is-on":xe.value===null}]),title:t.unref(l).t("em.swatch.none"),onClick:X[13]||(X[13]=q=>Ce(null))},"∅",10,dB),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(uo),q=>(t.openBlock(),t.createElementBlock("button",{key:q,type:"button",class:t.normalizeClass(["em-swatch__chip",{"is-on":xe.value===q}]),style:t.normalizeStyle({background:t.unref(jo)(q)}),title:t.unref(l).t(t.unref(mo)(q)),onClick:Ie=>Ce(q)},null,14,uB))),128))])])],64)):t.createCommentVNode("",!0)],8,TV)],4))}}),[["__scopeId","data-v-d86b8a5b"]]),mB=["title"],fB={class:"em-validation__title"},pB=["title","onClick"],hB={key:0,class:"em-validation__body"},yB={class:"em-validation__opt"},gB={key:0,class:"em-validation__empty"},bB={key:1,class:"em-validation__empty"},_B={key:2,class:"em-validation__list"},kB=["onClick"],EB={class:"em-validation__item-msg"},NB={key:0,class:"em-validation__item-entity"},wB=["title","onClick"],IB=["title"],vB=tt(t.defineComponent({__name:"ValidationPanel",props:{controller:{},panelWidth:{},inspectorOpen:{type:Boolean,default:!0}},setup(e){const o=e.controller,i=t.computed(()=>o.issues.value),a=t.computed(()=>{const _=new Map;for(const g of o.state.logical.entities)_.set(g.modelId,g.name);return _});function r(_){const g=Pw(_);if(!g)return null;const b=a.value.get(g);return b===void 0?null:b.trim()===""?o.t("em.validation.nameless"):b}const l={error:{order:0,icon:"alert-circle",labelKey:"em.validation.severityError"},warning:{order:1,icon:"alert-triangle",labelKey:"em.validation.severityWarning"},info:{order:2,icon:"info",labelKey:"em.validation.severityInfo"}},s=t.computed(()=>{const _={error:0,warning:0,info:0};for(const g of i.value)_[g.severity]++;return _}),c=t.ref({error:!0,warning:!0,info:!0}),d=t.computed(()=>i.value.filter(_=>c.value[_.severity]).slice().sort((_,g)=>l[_.severity].order-l[g.severity].order)),u=t.computed(()=>d.value.map(_=>({issue:_,entityName:r(_),message:$f(o.t,_),category:Ow(o.t,_.ruleId)}))),m=t.ref(!1);function p(_){c.value[_]=!c.value[_]}function f(_){if(!m.value){m.value=!0;return}p(_)}function y(_){_.targetRef&&o.requestFocus(_.targetRef)}return(_,g)=>(t.openBlock(),t.createElementBlock("section",{class:t.normalizeClass(["em-validation",{"is-open":m.value,"is-inspector-collapsed":!e.inspectorOpen}]),style:t.normalizeStyle(m.value||!e.inspectorOpen?void 0:{width:e.panelWidth+"px"})},[t.createElementVNode("header",{class:"em-validation__head",onClick:g[1]||(g[1]=b=>m.value=!m.value)},[t.createElementVNode("button",{type:"button",class:"em-validation__toggle",title:t.unref(o).t(m.value?"em.panel.collapse":"em.panel.expand")},[t.createVNode(Ve,{name:"chevron",size:14,class:t.normalizeClass([{"is-open":m.value},"em-validation__chevron"])},null,8,["class"]),t.createElementVNode("span",fB,t.toDisplayString(t.unref(o).t("em.validation.title")),1)],8,mB),t.createElementVNode("div",{class:"em-validation__counts",onClick:g[0]||(g[0]=t.withModifiers(()=>{},["stop"]))},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(["error","warning","info"],b=>t.createElementVNode("button",{key:b,type:"button",class:t.normalizeClass(["em-validation__count",[`is-${b}`,{"is-off":!c.value[b]}]]),title:m.value?t.unref(o).t(c.value[b]?"em.validation.hideSeverity":"em.validation.showSeverity",{label:t.unref(o).t(l[b].labelKey)}):t.unref(o).t("em.validation.expandPanel"),onClick:E=>f(b)},[t.createVNode(Ve,{name:l[b].icon,size:14},null,8,["name"]),t.createElementVNode("span",null,t.toDisplayString(s.value[b]),1)],10,pB)),64))])]),m.value?(t.openBlock(),t.createElementBlock("div",hB,[t.createElementVNode("label",yB,[t.createVNode(t.unref(te.BSCheckbox),{name:"val-flag-norel",label:t.unref(o).t("em.validation.checkOrphanEntities"),"model-value":t.unref(o).flagEntitiesWithoutRelations.value,"onUpdate:modelValue":g[2]||(g[2]=b=>t.unref(o).flagEntitiesWithoutRelations.value=b)},null,8,["label","model-value"])]),i.value.length===0?(t.openBlock(),t.createElementBlock("p",gB,t.toDisplayString(t.unref(o).t("em.validation.noIssues")),1)):d.value.length===0?(t.openBlock(),t.createElementBlock("p",bB,t.toDisplayString(t.unref(o).t("em.validation.noVisibleIssues")),1)):(t.openBlock(),t.createElementBlock("ul",_B,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,({issue:b,entityName:E,message:h,category:N},w)=>(t.openBlock(),t.createElementBlock("li",{key:`${b.ruleId}:${b.targetRef??"model"}:${w}`,class:t.normalizeClass(["em-validation__item",[`is-${b.severity}`,{"is-clickable":!!b.targetRef}]]),onClick:C=>y(b)},[t.createVNode(Ve,{name:l[b.severity].icon,size:15,class:"em-validation__item-icon"},null,8,["name"]),t.createElementVNode("span",EB,[E?(t.openBlock(),t.createElementBlock("span",NB,t.toDisplayString(E),1)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(h),1)]),t.unref(o).hasQuickFix(b)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-validation__item-fix",title:t.unref(o).t("em.validation.quickFixTip"),onClick:t.withModifiers(C=>t.unref(o).applyQuickFix(b),["stop"])},t.toDisplayString(t.unref(o).t("em.validation.quickFix")),9,wB)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:"em-validation__item-cat",title:b.ruleId},t.toDisplayString(N),9,IB)],10,kB))),128))]))])):t.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-251fd3f0"]]),CB={class:"em-history"},SB={class:"em-history__head"},xB={class:"em-history__title"},RB={class:"em-history__head-actions"},AB=["title","disabled"],$B=["title"],TB={class:"em-history__filters"},MB={class:"em-history__filter"},VB={class:"em-history__filters em-history__filters--period"},BB={class:"em-history__filter-label"},DB=["title","aria-label","max"],OB=["title","aria-label","min"],LB=["title"],PB={key:0,class:"em-history__diffbar"},zB={class:"em-history__diffbar-range"},FB={class:"em-history__diffbar-count"},UB={class:"em-history__body"},HB={key:0,class:"em-history__empty"},jB={key:1,class:"em-history__diff-list"},KB=["onClick"],GB={class:"em-history__action-head"},YB={class:"em-history__action-name"},qB={key:0,class:"em-history__fields"},WB={class:"em-history__fname"},JB={key:0,class:"em-history__old"},XB={class:"em-history__val"},ZB={key:1,class:"em-history__empty"},QB={key:2,class:"em-history__empty is-error"},eD={key:3,class:"em-history__empty"},tD={key:4,class:"em-history__list"},nD=["onClick"],oD={class:"em-history__summary"},iD={class:"em-history__seq"},aD={class:"em-history__gmeta"},rD={class:"em-history__who"},lD={key:0,class:"em-history__time"},sD={key:1,class:"em-history__restored-from"},cD=["onClick"],dD={key:0,class:"em-history__detail"},uD={class:"em-history__action-head"},mD={class:"em-history__action-name"},fD={key:0,class:"em-history__fields"},pD={class:"em-history__fname"},hD={key:0,class:"em-history__old"},yD={class:"em-history__val"},gD={class:"em-history__preview"},bD=["disabled"],_D={key:0,class:"em-history__diff-list is-preview"},kD={class:"em-history__action-head"},ED={class:"em-history__action-name"},ND={key:0,class:"em-history__fields"},wD={class:"em-history__fname"},ID={key:0,class:"em-history__old"},vD={class:"em-history__val"},CD={class:"em-history__confirm-row"},SD={class:"em-history__confirm-msg"},xD=["disabled","onClick"],RD=["disabled"],AD=["onClick"],Tr=50,$D=tt(t.defineComponent({__name:"HistoryPanel",props:{controller:{},open:{type:Boolean}},emits:["close","diffChange"],setup(e,{emit:n}){const o=e,i=n,a=o.controller,r=t.ref([]),l=t.ref(!1),s=t.ref(null),c=t.ref(!1),d=t.computed(()=>r.value.reduce((ie,Se)=>Se.seq>ie?Se.seq:ie,-1/0));async function u(ie){if(a.historyTransport){l.value=!0,s.value=null;try{const Se=!(ie!=null&&ie.full)&&r.value.length>0&&Number.isFinite(d.value),je=await a.historyTransport(Se?d.value:void 0);if(!Se)r.value=je;else if(je.length){const Ze=new Set(r.value.map(re=>re.seq)),J=je.filter(re=>!Ze.has(re.seq));J.length&&(r.value=[...r.value,...J])}c.value=!0}catch(Se){s.value=Se instanceof Error?Se.message:a.t("em.history.loadError")}finally{l.value=!1}}}async function m(){await a.whenOpsSettled(),await u()}const p=t.ref(null),f=t.ref(null);t.watch(()=>o.open,ie=>{ie?m():(p.value=null,f.value=null)},{immediate:!0});let y=null;t.watch(()=>a.revision.value,()=>{o.open&&(y&&clearTimeout(y),y=setTimeout(()=>void m(),500))}),t.watch(()=>a.reloadRequest.value,()=>{o.open&&m()});const _=t.computed(()=>new Map(a.state.logical.entities.map(ie=>[ie.modelId,ie]))),g=t.computed(()=>new Map(a.state.logical.associations.map(ie=>[ie.modelId,ie]))),b=t.computed(()=>{const ie=a.userLanguage.value;return new Map((a.state.logical.groups??[]).map(Se=>{var je,Ze;return[Se.modelId,Se.packageName||((je=Se.name)==null?void 0:je[ie])||((Ze=Se.name)==null?void 0:Ze.ko)||Se.modelId]}))});function E(ie){var J,re,Ke,st,qe,nt,We;const Se=g.value.get(ie);if(!Se)return a.t("em.history.assocFallback");if((J=Se.description)!=null&&J.trim())return Se.description.trim();const je=(st=(Ke=_.value.get((re=Se.end1)==null?void 0:re.entityRef))==null?void 0:Ke.name)==null?void 0:st.trim(),Ze=(We=(nt=_.value.get((qe=Se.end2)==null?void 0:qe.entityRef))==null?void 0:nt.name)==null?void 0:We.trim();return je&&Ze?`${je}→${Ze}`:a.t("em.history.assocFallback")}function h(ie){var Se,je,Ze,J;if(ie.kind==="entity")return((je=(Se=_.value.get(ie.ref))==null?void 0:Se.name)==null?void 0:je.trim())||a.t("em.attr.nameless");if(ie.kind==="attribute"||ie.kind==="operation"||ie.kind==="index"){const re=ie.entityRef?_.value.get(ie.entityRef):void 0,st=((ie.kind==="attribute"?re==null?void 0:re.attributes:ie.kind==="operation"?re==null?void 0:re.operations:re==null?void 0:re.indexes)??[]).find(nt=>nt.modelId===ie.ref),qe=(Ze=re==null?void 0:re.name)==null?void 0:Ze.trim();return`${qe?qe+".":""}${((J=st==null?void 0:st.name)==null?void 0:J.trim())||ie.ref}`}return ie.kind==="association"?E(ie.ref):ie.kind==="associationEnd"?`${E(ie.ref)}(${ie.end})`:ie.kind==="group"?a.t("em.history.groupSubject",{name:b.value.get(ie.ref)??ie.ref}):ie.ref}const N={entity:"table",attribute:"field",operation:"method",index:"key",association:"link",associationEnd:"link",group:"folder"},w={add:"em.history.verbAdd",update:"em.history.verbUpdate",remove:"em.history.verbRemove"},C=t.ref("all"),S=[{v:"all",labelKey:"em.history.filterAll"},{v:"edit",labelKey:"em.history.kindEdit"},{v:"restore",labelKey:"em.history.kindRestore"}],V=t.computed({get:()=>C.value,set:ie=>{ie&&(C.value=ie)}}),$=t.computed(()=>gl(r.value)),R=t.computed(()=>$.value.length?$.value[0].seq:null),x=t.computed(()=>C.value==="all"?$.value:$.value.filter(ie=>(ie.kind??"edit")===C.value)),T=t.ref(Tr),M=t.ref(""),k=t.ref(""),v=t.computed(()=>!!M.value||!!k.value);function I(){M.value="",k.value=""}const O=t.computed(()=>{const ie=M.value?new Date(`${M.value}T00:00:00`).getTime():null,Se=k.value?new Date(`${k.value}T23:59:59.999`).getTime():null;return ie==null&&Se==null?x.value:x.value.filter(je=>{if(je.ts==null)return!1;const Ze=new Date(je.ts).getTime();return!(isNaN(Ze)||ie!=null&&Ze<ie||Se!=null&&Ze>Se)})}),A=t.computed(()=>O.value.slice(0,T.value)),L=t.computed(()=>Math.max(0,O.value.length-T.value));function H(){T.value+=Tr}t.watch([C,M,k],()=>{T.value=Tr}),t.watch(()=>o.open,ie=>{ie&&(T.value=Tr,I())});function oe(ie){return ie===void 0?"—":ie===null?a.t("em.history.emptyValue"):typeof ie=="object"?JSON.stringify(ie):String(ie)}function ue(ie){const Se=h(ie.subject);if(ie.verb==="add")return a.t("em.history.summaryAdd",{name:Se});if(ie.verb==="remove")return a.t("em.history.summaryRemove",{name:Se});if(ie.fields.length===1){const je=ie.fields[0];return`${Se}.${je.field} ${je.oldValue!==void 0?oe(je.oldValue)+"→":""}${oe(je.value)}`}return a.t("em.history.summaryFields",{name:Se,n:ie.fields.length})}function be(ie){return ie.actions.length===0?a.t("em.history.noChange"):ie.actions.length===1?ue(ie.actions[0]):a.t("em.history.summaryMore",{summary:ue(ie.actions[0]),n:ie.actions.length-1})}const pe=t.ref(new Set);function he(ie){const Se=new Set(pe.value);Se.has(ie)?Se.delete(ie):Se.add(ie),pe.value=Se}function _e(ie){if(ie==null)return"";const Se=new Date(ie);return isNaN(Se.getTime())?String(ie):Se.toLocaleString()}function ye(ie){const Se=ie.author,je=ie.origin;return Se&&je?`${Se}(${je})`:Se||(je?`(${je})`:"—")}const Ae=t.computed(()=>p.value==null?null:bl(r.value,{fromSeq:p.value,...f.value!=null?{toSeq:f.value}:{}}));t.watch(()=>Ae.value?sd(Ae.value):null,ie=>i("diffChange",ie));function Fe(ie){p.value=ie,f.value=null,X.value=null}function se(){p.value=null,f.value=null}const ne=t.computed(()=>$.value.map(ie=>ie.seq)),ae=t.computed(()=>R.value??1/0),me=t.computed(()=>f.value??ae.value),P=t.computed(()=>f.value??ae.value),D=t.computed(()=>ne.value.filter(ie=>ie<me.value).map(ie=>({v:ie}))),z=t.computed(()=>ne.value.filter(ie=>p.value!=null&&ie>p.value).map(ie=>({v:ie})));function Q(ie){ie!=null&&(p.value=ie,f.value!=null&&f.value<=ie&&(f.value=null))}function ee(ie){ie!=null&&(f.value=ie>=ae.value?null:ie)}function we(ie){return ie>=ae.value?a.t("em.history.diff.current"):`#${ie}`}function de(ie){return ie.kind==="entity"?_.value.has(ie.ref)?ie.ref:null:(ie.kind==="attribute"||ie.kind==="operation"||ie.kind==="index")&&ie.entityRef?_.value.has(ie.entityRef)?ie.entityRef:null:ie.kind==="group"&&b.value.has(ie.ref)?ie.ref:null}function xe(ie){const Se=de(ie);Se&&a.requestFocus(Se)}const Ce={added:"em.history.verbAdd",modified:"em.history.verbUpdate",removed:"em.history.verbRemove"},Y={added:"add",modified:"update",removed:"remove"},X=t.ref(null),q=t.ref(!1),Ie=t.computed(()=>X.value==null?null:bl(r.value,{fromSeq:X.value})),Be=t.ref(!1);function ze(ie){X.value=ie,Be.value=!1}async function Ue(ie){q.value=!0;try{const Se=await a.restoreToSeq(ie);Se.ok?(p.value=null,f.value=null):s.value=a.t("em.history.restoreFailed",{reason:Se.reason??a.t("em.history.unknown")})}finally{q.value=!1,X.value=null}}return(ie,Se)=>(t.openBlock(),t.createBlock(t.Transition,{name:"em-history"},{default:t.withCtx(()=>{var je,Ze;return[t.withDirectives(t.createElementVNode("section",CB,[t.createElementVNode("header",SB,[t.createElementVNode("div",xB,[t.createVNode(Ve,{name:"undo",size:15}),t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.history.title")),1)]),t.createElementVNode("div",RB,[t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.history.refresh"),disabled:l.value,onClick:Se[0]||(Se[0]=J=>u({full:!0}))},[t.createVNode(Ve,{name:"redo",size:15})],8,AB),t.createElementVNode("button",{type:"button",class:"em-history__btn",title:t.unref(a).t("em.common.close"),onClick:Se[1]||(Se[1]=J=>i("close"))},[t.createVNode(Ve,{name:"panel-close",size:15})],8,$B)])]),t.createElementVNode("div",TB,[t.createElementVNode("label",MB,[t.createElementVNode("span",null,t.toDisplayString(t.unref(a).t("em.toolbar.displayLabel")),1),t.createVNode(t.unref(te.BSSelect),{modelValue:V.value,"onUpdate:modelValue":Se[2]||(Se[2]=J=>V.value=J),items:S,"value-provider":J=>J.v,"label-provider":J=>t.unref(a).t(J.labelKey)},null,8,["modelValue","value-provider","label-provider"])])]),t.createElementVNode("div",VB,[t.createElementVNode("span",BB,t.toDisplayString(t.unref(a).t("em.history.periodLabel")),1),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodFrom"),"aria-label":t.unref(a).t("em.history.periodFrom"),max:k.value||void 0,"onUpdate:modelValue":Se[3]||(Se[3]=J=>M.value=J)},null,8,DB),[[t.vModelText,M.value]]),Se[9]||(Se[9]=t.createElementVNode("span",{class:"em-history__period-sep"},"~",-1)),t.withDirectives(t.createElementVNode("input",{type:"date",class:"em-history__date",title:t.unref(a).t("em.history.periodTo"),"aria-label":t.unref(a).t("em.history.periodTo"),min:M.value||void 0,"onUpdate:modelValue":Se[4]||(Se[4]=J=>k.value=J)},null,8,OB),[[t.vModelText,k.value]]),v.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-history__period-reset",title:t.unref(a).t("em.history.periodReset"),onClick:I},[t.createVNode(Ve,{name:"x",size:12})],8,LB)):t.createCommentVNode("",!0)]),p.value!=null?(t.openBlock(),t.createElementBlock("div",PB,[t.createElementVNode("div",zB,[t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":p.value??void 0,items:D.value,"value-provider":J=>J.v,"label-provider":J=>`#${J.v}`,"onUpdate:modelValue":Se[5]||(Se[5]=J=>Q(J??null))},null,8,["model-value","items","value-provider","label-provider"]),t.createVNode(Ve,{name:"arrow-lr",size:12,class:"em-history__diffbar-arrow"}),t.createVNode(t.unref(te.BSSelect),{class:"em-history__range-sel","model-value":P.value,items:z.value,"value-provider":J=>J.v,"label-provider":J=>we(J.v),"onUpdate:modelValue":Se[6]||(Se[6]=J=>ee(J??null))},null,8,["model-value","items","value-provider","label-provider"])]),t.createElementVNode("span",FB,t.toDisplayString(t.unref(a).t("em.history.diff.count",{n:((je=Ae.value)==null?void 0:je.entries.length)??0})),1),t.createElementVNode("button",{type:"button",class:"em-history__diffbar-exit",onClick:se},t.toDisplayString(t.unref(a).t("em.history.diff.exit")),1)])):t.createCommentVNode("",!0),t.createElementVNode("div",UB,[p.value!=null?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(Ze=Ae.value)!=null&&Ze.entries.length?(t.openBlock(),t.createElementBlock("ul",jB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ae.value.entries,(J,re)=>(t.openBlock(),t.createElementBlock("li",{key:re,class:t.normalizeClass(["em-history__diff-entry",{"is-focusable":!!de(J.subject)}]),onClick:Ke=>xe(J.subject)},[t.createElementVNode("div",GB,[t.createVNode(Ve,{name:N[J.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",YB,t.toDisplayString(h(J.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Y[J.verb]}`])},t.toDisplayString(t.unref(a).t(Ce[J.verb])),3)]),J.fields.length?(t.openBlock(),t.createElementBlock("ul",qB,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.fields,(Ke,st)=>(t.openBlock(),t.createElementBlock("li",{key:st,class:"em-history__field"},[t.createElementVNode("span",WB,t.toDisplayString(Ke.field),1),Ke.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",JB,t.toDisplayString(oe(Ke.oldValue)),1)):t.createCommentVNode("",!0),Ke.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",XB,t.toDisplayString(oe(Ke.value)),1)]))),128))])):t.createCommentVNode("",!0)],10,KB))),128))])):(t.openBlock(),t.createElementBlock("p",HB,t.toDisplayString(t.unref(a).t("em.history.diff.empty")),1))],64)):l.value&&!c.value?(t.openBlock(),t.createElementBlock("p",ZB,t.toDisplayString(t.unref(a).t("em.history.loading")),1)):s.value?(t.openBlock(),t.createElementBlock("p",QB,t.toDisplayString(s.value),1)):O.value.length===0?(t.openBlock(),t.createElementBlock("p",eD,t.toDisplayString(c.value?t.unref(a).t("em.history.emptyLoaded"):t.unref(a).t("em.history.emptyNotLoaded")),1)):(t.openBlock(),t.createElementBlock("ul",tD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(A.value,J=>{var re,Ke,st;return t.openBlock(),t.createElementBlock("li",{key:J.seq,class:t.normalizeClass(["em-history__group",[`is-${J.kind??"edit"}`]])},[t.createElementVNode("div",{class:"em-history__ghead",onClick:qe=>he(J.seq)},[t.createVNode(Ve,{name:"chevron",size:13,class:t.normalizeClass(["em-history__chevron",{"is-open":pe.value.has(J.seq)}])},null,8,["class"]),t.createElementVNode("span",{class:t.normalizeClass(["em-history__kind",`is-${J.kind??"edit"}`])},t.toDisplayString(t.unref(a).t(J.kind==="restore"?"em.history.kindRestore":"em.history.kindEdit")),3),t.createElementVNode("span",oD,t.toDisplayString(be(J)),1),t.createElementVNode("span",iD,"#"+t.toDisplayString(J.seq),1)],8,nD),t.createElementVNode("div",aD,[t.createElementVNode("span",rD,t.toDisplayString(ye(J)),1),J.ts?(t.openBlock(),t.createElementBlock("span",lD,t.toDisplayString(_e(J.ts)),1)):t.createCommentVNode("",!0),J.kind==="restore"&&J.restoredFromSeq!=null?(t.openBlock(),t.createElementBlock("span",sD,"← #"+t.toDisplayString(J.restoredFromSeq),1)):t.createCommentVNode("",!0),J.seq!==R.value?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"em-history__compare-btn",onClick:t.withModifiers(qe=>Fe(J.seq),["stop"])},t.toDisplayString(t.unref(a).t("em.history.diff.compare")),9,cD)):t.createCommentVNode("",!0)]),pe.value.has(J.seq)?(t.openBlock(),t.createElementBlock("div",dD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(J.actions,(qe,nt)=>(t.openBlock(),t.createElementBlock("div",{key:nt,class:"em-history__action"},[t.createElementVNode("div",uD,[t.createVNode(Ve,{name:N[qe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",mD,t.toDisplayString(h(qe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${qe.verb}`])},t.toDisplayString(t.unref(a).t(w[qe.verb])),3)]),qe.fields.length?(t.openBlock(),t.createElementBlock("ul",fD,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(qe.fields,(We,K)=>(t.openBlock(),t.createElementBlock("li",{key:K,class:"em-history__field"},[t.createElementVNode("span",pD,t.toDisplayString(We.field),1),We.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",hD,t.toDisplayString(oe(We.oldValue)),1)):t.createCommentVNode("",!0),We.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",yD,t.toDisplayString(oe(We.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0),t.unref(a).restoreAvailable.value&&J.seq!==R.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["em-history__restore",{"is-confirming":X.value===J.seq}])},[X.value===J.seq?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",gD,[t.createElementVNode("button",{type:"button",class:"em-history__preview-toggle",disabled:!((re=Ie.value)!=null&&re.entries.length),onClick:Se[7]||(Se[7]=qe=>Be.value=!Be.value)},[t.createVNode(Ve,{name:"chevron",size:11,class:t.normalizeClass(["em-history__chevron",{"is-open":Be.value}])},null,8,["class"]),t.createTextVNode(" "+t.toDisplayString((Ke=Ie.value)!=null&&Ke.entries.length?t.unref(a).t("em.history.diff.restorePreview",{n:Ie.value.entries.length}):t.unref(a).t("em.history.diff.restorePreviewNone")),1)],8,bD),Be.value&&((st=Ie.value)!=null&&st.entries.length)?(t.openBlock(),t.createElementBlock("ul",_D,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ie.value.entries,(qe,nt)=>(t.openBlock(),t.createElementBlock("li",{key:nt,class:"em-history__diff-entry"},[t.createElementVNode("div",kD,[t.createVNode(Ve,{name:N[qe.subject.kind],size:12},null,8,["name"]),t.createElementVNode("span",ED,t.toDisplayString(h(qe.subject)),1),t.createElementVNode("span",{class:t.normalizeClass(["em-history__verb",`is-${Y[qe.verb]}`])},t.toDisplayString(t.unref(a).t(Ce[qe.verb])),3)]),qe.fields.length?(t.openBlock(),t.createElementBlock("ul",ND,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(qe.fields,(We,K)=>(t.openBlock(),t.createElementBlock("li",{key:K,class:"em-history__field"},[t.createElementVNode("span",wD,t.toDisplayString(We.field),1),We.oldValue!==void 0?(t.openBlock(),t.createElementBlock("span",ID,t.toDisplayString(oe(We.oldValue)),1)):t.createCommentVNode("",!0),We.oldValue!==void 0?(t.openBlock(),t.createBlock(Ve,{key:1,name:"arrow-lr",size:10,class:"em-history__arrow"})):t.createCommentVNode("",!0),t.createElementVNode("span",vD,t.toDisplayString(oe(We.value)),1)]))),128))])):t.createCommentVNode("",!0)]))),128))])):t.createCommentVNode("",!0)]),t.createElementVNode("div",CD,[t.createElementVNode("span",SD,t.toDisplayString(t.unref(a).t("em.history.confirmRestore")),1),t.createElementVNode("button",{type:"button",class:"em-history__confirm-yes",disabled:q.value,onClick:qe=>Ue(J.seq)},t.toDisplayString(t.unref(a).t("em.history.doRestore")),9,xD),t.createElementVNode("button",{type:"button",class:"em-history__confirm-no",disabled:q.value,onClick:Se[8]||(Se[8]=qe=>X.value=null)},t.toDisplayString(t.unref(a).t("em.history.cancel")),9,RD)])],64)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"em-history__restore-btn",onClick:qe=>ze(J.seq)},[t.createVNode(Ve,{name:"undo",size:12}),t.createTextVNode(" "+t.toDisplayString(t.unref(a).t("em.history.restoreToHere")),1)],8,AD))],2)):t.createCommentVNode("",!0)],2)}),128))])),p.value==null&&L.value>0?(t.openBlock(),t.createElementBlock("button",{key:5,type:"button",class:"em-history__load-more",onClick:H},t.toDisplayString(t.unref(a).t("em.history.loadMore",{n:L.value})),1)):t.createCommentVNode("",!0)])],512),[[t.vShow,e.open]])]}),_:1}))}}),[["__scopeId","data-v-471d6cf8"]]);function TD(e,n){if(!e||typeof window>"u"||!window.localStorage)return null;const o=window.localStorage.getItem(e),i=o==null?NaN:Number(o);return Number.isFinite(i)&&i>=n?i:null}function Dh(e){const n=t.ref(TD(e.storageKey,e.min)??e.initial),o=t.ref(!1);function i(a){a.preventDefault();const r=a.clientX,l=n.value;o.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const s=d=>{const u=e.edge==="left"?r-d.clientX:d.clientX-r;let m=l+u;m=Math.max(e.min,m),e.max!=null&&(m=Math.min(e.max,m)),n.value=m},c=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",c),document.body.style.cursor="",document.body.style.userSelect="",o.value=!1,e.storageKey&&typeof window<"u"&&window.localStorage&&window.localStorage.setItem(e.storageKey,String(n.value))};window.addEventListener("pointermove",s),window.addEventListener("pointerup",c)}return{width:n,dragging:o,startResize:i}}const MD={class:"em-modeler"},VD={class:"em-modeler__body"},BD={class:"em-drawer__inner"},DD={class:"em-drawer__head"},OD={class:"em-drawer__actions"},LD=["title"],PD=["title"],zD=["title"],FD=["title"],UD=["title"],HD=tt(t.defineComponent({__name:"EntityModeler",props:{controller:{}},setup(e){const n=t.ref(!0),o=t.ref(!0),i=t.ref(null),a=t.ref(null),r=t.ref(null),l=t.ref(null);function s(N){t.nextTick(()=>{const w=N();w&&("focusCollapse"in w?w.focusCollapse():w.focus())})}function c(N){n.value=N,s(()=>N?i.value:a.value)}function d(N){o.value=N,s(()=>N?l.value:r.value)}const u=t.ref(!1),m=t.shallowRef(null),{width:p,dragging:f,startResize:y}=Dh({initial:260,min:260,max:560,edge:"right",storageKey:"em.explorerWidth"}),{width:_,dragging:g,startResize:b}=Dh({initial:320,min:320,max:640,edge:"left",storageKey:"em.panelWidth"}),E=t.ref(null),h=t.ref(null);return(N,w)=>{var C,S,V;return t.openBlock(),t.createElementBlock("div",MD,[t.createVNode(Vh,{controller:e.controller,"history-open":u.value,onExportSvg:w[0]||(w[0]=$=>{var R;return(R=E.value)==null?void 0:R.exportSvg()}),onExportPng:w[1]||(w[1]=$=>{var R;return(R=E.value)==null?void 0:R.exportPng()}),onToggleHistory:w[2]||(w[2]=$=>u.value=!u.value)},null,8,["controller","history-open"]),t.createElementVNode("div",VD,[t.createElementVNode("aside",{class:t.normalizeClass(["em-drawer",{"is-collapsed":!n.value}]),style:t.normalizeStyle({width:t.unref(p)+"px"})},[t.createElementVNode("div",BD,[t.createElementVNode("header",DD,[w[11]||(w[11]=t.createElementVNode("span",null,"Diagram Explorer",-1)),t.createElementVNode("div",OD,[(C=h.value)!=null&&C.hasExpandable?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"em-drawer__btn",title:e.controller.t((S=h.value)!=null&&S.allExpanded?"em.panel.collapseAll":"em.panel.expandAll"),onClick:w[3]||(w[3]=$=>{var R;return(R=h.value)==null?void 0:R.toggleAll()})},[t.createVNode(Ve,{name:(V=h.value)!=null&&V.allExpanded?"collapse-all":"expand-all",size:16},null,8,["name"])],8,LD)):t.createCommentVNode("",!0),t.createElementVNode("button",{ref_key:"explorerCollapseBtn",ref:i,type:"button",class:"em-drawer__btn",title:e.controller.t("em.panel.collapse"),onClick:w[4]||(w[4]=$=>c(!1))},[t.createVNode(Ve,{name:"panel-close",size:16})],8,PD)])]),t.createVNode(Mh,{ref_key:"explorer",ref:h,controller:e.controller,"storage-key":"em.explorerCollapsed"},null,8,["controller"])]),t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["em-resize-handle em-resize-handle--right",{"is-dragging":t.unref(f)}]),title:e.controller.t("em.panel.resizeWidth"),onPointerdown:w[5]||(w[5]=(...$)=>t.unref(y)&&t.unref(y)(...$))},null,42,zD),[[t.vShow,n.value]])],6),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"explorerReopenBtn",ref:a,class:"em-drawer__reopen",title:e.controller.t("em.panel.openNamed",{name:"Diagram Explorer"}),onClick:w[6]||(w[6]=$=>c(!0))},[t.createVNode(Ve,{name:"panel-open",size:18})],8,FD),[[t.vShow,!n.value]])]),_:1}),t.createElementVNode("div",{class:t.normalizeClass(["em-modeler__canvas",{"is-drawer-open":n.value,"is-resizing":t.unref(f),"is-inspector-collapsed":!o.value}]),style:t.normalizeStyle({"--em-drawer-shift":t.unref(p)-6+"px"})},[t.createVNode(Th,{ref_key:"canvas",ref:E,controller:e.controller,"diff-marks":m.value,"embed-collapse-storage-key":"em.embedCollapsed"},null,8,["controller","diff-marks"])],6),t.withDirectives(t.createVNode(Bh,{ref_key:"inspectorRef",ref:l,controller:e.controller,width:t.unref(_),resizing:t.unref(g),"start-resize":t.unref(b),onCollapse:w[7]||(w[7]=$=>d(!1))},null,8,["controller","width","resizing","start-resize"]),[[t.vShow,o.value]]),t.createVNode(t.Transition,{name:"em-reopen"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("button",{type:"button",ref_key:"inspectorReopenBtn",ref:r,class:"em-panel__reopen",title:e.controller.t("em.panel.openNamed",{name:"Inspector"}),onClick:w[8]||(w[8]=$=>d(!0))},[t.createVNode(Ve,{name:"panel-right-open",size:18})],8,UD),[[t.vShow,!o.value]])]),_:1}),t.createVNode($D,{controller:e.controller,open:u.value,onClose:w[9]||(w[9]=$=>u.value=!1),onDiffChange:w[10]||(w[10]=$=>m.value=$)},null,8,["controller","open"])]),t.createVNode(vB,{controller:e.controller,"panel-width":t.unref(_),"inspector-open":o.value},null,8,["controller","panel-width","inspector-open"])])}}}),[["__scopeId","data-v-1e5c0922"]]);Ne.APPLY_MODEL_OPS_INPUT_SCHEMA=Gb,Ne.AssociationEdge=$p,Ne.CUSTOM_TYPE_VALUE=hn,Ne.CommandStack=_l,Ne.DEFAULT_JAVA_TYPE=Gr,Ne.DIAGRAM_JSON_FORMAT=Jr,Ne.DIAGRAM_JSON_VERSION=Xr,Ne.DiagramCanvas=Th,Ne.DiagramExplorer=Mh,Ne.EDITOR=po,Ne.EditModeToggle=p2,Ne.EditorToolbar=Vh,Ne.EntityModeler=HD,Ne.EntityNode=sp,Ne.GROUP_CODE_ENUM_VALUE=Yn,Ne.GroupNode=cp,Ne.INHERITED_REF_PREFIX=qi,Ne.InvalidDiagramJsonError=Wn,Ne.JAVA_TYPES=ii,Ne.NoteNode=dp,Ne.OpSyncAdapter=Qd,Ne.PHYSICAL_NAME_MAX_LENGTH=ri,Ne.PropertyPanel=Bh,Ne.RevCache=Zd,Ne.SELECTABLE_JAVA_TYPES=bc,Ne.SYMBOLIC_OP_KINDS=eu,Ne.SYMBOLIC_OP_SCHEMA=_u,Ne.UI_LOCALES=fI,Ne.applyDocumentReferenceOnly=zr,Ne.buildAgentBatch=Yb,Ne.buildDiagramSvg=js,Ne.buildDiffMarks=sd,Ne.collectSharedColumns=$n,Ne.commands=Qg,Ne.computeAutoLayout=qs,Ne.createEditorController=tS,Ne.dedupeModelIds=Sg,Ne.defaultMermaidDialect=Xh,Ne.defaultSqlDialect=Ry,Ne.diagramToJson=xc,Ne.displayLabel=Ji,Ne.emptyState=Wf,Ne.entityModelToDdl=Cc,Ne.entityModelToMermaid=Fr,Ne.entityModelToText=lc,Ne.exportDiagramPng=Ah,Ne.exportDiagramSvg=Rh,Ne.fromPersisted=Ru,Ne.isGeneratable=Uc,Ne.isInheritedColumnRef=jn,Ne.javaTypeLabel=wo,Ne.makeInheritedColumnRef=Xs,Ne.mergeDiagram=nd,Ne.mermaidErToImportSource=Ec,Ne.migrateLegacyMoney=Cg,Ne.multiplicityLabel=ea,Ne.newId=Pe,Ne.packEntityBoxes=Vr,Ne.parseDiagramJson=Rc,Ne.parseInheritedColumnRef=Br,Ne.parseMermaidEr=kc,Ne.parseSqlDdl=qr,Ne.planHealBackfillOps=S_,Ne.projectActionLog=gl,Ne.projectEntityAudit=rd,Ne.projectFieldAudit=Tn,Ne.projectInheritedColumns=Qo,Ne.projectSeqDiff=bl,Ne.renderDiagramSvg=$c,Ne.resolveColumnPhysicalName=ni,Ne.resolveDiagram=Ys,Ne.resolveEffectiveColumn=pn,Ne.resolveQuickFix=ol,Ne.resolveSharedColumn=Gn,Ne.resolveSymbolicOps=Sb,Ne.restoreDeepEqual=Jn,Ne.scaffoldEntityJava=ng,Ne.sharedColumnScopeEntities=Lr,Ne.sqlDdlToImportSource=vc,Ne.stereotypeLabel=ei,Ne.synthesizeRestoreOps=Pg,Ne.toPersisted=I_,Ne.toPersistedV2=v_,Ne.translate=qt,Ne.uiMessagesEn=Bf,Ne.uiMessagesJa=Df,Ne.uiMessagesKo=Of,Ne.validateModel=sa,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));
|